import { mapStores as pet } from "pinia";
import { u as Tet, w as fet, h as Qet, U as met, G as get, q as yet } from "./index-DsKXfcyp.js";
import { ref as Ve, defineComponent as mr, computed as Kt, openBlock as le, createElementBlock as Ye, mergeProps as rl, unref as yt, renderSlot as kr, watch as on, nextTick as i1, provide as G1, reactive as u3, onActivated as vet, onMounted as Z1, onUpdated as _et, normalizeClass as Be, createElementVNode as je, normalizeStyle as E1, createBlock as Ar, resolveDynamicComponent as Ss, withCtx as fe, createCommentVNode as Br, inject as ln, onBeforeUnmount as Rs, withDirectives as Ti, cloneVNode as bet, Fragment as to, Text as Zj, Comment as Let, createVNode as Pe, toRef as K2, Transition as cd, vShow as zo, readonly as Wj, onDeactivated as wet, toDisplayString as fi, useSlots as pg, isRef as g2, withModifiers as m1, vModelCheckbox as kQ, createTextVNode as xn, toRefs as s0, vModelRadio as qj, h as b7, createSlots as Xj, getCurrentInstance as $1, markRaw as jo, shallowRef as VQ, warn as xet, watchEffect as Kj, onBeforeMount as Met, onUnmounted as Eet, toRaw as Ph, getCurrentScope as Yj, onScopeDispose as XE, Teleport as Het, resolveComponent as xs, resolveDirective as Aet, toHandlerKey as Cet, renderList as t3, withKeys as au, vModelText as Oet, createApp as Pet, hasInjectionContext as ket, effectScope as Vet, isReactive as KE, pushScopeId as YE, popScopeId as JE, createStaticVNode as Iet } from "vue";
const Ret = function(t) {
return t ? [...new Set(t.map((e) => JSON.stringify(e)))].map(
(e) => JSON.parse(e)
) : [];
}, F$t = {
computed: {
...pet(Tet)
},
methods: {
flatmapPanZoomCallback: function(t) {
if (this.mouseHovered) {
const e = {
paneIndex: this.entry.id,
eventType: "panZoom",
payload: t,
type: this.entry.type
};
this.$emit("resource-selected", e);
}
},
/**
* Function used for updating the flatmap markers.
* We set the markers based on what was searched and the flatmap clusters them.
*/
flatmapMarkerUpdate(t) {
if (!this.flatmapReady) return;
let e = t;
if (e || (e = this.getFlatmapImp()), e) {
let r = this.settingsStore.markers;
r = Ret(r);
let n = this.removeMarkersNotOnFlatmap(e, r);
if (e.clearMarkers(), e.clearDatasetMarkers(), this.entry.resource === "FunctionalConnectivity") {
let i = [];
for (let o = 0; o < n.length; o++)
i = i.concat(n[o].terms);
e.addMarkers(Array.from(new Set(i)), { className: "standard-marker", cluster: !1 });
} else
e.addDatasetMarkers(n);
this.entry.type === "MultiFlatmap" && this.restoreFeaturedMarkers(e);
}
},
// removeMarkersNotOnFlatmap: rewrites the dataset marker list to only include markers that are on the flatmap
removeMarkersNotOnFlatmap(t, e) {
let r = t.anatomicalIdentifiers, n = [];
for (let i = 0; i < e.length; i++) {
let o = e[i], s = { id: o.id, terms: [] };
for (let a = 0; a < o.terms.length; a++)
r.includes(o.terms[a]) && s.terms.push(o.terms[a]);
n.push(s);
}
return n;
},
flatmapReadyForMarkerUpdates: function(t) {
if (t) {
t.enablePanZoomEvents(!0), this.flatmapReady = !0;
const e = t.mapImp;
this.flatmapMarkerUpdate(e);
}
}
}
}, s4 = (t, e, { checkForDefaultPrevented: r = !0 } = {}) => (n) => {
const i = t == null ? void 0 : t(n);
if (r === !1 || !i)
return e == null ? void 0 : e(n);
};
var uP;
const s1 = typeof window < "u", Net = (t) => typeof t == "string", Jj = () => {
}, sx = s1 && ((uP = window == null ? void 0 : window.navigator) == null ? void 0 : uP.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function tS(t) {
return typeof t == "function" ? t() : yt(t);
}
function Det(t) {
return t;
}
function ud(t) {
return Yj() ? (XE(t), !0) : !1;
}
function Fet(t, e = !0) {
$1() ? Z1(t) : e ? t() : i1(t);
}
function hP(t, e, r = {}) {
const {
immediate: n = !0
} = r, i = Ve(!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: Wj(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 (Net(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 dP = !1;
function Bet(t, e, r = {}) {
const { window: n = Tg, ignore: i = [], capture: o = !0, detectIframe: s = !1 } = r;
if (!n)
return;
sx && !dP && (dP = !0, Array.from(n.document.body.children).forEach((T) => T.addEventListener("click", Jj)));
let a = !0;
const u = (T) => i.some((f) => {
if (typeof f == "string")
return Array.from(n.document.querySelectorAll(f)).some((Q) => Q === T.target || T.composedPath().includes(Q));
{
const Q = f4(f);
return Q && (T.target === Q || T.composedPath().includes(Q));
}
}), d = [
ea(n, "click", (T) => {
const f = f4(t);
if (!(!f || f === T.target || T.composedPath().includes(f))) {
if (T.detail === 0 && (a = !u(T)), !a) {
a = !0;
return;
}
e(T);
}
}, { passive: !0, capture: o }),
ea(n, "pointerdown", (T) => {
const f = f4(t);
f && (a = !T.composedPath().includes(f) && !u(T));
}, { passive: !0 }),
s && ea(n, "blur", (T) => {
var f;
const Q = f4(t);
((f = n.document.activeElement) == null ? void 0 : f.tagName) === "IFRAME" && !(Q != null && Q.contains(n.document.activeElement)) && e(T);
})
].filter(Boolean);
return () => d.forEach((T) => T());
}
function tz(t, e = !1) {
const r = Ve(), n = () => r.value = !!t();
return n(), Fet(n, e), r;
}
const pP = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, TP = "__vueuse_ssr_handlers__";
pP[TP] = pP[TP] || {};
var fP = 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 && fP)
for (var n of fP(t))
e.indexOf(n) < 0 && zet.call(t, n) && (r[n] = t[n]);
return r;
};
function B6(t, e, r = {}) {
const n = r, { window: i = Tg } = n, o = Uet(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 QP = Object.getOwnPropertySymbols, Get = Object.prototype.hasOwnProperty, $et = Object.prototype.propertyIsEnumerable, Zet = (t, e) => {
var r = {};
for (var n in t)
Get.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]);
if (t != null && QP)
for (var n of QP(t))
e.indexOf(n) < 0 && $et.call(t, n) && (r[n] = t[n]);
return r;
};
function Wet(t, e, r = {}) {
const n = r, { window: i = Tg } = n, o = Zet(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 mP;
(function(t) {
t.UP = "UP", t.RIGHT = "RIGHT", t.DOWN = "DOWN", t.LEFT = "LEFT", t.NONE = "NONE";
})(mP || (mP = {}));
var qet = Object.defineProperty, gP = Object.getOwnPropertySymbols, Xet = Object.prototype.hasOwnProperty, Ket = Object.prototype.propertyIsEnumerable, yP = (t, e, r) => e in t ? qet(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Yet = (t, e) => {
for (var r in e || (e = {}))
Xet.call(e, r) && yP(t, r, e[r]);
if (gP)
for (var r of gP(e))
Ket.call(e, r) && yP(t, r, e[r]);
return t;
};
const Jet = {
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]
};
Yet({
linear: Det
}, Jet);
/**
* @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 O5 = () => {
}, trt = Object.prototype.hasOwnProperty, vP = (t, e) => trt.call(t, e), p2 = Array.isArray, Wo = (t) => typeof t == "function", sa = (t) => typeof t == "string", T2 = (t) => t !== null && typeof t == "object", ert = Object.prototype.toString, rrt = (t) => ert.call(t), hb = (t) => rrt(t).slice(8, -1), ez = (t) => {
const e = /* @__PURE__ */ Object.create(null);
return (r) => e[r] || (e[r] = t(r));
}, nrt = /-(\w)/g, irt = ez((t) => t.replace(nrt, (e, r) => r ? r.toUpperCase() : "")), ort = /\B([A-Z])/g, srt = ez(
(t) => t.replace(ort, "-$1").toLowerCase()
);
var rz = typeof global == "object" && global && global.Object === Object && global, art = typeof self == "object" && self && self.Object === Object && self, v3 = rz || art || Function("return this")(), h3 = v3.Symbol, nz = Object.prototype, lrt = nz.hasOwnProperty, crt = nz.toString, lu = h3 ? h3.toStringTag : void 0;
function urt(t) {
var e = lrt.call(t, lu), r = t[lu];
try {
t[lu] = void 0;
var n = !0;
} catch {
}
var i = crt.call(t);
return n && (e ? t[lu] = r : delete t[lu]), i;
}
var hrt = Object.prototype, drt = hrt.toString;
function prt(t) {
return drt.call(t);
}
var Trt = "[object Null]", frt = "[object Undefined]", _P = h3 ? h3.toStringTag : void 0;
function Y8(t) {
return t == null ? t === void 0 ? frt : Trt : _P && _P in Object(t) ? urt(t) : prt(t);
}
function _8(t) {
return t != null && typeof t == "object";
}
var Qrt = "[object Symbol]";
function fg(t) {
return typeof t == "symbol" || _8(t) && Y8(t) == Qrt;
}
function mrt(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, grt = 1 / 0, bP = h3 ? h3.prototype : void 0, LP = bP ? bP.toString : void 0;
function iz(t) {
if (typeof t == "string")
return t;
if (aa(t))
return mrt(t, iz) + "";
if (fg(t))
return LP ? LP.call(t) : "";
var e = t + "";
return e == "0" && 1 / t == -grt ? "-0" : e;
}
var yrt = /\s/;
function vrt(t) {
for (var e = t.length; e-- && yrt.test(t.charAt(e)); )
;
return e;
}
var _rt = /^\s+/;
function brt(t) {
return t && t.slice(0, vrt(t) + 1).replace(_rt, "");
}
function a0(t) {
var e = typeof t;
return t != null && (e == "object" || e == "function");
}
var wP = NaN, Lrt = /^[-+]0x[0-9a-f]+$/i, wrt = /^0b[01]+$/i, xrt = /^0o[0-7]+$/i, Mrt = parseInt;
function xP(t) {
if (typeof t == "number")
return t;
if (fg(t))
return wP;
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 = brt(t);
var r = wrt.test(t);
return r || xrt.test(t) ? Mrt(t.slice(2), r ? 2 : 8) : Lrt.test(t) ? wP : +t;
}
function oz(t) {
return t;
}
var Ert = "[object AsyncFunction]", Srt = "[object Function]", Hrt = "[object GeneratorFunction]", Art = "[object Proxy]";
function sz(t) {
if (!a0(t))
return !1;
var e = Y8(t);
return e == Srt || e == Hrt || e == Ert || e == Art;
}
var db = v3["__core-js_shared__"], MP = function() {
var t = /[^.]+$/.exec(db && db.keys && db.keys.IE_PROTO || "");
return t ? "Symbol(src)_1." + t : "";
}();
function Crt(t) {
return !!MP && MP in t;
}
var Ort = Function.prototype, Prt = Ort.toString;
function nl(t) {
if (t != null) {
try {
return Prt.call(t);
} catch {
}
try {
return t + "";
} catch {
}
}
return "";
}
var krt = /[\\^$.*+?()[\]{}|]/g, Vrt = /^\[object .+?Constructor\]$/, Irt = Function.prototype, Rrt = Object.prototype, Nrt = Irt.toString, Drt = Rrt.hasOwnProperty, Frt = RegExp(
"^" + Nrt.call(Drt).replace(krt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function Brt(t) {
if (!a0(t) || Crt(t))
return !1;
var e = sz(t) ? Frt : Vrt;
return e.test(nl(t));
}
function jrt(t, e) {
return t == null ? void 0 : t[e];
}
function il(t, e) {
var r = jrt(t, e);
return Brt(r) ? r : void 0;
}
var ax = il(v3, "WeakMap");
function zrt(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 Urt = 800, Grt = 16, $rt = Date.now;
function Zrt(t) {
var e = 0, r = 0;
return function() {
var n = $rt(), i = Grt - (n - r);
if (r = n, i > 0) {
if (++e >= Urt)
return arguments[0];
} else
e = 0;
return t.apply(void 0, arguments);
};
}
function Wrt(t) {
return function() {
return t;
};
}
var IQ = function() {
try {
var t = il(Object, "defineProperty");
return t({}, "", {}), t;
} catch {
}
}(), qrt = IQ ? function(t, e) {
return IQ(t, "toString", {
configurable: !0,
enumerable: !1,
value: Wrt(e),
writable: !0
});
} : oz, Xrt = Zrt(qrt);
function Krt(t, e, r, n) {
t.length;
for (var i = r + 1; i--; )
if (e(t[i], i, t))
return i;
return -1;
}
var Yrt = 9007199254740991, Jrt = /^(?:0|[1-9]\d*)$/;
function eS(t, e) {
var r = typeof t;
return e = e ?? Yrt, !!e && (r == "number" || r != "symbol" && Jrt.test(t)) && t > -1 && t % 1 == 0 && t < e;
}
function tnt(t, e, r) {
e == "__proto__" && IQ ? IQ(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 ent = Object.prototype, rnt = ent.hasOwnProperty;
function nnt(t, e, r) {
var n = t[e];
(!(rnt.call(t, e) && rS(n, r)) || r === void 0 && !(e in t)) && tnt(t, e, r);
}
var EP = Math.max;
function int(t, e, r) {
return e = EP(e === void 0 ? t.length - 1 : e, 0), function() {
for (var n = arguments, i = -1, o = EP(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), zrt(t, this, a);
};
}
var ont = 9007199254740991;
function nS(t) {
return typeof t == "number" && t > -1 && t % 1 == 0 && t <= ont;
}
function snt(t) {
return t != null && nS(t.length) && !sz(t);
}
var ant = Object.prototype;
function lnt(t) {
var e = t && t.constructor, r = typeof e == "function" && e.prototype || ant;
return t === r;
}
function cnt(t, e) {
for (var r = -1, n = Array(t); ++r < t; )
n[r] = e(r);
return n;
}
var unt = "[object Arguments]";
function SP(t) {
return _8(t) && Y8(t) == unt;
}
var az = Object.prototype, hnt = az.hasOwnProperty, dnt = az.propertyIsEnumerable, iS = SP(/* @__PURE__ */ function() {
return arguments;
}()) ? SP : function(t) {
return _8(t) && hnt.call(t, "callee") && !dnt.call(t, "callee");
};
function pnt() {
return !1;
}
var lz = typeof exports == "object" && exports && !exports.nodeType && exports, HP = lz && typeof module == "object" && module && !module.nodeType && module, Tnt = HP && HP.exports === lz, AP = Tnt ? v3.Buffer : void 0, fnt = AP ? AP.isBuffer : void 0, lx = fnt || pnt, Qnt = "[object Arguments]", mnt = "[object Array]", gnt = "[object Boolean]", ynt = "[object Date]", vnt = "[object Error]", _nt = "[object Function]", bnt = "[object Map]", Lnt = "[object Number]", wnt = "[object Object]", xnt = "[object RegExp]", Mnt = "[object Set]", Ent = "[object String]", Snt = "[object WeakMap]", Hnt = "[object ArrayBuffer]", Ant = "[object DataView]", Cnt = "[object Float32Array]", Ont = "[object Float64Array]", Pnt = "[object Int8Array]", knt = "[object Int16Array]", Vnt = "[object Int32Array]", Int = "[object Uint8Array]", Rnt = "[object Uint8ClampedArray]", Nnt = "[object Uint16Array]", Dnt = "[object Uint32Array]", Ei = {};
Ei[Cnt] = Ei[Ont] = Ei[Pnt] = Ei[knt] = Ei[Vnt] = Ei[Int] = Ei[Rnt] = Ei[Nnt] = Ei[Dnt] = !0;
Ei[Qnt] = Ei[mnt] = Ei[Hnt] = Ei[gnt] = Ei[Ant] = Ei[ynt] = Ei[vnt] = Ei[_nt] = Ei[bnt] = Ei[Lnt] = Ei[wnt] = Ei[xnt] = Ei[Mnt] = Ei[Ent] = Ei[Snt] = !1;
function Fnt(t) {
return _8(t) && nS(t.length) && !!Ei[Y8(t)];
}
function Bnt(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, jnt = th && th.exports === cz, pb = jnt && rz.process, CP = function() {
try {
var t = th && th.require && th.require("util").types;
return t || pb && pb.binding && pb.binding("util");
} catch {
}
}(), OP = CP && CP.isTypedArray, uz = OP ? Bnt(OP) : Fnt, znt = Object.prototype, Unt = znt.hasOwnProperty;
function Gnt(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 ? cnt(t.length, String) : [], u = a.length;
for (var d in t)
Unt.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 $nt(t, e) {
return function(r) {
return t(e(r));
};
}
var Znt = $nt(Object.keys, Object), Wnt = Object.prototype, qnt = Wnt.hasOwnProperty;
function Xnt(t) {
if (!lnt(t))
return Znt(t);
var e = [];
for (var r in Object(t))
qnt.call(t, r) && r != "constructor" && e.push(r);
return e;
}
function hz(t) {
return snt(t) ? Gnt(t) : Xnt(t);
}
var Knt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Ynt = /^\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 : Ynt.test(t) || !Knt.test(t) || e != null && t in Object(e);
}
var kh = il(Object, "create");
function Jnt() {
this.__data__ = kh ? kh(null) : {}, this.size = 0;
}
function tit(t) {
var e = this.has(t) && delete this.__data__[t];
return this.size -= e ? 1 : 0, e;
}
var eit = "__lodash_hash_undefined__", rit = Object.prototype, nit = rit.hasOwnProperty;
function iit(t) {
var e = this.__data__;
if (kh) {
var r = e[t];
return r === eit ? void 0 : r;
}
return nit.call(e, t) ? e[t] : void 0;
}
var oit = Object.prototype, sit = oit.hasOwnProperty;
function ait(t) {
var e = this.__data__;
return kh ? e[t] !== void 0 : sit.call(e, t);
}
var lit = "__lodash_hash_undefined__";
function cit(t, e) {
var r = this.__data__;
return this.size += this.has(t) ? 0 : 1, r[t] = kh && e === void 0 ? lit : 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 = Jnt;
j5.prototype.delete = tit;
j5.prototype.get = iit;
j5.prototype.has = ait;
j5.prototype.set = cit;
function uit() {
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 hit = Array.prototype, dit = hit.splice;
function pit(t) {
var e = this.__data__, r = Qg(e, t);
if (r < 0)
return !1;
var n = e.length - 1;
return r == n ? e.pop() : dit.call(e, r, 1), --this.size, !0;
}
function Tit(t) {
var e = this.__data__, r = Qg(e, t);
return r < 0 ? void 0 : e[r][1];
}
function fit(t) {
return Qg(this.__data__, t) > -1;
}
function Qit(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 O4(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]);
}
}
O4.prototype.clear = uit;
O4.prototype.delete = pit;
O4.prototype.get = Tit;
O4.prototype.has = fit;
O4.prototype.set = Qit;
var Vh = il(v3, "Map");
function mit() {
this.size = 0, this.__data__ = {
hash: new j5(),
map: new (Vh || O4)(),
string: new j5()
};
}
function git(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 git(e) ? r[typeof e == "string" ? "string" : "hash"] : r.map;
}
function yit(t) {
var e = mg(this, t).delete(t);
return this.size -= e ? 1 : 0, e;
}
function vit(t) {
return mg(this, t).get(t);
}
function _it(t) {
return mg(this, t).has(t);
}
function bit(t, e) {
var r = mg(this, t), n = r.size;
return r.set(t, e), this.size += r.size == n ? 0 : 1, this;
}
function P4(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]);
}
}
P4.prototype.clear = mit;
P4.prototype.delete = yit;
P4.prototype.get = vit;
P4.prototype.has = _it;
P4.prototype.set = bit;
var Lit = "Expected a function";
function sS(t, e) {
if (typeof t != "function" || e != null && typeof e != "function")
throw new TypeError(Lit);
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 || P4)(), r;
}
sS.Cache = P4;
var wit = 500;
function xit(t) {
var e = sS(t, function(n) {
return r.size === wit && r.clear(), n;
}), r = e.cache;
return e;
}
var Mit = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Eit = /\\(\\)?/g, Sit = xit(function(t) {
var e = [];
return t.charCodeAt(0) === 46 && e.push(""), t.replace(Mit, function(r, n, i, o) {
e.push(i ? o.replace(Eit, "$1") : n || r);
}), e;
});
function Hit(t) {
return t == null ? "" : iz(t);
}
function gg(t, e) {
return aa(t) ? t : oS(t, e) ? [t] : Sit(Hit(t));
}
var Ait = 1 / 0;
function hd(t) {
if (typeof t == "string" || fg(t))
return t;
var e = t + "";
return e == "0" && 1 / t == -Ait ? "-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 PP = h3 ? h3.isConcatSpreadable : void 0;
function Cit(t) {
return aa(t) || iS(t) || !!(PP && t && t[PP]);
}
function Oit(t, e, r, n, i) {
var o = -1, s = t.length;
for (r || (r = Cit), i || (i = []); ++o < s; ) {
var a = t[o];
r(a) ? dz(i, a) : i[i.length] = a;
}
return i;
}
function Pit(t) {
var e = t == null ? 0 : t.length;
return e ? Oit(t) : [];
}
function kit(t) {
return Xrt(int(t, void 0, Pit), t + "");
}
function Z6() {
if (!arguments.length)
return [];
var t = arguments[0];
return aa(t) ? t : [t];
}
function Vit() {
this.__data__ = new O4(), this.size = 0;
}
function Iit(t) {
var e = this.__data__, r = e.delete(t);
return this.size = e.size, r;
}
function Rit(t) {
return this.__data__.get(t);
}
function Nit(t) {
return this.__data__.has(t);
}
var Dit = 200;
function Fit(t, e) {
var r = this.__data__;
if (r instanceof O4) {
var n = r.__data__;
if (!Vh || n.length < Dit - 1)
return n.push([t, e]), this.size = ++r.size, this;
r = this.__data__ = new P4(n);
}
return r.set(t, e), this.size = r.size, this;
}
function v4(t) {
var e = this.__data__ = new O4(t);
this.size = e.size;
}
v4.prototype.clear = Vit;
v4.prototype.delete = Iit;
v4.prototype.get = Rit;
v4.prototype.has = Nit;
v4.prototype.set = Fit;
function Bit(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 jit() {
return [];
}
var zit = Object.prototype, Uit = zit.propertyIsEnumerable, kP = Object.getOwnPropertySymbols, Git = kP ? function(t) {
return t == null ? [] : (t = Object(t), Bit(kP(t), function(e) {
return Uit.call(t, e);
}));
} : jit;
function $it(t, e, r) {
var n = e(t);
return aa(t) ? n : dz(n, r(t));
}
function VP(t) {
return $it(t, hz, Git);
}
var cx = il(v3, "DataView"), ux = il(v3, "Promise"), hx = il(v3, "Set"), IP = "[object Map]", Zit = "[object Object]", RP = "[object Promise]", NP = "[object Set]", DP = "[object WeakMap]", FP = "[object DataView]", Wit = nl(cx), qit = nl(Vh), Xit = nl(ux), Kit = nl(hx), Yit = nl(ax), j6 = Y8;
(cx && j6(new cx(new ArrayBuffer(1))) != FP || Vh && j6(new Vh()) != IP || ux && j6(ux.resolve()) != RP || hx && j6(new hx()) != NP || ax && j6(new ax()) != DP) && (j6 = function(t) {
var e = Y8(t), r = e == Zit ? t.constructor : void 0, n = r ? nl(r) : "";
if (n)
switch (n) {
case Wit:
return FP;
case qit:
return IP;
case Xit:
return RP;
case Kit:
return NP;
case Yit:
return DP;
}
return e;
});
var BP = v3.Uint8Array, Jit = "__lodash_hash_undefined__";
function t1t(t) {
return this.__data__.set(t, Jit), this;
}
function e1t(t) {
return this.__data__.has(t);
}
function RQ(t) {
var e = -1, r = t == null ? 0 : t.length;
for (this.__data__ = new P4(); ++e < r; )
this.add(t[e]);
}
RQ.prototype.add = RQ.prototype.push = t1t;
RQ.prototype.has = e1t;
function r1t(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 n1t(t, e) {
return t.has(e);
}
var i1t = 1, o1t = 2;
function pz(t, e, r, n, i, o) {
var s = r & i1t, 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 & o1t ? new RQ() : void 0;
for (o.set(t, e), o.set(e, t); ++f < a; ) {
var b = t[f], w = e[f];
if (n)
var S = s ? n(w, b, f, e, t, o) : n(b, w, f, t, e, o);
if (S !== void 0) {
if (S)
continue;
Q = !1;
break;
}
if (y) {
if (!r1t(e, function(x, C) {
if (!n1t(y, C) && (b === x || i(b, x, r, n, o)))
return y.push(C);
})) {
Q = !1;
break;
}
} else if (!(b === w || i(b, w, r, n, o))) {
Q = !1;
break;
}
}
return o.delete(t), o.delete(e), Q;
}
function s1t(t) {
var e = -1, r = Array(t.size);
return t.forEach(function(n, i) {
r[++e] = [i, n];
}), r;
}
function a1t(t) {
var e = -1, r = Array(t.size);
return t.forEach(function(n) {
r[++e] = n;
}), r;
}
var l1t = 1, c1t = 2, u1t = "[object Boolean]", h1t = "[object Date]", d1t = "[object Error]", p1t = "[object Map]", T1t = "[object Number]", f1t = "[object RegExp]", Q1t = "[object Set]", m1t = "[object String]", g1t = "[object Symbol]", y1t = "[object ArrayBuffer]", v1t = "[object DataView]", jP = h3 ? h3.prototype : void 0, Tb = jP ? jP.valueOf : void 0;
function _1t(t, e, r, n, i, o, s) {
switch (r) {
case v1t:
if (t.byteLength != e.byteLength || t.byteOffset != e.byteOffset)
return !1;
t = t.buffer, e = e.buffer;
case y1t:
return !(t.byteLength != e.byteLength || !o(new BP(t), new BP(e)));
case u1t:
case h1t:
case T1t:
return rS(+t, +e);
case d1t:
return t.name == e.name && t.message == e.message;
case f1t:
case m1t:
return t == e + "";
case p1t:
var a = s1t;
case Q1t:
var u = n & l1t;
if (a || (a = a1t), t.size != e.size && !u)
return !1;
var d = s.get(t);
if (d)
return d == e;
n |= c1t, s.set(t, e);
var T = pz(a(t), a(e), n, i, o, s);
return s.delete(t), T;
case g1t:
if (Tb)
return Tb.call(t) == Tb.call(e);
}
return !1;
}
var b1t = 1, L1t = Object.prototype, w1t = L1t.hasOwnProperty;
function x1t(t, e, r, n, i, o) {
var s = r & b1t, a = VP(t), u = a.length, d = VP(e), T = d.length;
if (u != T && !s)
return !1;
for (var f = u; f--; ) {
var Q = a[f];
if (!(s ? Q in e : w1t.call(e, Q)))
return !1;
}
var y = o.get(t), b = o.get(e);
if (y && b)
return y == e && b == t;
var w = !0;
o.set(t, e), o.set(e, t);
for (var S = s; ++f < u; ) {
Q = a[f];
var x = t[Q], C = e[Q];
if (n)
var P = s ? n(C, x, Q, e, t, o) : n(x, C, Q, t, e, o);
if (!(P === void 0 ? x === C || i(x, C, r, n, o) : P)) {
w = !1;
break;
}
S || (S = Q == "constructor");
}
if (w && !S) {
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) && (w = !1);
}
return o.delete(t), o.delete(e), w;
}
var M1t = 1, zP = "[object Arguments]", UP = "[object Array]", $p = "[object Object]", E1t = Object.prototype, GP = E1t.hasOwnProperty;
function S1t(t, e, r, n, i, o) {
var s = aa(t), a = aa(e), u = s ? UP : j6(t), d = a ? UP : j6(e);
u = u == zP ? $p : u, d = d == zP ? $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) : _1t(t, e, u, r, n, i, o);
if (!(r & M1t)) {
var y = T && GP.call(t, "__wrapped__"), b = f && GP.call(e, "__wrapped__");
if (y || b) {
var w = y ? t.value() : t, S = b ? e.value() : e;
return o || (o = new v4()), i(w, S, r, n, o);
}
}
return Q ? (o || (o = new v4()), x1t(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 : S1t(t, e, r, n, yg, i);
}
var H1t = 1, A1t = 2;
function C1t(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, H1t | A1t, n, T) : f))
return !1;
}
}
return !0;
}
function Tz(t) {
return t === t && !a0(t);
}
function O1t(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 P1t(t) {
var e = O1t(t);
return e.length == 1 && e[0][2] ? fz(e[0][0], e[0][1]) : function(r) {
return r === t || C1t(r, t, e);
};
}
function k1t(t, e) {
return t != null && e in Object(t);
}
function V1t(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 && V1t(t, e, k1t);
}
var I1t = 1, R1t = 2;
function N1t(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, I1t | R1t);
};
}
function D1t(t) {
return function(e) {
return e == null ? void 0 : e[t];
};
}
function F1t(t) {
return function(e) {
return aS(e, t);
};
}
function B1t(t) {
return oS(t) ? D1t(hd(t)) : F1t(t);
}
function j1t(t) {
return typeof t == "function" ? t : t == null ? oz : typeof t == "object" ? aa(t) ? N1t(t[0], t[1]) : P1t(t) : B1t(t);
}
var fb = function() {
return v3.Date.now();
}, z1t = "Expected a function", U1t = Math.max, G1t = Math.min;
function $1t(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(z1t);
e = xP(e) || 0, a0(r) && (T = !!r.leading, f = "maxWait" in r, o = f ? U1t(xP(r.maxWait) || 0, e) : o, Q = "trailing" in r ? !!r.trailing : Q);
function y(U) {
var $ = n, rt = i;
return n = i = void 0, d = U, s = t.apply(rt, $), s;
}
function b(U) {
return d = U, a = setTimeout(x, e), T ? y(U) : s;
}
function w(U) {
var $ = U - u, rt = U - d, tt = e - $;
return f ? G1t(tt, o - rt) : tt;
}
function S(U) {
var $ = U - u, rt = U - d;
return u === void 0 || $ >= e || $ < 0 || f && rt >= o;
}
function x() {
var U = fb();
if (S(U))
return C(U);
a = setTimeout(x, w(U));
}
function C(U) {
return a = void 0, Q && n ? y(U) : (n = i = void 0, s);
}
function P() {
a !== void 0 && clearTimeout(a), d = 0, n = u = i = a = void 0;
}
function R() {
return a === void 0 ? s : C(fb());
}
function F() {
var U = fb(), $ = S(U);
if (n = arguments, i = this, u = U, $) {
if (a === void 0)
return b(u);
if (f)
return clearTimeout(a), a = setTimeout(x, e), y(u);
}
return a === void 0 && (a = setTimeout(x, e)), s;
}
return F.cancel = P, F.flush = R, F;
}
function Z1t(t, e, r) {
var n = t == null ? 0 : t.length;
if (!n)
return -1;
var i = n - 1;
return Krt(t, j1t(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 W1t(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]) ? [] : {});
}
nnt(a, u, d), a = a[u];
}
return t;
}
function q1t(t, e, r) {
for (var n = -1, i = e.length, o = {}; ++n < i; ) {
var s = e[n], a = aS(t, s);
r(a, s) && W1t(o, gg(s, t), a);
}
return o;
}
function X1t(t, e) {
return q1t(t, e, function(r, n) {
return Qz(t, n);
});
}
var gz = kit(function(t, e) {
return t == null ? {} : X1t(t, e);
});
const q6 = (t) => t === void 0, S4 = (t) => typeof t == "boolean", ro = (t) => typeof t == "number", P5 = (t) => typeof Element > "u" ? !1 : t instanceof Element, Ih = (t) => vg(t), K1t = (t) => sa(t) ? !Number.isNaN(Number(t)) : !1, Y1t = (t = "") => t.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"), $P = (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 J1t = "utils/dom/style", _z = (t = "") => t.split(" ").filter((e) => !!e.trim()), ZP = (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 = irt(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) || K1t(t))
return `${t}${e}`;
if (sa(t))
return t;
y2(J1t, "binding value must be a string or number");
}
let Zp;
const tot = (t) => {
var e;
if (!s1)
return 0;
if (Zp !== void 0)
return Zp;
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), Zp = n - o, Zp;
};
function eot(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 rot = /* @__PURE__ */ mr({
name: "ArrowDown",
__name: "arrow-down",
setup(t) {
return (e, r) => (le(), 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 = rot, not = /* @__PURE__ */ mr({
name: "ArrowLeft",
__name: "arrow-left",
setup(t) {
return (e, r) => (le(), 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 = not, iot = /* @__PURE__ */ mr({
name: "CircleCheck",
__name: "circle-check",
setup(t) {
return (e, r) => (le(), 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"
})
]));
}
}), oot = iot, sot = /* @__PURE__ */ mr({
name: "CircleClose",
__name: "circle-close",
setup(t) {
return (e, r) => (le(), 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 = sot, aot = /* @__PURE__ */ mr({
name: "Close",
__name: "close",
setup(t) {
return (e, r) => (le(), 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 = aot, lot = /* @__PURE__ */ mr({
name: "Loading",
__name: "loading",
setup(t) {
return (e, r) => (le(), 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 = lot, cot = /* @__PURE__ */ mr({
name: "WarningFilled",
__name: "warning-filled",
setup(t) {
return (e, r) => (le(), 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 = cot, uot = /* @__PURE__ */ mr({
name: "Warning",
__name: "warning",
setup(t) {
return (e, r) => (le(), 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"
})
]));
}
}), Mz = uot;
const Ez = "__epPropKey", Ur = (t) => t, hot = (t) => T2(t) && !!t[Ez], _g = (t, e) => {
if (!T2(t) || hot(t))
return t;
const { values: r, required: n, default: i, type: o, validator: s } = t, a = {
type: o,
required: !!n,
validator: r || s ? (u) => {
let d = !1, T = [];
if (r && (T = Array.from(r), vP(t, "default") && T.push(i), d || (d = T.includes(u))), s && (d || (d = s(u))), !d && T.length > 0) {
const f = [...new Set(T)].map((Q) => JSON.stringify(Q)).join(", ");
xet(`Invalid prop: validation failed${e ? ` for prop "${e}"` : ""}. Expected one of [${f}], got value ${JSON.stringify(u)}.`);
}
return d;
} : void 0,
[Ez]: !0
};
return vP(t, "default") && (a.default = i), a;
}, Sn = (t) => dx(Object.entries(t).map(([e, r]) => [
e,
_g(r, e)
])), b8 = Ur([
String,
Object,
Function
]), dot = {
Close: Tx
}, pot = {
validating: wz,
success: oot,
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;
}, Tot = (t, e) => (t.install = (r) => {
r.directive(e, t);
}, t), ol = (t) => (t.install = O5, t), fot = (...t) => (e) => {
t.forEach((r) => {
Wo(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"
}, Zo = "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 Qot = (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(() => yt(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
});
}, mot = (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, b = t.value.getBoundingClientRect(), w = b.left, S = b.top, x = b.width, C = b.height, P = document.documentElement.clientWidth, R = document.documentElement.clientHeight, F = -w + Q, U = -S + y, $ = P - w - x + Q, rt = R - S - C + y, tt = (lt) => {
let xt = Q + lt.clientX - T, Vt = y + lt.clientY - f;
n != null && n.value || (xt = Math.min(Math.max(xt, F), $), Vt = Math.min(Math.max(Vt, U), rt)), i = {
offsetX: xt,
offsetY: Vt
}, t.value && (t.value.style.transform = `translate(${z5(xt)}, ${z5(Vt)})`);
}, at = () => {
document.removeEventListener("mousemove", tt), document.removeEventListener("mouseup", at);
};
document.addEventListener("mousemove", tt), document.addEventListener("mouseup", at);
}, 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 Z1(() => {
Kj(() => {
r.value ? s() : a();
});
}), Rs(() => {
a();
}), {
resetPosition: u
};
};
var got = {
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 yot = (t) => (e, r) => vot(e, r, yt(t)), vot = (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}}`}`;
}), _ot = (t) => {
const e = Kt(() => yt(t).name), r = g2(t) ? t : Ve(t);
return {
lang: e,
locale: r,
t: yot(t)
};
}, Hz = Symbol("localeContextKey"), uS = (t) => {
const e = t || ln(Hz, Ve());
return _ot(Kt(() => e.value || got));
}, eh = "el", bot = "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 || ($1() ? ln(Az, Ve(eh)) : Ve(eh));
return Kt(() => yt(e) || eh);
}, Bn = (t, e) => {
const r = hS(e);
return {
namespace: r,
b: (n = "") => G0(r.value, t, n, "", ""),
e: (n) => n ? G0(r.value, t, "", n, "") : "",
m: (n) => n ? G0(r.value, t, "", "", n) : "",
be: (n, i) => n && i ? G0(r.value, t, n, i, "") : "",
em: (n, i) => n && i ? G0(r.value, t, "", n, i) : "",
bm: (n, i) => n && i ? G0(r.value, t, n, "", i) : "",
bem: (n, i, o) => n && i && o ? G0(r.value, t, n, i, o) : "",
is: (n, ...i) => {
const o = i.length >= 1 ? i[0] : !0;
return n && o ? `${bot}${n}` : "";
},
cssVar: (n) => {
const i = {};
for (const o in n)
n[o] && (i[`--${r.value}-${o}`] = n[o]);
return i;
},
cssVarName: (n) => `--${r.value}-${n}`,
cssVarBlock: (n) => {
const i = {};
for (const o in n)
n[o] && (i[`--${r.value}-${t}-${o}`] = n[o]);
return i;
},
cssVarBlockName: (n) => `--${r.value}-${t}-${n}`
};
}, Lot = (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 || ZP(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 = !ZP(document.body, n.value), o && (s = document.body.style.width), i = tot(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);
}), XE(() => a());
}, wot = _g({
type: Ur(Boolean),
default: null
}), xot = _g({
type: Ur(Function)
}), Mot = (t) => {
const e = `update:${t}`, r = `onUpdate:${t}`, n = [e], i = {
[t]: wot,
[r]: xot
};
return {
useModelToggle: ({
indicator: o,
toggleReason: s,
shouldHideWhenRouteChanges: a,
shouldProceed: u,
onShow: d,
onHide: T
}) => {
const f = $1(), { emit: Q } = f, y = f.props, b = Kt(() => Wo(y[r])), w = Kt(() => y[t] === null), S = (U) => {
o.value !== !0 && (o.value = !0, s && (s.value = U), Wo(d) && d(U));
}, x = (U) => {
o.value !== !1 && (o.value = !1, s && (s.value = U), Wo(T) && T(U));
}, C = (U) => {
if (y.disabled === !0 || Wo(u) && !u())
return;
const $ = b.value && s1;
$ && Q(e, !0), (w.value || !$) && S(U);
}, P = (U) => {
if (y.disabled === !0 || !s1)
return;
const $ = b.value && s1;
$ && Q(e, !1), (w.value || !$) && x(U);
}, R = (U) => {
S4(U) && (y.disabled && U ? b.value && Q(e, !1) : o.value !== U && (U ? S() : x()));
}, F = () => {
o.value ? P() : C();
};
return on(() => y[t], R), a && f.appContext.config.globalProperties.$route !== void 0 && on(() => ({
...f.proxy.$route
}), () => {
a.value && o.value && P();
}), Z1(() => {
R(y[t]);
}), {
hide: P,
show: C,
toggle: F,
hasUpdateHandler: b
};
},
useModelToggleProps: i,
useModelToggleEmits: n
};
}, Cz = (t) => {
const e = $1();
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", Ps = "bottom", ks = "right", m2 = "left", dS = "auto", dd = [Q2, Ps, ks, m2], L8 = "start", Dh = "end", Eot = "clippingParents", Oz = "viewport", uu = "popper", Sot = "reference", WP = 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]);
}, []), Hot = "beforeRead", Aot = "read", Cot = "afterRead", Oot = "beforeMain", Pot = "main", kot = "afterMain", Vot = "beforeWrite", Iot = "write", Rot = "afterWrite", Not = [Hot, Aot, Cot, Oot, Pot, kot, Vot, Iot, Rot];
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 Dot(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 Fot(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 Pz = { name: "applyStyles", enabled: !0, phase: "write", fn: Dot, effect: Fot, requires: ["computeStyles"] };
function o3(t) {
return t.split("-")[0];
}
var k5 = Math.max, DQ = Math.min, x8 = Math.round;
function M8(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 = M8(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 kz(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 Bot(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 qP(t) {
return !Hs(t) || H4(t).position === "fixed" ? null : t.offsetParent;
}
function jot(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 = qP(t); r && Bot(r) && H4(r).position === "static"; ) r = qP(r);
return r && (d3(r) === "html" || d3(r) === "body" && H4(r).position === "static") ? e : r || jot(t) || e;
}
function fS(t) {
return ["top", "bottom"].indexOf(t) >= 0 ? "x" : "y";
}
function rh(t, e, r) {
return k5(t, DQ(e, r));
}
function zot(t, e, r) {
var n = rh(t, e, r);
return n > r ? r : n;
}
function Vz() {
return { top: 0, right: 0, bottom: 0, left: 0 };
}
function Iz(t) {
return Object.assign({}, Vz(), t);
}
function Rz(t, e) {
return e.reduce(function(r, n) {
return r[n] = t, r;
}, {});
}
var Uot = function(t, e) {
return t = typeof t == "function" ? t(Object.assign({}, e.rects, { placement: e.placement })) : t, Iz(typeof t != "number" ? t : Rz(t, dd));
};
function Got(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, ks].indexOf(a) >= 0, T = d ? "height" : "width";
if (!(!o || !s)) {
var f = Uot(i.padding, r), Q = TS(o), y = u === "y" ? Q2 : m2, b = u === "y" ? Ps : ks, w = r.rects.reference[T] + r.rects.reference[u] - s[u] - r.rects.popper[T], S = s[u] - r.rects.reference[u], x = pd(o), C = x ? u === "y" ? x.clientHeight || 0 : x.clientWidth || 0 : 0, P = w / 2 - S / 2, R = f[y], F = C - Q[T] - f[b], U = C / 2 - Q[T] / 2 + P, $ = rh(R, U, F), rt = u;
r.modifiersData[n] = (e = {}, e[rt] = $, e.centerOffset = $ - U, e);
}
}
function $ot(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) || !kz(e.elements.popper, i) || (e.elements.arrow = i));
}
var Zot = { name: "arrow", enabled: !0, phase: "main", fn: Got, effect: $ot, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] };
function E8(t) {
return t.split("-")[1];
}
var Wot = { top: "auto", right: "auto", bottom: "auto", left: "auto" };
function qot(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 XP(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, b = s.y, w = b === void 0 ? 0 : b, S = typeof T == "function" ? T({ x: y, y: w }) : { x: y, y: w };
y = S.x, w = S.y;
var x = s.hasOwnProperty("x"), C = s.hasOwnProperty("y"), P = m2, R = Q2, F = window;
if (d) {
var U = pd(r), $ = "clientHeight", rt = "clientWidth";
if (U === ha(r) && (U = d0(r), H4(U).position !== "static" && a === "absolute" && ($ = "scrollHeight", rt = "scrollWidth")), U = U, i === Q2 || (i === m2 || i === ks) && o === Dh) {
R = Ps;
var tt = f && U === F && F.visualViewport ? F.visualViewport.height : U[$];
w -= tt - n.height, w *= u ? 1 : -1;
}
if (i === m2 || (i === Q2 || i === Ps) && o === Dh) {
P = ks;
var at = f && U === F && F.visualViewport ? F.visualViewport.width : U[rt];
y -= at - n.width, y *= u ? 1 : -1;
}
}
var lt = Object.assign({ position: a }, d && Wot), xt = T === !0 ? qot({ x: y, y: w }) : { x: y, y: w };
if (y = xt.x, w = xt.y, u) {
var Vt;
return Object.assign({}, lt, (Vt = {}, Vt[R] = C ? "0" : "", Vt[P] = x ? "0" : "", Vt.transform = (F.devicePixelRatio || 1) <= 1 ? "translate(" + y + "px, " + w + "px)" : "translate3d(" + y + "px, " + w + "px, 0)", Vt));
}
return Object.assign({}, lt, (e = {}, e[R] = C ? w + "px" : "", e[P] = x ? y + "px" : "", e.transform = "", e));
}
function Xot(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: E8(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, XP(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, XP(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: Xot, data: {} }, Wp = { passive: !0 };
function Kot(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, Wp);
}), a && u.addEventListener("resize", r.update, Wp), function() {
o && d.forEach(function(T) {
T.removeEventListener("scroll", r.update, Wp);
}), a && u.removeEventListener("resize", r.update, Wp);
};
}
var Dz = { name: "eventListeners", enabled: !0, phase: "write", fn: function() {
}, effect: Kot, data: {} }, Yot = { left: "right", right: "left", bottom: "top", top: "bottom" };
function Qf(t) {
return t.replace(/left|right|bottom|top/g, function(e) {
return Yot[e];
});
}
var Jot = { start: "end", end: "start" };
function KP(t) {
return t.replace(/start|end/g, function(e) {
return Jot[e];
});
}
function QS(t) {
var e = ha(t), r = e.pageXOffset, n = e.pageYOffset;
return { scrollLeft: r, scrollTop: n };
}
function mS(t) {
return M8(d0(t)).left + QS(t).scrollLeft;
}
function t2t(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 e2t(t) {
var e, r = d0(t), n = QS(t), i = (e = t.ownerDocument) == null ? void 0 : e.body, o = k5(r.scrollWidth, r.clientWidth, i ? i.scrollWidth : 0, i ? i.clientWidth : 0), s = k5(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 += k5(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 r2t(t) {
var e = M8(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 YP(t, e) {
return e === Oz ? fx(t2t(t)) : w8(e) ? r2t(e) : fx(e2t(d0(t)));
}
function n2t(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) && kz(i, n) && d3(i) !== "body";
}) : [];
}
function i2t(t, e, r) {
var n = e === "clippingParents" ? n2t(t) : [].concat(e), i = [].concat(n, [r]), o = i[0], s = i.reduce(function(a, u) {
var d = YP(t, u);
return a.top = k5(d.top, a.top), a.right = DQ(d.right, a.right), a.bottom = DQ(d.bottom, a.bottom), a.left = k5(d.left, a.left), a;
}, YP(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 ? E8(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 Ps:
u = { x: s, y: e.y + e.height };
break;
case ks:
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 ? Eot : o, a = r.rootBoundary, u = a === void 0 ? Oz : a, d = r.elementContext, T = d === void 0 ? uu : d, f = r.altBoundary, Q = f === void 0 ? !1 : f, y = r.padding, b = y === void 0 ? 0 : y, w = Iz(typeof b != "number" ? b : Rz(b, dd)), S = T === uu ? Sot : uu, x = t.rects.popper, C = t.elements[Q ? S : T], P = i2t(w8(C) ? C : C.contextElement || d0(t.elements.popper), s, u), R = M8(t.elements.reference), F = Bz({ reference: R, element: x, strategy: "absolute", placement: i }), U = fx(Object.assign({}, x, F)), $ = T === uu ? U : R, rt = { top: P.top - $.top + w.top, bottom: $.bottom - P.bottom + w.bottom, left: P.left - $.left + w.left, right: $.right - P.right + w.right }, tt = t.modifiersData.offset;
if (T === uu && tt) {
var at = tt[i];
Object.keys(rt).forEach(function(lt) {
var xt = [ks, Ps].indexOf(lt) >= 0 ? 1 : -1, Vt = [Q2, Ps].indexOf(lt) >= 0 ? "y" : "x";
rt[lt] += at[Vt] * xt;
});
}
return rt;
}
function o2t(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 = E8(n), f = T ? a ? WP : WP.filter(function(b) {
return E8(b) === T;
}) : dd, Q = f.filter(function(b) {
return d.indexOf(b) >= 0;
});
Q.length === 0 && (Q = f);
var y = Q.reduce(function(b, w) {
return b[w] = Fh(t, { placement: w, boundary: i, rootBoundary: o, padding: s })[o3(w)], b;
}, {});
return Object.keys(y).sort(function(b, w) {
return y[b] - y[w];
});
}
function s2t(t) {
if (o3(t) === dS) return [];
var e = Qf(t);
return [KP(t), e, KP(e)];
}
function a2t(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, b = y === void 0 ? !0 : y, w = r.allowedAutoPlacements, S = e.options.placement, x = o3(S), C = x === S, P = u || (C || !b ? [Qf(S)] : s2t(S)), R = [S].concat(P).reduce(function(er, Je) {
return er.concat(o3(Je) === dS ? o2t(e, { placement: Je, boundary: T, rootBoundary: f, padding: d, flipVariations: b, allowedAutoPlacements: w }) : Je);
}, []), F = e.rects.reference, U = e.rects.popper, $ = /* @__PURE__ */ new Map(), rt = !0, tt = R[0], at = 0; at < R.length; at++) {
var lt = R[at], xt = o3(lt), Vt = E8(lt) === L8, Zt = [Q2, Ps].indexOf(xt) >= 0, ce = Zt ? "width" : "height", oe = Fh(e, { placement: lt, boundary: T, rootBoundary: f, altBoundary: Q, padding: d }), Se = Zt ? Vt ? ks : m2 : Vt ? Ps : Q2;
F[ce] > U[ce] && (Se = Qf(Se));
var Ir = Qf(Se), qr = [];
if (o && qr.push(oe[xt] <= 0), a && qr.push(oe[Se] <= 0, oe[Ir] <= 0), qr.every(function(er) {
return er;
})) {
tt = lt, rt = !1;
break;
}
$.set(lt, qr);
}
if (rt) for (var ne = b ? 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 tt = Je, "break";
}, Ke = ne; Ke > 0; Ke--) {
var Ae = Qe(Ke);
if (Ae === "break") break;
}
e.placement !== tt && (e.modifiersData[n]._skip = !0, e.placement = tt, e.reset = !0);
}
}
var l2t = { name: "flip", enabled: !0, phase: "main", fn: a2t, requiresIfExists: ["offset"], data: { _skip: !1 } };
function JP(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 tk(t) {
return [Q2, ks, Ps, m2].some(function(e) {
return t[e] >= 0;
});
}
function c2t(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 = JP(s, n), d = JP(a, i, o), T = tk(u), f = tk(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 u2t = { name: "hide", enabled: !0, phase: "main", requiresIfExists: ["preventOverflow"], fn: c2t };
function h2t(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, ks].indexOf(n) >= 0 ? { x: a, y: s } : { x: s, y: a };
}
function d2t(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] = h2t(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 p2t = { name: "offset", enabled: !0, phase: "main", requires: ["popperOffsets"], fn: d2t };
function T2t(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: T2t, data: {} };
function f2t(t) {
return t === "x" ? "y" : "x";
}
function Q2t(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, b = r.tetherOffset, w = b === void 0 ? 0 : b, S = Fh(e, { boundary: u, rootBoundary: d, padding: f, altBoundary: T }), x = o3(e.placement), C = E8(e.placement), P = !C, R = fS(x), F = f2t(R), U = e.modifiersData.popperOffsets, $ = e.rects.reference, rt = e.rects.popper, tt = typeof w == "function" ? w(Object.assign({}, e.rects, { placement: e.placement })) : w, at = typeof tt == "number" ? { mainAxis: tt, altAxis: tt } : Object.assign({ mainAxis: 0, altAxis: 0 }, tt), lt = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, xt = { x: 0, y: 0 };
if (U) {
if (o) {
var Vt, Zt = R === "y" ? Q2 : m2, ce = R === "y" ? Ps : ks, oe = R === "y" ? "height" : "width", Se = U[R], Ir = Se + S[Zt], qr = Se - S[ce], ne = y ? -rt[oe] / 2 : 0, Qe = C === L8 ? $[oe] : rt[oe], Ke = C === L8 ? -rt[oe] : -$[oe], Ae = e.elements.arrow, er = y && Ae ? TS(Ae) : { width: 0, height: 0 }, Je = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : Vz(), Ne = Je[Zt], Gt = Je[ce], te = rh(0, $[oe], er[oe]), me = P ? $[oe] / 2 - ne - te - Ne - at.mainAxis : Qe - te - Ne - at.mainAxis, de = P ? -$[oe] / 2 + ne + te + Gt + at.mainAxis : Ke + te + Gt + at.mainAxis, Ge = e.elements.arrow && pd(e.elements.arrow), Tr = Ge ? R === "y" ? Ge.clientTop || 0 : Ge.clientLeft || 0 : 0, qe = (Vt = lt == null ? void 0 : lt[R]) != null ? Vt : 0, $e = Se + me - qe - Tr, ar = Se + de - qe, Ot = rh(y ? DQ(Ir, $e) : Ir, Se, y ? k5(qr, ar) : qr);
U[R] = Ot, xt[R] = Ot - Se;
}
if (a) {
var en, Jr = R === "x" ? Q2 : m2, Sr = R === "x" ? Ps : ks, Rr = U[F], dn = F === "y" ? "height" : "width", ji = Rr + S[Jr], Ji = Rr - S[Sr], Pi = [Q2, m2].indexOf(x) !== -1, _i = (en = lt == null ? void 0 : lt[F]) != null ? en : 0, ki = Pi ? ji : Rr - $[dn] - rt[dn] - _i + at.altAxis, c1 = Pi ? Rr + $[dn] + rt[dn] - _i - at.altAxis : Ji, ye = y && Pi ? zot(ki, Rr, c1) : rh(y ? ki : ji, Rr, y ? c1 : Ji);
U[F] = ye, xt[F] = ye - Rr;
}
e.modifiersData[n] = xt;
}
}
var m2t = { name: "preventOverflow", enabled: !0, phase: "main", fn: Q2t, requiresIfExists: ["offset"] };
function g2t(t) {
return { scrollLeft: t.scrollLeft, scrollTop: t.scrollTop };
}
function y2t(t) {
return t === ha(t) || !Hs(t) ? QS(t) : g2t(t);
}
function v2t(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 _2t(t, e, r) {
r === void 0 && (r = !1);
var n = Hs(e), i = Hs(e) && v2t(e), o = d0(e), s = M8(t, i), a = { scrollLeft: 0, scrollTop: 0 }, u = { x: 0, y: 0 };
return (n || !n && !r) && ((d3(e) !== "body" || gS(o)) && (a = y2t(e)), Hs(e) ? (u = M8(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 b2t(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 L2t(t) {
var e = b2t(t);
return Not.reduce(function(r, n) {
return r.concat(e.filter(function(i) {
return i.phase === n;
}));
}, []);
}
function w2t(t) {
var e;
return function() {
return e || (e = new Promise(function(r) {
Promise.resolve().then(function() {
e = void 0, r(t());
});
})), e;
};
}
function x2t(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 ek = { placement: "bottom", modifiers: [], strategy: "absolute" };
function rk() {
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 ? ek : i;
return function(s, a, u) {
u === void 0 && (u = o);
var d = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, ek, o), modifiersData: {}, elements: { reference: s, popper: a }, attributes: {}, styles: {} }, T = [], f = !1, Q = { state: d, setOptions: function(w) {
var S = typeof w == "function" ? w(d.options) : w;
b(), d.options = Object.assign({}, o, d.options, S), d.scrollParents = { reference: w8(s) ? nh(s) : s.contextElement ? nh(s.contextElement) : [], popper: nh(a) };
var x = L2t(x2t([].concat(n, d.options.modifiers)));
return d.orderedModifiers = x.filter(function(C) {
return C.enabled;
}), y(), Q.update();
}, forceUpdate: function() {
if (!f) {
var w = d.elements, S = w.reference, x = w.popper;
if (rk(S, x)) {
d.rects = { reference: _2t(S, pd(x), d.options.strategy === "fixed"), popper: TS(x) }, d.reset = !1, d.placement = d.options.placement, d.orderedModifiers.forEach(function(rt) {
return d.modifiersData[rt.name] = Object.assign({}, rt.data);
});
for (var C = 0; C < d.orderedModifiers.length; C++) {
if (d.reset === !0) {
d.reset = !1, C = -1;
continue;
}
var P = d.orderedModifiers[C], R = P.fn, F = P.options, U = F === void 0 ? {} : F, $ = P.name;
typeof R == "function" && (d = R({ state: d, options: U, name: $, instance: Q }) || d);
}
}
}
}, update: w2t(function() {
return new Promise(function(w) {
Q.forceUpdate(), w(d);
});
}), destroy: function() {
b(), f = !0;
} };
if (!rk(s, a)) return Q;
Q.setOptions(u).then(function(w) {
!f && u.onFirstUpdate && u.onFirstUpdate(w);
});
function y() {
d.orderedModifiers.forEach(function(w) {
var S = w.name, x = w.options, C = x === void 0 ? {} : x, P = w.effect;
if (typeof P == "function") {
var R = P({ state: d, name: S, instance: Q, options: C }), F = function() {
};
T.push(R || F);
}
});
}
function b() {
T.forEach(function(w) {
return w();
}), T = [];
}
return Q;
};
}
yS();
var M2t = [Dz, jz, Nz, Pz];
yS({ defaultModifiers: M2t });
var E2t = [Dz, jz, Nz, Pz, p2t, l2t, m2t, Zot, u2t], S2t = yS({ defaultModifiers: E2t });
const H2t = (t, e, r = {}) => {
const n = {
name: "updateState",
enabled: !0,
phase: "write",
fn: ({ state: u }) => {
const d = A2t(u);
Object.assign(s.value, d);
},
requires: ["computeStyles"]
}, i = Kt(() => {
const { onFirstUpdate: u, placement: d, strategy: T, modifiers: f } = yt(r);
return {
onFirstUpdate: u,
placement: d || "bottom",
strategy: T || "absolute",
modifiers: [
...f || [],
n,
{ name: "applyStyles", enabled: !1 }
]
};
}), o = VQ(), s = Ve({
styles: {
popper: {
position: yt(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 = yt(o);
d && d.setOptions(u);
}, {
deep: !0
}), on([t, e], ([u, d]) => {
a(), !(!u || !d) && (o.value = S2t(u, d, yt(i)));
}), Rs(() => {
a();
}), {
state: Kt(() => {
var u;
return { ...((u = yt(o)) == null ? void 0 : u.state) || {} };
}),
styles: Kt(() => yt(s).styles),
attributes: Kt(() => yt(s).attributes),
update: () => {
var u;
return (u = yt(o)) == null ? void 0 : u.update();
},
forceUpdate: () => {
var u;
return (u = yt(o)) == null ? void 0 : u.forceUpdate();
},
instanceRef: Kt(() => yt(o))
};
};
function A2t(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: O5, onMousedown: O5, onMouseup: O5 };
let e = !1, r = !1;
return { onClick: (n) => {
e && r && t(n), e = r = !1;
}, onMousedown: (n) => {
e = n.target === n.currentTarget;
}, onMouseup: (n) => {
r = n.target === n.currentTarget;
} };
};
function nk() {
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
}, C2t = Symbol("elIdInjection"), Uz = () => $1() ? ln(C2t, 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(() => yt(t) || `${r.value}-id-${e.prefix}-${e.current++}`);
};
let w7 = [];
const ik = (t) => {
const e = t;
e.key === Nh.esc && w7.forEach((r) => r(e));
}, O2t = (t) => {
Z1(() => {
w7.length === 0 && document.addEventListener("keydown", ik), s1 && w7.push(t);
}), Rs(() => {
w7 = w7.filter((e) => e !== t), w7.length === 0 && s1 && document.removeEventListener("keydown", ik);
});
};
let ok;
const Gz = () => {
const t = hS(), e = Uz(), r = Kt(() => `${t.value}-popper-container-${e.prefix}`), n = Kt(() => `#${r.value}`);
return {
id: r,
selector: n
};
}, P2t = (t) => {
const e = document.createElement("div");
return e.id = t, document.body.appendChild(e), e;
}, k2t = () => {
const { id: t, selector: e } = Gz();
return Met(() => {
s1 && (process.env.NODE_ENV === "test" || !ok || !document.body.querySelector(e.value)) && (ok = P2t(t.value));
}), {
id: t,
selector: e
};
}, V2t = Sn({
showAfter: {
type: Number,
default: 0
},
hideAfter: {
type: Number,
default: 200
},
autoClose: {
type: Number,
default: 0
}
}), I2t = ({
showAfter: t,
hideAfter: e,
autoClose: r,
open: n,
close: i
}) => {
const { registerTimeout: o } = nk(), {
registerTimeout: s,
cancelTimeout: a
} = nk();
return {
onOpen: (u) => {
o(() => {
n(u);
const d = yt(r);
ro(d) && d > 0 && s(() => {
i(u);
}, d);
}, yt(t));
},
onClose: (u) => {
a(), o(() => {
i(u);
}, yt(e));
}
};
}, $z = Symbol("elForwardRef"), R2t = (t) => {
G1($z, {
setForwardRef: (e) => {
t.value = e;
}
});
}, N2t = (t) => ({
mounted(e) {
t(e);
},
updated(e) {
t(e);
},
unmounted() {
t(null);
}
}), sk = {
current: 0
}, ak = Ve(0), Zz = 2e3, lk = Symbol("elZIndexContextKey"), Wz = Symbol("zIndexContextKey"), vS = (t) => {
const e = $1() ? ln(lk, sk) : sk, r = t || ($1() ? ln(Wz, void 0) : void 0), n = Kt(() => {
const s = yt(r);
return ro(s) ? s : Zz;
}), i = Kt(() => n.value + ak.value), o = () => (e.current++, ak.value = e.current, i.value);
return !s1 && !ln(lk) && 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"), D2t = () => {
const t = ln(qz, {});
return Kt(() => yt(t.size) || "");
};
function F2t(t, {
beforeFocus: e,
afterFocus: r,
beforeBlur: n,
afterBlur: i
} = {}) {
const o = $1(), { emit: s } = o, a = VQ(), u = Ve(!1), d = (Q) => {
Wo(e) && e(Q) || u.value || (u.value = !0, s("focus", Q), r == null || r());
}, T = (Q) => {
var y;
Wo(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" && Z1(() => {
const Q = P5(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 B2t({
afterComposition: t,
emit: e
}) {
const r = Ve(!1), n = (s) => {
e == null || e("compositionstart", s), r.value = !0;
}, i = (s) => {
var a;
e == null || e("compositionupdate", s);
const u = (a = s.target) == null ? void 0 : a.value, d = u[u.length - 1] || "";
r.value = !Qot(d);
}, o = (s) => {
e == null || e("compositionend", s), r.value && (r.value = !1, i1(() => t(s)));
};
return {
isComposing: r,
handleComposition: (s) => {
s.type === "compositionend" ? o(s) : i(s);
},
handleCompositionStart: n,
handleCompositionUpdate: i,
handleCompositionEnd: o
};
}
const Xz = Symbol("emptyValuesContextKey"), j2t = "use-empty-values", z2t = ["", void 0, null], U2t = void 0, G2t = Sn({
emptyValues: Array,
valueOnClear: {
type: [String, Number, Boolean, Function],
default: void 0,
validator: (t) => Wo(t) ? !t() : !t
}
}), $2t = (t, e) => {
const r = $1() ? ln(Xz, Ve({})) : Ve({}), n = Kt(() => t.emptyValues || r.value.emptyValues || z2t), i = Kt(() => Wo(t.valueOnClear) ? t.valueOnClear() : t.valueOnClear !== void 0 ? t.valueOnClear : Wo(r.value.valueOnClear) ? r.value.valueOnClear() : r.value.valueOnClear !== void 0 ? r.value.valueOnClear : U2t), o = (s) => n.value.includes(s);
return n.value.includes(i.value) || y2(j2t, "value-on-clear should be a value of empty-values"), {
emptyValues: n,
valueOnClear: i,
isEmptyValue: o
};
}, Z2t = Sn({
ariaLabel: String,
ariaOrientation: {
type: String,
values: ["horizontal", "vertical", "undefined"]
},
ariaControls: String
}), sl = (t) => gz(Z2t, t), Kz = Symbol(), FQ = Ve();
function wg(t, e = void 0) {
const r = $1() ? 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 W2t(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) || Zz;
})), s = Kt(() => {
var a;
return yt(e) || ((a = r.value) == null ? void 0 : a.size) || "";
});
return q2t(Kt(() => yt(r) || {})), {
ns: n,
locale: i,
zIndex: o,
size: s
};
}
const q2t = (t, e, r = !1) => {
var n;
const i = !!$1(), o = i ? wg() : void 0, s = (n = void 0) != null ? n : i ? G1 : void 0;
if (!s) {
y2("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup().");
return;
}
const a = Kt(() => {
const u = yt(t);
return o != null && o.value ? X2t(o.value, u) : u;
});
return s(Kz, a), s(Hz, Kt(() => a.value.locale)), s(Az, Kt(() => a.value.namespace)), s(Wz, 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;
}, X2t = (t, e) => {
const r = [.../* @__PURE__ */ new Set([...$P(t), ...$P(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 K2t = Sn({
size: {
type: Ur([Number, String])
},
color: {
type: String
}
}), Y2t = mr({
name: "ElIcon",
inheritAttrs: !1
}), J2t = /* @__PURE__ */ mr({
...Y2t,
props: K2t,
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) => (le(), Ye("i", rl({
class: yt(r).b(),
style: yt(n)
}, i.$attrs), [
kr(i.$slots, "default")
], 16));
}
});
var tst = /* @__PURE__ */ Hn(J2t, [["__file", "icon.vue"]]);
const p3 = v2(tst), _S = Symbol("formContextKey"), BQ = Symbol("formItemContextKey"), S8 = (t, e = {}) => {
const r = Ve(void 0), n = e.prop ? r : Cz("size"), i = e.global ? r : D2t(), o = e.form ? { size: void 0 } : ln(_S, void 0), s = e.formItem ? { size: void 0 } : ln(BQ, void 0);
return Kt(() => n.value || yt(t) || (s == null ? void 0 : s.size) || (o == null ? void 0 : o.size) || i.value || "");
}, xg = (t) => {
const e = Cz("disabled"), r = ln(_S, void 0);
return Kt(() => e.value || yt(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
};
}, Mg = (t, {
formItemContext: e,
disableIdGeneration: r,
disableIdManagement: n
}) => {
r || (r = Ve(!1)), n || (n = Ve(!1));
const i = Ve();
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 Z1(() => {
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 });
}), Eet(() => {
o && o(), e != null && e.removeInputId && i.value && e.removeInputId(i.value);
}), {
isLabeledByFormItem: s,
inputId: i
};
}, Xl = 4, est = {
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"
}
}, rst = ({
move: t,
size: e,
bar: r
}) => ({
[r.size]: e,
transform: `translate${r.axis}(${t}%)`
}), bS = Symbol("scrollbarContextKey"), nst = Sn({
vertical: Boolean,
size: String,
move: Number,
ratio: {
type: Number,
required: !0
},
always: Boolean
}), ist = "Thumb", ost = /* @__PURE__ */ mr({
__name: "thumb",
props: nst,
setup(t) {
const e = t, r = ln(bS), n = Bn("scrollbar");
r || vz(ist, "can not inject scrollbar context");
const i = Ve(), o = Ve(), s = Ve({}), a = Ve(!1);
let u = !1, d = !1, T = s1 ? document.onselectstart : null;
const f = Kt(() => est[e.vertical ? "vertical" : "horizontal"]), Q = Kt(() => rst({
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]), b = (U) => {
var $;
if (U.stopPropagation(), U.ctrlKey || [1, 2].includes(U.button))
return;
($ = window.getSelection()) == null || $.removeAllRanges(), S(U);
const rt = U.currentTarget;
rt && (s.value[f.value.axis] = rt[f.value.offset] - (U[f.value.client] - rt.getBoundingClientRect()[f.value.direction]));
}, w = (U) => {
if (!o.value || !i.value || !r.wrapElement)
return;
const $ = Math.abs(U.target.getBoundingClientRect()[f.value.direction] - U[f.value.client]), rt = o.value[f.value.offset] / 2, tt = ($ - rt) * 100 * y.value / i.value[f.value.offset];
r.wrapElement[f.value.scroll] = tt * r.wrapElement[f.value.scrollSize] / 100;
}, S = (U) => {
U.stopImmediatePropagation(), u = !0, document.addEventListener("mousemove", x), document.addEventListener("mouseup", C), 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 rt = (i.value.getBoundingClientRect()[f.value.direction] - U[f.value.client]) * -1, tt = o.value[f.value.offset] - $, at = (rt - tt) * 100 * y.value / i.value[f.value.offset];
r.wrapElement[f.value.scroll] = at * r.wrapElement[f.value.scrollSize] / 100;
}, C = () => {
u = !1, s.value[f.value.axis] = 0, document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", C), F(), d && (a.value = !1);
}, P = () => {
d = !1, a.value = !!e.size;
}, R = () => {
d = !0, a.value = u;
};
Rs(() => {
F(), document.removeEventListener("mouseup", C);
});
const F = () => {
document.onselectstart !== T && (document.onselectstart = T);
};
return ea(K2(r, "scrollbarElement"), "mousemove", P), ea(K2(r, "scrollbarElement"), "mouseleave", R), (U, $) => (le(), Ar(cd, {
name: yt(n).b("fade"),
persisted: ""
}, {
default: fe(() => [
Ti(je("div", {
ref_key: "instance",
ref: i,
class: Be([yt(n).e("bar"), yt(n).is(yt(f).key)]),
onMousedown: w
}, [
je("div", {
ref_key: "thumb",
ref: o,
class: Be(yt(n).e("thumb")),
style: E1(yt(Q)),
onMousedown: b
}, null, 38)
], 34), [
[zo, U.always || a.value]
])
]),
_: 1
}, 8, ["name"]));
}
});
var ck = /* @__PURE__ */ Hn(ost, [["__file", "thumb.vue"]]);
const sst = Sn({
always: {
type: Boolean,
default: !0
},
minSize: {
type: Number,
required: !0
}
}), ast = /* @__PURE__ */ mr({
__name: "bar",
props: sst,
setup(t, { expose: e }) {
const r = t, n = ln(bS), i = Ve(0), o = Ve(0), s = Ve(""), a = Ve(""), u = Ve(1), d = Ve(1);
return e({
handleScroll: (T) => {
if (T) {
const f = T.offsetHeight - Xl, Q = T.offsetWidth - Xl;
o.value = T.scrollTop * 100 / f * u.value, i.value = T.scrollLeft * 100 / Q * d.value;
}
},
update: () => {
const T = n == null ? void 0 : n.wrapElement;
if (!T)
return;
const f = T.offsetHeight - Xl, Q = T.offsetWidth - Xl, y = f ** 2 / T.scrollHeight, b = Q ** 2 / T.scrollWidth, w = Math.max(y, r.minSize), S = Math.max(b, r.minSize);
u.value = y / (f - y) / (w / (f - w)), d.value = b / (Q - b) / (S / (Q - S)), a.value = w + Xl < f ? `${w}px` : "", s.value = S + Xl < Q ? `${S}px` : "";
}
}), (T, f) => (le(), Ye(to, null, [
Pe(ck, {
move: i.value,
ratio: d.value,
size: s.value,
always: T.always
}, null, 8, ["move", "ratio", "size", "always"]),
Pe(ck, {
move: o.value,
ratio: u.value,
size: a.value,
vertical: "",
always: T.always
}, null, 8, ["move", "ratio", "size", "always"])
], 64));
}
});
var lst = /* @__PURE__ */ Hn(ast, [["__file", "bar.vue"]]);
const cst = Sn({
height: {
type: [String, Number],
default: ""
},
maxHeight: {
type: [String, Number],
default: ""
},
native: {
type: Boolean,
default: !1
},
wrapStyle: {
type: Ur([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"])
}), ust = {
scroll: ({
scrollTop: t,
scrollLeft: e
}) => [t, e].every(ro)
}, mx = "ElScrollbar", hst = mr({
name: mx
}), dst = /* @__PURE__ */ mr({
...hst,
props: cst,
emits: ust,
setup(t, { expose: e, emit: r }) {
const n = t, i = Bn("scrollbar");
let o, s, a = 0, u = 0;
const d = Ve(), T = Ve(), f = Ve(), Q = Ve(), y = Kt(() => {
const F = {};
return n.height && (F.height = z5(n.height)), n.maxHeight && (F.maxHeight = z5(n.maxHeight)), [n.wrapStyle, F];
}), b = Kt(() => [
n.wrapClass,
i.e("wrap"),
{ [i.em("wrap", "hidden-default")]: !n.native }
]), w = Kt(() => [i.e("view"), n.viewClass]), S = () => {
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 C = (F) => {
if (!ro(F)) {
y2(mx, "value must be a number");
return;
}
T.value.scrollTop = F;
}, P = (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));
});
}), G1(bS, u3({
scrollbarElement: d,
wrapElement: T
})), vet(() => {
T.value && (T.value.scrollTop = a, T.value.scrollLeft = u);
}), Z1(() => {
n.native || i1(() => {
R();
});
}), _et(() => R()), e({
wrapRef: T,
update: R,
scrollTo: x,
setScrollTop: C,
setScrollLeft: P,
handleScroll: S
}), (F, U) => (le(), Ye("div", {
ref_key: "scrollbarRef",
ref: d,
class: Be(yt(i).b())
}, [
je("div", {
ref_key: "wrapRef",
ref: T,
class: Be(yt(b)),
style: E1(yt(y)),
tabindex: F.tabindex,
onScroll: S
}, [
(le(), Ar(Ss(F.tag), {
id: F.id,
ref_key: "resizeRef",
ref: f,
class: Be(yt(w)),
style: E1(F.viewStyle),
role: F.role,
"aria-label": F.ariaLabel,
"aria-orientation": F.ariaOrientation
}, {
default: fe(() => [
kr(F.$slots, "default")
]),
_: 3
}, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
], 46, ["tabindex"]),
F.native ? Br("v-if", !0) : (le(), Ar(lst, {
key: 0,
ref_key: "barRef",
ref: Q,
always: F.always,
"min-size": F.minSize
}, null, 8, ["always", "min-size"]))
], 2));
}
});
var pst = /* @__PURE__ */ Hn(dst, [["__file", "scrollbar.vue"]]);
const Tst = v2(pst), LS = Symbol("popper"), Yz = Symbol("popperContent"), fst = [
"dialog",
"grid",
"group",
"listbox",
"menu",
"navigation",
"tooltip",
"tree"
], Jz = Sn({
role: {
type: String,
values: fst,
default: "tooltip"
}
}), Qst = mr({
name: "ElPopper",
inheritAttrs: !1
}), mst = /* @__PURE__ */ mr({
...Qst,
props: Jz,
setup(t, { expose: e }) {
const r = t, n = Ve(), i = Ve(), o = Ve(), s = Ve(), a = Kt(() => r.role), u = {
triggerRef: n,
popperInstanceRef: i,
contentRef: o,
referenceRef: s,
role: a
};
return e(u), G1(LS, u), (d, T) => kr(d.$slots, "default");
}
});
var gst = /* @__PURE__ */ Hn(mst, [["__file", "popper.vue"]]);
const tU = Sn({
arrowOffset: {
type: Number,
default: 5
}
}), yst = mr({
name: "ElPopperArrow",
inheritAttrs: !1
}), vst = /* @__PURE__ */ mr({
...yst,
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) => (le(), Ye("span", {
ref_key: "arrowRef",
ref: o,
class: Be(yt(n).e("arrow")),
style: E1(yt(s)),
"data-popper-arrow": ""
}, null, 6));
}
});
var _st = /* @__PURE__ */ Hn(vst, [["__file", "arrow.vue"]]);
const Qb = "ElOnlyChild", bst = mr({
name: Qb,
setup(t, {
slots: e,
attrs: r
}) {
var n;
const i = ln($z), o = N2t((n = i == null ? void 0 : i.setForwardRef) != null ? n : O5);
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(bet(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 Let:
continue;
case Zj:
case "svg":
return uk(r);
case to:
return eU(r.children);
default:
return r;
}
return uk(r);
}
return null;
}
function uk(t) {
const e = Bn("only-child");
return Pe("span", {
class: e.e("content")
}, [t]);
}
const rU = Sn({
virtualRef: {
type: Ur(Object)
},
virtualTriggering: Boolean,
onMouseenter: {
type: Ur(Function)
},
onMouseleave: {
type: Ur(Function)
},
onClick: {
type: Ur(Function)
},
onKeydown: {
type: Ur(Function)
},
onFocus: {
type: Ur(Function)
},
onBlur: {
type: Ur(Function)
},
onContextmenu: {
type: Ur(Function)
},
id: String,
open: Boolean
}), Lst = mr({
name: "ElPopperTrigger",
inheritAttrs: !1
}), wst = /* @__PURE__ */ mr({
...Lst,
props: rU,
setup(t, { expose: e }) {
const r = t, { role: n, triggerRef: i } = ln(LS, void 0);
R2t(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 Z1(() => {
on(() => r.virtualRef, (f) => {
f && (i.value = f4(f));
}, {
immediate: !0
}), on(i, (f, Q) => {
d == null || d(), d = void 0, P5(f) && (T.forEach((y) => {
var b;
const w = r[y];
w && (f.addEventListener(y.slice(2).toLowerCase(), w), (b = Q == null ? void 0 : Q.removeEventListener) == null || b.call(Q, y.slice(2).toLowerCase(), w));
}), d = on([o, s, a, u], (y) => {
[
"aria-controls",
"aria-describedby",
"aria-haspopup",
"aria-expanded"
].forEach((b, w) => {
vg(y[w]) ? f.removeAttribute(b) : f.setAttribute(b, y[w]);
});
}, { immediate: !0 })), P5(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 && P5(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 ? Br("v-if", !0) : (le(), Ar(yt(bst), rl({ key: 0 }, f.$attrs, {
"aria-controls": yt(o),
"aria-describedby": yt(s),
"aria-expanded": yt(u),
"aria-haspopup": yt(a)
}), {
default: fe(() => [
kr(f.$slots, "default")
]),
_: 3
}, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"]));
}
});
var xst = /* @__PURE__ */ Hn(wst, [["__file", "trigger.vue"]]);
const mb = "focus-trap.focus-after-trapped", gb = "focus-trap.focus-after-released", Mst = "focus-trap.focusout-prevented", hk = {
cancelable: !0,
bubbles: !1
}, Est = {
cancelable: !0,
bubbles: !1
}, dk = "focusAfterTrapped", pk = "focusAfterReleased", nU = Symbol("elFocusTrap"), wS = Ve(), Eg = Ve(0), xS = Ve(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;
}, Tk = (t, e) => {
for (const r of t)
if (!Sst(r, e))
return r;
}, Sst = (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;
}, Hst = (t) => {
const e = iU(t), r = Tk(e, t), n = Tk(e.reverse(), t);
return [r, n];
}, Ast = (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 && Ast(t) && e && t.select();
}
};
function fk(t, e) {
const r = [...t], n = t.indexOf(e);
return n !== -1 && r.splice(n, 1), r;
}
const Cst = () => {
let t = [];
return {
push: (e) => {
const r = t[0];
r && e !== r && r.pause(), t = fk(t, e), t.unshift(e);
},
remove: (e) => {
var r, n;
t = fk(t, e), (n = (r = t[0]) == null ? void 0 : r.resume) == null || n.call(r);
}
};
}, Ost = (t, e = !1) => {
const r = document.activeElement;
for (const n of t)
if (H6(n, e), document.activeElement !== r)
return;
}, Qk = Cst(), Pst = () => Eg.value > xS.value, Xp = () => {
wS.value = "pointer", Eg.value = window.performance.now();
}, mk = () => {
wS.value = "keyboard", Eg.value = window.performance.now();
}, kst = () => (Z1(() => {
qp === 0 && (document.addEventListener("mousedown", Xp), document.addEventListener("touchstart", Xp), document.addEventListener("keydown", mk)), qp++;
}), Rs(() => {
qp--, qp <= 0 && (document.removeEventListener("mousedown", Xp), document.removeEventListener("touchstart", Xp), document.removeEventListener("keydown", mk));
}), {
focusReason: wS,
lastUserFocusTimestamp: Eg,
lastAutomatedFocusTimestamp: xS
}), Kp = (t) => new CustomEvent(Mst, {
...Est,
detail: t
}), Vst = mr({
name: "ElFocusTrap",
inheritAttrs: !1,
props: {
loop: Boolean,
trapped: Boolean,
focusTrapEl: Object,
focusStartEl: {
type: [Object, String],
default: "first"
}
},
emits: [
dk,
pk,
"focusin",
"focusout",
"focusout-prevented",
"release-requested"
],
setup(t, { emit: e }) {
const r = Ve();
let n, i;
const { focusReason: o } = kst();
O2t((b) => {
t.trapped && !s.paused && e("release-requested", b);
});
const s = {
paused: !1,
pause() {
this.paused = !0;
},
resume() {
this.paused = !1;
}
}, a = (b) => {
if (!t.loop && !t.trapped || s.paused)
return;
const { key: w, altKey: S, ctrlKey: x, metaKey: C, currentTarget: P, shiftKey: R } = b, { loop: F } = t, U = w === Nh.tab && !S && !x && !C, $ = document.activeElement;
if (U && $) {
const rt = P, [tt, at] = Hst(rt);
if (tt && at) {
if (!R && $ === at) {
const lt = Kp({
focusReason: o.value
});
e("focusout-prevented", lt), lt.defaultPrevented || (b.preventDefault(), F && H6(tt, !0));
} else if (R && [tt, rt].includes($)) {
const lt = Kp({
focusReason: o.value
});
e("focusout-prevented", lt), lt.defaultPrevented || (b.preventDefault(), F && H6(at, !0));
}
} else if ($ === rt) {
const lt = Kp({
focusReason: o.value
});
e("focusout-prevented", lt), lt.defaultPrevented || b.preventDefault();
}
}
};
G1(nU, {
focusTrapRef: r,
onKeydown: a
}), on(() => t.focusTrapEl, (b) => {
b && (r.value = b);
}, { immediate: !0 }), on([r], ([b], [w]) => {
b && (b.addEventListener("keydown", a), b.addEventListener("focusin", T), b.addEventListener("focusout", f)), w && (w.removeEventListener("keydown", a), w.removeEventListener("focusin", T), w.removeEventListener("focusout", f));
});
const u = (b) => {
e(dk, b);
}, d = (b) => e(pk, b), T = (b) => {
const w = yt(r);
if (!w)
return;
const S = b.target, x = b.relatedTarget, C = S && w.contains(S);
t.trapped || x && w.contains(x) || (n = x), C && e("focusin", b), !s.paused && t.trapped && (C ? i = S : H6(i, !0));
}, f = (b) => {
const w = yt(r);
if (!(s.paused || !w))
if (t.trapped) {
const S = b.relatedTarget;
!vg(S) && !w.contains(S) && setTimeout(() => {
if (!s.paused && t.trapped) {
const x = Kp({
focusReason: o.value
});
e("focusout-prevented", x), x.defaultPrevented || H6(i, !0);
}
}, 0);
} else {
const S = b.target;
S && w.contains(S) || e("focusout", b);
}
};
async function Q() {
await i1();
const b = yt(r);
if (b) {
Qk.push(s);
const w = b.contains(document.activeElement) ? n : document.activeElement;
if (n = w, !b.contains(w)) {
const S = new Event(mb, hk);
b.addEventListener(mb, u), b.dispatchEvent(S), S.defaultPrevented || i1(() => {
let x = t.focusStartEl;
sa(x) || (H6(x), document.activeElement !== x && (x = "first")), x === "first" && Ost(iU(b), !0), (document.activeElement === w || x === "container") && H6(b);
});
}
}
}
function y() {
const b = yt(r);
if (b) {
b.removeEventListener(mb, u);
const w = new CustomEvent(gb, {
...hk,
detail: {
focusReason: o.value
}
});
b.addEventListener(gb, d), b.dispatchEvent(w), !w.defaultPrevented && (o.value == "keyboard" || !Pst() || b.contains(document.activeElement)) && H6(n ?? document.body), b.removeEventListener(gb, d), Qk.remove(s);
}
}
return Z1(() => {
t.trapped && Q(), on(() => t.trapped, (b) => {
b ? 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 Ist(t, e, r, n, i, o) {
return kr(t.$slots, "default", { handleKeydown: t.onKeydown });
}
var oU = /* @__PURE__ */ Hn(Vst, [["render", Ist], ["__file", "focus-trap.vue"]]);
const Rst = ["fixed", "absolute"], Nst = Sn({
boundariesPadding: {
type: Number,
default: 0
},
fallbackPlacements: {
type: Ur(Array),
default: void 0
},
gpuAcceleration: {
type: Boolean,
default: !0
},
offset: {
type: Number,
default: 12
},
placement: {
type: String,
values: bg,
default: "bottom"
},
popperOptions: {
type: Ur(Object),
default: () => ({})
},
strategy: {
type: String,
values: Rst,
default: "absolute"
}
}), sU = Sn({
...Nst,
id: String,
style: {
type: Ur([String, Array, Object])
},
className: {
type: Ur([String, Array, Object])
},
effect: {
type: Ur(String),
default: "dark"
},
visible: Boolean,
enterable: {
type: Boolean,
default: !0
},
pure: Boolean,
focusOnShow: {
type: Boolean,
default: !1
},
trapping: {
type: Boolean,
default: !1
},
popperClass: {
type: Ur([String, Array, Object])
},
popperStyle: {
type: Ur([String, Array, Object])
},
referenceEl: {
type: Ur(Object)
},
triggerTargetEl: {
type: Ur(Object)
},
stopPopperMouseEvent: {
type: Boolean,
default: !0
},
virtualTriggering: Boolean,
zIndex: Number,
...sl(["ariaLabel"])
}), Dst = {
mouseenter: (t) => t instanceof MouseEvent,
mouseleave: (t) => t instanceof MouseEvent,
focus: () => !0,
blur: () => !0,
close: () => !0
}, Fst = (t, e = []) => {
const { placement: r, strategy: n, popperOptions: i } = t, o = {
placement: r,
strategy: n,
...i,
modifiers: [...jst(t), ...e]
};
return zst(o, i == null ? void 0 : i.modifiers), o;
}, Bst = (t) => {
if (s1)
return f4(t);
};
function jst(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 zst(t, e) {
e && (t.modifiers = [...t.modifiers, ...e ?? []]);
}
const Ust = 0, Gst = (t) => {
const { popperInstanceRef: e, contentRef: r, triggerRef: n, role: i } = ln(LS, void 0), o = Ve(), s = Ve(), a = Kt(() => ({
name: "eventListeners",
enabled: !!t.visible
})), u = Kt(() => {
var x;
const C = yt(o), P = (x = yt(s)) != null ? x : Ust;
return {
name: "arrow",
enabled: !mz(C),
options: {
element: C,
padding: P
}
};
}), d = Kt(() => ({
onFirstUpdate: () => {
b();
},
...Fst(t, [
yt(u),
yt(a)
])
})), T = Kt(() => Bst(t.referenceEl) || yt(n)), { attributes: f, state: Q, styles: y, update: b, forceUpdate: w, instanceRef: S } = H2t(T, r, d);
return on(S, (x) => e.value = x), Z1(() => {
on(() => {
var x;
return (x = yt(T)) == null ? void 0 : x.getBoundingClientRect();
}, () => {
b();
});
}), {
attributes: f,
arrowRef: o,
contentRef: r,
instanceRef: S,
state: Q,
styles: y,
role: i,
forceUpdate: w,
update: b
};
}, $st = (t, {
attributes: e,
styles: r,
role: n
}) => {
const { nextZIndex: i } = vS(), o = Bn("popper"), s = Kt(() => yt(e).popper), a = Ve(ro(t.zIndex) ? t.zIndex : i()), u = Kt(() => [
o.b(),
o.is("pure", t.pure),
o.is(t.effect),
t.popperClass
]), d = Kt(() => [
{ zIndex: yt(a) },
yt(r).popper,
t.popperStyle || {}
]), T = Kt(() => n.value === "dialog" ? "false" : void 0), f = Kt(() => yt(r).arrow || {});
return {
ariaModal: T,
arrowStyle: f,
contentAttrs: s,
contentClass: u,
contentStyle: d,
contentZIndex: a,
updateZIndex: () => {
a.value = ro(t.zIndex) ? t.zIndex : i();
}
};
}, Zst = (t, e) => {
const r = Ve(!1), n = Ve();
return {
focusStartRef: n,
trapped: r,
onFocusAfterReleased: (i) => {
var o;
((o = i.detail) == null ? void 0 : o.focusReason) !== "pointer" && (n.value = "first", e("blur"));
},
onFocusAfterTrapped: () => {
e("focus");
},
onFocusInTrap: (i) => {
t.visible && !r.value && (i.target && (n.value = i.target), r.value = !0);
},
onFocusoutPrevented: (i) => {
t.trapping || (i.detail.focusReason === "pointer" && i.preventDefault(), r.value = !1);
},
onReleaseRequested: () => {
r.value = !1, e("close");
}
};
}, Wst = mr({
name: "ElPopperContent"
}), qst = /* @__PURE__ */ mr({
...Wst,
props: sU,
emits: Dst,
setup(t, { expose: e, emit: r }) {
const n = t, {
focusStartRef: i,
trapped: o,
onFocusAfterReleased: s,
onFocusAfterTrapped: a,
onFocusInTrap: u,
onFocusoutPrevented: d,
onReleaseRequested: T
} = Zst(n, r), { attributes: f, arrowRef: Q, contentRef: y, styles: b, instanceRef: w, role: S, update: x } = Gst(n), {
ariaModal: C,
arrowStyle: P,
contentAttrs: R,
contentClass: F,
contentStyle: U,
updateZIndex: $
} = $st(n, {
styles: b,
attributes: f,
role: S
}), rt = ln(BQ, void 0), tt = Ve();
G1(Yz, {
arrowStyle: P,
arrowRef: Q,
arrowOffset: tt
}), rt && G1(BQ, {
...rt,
addInputId: O5,
removeInputId: O5
});
let at;
const lt = (Vt = !0) => {
x(), Vt && $();
}, xt = () => {
lt(!1), n.visible && n.focusOnShow ? o.value = !0 : n.visible === !1 && (o.value = !1);
};
return Z1(() => {
on(() => n.triggerTargetEl, (Vt, Zt) => {
at == null || at(), at = void 0;
const ce = yt(Vt || y.value), oe = yt(Zt || y.value);
P5(ce) && (at = on([S, () => n.ariaLabel, C, () => n.id], (Se) => {
["role", "aria-label", "aria-modal", "id"].forEach((Ir, qr) => {
vg(Se[qr]) ? ce.removeAttribute(Ir) : ce.setAttribute(Ir, Se[qr]);
});
}, { immediate: !0 })), oe !== ce && P5(oe) && ["role", "aria-label", "aria-modal", "id"].forEach((Se) => {
oe.removeAttribute(Se);
});
}, { immediate: !0 }), on(() => n.visible, xt, { immediate: !0 });
}), Rs(() => {
at == null || at(), at = void 0;
}), e({
popperContentRef: y,
popperInstanceRef: w,
updatePopper: lt,
contentStyle: U
}), (Vt, Zt) => (le(), Ye("div", rl({
ref_key: "contentRef",
ref: y
}, yt(R), {
style: yt(U),
class: yt(F),
tabindex: "-1",
onMouseenter: (ce) => Vt.$emit("mouseenter", ce),
onMouseleave: (ce) => Vt.$emit("mouseleave", ce)
}), [
Pe(yt(oU), {
trapped: yt(o),
"trap-on-focus-in": !0,
"focus-trap-el": yt(y),
"focus-start-el": yt(i),
onFocusAfterTrapped: yt(a),
onFocusAfterReleased: yt(s),
onFocusin: yt(u),
onFocusoutPrevented: yt(d),
onReleaseRequested: yt(T)
}, {
default: fe(() => [
kr(Vt.$slots, "default")
]),
_: 3
}, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
], 16, ["onMouseenter", "onMouseleave"]));
}
});
var Xst = /* @__PURE__ */ Hn(qst, [["__file", "content.vue"]]);
const Kst = v2(gst), MS = Symbol("elTooltip"), W2 = Sn({
...V2t,
...sU,
appendTo: {
type: Ur([String, Object])
},
content: {
type: String,
default: ""
},
rawContent: Boolean,
persistent: Boolean,
visible: {
type: Ur(Boolean),
default: null
},
transition: String,
teleported: {
type: Boolean,
default: !0
},
disabled: Boolean,
...sl(["ariaLabel"])
}), Bh = Sn({
...rU,
disabled: Boolean,
trigger: {
type: Ur([String, Array]),
default: "hover"
},
triggerKeys: {
type: Ur(Array),
default: () => [Nh.enter, Nh.space]
}
}), {
useModelToggleProps: Yst,
useModelToggleEmits: Jst,
useModelToggle: tat
} = Mot("visible"), eat = Sn({
...Jz,
...Yst,
...W2,
...Bh,
...tU,
showArrow: {
type: Boolean,
default: !0
}
}), rat = [
...Jst,
"before-show",
"before-hide",
"show",
"hide",
"open",
"close"
], nat = (t, e) => p2(t) ? t.includes(e) : t === e, Kl = (t, e, r) => (n) => {
nat(yt(t), e) && r(n);
}, iat = mr({
name: "ElTooltipTrigger"
}), oat = /* @__PURE__ */ mr({
...iat,
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(MS, void 0), T = Ve(null), f = () => {
if (yt(i) || r.disabled)
return !0;
}, Q = K2(r, "trigger"), y = s4(f, Kl(Q, "hover", a)), b = s4(f, Kl(Q, "hover", u)), w = s4(f, Kl(Q, "click", (R) => {
R.button === 0 && d(R);
})), S = s4(f, Kl(Q, "focus", a)), x = s4(f, Kl(Q, "focus", u)), C = s4(f, Kl(Q, "contextmenu", (R) => {
R.preventDefault(), d(R);
})), P = s4(f, (R) => {
const { code: F } = R;
r.triggerKeys.includes(F) && (R.preventDefault(), d(R));
});
return e({
triggerRef: T
}), (R, F) => (le(), Ar(yt(xst), {
id: yt(o),
"virtual-ref": R.virtualRef,
open: yt(s),
"virtual-triggering": R.virtualTriggering,
class: Be(yt(n).e("trigger")),
onBlur: yt(x),
onClick: yt(w),
onContextmenu: yt(C),
onFocus: yt(S),
onMouseenter: yt(y),
onMouseleave: yt(b),
onKeydown: yt(P)
}, {
default: fe(() => [
kr(R.$slots, "default")
]),
_: 3
}, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]));
}
});
var sat = /* @__PURE__ */ Hn(oat, [["__file", "trigger.vue"]]);
const aat = Sn({
to: {
type: Ur([String, Object]),
required: !0
},
disabled: Boolean
}), lat = /* @__PURE__ */ mr({
__name: "teleport",
props: aat,
setup(t) {
return (e, r) => e.disabled ? kr(e.$slots, "default", { key: 0 }) : (le(), Ar(Het, {
key: 1,
to: e.to
}, [
kr(e.$slots, "default")
], 8, ["to"]));
}
});
var cat = /* @__PURE__ */ Hn(lat, [["__file", "teleport.vue"]]);
const aU = v2(cat), uat = mr({
name: "ElTooltipContent",
inheritAttrs: !1
}), hat = /* @__PURE__ */ mr({
...uat,
props: W2,
setup(t, { expose: e }) {
const r = t, { selector: n } = Gz(), i = Bn("tooltip"), o = Ve(null);
let s;
const {
controlled: a,
id: u,
open: d,
trigger: T,
onClose: f,
onOpen: Q,
onShow: y,
onHide: b,
onBeforeShow: w,
onBeforeHide: S
} = ln(MS, void 0), x = Kt(() => r.transition || `${i.namespace.value}-fade-in-linear`), C = Kt(() => process.env.NODE_ENV === "test" ? !0 : r.persistent);
Rs(() => {
s == null || s();
});
const P = Kt(() => yt(C) ? !0 : yt(d)), R = Kt(() => r.disabled ? !1 : yt(d)), F = Kt(() => r.appendTo || n.value), U = Kt(() => {
var oe;
return (oe = r.style) != null ? oe : {};
}), $ = Ve(!0), rt = () => {
b(), $.value = !0;
}, tt = () => {
if (yt(a))
return !0;
}, at = s4(tt, () => {
r.enterable && yt(T) === "hover" && Q();
}), lt = s4(tt, () => {
yt(T) === "hover" && f();
}), xt = () => {
var oe, Se;
(Se = (oe = o.value) == null ? void 0 : oe.updatePopper) == null || Se.call(oe), w == null || w();
}, Vt = () => {
S == null || S();
}, Zt = () => {
y(), s = Bet(Kt(() => {
var oe;
return (oe = o.value) == null ? void 0 : oe.popperContentRef;
}), () => {
yt(a) || yt(T) !== "hover" && f();
});
}, ce = () => {
r.virtualTriggering || f();
};
return on(() => yt(d), (oe) => {
oe ? $.value = !1 : s == null || s();
}, {
flush: "post"
}), on(() => r.content, () => {
var oe, Se;
(Se = (oe = o.value) == null ? void 0 : oe.updatePopper) == null || Se.call(oe);
}), e({
contentRef: o
}), (oe, Se) => (le(), Ar(yt(aU), {
disabled: !oe.teleported,
to: yt(F)
}, {
default: fe(() => [
Pe(cd, {
name: yt(x),
onAfterLeave: rt,
onBeforeEnter: xt,
onAfterEnter: Zt,
onBeforeLeave: Vt
}, {
default: fe(() => [
yt(P) ? Ti((le(), Ar(yt(Xst), rl({
key: 0,
id: yt(u),
ref_key: "contentRef",
ref: o
}, oe.$attrs, {
"aria-label": oe.ariaLabel,
"aria-hidden": $.value,
"boundaries-padding": oe.boundariesPadding,
"fallback-placements": oe.fallbackPlacements,
"gpu-acceleration": oe.gpuAcceleration,
offset: oe.offset,
placement: oe.placement,
"popper-options": oe.popperOptions,
strategy: oe.strategy,
effect: oe.effect,
enterable: oe.enterable,
pure: oe.pure,
"popper-class": oe.popperClass,
"popper-style": [oe.popperStyle, yt(U)],
"reference-el": oe.referenceEl,
"trigger-target-el": oe.triggerTargetEl,
visible: yt(R),
"z-index": oe.zIndex,
onMouseenter: yt(at),
onMouseleave: yt(lt),
onBlur: ce,
onClose: yt(f)
}), {
default: fe(() => [
kr(oe.$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, yt(R)]
]) : Br("v-if", !0)
]),
_: 3
}, 8, ["name"])
]),
_: 3
}, 8, ["disabled", "to"]));
}
});
var dat = /* @__PURE__ */ Hn(hat, [["__file", "content.vue"]]);
const pat = mr({
name: "ElTooltip"
}), Tat = /* @__PURE__ */ mr({
...pat,
props: eat,
emits: rat,
setup(t, { expose: e, emit: r }) {
const n = t;
k2t();
const i = U5(), o = Ve(), s = Ve(), a = () => {
var x;
const C = yt(o);
C && ((x = C.popperInstanceRef) == null || x.update());
}, u = Ve(!1), d = Ve(), { show: T, hide: f, hasUpdateHandler: Q } = tat({
indicator: u,
toggleReason: d
}), { onOpen: y, onClose: b } = I2t({
showAfter: K2(n, "showAfter"),
hideAfter: K2(n, "hideAfter"),
autoClose: K2(n, "autoClose"),
open: T,
close: f
}), w = Kt(() => S4(n.visible) && !Q.value);
G1(MS, {
controlled: w,
id: i,
open: Wj(u),
trigger: K2(n, "trigger"),
onOpen: (x) => {
y(x);
},
onClose: (x) => {
b(x);
},
onToggle: (x) => {
yt(u) ? b(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 S = (x) => {
var C, P;
const R = (P = (C = s.value) == null ? void 0 : C.contentRef) == null ? void 0 : P.popperContentRef, F = (x == null ? void 0 : x.relatedTarget) || document.activeElement;
return R && R.contains(F);
};
return wet(() => u.value && f()), e({
popperRef: o,
contentRef: s,
isFocusInsideContent: S,
updatePopper: a,
onOpen: y,
onClose: b,
hide: f
}), (x, C) => (le(), Ar(yt(Kst), {
ref_key: "popperRef",
ref: o,
role: x.role
}, {
default: fe(() => [
Pe(sat, {
disabled: x.disabled,
trigger: x.trigger,
"trigger-keys": x.triggerKeys,
"virtual-ref": x.virtualRef,
"virtual-triggering": x.virtualTriggering
}, {
default: fe(() => [
x.$slots.default ? kr(x.$slots, "default", { key: 0 }) : Br("v-if", !0)
]),
_: 3
}, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
Pe(dat, {
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(() => [
kr(x.$slots, "content", {}, () => [
x.rawContent ? (le(), Ye("span", {
key: 0,
innerHTML: x.content
}, null, 8, ["innerHTML"])) : (le(), Ye("span", { key: 1 }, fi(x.content), 1))
]),
x.showArrow ? (le(), Ar(yt(_st), {
key: 0,
"arrow-offset": x.arrowOffset
}, null, 8, ["arrow-offset"])) : Br("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 fat = /* @__PURE__ */ Hn(Tat, [["__file", "tooltip.vue"]]);
const lU = v2(fat), cU = Symbol("buttonGroupContextKey"), Qat = (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 = Ve(), u = pg(), d = Kt(() => t.type || (r == null ? void 0 : r.type) || ""), T = Kt(() => {
var y, b, w;
return (w = (b = t.autoInsertSpace) != null ? b : (y = n.value) == null ? void 0 : y.autoInsertSpace) != null ? w : !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 y;
const b = (y = u.default) == null ? void 0 : y.call(u);
if (T.value && (b == null ? void 0 : b.length) === 1) {
const w = b[0];
if ((w == null ? void 0 : w.type) === Zj) {
const S = w.children;
return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(S.trim());
}
}
return !1;
});
return {
_disabled: s,
_size: o,
_type: d,
_ref: a,
_props: f,
shouldAddSpace: Q,
handleClick: (y) => {
if (s.value || t.loading) {
y.stopPropagation();
return;
}
t.nativeType === "reset" && (i == null || i.resetFields()), e("click", y);
}
};
}, mat = [
"default",
"primary",
"success",
"warning",
"info",
"danger",
"text",
""
], gat = ["button", "submit", "reset"], gx = Sn({
size: J8,
disabled: Boolean,
type: {
type: String,
values: mat,
default: ""
},
icon: {
type: b8
},
nativeType: {
type: String,
values: gat,
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: Ur([String, Object]),
default: "button"
}
}), yat = {
click: (t) => t instanceof MouseEvent
};
function io(t, e) {
vat(t) && (t = "100%");
var r = _at(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 vat(t) {
return typeof t == "string" && t.indexOf(".") !== -1 && parseFloat(t) === 1;
}
function _at(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 E5(t) {
return t.length === 1 ? "0" + t : String(t);
}
function bat(t, e, r) {
return {
r: io(t, 255) * 255,
g: io(e, 255) * 255,
b: io(r, 255) * 255
};
}
function gk(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 Lat(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 yk(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 wat(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 vk(t, e, r, n) {
var i = [
E5(Math.round(t).toString(16)),
E5(Math.round(e).toString(16)),
E5(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 xat(t, e, r, n, i) {
var o = [
E5(Math.round(t).toString(16)),
E5(Math.round(e).toString(16)),
E5(Math.round(r).toString(16)),
E5(Mat(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 Mat(t) {
return Math.round(parseFloat(t) * 255).toString(16);
}
function _k(t) {
return U2(t) / 255;
}
function U2(t) {
return parseInt(t, 16);
}
function Eat(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 Sat(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 = Cat(t)), typeof t == "object" && ($3(t.r) && $3(t.g) && $3(t.b) ? (e = bat(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 = wat(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 = Lat(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 Hat = "[-\\+]?\\d+%?", Aat = "[-\\+]?\\d*\\.\\d+%?", X6 = "(?:".concat(Aat, ")|(?:").concat(Hat, ")"), 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 Cat(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: _k(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: _k(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 Oat = (
/** @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 = Eat(e)), this.originalInput = e;
var i = Sat(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 = yk(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 = yk(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 = gk(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 = gk(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), vk(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), xat(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 = "#" + vk(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 Pat(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 Oat(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 kat = mr({
name: "ElButton"
}), Vat = /* @__PURE__ */ mr({
...kat,
props: gx,
emits: yat,
setup(t, { expose: e, emit: r }) {
const n = t, i = Pat(n), o = Bn("button"), { _ref: s, _size: a, _type: u, _disabled: d, _props: T, shouldAddSpace: f, handleClick: Q } = Qat(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
}), (b, w) => (le(), Ar(Ss(b.tag), rl({
ref_key: "_ref",
ref: s
}, yt(T), {
class: yt(y),
style: yt(i),
onClick: yt(Q)
}), {
default: fe(() => [
b.loading ? (le(), Ye(to, { key: 0 }, [
b.$slots.loading ? kr(b.$slots, "loading", { key: 0 }) : (le(), Ar(yt(p3), {
key: 1,
class: Be(yt(o).is("loading"))
}, {
default: fe(() => [
(le(), Ar(Ss(b.loadingIcon)))
]),
_: 1
}, 8, ["class"]))
], 64)) : b.icon || b.$slots.icon ? (le(), Ar(yt(p3), { key: 1 }, {
default: fe(() => [
b.icon ? (le(), Ar(Ss(b.icon), { key: 0 })) : kr(b.$slots, "icon", { key: 1 })
]),
_: 3
})) : Br("v-if", !0),
b.$slots.default ? (le(), Ye("span", {
key: 2,
class: Be({ [yt(o).em("text", "expand")]: yt(f) })
}, [
kr(b.$slots, "default")
], 2)) : Br("v-if", !0)
]),
_: 3
}, 16, ["class", "style", "onClick"]));
}
});
var Iat = /* @__PURE__ */ Hn(Vat, [["__file", "button.vue"]]);
const Rat = {
size: gx.size,
type: gx.type
}, Nat = mr({
name: "ElButtonGroup"
}), Dat = /* @__PURE__ */ mr({
...Nat,
props: Rat,
setup(t) {
const e = t;
G1(cU, u3({
size: K2(e, "size"),
type: K2(e, "type")
}));
const r = Bn("button");
return (n, i) => (le(), Ye("div", {
class: Be(yt(r).b("group"))
}, [
kr(n.$slots, "default")
], 2));
}
});
var hU = /* @__PURE__ */ Hn(Dat, [["__file", "button-group.vue"]]);
const dU = v2(Iat, {
ButtonGroup: hU
});
ol(hU);
var Fat = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Bat(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 bk(t, e) {
let r = [];
return Array.isArray(e.arg) ? r = e.arg : P5(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((b) => b == null ? void 0 : b.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 jat = {
beforeMount(t, e) {
A6.has(t) || A6.set(t, []), A6.get(t).push({
documentHandler: bk(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: bk(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 = {
[Zo]: (t) => sa(t) || ro(t) || S4(t),
change: (t) => sa(t) || ro(t) || S4(t)
}, ec = Symbol("checkboxGroupContextKey"), zat = ({
model: t,
isChecked: e
}) => {
const r = ln(ec, void 0), n = Kt(() => {
var i, o;
const s = (i = r == null ? void 0 : r.max) == null ? void 0 : i.value, a = (o = r == null ? void 0 : r.min) == null ? void 0 : o.value;
return !q6(s) && t.value.length >= s && !e.value || !q6(a) && t.value.length <= a && e.value;
});
return {
isDisabled: xg(Kt(() => (r == null ? void 0 : r.disabled.value) || n.value)),
isLimitDisabled: n
};
}, Uat = (t, {
model: e,
isLimitExceeded: r,
hasOwnLabel: n,
isDisabled: i,
isLabeledByFormItem: o
}) => {
const s = ln(ec, void 0), { formItem: a } = tc(), { emit: u } = $1();
function d(b) {
var w, S, x, C;
return [!0, t.trueValue, t.trueLabel].includes(b) ? (S = (w = t.trueValue) != null ? w : t.trueLabel) != null ? S : !0 : (C = (x = t.falseValue) != null ? x : t.falseLabel) != null ? C : !1;
}
function T(b, w) {
u("change", d(b), w);
}
function f(b) {
if (r.value)
return;
const w = b.target;
u("change", d(w.checked), b);
}
async function Q(b) {
r.value || !n.value && !i.value && o.value && (b.composedPath().some((w) => w.tagName === "LABEL") || (e.value = d([!1, t.falseValue, t.falseLabel].includes(e.value)), await i1(), T(e.value, b)));
}
const y = Kt(() => (s == null ? void 0 : s.validateEvent) || t.validateEvent);
return on(() => t.modelValue, () => {
y.value && (a == null || a.validate("change").catch((b) => y2(b)));
}), {
handleChange: f,
onClickRoot: Q
};
}, Gat = (t) => {
const e = Ve(!1), { emit: r } = $1(), n = ln(ec, void 0), i = Kt(() => q6(n) === !1), o = Ve(!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(Zo, a), e.value = a);
}
});
return {
model: s,
isGroup: i,
isLimitExceeded: o
};
}, $at = (t, e, { model: r }) => {
const n = ln(ec, void 0), i = Ve(!1), o = Kt(() => Ih(t.value) ? t.label : t.value), s = Kt(() => {
const T = r.value;
return S4(T) ? T : p2(T) ? T2(o.value) ? T.map(Ph).some((f) => NQ(f, o.value)) : T.map(Ph).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 || !Ih(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 } = Gat(t), {
isFocused: s,
isChecked: a,
checkboxButtonSize: u,
checkboxSize: d,
hasOwnLabel: T,
actualValue: f
} = $at(t, e, { model: n }), { isDisabled: Q } = zat({ model: n, isChecked: a }), { inputId: y, isLabeledByFormItem: b } = Mg(t, {
formItemContext: r,
disableIdGeneration: T,
disableIdManagement: i
}), { handleChange: w, onClickRoot: S } = Uat(t, {
model: n,
isLimitExceeded: o,
hasOwnLabel: T,
isDisabled: Q,
isLabeledByFormItem: b
});
return (() => {
function x() {
var C, P;
p2(n.value) && !n.value.includes(f.value) ? n.value.push(f.value) : n.value = (P = (C = t.trueValue) != null ? C : t.trueLabel) != null ? P : !0;
}
t.checked && x();
})(), 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 && Ih(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: b,
isChecked: a,
isDisabled: Q,
isFocused: s,
checkboxButtonSize: u,
checkboxSize: d,
hasOwnLabel: T,
model: n,
actualValue: f,
handleChange: w,
onClickRoot: S
};
}, Zat = mr({
name: "ElCheckbox"
}), Wat = /* @__PURE__ */ mr({
...Zat,
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), b = Bn("checkbox"), w = Kt(() => [
b.b(),
b.m(u.value),
b.is("disabled", s.value),
b.is("bordered", e.border),
b.is("checked", o.value)
]), S = Kt(() => [
b.e("input"),
b.is("disabled", s.value),
b.is("checked", o.value),
b.is("indeterminate", e.indeterminate),
b.is("focus", a.value)
]);
return (x, C) => (le(), Ar(Ss(!yt(d) && yt(i) ? "span" : "label"), {
class: Be(yt(w)),
"aria-controls": x.indeterminate ? x.ariaControls : null,
onClick: yt(y)
}, {
default: fe(() => {
var P, R, F, U;
return [
je("span", {
class: Be(yt(S))
}, [
x.trueValue || x.falseValue || x.trueLabel || x.falseLabel ? Ti((le(), Ye("input", {
key: 0,
id: yt(n),
"onUpdate:modelValue": ($) => g2(T) ? T.value = $ : null,
class: Be(yt(b).e("original")),
type: "checkbox",
indeterminate: x.indeterminate,
name: x.name,
tabindex: x.tabindex,
disabled: yt(s),
"true-value": (R = (P = x.trueValue) != null ? P : x.trueLabel) != null ? R : !0,
"false-value": (U = (F = x.falseValue) != null ? F : x.falseLabel) != null ? U : !1,
onChange: yt(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"])), [
[kQ, yt(T)]
]) : Ti((le(), Ye("input", {
key: 1,
id: yt(n),
"onUpdate:modelValue": ($) => g2(T) ? T.value = $ : null,
class: Be(yt(b).e("original")),
type: "checkbox",
indeterminate: x.indeterminate,
disabled: yt(s),
value: yt(f),
name: x.name,
tabindex: x.tabindex,
onChange: yt(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"])), [
[kQ, yt(T)]
]),
je("span", {
class: Be(yt(b).e("inner"))
}, null, 2)
], 2),
yt(d) ? (le(), Ye("span", {
key: 0,
class: Be(yt(b).e("label"))
}, [
kr(x.$slots, "default"),
x.$slots.default ? Br("v-if", !0) : (le(), Ye(to, { key: 0 }, [
xn(fi(x.label), 1)
], 64))
], 2)) : Br("v-if", !0)
];
}),
_: 3
}, 8, ["class", "aria-controls", "onClick"]));
}
});
var qat = /* @__PURE__ */ Hn(Wat, [["__file", "checkbox.vue"]]);
const Xat = mr({
name: "ElCheckboxButton"
}), Kat = /* @__PURE__ */ mr({
...Xat,
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 b, w, S, x;
const C = (w = (b = T == null ? void 0 : T.fill) == null ? void 0 : b.value) != null ? w : "";
return {
backgroundColor: C,
borderColor: C,
color: (x = (S = T == null ? void 0 : T.textColor) == null ? void 0 : S.value) != null ? x : "",
boxShadow: C ? `-1px 0 0 0 ${C}` : 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 (b, w) => {
var S, x, C, P;
return le(), Ye("label", {
class: Be(yt(y))
}, [
b.trueValue || b.falseValue || b.trueLabel || b.falseLabel ? Ti((le(), Ye("input", {
key: 0,
"onUpdate:modelValue": (R) => g2(a) ? a.value = R : null,
class: Be(yt(f).be("button", "original")),
type: "checkbox",
name: b.name,
tabindex: b.tabindex,
disabled: yt(o),
"true-value": (x = (S = b.trueValue) != null ? S : b.trueLabel) != null ? x : !0,
"false-value": (P = (C = b.falseValue) != null ? C : b.falseLabel) != null ? P : !1,
onChange: yt(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"])), [
[kQ, yt(a)]
]) : Ti((le(), Ye("input", {
key: 1,
"onUpdate:modelValue": (R) => g2(a) ? a.value = R : null,
class: Be(yt(f).be("button", "original")),
type: "checkbox",
name: b.name,
tabindex: b.tabindex,
disabled: yt(o),
value: yt(u),
onChange: yt(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"])), [
[kQ, yt(a)]
]),
b.$slots.default || b.label ? (le(), Ye("span", {
key: 2,
class: Be(yt(f).be("button", "inner")),
style: E1(yt(i) ? yt(Q) : void 0)
}, [
kr(b.$slots, "default", {}, () => [
xn(fi(b.label), 1)
])
], 6)) : Br("v-if", !0)
], 2);
};
}
});
var QU = /* @__PURE__ */ Hn(Kat, [["__file", "checkbox-button.vue"]]);
const Yat = Sn({
modelValue: {
type: Ur(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"])
}), Jat = {
[Zo]: (t) => p2(t),
change: (t) => p2(t)
}, t3t = mr({
name: "ElCheckboxGroup"
}), e3t = /* @__PURE__ */ mr({
...t3t,
props: Yat,
emits: Jat,
setup(t, { emit: e }) {
const r = t, n = Bn("checkbox"), { formItem: i } = tc(), { inputId: o, isLabeledByFormItem: s } = Mg(r, {
formItemContext: i
}), a = async (d) => {
e(Zo, d), await i1(), e("change", d);
}, u = Kt({
get() {
return r.modelValue;
},
set(d) {
a(d);
}
});
return G1(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 le(), Ar(Ss(d.tag), {
id: yt(o),
class: Be(yt(n).b("group")),
role: "group",
"aria-label": yt(s) ? void 0 : d.ariaLabel || "checkbox-group",
"aria-labelledby": yt(s) ? (f = yt(i)) == null ? void 0 : f.labelId : void 0
}, {
default: fe(() => [
kr(d.$slots, "default")
]),
_: 3
}, 8, ["id", "class", "aria-label", "aria-labelledby"]);
};
}
});
var mU = /* @__PURE__ */ Hn(e3t, [["__file", "checkbox-group.vue"]]);
const gU = v2(qat, {
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
}
}), r3t = Sn({
...vU,
border: Boolean
}), _U = {
[Zo]: (t) => sa(t) || ro(t) || S4(t),
[cS]: (t) => sa(t) || ro(t) || S4(t)
}, bU = Symbol("radioGroupKey"), LU = (t, e) => {
const r = Ve(), n = ln(bU, void 0), i = Kt(() => !!n), o = Kt(() => Ih(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(Zo, 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 = Ve(!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 && Ih(t.value))), {
radioRef: r,
isGroup: i,
radioGroup: n,
focus: d,
size: a,
disabled: u,
tabIndex: T,
modelValue: s,
actualValue: o
};
}, n3t = mr({
name: "ElRadio"
}), i3t = /* @__PURE__ */ mr({
...n3t,
props: r3t,
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 b;
return le(), Ye("label", {
class: Be([
yt(n).b(),
yt(n).is("disabled", yt(u)),
yt(n).is("focus", yt(s)),
yt(n).is("bordered", Q.border),
yt(n).is("checked", yt(d) === yt(T)),
yt(n).m(yt(a))
])
}, [
je("span", {
class: Be([
yt(n).e("input"),
yt(n).is("disabled", yt(u)),
yt(n).is("checked", yt(d) === yt(T))
])
}, [
Ti(je("input", {
ref_key: "radioRef",
ref: i,
"onUpdate:modelValue": (w) => g2(d) ? d.value = w : null,
class: Be(yt(n).e("original")),
value: yt(T),
name: Q.name || ((b = yt(o)) == null ? void 0 : b.name),
disabled: yt(u),
checked: yt(d) === yt(T),
type: "radio",
onFocus: (w) => s.value = !0,
onBlur: (w) => s.value = !1,
onChange: f,
onClick: m1(() => {
}, ["stop"])
}, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [
[qj, yt(d)]
]),
je("span", {
class: Be(yt(n).e("inner"))
}, null, 2)
], 2),
je("span", {
class: Be(yt(n).e("label")),
onKeydown: m1(() => {
}, ["stop"])
}, [
kr(Q.$slots, "default", {}, () => [
xn(fi(Q.label), 1)
])
], 42, ["onKeydown"])
], 2);
};
}
});
var o3t = /* @__PURE__ */ Hn(i3t, [["__file", "radio.vue"]]);
const s3t = Sn({
...vU
}), a3t = mr({
name: "ElRadioButton"
}), l3t = /* @__PURE__ */ mr({
...a3t,
props: s3t,
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 le(), Ye("label", {
class: Be([
yt(r).b("button"),
yt(r).is("active", yt(a) === yt(d)),
yt(r).is("disabled", yt(s)),
yt(r).is("focus", yt(i)),
yt(r).bm("button", yt(o))
])
}, [
Ti(je("input", {
ref_key: "radioRef",
ref: n,
"onUpdate:modelValue": (b) => g2(a) ? a.value = b : null,
class: Be(yt(r).be("button", "original-radio")),
value: yt(d),
type: "radio",
name: f.name || ((y = yt(u)) == null ? void 0 : y.name),
disabled: yt(s),
onFocus: (b) => i.value = !0,
onBlur: (b) => i.value = !1,
onClick: m1(() => {
}, ["stop"])
}, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "onFocus", "onBlur", "onClick"]), [
[qj, yt(a)]
]),
je("span", {
class: Be(yt(r).be("button", "inner")),
style: E1(yt(a) === yt(d) ? yt(T) : {}),
onKeydown: m1(() => {
}, ["stop"])
}, [
kr(f.$slots, "default", {}, () => [
xn(fi(f.label), 1)
])
], 46, ["onKeydown"])
], 2);
};
}
});
var wU = /* @__PURE__ */ Hn(l3t, [["__file", "radio-button.vue"]]);
const c3t = 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"])
}), u3t = _U, h3t = mr({
name: "ElRadioGroup"
}), d3t = /* @__PURE__ */ mr({
...h3t,
props: c3t,
emits: u3t,
setup(t, { emit: e }) {
const r = t, n = Bn("radio"), i = U5(), o = Ve(), { formItem: s } = tc(), { inputId: a, isLabeledByFormItem: u } = Mg(r, {
formItemContext: s
}), d = (f) => {
e(Zo, f), i1(() => e("change", f));
};
Z1(() => {
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 G1(bU, u3({
...s0(r),
changeEvent: d,
name: T
})), on(() => r.modelValue, () => {
r.validateEvent && (s == null || s.validate("change").catch((f) => y2(f)));
}), (f, Q) => (le(), Ye("div", {
id: yt(a),
ref_key: "radioGroupRef",
ref: o,
class: Be(yt(n).b("group")),
role: "radiogroup",
"aria-label": yt(u) ? void 0 : f.ariaLabel || "radio-group",
"aria-labelledby": yt(u) ? yt(s).labelId : void 0
}, [
kr(f.$slots, "default")
], 10, ["id", "aria-label", "aria-labelledby"]));
}
});
var xU = /* @__PURE__ */ Hn(d3t, [["__file", "radio-group.vue"]]);
const MU = v2(o3t, {
RadioButton: wU,
RadioGroup: xU
}), EU = 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
}), p3t = {
close: (t) => t instanceof MouseEvent,
click: (t) => t instanceof MouseEvent
}, T3t = mr({
name: "ElTag"
}), f3t = /* @__PURE__ */ mr({
...T3t,
props: vx,
emits: p3t,
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 ? (le(), Ye("span", {
key: 0,
class: Be(yt(o)),
style: E1({ backgroundColor: d.color }),
onClick: a
}, [
je("span", {
class: Be(yt(i).e("content"))
}, [
kr(d.$slots, "default")
], 2),
d.closable ? (le(), Ar(yt(p3), {
key: 0,
class: Be(yt(i).e("close")),
onClick: m1(s, ["stop"])
}, {
default: fe(() => [
Pe(yt(Tx))
]),
_: 1
}, 8, ["class", "onClick"])) : Br("v-if", !0)
], 6)) : (le(), Ar(cd, {
key: 1,
name: `${yt(i).namespace.value}-zoom-in-center`,
appear: "",
onVnodeMounted: u
}, {
default: fe(() => [
je("span", {
class: Be(yt(o)),
style: E1({ backgroundColor: d.color }),
onClick: a
}, [
je("span", {
class: Be(yt(i).e("content"))
}, [
kr(d.$slots, "default")
], 2),
d.closable ? (le(), Ar(yt(p3), {
key: 0,
class: Be(yt(i).e("close")),
onClick: m1(s, ["stop"])
}, {
default: fe(() => [
Pe(yt(Tx))
]),
_: 1
}, 8, ["class", "onClick"])) : Br("v-if", !0)
], 6)
]),
_: 3
}, 8, ["name"]));
}
});
var Q3t = /* @__PURE__ */ Hn(f3t, [["__file", "tag.vue"]]);
const m3t = v2(Q3t), SU = Symbol("rowContextKey"), g3t = [
"start",
"center",
"end",
"space-around",
"space-between",
"space-evenly"
], y3t = ["top", "middle", "bottom"], v3t = Sn({
tag: {
type: String,
default: "div"
},
gutter: {
type: Number,
default: 0
},
justify: {
type: String,
values: g3t,
default: "start"
},
align: {
type: String,
values: y3t
}
}), _3t = mr({
name: "ElRow"
}), b3t = /* @__PURE__ */ mr({
..._3t,
props: v3t,
setup(t) {
const e = t, r = Bn("row"), n = Kt(() => e.gutter);
G1(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) => (le(), Ar(Ss(s.tag), {
class: Be(yt(o)),
style: E1(yt(i))
}, {
default: fe(() => [
kr(s.$slots, "default")
]),
_: 3
}, 8, ["class", "style"]));
}
});
var L3t = /* @__PURE__ */ Hn(b3t, [["__file", "row.vue"]]);
const Td = v2(L3t), w3t = 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: Ur([Number, Object]),
default: () => cu({})
},
sm: {
type: Ur([Number, Object]),
default: () => cu({})
},
md: {
type: Ur([Number, Object]),
default: () => cu({})
},
lg: {
type: Ur([Number, Object]),
default: () => cu({})
},
xl: {
type: Ur([Number, Object]),
default: () => cu({})
}
}), x3t = mr({
name: "ElCol"
}), M3t = /* @__PURE__ */ mr({
...x3t,
props: w3t,
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((a) => {
const u = e[a];
ro(u) && (a === "span" ? s.push(n.b(`${e[a]}`)) : u > 0 && s.push(n.b(`${a}-${e[a]}`)));
}), ["xs", "sm", "md", "lg", "xl"].forEach((a) => {
ro(e[a]) ? s.push(n.b(`${a}-${e[a]}`)) : T2(e[a]) && Object.entries(e[a]).forEach(([u, d]) => {
s.push(u !== "span" ? n.b(`${a}-${u}-${d}`) : n.b(`${a}-${d}`));
});
}), r.value && s.push(n.is("guttered")), [n.b(), s];
});
return (s, a) => (le(), Ar(Ss(s.tag), {
class: Be(yt(o)),
style: E1(yt(i))
}, {
default: fe(() => [
kr(s.$slots, "default")
]),
_: 3
}, 8, ["class", "style"]));
}
});
var E3t = /* @__PURE__ */ Hn(M3t, [["__file", "col.vue"]]);
const fd = v2(E3t), S3t = Sn({
mask: {
type: Boolean,
default: !0
},
customMaskEvent: Boolean,
overlayClass: {
type: Ur([
String,
Array,
Object
])
},
zIndex: {
type: Ur([String, Number])
}
}), H3t = {
click: (t) => t instanceof MouseEvent
}, A3t = "overlay";
var C3t = mr({
name: "ElOverlay",
props: S3t,
emits: H3t,
setup(t, { slots: e, emit: r }) {
const n = Bn(A3t), i = (u) => {
r("click", u);
}, { onClick: o, onMousedown: s, onMouseup: a } = zz(t.customMaskEvent ? void 0 : i);
return () => t.mask ? Pe("div", {
class: [n.b(), t.overlayClass],
style: {
zIndex: t.zIndex
},
onClick: o,
onMousedown: s,
onMouseup: a
}, [kr(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"
}
}, [kr(e, "default")]);
}
});
const O3t = C3t, 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"
}
}), P3t = {
close: () => !0
}, k3t = mr({ name: "ElDialogContent" }), V3t = /* @__PURE__ */ mr({
...k3t,
props: AU,
emits: P3t,
setup(t, { expose: e }) {
const r = t, { t: n } = uS(), { Close: i } = dot, { 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 = fot(T, o), y = Kt(() => r.draggable), b = Kt(() => r.overflow), { resetPosition: w } = mot(o, s, y, b);
return e({
resetPosition: w
}), (S, x) => (le(), Ye("div", {
ref: yt(Q),
class: Be(yt(f)),
style: E1(yt(d)),
tabindex: "-1"
}, [
je("header", {
ref_key: "headerRef",
ref: s,
class: Be([yt(u).e("header"), { "show-close": S.showClose }])
}, [
kr(S.$slots, "header", {}, () => [
je("span", {
role: "heading",
"aria-level": S.ariaLevel,
class: Be(yt(u).e("title"))
}, fi(S.title), 11, ["aria-level"])
]),
S.showClose ? (le(), Ye("button", {
key: 0,
"aria-label": yt(n)("el.dialog.close"),
class: Be(yt(u).e("headerbtn")),
type: "button",
onClick: (C) => S.$emit("close")
}, [
Pe(yt(p3), {
class: Be(yt(u).e("close"))
}, {
default: fe(() => [
(le(), Ar(Ss(S.closeIcon || yt(i))))
]),
_: 1
}, 8, ["class"])
], 10, ["aria-label", "onClick"])) : Br("v-if", !0)
], 2),
je("div", {
id: yt(a),
class: Be(yt(u).e("body"))
}, [
kr(S.$slots, "default")
], 10, ["id"]),
S.$slots.footer ? (le(), Ye("footer", {
key: 0,
class: Be(yt(u).e("footer"))
}, [
kr(S.$slots, "footer")
], 2)) : Br("v-if", !0)
], 6));
}
});
var I3t = /* @__PURE__ */ Hn(V3t, [["__file", "dialog-content.vue"]]);
const R3t = Sn({
...AU,
appendToBody: Boolean,
appendTo: {
type: Ur([String, Object]),
default: "body"
},
beforeClose: {
type: Ur(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"
}
}), N3t = {
open: () => !0,
opened: () => !0,
close: () => !0,
closed: () => !0,
[Zo]: (t) => S4(t),
openAutoFocus: () => !0,
closeAutoFocus: () => !0
}, D3t = (t, e) => {
var r;
const n = $1().emit, { nextZIndex: i } = vS();
let o = "";
const s = U5(), a = U5(), u = Ve(!1), d = Ve(!1), T = Ve(!1), f = Ve((r = t.zIndex) != null ? r : i());
let Q, y;
const b = wg("namespace", eh), w = Kt(() => {
const Zt = {}, ce = `--${b.value}-dialog`;
return t.fullscreen || (t.top && (Zt[`${ce}-margin-top`] = t.top), t.width && (Zt[`${ce}-width`] = z5(t.width))), Zt;
}), S = Kt(() => t.alignCenter ? { display: "flex" } : {});
function x() {
n("opened");
}
function C() {
n("closed"), n(Zo, !1), t.destroyOnClose && (T.value = !1);
}
function P() {
n("close");
}
function R() {
y == null || y(), Q == null || Q(), t.openDelay && t.openDelay > 0 ? { stop: Q } = hP(() => rt(), t.openDelay) : rt();
}
function F() {
Q == null || Q(), y == null || y(), t.closeDelay && t.closeDelay > 0 ? { stop: y } = hP(() => tt(), t.closeDelay) : tt();
}
function U() {
function Zt(ce) {
ce || (d.value = !0, u.value = !1);
}
t.beforeClose ? t.beforeClose(Zt) : F();
}
function $() {
t.closeOnClickModal && U();
}
function rt() {
s1 && (u.value = !0);
}
function tt() {
u.value = !1;
}
function at() {
n("openAutoFocus");
}
function lt() {
n("closeAutoFocus");
}
function xt(Zt) {
var ce;
((ce = Zt.detail) == null ? void 0 : ce.focusReason) === "pointer" && Zt.preventDefault();
}
t.lockScroll && Lot(u);
function Vt() {
t.closeOnPressEscape && U();
}
return on(() => t.modelValue, (Zt) => {
Zt ? (d.value = !1, R(), T.value = !0, f.value = mz(t.zIndex) ? i() : f.value++, i1(() => {
n("open"), e.value && (e.value.scrollTop = 0);
})) : u.value && F();
}), on(() => t.fullscreen, (Zt) => {
e.value && (Zt ? (o = e.value.style.transform, e.value.style.transform = "") : e.value.style.transform = o);
}), Z1(() => {
t.modelValue && (u.value = !0, T.value = !0, R());
}), {
afterEnter: x,
afterLeave: C,
beforeLeave: P,
handleClose: U,
onModalClick: $,
close: F,
doClose: tt,
onOpenAutoFocus: at,
onCloseAutoFocus: lt,
onCloseRequested: Vt,
onFocusoutPrevented: xt,
titleId: s,
bodyId: a,
closed: d,
style: w,
overlayDialogStyle: S,
rendered: T,
visible: u,
zIndex: f
};
}, F3t = mr({
name: "ElDialog",
inheritAttrs: !1
}), B3t = /* @__PURE__ */ mr({
...F3t,
props: R3t,
emits: N3t,
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 = Ve(), s = Ve(), a = Ve(), {
visible: u,
titleId: d,
bodyId: T,
style: f,
overlayDialogStyle: Q,
rendered: y,
zIndex: b,
afterEnter: w,
afterLeave: S,
beforeLeave: x,
handleClose: C,
onModalClick: P,
onOpenAutoFocus: R,
onCloseAutoFocus: F,
onCloseRequested: U,
onFocusoutPrevented: $
} = D3t(r, o);
G1(HU, {
dialogRef: o,
headerRef: s,
bodyId: T,
ns: i,
rendered: y,
style: f
});
const rt = zz(P), tt = Kt(() => r.draggable && !r.fullscreen);
return e({
visible: u,
dialogContentRef: a,
resetPosition: () => {
var at;
(at = a.value) == null || at.resetPosition();
}
}), (at, lt) => (le(), Ar(yt(aU), {
to: at.appendTo,
disabled: at.appendTo !== "body" ? !1 : !at.appendToBody
}, {
default: fe(() => [
Pe(cd, {
name: "dialog-fade",
onAfterEnter: yt(w),
onAfterLeave: yt(S),
onBeforeLeave: yt(x),
persisted: ""
}, {
default: fe(() => [
Ti(Pe(yt(O3t), {
"custom-mask-event": "",
mask: at.modal,
"overlay-class": at.modalClass,
"z-index": yt(b)
}, {
default: fe(() => [
je("div", {
role: "dialog",
"aria-modal": "true",
"aria-label": at.title || void 0,
"aria-labelledby": at.title ? void 0 : yt(d),
"aria-describedby": yt(T),
class: Be(`${yt(i).namespace.value}-overlay-dialog`),
style: E1(yt(Q)),
onClick: yt(rt).onClick,
onMousedown: yt(rt).onMousedown,
onMouseup: yt(rt).onMouseup
}, [
Pe(yt(oU), {
loop: "",
trapped: yt(u),
"focus-start-el": "container",
onFocusAfterTrapped: yt(R),
onFocusAfterReleased: yt(F),
onFocusoutPrevented: yt($),
onReleaseRequested: yt(U)
}, {
default: fe(() => [
yt(y) ? (le(), Ar(I3t, rl({
key: 0,
ref_key: "dialogContentRef",
ref: a
}, at.$attrs, {
center: at.center,
"align-center": at.alignCenter,
"close-icon": at.closeIcon,
draggable: yt(tt),
overflow: at.overflow,
fullscreen: at.fullscreen,
"show-close": at.showClose,
title: at.title,
"aria-level": at.headerAriaLevel,
onClose: yt(C)
}), Xj({
header: fe(() => [
at.$slots.title ? kr(at.$slots, "title", { key: 1 }) : kr(at.$slots, "header", {
key: 0,
close: yt(C),
titleId: yt(d),
titleClass: yt(i).e("title")
})
]),
default: fe(() => [
kr(at.$slots, "default")
]),
_: 2
}, [
at.$slots.footer ? {
name: "footer",
fn: fe(() => [
kr(at.$slots, "footer")
])
} : void 0
]), 1040, ["center", "align-center", "close-icon", "draggable", "overflow", "fullscreen", "show-close", "title", "aria-level", "onClose"])) : Br("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, yt(u)]
])
]),
_: 3
}, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
]),
_: 3
}, 8, ["to", "disabled"]));
}
});
var j3t = /* @__PURE__ */ Hn(B3t, [["__file", "dialog.vue"]]);
const z3t = v2(j3t), U3t = /* @__PURE__ */ mr({
inheritAttrs: !1
});
function G3t(t, e, r, n, i, o) {
return kr(t.$slots, "default");
}
var $3t = /* @__PURE__ */ Hn(U3t, [["render", G3t], ["__file", "collection.vue"]]);
const Z3t = /* @__PURE__ */ mr({
name: "ElCollectionItem",
inheritAttrs: !1
});
function W3t(t, e, r, n, i, o) {
return kr(t.$slots, "default");
}
var q3t = /* @__PURE__ */ Hn(Z3t, [["render", W3t], ["__file", "collection-item.vue"]]);
const X3t = "data-el-collection-item", K3t = (t) => {
const e = `El${t}Collection`, r = `${e}Item`, n = Symbol(e), i = Symbol(r), o = {
...$3t,
name: e,
setup() {
const a = Ve(null), u = /* @__PURE__ */ new Map();
G1(n, {
itemMap: u,
getItems: () => {
const d = yt(a);
if (!d)
return [];
const T = Array.from(d.querySelectorAll(`[${X3t}]`));
return [...u.values()].sort((f, Q) => T.indexOf(f.ref) - T.indexOf(Q.ref));
},
collectionRef: a
});
}
}, s = {
...q3t,
name: r,
setup(a, { attrs: u }) {
const d = Ve(null), T = ln(n, void 0);
G1(i, {
collectionItemRef: d
}), Z1(() => {
const f = yt(d);
f && T.itemMap.set(f, {
ref: f,
...u
});
}), Rs(() => {
const f = yt(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: {
...W2.effect,
default: "light"
},
type: {
type: Ur(String)
},
placement: {
type: Ur(String),
default: "bottom"
},
popperOptions: {
type: Ur(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: Ur([Number, String]),
default: 0
},
maxHeight: {
type: Ur([Number, String]),
default: ""
},
popperClass: {
type: String,
default: ""
},
disabled: Boolean,
role: {
type: String,
default: "menu"
},
buttonProps: {
type: Ur(Object)
},
teleported: W2.teleported
});
Sn({
command: {
type: [Object, String, Number],
default: () => ({})
},
disabled: Boolean,
divided: Boolean,
textValue: String,
icon: {
type: b8
}
});
Sn({
onKeydown: { type: Ur(Function) }
});
K3t("Dropdown");
const CU = Symbol("ElSelectGroup"), Sg = Symbol("ElSelect");
function Y3t(t, e) {
const r = ln(Sg), n = ln(CU, { disabled: !1 }), i = Kt(() => T(Z6(r.props.modelValue), t.value)), o = Kt(() => {
var y;
if (r.props.multiple) {
const b = Z6((y = r.props.modelValue) != null ? y : []);
return !i.value && b.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 = $1(), T = (y = [], b) => {
if (T2(t.value)) {
const w = r.props.valueKey;
return y && y.some((S) => Ph(T4(S, w)) === T4(b, w));
} else
return y && y.includes(b);
}, f = () => {
!t.disabled && !n.disabled && (r.states.hoveringIndex = r.optionsArray.indexOf(d.proxy));
}, Q = (y) => {
const b = new RegExp(Y1t(y), "i");
e.visible = b.test(s.value) || t.created;
};
return on(() => s.value, () => {
!t.created && !r.props.remote && r.setSelected();
}), on(() => t.value, (y, b) => {
const { remote: w, valueKey: S } = r.props;
if (y !== b && (r.onOptionDestroy(b, d.proxy), r.onOptionCreate(d.proxy)), !t.created && !w) {
if (S && T2(y) && T2(b) && y[S] === b[S])
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 J3t = 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", yt(a)),
e.is("selected", yt(s)),
e.is("hovering", yt(Q))
]), i = u3({
index: -1,
groupDisabled: !1,
visible: !0,
hover: !1
}), {
currentLabel: o,
itemSelected: s,
isDisabled: a,
select: u,
hoverItem: d,
updateOption: T
} = Y3t(t, i), { visible: f, hover: Q } = s0(i), y = $1().proxy;
u.onOptionCreate(y), Rs(() => {
const w = y.value, { selected: S } = u.states, x = (u.props.multiple ? S : [S]).some((C) => C.value === y.value);
i1(() => {
u.states.cachedOptions.get(w) === y && !x && u.states.cachedOptions.delete(w);
}), u.onOptionDestroy(w, y);
});
function b() {
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: b,
states: i
};
}
});
function t4t(t, e, r, n, i, o) {
return Ti((le(), 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"])
}, [
kr(t.$slots, "default", {}, () => [
je("span", null, fi(t.currentLabel), 1)
])
], 42, ["id", "aria-disabled", "aria-selected", "onMouseenter", "onClick"])), [
[zo, t.visible]
]);
}
var ES = /* @__PURE__ */ Hn(J3t, [["render", t4t], ["__file", "option.vue"]]);
const e4t = 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 = Ve("");
function s() {
var a;
o.value = `${(a = t.selectRef) == null ? void 0 : a.offsetWidth}px`;
}
return Z1(() => {
s(), B6(t.selectRef, s);
}), {
ns: e,
minWidth: o,
popperClass: r,
isMultiple: n,
isFitInputWidth: i
};
}
});
function r4t(t, e, r, n, i, o) {
return le(), Ye("div", {
class: Be([t.ns.b("dropdown"), t.ns.is("multiple", t.isMultiple), t.popperClass]),
style: E1({ [t.isFitInputWidth ? "width" : "minWidth"]: t.minWidth })
}, [
t.$slots.header ? (le(), Ye("div", {
key: 0,
class: Be(t.ns.be("dropdown", "header"))
}, [
kr(t.$slots, "header")
], 2)) : Br("v-if", !0),
kr(t.$slots, "default"),
t.$slots.footer ? (le(), Ye("div", {
key: 1,
class: Be(t.ns.be("dropdown", "footer"))
}, [
kr(t.$slots, "footer")
], 2)) : Br("v-if", !0)
], 6);
}
var n4t = /* @__PURE__ */ Hn(e4t, [["render", r4t], ["__file", "select-dropdown.vue"]]);
const i4t = 11, o4t = (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 = Ve(null), u = Ve(null), d = Ve(null), T = Ve(null), f = Ve(null), Q = Ve(null), y = Ve(null), b = Ve(null), w = Ve(null), S = Ve(null), x = Ve(null), C = Ve(null), {
isComposing: P,
handleCompositionStart: R,
handleCompositionUpdate: F,
handleCompositionEnd: U
} = B2t({
afterComposition: (Rt) => c1(Rt)
}), { wrapperRef: $, isFocused: rt } = F2t(f, {
beforeFocus() {
return oe.value;
},
afterFocus() {
t.automaticDropdown && !tt.value && (tt.value = !0, s.menuVisibleOnFocus = !0);
},
beforeBlur(Rt) {
var Te, He;
return ((Te = d.value) == null ? void 0 : Te.isFocusInsideContent(Rt)) || ((He = T.value) == null ? void 0 : He.isFocusInsideContent(Rt));
},
afterBlur() {
tt.value = !1, s.menuVisibleOnFocus = !1;
}
}), tt = Ve(!1), at = Ve(), { form: lt, formItem: xt } = tc(), { inputId: Vt } = Mg(t, {
formItemContext: xt
}), { valueOnClear: Zt, isEmptyValue: ce } = $2t(t), oe = Kt(() => t.disabled || (lt == null ? void 0 : lt.disabled)), Se = Kt(() => p2(t.modelValue) ? t.modelValue.length > 0 : !ce(t.modelValue)), Ir = Kt(() => t.clearable && !oe.value && s.inputHovering && Se.value), qr = Kt(() => t.remote && t.filterable && !t.remoteShowSuffix ? "" : t.suffixIcon), ne = Kt(() => i.is("reverse", qr.value && tt.value)), Qe = Kt(() => (xt == null ? void 0 : xt.validateState) || ""), Ke = Kt(() => pot[Qe.value]), Ae = 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((He) => {
const lr = Rt.findIndex((Hr) => Hr.value === He);
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 && Wo(t.filterMethod) || t.filterable && t.remote && Wo(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 tt.value && er.value !== !1;
},
set(Rt) {
tt.value = Rt;
}
}), qe = Kt(() => {
if (t.multiple && !q6(t.modelValue))
return Z6(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 || !Se.value ? Te : s.selectedLabel;
}), ar = Kt(() => sx ? null : "mouseenter");
on(() => t.modelValue, (Rt, Te) => {
t.multiple && t.filterable && !t.reserveKeyword && (s.inputValue = "", Ot("")), Jr(), !NQ(Rt, Te) && t.validateEvent && (xt == null || xt.validate("change").catch((He) => y2(He)));
}, {
flush: "post",
deep: !0
}), on(() => tt.value, (Rt) => {
Rt ? Ot(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 ? at.value = Ne.value[Rt] || {} : at.value = {}, Ne.value.forEach((Te) => {
Te.hover = at.value === Te;
});
}), Kj(() => {
s.isBeforeHide || me();
});
const Ot = (Rt) => {
s.previousQuery === Rt || P.value || (s.previousQuery = Rt, t.filterable && Wo(t.filterMethod) ? t.filterMethod(Rt) : t.filterable && t.remote && Wo(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), He = Rt[0];
s.hoveringIndex = _r(Ne.value, Te || He);
}, Jr = () => {
if (t.multiple)
s.selectedLabel = "";
else {
const Te = p2(t.modelValue) ? t.modelValue[0] : t.modelValue, He = Sr(Te);
s.selectedLabel = He.currentLabel, s.selected = [He];
return;
}
const Rt = [];
q6(t.modelValue) || Z6(t.modelValue).forEach((Te) => {
Rt.push(Sr(Te));
}), s.selected = Rt;
}, Sr = (Rt) => {
let Te;
const He = hb(Rt).toLowerCase() === "object", lr = hb(Rt).toLowerCase() === "null", Hr = hb(Rt).toLowerCase() === "undefined";
for (let Nr = s.cachedOptions.size - 1; Nr >= 0; Nr--) {
const vr = Gt.value[Nr];
if (He ? T4(vr.value, t.valueKey) === T4(Rt, t.valueKey) : vr.value === Rt) {
Te = {
value: Rt,
currentLabel: vr.currentLabel,
get isDisabled() {
return vr.isDisabled;
}
};
break;
}
}
if (Te)
return Te;
const vn = He ? Rt.label : !lr && !Hr ? 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;
}, Pi = () => {
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);
}, ki = () => {
s.inputValue.length > 0 && !tt.value && (tt.value = !0), Ot(s.inputValue);
}, c1 = (Rt) => {
if (s.inputValue = Rt.target.value, t.remote)
ye();
else
return ki();
}, ye = $1t(() => {
ki();
}, Ae.value), bi = (Rt) => {
NQ(t.modelValue, Rt) || e(cS, Rt);
}, Xn = (Rt) => Z1t(Rt, (Te) => !s.disabledOptions.has(Te)), Hi = (Rt) => {
if (t.multiple && Rt.code !== Nh.delete && Rt.target.value.length <= 0) {
const Te = Z6(t.modelValue).slice(), He = Xn(Te);
if (He < 0)
return;
const lr = Te[He];
Te.splice(He, 1), e(Zo, Te), bi(Te), e("remove-tag", lr);
}
}, t1 = (Rt, Te) => {
const He = s.selected.indexOf(Te);
if (He > -1 && !oe.value) {
const lr = Z6(t.modelValue).slice();
lr.splice(He, 1), e(Zo, lr), bi(lr), e("remove-tag", Te.value);
}
Rt.stopPropagation(), Ii();
}, xe = (Rt) => {
Rt.stopPropagation();
const Te = t.multiple ? [] : Zt.value;
if (t.multiple)
for (const He of s.selected)
He.isDisabled && Te.push(He.value);
e(Zo, Te), bi(Te), s.hoveringIndex = -1, tt.value = !1, e("clear"), Ii();
}, Fr = (Rt) => {
var Te;
if (t.multiple) {
const He = Z6((Te = t.modelValue) != null ? Te : []).slice(), lr = _r(He, Rt.value);
lr > -1 ? He.splice(lr, 1) : (t.multipleLimit <= 0 || He.length < t.multipleLimit) && He.push(Rt.value), e(Zo, He), bi(He), Rt.created && Ot(""), t.filterable && !t.reserveKeyword && (s.inputValue = "");
} else
e(Zo, Rt.value), bi(Rt.value), tt.value = !1;
Ii(), !tt.value && i1(() => {
In(Rt);
});
}, _r = (Rt = [], Te) => {
if (!T2(Te))
return Rt.indexOf(Te);
const He = t.valueKey;
let lr = -1;
return Rt.some((Hr, vn) => Ph(T4(Hr, He)) === T4(Te, He) ? (lr = vn, !0) : !1), lr;
}, In = (Rt) => {
var Te, He, lr, Hr, vn;
const Nr = p2(Rt) ? Rt[0] : Rt;
let vr = null;
if (Nr != null && Nr.value) {
const $r = Ne.value.filter((cn) => cn.value === Nr.value);
$r.length > 0 && (vr = $r[0].$el);
}
if (d.value && vr) {
const $r = (Hr = (lr = (He = (Te = d.value) == null ? void 0 : Te.popperRef) == null ? void 0 : He.contentRef) == null ? void 0 : lr.querySelector) == null ? void 0 : Hr.call(lr, `.${i.be("dropdown", "wrap")}`);
$r && eot($r, vr);
}
(vn = C.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);
}, Lr = (Rt, Te) => {
s.options.get(Rt) === Te && s.options.delete(Rt);
}, Vi = Kt(() => {
var Rt, Te;
return (Te = (Rt = d.value) == null ? void 0 : Rt.popperRef) == null ? void 0 : Te.contentRef;
}), H1 = () => {
s.isBeforeHide = !1, i1(() => In(s.selected));
}, Ii = () => {
var Rt;
(Rt = f.value) == null || Rt.focus();
}, Rn = () => {
var Rt;
(Rt = f.value) == null || Rt.blur();
}, wt = (Rt) => {
xe(Rt);
}, it = () => {
tt.value = !1, rt.value && Rn();
}, ot = () => {
s.inputValue.length > 0 ? s.inputValue = "" : tt.value = !1;
}, pt = () => {
oe.value || (sx && (s.inputHovering = !0), s.menuVisibleOnFocus ? s.menuVisibleOnFocus = !1 : tt.value = !tt.value);
}, gt = () => {
tt.value ? Ne.value[s.hoveringIndex] && Fr(Ne.value[s.hoveringIndex]) : pt();
}, At = (Rt) => T2(Rt.value) ? T4(Rt.value, t.valueKey) : Rt.value, It = 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 (!tt.value) {
tt.value = !0;
return;
}
if (!(s.options.size === 0 || s.filteredOptionsCount === 0 || P.value) && !It.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(() => In(at.value));
}
}, se = () => {
if (!u.value)
return 0;
const Rt = window.getComputedStyle(u.value);
return Number.parseFloat(Rt.gap || "6px");
}, Xt = Kt(() => {
const Rt = se();
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, i4t)}px`
}));
return B6(u, dn), B6(Q, ji), B6(w, Pi), B6($, Pi), B6(S, _i), B6(x, Ji), Z1(() => {
Jr();
}), {
inputId: Vt,
contentId: n,
nsSelect: i,
nsInput: o,
states: s,
isFocused: rt,
expanded: tt,
optionsArray: Ne,
hoverOption: at,
selectSize: de,
filteredOptionsCount: Je,
resetCalculatorWidth: ji,
updateTooltip: Pi,
updateTagTooltip: _i,
debouncedOnInputChange: ye,
onInput: c1,
deletePrevTag: Hi,
deleteTag: t1,
deleteSelected: xe,
handleOptionSelect: Fr,
scrollToOption: In,
hasModelValue: Se,
shouldShowPlaceholder: qe,
currentPlaceholder: $e,
mouseEnterEventName: ar,
showClose: Ir,
iconComponent: qr,
iconReverse: ne,
validateState: Qe,
validateIcon: Ke,
showNewOption: te,
updateOptions: me,
collapseTagSize: Ge,
setSelected: Jr,
selectDisabled: oe,
emptyText: er,
handleCompositionStart: R,
handleCompositionUpdate: F,
handleCompositionEnd: U,
onOptionCreate: y1,
onOptionDestroy: Lr,
handleMenuEnter: H1,
focus: Ii,
blur: Rn,
handleClearClick: wt,
handleClickOutside: it,
handleEsc: ot,
toggleMenu: pt,
selectOption: gt,
getValueKey: At,
navigateOptions: Jt,
dropdownMenuVisible: Tr,
showTagList: jt,
collapseTagList: St,
tagStyle: Xt,
collapseTagStyle: Le,
inputStyle: or,
popperRef: Vi,
inputRef: f,
tooltipRef: d,
tagTooltipRef: T,
calculatorRef: Q,
prefixRef: y,
suffixRef: b,
selectRef: a,
wrapperRef: $,
selectionRef: u,
scrollbarRef: C,
menuRef: w,
tagMenuRef: S,
collapseItemRef: x
};
};
var s4t = 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, b;
const w = (f = (T == null ? void 0 : T.type) || {}) == null ? void 0 : f.name;
w === "ElOptionGroup" ? u(!sa(T.children) && !p2(T.children) && Wo((Q = T.children) == null ? void 0 : Q.default) ? (y = T.children) == null ? void 0 : y.default() : T.children) : w === "ElOption" ? a.push((b = T.props) == null ? void 0 : b.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 a4t = 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: Ur(String),
default: "light"
},
disabled: Boolean,
clearable: Boolean,
filterable: Boolean,
allowCreate: Boolean,
loading: Boolean,
popperClass: {
type: String,
default: ""
},
popperOptions: {
type: Ur(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: W2.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: Ur(String),
values: bg,
default: "bottom-start"
},
fallbackPlacements: {
type: Ur(Array),
default: ["bottom-start", "top-start", "right", "left"]
},
appendTo: String,
...G2t,
...sl(["ariaLabel"])
}), Lk = "ElSelect", l4t = mr({
name: Lk,
componentName: Lk,
components: {
ElSelectMenu: n4t,
ElOption: ES,
ElOptions: s4t,
ElTag: m3t,
ElScrollbar: Tst,
ElTooltip: lU,
ElIcon: p3
},
directives: { ClickOutside: jat },
props: a4t,
emits: [
Zo,
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 = o4t(n, e);
return G1(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 c4t(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 = Aet("click-outside");
return Ti((le(), Ye("div", {
ref: "selectRef",
class: Be([t.nsSelect.b(), t.nsSelect.m(t.selectSize)]),
[Cet(t.mouseEnterEventName)]: (b) => t.states.inputHovering = !0,
onMouseleave: (b) => t.states.inputHovering = !1
}, [
Pe(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: (b) => t.states.isBeforeHide = !1
}, {
default: fe(() => {
var b;
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 ? (le(), Ye("div", {
key: 0,
ref: "prefixRef",
class: Be(t.nsSelect.e("prefix"))
}, [
kr(t.$slots, "prefix")
], 2)) : Br("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 ? kr(t.$slots, "tag", { key: 0 }, () => [
(le(!0), Ye(to, null, t3(t.showTagList, (w) => (le(), Ye("div", {
key: t.getValueKey(w),
class: Be(t.nsSelect.e("selected-item"))
}, [
Pe(s, {
closable: !t.selectDisabled && !w.isDisabled,
size: t.collapseTagSize,
type: t.tagType,
effect: t.tagEffect,
"disable-transitions": "",
style: E1(t.tagStyle),
onClose: (S) => t.deleteTag(S, w)
}, {
default: fe(() => [
je("span", {
class: Be(t.nsSelect.e("tags-text"))
}, [
kr(t.$slots, "label", {
label: w.currentLabel,
value: w.value
}, () => [
xn(fi(w.currentLabel), 1)
])
], 2)
]),
_: 2
}, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
], 2))), 128)),
t.collapseTags && t.states.selected.length > t.maxCollapseTags ? (le(), Ar(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"))
}, [
Pe(s, {
closable: !1,
size: t.collapseTagSize,
type: t.tagType,
effect: t.tagEffect,
"disable-transitions": "",
style: E1(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"))
}, [
(le(!0), Ye(to, null, t3(t.collapseTagList, (w) => (le(), Ye("div", {
key: t.getValueKey(w),
class: Be(t.nsSelect.e("selected-item"))
}, [
Pe(s, {
class: "in-tooltip",
closable: !t.selectDisabled && !w.isDisabled,
size: t.collapseTagSize,
type: t.tagType,
effect: t.tagEffect,
"disable-transitions": "",
onClose: (S) => t.deleteTag(S, w)
}, {
default: fe(() => [
je("span", {
class: Be(t.nsSelect.e("tags-text"))
}, [
kr(t.$slots, "label", {
label: w.currentLabel,
value: w.value
}, () => [
xn(fi(w.currentLabel), 1)
])
], 2)
]),
_: 2
}, 1032, ["closable", "size", "type", "effect", "onClose"])
], 2))), 128))
], 2)
]),
_: 3
}, 8, ["disabled", "effect", "teleported"])) : Br("v-if", !0)
]) : Br("v-if", !0),
t.selectDisabled ? Br("v-if", !0) : (le(), 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": (w) => t.states.inputValue = w,
type: "text",
name: t.name,
class: Be([t.nsSelect.e("input"), t.nsSelect.is(t.selectSize)]),
disabled: t.selectDisabled,
autocomplete: t.autocomplete,
style: E1(t.inputStyle),
role: "combobox",
readonly: !t.filterable,
spellcheck: "false",
"aria-activedescendant": ((b = t.hoverOption) == null ? void 0 : b.id) || "",
"aria-controls": t.contentId,
"aria-expanded": t.dropdownMenuVisible,
"aria-label": t.ariaLabel,
"aria-autocomplete": "none",
"aria-haspopup": "listbox",
onKeydown: [
au(m1((w) => t.navigateOptions("next"), ["stop", "prevent"]), ["down"]),
au(m1((w) => 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"]), [
[Oet, t.states.inputValue]
]),
t.filterable ? (le(), Ye("span", {
key: 0,
ref: "calculatorRef",
"aria-hidden": "true",
class: Be(t.nsSelect.e("input-calculator")),
textContent: fi(t.states.inputValue)
}, null, 10, ["textContent"])) : Br("v-if", !0)
], 2)),
t.shouldShowPlaceholder ? (le(), 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 ? kr(t.$slots, "label", {
key: 0,
label: t.currentPlaceholder,
value: t.modelValue
}, () => [
je("span", null, fi(t.currentPlaceholder), 1)
]) : (le(), Ye("span", { key: 1 }, fi(t.currentPlaceholder), 1))
], 2)) : Br("v-if", !0)
], 2),
je("div", {
ref: "suffixRef",
class: Be(t.nsSelect.e("suffix"))
}, [
t.iconComponent && !t.showClose ? (le(), Ar(u, {
key: 0,
class: Be([t.nsSelect.e("caret"), t.nsSelect.e("icon"), t.iconReverse])
}, {
default: fe(() => [
(le(), Ar(Ss(t.iconComponent)))
]),
_: 1
}, 8, ["class"])) : Br("v-if", !0),
t.showClose && t.clearIcon ? (le(), Ar(u, {
key: 1,
class: Be([
t.nsSelect.e("caret"),
t.nsSelect.e("icon"),
t.nsSelect.e("clear")
]),
onClick: t.handleClearClick
}, {
default: fe(() => [
(le(), Ar(Ss(t.clearIcon)))
]),
_: 1
}, 8, ["class", "onClick"])) : Br("v-if", !0),
t.validateState && t.validateIcon ? (le(), Ar(u, {
key: 2,
class: Be([t.nsInput.e("icon"), t.nsInput.e("validateIcon")])
}, {
default: fe(() => [
(le(), Ar(Ss(t.validateIcon)))
]),
_: 1
}, 8, ["class"])) : Br("v-if", !0)
], 2)
], 10, ["onClick"])
];
}),
content: fe(() => [
Pe(Q, { ref: "menuRef" }, {
default: fe(() => [
t.$slots.header ? (le(), Ye("div", {
key: 0,
class: Be(t.nsSelect.be("dropdown", "header")),
onClick: m1(() => {
}, ["stop"])
}, [
kr(t.$slots, "header")
], 10, ["onClick"])) : Br("v-if", !0),
Ti(Pe(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 ? (le(), Ar(d, {
key: 0,
value: t.states.inputValue,
created: !0
}, null, 8, ["value"])) : Br("v-if", !0),
Pe(T, null, {
default: fe(() => [
kr(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 ? (le(), Ye("div", {
key: 1,
class: Be(t.nsSelect.be("dropdown", "loading"))
}, [
kr(t.$slots, "loading")
], 2)) : t.loading || t.filteredOptionsCount === 0 ? (le(), Ye("div", {
key: 2,
class: Be(t.nsSelect.be("dropdown", "empty"))
}, [
kr(t.$slots, "empty", {}, () => [
je("span", null, fi(t.emptyText), 1)
])
], 2)) : Br("v-if", !0),
t.$slots.footer ? (le(), Ye("div", {
key: 3,
class: Be(t.nsSelect.be("dropdown", "footer")),
onClick: m1(() => {
}, ["stop"])
}, [
kr(t.$slots, "footer")
], 10, ["onClick"])) : Br("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 u4t = /* @__PURE__ */ Hn(l4t, [["render", c4t], ["__file", "select.vue"]]);
const h4t = mr({
name: "ElOptionGroup",
componentName: "ElOptionGroup",
props: {
label: String,
disabled: Boolean
},
setup(t) {
const e = Bn("select"), r = Ve(null), n = $1(), i = Ve([]);
G1(CU, 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 = Z6(d), f = [];
return T.forEach((Q) => {
var y, b;
s(Q) ? f.push(Q.component.proxy) : (y = Q.children) != null && y.length ? f.push(...a(Q.children)) : (b = Q.component) != null && b.subTree && f.push(...a(Q.component.subTree));
}), f;
}, u = () => {
i.value = a(n.subTree);
};
return Z1(() => {
u();
}), Wet(r, u, {
attributes: !0,
subtree: !0,
childList: !0
}), {
groupRef: r,
visible: o,
ns: e
};
}
});
function d4t(t, e, r, n, i, o) {
return Ti((le(), 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"))
}, [
kr(t.$slots, "default")
], 2)
])
], 2)), [
[zo, t.visible]
]);
}
var OU = /* @__PURE__ */ Hn(h4t, [["render", d4t], ["__file", "option-group.vue"]]);
const Hg = v2(u4t, {
Option: ES,
OptionGroup: OU
}), SS = ol(ES);
ol(OU);
const p4t = Sn({
trigger: Bh.trigger,
placement: bb.placement,
disabled: Bh.disabled,
visible: W2.visible,
transition: W2.transition,
popperOptions: bb.popperOptions,
tabindex: bb.tabindex,
content: W2.content,
popperStyle: W2.popperStyle,
popperClass: W2.popperClass,
enterable: {
...W2.enterable,
default: !0
},
effect: {
...W2.effect,
default: "light"
},
teleported: W2.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
}
}), T4t = {
"update:visible": (t) => S4(t),
"before-enter": () => !0,
"before-leave": () => !0,
"after-enter": () => !0,
"after-leave": () => !0
}, f4t = "onUpdate:visible", Q4t = mr({
name: "ElPopover"
}), m4t = /* @__PURE__ */ mr({
...Q4t,
props: p4t,
emits: T4t,
setup(t, { expose: e, emit: r }) {
const n = t, i = Kt(() => n[f4t]), o = Bn("popover"), s = Ve(), a = Kt(() => {
var S;
return (S = yt(s)) == null ? void 0 : S.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 S;
(S = s.value) == null || S.hide();
}, Q = () => {
r("before-enter");
}, y = () => {
r("before-leave");
}, b = () => {
r("after-enter");
}, w = () => {
r("update:visible", !1), r("after-leave");
};
return e({
popperRef: a,
hide: f
}), (S, x) => (le(), Ar(yt(lU), rl({
ref_key: "tooltipRef",
ref: s
}, S.$attrs, {
trigger: S.trigger,
placement: S.placement,
disabled: S.disabled,
visible: S.visible,
transition: S.transition,
"popper-options": S.popperOptions,
tabindex: S.tabindex,
content: S.content,
offset: S.offset,
"show-after": S.showAfter,
"hide-after": S.hideAfter,
"auto-close": S.autoClose,
"show-arrow": S.showArrow,
"aria-label": S.title,
effect: S.effect,
enterable: S.enterable,
"popper-class": yt(d),
"popper-style": yt(u),
teleported: S.teleported,
persistent: S.persistent,
"gpu-acceleration": yt(T),
"onUpdate:visible": yt(i),
onBeforeShow: Q,
onBeforeHide: y,
onShow: b,
onHide: w
}), {
content: fe(() => [
S.title ? (le(), Ye("div", {
key: 0,
class: Be(yt(o).e("title")),
role: "title"
}, fi(S.title), 3)) : Br("v-if", !0),
kr(S.$slots, "default", {}, () => [
xn(fi(S.content), 1)
])
]),
default: fe(() => [
S.$slots.reference ? kr(S.$slots, "reference", { key: 0 }) : Br("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 g4t = /* @__PURE__ */ Hn(m4t, [["__file", "popover.vue"]]);
const wk = (t, e) => {
const r = e.arg || e.value, n = r == null ? void 0 : r.popperRef;
n && (n.triggerRef = t);
};
var y4t = {
mounted(t, e) {
wk(t, e);
},
updated(t, e) {
wk(t, e);
}
};
const v4t = "popover", PU = Tot(y4t, v4t), Ag = v2(g4t, {
directive: PU
});
function _4t(t) {
let e;
const r = Ve(!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 b = Q.getAttribute("loading-number");
b = Number.parseInt(b) - 1, b ? Q.setAttribute("loading-number", b.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: b, zIndex: w } = W2t("loading");
return y({
ns: b,
zIndex: w
}), () => {
const S = n.spinner || n.svg, x = b7("svg", {
class: "circular",
viewBox: n.svgViewBox ? n.svgViewBox : "0 0 50 50",
...S ? { innerHTML: S } : {}
}, [
b7("circle", {
class: "path",
cx: "25",
cy: "25",
r: "20",
fill: "none"
})
]), C = n.text ? b7("p", { class: b.b("text") }, [n.text]) : void 0;
return b7(cd, {
name: b.b("fade"),
onAfterLeave: u
}, {
default: fe(() => [
Ti(Pe("div", {
style: {
backgroundColor: n.background || ""
},
class: [
b.b("mask"),
n.customClass,
n.fullscreen ? "is-fullscreen" : ""
]
}, [
b7("div", {
class: b.b("spinner")
}, [x, C])
]), [[zo, n.visible]])
])
});
};
}
}), T = Pet(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 = b4t(t);
if (e.fullscreen && tT)
return tT;
const r = _4t({
...e,
closed: () => {
var i;
(i = e.closed) == null || i.call(e), e.fullscreen && (tT = void 0);
}
});
L4t(e, e.parent, r), xk(e, e.parent, r), e.parent.vLoadingAddClassList = () => xk(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;
}, b4t = (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
};
}, L4t = 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;
}, xk = (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"), Mk = (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 && Ve(y);
}, d = (Q) => u(a(Q) || t.getAttribute(`element-loading-${srt(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)
};
}, w4t = (t, e) => {
for (const r of Object.keys(e))
g2(e[r]) && (e[r].value = t[r]);
}, bx = {
mounted(t, e) {
e.value && Mk(t, e);
},
updated(t, e) {
const r = t[mf];
e.oldValue !== e.value && (e.value && !e.oldValue ? Mk(t, e) : e.value && e.oldValue ? T2(e.value) && w4t(e.value, r.options) : r == null || r.instance.close());
},
unmounted(t) {
var e;
(e = t[mf]) == null || e.instance.close(), t[mf] = null;
}
}, x4t = {
install(t) {
t.directive("loading", bx), t.config.globalProperties.$loading = _x;
},
directive: bx,
service: _x
}, Cg = (t, e) => {
const r = t.__vccOpts || t;
for (const [n, i] of e)
r[n] = i;
return r;
}, M4t = {
name: "SelectionsGroup",
components: {
Checkbox: gU,
CheckboxGroup: yU,
Col: fd,
Icon: p3,
Row: Td,
ElIconWarning: Mz
},
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"), i = t.closest(".selections-container").querySelector(".checkall-display-text");
let o = "";
r && (o = r.checked ? "checked" : "unchecked"), this.checkboxActionData = {
selectionsTitle: i ? i.innerText : "",
property: r && e !== "all" ? r.value : "",
label: n ? n.innerText : "",
checked: o
};
} 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 t = this.checkedItems.length === this.selections.length;
return {
checkAll: t,
checked: t ? [] : 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();
}
}, E4t = { class: "selections-container" }, S4t = { class: "checkall-display-text" }, H4t = { style: { "word-break": "keep-all" } }, A4t = { class: "checkbox-group-inner" }, C4t = ["onMouseenter", "onMouseleave"];
function O4t(t, e, r, n, i, o) {
const s = Mz, a = p3, u = Ag, d = fd, T = gU, f = Td, Q = yU;
return le(), Ye("div", E4t, [
Pe(f, null, {
default: fe(() => [
Pe(d, { span: 12 }, {
default: fe(() => [
je("span", S4t, fi(r.title), 1),
r.helpMessage ? (le(), Ar(u, {
key: 0,
width: "250",
trigger: "hover",
teleported: !1,
"popper-class": "popover-origin-help"
}, Xj({
default: fe(() => [
je("span", H4t, fi(r.helpMessage), 1)
]),
_: 2
}, [
r.helpMessage ? {
name: "reference",
fn: fe(() => [
Pe(a, { class: "info" }, {
default: fe(() => [
Pe(s)
]),
_: 1
})
]),
key: "0"
} : void 0
]), 1024)) : Br("", !0)
]),
_: 1
}),
Pe(d, { span: 12 }, {
default: fe(() => [
r.selections && r.selections.length > 1 ? (le(), Ar(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"])) : Br("", !0)
]),
_: 1
})
]),
_: 1
}),
Pe(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", A4t, [
(le(!0), Ye(to, null, t3(r.selections, (y) => (le(), Ar(f, {
key: y[r.identifierKey],
label: y[r.identifierKey]
}, {
default: fe(() => [
je("div", {
class: "checkbox-container",
onMouseenter: (b) => o.checkboxMouseEnterEmit(y[r.identifierKey], !0),
onMouseleave: (b) => o.checkboxMouseEnterEmit(y[r.identifierKey], !1)
}, [
Pe(T, {
class: "my-checkbox",
label: y[r.identifierKey],
value: y[r.identifierKey],
onChange: (b) => o.visibilityToggle(y[r.identifierKey], b),
onClick: o.onCheckboxNativeChange,
checked: !("enabled" in y) || y.enabled === !0
}, {
default: fe(() => [
Pe(f, { class: "checkbox-row" }, {
default: fe(() => [
o.hasLineStyles(y) ? (le(), Ar(d, {
key: 0,
span: 4
}, {
default: fe(() => [
je("div", {
class: "path-visual",
style: E1(o.getLineStyles(y))
}, null, 4)
]),
_: 2
}, 1024)) : Br("", !0),
Pe(d, { span: 20 }, {
default: fe(() => [
je("div", {
style: E1(o.getBackgroundStyles(y))
}, fi(y[r.labelKey]), 5)
]),
_: 2
}, 1024)
]),
_: 2
}, 1024)
]),
_: 2
}, 1032, ["label", "value", "onChange", "onClick", "checked"])
], 40, C4t)
]),
_: 2
}, 1032, ["label"]))), 128))
])
]),
_: 1
}, 8, ["modelValue", "onChange"])
]);
}
const kU = /* @__PURE__ */ Cg(M4t, [["render", O4t], ["__scopeId", "data-v-fb8c9eee"]]), P4t = {
name: "SvgLegends"
}, k4t = (t) => (YE("data-v-88079d87"), t = t(), JE(), t), V4t = { class: "legends-container" }, I4t = {
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"
}, R4t = /* @__PURE__ */ Iet(' Tissue region Brain nuclei Ganglia Ganglionated nerve plexus ', 9), N4t = [
R4t
], D4t = /* @__PURE__ */ k4t(() => /* @__PURE__ */ je("svg", {
width: "72px",
height: "72px",
viewBox: "0 0 24 24",
fill: "yellow"
}, null, -1));
function F4t(t, e, r, n, i, o) {
return le(), Ye("div", V4t, [
(le(), Ye("svg", I4t, N4t)),
D4t
]);
}
const VU = /* @__PURE__ */ Cg(P4t, [["render", F4t], ["__scopeId", "data-v-88079d87"]]), B4t = `
`, 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 j4t = 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((i) => ({ url: i, id: "pubmed" }));
let n;
if (e.provenanceTaxonomy) {
n = [];
const i = await Lx(t, e.provenanceTaxonomy);
i.length && i.forEach((o) => {
const { label: s } = o;
n.push(s);
});
}
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((n) => {
const i = e.lastIndexOf(n);
i !== -1 && (r.id = e.slice(i + n.length), n === "doi.org/" ? r.type = "doi" : n === "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 z4t = (t) => t && t.charAt(0).toUpperCase() + t.slice(1), U4t = '';
var IU = { exports: {} };
(function(t, e) {
(function(r, n) {
t.exports = n();
})(typeof window < "u" ? window : Fat, 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, b = 0, w = T.length;
if (y)
for (; b < w; b++)
f(T[b]);
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 w = [];
this.add = function(C) {
w.push(C);
};
var S, x;
this.call = function(C) {
for (S = 0, x = w.length; S < x; S++)
w[S].call(this, C);
}, this.remove = function(C) {
var P = [];
for (S = 0, x = w.length; S < x; S++)
w[S] !== C && P.push(w[S]);
w = P;
}, this.length = function() {
return w.length;
};
}
function b(w, S) {
if (w) {
if (w.resizedAttached) {
w.resizedAttached.add(S);
return;
}
w.resizedAttached = new y(), w.resizedAttached.add(S), w.resizeSensor = document.createElement("div"), w.resizeSensor.dir = "ltr", w.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%"
}, C = {
position: "absolute",
left: "0px",
top: "0px",
transition: "0s"
};
a(w.resizeSensor, x);
var P = document.createElement("div");
P.className = "resize-sensor-expand", a(P, x);
var R = document.createElement("div");
a(R, C), P.appendChild(R);
var F = document.createElement("div");
F.className = "resize-sensor-shrink", a(F, x);
var U = document.createElement("div");
a(U, C), a(U, { width: "200%", height: "200%" }), F.appendChild(U), w.resizeSensor.appendChild(P), w.resizeSensor.appendChild(F), w.appendChild(w.resizeSensor);
var $ = window.getComputedStyle(w), rt = $ ? $.getPropertyValue("position") : null;
rt !== "absolute" && rt !== "relative" && rt !== "fixed" && rt !== "sticky" && (w.style.position = "relative");
var tt = !1, at = 0, lt = s(w), xt = 0, Vt = 0, Zt = !0;
Q = 0;
var ce = function() {
var ne = w.offsetWidth, Qe = w.offsetHeight;
R.style.width = ne + 10 + "px", R.style.height = Qe + 10 + "px", P.scrollLeft = ne + 10, P.scrollTop = Qe + 10, F.scrollLeft = ne + 10, F.scrollTop = Qe + 10;
}, oe = function() {
if (Zt) {
var ne = w.offsetWidth === 0 && w.offsetHeight === 0;
if (ne) {
Q || (Q = n(function() {
Q = 0, oe();
}));
return;
} else
Zt = !1;
}
ce();
};
w.resizeSensor.resetSensor = oe;
var Se = function() {
at = 0, tt && (xt = lt.width, Vt = lt.height, w.resizedAttached && w.resizedAttached.call(lt));
}, Ir = function() {
lt = s(w), tt = lt.width !== xt || lt.height !== Vt, tt && !at && (at = n(Se)), oe();
}, qr = function(ne, Qe, Ke) {
ne.attachEvent ? ne.attachEvent("on" + Qe, Ke) : ne.addEventListener(Qe, Ke);
};
qr(P, "scroll", Ir), qr(F, "scroll", Ir), Q = n(function() {
Q = 0, oe();
});
}
}
o(T, function(w) {
b(w, f);
}), this.detach = function(w) {
Q || (i(Q), Q = 0), u.detach(T, w);
}, 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;
});
})(IU);
var G4t = IU.exports;
const $4t = /* @__PURE__ */ Bat(G4t);
var Z4t = Object.defineProperty, W4t = (t, e, r) => e in t ? Z4t(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, dt = (t, e, r) => (W4t(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), ie = (t, e, r) => (HS(t, e, "access private method"), r);
function q4t(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 V = 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 X4t(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;
}
}, K4t = qo, AS = !K4t(function() {
var t = (function() {
}).bind();
return typeof t != "function" || t.hasOwnProperty("prototype");
}), RU = AS, NU = Function.prototype, wx = NU.call, Y4t = RU && NU.bind.bind(wx, wx), oo = RU ? Y4t : function(t) {
return function() {
return wx.apply(t, arguments);
};
}, DU = oo, J4t = DU({}.toString), t6t = DU("".slice), Qd = function(t) {
return t6t(J4t(t), 8, -1);
}, e6t = oo, r6t = qo, n6t = Qd, Mb = Object, i6t = e6t("".split), o6t = r6t(function() {
return !Mb("z").propertyIsEnumerable(0);
}) ? function(t) {
return n6t(t) === "String" ? i6t(t, "") : Mb(t);
} : Mb, md = function(t) {
return t == null;
}, s6t = md, a6t = TypeError, Og = function(t) {
if (s6t(t))
throw new a6t("Can't call method on " + t);
return t;
}, l6t = o6t, c6t = Og, rc = function(t) {
return l6t(c6t(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 V == "object" && V) || hu(typeof V == "object" && V) || // eslint-disable-next-line no-new-func -- fallback
/* @__PURE__ */ function() {
return this;
}() || Function("return this")()
), FU = { exports: {} }, Ek = J2, u6t = Object.defineProperty, CS = function(t, e) {
try {
u6t(Ek, t, { value: e, configurable: !0, writable: !0 });
} catch {
Ek[t] = e;
}
return e;
}, h6t = J2, d6t = CS, Sk = "__core-js_shared__", Hk = FU.exports = h6t[Sk] || d6t(Sk, {});
(Hk.versions || (Hk.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 OS = FU.exports, Ak = OS, BU = function(t, e) {
return Ak[t] || (Ak[t] = e || {});
}, p6t = Og, T6t = Object, jU = function(t) {
return T6t(p6t(t));
}, f6t = oo, Q6t = jU, m6t = f6t({}.hasOwnProperty), _3 = Object.hasOwn || function(t, e) {
return m6t(Q6t(t), e);
}, g6t = oo, y6t = 0, v6t = Math.random(), _6t = g6t(1 .toString), PS = function(t) {
return "Symbol(" + (t === void 0 ? "" : t) + ")_" + _6t(++y6t + v6t, 36);
}, b6t = typeof navigator < "u" && String(navigator.userAgent) || "", zU = J2, Eb = b6t, Ck = zU.process, Ok = zU.Deno, Pk = Ck && Ck.versions || Ok && Ok.version, kk = Pk && Pk.v8, ta, jQ;
kk && (ta = kk.split("."), jQ = ta[0] > 0 && ta[0] < 4 ? 1 : +(ta[0] + ta[1]));
!jQ && Eb && (ta = Eb.match(/Edge\/(\d+)/), (!ta || ta[1] >= 74) && (ta = Eb.match(/Chrome\/(\d+)/), ta && (jQ = +ta[1])));
var L6t = jQ, Vk = L6t, w6t = qo, x6t = J2, M6t = x6t.String, UU = !!Object.getOwnPropertySymbols && !w6t(function() {
var t = Symbol("symbol detection");
return !M6t(t) || !(Object(t) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
!Symbol.sham && Vk && Vk < 41;
}), E6t = UU, GU = E6t && !Symbol.sham && typeof Symbol.iterator == "symbol", S6t = J2, H6t = BU, Ik = _3, A6t = PS, C6t = UU, O6t = GU, K7 = S6t.Symbol, Sb = H6t("wks"), P6t = O6t ? K7.for || K7 : K7 && K7.withoutSetter || A6t, Ns = function(t) {
return Ik(Sb, t) || (Sb[t] = C6t && Ik(K7, t) ? K7[t] : P6t("Symbol." + t)), Sb[t];
}, Hb = typeof document == "object" && document.all, Eo = typeof Hb > "u" && Hb !== void 0 ? function(t) {
return typeof t == "function" || t === Hb;
} : function(t) {
return typeof t == "function";
}, k6t = Eo, Ds = function(t) {
return typeof t == "object" ? t !== null : k6t(t);
}, V6t = Ds, I6t = String, R6t = TypeError, T0 = function(t) {
if (V6t(t))
return t;
throw new R6t(I6t(t) + " is not an object");
}, $U = {}, N6t = qo, da = !N6t(function() {
return Object.defineProperty({}, 1, { get: function() {
return 7;
} })[1] !== 7;
}), D6t = da, F6t = qo, ZU = D6t && F6t(function() {
return Object.defineProperty(function() {
}, "prototype", {
value: 42,
writable: !1
}).prototype !== 42;
}), b3 = {}, B6t = J2, Rk = Ds, xx = B6t.document, j6t = Rk(xx) && Rk(xx.createElement), kS = function(t) {
return j6t ? xx.createElement(t) : {};
}, z6t = da, U6t = qo, G6t = kS, WU = !z6t && !U6t(function() {
return Object.defineProperty(G6t("div"), "a", {
get: function() {
return 7;
}
}).a !== 7;
}), $6t = AS, eT = Function.prototype.call, k4 = $6t ? eT.bind(eT) : function() {
return eT.apply(eT, arguments);
}, Ab = J2, Z6t = Eo, W6t = function(t) {
return Z6t(t) ? t : void 0;
}, gd = function(t, e) {
return arguments.length < 2 ? W6t(Ab[t]) : Ab[t] && Ab[t][e];
}, q6t = oo, VS = q6t({}.isPrototypeOf), X6t = gd, K6t = Eo, Y6t = VS, J6t = GU, t0t = Object, qU = J6t ? function(t) {
return typeof t == "symbol";
} : function(t) {
var e = X6t("Symbol");
return K6t(e) && Y6t(e.prototype, t0t(t));
}, e0t = String, IS = function(t) {
try {
return e0t(t);
} catch {
return "Object";
}
}, r0t = Eo, n0t = IS, i0t = TypeError, yd = function(t) {
if (r0t(t))
return t;
throw new i0t(n0t(t) + " is not a function");
}, o0t = yd, s0t = md, RS = function(t, e) {
var r = t[e];
return s0t(r) ? void 0 : o0t(r);
}, Cb = k4, Ob = Eo, Pb = Ds, a0t = TypeError, l0t = function(t, e) {
var r, n;
if (e === "string" && Ob(r = t.toString) && !Pb(n = Cb(r, t)) || Ob(r = t.valueOf) && !Pb(n = Cb(r, t)) || e !== "string" && Ob(r = t.toString) && !Pb(n = Cb(r, t)))
return n;
throw new a0t("Can't convert object to primitive value");
}, c0t = k4, Nk = Ds, Dk = qU, u0t = RS, h0t = l0t, d0t = Ns, p0t = TypeError, T0t = d0t("toPrimitive"), f0t = function(t, e) {
if (!Nk(t) || Dk(t))
return t;
var r = u0t(t, T0t), n;
if (r) {
if (e === void 0 && (e = "default"), n = c0t(r, t, e), !Nk(n) || Dk(n))
return n;
throw new p0t("Can't convert object to primitive value");
}
return e === void 0 && (e = "number"), h0t(t, e);
}, Q0t = f0t, m0t = qU, XU = function(t) {
var e = Q0t(t, "string");
return m0t(e) ? e : e + "";
}, g0t = da, y0t = WU, v0t = ZU, rT = T0, Fk = XU, _0t = TypeError, kb = Object.defineProperty, b0t = Object.getOwnPropertyDescriptor, Vb = "enumerable", Ib = "configurable", Rb = "writable";
b3.f = g0t ? v0t ? function(t, e, r) {
if (rT(t), e = Fk(e), rT(r), typeof t == "function" && e === "prototype" && "value" in r && Rb in r && !r[Rb]) {
var n = b0t(t, e);
n && n[Rb] && (t[e] = r.value, r = {
configurable: Ib in r ? r[Ib] : n[Ib],
enumerable: Vb in r ? r[Vb] : n[Vb],
writable: !1
});
}
return kb(t, e, r);
} : kb : function(t, e, r) {
if (rT(t), e = Fk(e), rT(r), y0t)
try {
return kb(t, e, r);
} catch {
}
if ("get" in r || "set" in r)
throw new _0t("Accessors not supported");
return "value" in r && (t[e] = r.value), t;
};
var L0t = Math.ceil, w0t = Math.floor, x0t = Math.trunc || function(t) {
var e = +t;
return (e > 0 ? w0t : L0t)(e);
}, M0t = x0t, Pg = function(t) {
var e = +t;
return e !== e || e === 0 ? 0 : M0t(e);
}, E0t = Pg, S0t = Math.max, H0t = Math.min, A0t = function(t, e) {
var r = E0t(t);
return r < 0 ? S0t(r + e, 0) : H0t(r, e);
}, C0t = Pg, O0t = Math.min, P0t = function(t) {
var e = C0t(t);
return e > 0 ? O0t(e, 9007199254740991) : 0;
}, k0t = P0t, KU = function(t) {
return k0t(t.length);
}, V0t = rc, I0t = A0t, R0t = KU, Bk = function(t) {
return function(e, r, n) {
var i = V0t(e), o = R0t(i);
if (o === 0)
return !t && -1;
var s = I0t(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;
};
}, N0t = {
// `Array.prototype.includes` method
// https://tc39.es/ecma262/#sec-array.prototype.includes
includes: Bk(!0),
// `Array.prototype.indexOf` method
// https://tc39.es/ecma262/#sec-array.prototype.indexof
indexOf: Bk(!1)
}, kg = {}, D0t = oo, Nb = _3, F0t = rc, B0t = N0t.indexOf, j0t = kg, jk = D0t([].push), YU = function(t, e) {
var r = F0t(t), n = 0, i = [], o;
for (o in r)
!Nb(j0t, o) && Nb(r, o) && jk(i, o);
for (; e.length > n; )
Nb(r, o = e[n++]) && (~B0t(i, o) || jk(i, o));
return i;
}, NS = [
"constructor",
"hasOwnProperty",
"isPrototypeOf",
"propertyIsEnumerable",
"toLocaleString",
"toString",
"valueOf"
], z0t = YU, U0t = NS, G0t = Object.keys || function(t) {
return z0t(t, U0t);
}, $0t = da, Z0t = ZU, W0t = b3, q0t = T0, X0t = rc, K0t = G0t;
$U.f = $0t && !Z0t ? Object.defineProperties : function(t, e) {
q0t(t);
for (var r = X0t(e), n = K0t(e), i = n.length, o = 0, s; i > o; )
W0t.f(t, s = n[o++], r[s]);
return t;
};
var Y0t = gd, J0t = Y0t("document", "documentElement"), t5t = BU, e5t = PS, zk = t5t("keys"), DS = function(t) {
return zk[t] || (zk[t] = e5t(t));
}, r5t = T0, n5t = $U, Uk = NS, i5t = kg, o5t = J0t, s5t = kS, a5t = DS, Gk = ">", $k = "<", Mx = "prototype", Ex = "script", JU = a5t("IE_PROTO"), Db = function() {
}, tG = function(t) {
return $k + Ex + Gk + t + $k + "/" + Ex + Gk;
}, Zk = function(t) {
t.write(tG("")), t.close();
var e = t.parentWindow.Object;
return t = null, e;
}, l5t = function() {
var t = s5t("iframe"), e = "java" + Ex + ":", r;
return t.style.display = "none", o5t.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 ? Zk(nT) : l5t() : Zk(nT);
for (var t = Uk.length; t--; )
delete gf[Mx][Uk[t]];
return gf();
};
i5t[JU] = !0;
var FS = Object.create || function(t, e) {
var r;
return t !== null ? (Db[Mx] = r5t(t), r = new Db(), Db[Mx] = null, r[JU] = t) : r = gf(), e === void 0 ? r : n5t.f(r, e);
}, c5t = Ns, u5t = FS, h5t = b3.f, Sx = c5t("unscopables"), Hx = Array.prototype;
Hx[Sx] === void 0 && h5t(Hx, Sx, {
configurable: !0,
value: u5t(null)
});
var d5t = function(t) {
Hx[Sx][t] = !0;
}, vd = {}, p5t = J2, T5t = Eo, Wk = p5t.WeakMap, f5t = T5t(Wk) && /native code/.test(String(Wk)), BS = function(t, e) {
return {
enumerable: !(t & 1),
configurable: !(t & 2),
writable: !(t & 4),
value: e
};
}, Q5t = da, m5t = b3, g5t = BS, Vg = Q5t ? function(t, e, r) {
return m5t.f(t, e, g5t(1, r));
} : function(t, e, r) {
return t[e] = r, t;
}, y5t = f5t, eG = J2, v5t = Ds, _5t = Vg, Fb = _3, Bb = OS, b5t = DS, L5t = kg, qk = "Object already initialized", Ax = eG.TypeError, w5t = eG.WeakMap, zQ, jh, UQ, x5t = function(t) {
return UQ(t) ? jh(t) : zQ(t, {});
}, M5t = function(t) {
return function(e) {
var r;
if (!v5t(e) || (r = jh(e)).type !== t)
throw new Ax("Incompatible receiver, " + t + " required");
return r;
};
};
if (y5t || Bb.state) {
var Oa = Bb.state || (Bb.state = new w5t());
Oa.get = Oa.get, Oa.has = Oa.has, Oa.set = Oa.set, zQ = function(t, e) {
if (Oa.has(t))
throw new Ax(qk);
return e.facade = t, Oa.set(t, e), e;
}, jh = function(t) {
return Oa.get(t) || {};
}, UQ = function(t) {
return Oa.has(t);
};
} else {
var Yl = b5t("state");
L5t[Yl] = !0, zQ = function(t, e) {
if (Fb(t, Yl))
throw new Ax(qk);
return e.facade = t, _5t(t, Yl, e), e;
}, jh = function(t) {
return Fb(t, Yl) ? t[Yl] : {};
}, UQ = function(t) {
return Fb(t, Yl);
};
}
var Ig = {
set: zQ,
get: jh,
has: UQ,
enforce: x5t,
getterFor: M5t
}, jS = {}, rG = {}, nG = {}.propertyIsEnumerable, iG = Object.getOwnPropertyDescriptor, E5t = iG && !nG.call({ 1: 2 }, 1);
rG.f = E5t ? function(t) {
var e = iG(this, t);
return !!e && e.enumerable;
} : nG;
var S5t = da, H5t = k4, A5t = rG, C5t = BS, O5t = rc, P5t = XU, k5t = _3, V5t = WU, Xk = Object.getOwnPropertyDescriptor;
jS.f = S5t ? Xk : function(t, e) {
if (t = O5t(t), e = P5t(e), V5t)
try {
return Xk(t, e);
} catch {
}
if (k5t(t, e))
return C5t(!H5t(A5t.f, t, e), t[e]);
};
var oG = { exports: {} }, Cx = da, I5t = _3, sG = Function.prototype, R5t = Cx && Object.getOwnPropertyDescriptor, zS = I5t(sG, "name"), N5t = zS && (function() {
}).name === "something", D5t = zS && (!Cx || Cx && R5t(sG, "name").configurable), aG = {
EXISTS: zS,
PROPER: N5t,
CONFIGURABLE: D5t
}, F5t = oo, B5t = Eo, Ox = OS, j5t = F5t(Function.toString);
B5t(Ox.inspectSource) || (Ox.inspectSource = function(t) {
return j5t(t);
});
var z5t = Ox.inspectSource, US = oo, U5t = qo, G5t = Eo, iT = _3, Px = da, $5t = aG.CONFIGURABLE, Z5t = z5t, lG = Ig, W5t = lG.enforce, q5t = lG.get, Kk = String, yf = Object.defineProperty, X5t = US("".slice), K5t = US("".replace), Y5t = US([].join), J5t = Px && !U5t(function() {
return yf(function() {
}, "length", { value: 8 }).length !== 8;
}), tlt = String(String).split("String"), elt = oG.exports = function(t, e, r) {
X5t(Kk(e), 0, 7) === "Symbol(" && (e = "[" + K5t(Kk(e), /^Symbol\(([^)]*)\).*$/, "$1") + "]"), r && r.getter && (e = "get " + e), r && r.setter && (e = "set " + e), (!iT(t, "name") || $5t && t.name !== e) && (Px ? yf(t, "name", { value: e, configurable: !0 }) : t.name = e), J5t && r && iT(r, "arity") && t.length !== r.arity && yf(t, "length", { value: r.arity });
try {
r && iT(r, "constructor") && r.constructor ? Px && yf(t, "prototype", { writable: !1 }) : t.prototype && (t.prototype = void 0);
} catch {
}
var n = W5t(t);
return iT(n, "source") || (n.source = Y5t(tlt, typeof e == "string" ? e : "")), t;
};
Function.prototype.toString = elt(function() {
return G5t(this) && q5t(this).source || Z5t(this);
}, "toString");
var cG = oG.exports, rlt = Eo, nlt = b3, ilt = cG, olt = CS, nc = function(t, e, r, n) {
n || (n = {});
var i = n.enumerable, o = n.name !== void 0 ? n.name : e;
if (rlt(r) && ilt(r, o, n), n.global)
i ? t[e] = r : olt(e, r);
else {
try {
n.unsafe ? t[e] && (i = !0) : delete t[e];
} catch {
}
i ? t[e] = r : nlt.f(t, e, {
value: r,
enumerable: !1,
configurable: !n.nonConfigurable,
writable: !n.nonWritable
});
}
return t;
}, Rg = {}, slt = YU, alt = NS, llt = alt.concat("length", "prototype");
Rg.f = Object.getOwnPropertyNames || function(t) {
return slt(t, llt);
};
var uG = {};
uG.f = Object.getOwnPropertySymbols;
var clt = gd, ult = oo, hlt = Rg, dlt = uG, plt = T0, Tlt = ult([].concat), flt = clt("Reflect", "ownKeys") || function(t) {
var e = hlt.f(plt(t)), r = dlt.f;
return r ? Tlt(e, r(t)) : e;
}, Yk = _3, Qlt = flt, mlt = jS, glt = b3, ylt = function(t, e, r) {
for (var n = Qlt(e), i = glt.f, o = mlt.f, s = 0; s < n.length; s++) {
var a = n[s];
!Yk(t, a) && !(r && Yk(r, a)) && i(t, a, o(e, a));
}
}, vlt = qo, _lt = Eo, blt = /#|\.prototype\./, _d = function(t, e) {
var r = wlt[Llt(t)];
return r === Mlt ? !0 : r === xlt ? !1 : _lt(e) ? vlt(e) : !!e;
}, Llt = _d.normalize = function(t) {
return String(t).replace(blt, ".").toLowerCase();
}, wlt = _d.data = {}, xlt = _d.NATIVE = "N", Mlt = _d.POLYFILL = "P", hG = _d, oT = J2, Elt = jS.f, Slt = Vg, Hlt = nc, Alt = CS, Clt = ylt, Olt = 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] || Alt(r, {}) : s = oT[r] && oT[r].prototype, s)
for (a in e) {
if (d = e[a], t.dontCallGetSet ? (T = Elt(s, a), u = T && T.value) : u = s[a], o = Olt(n ? a : r + (i ? "." : "#") + a, t.forced), !o && u !== void 0) {
if (typeof d == typeof u)
continue;
Clt(d, u);
}
(t.sham || u && u.sham) && Slt(d, "sham", !0), Hlt(s, a, d, t);
}
}, Plt = qo, klt = !Plt(function() {
function t() {
}
return t.prototype.constructor = null, Object.getPrototypeOf(new t()) !== t.prototype;
}), Vlt = _3, Ilt = Eo, Rlt = jU, Nlt = DS, Dlt = klt, Jk = Nlt("IE_PROTO"), kx = Object, Flt = kx.prototype, dG = Dlt ? kx.getPrototypeOf : function(t) {
var e = Rlt(t);
if (Vlt(e, Jk))
return e[Jk];
var r = e.constructor;
return Ilt(r) && e instanceof r ? r.prototype : e instanceof kx ? Flt : null;
}, Blt = qo, jlt = Eo, zlt = Ds, tV = dG, Ult = nc, Glt = Ns, Vx = Glt("iterator"), pG = !1, G5, jb, zb;
[].keys && (zb = [].keys(), "next" in zb ? (jb = tV(tV(zb)), jb !== Object.prototype && (G5 = jb)) : pG = !0);
var $lt = !zlt(G5) || Blt(function() {
var t = {};
return G5[Vx].call(t) !== t;
});
$lt && (G5 = {});
jlt(G5[Vx]) || Ult(G5, Vx, function() {
return this;
});
var TG = {
IteratorPrototype: G5,
BUGGY_SAFARI_ITERATORS: pG
}, Zlt = b3.f, Wlt = _3, qlt = Ns, eV = qlt("toStringTag"), Ng = function(t, e, r) {
t && !r && (t = t.prototype), t && !Wlt(t, eV) && Zlt(t, eV, { configurable: !0, value: e });
}, Xlt = TG.IteratorPrototype, Klt = FS, Ylt = BS, Jlt = Ng, t7t = vd, e7t = function() {
return this;
}, r7t = function(t, e, r, n) {
var i = e + " Iterator";
return t.prototype = Klt(Xlt, { next: Ylt(+!n, r) }), Jlt(t, i, !1), t7t[i] = e7t, t;
}, n7t = oo, i7t = yd, fG = function(t, e, r) {
try {
return n7t(i7t(Object.getOwnPropertyDescriptor(t, e)[r]));
} catch {
}
}, o7t = Ds, s7t = function(t) {
return o7t(t) || t === null;
}, a7t = s7t, l7t = String, c7t = TypeError, u7t = function(t) {
if (a7t(t))
return t;
throw new c7t("Can't set " + l7t(t) + " as a prototype");
}, h7t = fG, d7t = Ds, p7t = Og, T7t = u7t, QG = Object.setPrototypeOf || ("__proto__" in {} ? function() {
var t = !1, e = {}, r;
try {
r = h7t(Object.prototype, "__proto__", "set"), r(e, []), t = e instanceof Array;
} catch {
}
return function(n, i) {
return p7t(n), T7t(i), d7t(n) && (t ? r(n, i) : n.__proto__ = i), n;
};
}() : void 0), f7t = L3, Q7t = k4, mG = aG, m7t = Eo, g7t = r7t, rV = dG, nV = QG, y7t = Ng, v7t = Vg, Ub = nc, _7t = Ns, b7t = vd, gG = TG, L7t = mG.PROPER, w7t = mG.CONFIGURABLE, iV = gG.IteratorPrototype, sT = gG.BUGGY_SAFARI_ITERATORS, du = _7t("iterator"), oV = "keys", pu = "values", sV = "entries", x7t = function() {
return this;
}, GS = function(t, e, r, n, i, o, s) {
g7t(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 oV:
return function() {
return new r(this, x);
};
case pu:
return function() {
return new r(this, x);
};
case sV:
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, b, w, S;
if (y && (b = rV(y.call(new t())), b !== Object.prototype && b.next && (rV(b) !== iV && (nV ? nV(b, iV) : m7t(b[du]) || Ub(b, du, x7t)), y7t(b, u, !0))), L7t && i === pu && f && f.name !== pu && (w7t ? v7t(T, "name", pu) : (d = !0, Q = function() {
return Q7t(f, this);
})), i)
if (w = {
values: a(pu),
keys: o ? Q : a(oV),
entries: a(sV)
}, s)
for (S in w)
(sT || d || !(S in T)) && Ub(T, S, w[S]);
else
f7t({ target: e, proto: !0, forced: sT || d }, w);
return T[du] !== Q && Ub(T, du, Q, { name: i }), b7t[e] = Q, w;
}, $S = function(t, e) {
return { value: t, done: e };
}, M7t = rc, ZS = d5t, aV = vd, yG = Ig, E7t = b3.f, S7t = GS, aT = $S, H7t = da, vG = "Array Iterator", A7t = yG.set, C7t = yG.getterFor(vG), O7t = S7t(Array, "Array", function(t, e) {
A7t(this, {
type: vG,
target: M7t(t),
// target
index: 0,
// next index
kind: e
// kind
});
}, function() {
var t = C7t(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"), lV = aV.Arguments = aV.Array;
ZS("keys");
ZS("values");
ZS("entries");
if (H7t && lV.name !== "values")
try {
E7t(lV, "name", { value: "values" });
} catch {
}
var P7t = Ns, k7t = P7t("toStringTag"), _G = {};
_G[k7t] = "z";
var WS = String(_G) === "[object z]", V7t = WS, I7t = Eo, vf = Qd, R7t = Ns, N7t = R7t("toStringTag"), D7t = Object, F7t = vf(/* @__PURE__ */ function() {
return arguments;
}()) === "Arguments", B7t = function(t, e) {
try {
return t[e];
} catch {
}
}, qS = V7t ? vf : function(t) {
var e, r, n;
return t === void 0 ? "Undefined" : t === null ? "Null" : typeof (r = B7t(e = D7t(t), N7t)) == "string" ? r : F7t ? vf(e) : (n = vf(e)) === "Object" && I7t(e.callee) ? "Arguments" : n;
}, j7t = WS, z7t = qS, U7t = j7t ? {}.toString : function() {
return "[object " + z7t(this) + "]";
}, G7t = WS, $7t = nc, Z7t = U7t;
G7t || $7t(Object.prototype, "toString", Z7t, { unsafe: !0 });
var bG = { exports: {} }, LG = {}, W7t = oo, q7t = W7t([].slice), X7t = Qd, K7t = rc, wG = Rg.f, Y7t = q7t, xG = typeof window == "object" && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [], J7t = function(t) {
try {
return wG(t);
} catch {
return Y7t(xG);
}
};
LG.f = function(t) {
return xG && X7t(t) === "Window" ? J7t(t) : wG(K7t(t));
};
var t8t = qo, e8t = t8t(function() {
if (typeof ArrayBuffer == "function") {
var t = new ArrayBuffer(8);
Object.isExtensible(t) && Object.defineProperty(t, "a", { value: 8 });
}
}), r8t = qo, n8t = Ds, i8t = Qd, cV = e8t, _f = Object.isExtensible, o8t = r8t(function() {
_f(1);
}), s8t = o8t || cV ? function(t) {
return !n8t(t) || cV && i8t(t) === "ArrayBuffer" ? !1 : _f ? _f(t) : !0;
} : _f, a8t = qo, l8t = !a8t(function() {
return Object.isExtensible(Object.preventExtensions({}));
}), c8t = L3, u8t = oo, h8t = kg, d8t = Ds, XS = _3, p8t = b3.f, uV = Rg, T8t = LG, KS = s8t, f8t = PS, Q8t = l8t, MG = !1, A4 = f8t("meta"), m8t = 0, YS = function(t) {
p8t(t, A4, { value: {
objectID: "O" + m8t++,
// object ID
weakData: {}
// weak collections IDs
} });
}, g8t = function(t, e) {
if (!d8t(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;
}, y8t = function(t, e) {
if (!XS(t, A4)) {
if (!KS(t))
return !0;
if (!e)
return !1;
YS(t);
}
return t[A4].weakData;
}, v8t = function(t) {
return Q8t && MG && KS(t) && !XS(t, A4) && YS(t), t;
}, _8t = function() {
b8t.enable = function() {
}, MG = !0;
var t = uV.f, e = u8t([].splice), r = {};
r[A4] = 1, t(r).length && (uV.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;
}, c8t({ target: "Object", stat: !0, forced: !0 }, {
getOwnPropertyNames: T8t.f
}));
}, b8t = bG.exports = {
enable: _8t,
fastKey: g8t,
getWeakData: y8t,
onFreeze: v8t
};
h8t[A4] = !0;
var EG = bG.exports, L8t = Qd, w8t = oo, x8t = function(t) {
if (L8t(t) === "Function")
return w8t(t);
}, hV = x8t, M8t = yd, E8t = AS, S8t = hV(hV.bind), SG = function(t, e) {
return M8t(t), e === void 0 ? t : E8t ? S8t(t, e) : function() {
return t.apply(e, arguments);
};
}, H8t = Ns, A8t = vd, C8t = H8t("iterator"), O8t = Array.prototype, P8t = function(t) {
return t !== void 0 && (A8t.Array === t || O8t[C8t] === t);
}, k8t = qS, dV = RS, V8t = md, I8t = vd, R8t = Ns, N8t = R8t("iterator"), HG = function(t) {
if (!V8t(t))
return dV(t, N8t) || dV(t, "@@iterator") || I8t[k8t(t)];
}, D8t = k4, F8t = yd, B8t = T0, j8t = IS, z8t = HG, U8t = TypeError, G8t = function(t, e) {
var r = arguments.length < 2 ? z8t(t) : e;
if (F8t(r))
return B8t(D8t(r, t));
throw new U8t(j8t(t) + " is not iterable");
}, $8t = k4, pV = T0, Z8t = RS, JS = function(t, e, r) {
var n, i;
pV(t);
try {
if (n = Z8t(t, "return"), !n) {
if (e === "throw")
throw r;
return r;
}
n = $8t(n, t);
} catch (o) {
i = !0, n = o;
}
if (e === "throw")
throw r;
if (i)
throw n;
return pV(n), r;
}, W8t = SG, q8t = k4, X8t = T0, K8t = IS, Y8t = P8t, J8t = KU, TV = VS, tct = G8t, ect = HG, fV = JS, rct = TypeError, bf = function(t, e) {
this.stopped = t, this.result = e;
}, QV = 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 = W8t(e, n), d, T, f, Q, y, b, w, S = function(C) {
return d && fV(d, "normal", C), new bf(!0, C);
}, x = function(C) {
return i ? (X8t(C), a ? u(C[0], C[1], S) : u(C[0], C[1])) : a ? u(C, S) : u(C);
};
if (o)
d = t.iterator;
else if (s)
d = t;
else {
if (T = ect(t), !T)
throw new rct(K8t(t) + " is not iterable");
if (Y8t(T)) {
for (f = 0, Q = J8t(t); Q > f; f++)
if (y = x(t[f]), y && TV(QV, y))
return y;
return new bf(!1);
}
d = tct(t, T);
}
for (b = o ? t.next : d.next; !(w = q8t(b, d)).done; ) {
try {
y = x(w.value);
} catch (C) {
fV(d, "throw", C);
}
if (typeof y == "object" && y && TV(QV, y))
return y;
}
return new bf(!1);
}, nct = VS, ict = TypeError, CG = function(t, e) {
if (nct(e, t))
return t;
throw new ict("Incorrect invocation");
}, oct = Ns, OG = oct("iterator"), PG = !1;
try {
var sct = 0, mV = {
next: function() {
return { done: !!sct++ };
},
return: function() {
PG = !0;
}
};
mV[OG] = function() {
return this;
}, Array.from(mV, function() {
throw 2;
});
} catch {
}
var act = function(t, e) {
try {
if (!e && !PG)
return !1;
} catch {
return !1;
}
var r = !1;
try {
var n = {};
n[OG] = function() {
return {
next: function() {
return { done: r = !0 };
}
};
}, t(n);
} catch {
}
return r;
}, lct = Eo, cct = Ds, gV = QG, uct = function(t, e, r) {
var n, i;
return (
// it can work only with native `setPrototypeOf`
gV && // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
lct(n = e.constructor) && n !== r && cct(i = n.prototype) && i !== r.prototype && gV(t, i), t
);
}, hct = L3, dct = J2, pct = oo, yV = hG, Tct = nc, fct = EG, Qct = AG, mct = CG, gct = Eo, yct = md, Gb = Ds, $b = qo, vct = act, _ct = Ng, bct = uct, Lct = function(t, e, r) {
var n = t.indexOf("Map") !== -1, i = t.indexOf("Weak") !== -1, o = n ? "set" : "add", s = dct[t], a = s && s.prototype, u = s, d = {}, T = function(x) {
var C = pct(a[x]);
Tct(
a,
x,
x === "add" ? function(P) {
return C(this, P === 0 ? 0 : P), this;
} : x === "delete" ? function(P) {
return i && !Gb(P) ? !1 : C(this, P === 0 ? 0 : P);
} : x === "get" ? function(P) {
return i && !Gb(P) ? void 0 : C(this, P === 0 ? 0 : P);
} : x === "has" ? function(P) {
return i && !Gb(P) ? !1 : C(this, P === 0 ? 0 : P);
} : function(P, R) {
return C(this, P === 0 ? 0 : P, R), this;
}
);
}, f = yV(
t,
!gct(s) || !(i || a.forEach && !$b(function() {
new s().entries().next();
}))
);
if (f)
u = r.getConstructor(e, t, n, o), fct.enable();
else if (yV(t, !0)) {
var Q = new u(), y = Q[o](i ? {} : -0, 1) !== Q, b = $b(function() {
Q.has(1);
}), w = vct(function(x) {
new s(x);
}), S = !i && $b(function() {
for (var x = new s(), C = 5; C--; )
x[o](C, C);
return !x.has(-0);
});
w || (u = e(function(x, C) {
mct(x, a);
var P = bct(new s(), x, u);
return yct(C) || Qct(C, P[o], { that: P, AS_ENTRIES: n }), P;
}), u.prototype = a, a.constructor = u), (b || S) && (T("delete"), T("has"), n && T("get")), (S || y) && T(o), i && a.clear && delete a.clear;
}
return d[t] = u, hct({ global: !0, constructor: !0, forced: u !== s }, d), _ct(u, t), i || r.setStrong(u, t, n), u;
}, vV = cG, wct = b3, kG = function(t, e, r) {
return r.get && vV(r.get, e, { getter: !0 }), r.set && vV(r.set, e, { setter: !0 }), wct.f(t, e, r);
}, xct = nc, Mct = function(t, e, r) {
for (var n in e)
xct(t, n, e[n], r);
return t;
}, Ect = gd, Sct = kG, Hct = Ns, Act = da, _V = Hct("species"), Cct = function(t) {
var e = Ect(t);
Act && e && !e[_V] && Sct(e, _V, {
configurable: !0,
get: function() {
return this;
}
});
}, bV = FS, Oct = kG, LV = Mct, Pct = SG, kct = CG, Vct = md, Ict = AG, Rct = GS, wV = $S, Nct = Cct, Tu = da, xV = EG.fastKey, VG = Ig, MV = VG.set, Zb = VG.getterFor, Dct = {
getConstructor: function(t, e, r, n) {
var i = t(function(d, T) {
kct(d, o), MV(d, {
type: e,
index: bV(null),
first: void 0,
last: void 0,
size: 0
}), Tu || (d.size = 0), Vct(T) || Ict(T, d[n], { that: d, AS_ENTRIES: r });
}), o = i.prototype, s = Zb(e), a = function(d, T, f) {
var Q = s(d), y = u(d, T), b, w;
return y ? y.value = f : (Q.last = y = {
index: w = xV(T, !0),
key: T,
value: f,
previous: b = Q.last,
next: void 0,
removed: !1
}, Q.first || (Q.first = y), b && (b.next = y), Tu ? Q.size++ : d.size++, w !== "F" && (Q.index[w] = y)), d;
}, u = function(d, T) {
var f = s(d), Q = xV(T), y;
if (Q !== "F")
return f.index[Q];
for (y = f.first; y; y = y.next)
if (y.key === T)
return y;
};
return LV(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 = bV(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, b = Q.previous;
delete f.index[Q.index], Q.removed = !0, b && (b.next = y), y && (y.previous = b), f.first === Q && (f.first = y), f.last === Q && (f.last = b), 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 = Pct(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);
}
}), LV(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 && Oct(o, "size", {
configurable: !0,
get: function() {
return s(this).size;
}
}), i;
},
setStrong: function(t, e, r) {
var n = e + " Iterator", i = Zb(e), o = Zb(n);
Rct(t, e, function(s, a) {
MV(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, wV(void 0, !0)) : wV(a === "keys" ? u.key : a === "values" ? u.value : [u.key, u.value], !1);
}, r ? "entries" : "values", !r, !0), Nct(e);
}
}, Fct = Lct, Bct = Dct;
Fct("Set", function(t) {
return function() {
return t(this, arguments.length ? arguments[0] : void 0);
};
}, Bct);
var Wb = oo, lT = Set.prototype, w3 = {
// eslint-disable-next-line es/no-set -- safe
Set,
add: Wb(lT.add),
has: Wb(lT.has),
remove: Wb(lT.delete),
proto: lT
}, jct = w3.has, al = function(t) {
return jct(t), t;
}, zct = k4, ll = function(t, e, r) {
for (var n = r ? t : t.iterator, i = t.next, o, s; !(o = zct(i, n)).done; )
if (s = e(o.value), s !== void 0)
return s;
}, IG = oo, Uct = ll, RG = w3, Gct = RG.Set, NG = RG.proto, $ct = IG(NG.forEach), DG = IG(NG.keys), Zct = DG(new Gct()).next, bd = function(t, e, r) {
return r ? Uct({ iterator: DG(t), next: Zct }, e) : $ct(t, e);
}, FG = w3, Wct = bd, qct = FG.Set, Xct = FG.add, tH = function(t) {
var e = new qct();
return Wct(t, function(r) {
Xct(e, r);
}), e;
}, Kct = fG, Yct = w3, Ld = Kct(Yct.proto, "size", "get") || function(t) {
return t.size;
}, Jct = function(t) {
return {
iterator: t,
next: t.next,
done: !1
};
}, EV = yd, BG = T0, SV = k4, tut = Pg, eut = Jct, HV = "Invalid size", rut = RangeError, nut = TypeError, iut = Math.max, jG = function(t, e) {
this.set = t, this.size = iut(e, 0), this.has = EV(t.has), this.keys = EV(t.keys);
};
jG.prototype = {
getIterator: function() {
return eut(BG(SV(this.keys, this.set)));
},
includes: function(t) {
return SV(this.has, this.set, t);
}
};
var cl = function(t) {
BG(t);
var e = +t.size;
if (e !== e)
throw new nut(HV);
var r = tut(e);
if (r < 0)
throw new rut(HV);
return new jG(t, r);
}, out = al, zG = w3, sut = tH, aut = Ld, lut = cl, cut = bd, uut = ll, hut = zG.has, AV = zG.remove, dut = function(t) {
var e = out(this), r = lut(t), n = sut(e);
return aut(e) <= r.size ? cut(e, function(i) {
r.includes(i) && AV(n, i);
}) : uut(r.getIterator(), function(i) {
hut(e, i) && AV(n, i);
}), n;
}, put = gd, CV = function(t) {
return {
size: t,
has: function() {
return !1;
},
keys: function() {
return {
next: function() {
return { done: !0 };
}
};
}
};
}, ul = function(t) {
var e = put("Set");
try {
new e()[t](CV(0));
try {
return new e()[t](CV(-1)), !1;
} catch {
return !0;
}
} catch {
return !1;
}
}, Tut = L3, fut = dut, Qut = ul;
Tut({ target: "Set", proto: !0, real: !0, forced: !Qut("difference") }, {
difference: fut
});
var mut = al, eH = w3, gut = Ld, yut = cl, vut = bd, _ut = ll, but = eH.Set, OV = eH.add, Lut = eH.has, wut = function(t) {
var e = mut(this), r = yut(t), n = new but();
return gut(e) > r.size ? _ut(r.getIterator(), function(i) {
Lut(e, i) && OV(n, i);
}) : vut(e, function(i) {
r.includes(i) && OV(n, i);
}), n;
}, xut = L3, Mut = qo, Eut = wut, Sut = ul, Hut = !Sut("intersection") || Mut(function() {
return String(Array.from((/* @__PURE__ */ new Set([1, 2, 3])).intersection(/* @__PURE__ */ new Set([3, 2])))) !== "3,2";
});
xut({ target: "Set", proto: !0, real: !0, forced: Hut }, {
intersection: Eut
});
var Aut = al, Cut = w3.has, Out = Ld, Put = cl, kut = bd, Vut = ll, Iut = JS, Rut = function(t) {
var e = Aut(this), r = Put(t);
if (Out(e) <= r.size)
return kut(e, function(i) {
if (r.includes(i))
return !1;
}, !0) !== !1;
var n = r.getIterator();
return Vut(n, function(i) {
if (Cut(e, i))
return Iut(n, "normal", !1);
}) !== !1;
}, Nut = L3, Dut = Rut, Fut = ul;
Nut({ target: "Set", proto: !0, real: !0, forced: !Fut("isDisjointFrom") }, {
isDisjointFrom: Dut
});
var But = al, jut = Ld, zut = bd, Uut = cl, Gut = function(t) {
var e = But(this), r = Uut(t);
return jut(e) > r.size ? !1 : zut(e, function(n) {
if (!r.includes(n))
return !1;
}, !0) !== !1;
}, $ut = L3, Zut = Gut, Wut = ul;
$ut({ target: "Set", proto: !0, real: !0, forced: !Wut("isSubsetOf") }, {
isSubsetOf: Zut
});
var qut = al, Xut = w3.has, Kut = Ld, Yut = cl, Jut = ll, t9t = JS, e9t = function(t) {
var e = qut(this), r = Yut(t);
if (Kut(e) < r.size)
return !1;
var n = r.getIterator();
return Jut(n, function(i) {
if (!Xut(e, i))
return t9t(n, "normal", !1);
}) !== !1;
}, r9t = L3, n9t = e9t, i9t = ul;
r9t({ target: "Set", proto: !0, real: !0, forced: !i9t("isSupersetOf") }, {
isSupersetOf: n9t
});
var o9t = al, rH = w3, s9t = tH, a9t = cl, l9t = ll, c9t = rH.add, u9t = rH.has, h9t = rH.remove, d9t = function(t) {
var e = o9t(this), r = a9t(t).getIterator(), n = s9t(e);
return l9t(r, function(i) {
u9t(e, i) ? h9t(n, i) : c9t(n, i);
}), n;
}, p9t = L3, T9t = d9t, f9t = ul;
p9t({ target: "Set", proto: !0, real: !0, forced: !f9t("symmetricDifference") }, {
symmetricDifference: T9t
});
var Q9t = al, m9t = w3.add, g9t = tH, y9t = cl, v9t = ll, _9t = function(t) {
var e = Q9t(this), r = y9t(t).getIterator(), n = g9t(e);
return v9t(r, function(i) {
m9t(n, i);
}), n;
}, b9t = L3, L9t = _9t, w9t = ul;
b9t({ target: "Set", proto: !0, real: !0, forced: !w9t("union") }, {
union: L9t
});
var x9t = qS, M9t = String, UG = function(t) {
if (x9t(t) === "Symbol")
throw new TypeError("Cannot convert a Symbol value to a string");
return M9t(t);
}, nH = oo, E9t = Pg, S9t = UG, H9t = Og, A9t = nH("".charAt), PV = nH("".charCodeAt), C9t = nH("".slice), kV = function(t) {
return function(e, r) {
var n = S9t(H9t(e)), i = E9t(r), o = n.length, s, a;
return i < 0 || i >= o ? t ? "" : void 0 : (s = PV(n, i), s < 55296 || s > 56319 || i + 1 === o || (a = PV(n, i + 1)) < 56320 || a > 57343 ? t ? A9t(n, i) : s : t ? C9t(n, i, i + 2) : (s - 55296 << 10) + (a - 56320) + 65536);
};
}, O9t = {
// `String.prototype.codePointAt` method
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
codeAt: kV(!1),
// `String.prototype.at` method
// https://github.com/mathiasbynens/String.prototype.at
charAt: kV(!0)
}, P9t = O9t.charAt, k9t = UG, GG = Ig, V9t = GS, VV = $S, $G = "String Iterator", I9t = GG.set, R9t = GG.getterFor($G);
V9t(String, "String", function(t) {
I9t(this, {
type: $G,
string: k9t(t),
index: 0
});
}, function() {
var t = R9t(this), e = t.string, r = t.index, n;
return r >= e.length ? VV(void 0, !0) : (n = P9t(e, r), t.index += n.length, VV(n, !1));
});
var N9t = J2, D9t = N9t, F9t = D9t, B9t = F9t.Set, j9t = {
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
}, z9t = kS, qb = z9t("span").classList, IV = qb && qb.constructor && qb.constructor.prototype, U9t = IV === Object.prototype ? void 0 : IV, RV = J2, ZG = j9t, G9t = U9t, l9 = O7t, NV = Vg, $9t = Ng, Z9t = Ns, Xb = Z9t("iterator"), Kb = l9.values, WG = function(t, e) {
if (t) {
if (t[Xb] !== Kb)
try {
NV(t, Xb, Kb);
} catch {
t[Xb] = Kb;
}
if ($9t(t, e, !0), ZG[e]) {
for (var r in l9)
if (t[r] !== l9[r])
try {
NV(t, r, l9[r]);
} catch {
t[r] = l9[r];
}
}
}
};
for (var Yb in ZG)
WG(RV[Yb] && RV[Yb].prototype, Yb);
WG(G9t, "DOMTokenList");
var W9t = B9t, q9t = W9t, X9t = q9t, K9t = X9t;
const z6 = /* @__PURE__ */ p0(K9t);
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();
})(V, 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(L, H) {
function A(z) {
try {
N(g.next(z));
} catch (Z) {
H(Z);
}
}
function O(z) {
try {
N(g.throw(z));
} catch (Z) {
H(Z);
}
}
function N(z) {
var Z;
z.done ? L(z.value) : (Z = z.value, Z instanceof p ? Z : new p(function(X) {
X(Z);
})).then(A, O);
}
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), L = 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 = L, 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 L = this.sampleCurveX(p) - h;
if (Math.abs(L) < c)
return p;
var H = this.sampleCurveDerivativeX(p);
if (Math.abs(H) < 1e-6)
break;
p -= L / H;
}
var A = 0, O = 1;
for (p = h, g = 0; g < 20 && (L = this.sampleCurveX(p), !(Math.abs(L - h) < c)); g++)
h > L ? A = p : O = p, p = 0.5 * (O - A) + A;
return p;
}, solve: function(h, c) {
return this.sampleCurveY(this.solveCurveX(h, c));
} };
var b = u(Q);
let w, S;
function x() {
return w == null && (w = typeof OffscreenCanvas < "u" && new OffscreenCanvas(1, 1).getContext("2d") && typeof createImageBitmap == "function"), w;
}
function C() {
if (S == null && (S = !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) {
S = !0;
break;
}
}
}
return S || !1;
}
function P(h, c, p, g) {
const L = new b(h, c, p, g);
return (H) => L.solve(H);
}
const R = P(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, L = ((h - c) % g + g) % g + c;
return L === c ? p : L;
}
function $(h, ...c) {
for (const p of c)
for (const g in p)
h[g] = p[g];
return h;
}
let rt = 1;
function tt(h, c, p) {
const g = {};
for (const L in h)
g[L] = c.call(this, h[L], L, h);
return g;
}
function at(h, c, p) {
const g = {};
for (const L in h)
c.call(this, h[L], L, h) && (g[L] = h[L]);
return g;
}
function lt(h) {
return Array.isArray(h) ? h.map(lt) : typeof h == "object" && h ? tt(h, lt) : h;
}
const xt = {};
function Vt(h) {
xt[h] || (typeof console < "u" && console.warn(h), xt[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 ce(h) {
return typeof WorkerGlobalScope < "u" && h !== void 0 && h instanceof WorkerGlobalScope;
}
let oe = null;
function Se(h) {
return typeof ImageBitmap < "u" && h instanceof ImageBitmap;
}
const Ir = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";
function qr(h, c, p, g, L) {
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 O = A.startsWith("BGR"), N = new Uint8ClampedArray(g * L * 4);
if (yield H.copyTo(N, function(z, Z, X, et, st) {
const ut = 4 * Math.max(-Z, 0), Tt = (Math.max(0, X) - X) * et * 4 + ut, bt = 4 * et, Mt = Math.max(0, Z), $t = Math.max(0, X);
return { rect: { x: Mt, y: $t, width: Math.min(z.width, Z + et) - Mt, height: Math.min(z.height, X + st) - $t }, layout: [{ offset: Tt, stride: bt }] };
}(h, c, p, g, L)), O)
for (let z = 0; z < N.length; z += 4) {
const Z = N[z];
N[z] = N[z + 2], N[z + 2] = Z;
}
return N;
} finally {
H.close();
}
});
}
let ne, Qe;
const Ke = "AbortError";
function Ae() {
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, L) {
super(`AJAXError: ${p} (${c}): ${g}`), this.status = c, this.statusText = p, this.url = g, this.body = L;
}
}
const te = () => ce(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 (ce(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, L) {
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: L.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 O;
O = g.type === "arrayBuffer" || g.type === "image" ? A.arrayBuffer() : g.type === "json" ? A.json() : A.text();
const N = yield O;
if (L.signal.aborted)
throw Ae();
return { data: N, cacheControl: A.headers.get("Cache-Control"), expires: A.headers.get("Expires") };
});
}(h, c);
if (ce(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, L) {
return new Promise((H, A) => {
var O;
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", !((O = g.headers) === null || O === void 0) && O.Accept || N.setRequestHeader("Accept", "application/json")), N.withCredentials = g.credentials === "include", N.onerror = () => {
A(new Error(N.statusText));
}, N.onload = () => {
if (!L.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 (Z) {
return void A(Z);
}
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));
}
}, L.signal.addEventListener("abort", () => {
N.abort(), A(Ae());
}), 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 L = this._listeners && this._listeners[g] ? this._listeners[g].slice() : [];
for (const O of L)
O.call(this, c);
const H = this._oneTimeListeners && this._oneTimeListeners[g] ? this._oneTimeListeners[g].slice() : [];
for (const O of H)
Tr(g, O, this._oneTimeListeners), O.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 Ot = { $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 Sr(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 (!Sr(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 (!Sr(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 Pi(h, c, p) {
let g;
for (g in h[p])
if (Object.prototype.hasOwnProperty.call(h[p], g) && g !== "data" && !Sr(h[p][g], c[p][g]))
return !1;
for (g in c[p])
if (Object.prototype.hasOwnProperty.call(c[p], g) && g !== "data" && !Sr(h[p][g], c[p][g]))
return !1;
return !0;
}
function _i(h, c, p, g, L, H) {
h = h || {}, c = c || {};
for (const A in h)
Object.prototype.hasOwnProperty.call(h, A) && (Sr(h[A], c[A]) || p.push({ command: H, args: [g, A, c[A], L] }));
for (const A in c)
Object.prototype.hasOwnProperty.call(c, A) && !Object.prototype.hasOwnProperty.call(h, A) && (Sr(h[A], c[A]) || p.push({ command: H, args: [g, A, c[A], L] }));
}
function ki(h) {
return h.id;
}
function c1(h, c) {
return h[c.id] = c, h;
}
class ye {
constructor(c, p, g, L) {
this.message = (c ? `${c}: ` : "") + g, L && (this.identifier = L), 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, L] of p)
this.bindings[g] = L;
}
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" }, Fr = { kind: "string" }, _r = { kind: "boolean" }, In = { kind: "color" }, y1 = { kind: "object" }, Lr = { kind: "value" }, Vi = { kind: "collator" }, H1 = { kind: "formatted" }, Ii = { kind: "padding" }, Rn = { kind: "resolvedImage" }, wt = { kind: "variableAnchorOffsetCollection" };
function it(h, c) {
return { kind: "array", itemType: h, N: c };
}
function ot(h) {
if (h.kind === "array") {
const c = ot(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, Fr, _r, In, H1, y1, it(Lr), Ii, Rn, wt];
function gt(h, c) {
if (c.kind === "error")
return null;
if (h.kind === "array") {
if (c.kind === "array" && (c.N === 0 && c.itemType.kind === "value" || !gt(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 (!gt(p, c))
return null;
}
}
return `Expected ${ot(h)} but found ${ot(c)} instead.`;
}
function At(h, c) {
return c.some((p) => p.kind === h.kind);
}
function It(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, se = 4 / 29, Xt = 6 / 29, Le = 3 * Xt * Xt, or = Xt * Xt * Xt, Rt = Math.PI / 180, Te = 180 / Math.PI;
function He(h) {
return (h %= 360) < 0 && (h += 360), h;
}
function lr([h, c, p, g]) {
let L, H;
const A = vn((0.2225045 * (h = Hr(h)) + 0.7168786 * (c = Hr(c)) + 0.0606169 * (p = Hr(p))) / 1);
h === c && c === p ? L = H = A : (L = vn((0.4360747 * h + 0.3850649 * c + 0.1430804 * p) / St), H = vn((0.0139322 * h + 0.0971045 * c + 0.7141733 * p) / Jt));
const O = 116 * A - 16;
return [O < 0 ? 0 : O, 500 * (L - A), 200 * (A - H), g];
}
function Hr(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 + se;
}
function Nr([h, c, p, g]) {
let L = (h + 16) / 116, H = isNaN(c) ? L : L + c / 500, A = isNaN(p) ? L : L - p / 200;
return L = 1 * $r(L), H = St * $r(H), A = Jt * $r(A), [vr(3.1338561 * H - 1.6168667 * L - 0.4906146 * A), vr(-0.9787684 * H + 1.9161415 * L + 0.033454 * A), vr(0.0719453 * H - 0.2289914 * L + 1.4052427 * A), g];
}
function vr(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 $r(h) {
return h > Xt ? h * h * h : Le * (h - se);
}
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, L = 1, H = !0) {
this.r = c, this.g = p, this.b = g, this.a = L, H || (this.r *= L, this.g *= L, this.b *= L, L || this.overwriteGetter("rgb", [c, p, g, L]));
}
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 L = rs[g];
if (L) {
const [A, O, N] = L;
return [A / 255, O / 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 O = 1;
return [cn(g.slice(O, O += A)), cn(g.slice(O, O += A)), cn(g.slice(O, O += A)), cn(g.slice(O, O + 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 [O, N, z, Z, X, et, st, ut, Tt, bt, Mt, $t] = A, kt = [Z || " ", st || " ", bt].join("");
if (kt === " " || kt === " /" || kt === ",," || kt === ",,,") {
const Bt = [z, et, 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), Mt ? Kn(+Mt, $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, O, N, z, Z, X, et, st, ut] = H, Tt = [N || " ", Z || " ", et].join("");
if (Tt === " " || Tt === " /" || Tt === ",," || Tt === ",,,") {
const bt = [+O, Li(+z, 0, 100), Li(+X, 0, 100), st ? Kn(+st, ut) : 1];
if (Ri(bt))
return function([Mt, $t, kt, Bt]) {
function ee(_e) {
const Xe = (_e + Mt / 30) % 12, xr = $t * Math.min(kt, 1 - kt);
return kt - xr * Math.max(-1, Math.min(Xe - 3, 9 - Xe, 1));
}
return Mt = He(Mt), $t /= 100, kt /= 100, [ee(0), ee(8), ee(4), Bt];
}(bt);
}
}
}(c);
return p ? new tn(...p, !1) : void 0;
}
get rgb() {
const { r: c, g: p, b: g, a: L } = this, H = L || 1 / 0;
return this.overwriteGetter("rgb", [c / H, p / H, g / H, L]);
}
get hcl() {
return this.overwriteGetter("hcl", function(c) {
const [p, g, L, H] = lr(c), A = Math.sqrt(g * g + L * L);
return [Math.round(1e4 * A) ? He(Math.atan2(L, 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, L] = this.rgb;
return `rgba(${[c, p, g].map((H) => Math.round(255 * H)).join(",")},${L})`;
}
}
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, L, H) {
this.text = c, this.image = p, this.scale = g, this.fontStack = L, 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], L = c[p + 1];
if (typeof g != "string" || !ns.has(g) || !Array.isArray(L) || L.length !== 2 || typeof L[0] != "number" || typeof L[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 Fr;
if (typeof h == "boolean")
return _r;
if (typeof h == "number")
return xe;
if (h instanceof tn)
return In;
if (h instanceof zi)
return Vi;
if (h instanceof Xr)
return H1;
if (h instanceof Yn)
return Ii;
if (h instanceof _n)
return wt;
if (h instanceof pn)
return Rn;
if (Array.isArray(h)) {
const c = h.length;
let p;
for (const g of h) {
const L = Qn(g);
if (p) {
if (p === L)
continue;
p = Lr;
break;
}
p = L;
}
return it(p || Lr, 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 L = Qn(g);
const H = p.expectedType;
return L.kind !== "array" || L.N !== 0 || !H || H.kind !== "array" || typeof H.N == "number" && H.N !== 0 || (L = H), new h1(L, 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: Fr, 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, L = 1;
const H = c[0];
if (H === "array") {
let O, 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);
O = is[z], L++;
} else
O = Lr;
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], L++;
}
g = it(O, N);
} else {
if (!is[H])
throw new Error(`Types doesn't contain name = ${H}`);
g = is[H];
}
const A = [];
for (; L < c.length; L++) {
const O = p.parse(c[L], L, Lr);
if (!O)
return null;
A.push(O);
}
return new d1(g, A);
}
evaluate(c) {
for (let p = 0; p < this.args.length; p++) {
const g = this.args[p].evaluate(c);
if (!gt(this.type, Qn(g)))
return g;
if (p === this.args.length - 1)
throw new jn(`Expected value to be of type ${ot(this.type)}, but found ${ot(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": In, "to-number": xe, "to-string": Fr };
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 L = b2[g], H = [];
for (let A = 1; A < c.length; A++) {
const O = p.parse(c[A], A, Lr);
if (!O)
return null;
H.push(O);
}
return new e1(L, H);
}
evaluate(c) {
switch (this.type.kind) {
case "boolean":
return !!this.args[0].evaluate(c);
case "color": {
let p, g;
for (const L of this.args) {
if (p = L.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 L = Yn.parse(p);
if (L)
return L;
}
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 L = _n.parse(p);
if (L)
return L;
}
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 L = Number(p);
if (!isNaN(L))
return L;
}
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 = [], L, H = new Hi(), A = []) {
this.registry = c, this.path = g, this.key = g.map((O) => `[${O}]`).join(""), this.scope = H, this.errors = A, this.expectedType = L, this._isConstant = p;
}
parse(c, p, g, L, H = {}) {
return p ? this.concat(p, g, L)._parse(c, H) : this._parse(c, H);
}
_parse(c, p) {
function g(L, H, A) {
return A === "assert" ? new d1(H, [L]) : A === "coerce" ? new e1(H, [L]) : L;
}
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 L = c[0];
if (typeof L != "string")
return this.error(`Expression name must be a string, but found ${typeof L} instead. If you wanted a literal array, use ["literal", [...]].`, 0), null;
const H = this.registry[L];
if (H) {
let A = H.parse(c, this);
if (!A)
return null;
if (this.expectedType) {
const O = this.expectedType, N = A.type;
if (O.kind !== "string" && O.kind !== "number" && O.kind !== "boolean" && O.kind !== "object" && O.kind !== "array" || N.kind !== "value")
if (O.kind !== "color" && O.kind !== "formatted" && O.kind !== "resolvedImage" || N.kind !== "value" && N.kind !== "string")
if (O.kind !== "padding" || N.kind !== "value" && N.kind !== "number" && N.kind !== "array")
if (O.kind !== "variableAnchorOffsetCollection" || N.kind !== "value" && N.kind !== "array") {
if (this.checkSubtype(O, N))
return null;
} else
A = g(A, O, p.typeAnnotation || "coerce");
else
A = g(A, O, p.typeAnnotation || "coerce");
else
A = g(A, O, p.typeAnnotation || "coerce");
else
A = g(A, O, p.typeAnnotation || "assert");
}
if (!(A instanceof h1) && A.type.kind !== "resolvedImage" && this._isConstant(A)) {
const O = new ma();
try {
A = new h1(A.type, A.evaluate(O));
} catch (N) {
return this.error(N.message), null;
}
}
return A;
}
return this.error(`Unknown expression "${L}". 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 L = typeof c == "number" ? this.path.concat(c) : this.path, H = g ? this.scope.concat(g) : this.scope;
return new Xo(this.registry, this._isConstant, L, p || null, H, this.errors);
}
error(c, ...p) {
const g = `${this.key}${p.map((L) => `[${L}]`).join("")}`;
this.errors.push(new Xn(g, c));
}
checkSubtype(c, p) {
const g = gt(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 O = p.parse(c[H + 1], H + 1);
if (!O)
return null;
g.push([A, O]);
}
const L = p.parse(c[c.length - 1], c.length - 1, p.expectedType, g);
return L ? new ho(g, L) : 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 k {
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), L = p.parse(c[2], 2, it(p.expectedType || Lr));
return g && L ? new k(L.type.itemType, g, L) : 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, Lr), L = p.parse(c[2], 2, Lr);
return g && L ? At(g.type, [_r, Fr, xe, t1, Lr]) ? new G(g, L) : p.error(`Expected first argument to be of type boolean, string, number or null, but found ${ot(g.type)} instead`) : null;
}
evaluate(c) {
const p = this.needle.evaluate(c), g = this.haystack.evaluate(c);
if (!g)
return !1;
if (!It(p, ["boolean", "string", "number", "null"]))
throw new jn(`Expected first argument to be of type boolean, string, number or null, but found ${ot(Qn(p))} instead.`);
if (!It(g, ["string", "array"]))
throw new jn(`Expected second argument to be of type array or string, but found ${ot(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, Lr), L = p.parse(c[2], 2, Lr);
if (!g || !L)
return null;
if (!At(g.type, [_r, Fr, xe, t1, Lr]))
return p.error(`Expected first argument to be of type boolean, string, number or null, but found ${ot(g.type)} instead`);
if (c.length === 4) {
const H = p.parse(c[3], 3, xe);
return H ? new B(g, L, H) : null;
}
return new B(g, L);
}
evaluate(c) {
const p = this.needle.evaluate(c), g = this.haystack.evaluate(c);
if (!It(p, ["boolean", "string", "number", "null"]))
throw new jn(`Expected first argument to be of type boolean, string, number or null, but found ${ot(Qn(p))} instead.`);
let L;
if (this.fromIndex && (L = this.fromIndex.evaluate(c)), It(g, ["string"])) {
const H = g.indexOf(p, L);
return H === -1 ? -1 : [...g.slice(0, H)].length;
}
if (It(g, ["array"]))
return g.indexOf(p, L);
throw new jn(`Expected second argument to be of type array or string, but found ${ot(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, L, H, A) {
this.inputType = c, this.type = p, this.input = g, this.cases = L, 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, L;
p.expectedType && p.expectedType.kind !== "value" && (L = p.expectedType);
const H = {}, A = [];
for (let z = 2; z < c.length - 1; z += 2) {
let Z = c[z];
const X = c[z + 1];
Array.isArray(Z) || (Z = [Z]);
const et = p.concat(z);
if (Z.length === 0)
return et.error("Expected at least one branch label.");
for (const ut of Z) {
if (typeof ut != "number" && typeof ut != "string")
return et.error("Branch labels must be numbers or strings.");
if (typeof ut == "number" && Math.abs(ut) > Number.MAX_SAFE_INTEGER)
return et.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);
if (typeof ut == "number" && Math.floor(ut) !== ut)
return et.error("Numeric branch labels must be integer values.");
if (g) {
if (et.checkSubtype(g, Qn(ut)))
return null;
} else
g = Qn(ut);
if (H[String(ut)] !== void 0)
return et.error("Branch labels must be unique.");
H[String(ut)] = A.length;
}
const st = p.parse(X, z, L);
if (!st)
return null;
L = L || st.type, A.push(st);
}
const O = p.parse(c[1], 1, Lr);
if (!O)
return null;
const N = p.parse(c[c.length - 1], c.length - 1, L);
return N ? O.type.kind !== "value" && p.concat(1).checkSubtype(g, O.type) ? null : new q(g, L, O, 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 nt {
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 L = [];
for (let A = 1; A < c.length - 1; A += 2) {
const O = p.parse(c[A], A, _r);
if (!O)
return null;
const N = p.parse(c[A + 1], A + 1, g);
if (!N)
return null;
L.push([O, 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 nt(g, L, 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, L) {
this.type = c, this.input = p, this.beginIndex = g, this.endIndex = L;
}
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, Lr), L = p.parse(c[2], 2, xe);
if (!g || !L)
return null;
if (!At(g.type, [it(Lr), Fr, Lr]))
return p.error(`Expected first argument to be of type array or string, but found ${ot(g.type)} instead`);
if (c.length === 4) {
const H = p.parse(c[3], 3, xe);
return H ? new ht(g.type, g, L, H) : null;
}
return new ht(g.type, g, L);
}
evaluate(c) {
const p = this.input.evaluate(c), g = this.beginIndex.evaluate(c);
let L;
if (this.endIndex && (L = this.endIndex.evaluate(c)), It(p, ["string"]))
return [...p].slice(g, L).join("");
if (It(p, ["array"]))
return p.slice(g, L);
throw new jn(`Expected first argument to be of type array or string, but found ${ot(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, L, H = 0, A = p, O = 0;
for (; H <= A; )
if (O = Math.floor((H + A) / 2), g = h[O], L = h[O + 1], g <= c) {
if (O === p || c < L)
return O;
H = O + 1;
} else {
if (!(g > c))
throw new jn("Input is not a number.");
A = O - 1;
}
return 0;
}
class qt {
constructor(c, p, g) {
this.type = c, this.input = p, this.labels = [], this.outputs = [];
for (const [L, H] of g)
this.labels.push(L), 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 L = [];
let H = null;
p.expectedType && p.expectedType.kind !== "value" && (H = p.expectedType);
for (let A = 1; A < c.length; A += 2) {
const O = A === 1 ? -1 / 0 : c[A], N = c[A + 1], z = A, Z = A + 1;
if (typeof O != "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 (L.length && L[L.length - 1][0] >= O)
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, Z, H);
if (!X)
return null;
H = H || X.type, L.push([O, X]);
}
return new qt(H, g, L);
}
evaluate(c) {
const p = this.labels, g = this.outputs;
if (p.length === 1)
return g[0].evaluate(c);
const L = this.input.evaluate(c);
if (L <= p[0])
return g[0].evaluate(c);
const H = p.length;
return L >= p[H - 1] ? g[H - 1].evaluate(c) : g[mt(p, L)].evaluate(c);
}
eachChild(c) {
c(this.input);
for (const p of this.outputs)
c(p);
}
outputDefined() {
return this.outputs.every((c) => c.outputDefined());
}
}
function ae(h) {
return h && h.__esModule && Object.prototype.hasOwnProperty.call(h, "default") ? h.default : h;
}
var ve = Ee;
function Ee(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;
}
Ee.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 L = this.sampleCurveX(p) - h;
if (Math.abs(L) < c)
return p;
var H = this.sampleCurveDerivativeX(p);
if (Math.abs(H) < 1e-6)
break;
p -= L / H;
}
var A = 0, O = 1;
for (p = h, g = 0; g < 20 && (L = this.sampleCurveX(p), !(Math.abs(L - h) < c)); g++)
h > L ? A = p : O = p, p = 0.5 * (O - A) + A;
return p;
}, solve: function(h, c) {
return this.sampleCurveY(this.solveCurveX(h, c));
} };
var be = ae(ve);
function fr(h, c, p) {
return h + p * (c - h);
}
function Pn(h, c, p) {
return h.map((g, L) => fr(g, c[L], p));
}
const wr = { number: fr, color: function(h, c, p, g = "rgb") {
switch (g) {
case "rgb": {
const [L, H, A, O] = Pn(h.rgb, c.rgb, p);
return new tn(L, H, A, O, !1);
}
case "hcl": {
const [L, H, A, O] = h.hcl, [N, z, Z, X] = c.hcl;
let et, st;
if (isNaN(L) || isNaN(N))
isNaN(L) ? isNaN(N) ? et = NaN : (et = N, A !== 1 && A !== 0 || (st = z)) : (et = L, Z !== 1 && Z !== 0 || (st = H));
else {
let $t = N - L;
N > L && $t > 180 ? $t -= 360 : N < L && L - N > 180 && ($t += 360), et = L + p * $t;
}
const [ut, Tt, bt, Mt] = function([$t, kt, Bt, ee]) {
return $t = isNaN($t) ? 0 : $t * Rt, Nr([Bt, Math.cos($t) * kt, Math.sin($t) * kt, ee]);
}([et, st ?? fr(H, z, p), fr(A, Z, p), fr(O, X, p)]);
return new tn(ut, Tt, bt, Mt, !1);
}
case "lab": {
const [L, H, A, O] = Nr(Pn(h.lab, c.lab, p));
return new tn(L, H, A, O, !1);
}
}
}, array: Pn, padding: function(h, c, p) {
return new Yn(Pn(h.values, c.values, p));
}, variableAnchorOffsetCollection: function(h, c, p) {
const g = h.values, L = c.values;
if (g.length !== L.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] !== L[A])
throw new jn(`Cannot interpolate values containing mismatched anchors. from[${A}]: ${g[A]}, to[${A}]: ${L[A]}`);
H.push(g[A]);
const [O, N] = g[A + 1], [z, Z] = L[A + 1];
H.push([fr(O, z, p), fr(N, Z, p)]);
}
return new _n(H);
} };
class un {
constructor(c, p, g, L, H) {
this.type = c, this.operator = p, this.interpolation = g, this.input = L, this.labels = [], this.outputs = [];
for (const [A, O] of H)
this.labels.push(A), this.outputs.push(O);
}
static interpolationFactor(c, p, g, L) {
let H = 0;
if (c.name === "exponential")
H = pe(p, c.base, g, L);
else if (c.name === "linear")
H = pe(p, 1, g, L);
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, L));
}
return H;
}
static parse(c, p) {
let [g, L, H, ...A] = c;
if (!Array.isArray(L) || L.length === 0)
return p.error("Expected an interpolation type expression.", 1);
if (L[0] === "linear")
L = { name: "linear" };
else if (L[0] === "exponential") {
const z = L[1];
if (typeof z != "number")
return p.error("Exponential interpolation requires a numeric base.", 1, 1);
L = { name: "exponential", base: z };
} else {
if (L[0] !== "cubic-bezier")
return p.error(`Unknown interpolation type ${String(L[0])}`, 1, 0);
{
const z = L.slice(1);
if (z.length !== 4 || z.some((Z) => typeof Z != "number" || Z < 0 || Z > 1))
return p.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.", 1);
L = { 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 O = [];
let N = null;
g === "interpolate-hcl" || g === "interpolate-lab" ? N = In : p.expectedType && p.expectedType.kind !== "value" && (N = p.expectedType);
for (let z = 0; z < A.length; z += 2) {
const Z = A[z], X = A[z + 1], et = z + 3, st = z + 4;
if (typeof Z != "number")
return p.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.', et);
if (O.length && O[O.length - 1][0] >= Z)
return p.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.', et);
const ut = p.parse(X, st, N);
if (!ut)
return null;
N = N || ut.type, O.push([Z, ut]);
}
return jt(N, xe) || jt(N, In) || jt(N, Ii) || jt(N, wt) || jt(N, it(xe)) ? new un(N, g, L, H, O) : p.error(`Type ${ot(N)} is not interpolatable.`);
}
evaluate(c) {
const p = this.labels, g = this.outputs;
if (p.length === 1)
return g[0].evaluate(c);
const L = this.input.evaluate(c);
if (L <= p[0])
return g[0].evaluate(c);
const H = p.length;
if (L >= p[H - 1])
return g[H - 1].evaluate(c);
const A = mt(p, L), O = un.interpolationFactor(this.interpolation, L, p[A], p[A + 1]), N = g[A].evaluate(c), z = g[A + 1].evaluate(c);
switch (this.operator) {
case "interpolate":
return wr[this.type.kind](N, z, O);
case "interpolate-hcl":
return wr.color(N, z, O, "hcl");
case "interpolate-lab":
return wr.color(N, z, O, "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 L = g - p, H = h - p;
return L === 0 ? 0 : c === 1 ? H / L : (Math.pow(c, H) - 1) / (Math.pow(c, L) - 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 L = p.expectedType;
L && L.kind !== "value" && (g = L);
const H = [];
for (const O of c.slice(1)) {
const N = p.parse(O, 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 = L && H.some((O) => gt(L, O.type));
return new dr(A ? Lr : g, H);
}
evaluate(c) {
let p, g = null, L = 0;
for (const H of this.args)
if (L++, g = H.evaluate(c), g && g instanceof pn && !g.available && (p || (p = g.name), g = null, L === 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, O) {
this.type = _r, this.lhs = H, this.rhs = A, this.collator = O, 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 O = H[0];
let N = A.parse(H[1], 1, Lr);
if (!N)
return null;
if (!Tn(O, N.type))
return A.concat(1).error(`"${O}" comparisons are not supported for type '${ot(N.type)}'.`);
let z = A.parse(H[2], 2, Lr);
if (!z)
return null;
if (!Tn(O, z.type))
return A.concat(2).error(`"${O}" comparisons are not supported for type '${ot(z.type)}'.`);
if (N.type.kind !== z.type.kind && N.type.kind !== "value" && z.type.kind !== "value")
return A.error(`Cannot compare types '${ot(N.type)}' and '${ot(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 Z = 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 (Z = A.parse(H[3], 3, Vi), !Z)
return null;
}
return new XG(N, z, Z);
}
evaluate(H) {
const A = this.lhs.evaluate(H), O = this.rhs.evaluate(H);
if (g && this.hasUntypedArgument) {
const N = Qn(A), z = Qn(O);
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(O);
if (N.kind !== "string" || z.kind !== "string")
return c(H, A, O);
}
return this.collator ? p(H, A, O, this.collator.evaluate(H)) : c(H, A, O);
}
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 = Vi, 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 L = p.parse(g["case-sensitive"] !== void 0 && g["case-sensitive"], 1, _r);
if (!L)
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, Fr), !A) ? null : new ga(L, 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, L, H) {
this.type = Fr, this.number = c, this.locale = p, this.currency = g, this.minFractionDigits = L, 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 L = c[2];
if (typeof L != "object" || Array.isArray(L))
return p.error("NumberFormat options argument must be an object.");
let H = null;
if (L.locale && (H = p.parse(L.locale, 1, Fr), !H))
return null;
let A = null;
if (L.currency && (A = p.parse(L.currency, 1, Fr), !A))
return null;
let O = null;
if (L["min-fraction-digits"] && (O = p.parse(L["min-fraction-digits"], 1, xe), !O))
return null;
let N = null;
return L["max-fraction-digits"] && (N = p.parse(L["max-fraction-digits"], 1, xe), !N) ? null : new D4(g, H, A, O, 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 L = [];
let H = !1;
for (let A = 1; A <= c.length - 1; ++A) {
const O = c[A];
if (H && typeof O == "object" && !Array.isArray(O)) {
H = !1;
let N = null;
if (O["font-scale"] && (N = p.parse(O["font-scale"], 1, xe), !N))
return null;
let z = null;
if (O["text-font"] && (z = p.parse(O["text-font"], 1, it(Fr)), !z))
return null;
let Z = null;
if (O["text-color"] && (Z = p.parse(O["text-color"], 1, In), !Z))
return null;
const X = L[L.length - 1];
X.scale = N, X.font = z, X.textColor = Z;
} else {
const N = p.parse(c[A], 1, Lr);
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, L.push({ content: N, scale: null, font: null, textColor: null });
}
}
return new A3(L);
}
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 C3 {
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, Fr);
return g ? new C3(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 ${ot(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 ${ot(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, L = Math.pow(2, c.z);
return [Math.round(p * L * Ao), Math.round(g * L * Ao)];
}
function L0(h, c) {
const p = Math.pow(2, c.z);
return [(L = (h[0] / Ao + c.x) / p, 360 * L - 180), (g = (h[1] / Ao + c.y) / p, 360 / Math.PI * Math.atan(Math.exp((180 - 360 * g) * Math.PI / 180)) - 90)];
var g, L;
}
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], L = h[1] - c[1], H = h[0] - p[0], A = h[1] - p[1];
return g * A - H * L == 0 && g * H <= 0 && L * A <= 0;
}
function O3(h, c, p, g) {
return (L = [g[0] - p[0], g[1] - p[1]])[0] * (H = [c[0] - h[0], c[1] - h[1]])[1] - L[1] * H[0] != 0 && !(!Co(h, c, p, g) || !Co(p, g, h, c));
var L, H;
}
function bc(h, c, p) {
for (const g of p)
for (let L = 0; L < g.length - 1; ++L)
if (O3(h, c, g[L], g[L + 1]))
return !0;
return !1;
}
function ya(h, c, p = !1) {
let g = !1;
for (const O of c)
for (let N = 0; N < O.length - 1; N++) {
if (hn(h, O[N], O[N + 1]))
return p;
(H = O[N])[1] > (L = h)[1] != (A = O[N + 1])[1] > L[1] && L[0] < (A[0] - H[0]) * (L[1] - H[1]) / (A[1] - H[1]) + H[0] && (g = !g);
}
var L, 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 Co(h, c, p, g) {
const L = g[0] - p[0], H = g[1] - p[1], A = (h[0] - p[0]) * H - L * (h[1] - p[1]), O = (c[0] - p[0]) * H - L * (c[1] - p[1]);
return A > 0 && O < 0 || A < 0 && O > 0;
}
function z4(h, c, p) {
const g = [];
for (let L = 0; L < h.length; L++) {
const H = [];
for (let A = 0; A < h[L].length; A++) {
const O = _c(h[L][A], p);
Bs(c, O), H.push(O);
}
g.push(H);
}
return g;
}
function w0(h, c, p) {
const g = [];
for (let L = 0; L < h.length; L++) {
const H = z4(h[L], c, p);
g.push(H);
}
return g;
}
function wl(h, c, p, g) {
if (h[0] < p[0] || h[0] > p[2]) {
const L = 0.5 * g;
let H = h[0] - p[0] > L ? -g : p[0] - h[0] > L ? g : 0;
H === 0 && (H = h[0] - p[2] > L ? -g : p[2] - h[0] > L ? g : 0), h[0] += H;
}
Bs(c, h);
}
function x0(h, c, p, g) {
const L = Math.pow(2, g.z) * Ao, H = [g.x * Ao, g.y * Ao], A = [];
for (const O of h)
for (const N of O) {
const z = [N.x + H[0], N.y + H[1]];
wl(z, c, p, L), A.push(z);
}
return A;
}
function P3(h, c, p, g) {
const L = Math.pow(2, g.z) * Ao, H = [g.x * Ao, g.y * Ao], A = [];
for (const N of h) {
const z = [];
for (const Z of N) {
const X = [Z.x + H[0], Z.y + H[1]];
Bs(c, X), z.push(X);
}
A.push(z);
}
if (c[2] - c[0] <= L / 2) {
(O = c)[0] = O[1] = 1 / 0, O[2] = O[3] = -1 / 0;
for (const N of A)
for (const z of N)
wl(z, c, p, L);
}
var O;
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 L = [];
for (const H of g.features) {
const { type: A, coordinates: O } = H.geometry;
A === "Polygon" && L.push(O), A === "MultiPolygon" && L.push(...O);
}
if (L.length)
return new os(g, { type: "MultiPolygon", coordinates: L });
} else if (g.type === "Feature") {
const L = g.geometry.type;
if (L === "Polygon" || L === "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 L = [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 O = z4(g.coordinates, H, A), N = x0(p.geometry(), L, H, A);
if (!L2(L, H))
return !1;
for (const z of N)
if (!ya(z, O))
return !1;
}
if (g.type === "MultiPolygon") {
const O = w0(g.coordinates, H, A), N = x0(p.geometry(), L, H, A);
if (!L2(L, H))
return !1;
for (const z of N)
if (!B4(z, O))
return !1;
}
return !0;
}(c, this.geometries);
if (c.geometryType() === "LineString")
return function(p, g) {
const L = [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 O = z4(g.coordinates, H, A), N = P3(p.geometry(), L, H, A);
if (!L2(L, H))
return !1;
for (const z of N)
if (!j4(z, O))
return !1;
}
if (g.type === "MultiPolygon") {
const O = w0(g.coordinates, H, A), N = P3(p.geometry(), L, H, A);
if (!L2(L, H))
return !1;
for (const z of N)
if (!Ll(z, O))
return !1;
}
return !0;
}(c, this.geometries);
}
return !1;
}
eachChild() {
}
outputDefined() {
return !0;
}
}
let M0 = 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 L = h - 1 >> 1, H = c[L];
if (p(g, H) >= 0)
break;
c[h] = H, h = L;
}
c[h] = g;
}
_down(h) {
const { data: c, compare: p } = this, g = this.length >> 1, L = 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], L) >= 0)
break;
c[h] = c[H], h = H;
}
c[h] = L;
}
};
function Lc(h, c, p, g, L) {
ss(h, c, p, g || h.length - 1, L || wc);
}
function ss(h, c, p, g, L) {
for (; g > p; ) {
if (g - p > 600) {
var H = g - p + 1, A = c - p + 1, O = Math.log(H), N = 0.5 * Math.exp(2 * O / 3), z = 0.5 * Math.sqrt(O * 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)), L);
}
var Z = h[c], X = p, et = g;
for (va(h, p, c), L(h[g], Z) > 0 && va(h, p, g); X < et; ) {
for (va(h, X, et), X++, et--; L(h[X], Z) < 0; )
X++;
for (; L(h[et], Z) > 0; )
et--;
}
L(h[p], Z) === 0 ? va(h, p, et) : va(h, ++et, g), et <= c && (p = et + 1), c <= et && (g = et - 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, L;
for (const H of h) {
const A = k3(H);
A !== 0 && (H.area = Math.abs(A), L === void 0 && (L = A < 0), L === 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, E0), p[H] = p[H].slice(0, c));
return p;
}
function E0(h, c) {
return c.area - h.area;
}
function k3(h) {
let c = 0;
for (let p, g, L = 0, H = h.length, A = H - 1; L < H; A = L++)
p = h[L], g = h[A], c += (g.x - p.x) * (p.y + g.y);
return c;
}
const G4 = 1 / 298.257223563, $4 = G4 * (2 - G4), Z4 = Math.PI / 180;
class js {
constructor(c) {
const p = 6378.137 * Z4 * 1e3, g = Math.cos(c * Z4), L = 1 / (1 - $4 * (1 - g * g)), H = Math.sqrt(L);
this.kx = p * H * g, this.ky = p * H * L * (1 - $4);
}
distance(c, p) {
const g = this.wrap(c[0] - p[0]) * this.kx, L = (c[1] - p[1]) * this.ky;
return Math.sqrt(g * g + L * L);
}
pointOnLine(c, p) {
let g, L, H, A, O = 1 / 0;
for (let N = 0; N < c.length - 1; N++) {
let z = c[N][0], Z = c[N][1], X = this.wrap(c[N + 1][0] - z) * this.kx, et = (c[N + 1][1] - Z) * this.ky, st = 0;
X === 0 && et === 0 || (st = (this.wrap(p[0] - z) * this.kx * X + (p[1] - Z) * this.ky * et) / (X * X + et * et), st > 1 ? (z = c[N + 1][0], Z = c[N + 1][1]) : st > 0 && (z += X / this.kx * st, Z += et / this.ky * st)), X = this.wrap(p[0] - z) * this.kx, et = (p[1] - Z) * this.ky;
const ut = X * X + et * et;
ut < O && (O = ut, g = z, L = Z, H = N, A = st);
}
return { point: [g, L], 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 W4(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 = W4(h);
if (c) {
if (p === 2)
return [h, null];
const L = Math.floor(p / 2);
return [[h[0], h[0] + L], [h[0] + L, 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, L = 0;
return h[2] < c[0] && (g = c[0] - h[2]), h[0] > c[2] && (g = h[0] - c[2]), h[1] > c[3] && (L = h[1] - c[3]), h[3] < c[1] && (L = c[1] - h[3]), p.distance([0, 0], [g, L]);
}
function v1(h, c, p) {
const g = p.pointOnLine(c, h);
return p.distance(h, g.point);
}
function M2(h, c, p, g, L) {
const H = Math.min(v1(h, [p, g], L), v1(c, [p, g], L)), A = Math.min(v1(p, [h, c], L), v1(g, [h, c], L));
return Math.min(H, A);
}
function X4(h, c, p, g, L) {
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 O = h[A], N = h[A + 1];
for (let z = g[0]; z < g[1]; ++z) {
const Z = p[z], X = p[z + 1];
if (O3(O, N, Z, X))
return 0;
H = Math.min(H, M2(O, N, Z, X, L));
}
}
return H;
}
function En(h, c, p, g, L) {
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 O = g[0]; O <= g[1]; ++O)
if (H = Math.min(H, L.distance(h[A], p[O])), H === 0)
return H;
return H;
}
function xc(h, c, p) {
if (ya(h, c, !0))
return 0;
let g = 1 / 0;
for (const L of c) {
const H = L[0], A = L[L.length - 1];
if (H !== A && (g = Math.min(g, v1(h, [A, H], p)), g === 0))
return g;
const O = p.pointOnLine(L, h);
if (g = Math.min(g, p.distance(h, O.point)), g === 0)
return g;
}
return g;
}
function Gr(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 L = 1 / 0;
for (let H = c[0]; H < c[1]; ++H) {
const A = h[H], O = h[H + 1];
for (const N of p)
for (let z = 0, Z = N.length, X = Z - 1; z < Z; X = z++) {
const et = N[X], st = N[z];
if (O3(A, O, et, st))
return 0;
L = Math.min(L, M2(A, O, et, st, g));
}
}
return L;
}
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 L = q4(h), H = q4(c);
if (g !== 1 / 0 && x2(L, H, p) >= g)
return g;
if (L2(L, H)) {
if (as(h, c))
return 0;
} else if (as(c, h))
return 0;
let A = 1 / 0;
for (const O of h)
for (let N = 0, z = O.length, Z = z - 1; N < z; Z = N++) {
const X = O[Z], et = O[N];
for (const st of c)
for (let ut = 0, Tt = st.length, bt = Tt - 1; ut < Tt; bt = ut++) {
const Mt = st[bt], $t = st[ut];
if (O3(X, et, Mt, $t))
return 0;
A = Math.min(A, M2(X, et, Mt, $t, p));
}
}
return A;
}
function bn(h, c, p, g, L, H) {
if (!H)
return;
const A = x2(H0(g, H), L, p);
A < c && h.push([A, H, [0, 0]]);
}
function zs(h, c, p, g, L, H, A) {
if (!H || !A)
return;
const O = x2(H0(g, H), H0(L, A), p);
O < c && h.push([O, H, A]);
}
function V3(h, c, p, g, L = 1 / 0) {
let H = Math.min(g.distance(h[0], p[0][0]), L);
if (H === 0)
return H;
const A = new M0([[0, [0, h.length - 1], [0, 0]]], xl), O = q4(p);
for (; A.length > 0; ) {
const N = A.pop();
if (N[0] >= H)
continue;
const z = N[1], Z = c ? 50 : 100;
if (W4(z) <= Z) {
if (!w2(z, h.length))
return NaN;
if (c) {
const X = Gr(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 et = xc(h[X], p, g);
if (H = Math.min(H, et), H === 0)
return 0;
}
} else {
const X = S0(z, c);
bn(A, H, g, h, O, X[0]), bn(A, H, g, h, O, X[1]);
}
}
return H;
}
function ba(h, c, p, g, L, H = 1 / 0) {
let A = Math.min(H, L.distance(h[0], p[0]));
if (A === 0)
return A;
const O = new M0([[0, [0, h.length - 1], [0, p.length - 1]]], xl);
for (; O.length > 0; ) {
const N = O.pop();
if (N[0] >= A)
continue;
const z = N[1], Z = N[2], X = c ? 50 : 100, et = g ? 50 : 100;
if (W4(z) <= X && W4(Z) <= et) {
if (!w2(z, h.length) && w2(Z, p.length))
return NaN;
let st;
if (c && g)
st = X4(h, z, p, Z, L), A = Math.min(A, st);
else if (c && !g) {
const ut = h.slice(z[0], z[1] + 1);
for (let Tt = Z[0]; Tt <= Z[1]; ++Tt)
if (st = v1(p[Tt], ut, L), A = Math.min(A, st), A === 0)
return A;
} else if (!c && g) {
const ut = p.slice(Z[0], Z[1] + 1);
for (let Tt = z[0]; Tt <= z[1]; ++Tt)
if (st = v1(h[Tt], ut, L), A = Math.min(A, st), A === 0)
return A;
} else
st = En(h, z, p, Z, L), A = Math.min(A, st);
} else {
const st = S0(z, c), ut = S0(Z, g);
zs(O, A, L, h, p, st[0], ut[0]), zs(O, A, L, h, p, st[0], ut[1]), zs(O, A, L, h, p, st[1], ut[0]), zs(O, A, L, h, p, st[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((L) => K4(L.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 L = p.geometry(), H = L.flat().map((N) => L0([N.x, N.y], p.canonical));
if (L.length === 0)
return NaN;
const A = new js(H[0][1]);
let O = 1 / 0;
for (const N of g) {
switch (N.type) {
case "Point":
O = Math.min(O, ba(H, !1, [N.coordinates], !1, A, O));
break;
case "LineString":
O = Math.min(O, ba(H, !1, N.coordinates, !0, A, O));
break;
case "Polygon":
O = Math.min(O, V3(H, !1, N.coordinates, A, O));
}
if (O === 0)
return O;
}
return O;
}(c, this.geometries);
if (c.geometryType() === "LineString")
return function(p, g) {
const L = p.geometry(), H = L.flat().map((N) => L0([N.x, N.y], p.canonical));
if (L.length === 0)
return NaN;
const A = new js(H[0][1]);
let O = 1 / 0;
for (const N of g) {
switch (N.type) {
case "Point":
O = Math.min(O, ba(H, !0, [N.coordinates], !1, A, O));
break;
case "LineString":
O = Math.min(O, ba(H, !0, N.coordinates, !0, A, O));
break;
case "Polygon":
O = Math.min(O, V3(H, !0, N.coordinates, A, O));
}
if (O === 0)
return O;
}
return O;
}(c, this.geometries);
if (c.geometryType() === "Polygon")
return function(p, g) {
const L = p.geometry();
if (L.length === 0 || L[0].length === 0)
return NaN;
const H = U4(L, 0).map((N) => N.map((z) => z.map((Z) => L0([Z.x, Z.y], p.canonical)))), A = new js(H[0][0][0][1]);
let O = 1 / 0;
for (const N of g)
for (const z of H) {
switch (N.type) {
case "Point":
O = Math.min(O, V3([N.coordinates], !1, z, A, O));
break;
case "LineString":
O = Math.min(O, V3(N.coordinates, !0, z, A, O));
break;
case "Polygon":
O = Math.min(O, An(z, N.coordinates, A, O));
}
if (O === 0)
return O;
}
return O;
}(c, this.geometries);
}
return NaN;
}
eachChild() {
}
outputDefined() {
return !0;
}
}
const Oo = { "==": b0, "!=": _l, ">": bl, "<": Nn, ">=": Ko, "<=": vc, array: d1, at: k, boolean: d1, case: nt, coalesce: dr, collator: ga, format: A3, image: C3, 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, L) {
this.name = c, this.type = p, this._evaluate = g, this.args = L;
}
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], L = po.definitions[g];
if (!L)
return p.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`, 0);
const H = Array.isArray(L) ? L[0] : L.type, A = Array.isArray(L) ? [[L[1], L[2]]] : L.overloads, O = A.filter(([z]) => !Array.isArray(z) || z.length === c.length - 1);
let N = null;
for (const [z, Z] of O) {
N = new Xo(p.registry, I3, p.path, null, p.scope);
const X = [];
let et = !1;
for (let st = 1; st < c.length; st++) {
const ut = c[st], Tt = Array.isArray(z) ? z[st - 1] : z.type, bt = N.parse(ut, 1 + X.length, Tt);
if (!bt) {
et = !0;
break;
}
X.push(bt);
}
if (!et)
if (Array.isArray(z) && z.length !== X.length)
N.error(`Expected ${z.length} arguments, but found ${X.length} instead.`);
else {
for (let st = 0; st < X.length; st++) {
const ut = Array.isArray(z) ? z[st] : z.type, Tt = X[st];
N.concat(st + 1).checkSubtype(ut, Tt.type);
}
if (N.errors.length === 0)
return new po(g, H, Z, X);
}
}
if (O.length === 1)
p.errors.push(...N.errors);
else {
const z = (O.length ? O : A).map(([X]) => {
return et = X, Array.isArray(et) ? `(${et.map(ot).join(", ")})` : `(${ot(et.type)}...)`;
var et;
}).join(" | "), Z = [];
for (let X = 1; X < c.length; X++) {
const et = p.parse(c[X], 1 + Z.length);
if (!et)
return null;
Z.push(ot(et.type));
}
p.error(`Expected arguments of type ${z}, but found (${Z.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, L]) {
c = c.evaluate(h), p = p.evaluate(h), g = g.evaluate(h);
const H = L ? L.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 E2(h, c) {
const p = c[h];
return p === void 0 ? null : p;
}
function ls(h) {
return { type: h };
}
function I3(h) {
if (h instanceof Yr)
return I3(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 && I3(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 C0(h) {
return !!h.expression && h.expression.parameters.indexOf("zoom") > -1;
}
function O0(h) {
return !!h.expression && h.expression.interpolated;
}
function Pt(h) {
return h instanceof Number ? "number" : h instanceof String ? "string" : h instanceof Boolean ? "boolean" : Array.isArray(h) ? "array" : h === null ? "null" : typeof h;
}
function re(h) {
return typeof h == "object" && h !== null && !Array.isArray(h);
}
function Fe(h) {
return h;
}
function br(h, c) {
const p = c.type === "color", g = h.stops && typeof h.stops[0][0] == "object", L = g || !(g || h.property !== void 0), H = h.type || (O0(c) ? "exponential" : "interval");
if (p || c.type === "padding") {
const Z = p ? tn.parse : Yn.parse;
(h = bi({}, h)).stops && (h.stops = h.stops.map((X) => [X[0], Z(X[1])])), h.default = Z(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 O, N, z;
if (H === "exponential")
O = wi;
else if (H === "interval")
O = Jn;
else if (H === "categorical") {
O = rn, N = /* @__PURE__ */ Object.create(null);
for (const Z of h.stops)
N[Z[0]] = Z[1];
z = typeof h.stops[0][0];
} else {
if (H !== "identity")
throw new Error(`Unknown function type "${H}"`);
O = To;
}
if (g) {
const Z = {}, X = [];
for (let ut = 0; ut < h.stops.length; ut++) {
const Tt = h.stops[ut], bt = Tt[0].zoom;
Z[bt] === void 0 && (Z[bt] = { zoom: bt, type: h.type, property: h.property, default: h.default, stops: [] }, X.push(bt)), Z[bt].stops.push([Tt[0].value, Tt[1]]);
}
const et = [];
for (const ut of X)
et.push([Z[ut].zoom, br(Z[ut], c)]);
const st = { name: "linear" };
return { kind: "composite", interpolationType: st, interpolationFactor: un.interpolationFactor.bind(void 0, st), zoomStops: et.map((ut) => ut[0]), evaluate: ({ zoom: ut }, Tt) => wi({ stops: et, base: h.base }, c, ut).evaluate(ut, Tt) };
}
if (L) {
const Z = H === "exponential" ? { name: "exponential", base: h.base !== void 0 ? h.base : 1 } : null;
return { kind: "camera", interpolationType: Z, interpolationFactor: un.interpolationFactor.bind(void 0, Z), zoomStops: h.stops.map((X) => X[0]), evaluate: ({ zoom: X }) => O(h, c, X, N, z) };
}
return { kind: "source", evaluate(Z, X) {
const et = X && X.properties ? X.properties[h.property] : void 0;
return et === void 0 ? Ln(h.default, c.default) : O(h, c, et, 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, L) {
return Ln(typeof p === L ? g[p] : void 0, h.default, c.default);
}
function Jn(h, c, p) {
if (Pt(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 L = mt(h.stops.map((H) => H[0]), p);
return h.stops[L][1];
}
function wi(h, c, p) {
const g = h.base !== void 0 ? h.base : 1;
if (Pt(p) !== "number")
return Ln(h.default, c.default);
const L = h.stops.length;
if (L === 1 || p <= h.stops[0][0])
return h.stops[0][1];
if (p >= h.stops[L - 1][0])
return h.stops[L - 1][1];
const H = mt(h.stops.map((Z) => Z[0]), p), A = function(Z, X, et, st) {
const ut = st - et, Tt = Z - et;
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]), O = h.stops[H][1], N = h.stops[H + 1][1], z = wr[c.type] || Fe;
return typeof O.evaluate == "function" ? { evaluate(...Z) {
const X = O.evaluate.apply(void 0, Z), et = N.evaluate.apply(void 0, Z);
if (X !== void 0 && et !== void 0)
return z(X, et, A, h.colorSpace);
} } : z(O, 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:
Pt(p) === c.type || c.type === "enum" && c.values[p] || (p = void 0);
}
return Ln(p, h.default, c.default);
}
po.register(Oo, { error: [{ kind: "error" }, [Fr], (h, [c]) => {
throw new jn(c.evaluate(h));
}], typeof: [Fr, [Lr], (h, [c]) => ot(Qn(c.evaluate(h)))], "to-rgba": [it(xe, 4), [In], (h, [c]) => {
const [p, g, L, H] = c.evaluate(h).rgb;
return [255 * p, 255 * g, 255 * L, H];
}], rgb: [In, [xe, xe, xe], Jo], rgba: [In, [xe, xe, xe, xe], Jo], has: { type: _r, overloads: [[[Fr], (h, [c]) => A0(c.evaluate(h), h.properties())], [[Fr, y1], (h, [c, p]) => A0(c.evaluate(h), p.evaluate(h))]] }, get: { type: Lr, overloads: [[[Fr], (h, [c]) => E2(c.evaluate(h), h.properties())], [[Fr, y1], (h, [c, p]) => E2(c.evaluate(h), p.evaluate(h))]] }, "feature-state": [Lr, [Fr], (h, [c]) => E2(c.evaluate(h), h.featureState || {})], properties: [y1, [], (h) => h.properties()], "geometry-type": [Fr, [], (h) => h.geometryType()], id: [Lr, [], (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: [Lr, [], (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, [Fr, Lr], (h, [c, p]) => h.properties()[c.value] === p.value], "filter-id-==": [_r, [Lr], (h, [c]) => h.id() === c.value], "filter-type-==": [_r, [Fr], (h, [c]) => h.geometryType() === c.value], "filter-<": [_r, [Fr, Lr], (h, [c, p]) => {
const g = h.properties()[c.value], L = p.value;
return typeof g == typeof L && g < L;
}], "filter-id-<": [_r, [Lr], (h, [c]) => {
const p = h.id(), g = c.value;
return typeof p == typeof g && p < g;
}], "filter->": [_r, [Fr, Lr], (h, [c, p]) => {
const g = h.properties()[c.value], L = p.value;
return typeof g == typeof L && g > L;
}], "filter-id->": [_r, [Lr], (h, [c]) => {
const p = h.id(), g = c.value;
return typeof p == typeof g && p > g;
}], "filter-<=": [_r, [Fr, Lr], (h, [c, p]) => {
const g = h.properties()[c.value], L = p.value;
return typeof g == typeof L && g <= L;
}], "filter-id-<=": [_r, [Lr], (h, [c]) => {
const p = h.id(), g = c.value;
return typeof p == typeof g && p <= g;
}], "filter->=": [_r, [Fr, Lr], (h, [c, p]) => {
const g = h.properties()[c.value], L = p.value;
return typeof g == typeof L && g >= L;
}], "filter-id->=": [_r, [Lr], (h, [c]) => {
const p = h.id(), g = c.value;
return typeof p == typeof g && p >= g;
}], "filter-has": [_r, [Lr], (h, [c]) => c.value in h.properties()], "filter-has-id": [_r, [], (h) => h.id() !== null && h.id() !== void 0], "filter-type-in": [_r, [it(Fr)], (h, [c]) => c.value.indexOf(h.geometryType()) >= 0], "filter-id-in": [_r, [it(Lr)], (h, [c]) => c.value.indexOf(h.id()) >= 0], "filter-in-small": [_r, [Fr, it(Lr)], (h, [c, p]) => p.value.indexOf(h.properties()[c.value]) >= 0], "filter-in-large": [_r, [Fr, it(Lr)], (h, [c, p]) => function(g, L, H, A) {
for (; H <= A; ) {
const O = H + A >> 1;
if (L[O] === g)
return !0;
L[O] > g ? A = O - 1 : H = O + 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, [Fr], (h, [c]) => {
const p = h.globals && h.globals.isSupportedScript;
return !p || p(c.evaluate(h));
}], upcase: [Fr, [Fr], (h, [c]) => c.evaluate(h).toUpperCase()], downcase: [Fr, [Fr], (h, [c]) => c.evaluate(h).toLowerCase()], concat: [Fr, ls(Lr), (h, c) => c.map((p) => Ui(p.evaluate(h))).join("")], "resolved-locale": [Fr, [Vi], (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" && re(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, L, H, A) {
return this._evaluator.globals = c, this._evaluator.feature = p, this._evaluator.featureState = g, this._evaluator.canonical = L, this._evaluator.availableImages = H || null, this._evaluator.formattedSection = A, this.expression.evaluate(this._evaluator);
}
evaluate(c, p, g, L, H, A) {
this._evaluator.globals = c, this._evaluator.feature = p || null, this._evaluator.featureState = g || null, this._evaluator.canonical = L, this._evaluator.availableImages = H || null, this._evaluator.formattedSection = A || null;
try {
const O = this.expression.evaluate(this._evaluator);
if (O == null || typeof O == "number" && O != O)
return this._defaultValue;
if (this._enumValues && !(O 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(O)} instead.`);
return O;
} catch (O) {
return this._warningHistory[O.message] || (this._warningHistory[O.message] = !0, typeof console < "u" && console.warn(O.message)), this._defaultValue;
}
}
}
function yi(h) {
return Array.isArray(h) && h.length > 0 && typeof h[0] == "string" && h[0] in Oo;
}
function _1(h, c) {
const p = new Xo(Oo, I3, [], c ? function(L) {
const H = { color: In, string: Fr, number: xe, enum: Fr, boolean: _r, formatted: H1, padding: Ii, resolvedImage: Rn, variableAnchorOffsetCollection: wt };
return L.type === "array" ? it(H[L.value] || Lr, L.length) : H[L.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, L, H, A) {
return this._styleExpression.evaluateWithoutErrorHandling(c, p, g, L, H, A);
}
evaluate(c, p, g, L, H, A) {
return this._styleExpression.evaluate(c, p, g, L, H, A);
}
}
class Ai {
constructor(c, p, g, L) {
this.kind = c, this.zoomStops = g, this._styleExpression = p, this.isStateDependent = c !== "camera" && !us(p.expression), this.interpolationType = L;
}
evaluateWithoutErrorHandling(c, p, g, L, H, A) {
return this._styleExpression.evaluateWithoutErrorHandling(c, p, g, L, H, A);
}
evaluate(c, p, g, L, H, A) {
return this._styleExpression.evaluate(c, p, g, L, H, A);
}
interpolationFactor(c, p, g) {
return this.interpolationType ? un.interpolationFactor(this.interpolationType, c, p, g) : 0;
}
}
function Po(h, c) {
const p = _1(h, c);
if (p.result === "error")
return p;
const g = p.value.expression, L = cs(g);
if (!L && !t2(c))
return Us([new Xn("", "data expressions not supported")]);
const H = La(g, ["zoom"]);
if (!H && !C0(c))
return Us([new Xn("", "zoom expressions not supported")]);
const A = hs(g);
return A || H ? A instanceof Xn ? Us([A]) : A instanceof un && !O0(c) ? Us([new Xn("", '"interpolate" expressions cannot be used with this property')]) : R3(A ? new Ai(L ? "camera" : "composite", p.value, A.labels, A instanceof un ? A.interpolation : void 0) : new A1(L ? "constant" : "source", p.value)) : Us([new Xn("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
}
class ko {
constructor(c, p) {
this._parameters = c, this._specification = p, bi(this, br(this._parameters, this._specification));
}
static deserialize(c) {
return new ko(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, L) => c.value.evaluate(p, g, {}, L), needGeometry: Ml(h) };
}
function Mc(h, c) {
return h < c ? -1 : h > c ? 1 : 0;
}
function Ml(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 (Ml(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(Mc)]] : ["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 L = "[";
for (const H of h)
L += `${$i(H)},`;
return `${L}]`;
}
const p = Object.keys(h).sort();
let g = "{";
for (let L = 0; L < p.length; L++)
g += `${JSON.stringify(p[L])}:${$i(h[p[L]])},`;
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 C1(h) {
if (Array.isArray(h))
return h.map(C1);
if (h instanceof Object && !(h instanceof Number || h instanceof String || h instanceof Boolean)) {
const c = {};
for (const p in h)
c[p] = C1(h[p]);
return c;
}
return Dn(h);
}
function Zi(h) {
const c = h.key, p = h.value, g = h.valueSpec || {}, L = h.objectElementValidators || {}, H = h.style, A = h.styleSpec, O = h.validateSpec;
let N = [];
const z = Pt(p);
if (z !== "object")
return [new ye(c, p, `object expected, ${z} found`)];
for (const Z in p) {
const X = Z.split(".")[0], et = g[X] || g["*"];
let st;
if (L[X])
st = L[X];
else if (g[X])
st = O;
else if (L["*"])
st = L["*"];
else {
if (!g["*"]) {
N.push(new ye(c, p[Z], `unknown property "${Z}"`));
continue;
}
st = O;
}
N = N.concat(st({ key: (c && `${c}.`) + Z, value: p[Z], valueSpec: et, style: H, styleSpec: A, object: p, objectKey: Z, validateSpec: O }, p));
}
for (const Z in g)
L[Z] || g[Z].required && g[Z].default === void 0 && p[Z] === void 0 && N.push(new ye(c, p, `missing required property "${Z}"`));
return N;
}
function Vo(h) {
const c = h.value, p = h.valueSpec, g = h.style, L = h.styleSpec, H = h.key, A = h.arrayElementValidator || h.validateSpec;
if (Pt(c) !== "array")
return [new ye(H, c, `array expected, ${Pt(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 O = { type: p.value, values: p.values };
L.$version < 7 && (O.function = p.function), Pt(p.value) === "object" && (O = p.value);
let N = [];
for (let z = 0; z < c.length; z++)
N = N.concat(A({ array: c, arrayIndex: z, value: c[z], valueSpec: O, validateSpec: h.validateSpec, style: g, styleSpec: L, key: `${H}[${z}]` }));
return N;
}
function J4(h) {
const c = h.key, p = h.value, g = h.valueSpec;
let L = Pt(p);
return L === "number" && p != p && (L = "NaN"), L !== "number" ? [new ye(c, p, `number expected, ${L} 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, L, H, A = {};
const O = p !== "categorical" && h.value.property === void 0, N = !O, z = Pt(h.value.stops) === "array" && Pt(h.value.stops[0]) === "array" && Pt(h.value.stops[0][0]) === "object", Z = Zi({ key: h.key, value: h.value, valueSpec: h.styleSpec.function, validateSpec: h.validateSpec, style: h.style, styleSpec: h.styleSpec, objectElementValidators: { stops: function(st) {
if (p === "identity")
return [new ye(st.key, st.value, 'identity function may not have a "stops" property')];
let ut = [];
const Tt = st.value;
return ut = ut.concat(Vo({ key: st.key, value: Tt, valueSpec: st.valueSpec, validateSpec: st.validateSpec, style: st.style, styleSpec: st.styleSpec, arrayElementValidator: X })), Pt(Tt) === "array" && Tt.length === 0 && ut.push(new ye(st.key, Tt, "array must have at least one stop")), ut;
}, default: function(st) {
return st.validateSpec({ key: st.key, value: st.value, valueSpec: c, validateSpec: st.validateSpec, style: st.style, styleSpec: st.styleSpec });
} } });
return p === "identity" && O && Z.push(new ye(h.key, h.value, 'missing required property "property"')), p === "identity" || h.value.stops || Z.push(new ye(h.key, h.value, 'missing required property "stops"')), p === "exponential" && h.valueSpec.expression && !O0(h.valueSpec) && Z.push(new ye(h.key, h.value, "exponential functions not supported")), h.styleSpec.$version >= 8 && (N && !t2(h.valueSpec) ? Z.push(new ye(h.key, h.value, "property functions not supported")) : O && !C0(h.valueSpec) && Z.push(new ye(h.key, h.value, "zoom functions not supported"))), p !== "categorical" && !z || h.value.property !== void 0 || Z.push(new ye(h.key, h.value, '"property" property is required')), Z;
function X(st) {
let ut = [];
const Tt = st.value, bt = st.key;
if (Pt(Tt) !== "array")
return [new ye(bt, Tt, `array expected, ${Pt(Tt)} found`)];
if (Tt.length !== 2)
return [new ye(bt, Tt, `array length 2 expected, length ${Tt.length} found`)];
if (z) {
if (Pt(Tt[0]) !== "object")
return [new ye(bt, Tt, `object expected, ${Pt(Tt[0])} found`)];
if (Tt[0].zoom === void 0)
return [new ye(bt, Tt, "object stop key must have zoom")];
if (Tt[0].value === void 0)
return [new ye(bt, Tt, "object stop key must have value")];
if (H && H > Dn(Tt[0].zoom))
return [new ye(bt, Tt[0].zoom, "stop zoom values must appear in ascending order")];
Dn(Tt[0].zoom) !== H && (H = Dn(Tt[0].zoom), L = void 0, A = {}), ut = ut.concat(Zi({ key: `${bt}[0]`, value: Tt[0], valueSpec: { zoom: {} }, validateSpec: st.validateSpec, style: st.style, styleSpec: st.styleSpec, objectElementValidators: { zoom: J4, value: et } }));
} else
ut = ut.concat(et({ key: `${bt}[0]`, value: Tt[0], valueSpec: {}, validateSpec: st.validateSpec, style: st.style, styleSpec: st.styleSpec }, Tt));
return yi(C1(Tt[1])) ? ut.concat([new ye(`${bt}[1]`, Tt[1], "expressions are not allowed in function stops.")]) : ut.concat(st.validateSpec({ key: `${bt}[1]`, value: Tt[1], valueSpec: c, validateSpec: st.validateSpec, style: st.style, styleSpec: st.styleSpec }));
}
function et(st, ut) {
const Tt = Pt(st.value), bt = Dn(st.value), Mt = st.value !== null ? st.value : ut;
if (g) {
if (Tt !== g)
return [new ye(st.key, Mt, `${Tt} stop domain type must match previous stop domain type ${g}`)];
} else
g = Tt;
if (Tt !== "number" && Tt !== "string" && Tt !== "boolean")
return [new ye(st.key, Mt, "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(st.key, Mt, $t)];
}
return p !== "categorical" || Tt !== "number" || isFinite(bt) && Math.floor(bt) === bt ? p !== "categorical" && Tt === "number" && L !== void 0 && bt < L ? [new ye(st.key, Mt, "stop domain values must appear in ascending order")] : (L = bt, p === "categorical" && bt in A ? [new ye(st.key, Mt, "stop domain values must be unique")] : (A[bt] = !0, [])) : [new ye(st.key, Mt, `integer expected, found ${bt}`)];
}
}
function Ts(h) {
const c = (h.expressionContext === "property" ? Po : _1)(C1(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, L = [];
return Array.isArray(g.values) ? g.values.indexOf(Dn(p)) === -1 && L.push(new ye(c, p, `expected one of [${g.values.join(", ")}], ${JSON.stringify(p)} found`)) : Object.keys(g.values).indexOf(Dn(p)) === -1 && L.push(new ye(c, p, `expected one of [${Object.keys(g.values).join(", ")}], ${JSON.stringify(p)} found`)), L;
}
function wa(h) {
return S2(C1(h.value)) ? Ts(bi({}, h, { expressionContext: "filter", valueSpec: { value: "boolean" } })) : N3(h);
}
function N3(h) {
const c = h.value, p = h.key;
if (Pt(c) !== "array")
return [new ye(p, c, `array expected, ${Pt(c)} found`)];
const g = h.styleSpec;
let L, 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 && (L = Pt(c[1]), L !== "string" && H.push(new ye(`${p}[1]`, c[1], `string expected, ${L} found`)));
for (let A = 2; A < c.length; A++)
L = Pt(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 })) : L !== "string" && L !== "number" && L !== "boolean" && H.push(new ye(`${p}[${A}]`, c[A], `string, number, or boolean expected, ${L} 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":
L = Pt(c[1]), c.length !== 2 ? H.push(new ye(p, c, `filter array for "${c[0]}" operator must have 2 elements`)) : L !== "string" && H.push(new ye(`${p}[1]`, c[1], `string expected, ${L} found`));
}
return H;
}
function xa(h, c) {
const p = h.key, g = h.validateSpec, L = h.style, H = h.styleSpec, A = h.value, O = h.objectKey, N = H[`${c}_${h.layerType}`];
if (!N)
return [];
const z = O.match(/^(.*)-transition$/);
if (c === "paint" && z && N[z[1]] && N[z[1]].transition)
return g({ key: p, value: A, valueSpec: H.transition, style: L, styleSpec: H });
const Z = h.valueSpec || N[O];
if (!Z)
return [new ye(p, A, `unknown property "${O}"`)];
let X;
if (Pt(A) === "string" && t2(Z) && !Z.tokens && (X = /^{([^}]+)}$/.exec(A)))
return [new ye(p, A, `"${O}" does not support interpolation syntax
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(X[1])} }\`.`)];
const et = [];
return h.layerType === "symbol" && (O === "text-field" && L && !L.glyphs && et.push(new ye(p, A, 'use of "text-field" requires a style "glyphs" property')), O === "text-font" && re(C1(A)) && Dn(A.type) === "identity" && et.push(new ye(p, A, '"text-font" does not support identity functions'))), et.concat(g({ key: h.key, value: A, valueSpec: Z, style: L, styleSpec: H, expressionContext: "property", propertyType: c, propertyKey: O }));
}
function $s(h) {
return xa(h, "paint");
}
function Ec(h) {
return xa(h, "layout");
}
function Sc(h) {
let c = [];
const p = h.value, g = h.key, L = 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 O = Dn(p.ref);
if (p.id) {
const N = Dn(p.id);
for (let z = 0; z < h.arrayIndex; z++) {
const Z = L.layers[z];
Dn(Z.id) === N && c.push(new ye(g, p.id, `duplicate layer id "${p.id}", previously used at line ${Z.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`));
}), L.layers.forEach((z) => {
Dn(z.id) === O && (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 "${O}" not found`));
} else if (A !== "background")
if (p.source) {
const N = L.sources && L.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(Zi({ 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) => Zi({ layer: p, key: N.key, value: N.value, style: N.style, styleSpec: N.styleSpec, validateSpec: N.validateSpec, objectElementValidators: { "*": (z) => Ec(bi({ layerType: A }, z)) } }), paint: (N) => Zi({ 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 = Pt(c);
return g !== "string" ? [new ye(p, c, `string expected, ${g} found`)] : [];
}
const El = { promoteId: function({ key: h, value: c }) {
if (Pt(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 P0(h) {
const c = h.value, p = h.key, g = h.styleSpec, L = h.style, H = h.validateSpec;
if (!c.type)
return [new ye(p, c, '"type" is required')];
const A = Dn(c.type);
let O;
switch (A) {
case "vector":
case "raster":
return O = Zi({ key: p, value: c, valueSpec: g[`source_${A.replace("-", "_")}`], style: h.style, styleSpec: g, objectElementValidators: El, validateSpec: H }), O;
case "raster-dem":
return O = function(N) {
var z;
const Z = (z = N.sourceName) !== null && z !== void 0 ? z : "", X = N.value, et = N.styleSpec, st = et.source_raster_dem, ut = N.style;
let Tt = [];
const bt = Pt(X);
if (X === void 0)
return Tt;
if (bt !== "object")
return Tt.push(new ye("source_raster_dem", X, `object expected, ${bt} found`)), Tt;
const Mt = Dn(X.encoding) === "custom", $t = ["redFactor", "greenFactor", "blueFactor", "baseShift"], kt = N.value.encoding ? `"${N.value.encoding}"` : "Default";
for (const Bt in X)
!Mt && $t.includes(Bt) ? Tt.push(new ye(Bt, X[Bt], `In "${Z}": "${Bt}" is only valid when "encoding" is set to "custom". ${kt} encoding found`)) : st[Bt] ? Tt = Tt.concat(N.validateSpec({ key: Bt, value: X[Bt], valueSpec: st[Bt], validateSpec: N.validateSpec, style: ut, styleSpec: et })) : Tt.push(new ye(Bt, X[Bt], `unknown property "${Bt}"`));
return Tt;
}({ sourceName: p, value: c, style: h.style, styleSpec: g, validateSpec: H }), O;
case "geojson":
if (O = Zi({ key: p, value: c, valueSpec: g.source_geojson, style: L, styleSpec: g, validateSpec: H, objectElementValidators: El }), c.cluster)
for (const N in c.clusterProperties) {
const [z, Z] = c.clusterProperties[N], X = typeof z == "string" ? [z, ["accumulated"], ["get", N]] : z;
O.push(...Ts({ key: `${p}.${N}.map`, value: Z, validateSpec: H, expressionContext: "cluster-map" })), O.push(...Ts({ key: `${p}.${N}.reduce`, value: X, validateSpec: H, expressionContext: "cluster-reduce" }));
}
return O;
case "video":
return Zi({ key: p, value: c, valueSpec: g.source_video, style: L, validateSpec: H, styleSpec: g });
case "image":
return Zi({ key: p, value: c, valueSpec: g.source_image, style: L, 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: L, validateSpec: H, styleSpec: g });
}
}
function Hc(h) {
const c = h.value, p = h.styleSpec, g = p.light, L = h.style;
let H = [];
const A = Pt(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 O in c) {
const N = O.match(/^(.*)-transition$/);
H = H.concat(N && g[N[1]] && g[N[1]].transition ? h.validateSpec({ key: O, value: c[O], valueSpec: p.transition, validateSpec: h.validateSpec, style: L, styleSpec: p }) : g[O] ? h.validateSpec({ key: O, value: c[O], valueSpec: g[O], validateSpec: h.validateSpec, style: L, styleSpec: p }) : [new ye(O, c[O], `unknown property "${O}"`)]);
}
return H;
}
function Ac(h) {
const c = h.value, p = h.styleSpec, g = p.sky, L = h.style, H = Pt(c);
if (c === void 0)
return [];
if (H !== "object")
return [new ye("sky", c, `object expected, ${H} found`)];
let A = [];
for (const O in c)
A = A.concat(g[O] ? h.validateSpec({ key: O, value: c[O], valueSpec: g[O], style: L, styleSpec: p }) : [new ye(O, c[O], `unknown property "${O}"`)]);
return A;
}
function Cc(h) {
const c = h.value, p = h.styleSpec, g = p.terrain, L = h.style;
let H = [];
const A = Pt(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 O in c)
H = H.concat(g[O] ? h.validateSpec({ key: O, value: c[O], valueSpec: g[O], validateSpec: h.validateSpec, style: L, styleSpec: p }) : [new ye(O, c[O], `unknown property "${O}"`)]);
return H;
}
function Oc(h) {
let c = [];
const p = h.value, g = h.key;
if (Array.isArray(p)) {
const L = [], H = [];
for (const A in p)
p[A].id && L.includes(p[A].id) && c.push(new ye(g, p, `all the sprites' ids must be unique, but ${p[A].id} is duplicated`)), L.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(Zi({ 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: Vo, boolean: function(h) {
const c = h.value, p = h.key, g = Pt(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 = Pt(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: Zi, source: P0, light: Hc, sky: Ac, terrain: Cc, projection: function(h) {
const c = h.value, p = h.styleSpec, g = p.projection, L = h.style, H = Pt(c);
if (c === void 0)
return [];
if (H !== "object")
return [new ye("projection", c, `object expected, ${H} found`)];
let A = [];
for (const O in c)
A = A.concat(g[O] ? h.validateSpec({ key: O, value: c[O], valueSpec: g[O], style: L, styleSpec: p }) : [new ye(O, c[O], `unknown property "${O}"`)]);
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 (Pt(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 L = [];
for (let H = 0; H < p.length; H++)
L = L.concat(h.validateSpec({ key: `${c}[${H}]`, value: p[H], validateSpec: h.validateSpec, valueSpec: g }));
return L;
}
return J4({ key: c, value: p, valueSpec: {} });
}, variableAnchorOffsetCollection: function(h) {
const c = h.key, p = h.value, g = Pt(p), L = 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: L.layout_symbol["text-anchor"] })), H = H.concat(Vo({ key: `${c}[${A + 1}]`, value: p[A + 1], valueSpec: { length: 2, value: "number" }, validateSpec: h.validateSpec, style: h.style, styleSpec: L }));
return H;
}, sprite: Oc };
function t6(h) {
const c = h.value, p = h.valueSpec, g = h.styleSpec;
return h.validateSpec = t6, p.expression && re(Dn(c)) ? Gs(h) : p.expression && yi(C1(c)) ? Ts(h) : p.type && Sl[p.type] ? Sl[p.type](h) : Zi(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 = Ot) {
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 }))), Pc(p);
}
function fs(h) {
return function(c) {
return h({ ...c, validateSpec: t6 });
};
}
function Pc(h) {
return [].concat(h).sort((c, p) => c.line - p.line);
}
function A2(h) {
return function(...c) {
return Pc(h.apply(this, c));
};
}
r2.source = A2(fs(P0)), r2.sprite = A2(fs(Oc)), r2.glyphs = A2(fs(Qp)), r2.light = A2(fs(Hc)), r2.sky = A2(fs(Ac)), r2.terrain = A2(fs(Cc)), r2.layer = A2(fs(Sc)), r2.filter = A2(fs(wa)), r2.paintProperty = A2(fs($s)), r2.layoutProperty = A2(fs(Ec));
const F3 = r2, f_ = F3.light, Q_ = F3.sky, mp = F3.paintProperty, gp = F3.layoutProperty;
function kc(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 L = 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], Z = A[3 + N + 1];
L.push(z === Z ? null : A.subarray(z, Z));
}
const O = A[3 + L.length + 1];
this.keys = A.subarray(A[3 + L.length], O), this.bboxes = A.subarray(O), this.insert = this._insertReadonly;
} else {
this.d = p + 2 * g;
for (let A = 0; A < this.d * this.d; A++)
L.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, L, H) {
this._forEachCell(p, g, L, H, this._insertCell, this.uid++, void 0, void 0), this.keys.push(c), this.bboxes.push(p), this.bboxes.push(g), this.bboxes.push(L), this.bboxes.push(H);
}
_insertReadonly() {
throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.");
}
_insertCell(c, p, g, L, H, A) {
this.cells[H].push(A);
}
query(c, p, g, L, H) {
const A = this.min, O = this.max;
if (c <= A && p <= A && O <= g && O <= L && !H)
return Array.prototype.slice.call(this.keys);
{
const N = [];
return this._forEachCell(c, p, g, L, this._queryCell, N, {}, H), N;
}
}
_queryCell(c, p, g, L, H, A, O, N) {
const z = this.cells[H];
if (z !== null) {
const Z = this.keys, X = this.bboxes;
for (let et = 0; et < z.length; et++) {
const st = z[et];
if (O[st] === void 0) {
const ut = 4 * st;
(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] && L >= X[ut + 1]) ? (O[st] = !0, A.push(Z[st])) : O[st] = !1;
}
}
}
}
_forEachCell(c, p, g, L, H, A, O, N) {
const z = this._convertToCellCoord(c), Z = this._convertToCellCoord(p), X = this._convertToCellCoord(g), et = this._convertToCellCoord(L);
for (let st = z; st <= X; st++)
for (let ut = Z; ut <= et; ut++) {
const Tt = this.d * ut + st;
if ((!N || N(this._convertFromCellCoord(st), this._convertFromCellCoord(ut), this._convertFromCellCoord(st + 1), this._convertFromCellCoord(ut + 1))) && H.call(this, c, p, g, L, Tt, A, O, 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 L = new Int32Array(p + g + this.keys.length + this.bboxes.length);
L[0] = this.extent, L[1] = this.n, L[2] = this.padding;
let H = p;
for (let A = 0; A < c.length; A++) {
const O = c[A];
L[3 + A] = H, L.set(O, H), H += O.length;
}
return L[3 + c.length] = H, L.set(this.keys, H), H += this.keys.length, L[3 + c.length + 1] = H, L.set(this.bboxes, H), H += this.bboxes.length, L.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", ko), nr("StyleExpression", gi, { omit: ["_evaluator"] }), nr("ZoomDependentExpression", Ai), nr("ZoomConstantExpression", A1), nr("CompoundExpression", po, { omit: ["_evaluate"] });
for (const h in Oo)
Oo[h]._classRegistryKey || nr(`Expression_${h}`, Oo[h]);
function Hl(h) {
return h && typeof ArrayBuffer < "u" && (h instanceof ArrayBuffer || h.constructor && h.constructor.name === "ArrayBuffer");
}
function Vc(h) {
return h.$name || h.constructor._classRegistryKey;
}
function yp(h) {
return !function(c) {
if (c === null || typeof c != "object")
return !1;
const p = Vc(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) || Se(h) || ArrayBuffer.isView(h) || h instanceof ImageData);
}
function r6(h, c) {
if (yp(h))
return (Hl(h) || Se(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 = Vc(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], L = g.serialize ? g.serialize(h, c) : {};
if (g.serialize) {
if (c && L === 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];
L[H] = n2[p].shallow.indexOf(H) >= 0 ? A : r6(A, c);
}
h instanceof Error && (L.message = h.message);
}
if (L.$name)
throw new Error("$name property is reserved for worker serialization logic.");
return p !== "Object" && (L.$name = p), L;
}
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 = Vc(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 L of Object.keys(h)) {
if (L === "$name")
continue;
const H = h[L];
g[L] = n2[c].shallow.indexOf(L) >= 0 ? H : n6(H);
}
return g;
}
class Ic {
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 Io = 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 Ic(), this.transition = {});
}
isSupportedScript(c) {
return function(p, g) {
for (const L of p)
if (!v_(L.charCodeAt(0), g))
return !1;
return !0;
}(c, Io.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, L) {
if (re(g))
return new ko(g, L);
if (yi(g)) {
const H = Po(g, L);
if (H.result === "error")
throw new Error(H.value.map((A) => `${A.key}: ${A.message}`).join(", "));
return H.value;
}
{
let H = g;
return L.type === "color" && typeof g == "string" ? H = tn.parse(g) : L.type !== "padding" || typeof g != "number" && !Array.isArray(g) ? L.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 Cl {
constructor(c) {
this._properties = c, this._values = Object.create(c.defaultTransitionablePropertyValues);
}
getValue(c) {
return lt(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 : lt(p));
}
getTransition(c) {
return lt(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 = lt(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 L = this.getTransition(p);
L !== void 0 && (c[`${p}-transition`] = L);
}
return c;
}
transitioned(c, p) {
const g = new k0(this._properties);
for (const L of Object.keys(this._values))
g._values[L] = this._values[L].transitioned(c, p._values[L]);
return g;
}
untransitioned() {
const c = new k0(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, L, H) {
this.property = c, this.value = p, this.begin = H + L.delay || 0, this.end = this.begin + L.duration || 0, c.specification.transition && (L.delay || L.duration) && (this.prior = g);
}
possiblyEvaluate(c, p, g) {
const L = c.now || 0, H = this.value.possiblyEvaluate(c, p, g), A = this.prior;
if (A) {
if (L > this.end)
return this.prior = null, H;
if (this.value.isDataDriven())
return this.prior = null, H;
if (L < this.begin)
return A.possiblyEvaluate(c, p, g);
{
const O = (L - 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, Z = z * N;
return 4 * (N < 0.5 ? Z : 3 * (N - z) + Z - 0.75);
}(O));
}
}
return H;
}
}
class k0 {
constructor(c) {
this._properties = c, this._values = Object.create(c.defaultTransitioningPropertyValues);
}
possiblyEvaluate(c, p, g) {
const L = new I0(this._properties);
for (const H of Object.keys(this._values))
L._values[H] = this._values[H].possiblyEvaluate(c, p, g);
return L;
}
hasTransition() {
for (const c of Object.keys(this._values))
if (this._values[c].prior)
return !0;
return !1;
}
}
class V0 {
constructor(c) {
this._properties = c, this._values = Object.create(c.defaultPropertyValues);
}
hasValue(c) {
return this._values[c].value !== void 0;
}
getValue(c) {
return lt(this._values[c].value);
}
setValue(c, p) {
this._values[c] = new o6(this._values[c].property, p === null ? void 0 : lt(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 L = new I0(this._properties);
for (const H of Object.keys(this._values))
L._values[H] = this._values[H].possiblyEvaluate(c, p, g);
return L;
}
}
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, L) {
return this.property.evaluate(this.value, this.parameters, c, p, g, L);
}
}
class I0 {
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 L = wr[this.specification.type];
return L ? L(c, p, g) : c;
}
}
class Mr {
constructor(c, p) {
this.specification = c, this.overrides = p;
}
possiblyEvaluate(c, p, g, L) {
return new Qs(this, c.expression.kind === "constant" || c.expression.kind === "camera" ? { kind: "constant", value: c.expression.evaluate(p, null, {}, g, L) } : 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 L = wr[this.specification.type];
if (L) {
const H = L(c.value.value, p.value.value, g);
return new Qs(this, { kind: "constant", value: H }, c.parameters);
}
return c;
}
evaluate(c, p, g, L, H, A) {
return c.kind === "constant" ? c.value : c.evaluate(p, g, L, H, A);
}
}
class Ol extends Mr {
possiblyEvaluate(c, p, g, L) {
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, L), A = c.property.specification.type === "resolvedImage" && typeof H != "string" ? H.name : H, O = this._calculate(A, A, A, p);
return new Qs(this, { kind: "constant", value: O }, 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, L, H, A) {
if (c.kind === "source") {
const O = c.evaluate(p, g, L, H, A);
return this._calculate(O, O, O, p);
}
return c.kind === "composite" ? this._calculate(c.evaluate({ zoom: Math.floor(p.zoom) - 1 }, g, L), c.evaluate({ zoom: Math.floor(p.zoom) }, g, L), c.evaluate({ zoom: Math.floor(p.zoom) + 1 }, g, L), p) : c.value;
}
_calculate(c, p, g, L) {
return L.zoom > L.zoomHistory.lastIntegerZoom ? { from: c, to: p } : { from: g, to: p };
}
interpolate(c) {
return c;
}
}
class Pl {
constructor(c) {
this.specification = c;
}
possiblyEvaluate(c, p, g, L) {
if (c.value !== void 0) {
if (c.expression.kind === "constant") {
const H = c.expression.evaluate(p, null, {}, g, L);
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, L) {
return L.zoom > L.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, L) {
return !!c.expression.evaluate(p, null, {}, g, L);
}
interpolate() {
return !1;
}
}
class E {
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 L = this.defaultPropertyValues[p] = new o6(g, void 0), H = this.defaultTransitionablePropertyValues[p] = new Al(g);
this.defaultTransitioningPropertyValues[p] = H.untransitioned(), this.defaultPossiblyEvaluatedValues[p] = L.possiblyEvaluate({});
}
}
}
nr("DataDrivenProperty", Mr), nr("DataConstantProperty", cr), nr("CrossFadedDataDrivenProperty", Ol), nr("CrossFadedProperty", Pl), 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 V0(p.layout)), p.paint)) {
this._transitionablePaint = new Cl(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 I0(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 L = this._transitionablePaint._values[c], H = L.property.specification["property-type"] === "cross-faded-data-driven", A = L.value.isDataDriven(), O = L.value;
this._transitionablePaint.setValue(c, p), this._handleSpecialPaintPropertyUpdate(c);
const N = this._transitionablePaint._values[c].value;
return N.isDataDriven() || A || H || this._handleOverridablePaintPropertyUpdate(c, O, 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), at(c, (p, g) => !(p === void 0 || g === "layout" && !Object.keys(p).length || g === "paint" && !Object.keys(p).length));
}
_validate(c, p, g, L, H = {}) {
return (!H || H.validate !== !1) && kc(this, c.call(F3, { key: p, layerType: this.type, objectKey: g, value: L, styleSpec: Ot, 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 _ {
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 I(h, c = 1) {
let p = 0, g = 0;
return { members: h.map((L) => {
const H = v[L.type].BYTES_PER_ELEMENT, A = p = D(p, Math.max(c, H)), O = L.components || 1;
return g = Math.max(g, H), p += H * O, { name: L.name, type: L.type, components: O, 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 L = 2 * c;
return this.int16[L + 0] = p, this.int16[L + 1] = g, c;
}
}
j.prototype.bytesPerElement = 4, nr("StructArrayLayout2i4", j);
class W extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g) {
const L = this.length;
return this.resize(L + 1), this.emplace(L, c, p, g);
}
emplace(c, p, g, L) {
const H = 3 * c;
return this.int16[H + 0] = p, this.int16[H + 1] = g, this.int16[H + 2] = L, c;
}
}
W.prototype.bytesPerElement = 6, nr("StructArrayLayout3i6", W);
class Y extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, L) {
const H = this.length;
return this.resize(H + 1), this.emplace(H, c, p, g, L);
}
emplace(c, p, g, L, H) {
const A = 4 * c;
return this.int16[A + 0] = p, this.int16[A + 1] = g, this.int16[A + 2] = L, 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, L, H, A) {
const O = this.length;
return this.resize(O + 1), this.emplace(O, c, p, g, L, H, A);
}
emplace(c, p, g, L, H, A, O) {
const N = 6 * c;
return this.int16[N + 0] = p, this.int16[N + 1] = g, this.int16[N + 2] = L, this.int16[N + 3] = H, this.int16[N + 4] = A, this.int16[N + 5] = O, c;
}
}
J.prototype.bytesPerElement = 12, nr("StructArrayLayout2i4i12", J);
class ct extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, L, H, A) {
const O = this.length;
return this.resize(O + 1), this.emplace(O, c, p, g, L, H, A);
}
emplace(c, p, g, L, H, A, O) {
const N = 4 * c, z = 8 * c;
return this.int16[N + 0] = p, this.int16[N + 1] = g, this.uint8[z + 4] = L, this.uint8[z + 5] = H, this.uint8[z + 6] = A, this.uint8[z + 7] = O, c;
}
}
ct.prototype.bytesPerElement = 8, nr("StructArrayLayout2i4ub8", ct);
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 L = 2 * c;
return this.float32[L + 0] = p, this.float32[L + 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, L, H, A, O, N, z, Z) {
const X = this.length;
return this.resize(X + 1), this.emplace(X, c, p, g, L, H, A, O, N, z, Z);
}
emplace(c, p, g, L, H, A, O, N, z, Z, X) {
const et = 10 * c;
return this.uint16[et + 0] = p, this.uint16[et + 1] = g, this.uint16[et + 2] = L, this.uint16[et + 3] = H, this.uint16[et + 4] = A, this.uint16[et + 5] = O, this.uint16[et + 6] = N, this.uint16[et + 7] = z, this.uint16[et + 8] = Z, this.uint16[et + 9] = X, c;
}
}
Qt.prototype.bytesPerElement = 20, nr("StructArrayLayout10ui20", Qt);
class Lt 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, L, H, A, O, N, z, Z, X, et) {
const st = this.length;
return this.resize(st + 1), this.emplace(st, c, p, g, L, H, A, O, N, z, Z, X, et);
}
emplace(c, p, g, L, H, A, O, N, z, Z, X, et, st) {
const ut = 12 * c;
return this.int16[ut + 0] = p, this.int16[ut + 1] = g, this.int16[ut + 2] = L, this.int16[ut + 3] = H, this.uint16[ut + 4] = A, this.uint16[ut + 5] = O, this.uint16[ut + 6] = N, this.uint16[ut + 7] = z, this.int16[ut + 8] = Z, this.int16[ut + 9] = X, this.int16[ut + 10] = et, this.int16[ut + 11] = st, c;
}
}
Lt.prototype.bytesPerElement = 24, nr("StructArrayLayout4i4ui4i24", Lt);
class Et extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
}
emplaceBack(c, p, g) {
const L = this.length;
return this.resize(L + 1), this.emplace(L, c, p, g);
}
emplace(c, p, g, L) {
const H = 3 * c;
return this.float32[H + 0] = p, this.float32[H + 1] = g, this.float32[H + 2] = L, c;
}
}
Et.prototype.bytesPerElement = 12, nr("StructArrayLayout3f12", Et);
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 Ct 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, L, H, A, O, N, z) {
const Z = this.length;
return this.resize(Z + 1), this.emplace(Z, c, p, g, L, H, A, O, N, z);
}
emplace(c, p, g, L, H, A, O, N, z, Z) {
const X = 10 * c, et = 5 * c;
return this.int16[X + 0] = p, this.int16[X + 1] = g, this.int16[X + 2] = L, this.int16[X + 3] = H, this.int16[X + 4] = A, this.int16[X + 5] = O, this.uint32[et + 3] = N, this.uint16[X + 8] = z, this.uint16[X + 9] = Z, c;
}
}
Ct.prototype.bytesPerElement = 20, nr("StructArrayLayout6i1ul2ui20", Ct);
class _t extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, L, H, A) {
const O = this.length;
return this.resize(O + 1), this.emplace(O, c, p, g, L, H, A);
}
emplace(c, p, g, L, H, A, O) {
const N = 6 * c;
return this.int16[N + 0] = p, this.int16[N + 1] = g, this.int16[N + 2] = L, this.int16[N + 3] = H, this.int16[N + 4] = A, this.int16[N + 5] = O, c;
}
}
_t.prototype.bytesPerElement = 12, nr("StructArrayLayout2i2i2i12", _t);
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, L, H) {
const A = this.length;
return this.resize(A + 1), this.emplace(A, c, p, g, L, H);
}
emplace(c, p, g, L, H, A) {
const O = 4 * c, N = 8 * c;
return this.float32[O + 0] = p, this.float32[O + 1] = g, this.float32[O + 2] = L, 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, L, H, A) {
const O = this.length;
return this.resize(O + 1), this.emplace(O, c, p, g, L, H, A);
}
emplace(c, p, g, L, H, A, O) {
const N = 16 * c, z = 4 * c, Z = 8 * c;
return this.uint8[N + 0] = p, this.uint8[N + 1] = g, this.float32[z + 1] = L, this.float32[z + 2] = H, this.int16[Z + 6] = A, this.int16[Z + 7] = O, 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 L = this.length;
return this.resize(L + 1), this.emplace(L, c, p, g);
}
emplace(c, p, g, L) {
const H = 3 * c;
return this.uint16[H + 0] = p, this.uint16[H + 1] = g, this.uint16[H + 2] = L, 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, L, H, A, O, N, z, Z, X, et, st, ut, Tt, bt, Mt) {
const $t = this.length;
return this.resize($t + 1), this.emplace($t, c, p, g, L, H, A, O, N, z, Z, X, et, st, ut, Tt, bt, Mt);
}
emplace(c, p, g, L, H, A, O, N, z, Z, X, et, st, ut, Tt, bt, Mt, $t) {
const kt = 24 * c, Bt = 12 * c, ee = 48 * c;
return this.int16[kt + 0] = p, this.int16[kt + 1] = g, this.uint16[kt + 2] = L, this.uint16[kt + 3] = H, this.uint32[Bt + 2] = A, this.uint32[Bt + 3] = O, this.uint32[Bt + 4] = N, this.uint16[kt + 10] = z, this.uint16[kt + 11] = Z, this.uint16[kt + 12] = X, this.float32[Bt + 7] = et, this.float32[Bt + 8] = st, this.uint8[ee + 36] = ut, this.uint8[ee + 37] = Tt, this.uint8[ee + 38] = bt, this.uint32[Bt + 10] = Mt, this.int16[kt + 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, L, H, A, O, N, z, Z, X, et, st, ut, Tt, bt, Mt, $t, kt, Bt, ee, _e, Xe, xr, ze, Re, Qr, sr) {
const rr = this.length;
return this.resize(rr + 1), this.emplace(rr, c, p, g, L, H, A, O, N, z, Z, X, et, st, ut, Tt, bt, Mt, $t, kt, Bt, ee, _e, Xe, xr, ze, Re, Qr, sr);
}
emplace(c, p, g, L, H, A, O, N, z, Z, X, et, st, ut, Tt, bt, Mt, $t, kt, Bt, ee, _e, Xe, xr, 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] = L, this.int16[ue + 3] = H, this.int16[ue + 4] = A, this.int16[ue + 5] = O, this.int16[ue + 6] = N, this.int16[ue + 7] = z, this.uint16[ue + 8] = Z, this.uint16[ue + 9] = X, this.uint16[ue + 10] = et, this.uint16[ue + 11] = st, this.uint16[ue + 12] = ut, this.uint16[ue + 13] = Tt, this.uint16[ue + 14] = bt, this.uint16[ue + 15] = Mt, this.uint16[ue + 16] = $t, this.uint16[ue + 17] = kt, this.uint16[ue + 18] = Bt, this.uint16[ue + 19] = ee, this.uint16[ue + 20] = _e, this.uint16[ue + 21] = Xe, this.uint16[ue + 22] = xr, 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 L = this.length;
return this.resize(L + 1), this.emplace(L, c, p, g);
}
emplace(c, p, g, L) {
const H = 3 * c;
return this.uint16[6 * c + 0] = p, this.float32[H + 1] = g, this.float32[H + 2] = L, 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 L = this.length;
return this.resize(L + 1), this.emplace(L, c, p, g);
}
emplace(c, p, g, L) {
const H = 4 * c;
return this.uint32[2 * c + 0] = p, this.uint16[H + 2] = g, this.uint16[H + 3] = L, c;
}
}
Oe.prototype.bytesPerElement = 8, nr("StructArrayLayout1ul2ui8", Oe);
class Ce 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 L = 2 * c;
return this.uint16[L + 0] = p, this.uint16[L + 1] = g, c;
}
}
Ce.prototype.bytesPerElement = 4, nr("StructArrayLayout2ui4", Ce);
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 Dr extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
}
emplaceBack(c, p, g, L) {
const H = this.length;
return this.resize(H + 1), this.emplace(H, c, p, g, L);
}
emplace(c, p, g, L, H) {
const A = 4 * c;
return this.float32[A + 0] = p, this.float32[A + 1] = g, this.float32[A + 2] = L, this.float32[A + 3] = H, c;
}
}
Dr.prototype.bytesPerElement = 16, nr("StructArrayLayout4f16", Dr);
class Ie extends _ {
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);
}
}
Ie.prototype.size = 20;
class Ze extends Ct {
get(c) {
return new Ie(this, c);
}
}
nr("CollisionBoxArray", Ze);
class Or extends _ {
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];
}
}
Or.prototype.size = 48;
class ei extends he {
get(c) {
return new Or(this, c);
}
}
nr("PlacedSymbolArray", ei);
class Zr extends _ {
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];
}
}
Zr.prototype.size = 64;
class nn extends we {
get(c) {
return new Zr(this, c);
}
}
nr("SymbolInstanceArray", nn);
class ri extends De {
getoffsetX(c) {
return this.float32[1 * c + 0];
}
}
nr("GlyphOffsetArray", ri);
class O1 extends W {
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", O1);
class C2 extends _ {
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];
}
}
C2.prototype.size = 12;
class ni extends tr {
get(c) {
return new C2(this, c);
}
}
nr("TextAnchorOffsetArray", ni);
class mo extends _ {
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 P1 extends j {
}
class X1 extends j {
}
class ms extends j {
}
class s6 extends J {
}
class kl extends ct {
}
class a6 extends ft {
}
class i2 extends Qt {
}
class Vl extends Lt {
}
class jc extends Et {
}
class o2 extends Ht {
}
class s2 extends _t {
}
class Ma extends Dt {
}
class O2 extends Wt {
}
class b1 extends Ce {
}
const k1 = I([{ name: "a_pos", components: 2, type: "Int16" }], 4), { members: Ro } = k1;
class an {
constructor(c = []) {
this.segments = c;
}
prepareSegment(c, p, g, L) {
let H = this.segments[this.segments.length - 1];
return c > an.MAX_VERTEX_ARRAY_LENGTH && Vt(`Max vertices per segment is ${an.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${c}`), (!H || H.vertexLength + c > an.MAX_VERTEX_ARRAY_LENGTH || H.sortKey !== L) && (H = { vertexOffset: p.length, primitiveOffset: g.length, vertexLength: 0, primitiveLength: 0 }, L !== void 0 && (H.sortKey = L), 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, L) {
return new an([{ vertexOffset: c, primitiveOffset: p, vertexLength: g, primitiveLength: L, 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 = I([{ 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, L, H, A, O, N, z;
for (g = h.length - (p = 3 & h.length), L = c, A = 3432918353, O = 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, L = 27492 + (65535 & (H = 5 * (65535 & (L = (L ^= N = (65535 & (N = (N = (65535 & N) * A + (((N >>> 16) * A & 65535) << 16) & 4294967295) << 15 | N >>> 17)) * O + (((N >>> 16) * O & 65535) << 16) & 4294967295) << 13 | L >>> 19)) + ((5 * (L >>> 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:
L ^= N = (65535 & (N = (N = (65535 & (N ^= 255 & h.charCodeAt(z))) * A + (((N >>> 16) * A & 65535) << 16) & 4294967295) << 15 | N >>> 17)) * O + (((N >>> 16) * O & 65535) << 16) & 4294967295;
}
return L ^= h.length, L = 2246822507 * (65535 & (L ^= L >>> 16)) + ((2246822507 * (L >>> 16) & 65535) << 16) & 4294967295, L = 3266489909 * (65535 & (L ^= L >>> 13)) + ((3266489909 * (L >>> 16) & 65535) << 16) & 4294967295, (L ^= L >>> 16) >>> 0;
};
var b_ = Lp.exports, wp = { exports: {} };
wp.exports = function(h, c) {
for (var p, g = h.length, L = 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), L = 1540483477 * (65535 & L) + ((1540483477 * (L >>> 16) & 65535) << 16) ^ (p = 1540483477 * (65535 & (p ^= p >>> 24)) + ((1540483477 * (p >>> 16) & 65535) << 16)), g -= 4, ++H;
switch (g) {
case 3:
L ^= (255 & h.charCodeAt(H + 2)) << 16;
case 2:
L ^= (255 & h.charCodeAt(H + 1)) << 8;
case 1:
L = 1540483477 * (65535 & (L ^= 255 & h.charCodeAt(H))) + ((1540483477 * (L >>> 16) & 65535) << 16);
}
return L = 1540483477 * (65535 & (L ^= L >>> 13)) + ((1540483477 * (L >>> 16) & 65535) << 16), (L ^= L >>> 15) >>> 0;
};
var Ea = b_, xp = wp.exports;
c6.exports = Ea, c6.exports.murmur3 = Ea, c6.exports.murmur2 = xp;
var Il = u(c6.exports);
class R0 {
constructor() {
this.ids = [], this.positions = [], this.indexed = !1;
}
add(c, p, g, L) {
this.ids.push(Rl(c)), this.positions.push(p, g, L);
}
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, L = this.ids.length - 1;
for (; g < L; ) {
const A = g + L >> 1;
this.ids[A] >= p ? L = 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), L = new Uint32Array(c.positions);
return Nl(g, L, 0, g.length - 1), p && p.push(g.buffer, L.buffer), { ids: g, positions: L };
}
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 : Il(String(h));
}
function Nl(h, c, p, g) {
for (; p < g; ) {
const L = h[p + g >> 1];
let H = p - 1, A = g + 1;
for (; ; ) {
do
H++;
while (h[H] < L);
do
A--;
while (h[A] > L);
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 Mp 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 EC 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 SC 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((L) => `u_${L}`), this.type = g;
}
setUniform(c, p, g) {
c.set(g.constantOr(this.value));
}
getBinding(c, p, g) {
return this.type === "color" ? new SC(c, p) : new Mp(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, L) {
const H = L === "u_pattern_to" ? this.patternTo : L === "u_pattern_from" ? this.patternFrom : L === "u_pixel_ratio_to" ? this.pixelRatioTo : L === "u_pixel_ratio_from" ? this.pixelRatioFrom : null;
H && c.set(H);
}
getBinding(c, p, g) {
return g.substr(0, 9) === "u_pattern" ? new EC(c, p) : new Mp(c, p);
}
}
class j3 {
constructor(c, p, g, L) {
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 L();
}
populatePaintArray(c, p, g, L, H) {
const A = this.paintVertexArray.length, O = this.expression.evaluate(new ti(0), p, {}, L, [], H);
this.paintVertexArray.resize(c), this._setPaintValue(A, c, O);
}
updatePaintArray(c, p, g, L) {
const H = this.expression.evaluate({ zoom: 0 }, g, L);
this._setPaintValue(c, p, H);
}
_setPaintValue(c, p, g) {
if (this.type === "color") {
const L = L_(g);
for (let H = c; H < p; H++)
this.paintVertexArray.emplace(H, L[0], L[1]);
} else {
for (let L = c; L < p; L++)
this.paintVertexArray.emplace(L, 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 Zs {
constructor(c, p, g, L, H, A) {
this.expression = c, this.uniformNames = p.map((O) => `u_${O}_t`), this.type = g, this.useIntegerZoom = L, this.zoom = H, this.maxValue = 0, this.paintVertexAttributes = p.map((O) => ({ name: `a_${O}`, type: "Float32", components: g === "color" ? 4 : 2, offset: 0 })), this.paintVertexArray = new A();
}
populatePaintArray(c, p, g, L, H) {
const A = this.expression.evaluate(new ti(this.zoom), p, {}, L, [], H), O = this.expression.evaluate(new ti(this.zoom + 1), p, {}, L, [], H), N = this.paintVertexArray.length;
this.paintVertexArray.resize(c), this._setPaintValue(N, c, A, O);
}
updatePaintArray(c, p, g, L) {
const H = this.expression.evaluate({ zoom: this.zoom }, g, L), A = this.expression.evaluate({ zoom: this.zoom + 1 }, g, L);
this._setPaintValue(c, p, H, A);
}
_setPaintValue(c, p, g, L) {
if (this.type === "color") {
const H = L_(g), A = L_(L);
for (let O = c; O < p; O++)
this.paintVertexArray.emplace(O, H[0], H[1], A[0], A[1]);
} else {
for (let H = c; H < p; H++)
this.paintVertexArray.emplace(H, g, L);
this.maxValue = Math.max(this.maxValue, Math.abs(g), Math.abs(L));
}
}
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, L = F(this.expression.interpolationFactor(g, this.zoom, this.zoom + 1), 0, 1);
c.set(L);
}
getBinding(c, p, g) {
return new Mp(c, p);
}
}
class h6 {
constructor(c, p, g, L, H, A) {
this.expression = c, this.type = p, this.useIntegerZoom = g, this.zoom = L, this.layerId = A, this.zoomInPaintVertexArray = new H(), this.zoomOutPaintVertexArray = new H();
}
populatePaintArray(c, p, g) {
const L = this.zoomInPaintVertexArray.length;
this.zoomInPaintVertexArray.resize(c), this.zoomOutPaintVertexArray.resize(c), this._setPaintValues(L, c, p.patterns && p.patterns[this.layerId], g);
}
updatePaintArray(c, p, g, L, H) {
this._setPaintValues(c, p, g.patterns && g.patterns[this.layerId], H);
}
_setPaintValues(c, p, g, L) {
if (!L || !g)
return;
const { min: H, mid: A, max: O } = g, N = L[H], z = L[A], Z = L[O];
if (N && z && Z)
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], Z.tl[0], Z.tl[1], Z.br[0], Z.br[1], z.pixelRatio, Z.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 HC {
constructor(c, p, g) {
this.binders = {}, this._buffers = [];
const L = [];
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 O = vJ(H, c.type), N = A.value, z = A.property.specification.type, Z = A.property.useIntegerZoom, X = A.property.specification["property-type"], et = X === "cross-faded" || X === "cross-faded-data-driven";
if (N.kind === "constant")
this.binders[H] = et ? new Dl(N.value, O) : new zc(N.value, O, z), L.push(`/u_${H}`);
else if (N.kind === "source" || et) {
const st = AC(H, z, "source");
this.binders[H] = et ? new h6(N, z, Z, p, st, c.id) : new j3(N, O, z, st), L.push(`/a_${H}`);
} else {
const st = AC(H, z, "composite");
this.binders[H] = new Zs(N, O, z, Z, p, st), L.push(`/z_${H}`);
}
}
this.cacheKey = L.sort().join("");
}
getMaxValue(c) {
const p = this.binders[c];
return p instanceof j3 || p instanceof Zs ? p.maxValue : 0;
}
populatePaintArrays(c, p, g, L, H) {
for (const A in this.binders) {
const O = this.binders[A];
(O instanceof j3 || O instanceof Zs || O instanceof h6) && O.populatePaintArray(c, p, g, L, H);
}
}
setConstantPatternPositions(c, p) {
for (const g in this.binders) {
const L = this.binders[g];
L instanceof Dl && L.setConstantPatternPositions(c, p);
}
}
updatePaintArrays(c, p, g, L, H) {
let A = !1;
for (const O in c) {
const N = p.getPositions(O);
for (const z of N) {
const Z = g.feature(z.index);
for (const X in this.binders) {
const et = this.binders[X];
if ((et instanceof j3 || et instanceof Zs || et instanceof h6) && et.expression.isStateDependent === !0) {
const st = L.paint.get(X);
et.expression = st.value, et.updatePaintArray(z.start, z.end, Z, c[O], 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((L) => `#define HAS_UNIFORM_${L}`));
}
return c;
}
getBinderAttributes() {
const c = [];
for (const p in this.binders) {
const g = this.binders[p];
if (g instanceof j3 || g instanceof Zs)
for (let L = 0; L < g.paintVertexAttributes.length; L++)
c.push(g.paintVertexAttributes[L].name);
else if (g instanceof h6)
for (let L = 0; L < l6.members.length; L++)
c.push(l6.members[L].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 Zs)
for (const L of g.uniformNames)
c.push(L);
}
return c;
}
getPaintVertexBuffers() {
return this._buffers;
}
getUniforms(c, p) {
const g = [];
for (const L in this.binders) {
const H = this.binders[L];
if (H instanceof zc || H instanceof Dl || H instanceof Zs) {
for (const A of H.uniformNames)
if (p[A]) {
const O = H.getBinding(c, p[A], A);
g.push({ name: A, property: L, binding: O });
}
}
}
return g;
}
setUniforms(c, p, g, L) {
for (const { name: H, property: A, binding: O } of p)
this.binders[A].setUniform(O, L, 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 L = c.fromScale === 2 ? g.zoomInPaintVertexBuffer : g.zoomOutPaintVertexBuffer;
L && this._buffers.push(L);
} else
(g instanceof j3 || g instanceof Zs) && 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 Zs || 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 Zs || p instanceof h6) && p.destroy();
}
}
}
class D0 {
constructor(c, p, g = () => !0) {
this.programConfigurations = {};
for (const L of c)
this.programConfigurations[L.id] = new HC(L, p, g);
this.needsUpload = !1, this._featureMap = new R0(), this._bufferOffset = 0;
}
populatePaintArrays(c, p, g, L, H, A) {
for (const O in this.programConfigurations)
this.programConfigurations[O].populatePaintArrays(c, p, L, 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, L) {
for (const H of g)
this.needsUpload = this.programConfigurations[H.id].updatePaintArrays(c, this._featureMap, p, H, L) || 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 AC(h, c, p) {
const g = { color: { source: ft, composite: Dr }, number: { source: De, composite: ft } }, L = 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 L && L[p] || g[c][p];
}
nr("ConstantBinder", zc), nr("CrossFadedConstantBinder", Dl), nr("SourceExpressionBinder", j3), nr("CrossFadedCompositeBinder", h6), nr("CompositeExpressionBinder", Zs), nr("ProgramConfiguration", HC, { omit: ["_buffers"] }), nr("ProgramConfigurationSet", D0);
const Wi = 8192, w_ = Math.pow(2, 14) - 1, CC = -w_ - 1;
function F0(h) {
const c = Wi / h.extent, p = h.loadGeometry();
for (let g = 0; g < p.length; g++) {
const L = p[g];
for (let H = 0; H < L.length; H++) {
const A = L[H], O = Math.round(A.x * c), N = Math.round(A.y * c);
A.x = F(O, CC, w_), A.y = F(N, CC, w_), (O < A.x || O > A.x + 1 || N < A.y || N > A.y + 1) && Vt("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 Ep(h, c, p, g, L) {
h.emplaceBack(2 * c + (g + 1) / 2, 2 * p + (L + 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 O2(), 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 L = this.layers[0], H = [];
let A = null, O = !1;
L.type === "circle" && (A = L.layout.get("circle-sort-key"), O = !A.isConstant());
for (const { feature: N, id: z, index: Z, sourceLayerIndex: X } of c) {
const et = this.layers[0]._featureFilter.needGeometry, st = B0(N, et);
if (!this.layers[0]._featureFilter.filter(new ti(this.zoom), st, g))
continue;
const ut = O ? A.evaluate(st, {}, g) : void 0, Tt = { id: z, properties: N.properties, type: N.type, sourceLayerIndex: X, index: Z, geometry: et ? st.geometry : F0(N), patterns: {}, sortKey: ut };
H.push(Tt);
}
O && H.sort((N, z) => N.sortKey - z.sortKey);
for (const N of H) {
const { geometry: z, index: Z, sourceLayerIndex: X } = N, et = c[Z].feature;
this.addFeature(N, z, Z, g), p.featureIndex.insert(et, z, Z, 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, L) {
for (const H of p)
for (const A of H) {
const O = A.x, N = A.y;
if (O < 0 || O >= Wi || N < 0 || N >= Wi)
continue;
const z = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray, c.sortKey), Z = z.vertexLength;
Ep(this.layoutVertexArray, O, N, -1, -1), Ep(this.layoutVertexArray, O, N, 1, -1), Ep(this.layoutVertexArray, O, N, 1, 1), Ep(this.layoutVertexArray, O, N, -1, 1), this.indexArray.emplaceBack(Z, Z + 1, Z + 2), this.indexArray.emplaceBack(Z, Z + 3, Z + 2), z.vertexLength += 4, z.primitiveLength += 2;
}
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, c, g, {}, L);
}
}
function OC(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 !!M_(h, c);
}
function _J(h, c, p) {
return !!Fl(h, c) || !!E_(c, h, p);
}
function PC(h, c) {
if (h.length === 1)
return VC(c, h[0]);
for (let p = 0; p < c.length; p++) {
const g = c[p];
for (let L = 0; L < g.length; L++)
if (Fl(h, g[L]))
return !0;
}
for (let p = 0; p < h.length; p++)
if (VC(c, h[p]))
return !0;
for (let p = 0; p < c.length; p++)
if (M_(h, c[p]))
return !0;
return !1;
}
function bJ(h, c, p) {
if (h.length > 1) {
if (M_(h, c))
return !0;
for (let g = 0; g < c.length; g++)
if (E_(c[g], h, p))
return !0;
}
for (let g = 0; g < h.length; g++)
if (E_(h[g], c, p))
return !0;
return !1;
}
function M_(h, c) {
if (h.length === 0 || c.length === 0)
return !1;
for (let p = 0; p < h.length - 1; p++) {
const g = h[p], L = h[p + 1];
for (let H = 0; H < c.length - 1; H++)
if (LJ(g, L, 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 E_(h, c, p) {
const g = p * p;
if (c.length === 1)
return h.distSqr(c[0]) < g;
for (let L = 1; L < c.length; L++)
if (kC(h, c[L - 1], c[L]) < g)
return !0;
return !1;
}
function kC(h, c, p) {
const g = c.distSqr(p);
if (g === 0)
return h.distSqr(c);
const L = ((h.x - c.x) * (p.x - c.x) + (h.y - c.y) * (p.y - c.y)) / g;
return h.distSqr(L < 0 ? c : L > 1 ? p : p.sub(c)._mult(L)._add(c));
}
function VC(h, c) {
let p, g, L, H = !1;
for (let A = 0; A < h.length; A++) {
p = h[A];
for (let O = 0, N = p.length - 1; O < p.length; N = O++)
g = p[O], L = p[N], g.y > c.y != L.y > c.y && c.x < (L.x - g.x) * (c.y - g.y) / (L.y - g.y) + g.x && (H = !H);
}
return H;
}
function Fl(h, c) {
let p = !1;
for (let g = 0, L = h.length - 1; g < h.length; L = g++) {
const H = h[g], A = h[L];
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], L = p[2];
if (h.x < g.x && c.x < g.x || h.x > L.x && c.x > L.x || h.y < g.y && c.y < g.y || h.y > L.y && c.y > L.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, L) {
if (!c[0] && !c[1])
return h;
const H = f.convert(c)._mult(L);
p === "viewport" && H._rotate(-g);
const A = [];
for (let O = 0; O < h.length; O++)
A.push(h[O].sub(H));
return A;
}
let IC, RC;
nr("CircleBucket", x_, { omit: ["layers"] });
var xJ = { get paint() {
return RC = RC || new E({ "circle-radius": new Mr(Ot.paint_circle["circle-radius"]), "circle-color": new Mr(Ot.paint_circle["circle-color"]), "circle-blur": new Mr(Ot.paint_circle["circle-blur"]), "circle-opacity": new Mr(Ot.paint_circle["circle-opacity"]), "circle-translate": new cr(Ot.paint_circle["circle-translate"]), "circle-translate-anchor": new cr(Ot.paint_circle["circle-translate-anchor"]), "circle-pitch-scale": new cr(Ot.paint_circle["circle-pitch-scale"]), "circle-pitch-alignment": new cr(Ot.paint_circle["circle-pitch-alignment"]), "circle-stroke-width": new Mr(Ot.paint_circle["circle-stroke-width"]), "circle-stroke-color": new Mr(Ot.paint_circle["circle-stroke-color"]), "circle-stroke-opacity": new Mr(Ot.paint_circle["circle-stroke-opacity"]) });
}, get layout() {
return IC = IC || new E({ "circle-sort-key": new Mr(Ot.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 NC(h, c, p) {
var g = c[0], L = c[1], H = c[2], A = c[3], O = c[4], N = c[5], z = c[6], Z = c[7], X = c[8], et = c[9], st = c[10], ut = c[11], Tt = c[12], bt = c[13], Mt = c[14], $t = c[15], kt = p[0], Bt = p[1], ee = p[2], _e = p[3];
return h[0] = kt * g + Bt * O + ee * X + _e * Tt, h[1] = kt * L + Bt * N + ee * et + _e * bt, h[2] = kt * H + Bt * z + ee * st + _e * Mt, h[3] = kt * A + Bt * Z + ee * ut + _e * $t, h[4] = (kt = p[4]) * g + (Bt = p[5]) * O + (ee = p[6]) * X + (_e = p[7]) * Tt, h[5] = kt * L + Bt * N + ee * et + _e * bt, h[6] = kt * H + Bt * z + ee * st + _e * Mt, h[7] = kt * A + Bt * Z + ee * ut + _e * $t, h[8] = (kt = p[8]) * g + (Bt = p[9]) * O + (ee = p[10]) * X + (_e = p[11]) * Tt, h[9] = kt * L + Bt * N + ee * et + _e * bt, h[10] = kt * H + Bt * z + ee * st + _e * Mt, h[11] = kt * A + Bt * Z + ee * ut + _e * $t, h[12] = (kt = p[12]) * g + (Bt = p[13]) * O + (ee = p[14]) * X + (_e = p[15]) * Tt, h[13] = kt * L + Bt * N + ee * et + _e * bt, h[14] = kt * H + Bt * z + ee * st + _e * Mt, h[15] = kt * A + Bt * Z + 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, MJ = NC;
function Ap(h, c, p) {
var g = c[0], L = c[1], H = c[2], A = c[3];
return h[0] = p[0] * g + p[4] * L + p[8] * H + p[12] * A, h[1] = p[1] * g + p[5] * L + p[9] * H + p[13] * A, h[2] = p[2] * g + p[6] * L + p[10] * H + p[14] * A, h[3] = p[3] * g + p[7] * L + 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 EJ 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, L, H, A, O, N) {
const z = Hp(c, this.paint.get("circle-translate"), this.paint.get("circle-translate-anchor"), A.angle, O), Z = 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", et = X ? z : function(ut, Tt) {
return ut.map((bt) => DC(bt, Tt));
}(z, N), st = X ? Z * O : Z;
for (const ut of L)
for (const Tt of ut) {
const bt = X ? Tt : DC(Tt, N);
let Mt = st;
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" ? Mt *= $t[3] / A.cameraToCenterDistance : this.paint.get("circle-pitch-scale") === "map" && this.paint.get("circle-pitch-alignment") === "viewport" && (Mt *= A.cameraToCenterDistance / $t[3]), _J(et, bt, Mt))
return !0;
}
return !1;
}
}
function DC(h, c) {
const p = Ap([], [h.x, h.y, 0, 1], c);
return new f(p[0] / p[3], p[1] / p[3]);
}
class FC extends x_ {
}
let BC;
nr("HeatmapBucket", FC, { omit: ["layers"] });
var SJ = { get paint() {
return BC = BC || new E({ "heatmap-radius": new Mr(Ot.paint_heatmap["heatmap-radius"]), "heatmap-weight": new Mr(Ot.paint_heatmap["heatmap-weight"]), "heatmap-intensity": new cr(Ot.paint_heatmap["heatmap-intensity"]), "heatmap-color": new Bc(Ot.paint_heatmap["heatmap-color"]), "heatmap-opacity": new cr(Ot.paint_heatmap["heatmap-opacity"]) });
} };
function H_(h, { width: c, height: p }, g, L) {
if (L) {
if (L instanceof Uint8ClampedArray)
L = new Uint8Array(L.buffer);
else if (L.length !== c * p * g)
throw new RangeError(`mismatched image size. expected: ${L.length} but got: ${c * p * g}`);
} else
L = new Uint8Array(c * p * g);
return h.width = c, h.height = p, h.data = L, h;
}
function jC(h, { width: c, height: p }, g) {
if (c === h.width && p === h.height)
return;
const L = H_({}, { width: c, height: p }, g);
A_(h, L, { 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 = L.data;
}
function A_(h, c, p, g, L, H) {
if (L.width === 0 || L.height === 0)
return c;
if (L.width > h.width || L.height > h.height || p.x > h.width - L.width || p.y > h.height - L.height)
throw new RangeError("out of range source coordinates for image copy");
if (L.width > c.width || L.height > c.height || g.x > c.width - L.width || g.y > c.height - L.height)
throw new RangeError("out of range destination coordinates for image copy");
const A = h.data, O = c.data;
if (A === O)
throw new Error("srcData equals dstData, so image is already copied");
for (let N = 0; N < L.height; N++) {
const z = ((p.y + N) * h.width + p.x) * H, Z = ((g.y + N) * c.width + g.x) * H;
for (let X = 0; X < L.width * H; X++)
O[Z + X] = A[z + X];
}
return c;
}
class $c {
constructor(c, p) {
H_(this, c, 1, p);
}
resize(c) {
jC(this, c, 1);
}
clone() {
return new $c({ width: this.width, height: this.height }, new Uint8Array(this.data));
}
static copy(c, p, g, L, H) {
A_(c, p, g, L, H, 1);
}
}
class P2 {
constructor(c, p) {
H_(this, c, 4, p);
}
resize(c) {
jC(this, c, 4);
}
replace(c, p) {
p ? this.data.set(c) : this.data = c instanceof Uint8ClampedArray ? new Uint8Array(c.buffer) : c;
}
clone() {
return new P2({ width: this.width, height: this.height }, new Uint8Array(this.data));
}
static copy(c, p, g, L, H) {
A_(c, p, g, L, H, 4);
}
}
function zC(h) {
const c = {}, p = h.resolution || 256, g = h.clips ? h.clips.length : 1, L = h.image || new P2({ 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, O, N) => {
c[h.evaluationKey] = N;
const z = h.expression.evaluate(c);
L.data[A + O + 0] = Math.floor(255 * z.r / z.a), L.data[A + O + 1] = Math.floor(255 * z.g / z.a), L.data[A + O + 2] = Math.floor(255 * z.b / z.a), L.data[A + O + 3] = Math.floor(255 * z.a);
};
if (h.clips)
for (let A = 0, O = 0; A < g; ++A, O += 4 * p)
for (let N = 0, z = 0; N < p; N++, z += 4) {
const Z = N / (p - 1), { start: X, end: et } = h.clips[A];
H(O, z, X * (1 - Z) + et * Z);
}
else
for (let A = 0, O = 0; A < p; A++, O += 4)
H(0, O, A / (p - 1));
return L;
}
nr("AlphaImage", $c), nr("RGBAImage", P2);
const C_ = "big-fb";
class HJ extends m {
createBucket(c) {
return new FC(c);
}
constructor(c) {
super(c, SJ), this.heatmapFbos = /* @__PURE__ */ new Map(), this._updateColorRamp();
}
_handleSpecialPaintPropertyUpdate(c) {
c === "heatmap-color" && this._updateColorRamp();
}
_updateColorRamp() {
this.colorRamp = zC({ expression: this._transitionablePaint._values["heatmap-color"].value.expression, evaluationKey: "heatmapDensity", image: this.colorRamp }), this.colorRampTexture = null;
}
resize() {
this.heatmapFbos.has(C_) && this.heatmapFbos.delete(C_);
}
queryRadius() {
return 0;
}
queryIntersectsFeature() {
return !1;
}
hasOffscreenPass() {
return this.paint.get("heatmap-opacity") !== 0 && this.visibility !== "none";
}
}
let UC;
var AJ = { get paint() {
return UC = UC || new E({ "hillshade-illumination-direction": new cr(Ot.paint_hillshade["hillshade-illumination-direction"]), "hillshade-illumination-anchor": new cr(Ot.paint_hillshade["hillshade-illumination-anchor"]), "hillshade-exaggeration": new cr(Ot.paint_hillshade["hillshade-exaggeration"]), "hillshade-shadow-color": new cr(Ot.paint_hillshade["hillshade-shadow-color"]), "hillshade-highlight-color": new cr(Ot.paint_hillshade["hillshade-highlight-color"]), "hillshade-accent-color": new cr(Ot.paint_hillshade["hillshade-accent-color"]) });
} };
class CJ extends m {
constructor(c) {
super(c, AJ);
}
hasOffscreenPass() {
return this.paint.get("hillshade-exaggeration") !== 0 && this.visibility !== "none";
}
}
const OJ = I([{ name: "a_pos", components: 2, type: "Int16" }], 4), { members: PJ } = OJ;
function GC(h, c, p = 2) {
const g = c && c.length, L = g ? c[0] * p : h.length;
let H = $C(h, 0, L, p, !0);
const A = [];
if (!H || H.next === H.prev)
return A;
let O, N, z;
if (g && (H = function(Z, X, et, st) {
const ut = [];
for (let Tt = 0, bt = X.length; Tt < bt; Tt++) {
const Mt = $C(Z, X[Tt] * st, Tt < bt - 1 ? X[Tt + 1] * st : Z.length, st, !1);
Mt === Mt.next && (Mt.steiner = !0), ut.push(BJ(Mt));
}
ut.sort(NJ);
for (let Tt = 0; Tt < ut.length; Tt++)
et = DJ(ut[Tt], et);
return et;
}(h, c, H, p)), h.length > 80 * p) {
O = 1 / 0, N = 1 / 0;
let Z = -1 / 0, X = -1 / 0;
for (let et = p; et < L; et += p) {
const st = h[et], ut = h[et + 1];
st < O && (O = st), ut < N && (N = ut), st > Z && (Z = st), ut > X && (X = ut);
}
z = Math.max(Z - O, X - N), z = z !== 0 ? 32767 / z : 0;
}
return Zc(H, A, p, O, N, z, 0), A;
}
function $C(h, c, p, g, L) {
let H;
if (L === function(A, O, N, z) {
let Z = 0;
for (let X = O, et = N - z; X < N; X += z)
Z += (A[et] - A[X]) * (A[X + 1] + A[et + 1]), et = X;
return Z;
}(h, c, p, g) > 0)
for (let A = c; A < p; A += g)
H = qC(A / g | 0, h[A], h[A + 1], H);
else
for (let A = p - g; A >= c; A -= g)
H = qC(A / g | 0, h[A], h[A + 1], H);
return H && Cp(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 || !Cp(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 Zc(h, c, p, g, L, H, A) {
if (!h)
return;
!A && H && function(N, z, Z, X) {
let et = N;
do
et.z === 0 && (et.z = O_(et.x, et.y, z, Z, X)), et.prevZ = et.prev, et.nextZ = et.next, et = et.next;
while (et !== N);
et.prevZ.nextZ = null, et.prevZ = null, function(st) {
let ut, Tt = 1;
do {
let bt, Mt = st;
st = null;
let $t = null;
for (ut = 0; Mt; ) {
ut++;
let kt = Mt, Bt = 0;
for (let _e = 0; _e < Tt && (Bt++, kt = kt.nextZ, kt); _e++)
;
let ee = Tt;
for (; Bt > 0 || ee > 0 && kt; )
Bt !== 0 && (ee === 0 || !kt || Mt.z <= kt.z) ? (bt = Mt, Mt = Mt.nextZ, Bt--) : (bt = kt, kt = kt.nextZ, ee--), $t ? $t.nextZ = bt : st = bt, bt.prevZ = $t, $t = bt;
Mt = kt;
}
$t.nextZ = null, Tt *= 2;
} while (ut > 1);
}(et);
}(h, g, L, H);
let O = h;
for (; h.prev !== h.next; ) {
const N = h.prev, z = h.next;
if (H ? VJ(h, g, L, H) : kJ(h))
c.push(N.i, h.i, z.i), qc(h), h = z.next, O = z.next;
else if ((h = z) === O) {
A ? A === 1 ? Zc(h = IJ(j0(h), c), c, p, g, L, H, 2) : A === 2 && RJ(h, c, p, g, L, H) : Zc(j0(h), c, p, g, L, H, 1);
break;
}
}
}
function kJ(h) {
const c = h.prev, p = h, g = h.next;
if (Di(c, p, g) >= 0)
return !1;
const L = c.x, H = p.x, A = g.x, O = c.y, N = p.y, z = g.y, Z = L < H ? L < A ? L : A : H < A ? H : A, X = O < N ? O < z ? O : z : N < z ? N : z, et = L > H ? L > A ? L : A : H > A ? H : A, st = O > N ? O > z ? O : z : N > z ? N : z;
let ut = g.next;
for (; ut !== c; ) {
if (ut.x >= Z && ut.x <= et && ut.y >= X && ut.y <= st && jl(L, O, H, N, A, z, ut.x, ut.y) && Di(ut.prev, ut, ut.next) >= 0)
return !1;
ut = ut.next;
}
return !0;
}
function VJ(h, c, p, g) {
const L = h.prev, H = h, A = h.next;
if (Di(L, H, A) >= 0)
return !1;
const O = L.x, N = H.x, z = A.x, Z = L.y, X = H.y, et = A.y, st = O < N ? O < z ? O : z : N < z ? N : z, ut = Z < X ? Z < et ? Z : et : X < et ? X : et, Tt = O > N ? O > z ? O : z : N > z ? N : z, bt = Z > X ? Z > et ? Z : et : X > et ? X : et, Mt = O_(st, ut, c, p, g), $t = O_(Tt, bt, c, p, g);
let kt = h.prevZ, Bt = h.nextZ;
for (; kt && kt.z >= Mt && Bt && Bt.z <= $t; ) {
if (kt.x >= st && kt.x <= Tt && kt.y >= ut && kt.y <= bt && kt !== L && kt !== A && jl(O, Z, N, X, z, et, kt.x, kt.y) && Di(kt.prev, kt, kt.next) >= 0 || (kt = kt.prevZ, Bt.x >= st && Bt.x <= Tt && Bt.y >= ut && Bt.y <= bt && Bt !== L && Bt !== A && jl(O, Z, N, X, z, et, Bt.x, Bt.y) && Di(Bt.prev, Bt, Bt.next) >= 0))
return !1;
Bt = Bt.nextZ;
}
for (; kt && kt.z >= Mt; ) {
if (kt.x >= st && kt.x <= Tt && kt.y >= ut && kt.y <= bt && kt !== L && kt !== A && jl(O, Z, N, X, z, et, kt.x, kt.y) && Di(kt.prev, kt, kt.next) >= 0)
return !1;
kt = kt.prevZ;
}
for (; Bt && Bt.z <= $t; ) {
if (Bt.x >= st && Bt.x <= Tt && Bt.y >= ut && Bt.y <= bt && Bt !== L && Bt !== A && jl(O, Z, N, X, z, et, Bt.x, Bt.y) && Di(Bt.prev, Bt, Bt.next) >= 0)
return !1;
Bt = Bt.nextZ;
}
return !0;
}
function IJ(h, c) {
let p = h;
do {
const g = p.prev, L = p.next.next;
!Cp(g, L) && ZC(g, p, p.next, L) && Wc(g, L) && Wc(L, g) && (c.push(g.i, p.i, L.i), qc(p), qc(p.next), p = h = L), p = p.next;
} while (p !== h);
return j0(p);
}
function RJ(h, c, p, g, L, H) {
let A = h;
do {
let O = A.next.next;
for (; O !== A.prev; ) {
if (A.i !== O.i && jJ(A, O)) {
let N = WC(A, O);
return A = j0(A, A.next), N = j0(N, N.next), Zc(A, c, p, g, L, H, 0), void Zc(N, c, p, g, L, H, 0);
}
O = O.next;
}
A = A.next;
} while (A !== h);
}
function NJ(h, c) {
return h.x - c.x;
}
function DJ(h, c) {
const p = function(L, H) {
let A = H;
const O = L.x, N = L.y;
let z, Z = -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 <= O && Tt > Z && (Z = Tt, z = A.x < A.next.x ? A : A.next, Tt === O))
return z;
}
A = A.next;
} while (A !== H);
if (!z)
return null;
const X = z, et = z.x, st = z.y;
let ut = 1 / 0;
A = z;
do {
if (O >= A.x && A.x >= et && O !== A.x && jl(N < st ? O : Z, N, et, st, N < st ? Z : O, N, A.x, A.y)) {
const Tt = Math.abs(N - A.y) / (O - A.x);
Wc(A, L) && (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 = WC(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 O_(h, c, p, g, L) {
return (h = 1431655765 & ((h = 858993459 & ((h = 252645135 & ((h = 16711935 & ((h = (h - p) * L | 0) | h << 8)) | h << 4)) | h << 2)) | h << 1)) | (c = 1431655765 & ((c = 858993459 & ((c = 252645135 & ((c = 16711935 & ((c = (c - g) * L | 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, L, H, A, O) {
return (L - A) * (c - O) >= (h - A) * (H - O) && (h - A) * (g - O) >= (p - A) * (c - O) && (p - A) * (H - O) >= (L - A) * (g - O);
}
function jJ(h, c) {
return h.next.i !== c.i && h.prev.i !== c.i && !function(p, g) {
let L = p;
do {
if (L.i !== p.i && L.next.i !== p.i && L.i !== g.i && L.next.i !== g.i && ZC(L, L.next, p, g))
return !0;
L = L.next;
} while (L !== p);
return !1;
}(h, c) && (Wc(h, c) && Wc(c, h) && function(p, g) {
let L = p, H = !1;
const A = (p.x + g.x) / 2, O = (p.y + g.y) / 2;
do
L.y > O != L.next.y > O && L.next.y !== L.y && A < (L.next.x - L.x) * (O - L.y) / (L.next.y - L.y) + L.x && (H = !H), L = L.next;
while (L !== p);
return H;
}(h, c) && (Di(h.prev, h, c.prev) || Di(h, c.prev, c)) || Cp(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 Cp(h, c) {
return h.x === c.x && h.y === c.y;
}
function ZC(h, c, p, g) {
const L = Pp(Di(h, c, p)), H = Pp(Di(h, c, g)), A = Pp(Di(p, g, h)), O = Pp(Di(p, g, c));
return L !== H && A !== O || !(L !== 0 || !Op(h, p, c)) || !(H !== 0 || !Op(h, g, c)) || !(A !== 0 || !Op(p, h, g)) || !(O !== 0 || !Op(p, c, g));
}
function Op(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 Pp(h) {
return h > 0 ? 1 : h < 0 ? -1 : 0;
}
function Wc(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 WC(h, c) {
const p = P_(h.i, h.x, h.y), g = P_(c.i, c.x, c.y), L = h.next, H = c.prev;
return h.next = c, c.prev = h, p.next = L, L.prev = p, g.next = p, p.prev = g, H.next = g, g.prev = H, g;
}
function qC(h, c, p, g) {
const L = P_(h, c, p);
return g ? (L.next = g.next, L.prev = g, g.next.prev = L, g.next = L) : (L.prev = L, L.next = L), L;
}
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 P_(h, c, p) {
return { i: h, x: c, y: p, prev: null, next: null, z: 0, prevZ: null, nextZ: null, steiner: !1 };
}
function k_(h, c, p) {
const g = p.patternDependencies;
let L = !1;
for (const H of c) {
const A = H.paint.get(`${h}-pattern`);
A.isConstant() || (L = !0);
const O = A.constantOr(null);
O && (L = !0, g[O.to] = !0, g[O.from] = !0);
}
return L;
}
function V_(h, c, p, g, L) {
const H = L.patternDependencies;
for (const A of c) {
const O = A.paint.get(`${h}-pattern`).value;
if (O.kind !== "constant") {
let N = O.evaluate({ zoom: g - 1 }, p, {}, L.availableImages), z = O.evaluate({ zoom: g }, p, {}, L.availableImages), Z = O.evaluate({ zoom: g + 1 }, p, {}, L.availableImages);
N = N && N.name ? N.name : N, z = z && z.name ? z.name : z, Z = Z && Z.name ? Z.name : Z, H[N] = !0, H[z] = !0, H[Z] = !0, p.patterns[A.id] = { min: N, mid: z, max: Z };
}
}
return p;
}
class I_ {
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 O2(), 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 = k_("fill", this.layers, p);
const L = this.layers[0].layout.get("fill-sort-key"), H = !L.isConstant(), A = [];
for (const { feature: O, id: N, index: z, sourceLayerIndex: Z } of c) {
const X = this.layers[0]._featureFilter.needGeometry, et = B0(O, X);
if (!this.layers[0]._featureFilter.filter(new ti(this.zoom), et, g))
continue;
const st = H ? L.evaluate(et, {}, g, p.availableImages) : void 0, ut = { id: N, properties: O.properties, type: O.type, sourceLayerIndex: Z, index: z, geometry: X ? et.geometry : F0(O), patterns: {}, sortKey: st };
A.push(ut);
}
H && A.sort((O, N) => O.sortKey - N.sortKey);
for (const O of A) {
const { geometry: N, index: z, sourceLayerIndex: Z } = O;
if (this.hasPattern) {
const X = V_("fill", this.layers, O, this.zoom, p);
this.patternFeatures.push(X);
} else
this.addFeature(O, N, z, g, {});
p.featureIndex.insert(c[z].feature, N, z, Z, this.index);
}
}
update(c, p, g) {
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(c, p, this.stateDependentLayers, g);
}
addFeatures(c, p, g) {
for (const L of this.patternFeatures)
this.addFeature(L, L.geometry, L.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, PJ), 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, L, H) {
for (const A of U4(p, 500)) {
let O = 0;
for (const st of A)
O += st.length;
const N = this.segments.prepareSegment(O, this.layoutVertexArray, this.indexArray), z = N.vertexLength, Z = [], X = [];
for (const st of A) {
if (st.length === 0)
continue;
st !== A[0] && X.push(Z.length / 2);
const ut = this.segments2.prepareSegment(st.length, this.layoutVertexArray, this.indexArray2), Tt = ut.vertexLength;
this.layoutVertexArray.emplaceBack(st[0].x, st[0].y), this.indexArray2.emplaceBack(Tt + st.length - 1, Tt), Z.push(st[0].x), Z.push(st[0].y);
for (let bt = 1; bt < st.length; bt++)
this.layoutVertexArray.emplaceBack(st[bt].x, st[bt].y), this.indexArray2.emplaceBack(Tt + bt - 1, Tt + bt), Z.push(st[bt].x), Z.push(st[bt].y);
ut.vertexLength += st.length, ut.primitiveLength += st.length;
}
const et = GC(Z, X);
for (let st = 0; st < et.length; st += 3)
this.indexArray.emplaceBack(z + et[st], z + et[st + 1], z + et[st + 2]);
N.vertexLength += O, N.primitiveLength += et.length / 3;
}
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, c, g, H, L);
}
}
let XC, KC;
nr("FillBucket", I_, { omit: ["layers", "patternFeatures"] });
var zJ = { get paint() {
return KC = KC || new E({ "fill-antialias": new cr(Ot.paint_fill["fill-antialias"]), "fill-opacity": new Mr(Ot.paint_fill["fill-opacity"]), "fill-color": new Mr(Ot.paint_fill["fill-color"]), "fill-outline-color": new Mr(Ot.paint_fill["fill-outline-color"]), "fill-translate": new cr(Ot.paint_fill["fill-translate"]), "fill-translate-anchor": new cr(Ot.paint_fill["fill-translate-anchor"]), "fill-pattern": new Ol(Ot.paint_fill["fill-pattern"]) });
}, get layout() {
return XC = XC || new E({ "fill-sort-key": new Mr(Ot.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 I_(c);
}
queryRadius() {
return Sp(this.paint.get("fill-translate"));
}
queryIntersectsFeature(c, p, g, L, H, A, O) {
return PC(Hp(c, this.paint.get("fill-translate"), this.paint.get("fill-translate-anchor"), A.angle, O), L);
}
isTileClipped() {
return !0;
}
}
const GJ = I([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_normal_ed", components: 4, type: "Int16" }], 4), $J = I([{ name: "a_centroid", components: 2, type: "Int16" }], 4), { members: ZJ } = GJ;
var d6 = {}, WJ = d, YC = zl;
function zl(h, c, p, g, L) {
this.properties = {}, this.extent = p, this.type = 0, this._pbf = h, this._geometry = -1, this._keys = g, this._values = L, h.readFields(qJ, this, c);
}
function qJ(h, c, p) {
h == 1 ? c.id = p.readVarint() : h == 2 ? function(g, L) {
for (var H = g.readVarint() + g.pos; g.pos < H; ) {
var A = L._keys[g.readVarint()], O = L._values[g.readVarint()];
L.properties[A] = O;
}
}(p, c) : h == 3 ? c.type = p.readVarint() : h == 4 && (c._geometry = p.pos);
}
function XJ(h) {
for (var c, p, g = 0, L = 0, H = h.length, A = H - 1; L < H; A = L++)
g += ((p = h[A]).x - (c = h[L]).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, L = 0, H = 0, A = 0, O = []; h.pos < p; ) {
if (L <= 0) {
var N = h.readVarint();
g = 7 & N, L = N >> 3;
}
if (L--, g === 1 || g === 2)
H += h.readSVarint(), A += h.readSVarint(), g === 1 && (c && O.push(c), c = []), c.push(new WJ(H, A));
else {
if (g !== 7)
throw new Error("unknown command " + g);
c && c.push(c[0].clone());
}
}
return c && O.push(c), O;
}, zl.prototype.bbox = function() {
var h = this._pbf;
h.pos = this._geometry;
for (var c = h.readVarint() + h.pos, p = 1, g = 0, L = 0, H = 0, A = 1 / 0, O = -1 / 0, N = 1 / 0, z = -1 / 0; h.pos < c; ) {
if (g <= 0) {
var Z = h.readVarint();
p = 7 & Z, g = Z >> 3;
}
if (g--, p === 1 || p === 2)
(L += h.readSVarint()) < A && (A = L), L > O && (O = L), (H += h.readSVarint()) < N && (N = H), H > z && (z = H);
else if (p !== 7)
throw new Error("unknown command " + p);
}
return [A, N, O, z];
}, zl.prototype.toGeoJSON = function(h, c, p) {
var g, L, H = this.extent * Math.pow(2, p), A = this.extent * h, O = this.extent * c, N = this.loadGeometry(), z = zl.types[this.type];
function Z(st) {
for (var ut = 0; ut < st.length; ut++) {
var Tt = st[ut];
st[ut] = [360 * (Tt.x + A) / H - 180, 360 / Math.PI * Math.atan(Math.exp((180 - 360 * (Tt.y + O) / H) * Math.PI / 180)) - 90];
}
}
switch (this.type) {
case 1:
var X = [];
for (g = 0; g < N.length; g++)
X[g] = N[g][0];
Z(N = X);
break;
case 2:
for (g = 0; g < N.length; g++)
Z(N[g]);
break;
case 3:
for (N = function(st) {
var ut = st.length;
if (ut <= 1)
return [st];
for (var Tt, bt, Mt = [], $t = 0; $t < ut; $t++) {
var kt = XJ(st[$t]);
kt !== 0 && (bt === void 0 && (bt = kt < 0), bt === kt < 0 ? (Tt && Mt.push(Tt), Tt = [st[$t]]) : Tt.push(st[$t]));
}
return Tt && Mt.push(Tt), Mt;
}(N), g = 0; g < N.length; g++)
for (L = 0; L < N[g].length; L++)
Z(N[g][L]);
}
N.length === 1 ? N = N[0] : z = "Multi" + z;
var et = { type: "Feature", geometry: { type: z, coordinates: N }, properties: this.properties };
return "id" in this && (et.id = this.id), et;
};
var KJ = YC, JC = tO;
function tO(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 L = null, H = g.readVarint() + g.pos; g.pos < H; ) {
var A = g.readVarint() >> 3;
L = 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 L;
}(p));
}
tO.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 = JC;
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 = YC, d6.VectorTileLayer = JC;
const ett = d6.VectorTileFeature.types, R_ = Math.pow(2, 13);
function Xc(h, c, p, g, L, H, A, O) {
h.emplaceBack(c, p, 2 * Math.floor(g * R_) + A, L * R_ * 2, H * R_ * 2, Math.round(O));
}
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 P1(), this.indexArray = new O2(), 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 = k_("fill-extrusion", this.layers, p);
for (const { feature: L, id: H, index: A, sourceLayerIndex: O } of c) {
const N = this.layers[0]._featureFilter.needGeometry, z = B0(L, N);
if (!this.layers[0]._featureFilter.filter(new ti(this.zoom), z, g))
continue;
const Z = { id: H, sourceLayerIndex: O, index: A, geometry: N ? z.geometry : F0(L), properties: L.properties, type: L.type, patterns: {} };
this.hasPattern ? this.features.push(V_("fill-extrusion", this.layers, Z, this.zoom, p)) : this.addFeature(Z, Z.geometry, A, g, {}), p.featureIndex.insert(L, Z.geometry, A, O, this.index, !0);
}
}
addFeatures(c, p, g) {
for (const L of this.features) {
const { geometry: H } = L;
this.addFeature(L, H, L.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, ZJ), 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, L, H) {
for (const A of U4(p, 500)) {
const O = { 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 bt = 0; bt < ut.length; bt++) {
const Mt = ut[bt];
if (bt >= 1) {
const $t = ut[bt - 1];
if (!rtt(Mt, $t)) {
z.vertexLength + 4 > an.MAX_VERTEX_ARRAY_LENGTH && (z = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray));
const kt = Mt.sub($t)._perp()._unit(), Bt = $t.dist(Mt);
Tt + Bt > 32768 && (Tt = 0), Xc(this.layoutVertexArray, Mt.x, Mt.y, kt.x, kt.y, 0, 0, Tt), Xc(this.layoutVertexArray, Mt.x, Mt.y, kt.x, kt.y, 0, 1, Tt), O.x += 2 * Mt.x, O.y += 2 * Mt.y, O.vertexCount += 2, Tt += Bt, Xc(this.layoutVertexArray, $t.x, $t.y, kt.x, kt.y, 0, 0, Tt), Xc(this.layoutVertexArray, $t.x, $t.y, kt.x, kt.y, 0, 1, Tt), O.x += 2 * $t.x, O.y += 2 * $t.y, O.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 Z = [], X = [], et = z.vertexLength;
for (const ut of A)
if (ut.length !== 0) {
ut !== A[0] && X.push(Z.length / 2);
for (let Tt = 0; Tt < ut.length; Tt++) {
const bt = ut[Tt];
Xc(this.layoutVertexArray, bt.x, bt.y, 0, 0, 1, 1, 0), O.x += bt.x, O.y += bt.y, O.vertexCount += 1, Z.push(bt.x), Z.push(bt.y);
}
}
const st = GC(Z, X);
for (let ut = 0; ut < st.length; ut += 3)
this.indexArray.emplaceBack(et + st[ut], et + st[ut + 2], et + st[ut + 1]);
z.primitiveLength += st.length / 3, z.vertexLength += N;
for (let ut = 0; ut < O.vertexCount; ut++) {
const Tt = Math.floor(O.x / O.vertexCount), bt = Math.floor(O.y / O.vertexCount);
this.centroidVertexArray.emplaceBack(Tt, bt);
}
}
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, c, g, H, L);
}
}
function rtt(h, c) {
return h.x === c.x && (h.x < 0 || h.x > Wi) || h.y === c.y && (h.y < 0 || h.y > Wi);
}
function ntt(h) {
return h.every((c) => c.x < 0) || h.every((c) => c.x > Wi) || h.every((c) => c.y < 0) || h.every((c) => c.y > Wi);
}
let eO;
nr("FillExtrusionBucket", N_, { omit: ["layers", "features"] });
var itt = { get paint() {
return eO = eO || new E({ "fill-extrusion-opacity": new cr(Ot["paint_fill-extrusion"]["fill-extrusion-opacity"]), "fill-extrusion-color": new Mr(Ot["paint_fill-extrusion"]["fill-extrusion-color"]), "fill-extrusion-translate": new cr(Ot["paint_fill-extrusion"]["fill-extrusion-translate"]), "fill-extrusion-translate-anchor": new cr(Ot["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]), "fill-extrusion-pattern": new Ol(Ot["paint_fill-extrusion"]["fill-extrusion-pattern"]), "fill-extrusion-height": new Mr(Ot["paint_fill-extrusion"]["fill-extrusion-height"]), "fill-extrusion-base": new Mr(Ot["paint_fill-extrusion"]["fill-extrusion-base"]), "fill-extrusion-vertical-gradient": new cr(Ot["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, L, H, A, O, N) {
const z = Hp(c, this.paint.get("fill-extrusion-translate"), this.paint.get("fill-extrusion-translate-anchor"), A.angle, O), Z = this.paint.get("fill-extrusion-height").evaluate(p, g), X = this.paint.get("fill-extrusion-base").evaluate(p, g), et = function(ut, Tt, bt, Mt) {
const $t = [];
for (const kt of ut) {
const Bt = [kt.x, kt.y, 0, 1];
Ap(Bt, Bt, Tt), $t.push(new f(Bt[0] / Bt[3], Bt[1] / Bt[3]));
}
return $t;
}(z, N), st = function(ut, Tt, bt, Mt) {
const $t = [], kt = [], Bt = Mt[8] * Tt, ee = Mt[9] * Tt, _e = Mt[10] * Tt, Xe = Mt[11] * Tt, xr = Mt[8] * bt, ze = Mt[9] * bt, Re = Mt[10] * bt, Qr = Mt[11] * bt;
for (const sr of ut) {
const rr = [], ue = [];
for (const gr of sr) {
const pr = gr.x, Pr = gr.y, Fn = Mt[0] * pr + Mt[4] * Pr + Mt[12], Vn = Mt[1] * pr + Mt[5] * Pr + Mt[13], p1 = Mt[2] * pr + Mt[6] * Pr + Mt[14], gs = Mt[3] * pr + Mt[7] * Pr + Mt[15], I1 = p1 + _e, T1 = gs + Xe, yo = Fn + xr, vo = Vn + ze, _o = p1 + Re, Ci = gs + Qr, f1 = new f((Fn + Bt) / T1, (Vn + ee) / T1);
f1.z = I1 / T1, rr.push(f1);
const K1 = new f(yo / Ci, vo / Ci);
K1.z = _o / Ci, ue.push(K1);
}
$t.push(rr), kt.push(ue);
}
return [$t, kt];
}(L, X, Z, N);
return function(ut, Tt, bt) {
let Mt = 1 / 0;
PC(bt, Tt) && (Mt = rO(bt, Tt[0]));
for (let $t = 0; $t < Tt.length; $t++) {
const kt = Tt[$t], Bt = ut[$t];
for (let ee = 0; ee < kt.length - 1; ee++) {
const _e = kt[ee], Xe = [_e, kt[ee + 1], Bt[ee + 1], Bt[ee], _e];
OC(bt, Xe) && (Mt = Math.min(Mt, rO(bt, Xe)));
}
}
return Mt !== 1 / 0 && Mt;
}(st[0], st[1], et);
}
}
function Kc(h, c) {
return h.x * c.x + h.y * c.y;
}
function rO(h, c) {
if (h.length === 1) {
let p = 0;
const g = c[p++];
let L;
for (; !L || g.equals(L); )
if (L = c[p++], !L)
return 1 / 0;
for (; p < c.length; p++) {
const H = c[p], A = h[0], O = L.sub(g), N = H.sub(g), z = A.sub(g), Z = Kc(O, O), X = Kc(O, N), et = Kc(N, N), st = Kc(z, O), ut = Kc(z, N), Tt = Z * et - X * X, bt = (et * st - X * ut) / Tt, Mt = (Z * ut - X * st) / Tt, $t = g.z * (1 - bt - Mt) + L.z * bt + H.z * Mt;
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 = I([{ name: "a_pos_normal", components: 2, type: "Int16" }, { name: "a_data", components: 4, type: "Uint8" }], 4), { members: att } = stt, ltt = I([{ 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), nO = 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 kl(), this.layoutVertexArray2 = new a6(), this.indexArray = new O2(), 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 = k_("line", this.layers, p);
const L = this.layers[0].layout.get("line-sort-key"), H = !L.isConstant(), A = [];
for (const { feature: O, id: N, index: z, sourceLayerIndex: Z } of c) {
const X = this.layers[0]._featureFilter.needGeometry, et = B0(O, X);
if (!this.layers[0]._featureFilter.filter(new ti(this.zoom), et, g))
continue;
const st = H ? L.evaluate(et, {}, g) : void 0, ut = { id: N, properties: O.properties, type: O.type, sourceLayerIndex: Z, index: z, geometry: X ? et.geometry : F0(O), patterns: {}, sortKey: st };
A.push(ut);
}
H && A.sort((O, N) => O.sortKey - N.sortKey);
for (const O of A) {
const { geometry: N, index: z, sourceLayerIndex: Z } = O;
if (this.hasPattern) {
const X = V_("line", this.layers, O, this.zoom, p);
this.patternFeatures.push(X);
} else
this.addFeature(O, N, z, g, {});
p.featureIndex.insert(c[z].feature, N, z, Z, this.index);
}
}
update(c, p, g) {
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(c, p, this.stateDependentLayers, g);
}
addFeatures(c, p, g) {
for (const L of this.patternFeatures)
this.addFeature(L, L.geometry, L.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, L, H) {
const A = this.layers[0].layout, O = A.get("line-join").evaluate(c, {}), N = A.get("line-cap"), z = A.get("line-miter-limit"), Z = A.get("line-round-limit");
this.lineClips = this.lineFeatureClips(c);
for (const X of p)
this.addLine(X, c, O, N, z, Z);
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, c, g, H, L);
}
addLine(c, p, g, L, H, A) {
if (this.distance = 0, this.scaledDistance = 0, this.totalDistance = 0, this.lineClips) {
this.lineClipsArray.push(this.lineClips);
for (let Mt = 0; Mt < c.length - 1; Mt++)
this.totalDistance += c[Mt].dist(c[Mt + 1]);
this.updateScaledDistance(), this.maxLineLength = Math.max(this.maxLineLength, this.totalDistance);
}
const O = 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 < (O ? 3 : 2))
return;
g === "bevel" && (H = 1.05);
const Z = this.overscaling <= 16 ? 15 * Wi / (512 * this.overscaling) : 0, X = this.segments.prepareSegment(10 * N, this.layoutVertexArray, this.indexArray);
let et, st, ut, Tt, bt;
this.e1 = this.e2 = -1, O && (et = c[N - 2], bt = c[z].sub(et)._unit()._perp());
for (let Mt = z; Mt < N; Mt++) {
if (ut = Mt === N - 1 ? O ? c[z + 1] : void 0 : c[Mt + 1], ut && c[Mt].equals(ut))
continue;
bt && (Tt = bt), et && (st = et), et = c[Mt], bt = ut ? ut.sub(et)._unit()._perp() : Tt, Tt = Tt || bt;
let $t = Tt.add(bt);
$t.x === 0 && $t.y === 0 || $t._unit();
const kt = Tt.x * bt.x + Tt.y * bt.y, Bt = $t.x * bt.x + $t.y * bt.y, ee = Bt !== 0 ? 1 / Bt : 1 / 0, _e = 2 * Math.sqrt(2 - 2 * Bt), Xe = Bt < htt && st && ut, xr = Tt.x * bt.y - Tt.y * bt.x > 0;
if (Xe && Mt > z) {
const Qr = et.dist(st);
if (Qr > 2 * Z) {
const sr = et.sub(et.sub(st)._mult(Z / Qr)._round());
this.updateDistance(st, sr), this.addCurrentVertex(sr, Tt, 0, 0, X), st = sr;
}
}
const ze = st && ut;
let Re = ze ? g : O ? "butt" : L;
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")), st && this.updateDistance(st, et), Re === "miter")
$t._mult(ee), this.addCurrentVertex(et, $t, 0, 0, X);
else if (Re === "flipbevel") {
if (ee > 100)
$t = bt.mult(-1);
else {
const Qr = ee * Tt.add(bt).mag() / Tt.sub(bt).mag();
$t._perp()._mult(Qr * (xr ? -1 : 1));
}
this.addCurrentVertex(et, $t, 0, 0, X), this.addCurrentVertex(et, $t.mult(-1), 0, 0, X);
} else if (Re === "bevel" || Re === "fakeround") {
const Qr = -Math.sqrt(ee * ee - 1), sr = xr ? Qr : 0, rr = xr ? 0 : Qr;
if (st && this.addCurrentVertex(et, 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 + kt * (kt * (3.55645 - 1.43519 * kt) - 3.2452)) * Fn * Fn + (0.848013 + kt * (0.215638 * kt - 1.06021)));
}
const Pr = bt.sub(Tt)._mult(pr)._add(Tt)._unit()._mult(xr ? -1 : 1);
this.addHalfVertex(et, Pr.x, Pr.y, !1, xr, 0, X);
}
}
ut && this.addCurrentVertex(et, bt, -sr, -rr, X);
} else if (Re === "butt")
this.addCurrentVertex(et, $t, 0, 0, X);
else if (Re === "square") {
const Qr = st ? 1 : -1;
this.addCurrentVertex(et, $t, Qr, Qr, X);
} else
Re === "round" && (st && (this.addCurrentVertex(et, Tt, 0, 0, X), this.addCurrentVertex(et, Tt, 1, 1, X, !0)), ut && (this.addCurrentVertex(et, bt, -1, -1, X, !0), this.addCurrentVertex(et, bt, 0, 0, X)));
if (Xe && Mt < N - 1) {
const Qr = et.dist(ut);
if (Qr > 2 * Z) {
const sr = et.add(ut.sub(et)._mult(Z / Qr)._round());
this.updateDistance(et, sr), this.addCurrentVertex(sr, bt, 0, 0, X), et = sr;
}
}
}
}
addCurrentVertex(c, p, g, L, H, A = !1) {
const O = p.y * L - p.x, N = -p.y - p.x * L;
this.addHalfVertex(c, p.x + p.y * g, p.y - p.x * g, A, !1, g, H), this.addHalfVertex(c, O, N, A, !0, -L, H), this.distance > nO / 2 && this.totalDistance === 0 && (this.distance = 0, this.updateScaledDistance(), this.addCurrentVertex(c, p, g, L, H, A));
}
addHalfVertex({ x: c, y: p }, g, L, H, A, O, N) {
const z = 0.5 * (this.lineClips ? this.scaledDistance * (nO - 1) : this.scaledDistance);
this.layoutVertexArray.emplaceBack((c << 1) + (H ? 1 : 0), (p << 1) + (A ? 1 : 0), Math.round(63 * g) + 128, Math.round(63 * L) + 128, 1 + (O === 0 ? 0 : O < 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 Z = N.vertexLength++;
this.e1 >= 0 && this.e2 >= 0 && (this.indexArray.emplaceBack(this.e1, this.e2, Z), N.primitiveLength++), A ? this.e2 = Z : this.e1 = Z;
}
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 iO, oO;
nr("LineBucket", D_, { omit: ["layers", "patternFeatures"] });
var sO = { get paint() {
return oO = oO || new E({ "line-opacity": new Mr(Ot.paint_line["line-opacity"]), "line-color": new Mr(Ot.paint_line["line-color"]), "line-translate": new cr(Ot.paint_line["line-translate"]), "line-translate-anchor": new cr(Ot.paint_line["line-translate-anchor"]), "line-width": new Mr(Ot.paint_line["line-width"]), "line-gap-width": new Mr(Ot.paint_line["line-gap-width"]), "line-offset": new Mr(Ot.paint_line["line-offset"]), "line-blur": new Mr(Ot.paint_line["line-blur"]), "line-dasharray": new Pl(Ot.paint_line["line-dasharray"]), "line-pattern": new Ol(Ot.paint_line["line-pattern"]), "line-gradient": new Bc(Ot.paint_line["line-gradient"]) });
}, get layout() {
return iO = iO || new E({ "line-cap": new cr(Ot.layout_line["line-cap"]), "line-join": new Mr(Ot.layout_line["line-join"]), "line-miter-limit": new cr(Ot.layout_line["line-miter-limit"]), "line-round-limit": new cr(Ot.layout_line["line-round-limit"]), "line-sort-key": new Mr(Ot.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, L) {
return p = $({}, p, { zoom: Math.floor(p.zoom) }), super.evaluate(c, p, g, L);
}
}
let kp;
class ptt extends m {
constructor(c) {
super(c, sO), this.gradientVersion = 0, kp || (kp = new dtt(sO.paint.properties["line-width"].specification), kp.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"] = kp.possiblyEvaluate(this._transitioningPaint._values["line-width"].value, c);
}
createBucket(c) {
return new D_(c);
}
queryRadius(c) {
const p = c, g = aO(Uc("line-width", this, p), Uc("line-gap-width", this, p)), L = Uc("line-offset", this, p);
return g / 2 + Math.abs(L) + Sp(this.paint.get("line-translate"));
}
queryIntersectsFeature(c, p, g, L, H, A, O) {
const N = Hp(c, this.paint.get("line-translate"), this.paint.get("line-translate-anchor"), A.angle, O), z = O / 2 * aO(this.paint.get("line-width").evaluate(p, g), this.paint.get("line-gap-width").evaluate(p, g)), Z = this.paint.get("line-offset").evaluate(p, g);
return Z && (L = function(X, et) {
const st = [];
for (let ut = 0; ut < X.length; ut++) {
const Tt = X[ut], bt = [];
for (let Mt = 0; Mt < Tt.length; Mt++) {
const $t = Tt[Mt - 1], kt = Tt[Mt], Bt = Tt[Mt + 1], ee = Mt === 0 ? new f(0, 0) : kt.sub($t)._unit()._perp(), _e = Mt === Tt.length - 1 ? new f(0, 0) : Bt.sub(kt)._unit()._perp(), Xe = ee._add(_e)._unit(), xr = Xe.x * _e.x + Xe.y * _e.y;
xr !== 0 && Xe._mult(1 / xr), bt.push(Xe._mult(et)._add(kt));
}
st.push(bt);
}
return st;
}(L, Z * O)), function(X, et, st) {
for (let ut = 0; ut < et.length; ut++) {
const Tt = et[ut];
if (X.length >= 3) {
for (let bt = 0; bt < Tt.length; bt++)
if (Fl(X, Tt[bt]))
return !0;
}
if (bJ(X, Tt, st))
return !0;
}
return !1;
}(N, L, z);
}
isTileClipped() {
return !0;
}
}
function aO(h, c) {
return c > 0 ? c + 2 * h : h;
}
const Ttt = I([{ name: "a_pos_offset", components: 4, type: "Int16" }, { name: "a_data", components: 4, type: "Uint16" }, { name: "a_pixeloffset", components: 4, type: "Int16" }], 4), ftt = I([{ name: "a_projected_pos", components: 3, type: "Float32" }], 4);
I([{ name: "a_fade_opacity", components: 1, type: "Uint32" }], 4);
const Qtt = I([{ name: "a_placed", components: 2, type: "Uint8" }, { name: "a_shift", components: 2, type: "Float32" }, { name: "a_box_real", components: 2, type: "Int16" }]);
I([{ 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 lO = I([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_anchor_pos", components: 2, type: "Int16" }, { name: "a_extrude", components: 2, type: "Int16" }], 4), mtt = I([{ 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(L, H, A) {
const O = H.layout.get("text-transform").evaluate(A, {});
return O === "uppercase" ? L = L.toLocaleUpperCase() : O === "lowercase" && (L = L.toLocaleLowerCase()), Io.applyArabicShaping && (L = Io.applyArabicShaping(L)), L;
}(g.text, c, p);
}), h;
}
I([{ name: "triangle", components: 3, type: "Uint16" }]), I([{ 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" }]), I([{ 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" }]), I([{ type: "Float32", name: "offsetX" }]), I([{ type: "Int16", name: "x" }, { type: "Int16", name: "y" }, { type: "Int16", name: "tileUnitDistanceFromAnchor" }]), I([{ type: "Uint16", name: "textAnchor" }, { type: "Float32", components: 2, name: "textOffset" }]);
const Yc = { "!": "︕", "#": "#", $: "$", "%": "%", "&": "&", "(": "︵", ")": "︶", "*": "*", "+": "+", ",": "︐", "-": "︲", ".": "・", "/": "/", ":": "︓", ";": "︔", "<": "︿", "=": "=", ">": "﹀", "?": "︖", "@": "@", "[": "﹇", "\\": "\", "]": "﹈", "^": "^", _: "︳", "`": "`", "{": "︷", "|": "―", "}": "︸", "~": "~", "¢": "¢", "£": "£", "¥": "¥", "¦": "¦", "¬": "¬", "¯": " ̄", "–": "︲", "—": "︱", "‘": "﹃", "’": "﹄", "“": "﹁", "”": "﹂", "…": "︙", "‧": "・", "₩": "₩", "、": "︑", "。": "︒", "〈": "︿", "〉": "﹀", "《": "︽", "》": "︾", "「": "﹁", "」": "﹂", "『": "﹃", "』": "﹄", "【": "︻", "】": "︼", "〔": "︹", "〕": "︺", "〖": "︗", "〗": "︘", "!": "︕", "(": "︵", ")": "︶", ",": "︐", "-": "︲", ".": "・", ":": "︓", ";": "︔", "<": "︿", ">": "﹀", "?": "︖", "[": "﹇", "]": "﹈", "_": "︳", "{": "︷", "|": "―", "}": "︸", "⦅": "︵", "⦆": "︶", "。": "︒", "「": "﹁", "」": "﹂" };
var r1 = 24, cO = kn, uO = function(h, c, p, g, L) {
var H, A, O = 8 * L - g - 1, N = (1 << O) - 1, z = N >> 1, Z = -7, X = L - 1, et = -1, st = h[c + X];
for (X += et, H = st & (1 << -Z) - 1, st >>= -Z, Z += O; Z > 0; H = 256 * H + h[c + X], X += et, Z -= 8)
;
for (A = H & (1 << -Z) - 1, H >>= -Z, Z += g; Z > 0; A = 256 * A + h[c + X], X += et, Z -= 8)
;
if (H === 0)
H = 1 - z;
else {
if (H === N)
return A ? NaN : 1 / 0 * (st ? -1 : 1);
A += Math.pow(2, g), H -= z;
}
return (st ? -1 : 1) * A * Math.pow(2, H - g);
}, hO = function(h, c, p, g, L, H) {
var A, O, N, z = 8 * H - L - 1, Z = (1 << z) - 1, X = Z >> 1, et = L === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, st = 0, ut = 1, Tt = c < 0 || c === 0 && 1 / c < 0 ? 1 : 0;
for (c = Math.abs(c), isNaN(c) || c === 1 / 0 ? (O = isNaN(c) ? 1 : 0, A = Z) : (A = Math.floor(Math.log(c) / Math.LN2), c * (N = Math.pow(2, -A)) < 1 && (A--, N *= 2), (c += A + X >= 1 ? et / N : et * Math.pow(2, 1 - X)) * N >= 2 && (A++, N /= 2), A + X >= Z ? (O = 0, A = Z) : A + X >= 1 ? (O = (c * N - 1) * Math.pow(2, L), A += X) : (O = c * Math.pow(2, X - 1) * Math.pow(2, L), A = 0)); L >= 8; h[p + st] = 255 & O, st += ut, O /= 256, L -= 8)
;
for (A = A << L | O, z += L; z > 0; h[p + st] = 255 & A, st += ut, A /= 256, z -= 8)
;
h[p + st - ut] |= 128 * Tt;
};
function kn(h) {
this.buf = ArrayBuffer.isView && ArrayBuffer.isView(h) ? h : new Uint8Array(h || 0), this.pos = 0, this.type = 0, this.length = this.buf.length;
}
kn.Varint = 0, kn.Fixed64 = 1, kn.Bytes = 2, kn.Fixed32 = 5;
var F_ = 4294967296, dO = 1 / F_, pO = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8");
function z3(h) {
return h.type === kn.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 TO(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 L = p.pos - 1; L >= h; L--)
p.buf[L + g] = p.buf[L];
}
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 Mtt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeSFixed32(h[p]);
}
function Ett(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 Vp(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 fO(h, c) {
return (h[c] | h[c + 1] << 8 | h[c + 2] << 16) + (h[c + 3] << 24);
}
kn.prototype = { destroy: function() {
this.buf = null;
}, readFields: function(h, c, p) {
for (p = p || this.length; this.pos < p; ) {
var g = this.readVarint(), L = g >> 3, H = this.pos;
this.type = 7 & g, h(L, 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 = Vp(this.buf, this.pos);
return this.pos += 4, h;
}, readSFixed32: function() {
var h = fO(this.buf, this.pos);
return this.pos += 4, h;
}, readFixed64: function() {
var h = Vp(this.buf, this.pos) + Vp(this.buf, this.pos + 4) * F_;
return this.pos += 8, h;
}, readSFixed64: function() {
var h = Vp(this.buf, this.pos) + fO(this.buf, this.pos + 4) * F_;
return this.pos += 8, h;
}, readFloat: function() {
var h = uO(this.buf, this.pos, !0, 23, 4);
return this.pos += 4, h;
}, readDouble: function() {
var h = uO(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(L, H, A) {
var O, N, z = A.buf;
if (O = (112 & (N = z[A.pos++])) >> 4, N < 128 || (O |= (127 & (N = z[A.pos++])) << 3, N < 128) || (O |= (127 & (N = z[A.pos++])) << 10, N < 128) || (O |= (127 & (N = z[A.pos++])) << 17, N < 128) || (O |= (127 & (N = z[A.pos++])) << 24, N < 128) || (O |= (1 & (N = z[A.pos++])) << 31, N < 128))
return ytt(L, O, 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 && pO ? function(p, g, L) {
return pO.decode(p.subarray(g, L));
}(this.buf, c, h) : function(p, g, L) {
for (var H = "", A = g; A < L; ) {
var O, N, z, Z = p[A], X = null, et = Z > 239 ? 4 : Z > 223 ? 3 : Z > 191 ? 2 : 1;
if (A + et > L)
break;
et === 1 ? Z < 128 && (X = Z) : et === 2 ? (192 & (O = p[A + 1])) == 128 && (X = (31 & Z) << 6 | 63 & O) <= 127 && (X = null) : et === 3 ? (N = p[A + 2], (192 & (O = p[A + 1])) == 128 && (192 & N) == 128 && ((X = (15 & Z) << 12 | (63 & O) << 6 | 63 & N) <= 2047 || X >= 55296 && X <= 57343) && (X = null)) : et === 4 && (N = p[A + 2], z = p[A + 3], (192 & (O = p[A + 1])) == 128 && (192 & N) == 128 && (192 & z) == 128 && ((X = (15 & Z) << 18 | (63 & O) << 12 | (63 & N) << 6 | 63 & z) <= 65535 || X >= 1114112) && (X = null)), X === null ? (X = 65533, et = 1) : X > 65535 && (X -= 65536, H += String.fromCharCode(X >>> 10 & 1023 | 55296), X = 56320 | 1023 & X), H += String.fromCharCode(X), A += et;
}
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 !== kn.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 !== kn.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 !== kn.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 !== kn.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 !== kn.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 !== kn.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 !== kn.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 !== kn.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 !== kn.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 === kn.Varint)
for (; this.buf[this.pos++] > 127; )
;
else if (c === kn.Bytes)
this.pos = this.readVarint() + this.pos;
else if (c === kn.Fixed32)
this.pos += 4;
else {
if (c !== kn.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 * dO), 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 * dO), this.pos + 4), this.pos += 8;
}, writeVarint: function(h) {
(h = +h || 0) > 268435455 || h < 0 ? function(c, p) {
var g, L;
if (c >= 0 ? (g = c % 4294967296 | 0, L = c / 4294967296 | 0) : (L = ~(-c / 4294967296), 4294967295 ^ (g = ~(-c % 4294967296)) ? g = g + 1 | 0 : (g = 0, L = L + 1 | 0)), c >= 18446744073709552e3 || c < -18446744073709552e3)
throw new Error("Given varint doesn't fit into 10 bytes");
p.realloc(10), function(H, A, O) {
O.buf[O.pos++] = 127 & H | 128, H >>>= 7, O.buf[O.pos++] = 127 & H | 128, H >>>= 7, O.buf[O.pos++] = 127 & H | 128, H >>>= 7, O.buf[O.pos++] = 127 & H | 128, O.buf[O.pos] = 127 & (H >>>= 7);
}(g, 0, p), function(H, A) {
var O = (7 & H) << 4;
A.buf[A.pos++] |= O | ((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)))));
}(L, 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, L, H) {
for (var A, O, N = 0; N < L.length; N++) {
if ((A = L.charCodeAt(N)) > 55295 && A < 57344) {
if (!O) {
A > 56319 || N + 1 === L.length ? (g[H++] = 239, g[H++] = 191, g[H++] = 189) : O = A;
continue;
}
if (A < 56320) {
g[H++] = 239, g[H++] = 191, g[H++] = 189, O = A;
continue;
}
A = O - 55296 << 10 | A - 56320 | 65536, O = null;
} else
O && (g[H++] = 239, g[H++] = 191, g[H++] = 189, O = 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 && TO(c, p, this), this.pos = c - 1, this.writeVarint(p), this.pos += p;
}, writeFloat: function(h) {
this.realloc(4), hO(this.buf, h, this.pos, !0, 23, 4), this.pos += 4;
}, writeDouble: function(h) {
this.realloc(8), hO(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 && TO(p, g, this), this.pos = p - 1, this.writeVarint(g), this.pos += g;
}, writeMessage: function(h, c, p) {
this.writeTag(h, kn.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, Mtt, c);
}, writePackedFixed64: function(h, c) {
c.length && this.writeMessage(h, Ett, c);
}, writePackedSFixed64: function(h, c) {
c.length && this.writeMessage(h, Stt, c);
}, writeBytesField: function(h, c) {
this.writeTag(h, kn.Bytes), this.writeBytes(c);
}, writeFixed32Field: function(h, c) {
this.writeTag(h, kn.Fixed32), this.writeFixed32(c);
}, writeSFixed32Field: function(h, c) {
this.writeTag(h, kn.Fixed32), this.writeSFixed32(c);
}, writeFixed64Field: function(h, c) {
this.writeTag(h, kn.Fixed64), this.writeFixed64(c);
}, writeSFixed64Field: function(h, c) {
this.writeTag(h, kn.Fixed64), this.writeSFixed64(c);
}, writeVarintField: function(h, c) {
this.writeTag(h, kn.Varint), this.writeVarint(c);
}, writeSVarintField: function(h, c) {
this.writeTag(h, kn.Varint), this.writeSVarint(c);
}, writeStringField: function(h, c) {
this.writeTag(h, kn.Bytes), this.writeString(c);
}, writeFloatField: function(h, c) {
this.writeTag(h, kn.Fixed32), this.writeFloat(c);
}, writeDoubleField: function(h, c) {
this.writeTag(h, kn.Fixed64), this.writeDouble(c);
}, writeBooleanField: function(h, c) {
this.writeVarintField(h, !!c);
} };
var B_ = u(cO);
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: L, width: H, height: A, left: O, top: N, advance: z } = p.readMessage(Ctt, {});
c.push({ id: g, bitmap: new $c({ width: H + 2 * j_, height: A + 2 * j_ }, L), metrics: { width: H, height: A, left: O, top: N, advance: z } });
}
}
function Ctt(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 QO = j_;
function mO(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, O) => O.h - A.h);
const g = [{ x: 0, y: 0, w: Math.max(Math.ceil(Math.sqrt(c / 0.95)), p), h: 1 / 0 }];
let L = 0, H = 0;
for (const A of h)
for (let O = g.length - 1; O >= 0; O--) {
const N = g[O];
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), L = Math.max(L, A.x + A.w), A.w === N.w && A.h === N.h) {
const z = g.pop();
O < g.length && (g[O] = 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: L, h: H, fill: c / (L * H) || 0 };
}
const No = 1;
class z_ {
constructor(c, { pixelRatio: p, version: g, stretchX: L, stretchY: H, content: A, textFitWidth: O, textFitHeight: N }) {
this.paddedRect = c, this.pixelRatio = p, this.stretchX = L, this.stretchY = H, this.content = A, this.version = g, this.textFitWidth = O, 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 gO {
constructor(c, p) {
const g = {}, L = {};
this.haveRenderCallbacks = [];
const H = [];
this.addImages(c, g, H), this.addImages(p, L, H);
const { w: A, h: O } = mO(H), N = new P2({ width: A || 1, height: O || 1 });
for (const z in c) {
const Z = c[z], X = g[z].paddedRect;
P2.copy(Z.data, N, { x: 0, y: 0 }, { x: X.x + No, y: X.y + No }, Z.data);
}
for (const z in p) {
const Z = p[z], X = L[z].paddedRect, et = X.x + No, st = X.y + No, ut = Z.data.width, Tt = Z.data.height;
P2.copy(Z.data, N, { x: 0, y: 0 }, { x: et, y: st }, Z.data), P2.copy(Z.data, N, { x: 0, y: Tt - 1 }, { x: et, y: st - 1 }, { width: ut, height: 1 }), P2.copy(Z.data, N, { x: 0, y: 0 }, { x: et, y: st + Tt }, { width: ut, height: 1 }), P2.copy(Z.data, N, { x: ut - 1, y: 0 }, { x: et - 1, y: st }, { width: 1, height: Tt }), P2.copy(Z.data, N, { x: 0, y: 0 }, { x: et + ut, y: st }, { width: 1, height: Tt });
}
this.image = N, this.iconPositions = g, this.patternPositions = L;
}
addImages(c, p, g) {
for (const L in c) {
const H = c[L], A = { x: 0, y: 0, w: H.data.width + 2 * No, h: H.data.height + 2 * No };
g.push(A), p[L] = new z_(A, H), H.hasRenderCallback && this.haveRenderCallbacks.push(L);
}
}
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 [L, H] = c.tl;
g.update(p.data, void 0, { x: L, y: H });
}
}
var p6;
nr("ImagePosition", z_), nr("ImageAtlas", gO), 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 L = 0; L < c.sections.length; L++) {
const H = c.sections[L];
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 L = c.charCodeAt(g + 1) || null, H = c.charCodeAt(g - 1) || null;
p += L && _p(L) && !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 L = 0; L < c.text.length; ++L)
this.sectionIndex.push(g);
}
addImageSection(c) {
const p = c.image ? c.image.name : "";
if (p.length === 0)
return void Vt("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)) : Vt("Reached maximum number of images 6401");
}
getNextImageSectionCharCode() {
return this.imageSectionID ? this.imageSectionID >= 63743 ? null : ++this.imageSectionID : (this.imageSectionID = 57344, this.imageSectionID);
}
}
function Ip(h, c, p, g, L, H, A, O, N, z, Z, X, et, st, ut) {
const Tt = Gl.fromFeature(h, L);
let bt;
X === s.ah.vertical && Tt.verticalizePunctuation();
const { processBidirectionalText: Mt, processStyledBidirectionalText: $t } = Io;
if (Mt && Tt.sections.length === 1) {
bt = [];
const ee = Mt(Tt.toString(), U_(Tt, z, H, c, g, st));
for (const _e of ee) {
const Xe = new Gl();
Xe.text = _e, Xe.sections = Tt.sections;
for (let xr = 0; xr < _e.length; xr++)
Xe.sectionIndex.push(0);
bt.push(Xe);
}
} else if ($t) {
bt = [];
const ee = $t(Tt.text, Tt.sectionIndex, U_(Tt, z, H, c, g, st));
for (const _e of ee) {
const Xe = new Gl();
Xe.text = _e[0], Xe.sectionIndex = _e[1], Xe.sections = Tt.sections, bt.push(Xe);
}
} else
bt = function(ee, _e) {
const Xe = [], xr = ee.text;
let ze = 0;
for (const Re of _e)
Xe.push(ee.substring(ze, Re)), ze = Re;
return ze < xr.length && Xe.push(ee.substring(ze, xr.length)), Xe;
}(Tt, U_(Tt, z, H, c, g, st));
const kt = [], Bt = { positionedLines: kt, text: Tt.toString(), top: Z[1], bottom: Z[1], left: Z[0], right: Z[0], writingMode: X, iconsInText: !1, verticalizable: !1 };
return function(ee, _e, Xe, xr, ze, Re, Qr, sr, rr, ue, gr, pr) {
let Pr = 0, Fn = Jc, Vn = 0, p1 = 0;
const gs = sr === "right" ? 1 : sr === "left" ? 0 : 0.5;
let I1 = 0;
for (const Ci of ze) {
Ci.trim();
const f1 = Ci.getMaxScale(), K1 = (f1 - 1) * r1, R1 = { positionedGlyphs: [], lineOffset: 0 };
ee.positionedLines[I1] = R1;
const bo = R1.positionedGlyphs;
let N1 = 0;
if (!Ci.length()) {
Fn += Re, ++I1;
continue;
}
for (let Do = 0; Do < Ci.length(); Do++) {
const fn = Ci.getSection(Do), Un = Ci.getSectionIndex(Do), ii = Ci.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 I2 = xr[fn.imageName];
if (!I2)
continue;
Ha = fn.imageName, ee.iconsInText = ee.iconsInText || !0, ql = I2.paddedRect;
const L1 = I2.displaySize;
fn.scale = fn.scale * r1 / pr, xi = { width: L1[0], height: L1[1], left: No, top: -QO, 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 I2 = Xe[fn.fontStack], L1 = I2 && I2[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: Pr, y: Fn + a2, vertical: ys, scale: fn.scale, fontStack: fn.fontStack, sectionIndex: Un, metrics: xi, rect: ql }), Pr += Aa * fn.scale + ue) : (bo.push({ glyph: ii, imageName: Ha, x: Pr, y: Fn + a2, vertical: ys, scale: fn.scale, fontStack: fn.fontStack, sectionIndex: Un, metrics: xi, rect: ql }), Pr += xi.advance * fn.scale + ue);
}
bo.length !== 0 && (Vn = Math.max(Pr - ue, Vn), Vtt(bo, 0, bo.length - 1, gs, N1)), Pr = 0;
const V2 = Re * f1 + N1;
R1.lineOffset = Math.max(N1, K1), Fn += V2, p1 = Math.max(V2, p1), ++I1;
}
var T1;
const yo = Fn - Jc, { horizontalAlign: vo, verticalAlign: _o } = G_(Qr);
(function(Ci, f1, K1, R1, bo, N1, V2, Do, fn) {
const Un = (f1 - K1) * bo;
let ii = 0;
ii = N1 !== V2 ? -Do * R1 - Jc : (-R1 * fn + 0.5) * V2;
for (const a2 of Ci)
for (const xi of a2.positionedGlyphs)
xi.x += Un, xi.y += ii;
})(ee.positionedLines, gs, vo, _o, Vn, p1, Re, yo, ze.length), ee.top += -_o * yo, ee.bottom = ee.top + yo, ee.left += -vo * Vn, ee.right = ee.left + Vn;
}(Bt, c, p, g, bt, A, O, N, X, z, et, ut), !function(ee) {
for (const _e of ee)
if (_e.positionedGlyphs.length !== 0)
return !1;
return !0;
}(kt) && Bt;
}
const Rp = { 9: !0, 10: !0, 11: !0, 12: !0, 13: !0, 32: !0 }, Ott = { 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 }, Ptt = { 40: !0 };
function yO(h, c, p, g, L, H) {
if (c.imageName) {
const A = g[c.imageName];
return A ? A.displaySize[0] * c.scale * r1 / H + L : 0;
}
{
const A = p[c.fontStack], O = A && A[h];
return O ? O.metrics.advance * c.scale + L : 0;
}
}
function vO(h, c, p, g) {
const L = Math.pow(h - c, 2);
return g ? h < c ? L / 2 : 2 * L : L + Math.abs(p) * p;
}
function ktt(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 _O(h, c, p, g, L, H) {
let A = null, O = vO(c, p, L, H);
for (const N of g) {
const z = vO(c - N.x, p, L, H) + N.badness;
z <= O && (A = N, O = z);
}
return { index: h, x: c, priorBreak: A, badness: O };
}
function bO(h) {
return h ? bO(h.priorBreak).concat(h.index) : [];
}
function U_(h, c, p, g, L, H) {
if (!h)
return [];
const A = [], O = function(X, et, st, ut, Tt, bt) {
let Mt = 0;
for (let $t = 0; $t < X.length(); $t++) {
const kt = X.getSection($t);
Mt += yO(X.getCharCode($t), kt, ut, Tt, et, bt);
}
return Mt / Math.max(1, Math.ceil(Mt / st));
}(h, c, p, g, L, H), N = h.text.indexOf("") >= 0;
let z = 0;
for (let X = 0; X < h.length(); X++) {
const et = h.getSection(X), st = h.getCharCode(X);
if (Rp[st] || (z += yO(st, et, g, L, c, H)), X < h.length() - 1) {
const ut = !((Z = st) < 11904) && (!!sn["CJK Compatibility Forms"](Z) || !!sn["CJK Compatibility"](Z) || !!sn["CJK Strokes"](Z) || !!sn["CJK Symbols and Punctuation"](Z) || !!sn["Enclosed CJK Letters and Months"](Z) || !!sn["Halfwidth and Fullwidth Forms"](Z) || !!sn["Ideographic Description Characters"](Z) || !!sn["Vertical Forms"](Z) || vp.test(String.fromCodePoint(Z)));
(Ott[st] || ut || et.imageName || X !== h.length() - 2 && Ptt[h.getCharCode(X + 1)]) && A.push(_O(X + 1, z, O, A, ktt(st, h.getCharCode(X + 1), ut && N), !1));
}
}
var Z;
return bO(_O(h.length(), z, O, 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 Vtt(h, c, p, g, L) {
if (!g && !L)
return;
const H = h[p], A = (h[p].x + H.metrics.advance * H.scale) * g;
for (let O = c; O <= p; O++)
h[O].x -= A, h[O].y += L;
}
function Itt(h, c, p) {
const { horizontalAlign: g, verticalAlign: L } = G_(p), H = c[0] - h.displaySize[0] * g, A = c[1] - h.displaySize[1] * L;
return { image: h, top: A, bottom: A + h.displaySize[1], left: H, right: H + h.displaySize[0] };
}
function LO(h) {
var c, p;
let g = h.left, L = h.top, H = h.right - g, A = h.bottom - L;
const O = (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 (O === "stretchOnly" && H / A < z || O === "proportional") {
const Z = Math.ceil(A * z);
g *= Z / H, H = Z;
}
} else if (O === "proportional" && N === "stretchOnly" && z !== 0 && H / A > z) {
const Z = Math.ceil(H / z);
L *= Z / A, A = Z;
}
return { x1: g, y1: L, x2: g + H, y2: L + A };
}
function wO(h, c, p, g, L, H) {
const A = h.image;
let O;
if (A.content) {
const bt = A.content, Mt = A.pixelRatio || 1;
O = [bt[0] / Mt, bt[1] / Mt, A.displaySize[0] - bt[2] / Mt, A.displaySize[1] - bt[3] / Mt];
}
const N = c.left * H, z = c.right * H;
let Z, X, et, st;
p === "width" || p === "both" ? (st = L[0] + N - g[3], X = L[0] + z + g[1]) : (st = L[0] + (N + z - A.displaySize[0]) / 2, X = st + A.displaySize[0]);
const ut = c.top * H, Tt = c.bottom * H;
return p === "height" || p === "both" ? (Z = L[1] + ut - g[0], et = L[1] + Tt + g[2]) : (Z = L[1] + (ut + Tt - A.displaySize[1]) / 2, et = Z + A.displaySize[1]), { image: A, top: Z, right: X, bottom: et, left: st, collisionPadding: O };
}
const eu = 255, Sa = 128, T6 = eu * Sa;
function xO(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: L } = 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 O = g[H], N = g[A];
return p.kind === "composite" ? { kind: "composite", minZoom: O, maxZoom: N, interpolationType: L } : { kind: "camera", minZoom: O, maxZoom: N, minSize: p.evaluate(new ti(O)), maxSize: p.evaluate(new ti(N)), interpolationType: L };
}
}
function $_(h, c, p) {
let g = "never";
const L = h.get(c);
return L ? g = L : 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, L, H, A, O, N, z, Z, X, et) {
const st = O ? Math.min(T6, Math.round(O[0])) : 0, ut = O ? Math.min(T6, Math.round(O[1])) : 0;
h.emplaceBack(c, p, Math.round(32 * g), Math.round(32 * L), H, A, (st << 1) + (N ? 1 : 0), ut, 16 * z, 16 * Z, 256 * X, 256 * et);
}
function Z_(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 W_ {
constructor(c) {
this.layoutVertexArray = new Vl(), this.indexArray = new O2(), 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, L) {
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 || L) && 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", W_);
class q_ {
constructor(c, p, g) {
this.layoutVertexArray = new c(), this.layoutAttributes = p, this.indexArray = new g(), this.segments = new an(), this.collisionVertexArray = new Ma();
}
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 = xO(this.zoom, p["text-size"]), this.iconSizeData = xO(this.zoom, p["icon-size"]);
const g = this.layers[0].layout, L = 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" && !L.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 W_(new D0(this.layers, this.zoom, (c) => /^text/.test(c))), this.icon = new W_(new D0(this.layers, this.zoom, (c) => /^icon/.test(c))), this.glyphOffsetArray = new ri(), this.lineVertexArray = new O1(), this.symbolInstances = new nn(), this.textAnchorOffsets = new ni();
}
calculateGlyphDependencies(c, p, g, L, H) {
for (let A = 0; A < c.length; A++)
if (p[c.charCodeAt(A)] = !0, (g || L) && H) {
const O = Yc[c.charAt(A)];
O && (p[O.charCodeAt(0)] = !0);
}
}
populate(c, p, g) {
const L = this.layers[0], H = L.layout, A = H.get("text-font"), O = H.get("text-field"), N = H.get("icon-image"), z = (O.value.kind !== "constant" || O.value.value instanceof Xr && !O.value.value.isEmpty() || O.value.value.toString().length > 0) && (A.value.kind !== "constant" || A.value.value.length > 0), Z = N.value.kind !== "constant" || !!N.value.value || Object.keys(N.parameters).length > 0, X = H.get("symbol-sort-key");
if (this.features = [], !z && !Z)
return;
const et = p.iconDependencies, st = p.glyphDependencies, ut = p.availableImages, Tt = new ti(this.zoom);
for (const { feature: bt, id: Mt, index: $t, sourceLayerIndex: kt } of c) {
const Bt = L._featureFilter.needGeometry, ee = B0(bt, Bt);
if (!L._featureFilter.filter(Tt, ee, g))
continue;
let _e, Xe;
if (Bt || (ee.geometry = F0(bt)), z) {
const ze = L.getValueAndResolveTokens("text-field", ee, g, ut), Re = Xr.factory(ze), Qr = this.hasRTLText = this.hasRTLText || Dtt(Re);
(!Qr || Io.getRTLTextPluginStatus() === "unavailable" || Qr && Io.isParsed()) && (_e = gtt(Re, L, ee));
}
if (Z) {
const ze = L.getValueAndResolveTokens("icon-image", ee, g, ut);
Xe = ze instanceof pn ? ze : pn.fromString(ze);
}
if (!_e && !Xe)
continue;
const xr = this.sortFeaturesByKey ? X.evaluate(ee, {}, g) : void 0;
if (this.features.push({ id: Mt, text: _e, icon: Xe, index: $t, sourceLayerIndex: kt, geometry: ee.geometry, properties: bt.properties, type: Rtt[bt.type], sortKey: xr }), Xe && (et[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)
et[Qr.image.name] = !0;
else {
const sr = Rc(_e.toString()), rr = Qr.fontStack || ze, ue = st[rr] = st[rr] || {};
this.calculateGlyphDependencies(Qr.text, ue, Re, this.allowVerticalPlacement, sr);
}
}
}
H.get("symbol-placement") === "line" && (this.features = function(bt) {
const Mt = {}, $t = {}, kt = [];
let Bt = 0;
function ee(ze) {
kt.push(bt[ze]), Bt++;
}
function _e(ze, Re, Qr) {
const sr = $t[ze];
return delete $t[ze], $t[Re] = sr, kt[sr].geometry[0].pop(), kt[sr].geometry[0] = kt[sr].geometry[0].concat(Qr[0]), sr;
}
function Xe(ze, Re, Qr) {
const sr = Mt[Re];
return delete Mt[Re], Mt[ze] = sr, kt[sr].geometry[0].shift(), kt[sr].geometry[0] = Qr[0].concat(kt[sr].geometry[0]), sr;
}
function xr(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 < bt.length; ze++) {
const Re = bt[ze], Qr = Re.geometry, sr = Re.text ? Re.text.toString() : null;
if (!sr) {
ee(ze);
continue;
}
const rr = xr(sr, Qr), ue = xr(sr, Qr, !0);
if (rr in $t && ue in Mt && $t[rr] !== Mt[ue]) {
const gr = Xe(rr, ue, Qr), pr = _e(rr, ue, kt[gr].geometry);
delete Mt[rr], delete $t[ue], $t[xr(sr, kt[pr].geometry, !0)] = pr, kt[gr].geometry = null;
} else
rr in $t ? _e(rr, ue, Qr) : ue in Mt ? Xe(rr, ue, Qr) : (ee(ze), Mt[rr] = Bt - 1, $t[ue] = Bt - 1);
}
return kt.filter((ze) => ze.geometry);
}(this.features)), this.sortFeaturesByKey && this.features.sort((bt, Mt) => bt.sortKey - Mt.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 L = c.dist(p[c.segment + 1]), H = c.dist(p[c.segment]);
const A = {};
for (let O = c.segment + 1; O < p.length; O++)
A[O] = { x: p[O].x, y: p[O].y, tileUnitDistanceFromAnchor: L }, O < p.length - 1 && (L += p[O + 1].dist(p[O]));
for (let O = c.segment || 0; O >= 0; O--)
A[O] = { x: p[O].x, y: p[O].y, tileUnitDistanceFromAnchor: H }, O > 0 && (H += p[O - 1].dist(p[O]));
for (let O = 0; O < p.length; O++) {
const N = A[O];
this.lineVertexArray.emplaceBack(N.x, N.y, N.tileUnitDistanceFromAnchor);
}
}
return { lineStartIndex: g, lineLength: this.lineVertexArray.length - g };
}
addSymbols(c, p, g, L, H, A, O, N, z, Z, X, et) {
const st = c.indexArray, ut = c.layoutVertexArray, Tt = c.segments.prepareSegment(4 * p.length, ut, st, this.canOverlap ? A.sortKey : void 0), bt = this.glyphOffsetArray.length, Mt = Tt.vertexLength, $t = this.allowVerticalPlacement && O === s.ah.vertical ? Math.PI / 2 : 0, kt = A.text && A.text.sections;
for (let Bt = 0; Bt < p.length; Bt++) {
const { tl: ee, tr: _e, bl: Xe, br: xr, tex: ze, pixelOffsetTL: Re, pixelOffsetBR: Qr, minFontScaleX: sr, minFontScaleY: rr, glyphOffset: ue, isSDF: gr, sectionIndex: pr } = p[Bt], Pr = 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, xr.x, Fn + xr.y, ze.x + ze.w, ze.y + ze.h, g, gr, Qr.x, Qr.y, sr, rr), Z_(c.dynamicLayoutVertexArray, N, $t), st.emplaceBack(Pr, Pr + 1, Pr + 2), st.emplaceBack(Pr + 1, Pr + 2, Pr + 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, {}, et, kt && kt[pr]);
}
c.placedSymbolArray.emplaceBack(N.x, N.y, bt, this.glyphOffsetArray.length - bt, Mt, z, Z, N.segment, g ? g[0] : 0, g ? g[1] : 0, L[0], L[1], O, 0, !1, 0, X);
}
_addCollisionDebugVertex(c, p, g, L, H, A) {
return p.emplaceBack(0, 0), c.emplaceBack(g.x, g.y, L, H, Math.round(A.x), Math.round(A.y));
}
addCollisionDebugVertices(c, p, g, L, H, A, O) {
const N = H.segments.prepareSegment(4, H.layoutVertexArray, H.indexArray), z = N.vertexLength, Z = H.layoutVertexArray, X = H.collisionVertexArray, et = O.anchorX, st = O.anchorY;
this._addCollisionDebugVertex(Z, X, A, et, st, new f(c, p)), this._addCollisionDebugVertex(Z, X, A, et, st, new f(g, p)), this._addCollisionDebugVertex(Z, X, A, et, st, new f(g, L)), this._addCollisionDebugVertex(Z, X, A, et, st, new f(c, L)), 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, L) {
for (let H = c; H < p; H++) {
const A = this.collisionBoxArray.get(H);
this.addCollisionDebugVertices(A.x1, A.y1, A.x2, A.y2, L ? this.textCollisionBox : this.iconCollisionBox, A.anchorPoint, g);
}
}
generateCollisionDebugBuffers() {
this.hasDebugData() && this.destroyDebugData(), this.textCollisionBox = new q_(s2, lO.members, b1), this.iconCollisionBox = new q_(s2, lO.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, L, H, A, O, N, z) {
const Z = {};
for (let X = p; X < g; X++) {
const et = c.get(X);
Z.textBox = { x1: et.x1, y1: et.y1, x2: et.x2, y2: et.y2, anchorPointX: et.anchorPointX, anchorPointY: et.anchorPointY }, Z.textFeatureIndex = et.featureIndex;
break;
}
for (let X = L; X < H; X++) {
const et = c.get(X);
Z.verticalTextBox = { x1: et.x1, y1: et.y1, x2: et.x2, y2: et.y2, anchorPointX: et.anchorPointX, anchorPointY: et.anchorPointY }, Z.verticalTextFeatureIndex = et.featureIndex;
break;
}
for (let X = A; X < O; X++) {
const et = c.get(X);
Z.iconBox = { x1: et.x1, y1: et.y1, x2: et.x2, y2: et.y2, anchorPointX: et.anchorPointX, anchorPointY: et.anchorPointY }, Z.iconFeatureIndex = et.featureIndex;
break;
}
for (let X = N; X < z; X++) {
const et = c.get(X);
Z.verticalIconBox = { x1: et.x1, y1: et.y1, x2: et.x2, y2: et.y2, anchorPointX: et.anchorPointX, anchorPointY: et.anchorPointY }, Z.verticalIconFeatureIndex = et.featureIndex;
break;
}
return Z;
}
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), L = g.vertexStartIndex + 4 * g.numGlyphs;
for (let H = g.vertexStartIndex; H < L; 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), L = [], H = [], A = [];
for (let O = 0; O < this.symbolInstances.length; ++O) {
A.push(O);
const N = this.symbolInstances.get(O);
L.push(0 | Math.round(p * N.anchorX + g * N.anchorY)), H.push(N.featureIndex);
}
return A.sort((O, N) => L[O] - L[N] || H[N] - H[O]), 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((L, H, A) => {
L >= 0 && A.indexOf(L) === H && this.addIndicesForPlacedSymbol(this.text, L);
}), 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 MO, EO;
nr("SymbolBucket", $l, { omit: ["layers", "collisionBoxArray", "features", "compareText"] }), $l.MAX_GLYPHS = 65535, $l.addDynamicAttributes = Z_;
var X_ = { get paint() {
return EO = EO || new E({ "icon-opacity": new Mr(Ot.paint_symbol["icon-opacity"]), "icon-color": new Mr(Ot.paint_symbol["icon-color"]), "icon-halo-color": new Mr(Ot.paint_symbol["icon-halo-color"]), "icon-halo-width": new Mr(Ot.paint_symbol["icon-halo-width"]), "icon-halo-blur": new Mr(Ot.paint_symbol["icon-halo-blur"]), "icon-translate": new cr(Ot.paint_symbol["icon-translate"]), "icon-translate-anchor": new cr(Ot.paint_symbol["icon-translate-anchor"]), "text-opacity": new Mr(Ot.paint_symbol["text-opacity"]), "text-color": new Mr(Ot.paint_symbol["text-color"], { runtimeType: In, getOverride: (h) => h.textColor, hasOverride: (h) => !!h.textColor }), "text-halo-color": new Mr(Ot.paint_symbol["text-halo-color"]), "text-halo-width": new Mr(Ot.paint_symbol["text-halo-width"]), "text-halo-blur": new Mr(Ot.paint_symbol["text-halo-blur"]), "text-translate": new cr(Ot.paint_symbol["text-translate"]), "text-translate-anchor": new cr(Ot.paint_symbol["text-translate-anchor"]) });
}, get layout() {
return MO = MO || new E({ "symbol-placement": new cr(Ot.layout_symbol["symbol-placement"]), "symbol-spacing": new cr(Ot.layout_symbol["symbol-spacing"]), "symbol-avoid-edges": new cr(Ot.layout_symbol["symbol-avoid-edges"]), "symbol-sort-key": new Mr(Ot.layout_symbol["symbol-sort-key"]), "symbol-z-order": new cr(Ot.layout_symbol["symbol-z-order"]), "icon-allow-overlap": new cr(Ot.layout_symbol["icon-allow-overlap"]), "icon-overlap": new cr(Ot.layout_symbol["icon-overlap"]), "icon-ignore-placement": new cr(Ot.layout_symbol["icon-ignore-placement"]), "icon-optional": new cr(Ot.layout_symbol["icon-optional"]), "icon-rotation-alignment": new cr(Ot.layout_symbol["icon-rotation-alignment"]), "icon-size": new Mr(Ot.layout_symbol["icon-size"]), "icon-text-fit": new cr(Ot.layout_symbol["icon-text-fit"]), "icon-text-fit-padding": new cr(Ot.layout_symbol["icon-text-fit-padding"]), "icon-image": new Mr(Ot.layout_symbol["icon-image"]), "icon-rotate": new Mr(Ot.layout_symbol["icon-rotate"]), "icon-padding": new Mr(Ot.layout_symbol["icon-padding"]), "icon-keep-upright": new cr(Ot.layout_symbol["icon-keep-upright"]), "icon-offset": new Mr(Ot.layout_symbol["icon-offset"]), "icon-anchor": new Mr(Ot.layout_symbol["icon-anchor"]), "icon-pitch-alignment": new cr(Ot.layout_symbol["icon-pitch-alignment"]), "text-pitch-alignment": new cr(Ot.layout_symbol["text-pitch-alignment"]), "text-rotation-alignment": new cr(Ot.layout_symbol["text-rotation-alignment"]), "text-field": new Mr(Ot.layout_symbol["text-field"]), "text-font": new Mr(Ot.layout_symbol["text-font"]), "text-size": new Mr(Ot.layout_symbol["text-size"]), "text-max-width": new Mr(Ot.layout_symbol["text-max-width"]), "text-line-height": new cr(Ot.layout_symbol["text-line-height"]), "text-letter-spacing": new Mr(Ot.layout_symbol["text-letter-spacing"]), "text-justify": new Mr(Ot.layout_symbol["text-justify"]), "text-radial-offset": new Mr(Ot.layout_symbol["text-radial-offset"]), "text-variable-anchor": new cr(Ot.layout_symbol["text-variable-anchor"]), "text-variable-anchor-offset": new Mr(Ot.layout_symbol["text-variable-anchor-offset"]), "text-anchor": new Mr(Ot.layout_symbol["text-anchor"]), "text-max-angle": new cr(Ot.layout_symbol["text-max-angle"]), "text-writing-mode": new cr(Ot.layout_symbol["text-writing-mode"]), "text-rotate": new Mr(Ot.layout_symbol["text-rotate"]), "text-padding": new cr(Ot.layout_symbol["text-padding"]), "text-keep-upright": new cr(Ot.layout_symbol["text-keep-upright"]), "text-transform": new Mr(Ot.layout_symbol["text-transform"]), "text-offset": new Mr(Ot.layout_symbol["text-offset"]), "text-allow-overlap": new cr(Ot.layout_symbol["text-allow-overlap"]), "text-overlap": new cr(Ot.layout_symbol["text-overlap"]), "text-ignore-placement": new cr(Ot.layout_symbol["text-ignore-placement"]), "text-optional": new cr(Ot.layout_symbol["text-optional"]) });
} };
class SO {
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", SO, { 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 L = [];
for (const H of g)
L.indexOf(H) < 0 && L.push(H);
this.layout._values["text-writing-mode"] = L;
} else
this.layout._values["text-writing-mode"] = ["horizontal"];
}
this._setPaintOverrides();
}
getValueAndResolveTokens(c, p, g, L) {
const H = this.layout.get(c).evaluate(p, {}, g, L), A = this._unevaluatedLayout._values[c];
return A.isDataDriven() || yi(A.value) || !H ? H : function(O, N) {
return N.replace(/{([^{}]+)}/g, (z, Z) => O && Z in O ? String(O[Z]) : "");
}(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 SO(p), L = new gi(g, p.property.specification);
let H = null;
H = p.value.kind === "constant" || p.value.kind === "source" ? new A1("source", L) : new Ai("composite", L, 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"), L = X_.paint.properties[p];
let H = !1;
const A = (O) => {
for (const N of O)
if (L.overrides && L.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 O = (z) => {
H || (z instanceof h1 && Qn(z.value) === H1 ? A(z.value.sections) : z instanceof A3 ? A(z.sections) : z.eachChild(O));
}, N = g.value;
N._styleExpression && O(N._styleExpression.expression);
}
return H;
}
}
let HO;
var Ftt = { get paint() {
return HO = HO || new E({ "background-color": new cr(Ot.paint_background["background-color"]), "background-pattern": new Pl(Ot.paint_background["background-pattern"]), "background-opacity": new cr(Ot.paint_background["background-opacity"]) });
} };
class Btt extends m {
constructor(c) {
super(c, Ftt);
}
}
let AO;
var jtt = { get paint() {
return AO = AO || new E({ "raster-opacity": new cr(Ot.paint_raster["raster-opacity"]), "raster-hue-rotate": new cr(Ot.paint_raster["raster-hue-rotate"]), "raster-brightness-min": new cr(Ot.paint_raster["raster-brightness-min"]), "raster-brightness-max": new cr(Ot.paint_raster["raster-brightness-max"]), "raster-saturation": new cr(Ot.paint_raster["raster-saturation"]), "raster-contrast": new cr(Ot.paint_raster["raster-contrast"]), "raster-resampling": new cr(Ot.paint_raster["raster-resampling"]), "raster-fade-duration": new cr(Ot.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, L = c.lat * p, H = Math.sin(g) * Math.sin(L) + Math.cos(g) * Math.cos(L) * 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 CO = 2 * Math.PI * K_;
function OO(h) {
return CO * Math.cos(h * Math.PI / 180);
}
function PO(h) {
return (180 + h) / 360;
}
function kO(h) {
return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + h * Math.PI / 360))) / 360;
}
function VO(h, c) {
return h / OO(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(PO(g.lng), kO(g.lat), VO(p, g.lat));
}
toLngLat() {
return new f6(360 * this.x - 180, Y_(this.y));
}
toAltitude() {
return this.z * OO(Y_(this.y));
}
meterInMercatorCoordinateUnits() {
return 1 / CO * (c = Y_(this.y), 1 / Math.cos(c * Math.PI / 180));
var c;
}
}
function IO(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(L, H, A) {
return !(L < 0 || L > 25 || A < 0 || A >= Math.pow(2, L) || H < 0 || H >= Math.pow(2, L));
}(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 L = (A = this.y, O = this.z, N = IO(256 * (H = this.x), 256 * (A = Math.pow(2, O) - A - 1), O), z = IO(256 * (H + 1), 256 * (A + 1), O), N[0] + "," + N[1] + "," + z[0] + "," + z[1]);
var H, A, O, N, z;
const Z = function(X, et, st) {
let ut, Tt = "";
for (let bt = X; bt > 0; bt--)
ut = 1 << bt - 1, Tt += (et & ut ? 1 : 0) + (st & 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, Z).replace(/{bbox-epsg-3857}/g, L);
}
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) * Wi, (c.y * p - this.y) * Wi);
}
toString() {
return `${this.z}/${this.x}/${this.y}`;
}
}
class RO {
constructor(c, p) {
this.wrap = c, this.canonical = p, this.key = nu(c, p.z, p.z, p.x, p.y);
}
}
class k2 {
constructor(c, p, g, L, 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, +L, +H), this.key = nu(p, c, g, L, H);
}
clone() {
return new k2(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 k2(c, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y) : new k2(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 k2(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, L = 2 * this.canonical.y;
return [new k2(p, this.wrap, p, g, L), new k2(p, this.wrap, p, g + 1, L), new k2(p, this.wrap, p, g, L + 1), new k2(p, this.wrap, p, g + 1, L + 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 k2(this.overscaledZ, 0, this.canonical.z, this.canonical.x, this.canonical.y);
}
unwrapTo(c) {
return new k2(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 RO(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, L) {
(h *= 2) < 0 && (h = -1 * h - 1);
const H = 1 << p;
return (H * H * h + H * L + g).toString(36) + p.toString(36) + c.toString(36);
}
nr("CanonicalTileID", J_), nr("OverscaledTileID", k2, { omit: ["posMatrix"] });
class NO {
constructor(c, p, g, L = 1, H = 1, A = 1, O = 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 Vt(`"${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 = L, this.greenFactor = H, this.blueFactor = A, this.baseShift = O;
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 Z = 0; Z < N; Z++) {
const X = this.get(z, Z);
X > this.max && (this.max = X), X < this.min && (this.min = X);
}
}
get(c, p) {
const g = new Uint8Array(this.data.buffer), L = 4 * this._idx(c, p);
return this.unpack(g[L], g[L + 1], g[L + 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 P2({ 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 L = p * this.dim, H = p * this.dim + this.dim, A = g * this.dim, O = g * this.dim + this.dim;
switch (p) {
case -1:
L = H - 1;
break;
case 1:
H = L + 1;
}
switch (g) {
case -1:
A = O - 1;
break;
case 1:
O = A + 1;
}
const N = -p * this.dim, z = -g * this.dim;
for (let Z = A; Z < O; Z++)
for (let X = L; X < H; X++)
this.data[this._idx(X, Z)] = c.data[this._idx(X + N, Z + z)];
}
}
nr("DEMData", NO);
class DO {
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 FO {
constructor(c, p, g, L, H) {
this.type = "Feature", this._vectorTileFeature = c, c._z = p, c._x = g, c._y = L, 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 BO {
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(Wi, 16, 0), this.grid3D = new e6(Wi, 16, 0), this.featureIndexArray = new q1(), this.promoteId = p;
}
insert(c, p, g, L, H, A) {
const O = this.featureIndexArray.length;
this.featureIndexArray.emplaceBack(g, L, H);
const N = A ? this.grid3D : this.grid;
for (let z = 0; z < p.length; z++) {
const Z = p[z], X = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
for (let et = 0; et < Z.length; et++) {
const st = Z[et];
X[0] = Math.min(X[0], st.x), X[1] = Math.min(X[1], st.y), X[2] = Math.max(X[2], st.x), X[3] = Math.max(X[3], st.y);
}
X[0] < Wi && X[1] < Wi && X[2] >= 0 && X[3] >= 0 && N.insert(O, 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 DO(this.vtLayers ? Object.keys(this.vtLayers).sort() : ["_geojsonTileLayer"])), this.vtLayers;
}
query(c, p, g, L) {
this.loadVTLayers();
const H = c.params || {}, A = Wi / c.tileSize / c.scale, O = Y4(H.filter), N = c.queryGeometry, z = c.queryPadding * A, Z = zO(N), X = this.grid.query(Z.minX - z, Z.minY - z, Z.maxX + z, Z.maxY + z), et = zO(c.cameraQueryGeometry), st = this.grid3D.query(et.minX - z, et.minY - z, et.maxX + z, et.maxY + z, (bt, Mt, $t, kt) => function(Bt, ee, _e, Xe, xr) {
for (const Re of Bt)
if (ee <= Re.x && _e <= Re.y && Xe >= Re.x && xr >= Re.y)
return !0;
const ze = [new f(ee, _e), new f(ee, xr), new f(Xe, xr), 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, bt - z, Mt - z, $t + z, kt + z));
for (const bt of st)
X.push(bt);
X.sort($tt);
const ut = {};
let Tt;
for (let bt = 0; bt < X.length; bt++) {
const Mt = X[bt];
if (Mt === Tt)
continue;
Tt = Mt;
const $t = this.featureIndexArray.get(Mt);
let kt = null;
this.loadMatchingFeature(ut, $t.bucketIndex, $t.sourceLayerIndex, $t.featureIndex, O, H.layers, H.availableImages, p, g, L, (Bt, ee, _e) => (kt || (kt = F0(Bt)), ee.queryIntersectsFeature(N, Bt, _e, kt, this.z, c.transform, A, c.pixelPosMatrix)));
}
return ut;
}
loadMatchingFeature(c, p, g, L, H, A, O, N, z, Z, X) {
const et = this.bucketLayerIDs[p];
if (A && !function(bt, Mt) {
for (let $t = 0; $t < bt.length; $t++)
if (Mt.indexOf(bt[$t]) >= 0)
return !0;
return !1;
}(A, et))
return;
const st = this.sourceLayerCoder.decode(g), ut = this.vtLayers[st].feature(L);
if (H.needGeometry) {
const bt = B0(ut, !0);
if (!H.filter(new ti(this.tileID.overscaledZ), bt, this.tileID.canonical))
return;
} else if (!H.filter(new ti(this.tileID.overscaledZ), ut))
return;
const Tt = this.getId(ut, st);
for (let bt = 0; bt < et.length; bt++) {
const Mt = et[bt];
if (A && A.indexOf(Mt) < 0)
continue;
const $t = N[Mt];
if (!$t)
continue;
let kt = {};
Tt && Z && (kt = Z.getState($t.sourceLayer || "_geojsonTileLayer", Tt));
const Bt = $({}, z[Mt]);
Bt.paint = jO(Bt.paint, $t.paint, ut, kt, O), Bt.layout = jO(Bt.layout, $t.layout, ut, kt, O);
const ee = !X || X(ut, $t, kt);
if (!ee)
continue;
const _e = new FO(ut, this.z, this.x, this.y, Tt);
_e.layer = Bt;
let Xe = c[Mt];
Xe === void 0 && (Xe = c[Mt] = []), Xe.push({ featureIndex: L, feature: _e, intersectionZ: ee });
}
}
lookupSymbolFeatures(c, p, g, L, H, A, O, N) {
const z = {};
this.loadVTLayers();
const Z = Y4(H);
for (const X of c)
this.loadMatchingFeature(z, g, L, X, Z, A, O, 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 jO(h, c, p, g, L) {
return tt(h, (H, A) => {
const O = c instanceof I0 ? c.get(A) : null;
return O && O.evaluate ? O.evaluate(p, g, L) : O;
});
}
function zO(h) {
let c = 1 / 0, p = 1 / 0, g = -1 / 0, L = -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), L = Math.max(L, H.y);
return { minX: c, minY: p, maxX: g, maxY: L };
}
function $tt(h, c) {
return c - h;
}
function UO(h, c, p, g, L) {
const H = [];
for (let A = 0; A < h.length; A++) {
const O = h[A];
let N;
for (let z = 0; z < O.length - 1; z++) {
let Z = O[z], X = O[z + 1];
Z.x < c && X.x < c || (Z.x < c ? Z = new f(c, Z.y + (c - Z.x) / (X.x - Z.x) * (X.y - Z.y))._round() : X.x < c && (X = new f(c, Z.y + (c - Z.x) / (X.x - Z.x) * (X.y - Z.y))._round()), Z.y < p && X.y < p || (Z.y < p ? Z = new f(Z.x + (p - Z.y) / (X.y - Z.y) * (X.x - Z.x), p)._round() : X.y < p && (X = new f(Z.x + (p - Z.y) / (X.y - Z.y) * (X.x - Z.x), p)._round()), Z.x >= g && X.x >= g || (Z.x >= g ? Z = new f(g, Z.y + (g - Z.x) / (X.x - Z.x) * (X.y - Z.y))._round() : X.x >= g && (X = new f(g, Z.y + (g - Z.x) / (X.x - Z.x) * (X.y - Z.y))._round()), Z.y >= L && X.y >= L || (Z.y >= L ? Z = new f(Z.x + (L - Z.y) / (X.y - Z.y) * (X.x - Z.x), L)._round() : X.y >= L && (X = new f(Z.x + (L - Z.y) / (X.y - Z.y) * (X.x - Z.x), L)._round()), N && Z.equals(N[N.length - 1]) || (N = [Z], H.push(N)), N.push(X)))));
}
}
return H;
}
nr("FeatureIndex", BO, { omit: ["rawTileData", "sourceLayerCoder"] });
class Q6 extends f {
constructor(c, p, g, L) {
super(c, p), this.angle = g, L !== void 0 && (this.segment = L);
}
clone() {
return new Q6(this.x, this.y, this.angle, this.segment);
}
}
function GO(h, c, p, g, L) {
if (c.segment === void 0 || p === 0)
return !0;
let H = c, A = c.segment + 1, O = 0;
for (; O > -p / 2; ) {
if (A--, A < 0)
return !1;
O -= h[A].dist(H), H = h[A];
}
O += h[A].dist(h[A + 1]), A++;
const N = [];
let z = 0;
for (; O < p / 2; ) {
const Z = h[A], X = h[A + 1];
if (!X)
return !1;
let et = h[A - 1].angleTo(Z) - Z.angleTo(X);
for (et = Math.abs((et + 3 * Math.PI) % (2 * Math.PI) - Math.PI), N.push({ distance: O, angleDelta: et }), z += et; O - N[0].distance > g; )
z -= N.shift().angleDelta;
if (z > L)
return !1;
A++, O += Z.dist(X);
}
return !0;
}
function $O(h) {
let c = 0;
for (let p = 0; p < h.length - 1; p++)
c += h[p].dist(h[p + 1]);
return c;
}
function ZO(h, c, p) {
return h ? 0.6 * c * p : 0;
}
function WO(h, c) {
return Math.max(h ? h.right - h.left : 0, c ? c.right - c.left : 0);
}
function Ztt(h, c, p, g, L, H) {
const A = ZO(p, L, H), O = WO(p, g) * H;
let N = 0;
const z = $O(h) / 2;
for (let Z = 0; Z < h.length - 1; Z++) {
const X = h[Z], et = h[Z + 1], st = X.dist(et);
if (N + st > z) {
const ut = (z - N) / st, Tt = wr.number(X.x, et.x, ut), bt = wr.number(X.y, et.y, ut), Mt = new Q6(Tt, bt, et.angleTo(X), Z);
return Mt._round(), !A || GO(h, Mt, O, A, c) ? Mt : void 0;
}
N += st;
}
}
function Wtt(h, c, p, g, L, H, A, O, N) {
const z = ZO(g, H, A), Z = WO(g, L), X = Z * A, et = 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), qO(h, et ? c / 2 * O % c : (Z / 2 + 2 * H) * A * O % c, c, z, p, X, et, !1, N);
}
function qO(h, c, p, g, L, H, A, O, N) {
const z = H / 2, Z = $O(h);
let X = 0, et = c - p, st = [];
for (let ut = 0; ut < h.length - 1; ut++) {
const Tt = h[ut], bt = h[ut + 1], Mt = Tt.dist(bt), $t = bt.angleTo(Tt);
for (; et + p < X + Mt; ) {
et += p;
const kt = (et - X) / Mt, Bt = wr.number(Tt.x, bt.x, kt), ee = wr.number(Tt.y, bt.y, kt);
if (Bt >= 0 && Bt < N && ee >= 0 && ee < N && et - z >= 0 && et + z <= Z) {
const _e = new Q6(Bt, ee, $t, ut);
_e._round(), g && !GO(h, _e, H, g, L) || st.push(_e);
}
}
X += Mt;
}
return O || st.length || A || (st = qO(h, X / 2, p, g, L, H, A, !0, N)), st;
}
nr("Anchor", Q6);
const Zl = No;
function XO(h, c, p, g) {
const L = [], H = h.image, A = H.pixelRatio, O = H.paddedRect.w - 2 * Zl, N = H.paddedRect.h - 2 * Zl;
let z = { x1: h.left, y1: h.top, x2: h.right, y2: h.bottom };
const Z = H.stretchX || [[0, O]], X = H.stretchY || [[0, N]], et = (ue, gr) => ue + gr[1] - gr[0], st = Z.reduce(et, 0), ut = X.reduce(et, 0), Tt = O - st, bt = N - ut;
let Mt = 0, $t = st, kt = 0, Bt = ut, ee = 0, _e = Tt, Xe = 0, xr = bt;
if (H.content && g) {
const ue = H.content, gr = ue[2] - ue[0], pr = ue[3] - ue[1];
(H.textFitWidth || H.textFitHeight) && (z = LO(h)), Mt = Fp(Z, 0, ue[0]), kt = Fp(X, 0, ue[1]), $t = Fp(Z, ue[0], ue[2]), Bt = Fp(X, ue[1], ue[3]), ee = ue[0] - Mt, Xe = ue[1] - kt, _e = gr - $t, xr = pr - Bt;
}
const ze = z.x1, Re = z.y1, Qr = z.x2 - ze, sr = z.y2 - Re, rr = (ue, gr, pr, Pr) => {
const Fn = Bp(ue.stretch - Mt, $t, Qr, ze), Vn = jp(ue.fixed - ee, _e, ue.stretch, st), p1 = Bp(gr.stretch - kt, Bt, sr, Re), gs = jp(gr.fixed - Xe, xr, gr.stretch, ut), I1 = Bp(pr.stretch - Mt, $t, Qr, ze), T1 = jp(pr.fixed - ee, _e, pr.stretch, st), yo = Bp(Pr.stretch - kt, Bt, sr, Re), vo = jp(Pr.fixed - Xe, xr, Pr.stretch, ut), _o = new f(Fn, p1), Ci = new f(I1, p1), f1 = new f(I1, yo), K1 = new f(Fn, yo), R1 = new f(Vn / 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), Ci._matMult(ii), K1._matMult(ii), f1._matMult(ii);
}
const V2 = ue.stretch + ue.fixed, Do = gr.stretch + gr.fixed;
return { tl: _o, tr: Ci, bl: K1, br: f1, tex: { x: H.paddedRect.x + Zl + V2, y: H.paddedRect.y + Zl + Do, w: pr.stretch + pr.fixed - V2, h: Pr.stretch + Pr.fixed - Do }, writingMode: void 0, glyphOffset: [0, 0], sectionIndex: 0, pixelOffsetTL: R1, pixelOffsetBR: bo, minFontScaleX: _e / A / Qr, minFontScaleY: xr / A / sr, isSDF: p };
};
if (g && (H.stretchX || H.stretchY)) {
const ue = KO(Z, Tt, st), gr = KO(X, bt, ut);
for (let pr = 0; pr < ue.length - 1; pr++) {
const Pr = ue[pr], Fn = ue[pr + 1];
for (let Vn = 0; Vn < gr.length - 1; Vn++)
L.push(rr(Pr, gr[Vn], Fn, gr[Vn + 1]));
}
} else
L.push(rr({ fixed: 0, stretch: -1 }, { fixed: 0, stretch: -1 }, { fixed: 0, stretch: O + 1 }, { fixed: 0, stretch: N + 1 }));
return L;
}
function Fp(h, c, p) {
let g = 0;
for (const L of h)
g += Math.max(c, Math.min(p, L[1])) - Math.max(c, Math.min(p, L[0]));
return g;
}
function KO(h, c, p) {
const g = [{ fixed: -Zl, stretch: 0 }];
for (const [L, H] of h) {
const A = g[g.length - 1];
g.push({ fixed: L - A.stretch, stretch: A.stretch }), g.push({ fixed: L - A.stretch, stretch: A.stretch + (H - L) });
}
return g.push({ fixed: c + Zl, 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, L, H, A, O, N, z, Z) {
var X;
if (this.boxStartIndex = c.length, z) {
let et = A.top, st = A.bottom;
const ut = A.collisionPadding;
ut && (et -= ut[1], st += ut[3]);
let Tt = st - et;
Tt > 0 && (Tt = Math.max(10, Tt), this.circleDiameter = Tt);
} else {
const et = !((X = A.image) === null || X === void 0) && X.content && (A.image.textFitWidth || A.image.textFitHeight) ? LO(A) : { x1: A.left, y1: A.top, x2: A.right, y2: A.bottom };
et.y1 = et.y1 * O - N[0], et.y2 = et.y2 * O + N[2], et.x1 = et.x1 * O - N[3], et.x2 = et.x2 * O + N[1];
const st = A.collisionPadding;
if (st && (et.x1 -= st[0] * O, et.y1 -= st[1] * O, et.x2 += st[2] * O, et.y2 += st[3] * O), Z) {
const ut = new f(et.x1, et.y1), Tt = new f(et.x2, et.y1), bt = new f(et.x1, et.y2), Mt = new f(et.x2, et.y2), $t = Z * Math.PI / 180;
ut._rotate($t), Tt._rotate($t), bt._rotate($t), Mt._rotate($t), et.x1 = Math.min(ut.x, Tt.x, bt.x, Mt.x), et.x2 = Math.max(ut.x, Tt.x, bt.x, Mt.x), et.y1 = Math.min(ut.y, Tt.y, bt.y, Mt.y), et.y2 = Math.max(ut.y, Tt.y, bt.y, Mt.y);
}
c.emplaceBack(p.x, p.y, et.x1, et.y1, et.x2, et.y2, g, L, H);
}
this.boxEndIndex = c.length;
}
}
class qtt {
constructor(c = [], p = (g, L) => g < L ? -1 : g > L ? 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, L = p[c];
for (; c > 0; ) {
const H = c - 1 >> 1, A = p[H];
if (g(L, A) >= 0)
break;
p[c] = A, c = H;
}
p[c] = L;
}
_down(c) {
const { data: p, compare: g } = this, L = this.length >> 1, H = p[c];
for (; c < L; ) {
let A = 1 + (c << 1);
const O = A + 1;
if (O < this.length && g(p[O], p[A]) < 0 && (A = O), 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, L = 1 / 0, H = -1 / 0, A = -1 / 0;
const O = h[0];
for (let st = 0; st < O.length; st++) {
const ut = O[st];
(!st || ut.x < g) && (g = ut.x), (!st || ut.y < L) && (L = ut.y), (!st || ut.x > H) && (H = ut.x), (!st || ut.y > A) && (A = ut.y);
}
const N = Math.min(H - g, A - L);
let z = N / 2;
const Z = new qtt([], Ktt);
if (N === 0)
return new f(g, L);
for (let st = g; st < H; st += N)
for (let ut = L; ut < A; ut += N)
Z.push(new Wl(st + z, ut + z, z, h));
let X = function(st) {
let ut = 0, Tt = 0, bt = 0;
const Mt = st[0];
for (let $t = 0, kt = Mt.length, Bt = kt - 1; $t < kt; Bt = $t++) {
const ee = Mt[$t], _e = Mt[Bt], Xe = ee.x * _e.y - _e.x * ee.y;
Tt += (ee.x + _e.x) * Xe, bt += (ee.y + _e.y) * Xe, ut += 3 * Xe;
}
return new Wl(Tt / ut, bt / ut, 0, st);
}(h), et = Z.length;
for (; Z.length; ) {
const st = Z.pop();
(st.d > X.d || !X.d) && (X = st, p && console.log("found best %d after %d probes", Math.round(1e4 * st.d) / 1e4, et)), st.max - X.d <= c || (z = st.h / 2, Z.push(new Wl(st.p.x - z, st.p.y - z, z, h)), Z.push(new Wl(st.p.x + z, st.p.y - z, z, h)), Z.push(new Wl(st.p.x - z, st.p.y + z, z, h)), Z.push(new Wl(st.p.x + z, st.p.y + z, z, h)), et += 4);
}
return p && (console.log(`num probes: ${et}`), console.log(`best distance: ${X.d}`)), X.p;
}
function Ktt(h, c) {
return c.max - h.max;
}
function Wl(h, c, p, g) {
this.p = new f(h, c), this.h = p, this.d = function(L, H) {
let A = !1, O = 1 / 0;
for (let N = 0; N < H.length; N++) {
const z = H[N];
for (let Z = 0, X = z.length, et = X - 1; Z < X; et = Z++) {
const st = z[Z], ut = z[et];
st.y > L.y != ut.y > L.y && L.x < (ut.x - st.x) * (L.y - st.y) / (ut.y - st.y) + st.x && (A = !A), O = Math.min(O, kC(L, st, ut));
}
}
return (A ? 1 : -1) * Math.sqrt(O);
}(this.p, g), this.max = this.d + this.h * Math.SQRT2;
}
var V1;
s.aq = void 0, (V1 = s.aq || (s.aq = {}))[V1.center = 1] = "center", V1[V1.left = 2] = "left", V1[V1.right = 3] = "right", V1[V1.top = 4] = "top", V1[V1.bottom = 5] = "bottom", V1[V1["top-left"] = 6] = "top-left", V1[V1["top-right"] = 7] = "top-right", V1[V1["bottom-left"] = 8] = "bottom-left", V1[V1["bottom-right"] = 9] = "bottom-right";
const m6 = 7, tb = Number.POSITIVE_INFINITY;
function YO(h, c) {
return c[1] !== tb ? function(p, g, L) {
let H = 0, A = 0;
switch (g = Math.abs(g), L = Math.abs(L), p) {
case "top-right":
case "top-left":
case "top":
A = L - m6;
break;
case "bottom-right":
case "bottom-left":
case "bottom":
A = -L + 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 L = 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":
L = -A;
break;
case "top-left":
case "bottom-left":
L = A;
break;
case "left":
L = g;
break;
case "right":
L = -g;
}
return [L, H];
}(h, c[0]);
}
function JO(h, c, p) {
var g;
const L = h.layout, H = (g = L.get("text-variable-anchor-offset")) === null || g === void 0 ? void 0 : g.evaluate(c, {}, p);
if (H) {
const O = H.values, N = [];
for (let z = 0; z < O.length; z += 2) {
const Z = N[z] = O[z], X = O[z + 1].map((et) => et * r1);
Z.startsWith("top") ? X[1] -= m6 : Z.startsWith("bottom") && (X[1] += m6), N[z + 1] = X;
}
return new _n(N);
}
const A = L.get("text-variable-anchor");
if (A) {
let O;
O = h._unevaluatedLayout.getValue("text-radial-offset") !== void 0 ? [L.get("text-radial-offset").evaluate(c, {}, p) * r1, tb] : L.get("text-offset").evaluate(c, {}, p).map((z) => z * r1);
const N = [];
for (const z of A)
N.push(z, YO(z, O));
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, L, H, A, O, N, z, Z) {
let X = H.textMaxSize.evaluate(c, {});
X === void 0 && (X = A);
const et = h.layers[0].layout, st = et.get("icon-offset").evaluate(c, {}, Z), ut = eP(p.horizontal), Tt = A / 24, bt = h.tilePixelRatio * Tt, Mt = h.tilePixelRatio * X / 24, $t = h.tilePixelRatio * O, kt = h.tilePixelRatio * et.get("symbol-spacing"), Bt = et.get("text-padding") * h.tilePixelRatio, ee = function(ue, gr, pr, Pr = 1) {
const Fn = ue.get("icon-padding").evaluate(gr, {}, pr), Vn = Fn && Fn.values;
return [Vn[0] * Pr, Vn[1] * Pr, Vn[2] * Pr, Vn[3] * Pr];
}(et, c, Z, h.tilePixelRatio), _e = et.get("text-max-angle") / 180 * Math.PI, Xe = et.get("text-rotation-alignment") !== "viewport" && et.get("symbol-placement") !== "point", xr = et.get("icon-rotation-alignment") === "map" && et.get("symbol-placement") !== "point", ze = et.get("symbol-placement"), Re = kt / 2, Qr = et.get("icon-text-fit");
let sr;
g && Qr !== "none" && (h.allowVerticalPlacement && p.vertical && (sr = wO(g, p.vertical, Qr, et.get("icon-text-fit-padding"), st, Tt)), ut && (g = wO(g, ut, Qr, et.get("icon-text-fit-padding"), st, Tt)));
const rr = (ue, gr) => {
gr.x < 0 || gr.x >= Wi || gr.y < 0 || gr.y >= Wi || function(pr, Pr, Fn, Vn, p1, gs, I1, T1, yo, vo, _o, Ci, f1, K1, R1, bo, N1, V2, Do, fn, Un, ii, a2, xi, ql) {
const Ha = pr.addToLineVertexArray(Pr, Fn);
let Aa, ys, I2, L1, U3 = 0, su = 0, oP = 0, sP = 0, cb = -1, ub = -1;
const G3 = {};
let aP = Il("");
if (pr.allowVerticalPlacement && Vn.vertical) {
const Y1 = T1.layout.get("text-rotate").evaluate(Un, {}, xi) + 90;
I2 = new zp(yo, Pr, vo, _o, Ci, Vn.vertical, f1, K1, R1, Y1), I1 && (L1 = new zp(yo, Pr, vo, _o, Ci, I1, N1, V2, R1, Y1));
}
if (p1) {
const Y1 = T1.layout.get("icon-rotate").evaluate(Un, {}), R2 = T1.layout.get("icon-text-fit") !== "none", z0 = XO(p1, Y1, a2, R2), qs = I1 ? XO(I1, Y1, a2, R2) : void 0;
ys = new zp(yo, Pr, vo, _o, Ci, p1, N1, V2, !1, Y1), U3 = 4 * z0.length;
const U0 = pr.iconSizeData;
let Ca = null;
U0.kind === "source" ? (Ca = [Sa * T1.layout.get("icon-size").evaluate(Un, {})], Ca[0] > T6 && Vt(`${pr.layerIds[0]}: Value for "icon-size" is >= ${eu}. Reduce your "icon-size".`)) : U0.kind === "composite" && (Ca = [Sa * ii.compositeIconSizes[0].evaluate(Un, {}, xi), Sa * ii.compositeIconSizes[1].evaluate(Un, {}, xi)], (Ca[0] > T6 || Ca[1] > T6) && Vt(`${pr.layerIds[0]}: Value for "icon-size" is >= ${eu}. Reduce your "icon-size".`)), pr.addSymbols(pr.icon, z0, Ca, fn, Do, Un, s.ah.none, Pr, Ha.lineStartIndex, Ha.lineLength, -1, xi), cb = pr.icon.placedSymbolArray.length - 1, qs && (su = 4 * qs.length, pr.addSymbols(pr.icon, qs, Ca, fn, Do, Un, s.ah.vertical, Pr, Ha.lineStartIndex, Ha.lineLength, -1, xi), ub = pr.icon.placedSymbolArray.length - 1);
}
const lP = Object.keys(Vn.horizontal);
for (const Y1 of lP) {
const R2 = Vn.horizontal[Y1];
if (!Aa) {
aP = Il(R2.text);
const qs = T1.layout.get("text-rotate").evaluate(Un, {}, xi);
Aa = new zp(yo, Pr, vo, _o, Ci, R2, f1, K1, R1, qs);
}
const z0 = R2.positionedLines.length === 1;
if (oP += tP(pr, Pr, R2, gs, T1, R1, Un, bo, Ha, Vn.vertical ? s.ah.horizontal : s.ah.horizontalOnly, z0 ? lP : [Y1], G3, cb, ii, xi), z0)
break;
}
Vn.vertical && (sP += tP(pr, Pr, Vn.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 = I2 ? I2.boxStartIndex : pr.collisionBoxArray.length, iet = I2 ? I2.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 Ws = -1;
const Gp = (Y1, R2) => Y1 && Y1.circleDiameter ? Math.max(Y1.circleDiameter, R2) : R2;
Ws = Gp(Aa, Ws), Ws = Gp(I2, Ws), Ws = Gp(ys, Ws), Ws = Gp(L1, Ws);
const cP = Ws > -1 ? 1 : 0;
cP && (Ws *= ql / r1), pr.glyphOffsetArray.length >= $l.MAX_GLYPHS && Vt("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 = JO(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 Ca = qs[U0 + 1];
Y1.emplaceBack(s.aq[qs[U0]], Ca[0], Ca[1]);
}
return [z0, Y1.length];
}(pr.textAnchorOffsets, uet);
pr.symbolInstances.emplaceBack(Pr.x, Pr.y, G3.right >= 0 ? G3.right : -1, G3.center >= 0 ? G3.center : -1, G3.left >= 0 ? G3.left : -1, G3.vertical || -1, cb, ub, aP, eet, ret, net, iet, oet, set, aet, cet, vo, oP, sP, U3, su, cP, 0, f1, Ws, het, det);
}(h, gr, ue, p, g, L, sr, h.layers[0], h.collisionBoxArray, c.index, c.sourceLayerIndex, h.index, bt, [Bt, Bt, Bt, Bt], Xe, N, $t, ee, xr, st, c, H, z, Z, A);
};
if (ze === "line")
for (const ue of UO(c.geometry, 0, 0, Wi, Wi)) {
const gr = Wtt(ue, kt, _e, p.vertical || ut, g, 24, Mt, h.overscaling, Wi);
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 = Ztt(ue, _e, p.vertical || ut, g, 24, Mt);
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 tP(h, c, p, g, L, H, A, O, N, z, Z, X, et, st, ut) {
const Tt = function($t, kt, Bt, ee, _e, Xe, xr, ze) {
const Re = ee.layout.get("text-rotate").evaluate(Xe, {}) * Math.PI / 180, Qr = [];
for (const sr of kt.positionedLines)
for (const rr of sr.positionedGlyphs) {
if (!rr.rect)
continue;
const ue = rr.rect || {};
let gr = QO + 1, pr = !0, Pr = 1, Fn = 0;
const Vn = (_e || ze) && rr.vertical, p1 = rr.metrics.advance * rr.scale / 2;
if (ze && kt.verticalizable && (Fn = sr.lineOffset / 2 - (rr.imageName ? -(r1 - rr.metrics.width * rr.scale) / 2 : (rr.scale - 1) * r1)), rr.imageName) {
const fn = xr[rr.imageName];
pr = fn.sdf, Pr = fn.pixelRatio, gr = No / Pr;
}
const gs = _e ? [rr.x + p1, rr.y] : [0, 0];
let I1 = _e ? [0, 0] : [rr.x + p1 + Bt[0], rr.y + Bt[1] - Fn], T1 = [0, 0];
Vn && (T1 = I1, I1 = [0, 0]);
const yo = rr.metrics.isDoubleResolution ? 2 : 1, vo = (rr.metrics.left - gr) * rr.scale - p1 + I1[0], _o = (-rr.metrics.top - gr) * rr.scale + I1[1], Ci = vo + ue.w / yo * rr.scale / Pr, f1 = _o + ue.h / yo * rr.scale / Pr, K1 = new f(vo, _o), R1 = new f(Ci, _o), bo = new f(vo, f1), N1 = new f(Ci, f1);
if (Vn) {
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 V2 = new f(0, 0), Do = new f(0, 0);
Qr.push({ tl: K1, tr: R1, bl: bo, br: N1, tex: ue, writingMode: kt.writingMode, glyphOffset: gs, sectionIndex: rr.sectionIndex, isSDF: pr, pixelOffsetTL: V2, pixelOffsetBR: Do, minFontScaleX: 0, minFontScaleY: 0 });
}
return Qr;
}(0, p, O, L, H, A, g, h.allowVerticalPlacement), bt = h.textSizeData;
let Mt = null;
bt.kind === "source" ? (Mt = [Sa * L.layout.get("text-size").evaluate(A, {})], Mt[0] > T6 && Vt(`${h.layerIds[0]}: Value for "text-size" is >= ${eu}. Reduce your "text-size".`)) : bt.kind === "composite" && (Mt = [Sa * st.compositeTextSizes[0].evaluate(A, {}, ut), Sa * st.compositeTextSizes[1].evaluate(A, {}, ut)], (Mt[0] > T6 || Mt[1] > T6) && Vt(`${h.layerIds[0]}: Value for "text-size" is >= ${eu}. Reduce your "text-size".`)), h.addSymbols(h.text, Tt, Mt, O, H, A, z, c, N.lineStartIndex, N.lineLength, et, ut);
for (const $t of Z)
X[$t] = h.text.placedSymbolArray.length - 1;
return 4 * Tt.length;
}
function eP(h) {
for (const c in h)
return h[c];
return null;
}
function Jtt(h, c, p, g) {
const L = h.compareText;
if (c in L) {
const H = L[c];
for (let A = H.length - 1; A >= 0; A--)
if (g.dist(H[A]) < p)
return !0;
} else
L[c] = [];
return L[c].push(g), !1;
}
const rP = [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 L = g >> 4;
if (L !== 1)
throw new Error(`Got v${L} data when expected v1.`);
const H = rP[15 & g];
if (!H)
throw new Error("Unrecognized array type.");
const [A] = new Uint16Array(c, 2, 1), [O] = new Uint32Array(c, 4, 1);
return new rb(O, A, H, c);
}
constructor(c, p = 64, g = Float64Array, L) {
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 = rP.indexOf(this.ArrayType), A = 2 * c * this.ArrayType.BYTES_PER_ELEMENT, O = c * this.IndexArrayType.BYTES_PER_ELEMENT, N = (8 - O % 8) % 8;
if (H < 0)
throw new Error(`Unexpected typed array class: ${g}.`);
L && L instanceof ArrayBuffer ? (this.data = L, this.ids = new this.IndexArrayType(this.data, 8, c), this.coords = new this.ArrayType(this.data, 8 + O + N, 2 * c), this._pos = 2 * c, this._finished = !0) : (this.data = new ArrayBuffer(8 + A + O + N), this.ids = new this.IndexArrayType(this.data, 8, c), this.coords = new this.ArrayType(this.data, 8 + O + 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, L) {
if (!this._finished)
throw new Error("Data not yet indexed - call index.finish().");
const { ids: H, coords: A, nodeSize: O } = this, N = [0, H.length - 1, 0], z = [];
for (; N.length; ) {
const Z = N.pop() || 0, X = N.pop() || 0, et = N.pop() || 0;
if (X - et <= O) {
for (let bt = et; bt <= X; bt++) {
const Mt = A[2 * bt], $t = A[2 * bt + 1];
Mt >= c && Mt <= g && $t >= p && $t <= L && z.push(H[bt]);
}
continue;
}
const st = et + X >> 1, ut = A[2 * st], Tt = A[2 * st + 1];
ut >= c && ut <= g && Tt >= p && Tt <= L && z.push(H[st]), (Z === 0 ? c <= ut : p <= Tt) && (N.push(et), N.push(st - 1), N.push(1 - Z)), (Z === 0 ? g >= ut : L >= Tt) && (N.push(st + 1), N.push(X), N.push(1 - Z));
}
return z;
}
within(c, p, g) {
if (!this._finished)
throw new Error("Data not yet indexed - call index.finish().");
const { ids: L, coords: H, nodeSize: A } = this, O = [0, L.length - 1, 0], N = [], z = g * g;
for (; O.length; ) {
const Z = O.pop() || 0, X = O.pop() || 0, et = O.pop() || 0;
if (X - et <= A) {
for (let bt = et; bt <= X; bt++)
iP(H[2 * bt], H[2 * bt + 1], c, p) <= z && N.push(L[bt]);
continue;
}
const st = et + X >> 1, ut = H[2 * st], Tt = H[2 * st + 1];
iP(ut, Tt, c, p) <= z && N.push(L[st]), (Z === 0 ? c - g <= ut : p - g <= Tt) && (O.push(et), O.push(st - 1), O.push(1 - Z)), (Z === 0 ? c + g >= ut : p + g >= Tt) && (O.push(st + 1), O.push(X), O.push(1 - Z));
}
return N;
}
}
function nb(h, c, p, g, L, H) {
if (L - g <= p)
return;
const A = g + L >> 1;
nP(h, c, A, g, L, H), nb(h, c, p, g, A - 1, 1 - H), nb(h, c, p, A + 1, L, 1 - H);
}
function nP(h, c, p, g, L, H) {
for (; L > g; ) {
if (L - g > 600) {
const z = L - g + 1, Z = p - g + 1, X = Math.log(z), et = 0.5 * Math.exp(2 * X / 3), st = 0.5 * Math.sqrt(X * et * (z - et) / z) * (Z - z / 2 < 0 ? -1 : 1);
nP(h, c, p, Math.max(g, Math.floor(p - Z * et / z + st)), Math.min(L, Math.floor(p + (z - Z) * et / z + st)), H);
}
const A = c[2 * p + H];
let O = g, N = L;
for (iu(h, c, g, p), c[2 * L + H] > A && iu(h, c, g, L); O < N; ) {
for (iu(h, c, O, N), O++, N--; c[2 * O + H] < A; )
O++;
for (; c[2 * N + H] > A; )
N--;
}
c[2 * g + H] === A ? iu(h, c, g, N) : (N++, iu(h, c, N, L)), N <= p && (g = N + 1), p <= N && (L = 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 iP(h, c, p, g) {
const L = h - p, H = c - g;
return L * L + 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), L = ou.filter((H) => H > sb).reduce((H, A) => H + (A - sb) / sb, 0);
return { loadTime: h, fullLoadTime: c, fps: g, percentDroppedFrames: L / (p + L) * 100, totalFrames: p };
} };
s.$ = class extends Y {
}, s.A = Bl, s.B = Q_, s.C = function(h) {
if (oe == null) {
const c = h.navigator ? h.navigator.userAgent : null;
oe = !!h.safari || !(!c || !(/\b(iPad|iPhone|iPod)\b/.test(c) || c.match("Safari") && !c.match("Chrome")));
}
return oe;
}, 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, L, H) {
return p.addEventListener(g, L, !1), { unsubscribe: () => {
p.removeEventListener(g, L, !1);
} };
}(this.target, "message", (p) => this.receive(p)), this.globalScope = ce(self) ? h : window;
}
registerMessageHandler(h, c) {
this.messageHandlers[h] = c;
}
sendAsync(h, c) {
return new Promise((p, g) => {
const L = Math.round(1e18 * Math.random()).toString(36).substring(0, 10);
this.resolveRejects[L] = { resolve: p, reject: g }, c && c.signal.addEventListener("abort", () => {
delete this.resolveRejects[L];
const O = { id: L, type: "", origin: location.origin, targetMapId: h.targetMapId, sourceMapId: this.mapId };
this.target.postMessage(O);
}, { once: !0 });
const H = [], A = Object.assign(Object.assign({}, h), { id: L, 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 (ce(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 L = this.resolveRejects[h];
return delete this.resolveRejects[h], L ? void (c.error ? L.reject(n6(c.error)) : L.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 L = yield this.messageHandlers[c.type](c.sourceMapId, p, g);
this.completeTask(h, null, L);
} catch (L) {
this.completeTask(h, L);
}
});
}
completeTask(h, c, p) {
const g = [];
delete this.abortControllers[h];
const L = { id: h, type: "", sourceMapId: this.mapId, origin: location.origin, error: c ? r6(c) : null, data: r6(p, g) };
this.target.postMessage(L, { 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, L, H, A, O, N, z, Z, X, et, st, ut, Tt = p[0], bt = p[1], Mt = p[2];
return c === h ? (h[12] = c[0] * Tt + c[4] * bt + c[8] * Mt + c[12], h[13] = c[1] * Tt + c[5] * bt + c[9] * Mt + c[13], h[14] = c[2] * Tt + c[6] * bt + c[10] * Mt + c[14], h[15] = c[3] * Tt + c[7] * bt + c[11] * Mt + c[15]) : (L = c[1], H = c[2], A = c[3], O = c[4], N = c[5], z = c[6], Z = c[7], X = c[8], et = c[9], st = c[10], ut = c[11], h[0] = g = c[0], h[1] = L, h[2] = H, h[3] = A, h[4] = O, h[5] = N, h[6] = z, h[7] = Z, h[8] = X, h[9] = et, h[10] = st, h[11] = ut, h[12] = g * Tt + O * bt + X * Mt + c[12], h[13] = L * Tt + N * bt + et * Mt + c[13], h[14] = H * Tt + z * bt + st * Mt + c[14], h[15] = A * Tt + Z * bt + ut * Mt + c[15]), h;
}, s.K = function(h, c, p) {
var g = p[0], L = 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] * L, h[5] = c[5] * L, h[6] = c[6] * L, h[7] = c[7] * L, 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 = NC, s.M = function(h, c) {
const p = {};
for (let g = 0; g < c.length; g++) {
const L = c[g];
L in h && (p[L] = h[L]);
}
return p;
}, s.N = f6, s.O = PO, s.P = f, s.Q = kO, s.R = P2, s.S = k2, s.T = Cl, s.U = x, s.V = C, s.W = qr, s.X = Wi, s.Y = I, s.Z = ru, s._ = a, s.a = er, s.a$ = function(h, c) {
var p = h[0], g = h[1], L = h[2], H = h[3], A = h[4], O = h[5], N = h[6], z = h[7], Z = h[8], X = h[9], et = h[10], st = h[11], ut = h[12], Tt = h[13], bt = h[14], Mt = h[15], $t = c[0], kt = c[1], Bt = c[2], ee = c[3], _e = c[4], Xe = c[5], xr = 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], Pr = c[15];
return Math.abs(p - $t) <= go * Math.max(1, Math.abs(p), Math.abs($t)) && Math.abs(g - kt) <= go * Math.max(1, Math.abs(g), Math.abs(kt)) && Math.abs(L - Bt) <= go * Math.max(1, Math.abs(L), 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(O - Xe) <= go * Math.max(1, Math.abs(O), Math.abs(Xe)) && Math.abs(N - xr) <= go * Math.max(1, Math.abs(N), Math.abs(xr)) && Math.abs(z - ze) <= go * Math.max(1, Math.abs(z), Math.abs(ze)) && Math.abs(Z - Re) <= go * Math.max(1, Math.abs(Z), Math.abs(Re)) && Math.abs(X - Qr) <= go * Math.max(1, Math.abs(X), Math.abs(Qr)) && Math.abs(et - sr) <= go * Math.max(1, Math.abs(et), Math.abs(sr)) && Math.abs(st - rr) <= go * Math.max(1, Math.abs(st), 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(bt - pr) <= go * Math.max(1, Math.abs(bt), Math.abs(pr)) && Math.abs(Mt - Pr) <= go * Math.max(1, Math.abs(Mt), Math.abs(Pr));
}, 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 L = window.document.createElement("source");
de(g) || (c.crossOrigin = "Anonymous"), L.src = g, c.appendChild(L);
}
});
}, s.a4 = function() {
return rt++;
}, s.a5 = Ze, s.a6 = $l, s.a7 = Y4, s.a8 = B0, s.a9 = FO, 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 EJ(h);
case "fill":
return new UJ(h);
case "fill-extrusion":
return new ott(h);
case "heatmap":
return new HJ(h);
case "hillshade":
return new CJ(h);
case "line":
return new ptt(h);
case "raster":
return new ztt(h);
case "symbol":
return new Dp(h);
}
}, s.aB = lt, s.aC = function(h, c) {
if (!h)
return [{ command: "setStyle", args: [c] }];
let p = [];
try {
if (!Sr(h.version, c.version))
return [{ command: "setStyle", args: [c] }];
Sr(h.center, c.center) || p.push({ command: "setCenter", args: [c.center] }), Sr(h.zoom, c.zoom) || p.push({ command: "setZoom", args: [c.zoom] }), Sr(h.bearing, c.bearing) || p.push({ command: "setBearing", args: [c.bearing] }), Sr(h.pitch, c.pitch) || p.push({ command: "setPitch", args: [c.pitch] }), Sr(h.sprite, c.sprite) || p.push({ command: "setSprite", args: [c.sprite] }), Sr(h.glyphs, c.glyphs) || p.push({ command: "setGlyphs", args: [c.glyphs] }), Sr(h.transition, c.transition) || p.push({ command: "setTransition", args: [c.transition] }), Sr(h.light, c.light) || p.push({ command: "setLight", args: [c.light] }), Sr(h.terrain, c.terrain) || p.push({ command: "setTerrain", args: [c.terrain] }), Sr(h.sky, c.sky) || p.push({ command: "setSky", args: [c.sky] }), Sr(h.projection, c.projection) || p.push({ command: "setProjection", args: [c.projection] });
const g = {}, L = [];
(function(A, O, N, z) {
let Z;
for (Z in O = O || {}, A = A || {})
Object.prototype.hasOwnProperty.call(A, Z) && (Object.prototype.hasOwnProperty.call(O, Z) || ji(Z, N, z));
for (Z in O)
Object.prototype.hasOwnProperty.call(O, Z) && (Object.prototype.hasOwnProperty.call(A, Z) ? Sr(A[Z], O[Z]) || (A[Z].type === "geojson" && O[Z].type === "geojson" && Pi(A, O, Z) ? Rr(N, { command: "setGeoJSONSourceData", args: [Z, O[Z].data] }) : Ji(Z, O, N, z)) : dn(Z, O, N));
})(h.sources, c.sources, L, 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(L), function(A, O, N) {
O = O || [];
const z = (A = A || []).map(ki), Z = O.map(ki), X = A.reduce(c1, {}), et = O.reduce(c1, {}), st = z.slice(), ut = /* @__PURE__ */ Object.create(null);
let Tt, bt, Mt, $t, kt;
for (let Bt = 0, ee = 0; Bt < z.length; Bt++)
Tt = z[Bt], Object.prototype.hasOwnProperty.call(et, Tt) ? ee++ : (Rr(N, { command: "removeLayer", args: [Tt] }), st.splice(st.indexOf(Tt, ee), 1));
for (let Bt = 0, ee = 0; Bt < Z.length; Bt++)
Tt = Z[Z.length - 1 - Bt], st[st.length - 1 - Bt] !== Tt && (Object.prototype.hasOwnProperty.call(X, Tt) ? (Rr(N, { command: "removeLayer", args: [Tt] }), st.splice(st.lastIndexOf(Tt, st.length - ee), 1)) : ee++, $t = st[st.length - Bt], Rr(N, { command: "addLayer", args: [et[Tt], $t] }), st.splice(st.length - Bt, 0, Tt), ut[Tt] = !0);
for (let Bt = 0; Bt < Z.length; Bt++)
if (Tt = Z[Bt], bt = X[Tt], Mt = et[Tt], !ut[Tt] && !Sr(bt, Mt))
if (Sr(bt.source, Mt.source) && Sr(bt["source-layer"], Mt["source-layer"]) && Sr(bt.type, Mt.type)) {
for (kt in _i(bt.layout, Mt.layout, N, Tt, null, "setLayoutProperty"), _i(bt.paint, Mt.paint, N, Tt, null, "setPaintProperty"), Sr(bt.filter, Mt.filter) || Rr(N, { command: "setFilter", args: [Tt, Mt.filter] }), Sr(bt.minzoom, Mt.minzoom) && Sr(bt.maxzoom, Mt.maxzoom) || Rr(N, { command: "setLayerZoomRange", args: [Tt, Mt.minzoom, Mt.maxzoom] }), bt)
Object.prototype.hasOwnProperty.call(bt, kt) && kt !== "layout" && kt !== "paint" && kt !== "filter" && kt !== "metadata" && kt !== "minzoom" && kt !== "maxzoom" && (kt.indexOf("paint.") === 0 ? _i(bt[kt], Mt[kt], N, Tt, kt.slice(6), "setPaintProperty") : Sr(bt[kt], Mt[kt]) || Rr(N, { command: "setLayerProperty", args: [Tt, kt, Mt[kt]] }));
for (kt in Mt)
Object.prototype.hasOwnProperty.call(Mt, kt) && !Object.prototype.hasOwnProperty.call(bt, kt) && kt !== "layout" && kt !== "paint" && kt !== "filter" && kt !== "metadata" && kt !== "minzoom" && kt !== "maxzoom" && (kt.indexOf("paint.") === 0 ? _i(bt[kt], Mt[kt], N, Tt, kt.slice(6), "setPaintProperty") : Sr(bt[kt], Mt[kt]) || Rr(N, { command: "setLayerProperty", args: [Tt, kt, Mt[kt]] }));
} else
Rr(N, { command: "removeLayer", args: [Tt] }), $t = st[st.lastIndexOf(Tt) + 1], Rr(N, { command: "addLayer", args: [Mt, $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 = tt, s.aG = at, 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 = Mp, 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 = EC, s.aL = SC, 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, L, H, A) {
var O = 1 / (c - p), N = 1 / (g - L), z = 1 / (H - A);
return h[0] = -2 * O, 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) * O, h[13] = (L + g) * N, h[14] = (A + H) * z, h[15] = 1, h;
}, s.aQ = MJ, s.aR = class extends Nt {
}, s.aS = mtt, s.aT = class extends Wt {
}, s.aU = C_, s.aV = function(h) {
return h <= 1 ? 1 : Math.pow(2, Math.ceil(Math.log(h) / Math.LN2));
}, s.aW = zC, s.aX = P1, s.aY = O2, 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, L, H) => {
const A = L || 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), L = Math.cos(p), H = c[0], A = c[1], O = c[2], N = c[3], z = c[4], Z = c[5], X = c[6], et = 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 * L + z * g, h[1] = A * L + Z * g, h[2] = O * L + X * g, h[3] = N * L + et * g, h[4] = z * L - H * g, h[5] = Z * L - A * g, h[6] = X * L - O * g, h[7] = et * L - 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: L, minZoom: H, maxZoom: A } = h, O = L ? F(un.interpolationFactor(L, c, H, A), 0, 1) : 0;
h.kind === "camera" ? g = wr.number(h.minSize, h.maxSize, O) : p = O;
}
return { uSizeT: p, uSize: g };
}, s.ai = function(h, { uSize: c, uSizeT: p }, { lowerSize: g, upperSize: L }) {
return h.kind === "source" ? g / Sa : h.kind === "composite" ? wr.number(g / Sa, L / Sa, p) : c;
}, s.aj = Z_, s.ak = function(h, c, p, g) {
const L = c.y - h.y, H = c.x - h.x, A = g.y - p.y, O = g.x - p.x, N = A * H - O * L;
if (N === 0)
return null;
const z = (O * (h.y - p.y) - A * (h.x - p.x)) / N;
return new f(h.x + z * H, h.y + z * L);
}, s.al = UO, s.am = OC, s.an = S_, s.ao = function(h) {
let c = 1 / 0, p = 1 / 0, g = -1 / 0, L = -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), L = Math.max(L, H.y);
return [c, p, g, L];
}, s.ap = r1, s.ar = $_, s.as = function(h, c) {
var p = c[0], g = c[1], L = c[2], H = c[3], A = c[4], O = c[5], N = c[6], z = c[7], Z = c[8], X = c[9], et = c[10], st = c[11], ut = c[12], Tt = c[13], bt = c[14], Mt = c[15], $t = p * O - g * A, kt = p * N - L * A, Bt = p * z - H * A, ee = g * N - L * O, _e = g * z - H * O, Xe = L * z - H * N, xr = Z * Tt - X * ut, ze = Z * bt - et * ut, Re = Z * Mt - st * ut, Qr = X * bt - et * Tt, sr = X * Mt - st * Tt, rr = et * Mt - st * bt, ue = $t * rr - kt * sr + Bt * Qr + ee * Re - _e * ze + Xe * xr;
return ue ? (h[0] = (O * rr - N * sr + z * Qr) * (ue = 1 / ue), h[1] = (L * sr - g * rr - H * Qr) * ue, h[2] = (Tt * Xe - bt * _e + Mt * ee) * ue, h[3] = (et * _e - X * Xe - st * ee) * ue, h[4] = (N * Re - A * rr - z * ze) * ue, h[5] = (p * rr - L * Re + H * ze) * ue, h[6] = (bt * Bt - ut * Xe - Mt * kt) * ue, h[7] = (Z * Xe - et * Bt + st * kt) * ue, h[8] = (A * sr - O * Re + z * xr) * ue, h[9] = (g * Re - p * sr - H * xr) * ue, h[10] = (ut * _e - Tt * Bt + Mt * $t) * ue, h[11] = (X * Bt - Z * _e - st * $t) * ue, h[12] = (O * ze - A * Qr - N * xr) * ue, h[13] = (p * Qr - g * ze + L * xr) * ue, h[14] = (Tt * kt - ut * ee - bt * $t) * ue, h[15] = (Z * ee - X * kt + et * $t) * ue, h) : null;
}, s.at = eb, s.au = G_, s.av = rb, s.aw = function() {
const h = {}, c = Ot.$version;
for (const p in Ot.$root) {
const g = Ot.$root[p];
if (g.required) {
let L = null;
L = p === "version" ? c : g.type === "array" ? [] : {}, L != null && (h[p] = L);
}
}
return h;
}, s.ax = Ic, 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 = Se, 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 = RO, s.b5 = VO, s.b6 = function(h, c, p, g, L) {
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, L != null && L !== 1 / 0 ? (h[10] = (L + g) * (H = 1 / (g - L)), h[14] = 2 * L * g * H) : (h[10] = -1, h[14] = -2 * g), h;
}, s.b7 = function(h, c, p) {
var g = Math.sin(p), L = Math.cos(p), H = c[4], A = c[5], O = c[6], N = c[7], z = c[8], Z = c[9], X = c[10], et = 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 * L + z * g, h[5] = A * L + Z * g, h[6] = O * L + X * g, h[7] = N * L + et * g, h[8] = z * L - H * g, h[9] = Z * L - A * g, h[10] = X * L - O * g, h[11] = et * L - N * g, h;
}, s.b8 = P, s.b9 = R, s.bA = cO, s.bB = function(h) {
return h.message === Ke;
}, s.bC = _1, s.bD = Io, 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 W {
}, 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 L = 0; L < h.length; L++) {
const H = c && c[h[L].id] || e2(h[L]);
c && (c[h[L].id] = H);
let A = p[H];
A || (A = p[H] = []), A.push(h[L]);
}
const g = [];
for (const L in p)
g.push(p[L]);
return g;
}, s.bl = nr, s.bm = DO, s.bn = BO, s.bo = gO, s.bp = function(h) {
h.bucket.createArrays(), h.bucket.tilePixelRatio = Wi / (512 * h.bucket.overscaling), h.bucket.compareText = {}, h.bucket.iconsNeedLinear = !1;
const c = h.bucket.layers[0], p = c.layout, g = c._unevaluatedLayout._values, L = { 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: Z } = h.bucket.textSizeData;
L.compositeTextSizes = [g["text-size"].possiblyEvaluate(new ti(z), h.canonical), g["text-size"].possiblyEvaluate(new ti(Z), h.canonical)];
}
if (h.bucket.iconSizeData.kind === "composite") {
const { minZoom: z, maxZoom: Z } = h.bucket.iconSizeData;
L.compositeIconSizes = [g["icon-size"].possiblyEvaluate(new ti(z), h.canonical), g["icon-size"].possiblyEvaluate(new ti(Z), h.canonical)];
}
const H = p.get("text-line-height") * r1, A = p.get("text-rotation-alignment") !== "viewport" && p.get("symbol-placement") !== "point", O = p.get("text-keep-upright"), N = p.get("text-size");
for (const z of h.bucket.features) {
const Z = p.get("text-font").evaluate(z, {}, h.canonical).join(","), X = N.evaluate(z, {}, h.canonical), et = L.layoutTextSize.evaluate(z, {}, h.canonical), st = L.layoutIconSize.evaluate(z, {}, h.canonical), ut = { horizontal: {}, vertical: void 0 }, Tt = z.text;
let bt, Mt = [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), xr = JO(c, z, h.canonical);
if (!xr) {
const sr = p.get("text-radial-offset").evaluate(z, {}, h.canonical);
Mt = sr ? YO(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 = Ip(Tt, h.glyphMap, h.glyphPositions, h.imagePositions, Z, Re, H, Xe, "left", _e, Mt, s.ah.vertical, !0, et, X));
};
if (!A && xr) {
const sr = /* @__PURE__ */ new Set();
if (ze === "auto")
for (let ue = 0; ue < xr.values.length; ue += 2)
sr.add(eb(xr.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 = Ip(Tt, h.glyphMap, h.glyphPositions, h.imagePositions, Z, Re, H, "center", ue, _e, Mt, s.ah.horizontal, !1, et, X);
gr && (ut.horizontal[ue] = gr, rr = gr.positionedLines.length === 1);
}
Qr();
} else {
ze === "auto" && (ze = eb(Xe));
const sr = Ip(Tt, h.glyphMap, h.glyphPositions, h.imagePositions, Z, Re, H, Xe, ze, _e, Mt, s.ah.horizontal, !1, et, X);
sr && (ut.horizontal[ze] = sr), Qr(), Rc(Bt) && A && O && (ut.vertical = Ip(Tt, h.glyphMap, h.glyphPositions, h.imagePositions, Z, Re, H, Xe, ze, _e, Mt, s.ah.vertical, !1, et, X));
}
}
let $t = !1;
if (z.icon && z.icon.name) {
const Bt = h.imageMap[z.icon.name];
Bt && (bt = Itt(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 && Vt("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 kt = eP(ut.horizontal) || ut.vertical;
h.bucket.iconsInText = !!kt && kt.iconsInText, (kt || bt) && Ytt(h.bucket, z, ut, bt, h.imageMap, L, et, st, Mt, $t, h.canonical);
}
h.showCollisionBoxes && h.bucket.generateCollisionDebugBuffers();
}, s.bq = D_, s.br = I_, 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, L) {
return a(this, void 0, void 0, function* () {
if (C())
try {
return yield qr(h, c, p, g, L);
} catch {
}
return function(H, A, O, N, z) {
const Z = H.width, X = H.height;
ne && Qe || (ne = new OffscreenCanvas(Z, X), Qe = ne.getContext("2d", { willReadFrequently: !0 })), ne.width = Z, ne.height = X, Qe.drawImage(H, 0, 0, Z, X);
const et = Qe.getImageData(A, O, N, z);
return Qe.clearRect(0, 0, Z, X), et.data;
}(h, c, p, g, L);
});
}, s.bx = NO, s.by = u, s.bz = d, s.c = Ae, 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 = Ir;
});
}, 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 L = new Blob([new Uint8Array(h)], { type: "image/png" });
g.src = h.byteLength ? URL.createObjectURL(L) : Ir;
}), s.g = Je, s.h = (h, c) => me($(h, { type: "json" }), c), s.i = ce, 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 = mO, s.q = E, s.r = f_, s.s = de, s.t = kc, s.u = F3, s.v = Ot, s.w = Vt, 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 = wr, s.z = ti;
}), i("worker", ["./shared"], function(s) {
class a {
constructor(it) {
this.keyCache = {}, it && this.replace(it);
}
replace(it) {
this._layerConfigs = {}, this._layers = {}, this.update(it, []);
}
update(it, ot) {
for (const gt of it) {
this._layerConfigs[gt.id] = gt;
const At = this._layers[gt.id] = s.aA(gt);
At._featureFilter = s.a7(At.filter), this.keyCache[gt.id] && delete this.keyCache[gt.id];
}
for (const gt of ot)
delete this.keyCache[gt], delete this._layerConfigs[gt], delete this._layers[gt];
this.familiesBySource = {};
const pt = s.bk(Object.values(this._layerConfigs), this.keyCache);
for (const gt of pt) {
const At = gt.map((Xt) => this._layers[Xt.id]), It = At[0];
if (It.visibility === "none")
continue;
const jt = It.source || "";
let St = this.familiesBySource[jt];
St || (St = this.familiesBySource[jt] = {});
const Jt = It.sourceLayer || "_geojsonTileLayer";
let se = St[Jt];
se || (se = St[Jt] = []), se.push(At);
}
}
}
class u {
constructor(it) {
const ot = {}, pt = [];
for (const jt in it) {
const St = it[jt], Jt = ot[jt] = {};
for (const se in St) {
const Xt = St[+se];
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[se] = { rect: Le, metrics: Xt.metrics };
}
}
const { w: gt, h: At } = s.p(pt), It = new s.o({ width: gt || 1, height: At || 1 });
for (const jt in it) {
const St = it[jt];
for (const Jt in St) {
const se = St[+Jt];
if (!se || se.bitmap.width === 0 || se.bitmap.height === 0)
continue;
const Xt = ot[jt][Jt].rect;
s.o.copy(se.bitmap, It, { x: 0, y: 0 }, { x: Xt.x + 1, y: Xt.y + 1 }, se.bitmap);
}
}
this.image = It, this.positions = ot;
}
}
s.bl("GlyphAtlas", u);
class d {
constructor(it) {
this.tileID = new s.S(it.tileID.overscaledZ, it.tileID.wrap, it.tileID.canonical.z, it.tileID.canonical.x, it.tileID.canonical.y), this.uid = it.uid, this.zoom = it.zoom, this.pixelRatio = it.pixelRatio, this.tileSize = it.tileSize, this.source = it.source, this.overscaling = this.tileID.overscaleFactor(), this.showCollisionBoxes = it.showCollisionBoxes, this.collectResourceTiming = !!it.collectResourceTiming, this.returnDependencies = !!it.returnDependencies, this.promoteId = it.promoteId, this.inFlightDependencies = [];
}
parse(it, ot, pt, gt) {
return s._(this, void 0, void 0, function* () {
this.status = "parsing", this.data = it, this.collisionBoxArray = new s.a5();
const At = new s.bm(Object.keys(it.layers).sort()), It = new s.bn(this.tileID, this.promoteId);
It.bucketLayerIDs = [];
const jt = {}, St = { featureIndex: It, iconDependencies: {}, patternDependencies: {}, glyphDependencies: {}, availableImages: pt }, Jt = ot.familiesBySource[this.source];
for (const vr in Jt) {
const $r = it.layers[vr];
if (!$r)
continue;
$r.version === 1 && s.w(`Vector tile source "${this.source}" layer "${vr}" does not use vector tile spec v2 and therefore may have some rendering errors.`);
const cn = At.encode(vr), Kn = [];
for (let Li = 0; Li < $r.length; Li++) {
const Ri = $r.feature(Li), rs = It.getId(Ri, vr);
Kn.push({ feature: Ri, id: rs, index: Li, sourceLayerIndex: cn });
}
for (const Li of Jt[vr]) {
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: It.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), It.bucketLayerIDs.push(Li.map((rs) => rs.id)));
}
}
const se = s.aF(St.glyphDependencies, (vr) => Object.keys(vr).map(Number));
this.inFlightDependencies.forEach((vr) => vr == null ? void 0 : vr.abort()), this.inFlightDependencies = [];
let Xt = Promise.resolve({});
if (Object.keys(se).length) {
const vr = new AbortController();
this.inFlightDependencies.push(vr), Xt = gt.sendAsync({ type: "GG", data: { stacks: se, source: this.source, tileID: this.tileID, type: "glyphs" } }, vr);
}
const Le = Object.keys(St.iconDependencies);
let or = Promise.resolve({});
if (Le.length) {
const vr = new AbortController();
this.inFlightDependencies.push(vr), or = gt.sendAsync({ type: "GI", data: { icons: Le, source: this.source, tileID: this.tileID, type: "icons" } }, vr);
}
const Rt = Object.keys(St.patternDependencies);
let Te = Promise.resolve({});
if (Rt.length) {
const vr = new AbortController();
this.inFlightDependencies.push(vr), Te = gt.sendAsync({ type: "GI", data: { icons: Rt, source: this.source, tileID: this.tileID, type: "patterns" } }, vr);
}
const [He, lr, Hr] = yield Promise.all([Xt, or, Te]), vn = new u(He), Nr = new s.bo(lr, Hr);
for (const vr in jt) {
const $r = jt[vr];
$r instanceof s.a6 ? (T($r.layers, this.zoom, pt), s.bp({ bucket: $r, glyphMap: He, glyphPositions: vn.positions, imageMap: lr, imagePositions: Nr.iconPositions, showCollisionBoxes: this.showCollisionBoxes, canonical: this.tileID.canonical })) : $r.hasPattern && ($r instanceof s.bq || $r instanceof s.br || $r instanceof s.bs) && (T($r.layers, this.zoom, pt), $r.addFeatures(St, this.tileID.canonical, Nr.patternPositions));
}
return this.status = "done", { buckets: Object.values(jt).filter((vr) => !vr.isEmpty()), featureIndex: It, collisionBoxArray: this.collisionBoxArray, glyphAtlasImage: vn.image, imageAtlas: Nr, glyphMap: this.returnDependencies ? He : null, iconMap: this.returnDependencies ? lr : null, glyphPositions: this.returnDependencies ? vn.positions : null };
});
}
}
function T(wt, it, ot) {
const pt = new s.z(it);
for (const gt of wt)
gt.recalculate(pt, ot);
}
class f {
constructor(it, ot, pt) {
this.actor = it, this.layerIndex = ot, this.availableImages = pt, this.fetching = {}, this.loading = {}, this.loaded = {};
}
loadVectorTile(it, ot) {
return s._(this, void 0, void 0, function* () {
const pt = yield s.l(it.request, ot);
try {
return { vectorTile: new s.bt.VectorTile(new s.bu(pt.data)), rawData: pt.data, cacheControl: pt.cacheControl, expires: pt.expires };
} catch (gt) {
const At = new Uint8Array(pt.data);
let It = `Unable to parse the tile at ${it.request.url}, `;
throw It += 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: ${gt.message}`, new Error(It);
}
});
}
loadTile(it) {
return s._(this, void 0, void 0, function* () {
const ot = it.uid, pt = !!(it && it.request && it.request.collectResourceTiming) && new s.bv(it.request), gt = new d(it);
this.loading[ot] = gt;
const At = new AbortController();
gt.abort = At;
try {
const It = yield this.loadVectorTile(it, At);
if (delete this.loading[ot], !It)
return null;
const jt = It.rawData, St = {};
It.expires && (St.expires = It.expires), It.cacheControl && (St.cacheControl = It.cacheControl);
const Jt = {};
if (pt) {
const Xt = pt.finish();
Xt && (Jt.resourceTiming = JSON.parse(JSON.stringify(Xt)));
}
gt.vectorTile = It.vectorTile;
const se = gt.parse(It.vectorTile, this.layerIndex, this.availableImages, this.actor);
this.loaded[ot] = gt, this.fetching[ot] = { rawTileData: jt, cacheControl: St, resourceTiming: Jt };
try {
const Xt = yield se;
return s.e({ rawTileData: jt.slice(0) }, Xt, St, Jt);
} finally {
delete this.fetching[ot];
}
} catch (It) {
throw delete this.loading[ot], gt.status = "done", this.loaded[ot] = gt, It;
}
});
}
reloadTile(it) {
return s._(this, void 0, void 0, function* () {
const ot = it.uid;
if (!this.loaded || !this.loaded[ot])
throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");
const pt = this.loaded[ot];
if (pt.showCollisionBoxes = it.showCollisionBoxes, pt.status === "parsing") {
const gt = yield pt.parse(pt.vectorTile, this.layerIndex, this.availableImages, this.actor);
let At;
if (this.fetching[ot]) {
const { rawTileData: It, cacheControl: jt, resourceTiming: St } = this.fetching[ot];
delete this.fetching[ot], At = s.e({ rawTileData: It.slice(0) }, gt, jt, St);
} else
At = gt;
return At;
}
if (pt.status === "done" && pt.vectorTile)
return pt.parse(pt.vectorTile, this.layerIndex, this.availableImages, this.actor);
});
}
abortTile(it) {
return s._(this, void 0, void 0, function* () {
const ot = this.loading, pt = it.uid;
ot && ot[pt] && ot[pt].abort && (ot[pt].abort.abort(), delete ot[pt]);
});
}
removeTile(it) {
return s._(this, void 0, void 0, function* () {
this.loaded && this.loaded[it.uid] && delete this.loaded[it.uid];
});
}
}
class Q {
constructor() {
this.loaded = {};
}
loadTile(it) {
return s._(this, void 0, void 0, function* () {
const { uid: ot, encoding: pt, rawImageData: gt, redFactor: At, greenFactor: It, blueFactor: jt, baseShift: St } = it, Jt = gt.width + 2, se = gt.height + 2, Xt = s.b(gt) ? new s.R({ width: Jt, height: se }, yield s.bw(gt, -1, -1, Jt, se)) : gt, Le = new s.bx(ot, Xt, pt, At, It, jt, St);
return this.loaded = this.loaded || {}, this.loaded[ot] = Le, Le;
});
}
removeTile(it) {
const ot = this.loaded, pt = it.uid;
ot && ot[pt] && delete ot[pt];
}
}
function y(wt, it) {
if (wt.length !== 0) {
b(wt[0], it);
for (var ot = 1; ot < wt.length; ot++)
b(wt[ot], !it);
}
}
function b(wt, it) {
for (var ot = 0, pt = 0, gt = 0, At = wt.length, It = At - 1; gt < At; It = gt++) {
var jt = (wt[gt][0] - wt[It][0]) * (wt[It][1] + wt[gt][1]), St = ot + jt;
pt += Math.abs(ot) >= Math.abs(jt) ? ot - St + jt : jt - St + ot, ot = St;
}
ot + pt >= 0 != !!it && wt.reverse();
}
var w = s.by(function wt(it, ot) {
var pt, gt = it && it.type;
if (gt === "FeatureCollection")
for (pt = 0; pt < it.features.length; pt++)
wt(it.features[pt], ot);
else if (gt === "GeometryCollection")
for (pt = 0; pt < it.geometries.length; pt++)
wt(it.geometries[pt], ot);
else if (gt === "Feature")
wt(it.geometry, ot);
else if (gt === "Polygon")
y(it.coordinates, ot);
else if (gt === "MultiPolygon")
for (pt = 0; pt < it.coordinates.length; pt++)
y(it.coordinates[pt], ot);
return it;
});
const S = s.bt.VectorTileFeature.prototype.toGeoJSON;
var x = { exports: {} }, C = s.bz, P = s.bt.VectorTileFeature, R = F;
function F(wt, it) {
this.options = it || {}, this.features = wt, this.length = wt.length;
}
function U(wt, it) {
this.id = typeof wt.id == "number" ? wt.id : void 0, this.type = wt.type, this.rawGeometry = wt.type === 1 ? [wt.geometry] : wt.geometry, this.properties = wt.tags, this.extent = it || 4096;
}
F.prototype.feature = function(wt) {
return new U(this.features[wt], this.options.extent);
}, U.prototype.loadGeometry = function() {
var wt = this.rawGeometry;
this.geometry = [];
for (var it = 0; it < wt.length; it++) {
for (var ot = wt[it], pt = [], gt = 0; gt < ot.length; gt++)
pt.push(new C(ot[gt][0], ot[gt][1]));
this.geometry.push(pt);
}
return this.geometry;
}, U.prototype.bbox = function() {
this.geometry || this.loadGeometry();
for (var wt = this.geometry, it = 1 / 0, ot = -1 / 0, pt = 1 / 0, gt = -1 / 0, At = 0; At < wt.length; At++)
for (var It = wt[At], jt = 0; jt < It.length; jt++) {
var St = It[jt];
it = Math.min(it, St.x), ot = Math.max(ot, St.x), pt = Math.min(pt, St.y), gt = Math.max(gt, St.y);
}
return [it, pt, ot, gt];
}, U.prototype.toGeoJSON = P.prototype.toGeoJSON;
var $ = s.bA, rt = R;
function tt(wt) {
var it = new $();
return function(ot, pt) {
for (var gt in ot.layers)
pt.writeMessage(3, at, ot.layers[gt]);
}(wt, it), it.finish();
}
function at(wt, it) {
var ot;
it.writeVarintField(15, wt.version || 1), it.writeStringField(1, wt.name || ""), it.writeVarintField(5, wt.extent || 4096);
var pt = { keys: [], values: [], keycache: {}, valuecache: {} };
for (ot = 0; ot < wt.length; ot++)
pt.feature = wt.feature(ot), it.writeMessage(2, lt, pt);
var gt = pt.keys;
for (ot = 0; ot < gt.length; ot++)
it.writeStringField(3, gt[ot]);
var At = pt.values;
for (ot = 0; ot < At.length; ot++)
it.writeMessage(4, oe, At[ot]);
}
function lt(wt, it) {
var ot = wt.feature;
ot.id !== void 0 && it.writeVarintField(1, ot.id), it.writeMessage(2, xt, wt), it.writeVarintField(3, ot.type), it.writeMessage(4, ce, ot);
}
function xt(wt, it) {
var ot = wt.feature, pt = wt.keys, gt = wt.values, At = wt.keycache, It = wt.valuecache;
for (var jt in ot.properties) {
var St = ot.properties[jt], Jt = At[jt];
if (St !== null) {
Jt === void 0 && (pt.push(jt), At[jt] = Jt = pt.length - 1), it.writeVarint(Jt);
var se = typeof St;
se !== "string" && se !== "boolean" && se !== "number" && (St = JSON.stringify(St));
var Xt = se + ":" + St, Le = It[Xt];
Le === void 0 && (gt.push(St), It[Xt] = Le = gt.length - 1), it.writeVarint(Le);
}
}
}
function Vt(wt, it) {
return (it << 3) + (7 & wt);
}
function Zt(wt) {
return wt << 1 ^ wt >> 31;
}
function ce(wt, it) {
for (var ot = wt.loadGeometry(), pt = wt.type, gt = 0, At = 0, It = ot.length, jt = 0; jt < It; jt++) {
var St = ot[jt], Jt = 1;
pt === 1 && (Jt = St.length), it.writeVarint(Vt(1, Jt));
for (var se = pt === 3 ? St.length - 1 : St.length, Xt = 0; Xt < se; Xt++) {
Xt === 1 && pt !== 1 && it.writeVarint(Vt(2, se - 1));
var Le = St[Xt].x - gt, or = St[Xt].y - At;
it.writeVarint(Zt(Le)), it.writeVarint(Zt(or)), gt += Le, At += or;
}
pt === 3 && it.writeVarint(Vt(7, 1));
}
}
function oe(wt, it) {
var ot = typeof wt;
ot === "string" ? it.writeStringField(1, wt) : ot === "boolean" ? it.writeBooleanField(7, wt) : ot === "number" && (wt % 1 != 0 ? it.writeDoubleField(3, wt) : wt < 0 ? it.writeSVarintField(6, wt) : it.writeVarintField(5, wt));
}
x.exports = tt, x.exports.fromVectorTileJs = tt, x.exports.fromGeojsonVt = function(wt, it) {
it = it || {};
var ot = {};
for (var pt in wt)
ot[pt] = new rt(wt[pt].features, it), ot[pt].name = pt, ot[pt].version = it.version, ot[pt].extent = it.extent;
return tt({ layers: ot });
}, x.exports.GeoJSONWrapper = rt;
var Se = s.by(x.exports);
const Ir = { minZoom: 0, maxZoom: 16, minPoints: 2, radius: 40, extent: 512, nodeSize: 64, log: !1, generateId: !1, reduce: null, map: (wt) => wt }, qr = Math.fround || (ne = new Float32Array(1), (wt) => (ne[0] = +wt, ne[0]));
var ne;
const Qe = 3, Ke = 5, Ae = 6;
class er {
constructor(it) {
this.options = Object.assign(Object.create(Ir), it), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];
}
load(it) {
const { log: ot, minZoom: pt, maxZoom: gt } = this.options;
ot && console.time("total time");
const At = `prepare ${it.length} points`;
ot && console.time(At), this.points = it;
const It = [];
for (let St = 0; St < it.length; St++) {
const Jt = it[St];
if (!Jt.geometry)
continue;
const [se, Xt] = Jt.geometry.coordinates, Le = qr(Gt(se)), or = qr(te(Xt));
It.push(Le, or, 1 / 0, St, -1, 1), this.options.reduce && It.push(0);
}
let jt = this.trees[gt + 1] = this._createTree(It);
ot && console.timeEnd(At);
for (let St = gt; St >= pt; St--) {
const Jt = +Date.now();
jt = this.trees[St] = this._createTree(this._cluster(jt, St)), ot && console.log("z%d: %d clusters in %dms", St, jt.numItems, +Date.now() - Jt);
}
return ot && console.timeEnd("total time"), this;
}
getClusters(it, ot) {
let pt = ((it[0] + 180) % 360 + 360) % 360 - 180;
const gt = Math.max(-90, Math.min(90, it[1]));
let At = it[2] === 180 ? 180 : ((it[2] + 180) % 360 + 360) % 360 - 180;
const It = Math.max(-90, Math.min(90, it[3]));
if (it[2] - it[0] >= 360)
pt = -180, At = 180;
else if (pt > At) {
const Xt = this.getClusters([pt, gt, 180, It], ot), Le = this.getClusters([-180, gt, At, It], ot);
return Xt.concat(Le);
}
const jt = this.trees[this._limitZoom(ot)], St = jt.range(Gt(pt), te(It), Gt(At), te(gt)), Jt = jt.data, se = [];
for (const Xt of St) {
const Le = this.stride * Xt;
se.push(Jt[Le + Ke] > 1 ? Je(Jt, Le, this.clusterProps) : this.points[Jt[Le + Qe]]);
}
return se;
}
getChildren(it) {
const ot = this._getOriginId(it), pt = this._getOriginZoom(it), gt = "No cluster with the specified id.", At = this.trees[pt];
if (!At)
throw new Error(gt);
const It = At.data;
if (ot * this.stride >= It.length)
throw new Error(gt);
const jt = this.options.radius / (this.options.extent * Math.pow(2, pt - 1)), St = At.within(It[ot * this.stride], It[ot * this.stride + 1], jt), Jt = [];
for (const se of St) {
const Xt = se * this.stride;
It[Xt + 4] === it && Jt.push(It[Xt + Ke] > 1 ? Je(It, Xt, this.clusterProps) : this.points[It[Xt + Qe]]);
}
if (Jt.length === 0)
throw new Error(gt);
return Jt;
}
getLeaves(it, ot, pt) {
const gt = [];
return this._appendLeaves(gt, it, ot = ot || 10, pt = pt || 0, 0), gt;
}
getTile(it, ot, pt) {
const gt = this.trees[this._limitZoom(it)], At = Math.pow(2, it), { extent: It, radius: jt } = this.options, St = jt / It, Jt = (pt - St) / At, se = (pt + 1 + St) / At, Xt = { features: [] };
return this._addTileFeatures(gt.range((ot - St) / At, Jt, (ot + 1 + St) / At, se), gt.data, ot, pt, At, Xt), ot === 0 && this._addTileFeatures(gt.range(1 - St / At, Jt, 1, se), gt.data, At, pt, At, Xt), ot === At - 1 && this._addTileFeatures(gt.range(0, Jt, St / At, se), gt.data, -1, pt, At, Xt), Xt.features.length ? Xt : null;
}
getClusterExpansionZoom(it) {
let ot = this._getOriginZoom(it) - 1;
for (; ot <= this.options.maxZoom; ) {
const pt = this.getChildren(it);
if (ot++, pt.length !== 1)
break;
it = pt[0].properties.cluster_id;
}
return ot;
}
_appendLeaves(it, ot, pt, gt, At) {
const It = this.getChildren(ot);
for (const jt of It) {
const St = jt.properties;
if (St && St.cluster ? At + St.point_count <= gt ? At += St.point_count : At = this._appendLeaves(it, St.cluster_id, pt, gt, At) : At < gt ? At++ : it.push(jt), it.length === pt)
break;
}
return At;
}
_createTree(it) {
const ot = new s.av(it.length / this.stride | 0, this.options.nodeSize, Float32Array);
for (let pt = 0; pt < it.length; pt += this.stride)
ot.add(it[pt], it[pt + 1]);
return ot.finish(), ot.data = it, ot;
}
_addTileFeatures(it, ot, pt, gt, At, It) {
for (const jt of it) {
const St = jt * this.stride, Jt = ot[St + Ke] > 1;
let se, Xt, Le;
if (Jt)
se = Ne(ot, St, this.clusterProps), Xt = ot[St], Le = ot[St + 1];
else {
const Te = this.points[ot[St + Qe]];
se = Te.properties;
const [He, lr] = Te.geometry.coordinates;
Xt = Gt(He), Le = te(lr);
}
const or = { type: 1, geometry: [[Math.round(this.options.extent * (Xt * At - pt)), Math.round(this.options.extent * (Le * At - gt))]], tags: se };
let Rt;
Rt = Jt || this.options.generateId ? ot[St + Qe] : this.points[ot[St + Qe]].id, Rt !== void 0 && (or.id = Rt), It.features.push(or);
}
}
_limitZoom(it) {
return Math.max(this.options.minZoom, Math.min(Math.floor(+it), this.options.maxZoom + 1));
}
_cluster(it, ot) {
const { radius: pt, extent: gt, reduce: At, minPoints: It } = this.options, jt = pt / (gt * Math.pow(2, ot)), St = it.data, Jt = [], se = this.stride;
for (let Xt = 0; Xt < St.length; Xt += se) {
if (St[Xt + 2] <= ot)
continue;
St[Xt + 2] = ot;
const Le = St[Xt], or = St[Xt + 1], Rt = it.within(St[Xt], St[Xt + 1], jt), Te = St[Xt + Ke];
let He = Te;
for (const lr of Rt) {
const Hr = lr * se;
St[Hr + 2] > ot && (He += St[Hr + Ke]);
}
if (He > Te && He >= It) {
let lr, Hr = Le * Te, vn = or * Te, Nr = -1;
const vr = ((Xt / se | 0) << 5) + (ot + 1) + this.points.length;
for (const $r of Rt) {
const cn = $r * se;
if (St[cn + 2] <= ot)
continue;
St[cn + 2] = ot;
const Kn = St[cn + Ke];
Hr += St[cn] * Kn, vn += St[cn + 1] * Kn, St[cn + 4] = vr, At && (lr || (lr = this._map(St, Xt, !0), Nr = this.clusterProps.length, this.clusterProps.push(lr)), At(lr, this._map(St, cn)));
}
St[Xt + 4] = vr, Jt.push(Hr / He, vn / He, 1 / 0, vr, -1, He), At && Jt.push(Nr);
} else {
for (let lr = 0; lr < se; lr++)
Jt.push(St[Xt + lr]);
if (He > 1)
for (const lr of Rt) {
const Hr = lr * se;
if (!(St[Hr + 2] <= ot)) {
St[Hr + 2] = ot;
for (let vn = 0; vn < se; vn++)
Jt.push(St[Hr + vn]);
}
}
}
}
return Jt;
}
_getOriginId(it) {
return it - this.points.length >> 5;
}
_getOriginZoom(it) {
return (it - this.points.length) % 32;
}
_map(it, ot, pt) {
if (it[ot + Ke] > 1) {
const It = this.clusterProps[it[ot + Ae]];
return pt ? Object.assign({}, It) : It;
}
const gt = this.points[it[ot + Qe]].properties, At = this.options.map(gt);
return pt && At === gt ? Object.assign({}, At) : At;
}
}
function Je(wt, it, ot) {
return { type: "Feature", id: wt[it + Qe], properties: Ne(wt, it, ot), geometry: { type: "Point", coordinates: [(pt = wt[it], 360 * (pt - 0.5)), me(wt[it + 1])] } };
var pt;
}
function Ne(wt, it, ot) {
const pt = wt[it + Ke], gt = pt >= 1e4 ? `${Math.round(pt / 1e3)}k` : pt >= 1e3 ? Math.round(pt / 100) / 10 + "k" : pt, At = wt[it + Ae], It = At === -1 ? {} : Object.assign({}, ot[At]);
return Object.assign(It, { cluster: !0, cluster_id: wt[it + Qe], point_count: pt, point_count_abbreviated: gt });
}
function Gt(wt) {
return wt / 360 + 0.5;
}
function te(wt) {
const it = Math.sin(wt * Math.PI / 180), ot = 0.5 - 0.25 * Math.log((1 + it) / (1 - it)) / Math.PI;
return ot < 0 ? 0 : ot > 1 ? 1 : ot;
}
function me(wt) {
const it = (180 - 360 * wt) * Math.PI / 180;
return 360 * Math.atan(Math.exp(it)) / Math.PI - 90;
}
function de(wt, it, ot, pt) {
let gt = pt;
const At = it + (ot - it >> 1);
let It, jt = ot - it;
const St = wt[it], Jt = wt[it + 1], se = wt[ot], Xt = wt[ot + 1];
for (let Le = it + 3; Le < ot; Le += 3) {
const or = Ge(wt[Le], wt[Le + 1], St, Jt, se, Xt);
if (or > gt)
It = Le, gt = or;
else if (or === gt) {
const Rt = Math.abs(Le - At);
Rt < jt && (It = Le, jt = Rt);
}
}
gt > pt && (It - it > 3 && de(wt, it, It, pt), wt[It + 2] = gt, ot - It > 3 && de(wt, It, ot, pt));
}
function Ge(wt, it, ot, pt, gt, At) {
let It = gt - ot, jt = At - pt;
if (It !== 0 || jt !== 0) {
const St = ((wt - ot) * It + (it - pt) * jt) / (It * It + jt * jt);
St > 1 ? (ot = gt, pt = At) : St > 0 && (ot += It * St, pt += jt * St);
}
return It = wt - ot, jt = it - pt, It * It + jt * jt;
}
function Tr(wt, it, ot, pt) {
const gt = { id: wt ?? null, type: it, geometry: ot, tags: pt, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
if (it === "Point" || it === "MultiPoint" || it === "LineString")
qe(gt, ot);
else if (it === "Polygon")
qe(gt, ot[0]);
else if (it === "MultiLineString")
for (const At of ot)
qe(gt, At);
else if (it === "MultiPolygon")
for (const At of ot)
qe(gt, At[0]);
return gt;
}
function qe(wt, it) {
for (let ot = 0; ot < it.length; ot += 3)
wt.minX = Math.min(wt.minX, it[ot]), wt.minY = Math.min(wt.minY, it[ot + 1]), wt.maxX = Math.max(wt.maxX, it[ot]), wt.maxY = Math.max(wt.maxY, it[ot + 1]);
}
function $e(wt, it, ot, pt) {
if (!it.geometry)
return;
const gt = it.geometry.coordinates;
if (gt && gt.length === 0)
return;
const At = it.geometry.type, It = Math.pow(ot.tolerance / ((1 << ot.maxZoom) * ot.extent), 2);
let jt = [], St = it.id;
if (ot.promoteId ? St = it.properties[ot.promoteId] : ot.generateId && (St = pt || 0), At === "Point")
ar(gt, jt);
else if (At === "MultiPoint")
for (const Jt of gt)
ar(Jt, jt);
else if (At === "LineString")
Ot(gt, jt, It, !1);
else if (At === "MultiLineString") {
if (ot.lineMetrics) {
for (const Jt of gt)
jt = [], Ot(Jt, jt, It, !1), wt.push(Tr(St, "LineString", jt, it.properties));
return;
}
en(gt, jt, It, !1);
} else if (At === "Polygon")
en(gt, jt, It, !0);
else {
if (At !== "MultiPolygon") {
if (At === "GeometryCollection") {
for (const Jt of it.geometry.geometries)
$e(wt, { id: St, geometry: Jt, properties: it.properties }, ot, pt);
return;
}
throw new Error("Input data is not a valid GeoJSON object.");
}
for (const Jt of gt) {
const se = [];
en(Jt, se, It, !0), jt.push(se);
}
}
wt.push(Tr(St, At, jt, it.properties));
}
function ar(wt, it) {
it.push(Jr(wt[0]), Sr(wt[1]), 0);
}
function Ot(wt, it, ot, pt) {
let gt, At, It = 0;
for (let St = 0; St < wt.length; St++) {
const Jt = Jr(wt[St][0]), se = Sr(wt[St][1]);
it.push(Jt, se, 0), St > 0 && (It += pt ? (gt * se - Jt * At) / 2 : Math.sqrt(Math.pow(Jt - gt, 2) + Math.pow(se - At, 2))), gt = Jt, At = se;
}
const jt = it.length - 3;
it[2] = 1, de(it, 0, jt, ot), it[jt + 2] = 1, it.size = Math.abs(It), it.start = 0, it.end = it.size;
}
function en(wt, it, ot, pt) {
for (let gt = 0; gt < wt.length; gt++) {
const At = [];
Ot(wt[gt], At, ot, pt), it.push(At);
}
}
function Jr(wt) {
return wt / 360 + 0.5;
}
function Sr(wt) {
const it = Math.sin(wt * Math.PI / 180), ot = 0.5 - 0.25 * Math.log((1 + it) / (1 - it)) / Math.PI;
return ot < 0 ? 0 : ot > 1 ? 1 : ot;
}
function Rr(wt, it, ot, pt, gt, At, It, jt) {
if (pt /= it, At >= (ot /= it) && It < pt)
return wt;
if (It < ot || At >= pt)
return null;
const St = [];
for (const Jt of wt) {
const se = Jt.geometry;
let Xt = Jt.type;
const Le = gt === 0 ? Jt.minX : Jt.minY, or = gt === 0 ? Jt.maxX : Jt.maxY;
if (Le >= ot && or < pt) {
St.push(Jt);
continue;
}
if (or < ot || Le >= pt)
continue;
let Rt = [];
if (Xt === "Point" || Xt === "MultiPoint")
dn(se, Rt, ot, pt, gt);
else if (Xt === "LineString")
ji(se, Rt, ot, pt, gt, !1, jt.lineMetrics);
else if (Xt === "MultiLineString")
Pi(se, Rt, ot, pt, gt, !1);
else if (Xt === "Polygon")
Pi(se, Rt, ot, pt, gt, !0);
else if (Xt === "MultiPolygon")
for (const Te of se) {
const He = [];
Pi(Te, He, ot, pt, gt, !0), He.length && Rt.push(He);
}
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(wt, it, ot, pt, gt) {
for (let At = 0; At < wt.length; At += 3) {
const It = wt[At + gt];
It >= ot && It <= pt && _i(it, wt[At], wt[At + 1], wt[At + 2]);
}
}
function ji(wt, it, ot, pt, gt, At, It) {
let jt = Ji(wt);
const St = gt === 0 ? ki : c1;
let Jt, se, Xt = wt.start;
for (let He = 0; He < wt.length - 3; He += 3) {
const lr = wt[He], Hr = wt[He + 1], vn = wt[He + 2], Nr = wt[He + 3], vr = wt[He + 4], $r = gt === 0 ? lr : Hr, cn = gt === 0 ? Nr : vr;
let Kn = !1;
It && (Jt = Math.sqrt(Math.pow(lr - Nr, 2) + Math.pow(Hr - vr, 2))), $r < ot ? cn > ot && (se = St(jt, lr, Hr, Nr, vr, ot), It && (jt.start = Xt + Jt * se)) : $r > pt ? cn < pt && (se = St(jt, lr, Hr, Nr, vr, pt), It && (jt.start = Xt + Jt * se)) : _i(jt, lr, Hr, vn), cn < ot && $r >= ot && (se = St(jt, lr, Hr, Nr, vr, ot), Kn = !0), cn > pt && $r <= pt && (se = St(jt, lr, Hr, Nr, vr, pt), Kn = !0), !At && Kn && (It && (jt.end = Xt + Jt * se), it.push(jt), jt = Ji(wt)), It && (Xt += Jt);
}
let Le = wt.length - 3;
const or = wt[Le], Rt = wt[Le + 1], Te = gt === 0 ? or : Rt;
Te >= ot && Te <= pt && _i(jt, or, Rt, wt[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 && it.push(jt);
}
function Ji(wt) {
const it = [];
return it.size = wt.size, it.start = wt.start, it.end = wt.end, it;
}
function Pi(wt, it, ot, pt, gt, At) {
for (const It of wt)
ji(It, it, ot, pt, gt, At, !1);
}
function _i(wt, it, ot, pt) {
wt.push(it, ot, pt);
}
function ki(wt, it, ot, pt, gt, At) {
const It = (At - it) / (pt - it);
return _i(wt, At, ot + (gt - ot) * It, 1), It;
}
function c1(wt, it, ot, pt, gt, At) {
const It = (At - ot) / (gt - ot);
return _i(wt, it + (pt - it) * It, At, 1), It;
}
function ye(wt, it) {
const ot = [];
for (let pt = 0; pt < wt.length; pt++) {
const gt = wt[pt], At = gt.type;
let It;
if (At === "Point" || At === "MultiPoint" || At === "LineString")
It = bi(gt.geometry, it);
else if (At === "MultiLineString" || At === "Polygon") {
It = [];
for (const jt of gt.geometry)
It.push(bi(jt, it));
} else if (At === "MultiPolygon") {
It = [];
for (const jt of gt.geometry) {
const St = [];
for (const Jt of jt)
St.push(bi(Jt, it));
It.push(St);
}
}
ot.push(Tr(gt.id, At, It, gt.tags));
}
return ot;
}
function bi(wt, it) {
const ot = [];
ot.size = wt.size, wt.start !== void 0 && (ot.start = wt.start, ot.end = wt.end);
for (let pt = 0; pt < wt.length; pt += 3)
ot.push(wt[pt] + it, wt[pt + 1], wt[pt + 2]);
return ot;
}
function Xn(wt, it) {
if (wt.transformed)
return wt;
const ot = 1 << wt.z, pt = wt.x, gt = wt.y;
for (const At of wt.features) {
const It = At.geometry, jt = At.type;
if (At.geometry = [], jt === 1)
for (let St = 0; St < It.length; St += 2)
At.geometry.push(Hi(It[St], It[St + 1], it, ot, pt, gt));
else
for (let St = 0; St < It.length; St++) {
const Jt = [];
for (let se = 0; se < It[St].length; se += 2)
Jt.push(Hi(It[St][se], It[St][se + 1], it, ot, pt, gt));
At.geometry.push(Jt);
}
}
return wt.transformed = !0, wt;
}
function Hi(wt, it, ot, pt, gt, At) {
return [Math.round(ot * (wt * pt - gt)), Math.round(ot * (it * pt - At))];
}
function t1(wt, it, ot, pt, gt) {
const At = it === gt.maxZoom ? 0 : gt.tolerance / ((1 << it) * gt.extent), It = { features: [], numPoints: 0, numSimplified: 0, numFeatures: wt.length, source: null, x: ot, y: pt, z: it, transformed: !1, minX: 2, minY: 1, maxX: -1, maxY: 0 };
for (const jt of wt)
xe(It, jt, At, gt);
return It;
}
function xe(wt, it, ot, pt) {
const gt = it.geometry, At = it.type, It = [];
if (wt.minX = Math.min(wt.minX, it.minX), wt.minY = Math.min(wt.minY, it.minY), wt.maxX = Math.max(wt.maxX, it.maxX), wt.maxY = Math.max(wt.maxY, it.maxY), At === "Point" || At === "MultiPoint")
for (let jt = 0; jt < gt.length; jt += 3)
It.push(gt[jt], gt[jt + 1]), wt.numPoints++, wt.numSimplified++;
else if (At === "LineString")
Fr(It, gt, wt, ot, !1, !1);
else if (At === "MultiLineString" || At === "Polygon")
for (let jt = 0; jt < gt.length; jt++)
Fr(It, gt[jt], wt, ot, At === "Polygon", jt === 0);
else if (At === "MultiPolygon")
for (let jt = 0; jt < gt.length; jt++) {
const St = gt[jt];
for (let Jt = 0; Jt < St.length; Jt++)
Fr(It, St[Jt], wt, ot, !0, Jt === 0);
}
if (It.length) {
let jt = it.tags || null;
if (At === "LineString" && pt.lineMetrics) {
jt = {};
for (const Jt in it.tags)
jt[Jt] = it.tags[Jt];
jt.mapbox_clip_start = gt.start / gt.size, jt.mapbox_clip_end = gt.end / gt.size;
}
const St = { geometry: It, type: At === "Polygon" || At === "MultiPolygon" ? 3 : At === "LineString" || At === "MultiLineString" ? 2 : 1, tags: jt };
it.id !== null && (St.id = it.id), wt.features.push(St);
}
}
function Fr(wt, it, ot, pt, gt, At) {
const It = pt * pt;
if (pt > 0 && it.size < (gt ? It : pt))
return void (ot.numPoints += it.length / 3);
const jt = [];
for (let St = 0; St < it.length; St += 3)
(pt === 0 || it[St + 2] > It) && (ot.numSimplified++, jt.push(it[St], it[St + 1])), ot.numPoints++;
gt && function(St, Jt) {
let se = 0;
for (let Xt = 0, Le = St.length, or = Le - 2; Xt < Le; or = Xt, Xt += 2)
se += (St[Xt] - St[or]) * (St[Xt + 1] + St[or + 1]);
if (se > 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), wt.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 In {
constructor(it, ot) {
const pt = (ot = this.options = function(At, It) {
for (const jt in It)
At[jt] = It[jt];
return At;
}(Object.create(_r), ot)).debug;
if (pt && console.time("preprocess data"), ot.maxZoom < 0 || ot.maxZoom > 24)
throw new Error("maxZoom should be in the 0-24 range");
if (ot.promoteId && ot.generateId)
throw new Error("promoteId and generateId cannot be used together.");
let gt = function(At, It) {
const jt = [];
if (At.type === "FeatureCollection")
for (let St = 0; St < At.features.length; St++)
$e(jt, At.features[St], It, St);
else
$e(jt, At.type === "Feature" ? At : { geometry: At }, It);
return jt;
}(it, ot);
this.tiles = {}, this.tileCoords = [], pt && (console.timeEnd("preprocess data"), console.log("index: maxZoom: %d, maxPoints: %d", ot.indexMaxZoom, ot.indexMaxPoints), console.time("generate tiles"), this.stats = {}, this.total = 0), gt = function(At, It) {
const jt = It.buffer / It.extent;
let St = At;
const Jt = Rr(At, 1, -1 - jt, jt, 0, -1, 2, It), se = Rr(At, 1, 1 - jt, 2 + jt, 0, -1, 2, It);
return (Jt || se) && (St = Rr(At, 1, -jt, 1 + jt, 0, -1, 2, It) || [], Jt && (St = ye(Jt, 1).concat(St)), se && (St = St.concat(ye(se, -1)))), St;
}(gt, ot), gt.length && this.splitTile(gt, 0, 0, 0), pt && (gt.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(it, ot, pt, gt, At, It, jt) {
const St = [it, ot, pt, gt], Jt = this.options, se = Jt.debug;
for (; St.length; ) {
gt = St.pop(), pt = St.pop(), ot = St.pop(), it = St.pop();
const Xt = 1 << ot, Le = y1(ot, pt, gt);
let or = this.tiles[Le];
if (!or && (se > 1 && console.time("creation"), or = this.tiles[Le] = t1(it, ot, pt, gt, Jt), this.tileCoords.push({ z: ot, x: pt, y: gt }), se)) {
se > 1 && (console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)", ot, pt, gt, or.numFeatures, or.numPoints, or.numSimplified), console.timeEnd("creation"));
const Kn = `z${ot}`;
this.stats[Kn] = (this.stats[Kn] || 0) + 1, this.total++;
}
if (or.source = it, At == null) {
if (ot === Jt.indexMaxZoom || or.numPoints <= Jt.indexMaxPoints)
continue;
} else {
if (ot === Jt.maxZoom || ot === At)
continue;
if (At != null) {
const Kn = At - ot;
if (pt !== It >> Kn || gt !== jt >> Kn)
continue;
}
}
if (or.source = null, it.length === 0)
continue;
se > 1 && console.time("clipping");
const Rt = 0.5 * Jt.buffer / Jt.extent, Te = 0.5 - Rt, He = 0.5 + Rt, lr = 1 + Rt;
let Hr = null, vn = null, Nr = null, vr = null, $r = Rr(it, Xt, pt - Rt, pt + He, 0, or.minX, or.maxX, Jt), cn = Rr(it, Xt, pt + Te, pt + lr, 0, or.minX, or.maxX, Jt);
it = null, $r && (Hr = Rr($r, Xt, gt - Rt, gt + He, 1, or.minY, or.maxY, Jt), vn = Rr($r, Xt, gt + Te, gt + lr, 1, or.minY, or.maxY, Jt), $r = null), cn && (Nr = Rr(cn, Xt, gt - Rt, gt + He, 1, or.minY, or.maxY, Jt), vr = Rr(cn, Xt, gt + Te, gt + lr, 1, or.minY, or.maxY, Jt), cn = null), se > 1 && console.timeEnd("clipping"), St.push(Hr || [], ot + 1, 2 * pt, 2 * gt), St.push(vn || [], ot + 1, 2 * pt, 2 * gt + 1), St.push(Nr || [], ot + 1, 2 * pt + 1, 2 * gt), St.push(vr || [], ot + 1, 2 * pt + 1, 2 * gt + 1);
}
}
getTile(it, ot, pt) {
it = +it, ot = +ot, pt = +pt;
const gt = this.options, { extent: At, debug: It } = gt;
if (it < 0 || it > 24)
return null;
const jt = 1 << it, St = y1(it, ot = ot + jt & jt - 1, pt);
if (this.tiles[St])
return Xn(this.tiles[St], At);
It > 1 && console.log("drilling down to z%d-%d-%d", it, ot, pt);
let Jt, se = it, Xt = ot, Le = pt;
for (; !Jt && se > 0; )
se--, Xt >>= 1, Le >>= 1, Jt = this.tiles[y1(se, Xt, Le)];
return Jt && Jt.source ? (It > 1 && (console.log("found parent tile z%d-%d-%d", se, Xt, Le), console.time("drilling down")), this.splitTile(Jt.source, se, Xt, Le, it, ot, pt), It > 1 && console.timeEnd("drilling down"), this.tiles[St] ? Xn(this.tiles[St], At) : null) : null;
}
}
function y1(wt, it, ot) {
return 32 * ((1 << wt) * ot + it) + wt;
}
function Lr(wt, it) {
return it ? wt.properties[it] : wt.id;
}
function Vi(wt, it) {
if (wt == null)
return !0;
if (wt.type === "Feature")
return Lr(wt, it) != null;
if (wt.type === "FeatureCollection") {
const ot = /* @__PURE__ */ new Set();
for (const pt of wt.features) {
const gt = Lr(pt, it);
if (gt == null || ot.has(gt))
return !1;
ot.add(gt);
}
return !0;
}
return !1;
}
function H1(wt, it) {
const ot = /* @__PURE__ */ new Map();
if (wt != null)
if (wt.type === "Feature")
ot.set(Lr(wt, it), wt);
else
for (const pt of wt.features)
ot.set(Lr(pt, it), pt);
return ot;
}
class Ii extends f {
constructor() {
super(...arguments), this._dataUpdateable = /* @__PURE__ */ new Map();
}
loadVectorTile(it, ot) {
return s._(this, void 0, void 0, function* () {
const pt = it.tileID.canonical;
if (!this._geoJSONIndex)
throw new Error("Unable to parse the data into a cluster or geojson");
const gt = this._geoJSONIndex.getTile(pt.z, pt.x, pt.y);
if (!gt)
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 se = [];
for (const Xt of Jt)
se.push(new s.P(Xt[0], Xt[1]));
St.push(se);
}
return St;
}
}
toGeoJSON(St, Jt, se) {
return S.call(this, St, Jt, se);
}
}(this._features[jt]);
}
}(gt.features);
let It = Se(At);
return It.byteOffset === 0 && It.byteLength === It.buffer.byteLength || (It = new Uint8Array(It)), { vectorTile: At, rawData: It.buffer };
});
}
loadData(it) {
return s._(this, void 0, void 0, function* () {
var ot;
(ot = this._pendingRequest) === null || ot === void 0 || ot.abort();
const pt = !!(it && it.request && it.request.collectResourceTiming) && new s.bv(it.request);
this._pendingRequest = new AbortController();
try {
this._pendingData = this.loadAndProcessGeoJSON(it, this._pendingRequest), this._geoJSONIndex = it.cluster ? new er(function({ superclusterOptions: It, clusterProperties: jt }) {
if (!jt || !It)
return It;
const St = {}, Jt = {}, se = { accumulated: null, zoom: 0 }, Xt = { properties: null }, Le = Object.keys(jt);
for (const or of Le) {
const [Rt, Te] = jt[or], He = s.bC(Te), lr = s.bC(typeof Rt == "string" ? [Rt, ["accumulated"], ["get", or]] : Rt);
St[or] = He.value, Jt[or] = lr.value;
}
return It.map = (or) => {
Xt.properties = or;
const Rt = {};
for (const Te of Le)
Rt[Te] = St[Te].evaluate(se, Xt);
return Rt;
}, It.reduce = (or, Rt) => {
Xt.properties = Rt;
for (const Te of Le)
se.accumulated = or[Te], or[Te] = Jt[Te].evaluate(se, Xt);
}, It;
}(it)).load((yield this._pendingData).features) : (gt = yield this._pendingData, new In(gt, it.geojsonVtOptions)), this.loaded = {};
const At = {};
if (pt) {
const It = pt.finish();
It && (At.resourceTiming = {}, At.resourceTiming[it.source] = JSON.parse(JSON.stringify(It)));
}
return At;
} catch (At) {
if (delete this._pendingRequest, s.bB(At))
return { abandoned: !0 };
throw At;
}
var gt;
});
}
getData() {
return s._(this, void 0, void 0, function* () {
return this._pendingData;
});
}
reloadTile(it) {
const ot = this.loaded;
return ot && ot[it.uid] ? super.reloadTile(it) : this.loadTile(it);
}
loadAndProcessGeoJSON(it, ot) {
return s._(this, void 0, void 0, function* () {
let pt = yield this.loadGeoJSON(it, ot);
if (delete this._pendingRequest, typeof pt != "object")
throw new Error(`Input data given to '${it.source}' is not a valid GeoJSON object.`);
if (w(pt, !0), it.filter) {
const gt = s.bC(it.filter, { type: "boolean", "property-type": "data-driven", overridable: !1, transition: !1 });
if (gt.result === "error")
throw new Error(gt.value.map((At) => `${At.key}: ${At.message}`).join(", "));
pt = { type: "FeatureCollection", features: pt.features.filter((At) => gt.value.evaluate({ zoom: 0 }, At)) };
}
return pt;
});
}
loadGeoJSON(it, ot) {
return s._(this, void 0, void 0, function* () {
const { promoteId: pt } = it;
if (it.request) {
const gt = yield s.h(it.request, ot);
return this._dataUpdateable = Vi(gt.data, pt) ? H1(gt.data, pt) : void 0, gt.data;
}
if (typeof it.data == "string")
try {
const gt = JSON.parse(it.data);
return this._dataUpdateable = Vi(gt, pt) ? H1(gt, pt) : void 0, gt;
} catch {
throw new Error(`Input data given to '${it.source}' is not a valid GeoJSON object.`);
}
if (!it.dataDiff)
throw new Error(`Input data given to '${it.source}' is not a valid GeoJSON object.`);
if (!this._dataUpdateable)
throw new Error(`Cannot update existing geojson data in ${it.source}`);
return function(gt, At, It) {
var jt, St, Jt, se;
if (At.removeAll && gt.clear(), At.remove)
for (const Xt of At.remove)
gt.delete(Xt);
if (At.add)
for (const Xt of At.add) {
const Le = Lr(Xt, It);
Le != null && gt.set(Le, Xt);
}
if (At.update)
for (const Xt of At.update) {
let Le = gt.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), gt.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 (((se = Xt.addOrUpdateProperties) === null || se === void 0 ? void 0 : se.length) > 0)
for (const { key: Rt, value: Te } of Xt.addOrUpdateProperties)
Le.properties[Rt] = Te;
}
}(this._dataUpdateable, it.dataDiff, pt), { type: "FeatureCollection", features: Array.from(this._dataUpdateable.values()) };
});
}
removeSource(it) {
return s._(this, void 0, void 0, function* () {
this._pendingRequest && this._pendingRequest.abort();
});
}
getClusterExpansionZoom(it) {
return this._geoJSONIndex.getClusterExpansionZoom(it.clusterId);
}
getClusterChildren(it) {
return this._geoJSONIndex.getChildren(it.clusterId);
}
getClusterLeaves(it) {
return this._geoJSONIndex.getLeaves(it.clusterId, it.limit, it.offset);
}
}
class Rn {
constructor(it) {
this.self = it, this.actor = new s.F(it), this.layerIndexes = {}, this.availableImages = {}, this.workerSources = {}, this.demWorkerSources = {}, this.externalWorkerSourceTypes = {}, this.self.registerWorkerSource = (ot, pt) => {
if (this.externalWorkerSourceTypes[ot])
throw new Error(`Worker source with name "${ot}" already registered.`);
this.externalWorkerSourceTypes[ot] = pt;
}, this.self.addProtocol = s.bi, this.self.removeProtocol = s.bj, this.self.registerRTLTextPlugin = (ot) => {
if (s.bD.isParsed())
throw new Error("RTL text plugin already registered.");
s.bD.setMethods(ot);
}, this.actor.registerMessageHandler("LDT", (ot, pt) => this._getDEMWorkerSource(ot, pt.source).loadTile(pt)), this.actor.registerMessageHandler("RDT", (ot, pt) => s._(this, void 0, void 0, function* () {
this._getDEMWorkerSource(ot, pt.source).removeTile(pt);
})), this.actor.registerMessageHandler("GCEZ", (ot, pt) => s._(this, void 0, void 0, function* () {
return this._getWorkerSource(ot, pt.type, pt.source).getClusterExpansionZoom(pt);
})), this.actor.registerMessageHandler("GCC", (ot, pt) => s._(this, void 0, void 0, function* () {
return this._getWorkerSource(ot, pt.type, pt.source).getClusterChildren(pt);
})), this.actor.registerMessageHandler("GCL", (ot, pt) => s._(this, void 0, void 0, function* () {
return this._getWorkerSource(ot, pt.type, pt.source).getClusterLeaves(pt);
})), this.actor.registerMessageHandler("LD", (ot, pt) => this._getWorkerSource(ot, pt.type, pt.source).loadData(pt)), this.actor.registerMessageHandler("GD", (ot, pt) => this._getWorkerSource(ot, pt.type, pt.source).getData()), this.actor.registerMessageHandler("LT", (ot, pt) => this._getWorkerSource(ot, pt.type, pt.source).loadTile(pt)), this.actor.registerMessageHandler("RT", (ot, pt) => this._getWorkerSource(ot, pt.type, pt.source).reloadTile(pt)), this.actor.registerMessageHandler("AT", (ot, pt) => this._getWorkerSource(ot, pt.type, pt.source).abortTile(pt)), this.actor.registerMessageHandler("RMT", (ot, pt) => this._getWorkerSource(ot, pt.type, pt.source).removeTile(pt)), this.actor.registerMessageHandler("RS", (ot, pt) => s._(this, void 0, void 0, function* () {
if (!this.workerSources[ot] || !this.workerSources[ot][pt.type] || !this.workerSources[ot][pt.type][pt.source])
return;
const gt = this.workerSources[ot][pt.type][pt.source];
delete this.workerSources[ot][pt.type][pt.source], gt.removeSource !== void 0 && gt.removeSource(pt);
})), this.actor.registerMessageHandler("RM", (ot) => s._(this, void 0, void 0, function* () {
delete this.layerIndexes[ot], delete this.availableImages[ot], delete this.workerSources[ot], delete this.demWorkerSources[ot];
})), this.actor.registerMessageHandler("SR", (ot, pt) => s._(this, void 0, void 0, function* () {
this.referrer = pt;
})), this.actor.registerMessageHandler("SRPS", (ot, pt) => this._syncRTLPluginState(ot, pt)), this.actor.registerMessageHandler("IS", (ot, pt) => s._(this, void 0, void 0, function* () {
this.self.importScripts(pt);
})), this.actor.registerMessageHandler("SI", (ot, pt) => this._setImages(ot, pt)), this.actor.registerMessageHandler("UL", (ot, pt) => s._(this, void 0, void 0, function* () {
this._getLayerIndex(ot).update(pt.layers, pt.removedIds);
})), this.actor.registerMessageHandler("SL", (ot, pt) => s._(this, void 0, void 0, function* () {
this._getLayerIndex(ot).replace(pt);
}));
}
_setImages(it, ot) {
return s._(this, void 0, void 0, function* () {
this.availableImages[it] = ot;
for (const pt in this.workerSources[it]) {
const gt = this.workerSources[it][pt];
for (const At in gt)
gt[At].availableImages = ot;
}
});
}
_syncRTLPluginState(it, ot) {
return s._(this, void 0, void 0, function* () {
if (s.bD.isParsed())
return s.bD.getState();
if (ot.pluginStatus !== "loading")
return s.bD.setState(ot), ot;
const pt = ot.pluginURL;
if (this.self.importScripts(pt), s.bD.isParsed()) {
const gt = { pluginStatus: "loaded", pluginURL: pt };
return s.bD.setState(gt), gt;
}
throw s.bD.setState({ pluginStatus: "error", pluginURL: "" }), new Error(`RTL Text Plugin failed to import scripts from ${pt}`);
});
}
_getAvailableImages(it) {
let ot = this.availableImages[it];
return ot || (ot = []), ot;
}
_getLayerIndex(it) {
let ot = this.layerIndexes[it];
return ot || (ot = this.layerIndexes[it] = new a()), ot;
}
_getWorkerSource(it, ot, pt) {
if (this.workerSources[it] || (this.workerSources[it] = {}), this.workerSources[it][ot] || (this.workerSources[it][ot] = {}), !this.workerSources[it][ot][pt]) {
const gt = { sendAsync: (At, It) => (At.targetMapId = it, this.actor.sendAsync(At, It)) };
switch (ot) {
case "vector":
this.workerSources[it][ot][pt] = new f(gt, this._getLayerIndex(it), this._getAvailableImages(it));
break;
case "geojson":
this.workerSources[it][ot][pt] = new Ii(gt, this._getLayerIndex(it), this._getAvailableImages(it));
break;
default:
this.workerSources[it][ot][pt] = new this.externalWorkerSourceTypes[ot](gt, this._getLayerIndex(it), this._getAvailableImages(it));
}
}
return this.workerSources[it][ot][pt];
}
_getDEMWorkerSource(it, ot) {
return this.demWorkerSources[it] || (this.demWorkerSources[it] = {}), this.demWorkerSources[it][ot] || (this.demWorkerSources[it][ot] = new Q()), this.demWorkerSources[it][ot];
}
}
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: (E) => new Promise((l, m) => {
const v = requestAnimationFrame(l);
E.signal.addEventListener("abort", () => {
cancelAnimationFrame(v), m(a.c());
});
}), getImageData(E, l = 0) {
return this.getImageCanvasContext(E).getImageData(-l, -l, E.width + 2 * l, E.height + 2 * l);
}, getImageCanvasContext(E) {
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 = E.width, l.height = E.height, m.drawImage(E, 0, 0, E.width, E.height), m;
}, resolveURL: (E) => (d || (d = document.createElement("a")), d.href = E, 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 _ = window.document.createElement(l);
return m !== void 0 && (_.className = m), v && v.appendChild(_), _;
}
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, _ = {}) {
l.addEventListener(m, v, "passive" in _ ? _ : _.capture);
}
static removeEventListener(l, m, v, _ = {}) {
l.removeEventListener(m, v, "passive" in _ ? _ : _.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 _ = m.boundingClientRect;
return new a.P((v.clientX - _.left) / m.x - l.clientLeft, (v.clientY - _.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 = [], _ = Q.getScale(l);
for (let M = 0; M < m.length; M++)
v.push(Q.getPoint(l, _, 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(E) {
!S && w && (x ? C(E) : b = E);
} };
let b, w, S = !1, x = !1;
function C(E) {
const l = E.createTexture();
E.bindTexture(E.TEXTURE_2D, l);
try {
if (E.texImage2D(E.TEXTURE_2D, 0, E.RGBA, E.RGBA, E.UNSIGNED_BYTE, w), E.isContextLost())
return;
y.supported = !0;
} catch {
}
E.deleteTexture(l), S = !0;
}
var P;
typeof document < "u" && (w = document.createElement("img"), w.onload = () => {
b && C(b), b = null, x = !0;
}, w.onerror = () => {
S = !0, b = null;
}, w.src = "data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="), function(E) {
let l, m, v, _;
E.resetRequestQueue = () => {
l = [], m = 0, v = 0, _ = {};
}, E.addThrottleControl = (j) => {
const W = v++;
return _[W] = j, W;
}, E.removeThrottleControl = (j) => {
delete _[j], I();
}, E.getImage = (j, W, Y = !0) => new Promise((J, ct) => {
y.supported && (j.headers || (j.headers = {}), j.headers.accept = "image/webp,*/*"), a.e(j, { type: "image" }), l.push({ abortController: W, requestParameters: j, supportImageRefresh: Y, state: "queued", onError: (ft) => {
ct(ft);
}, onSuccess: (ft) => {
J(ft);
} }), I();
});
const M = (j) => a._(this, void 0, void 0, function* () {
j.state = "running";
const { requestParameters: W, supportImageRefresh: Y, onError: J, onSuccess: ct, abortController: ft } = j, Qt = Y === !1 && !a.i(self) && !a.g(W.url) && (!W.headers || Object.keys(W.headers).reduce((Ht, Ct) => Ht && Ct === "accept", !0));
m++;
const Lt = Qt ? D(W, ft) : a.m(W, ft);
try {
const Ht = yield Lt;
delete j.abortController, j.state = "completed", Ht.data instanceof HTMLImageElement || a.b(Ht.data) ? ct(Ht) : Ht.data && ct({ data: yield (Et = Ht.data, typeof createImageBitmap == "function" ? a.d(Et) : a.f(Et)), cacheControl: Ht.cacheControl, expires: Ht.expires });
} catch (Ht) {
delete j.abortController, J(Ht);
} finally {
m--, I();
}
var Et;
}), I = () => {
const j = (() => {
for (const W of Object.keys(_))
if (_[W]())
return !0;
return !1;
})() ? a.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME : a.a.MAX_PARALLEL_IMAGE_REQUESTS;
for (let W = m; W < j && l.length > 0; W++) {
const Y = l.shift();
Y.abortController.signal.aborted ? W-- : M(Y);
}
}, D = (j, W) => new Promise((Y, J) => {
const ct = new Image(), ft = j.url, Qt = j.credentials;
Qt && Qt === "include" ? ct.crossOrigin = "use-credentials" : (Qt && Qt === "same-origin" || !a.s(ft)) && (ct.crossOrigin = "anonymous"), W.signal.addEventListener("abort", () => {
ct.src = "", J(a.c());
}), ct.fetchPriority = "high", ct.onload = () => {
ct.onerror = ct.onload = null, Y({ data: ct });
}, ct.onerror = () => {
ct.onerror = ct.onload = null, W.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."));
}, ct.src = ft;
});
}(P || (P = {})), P.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(E) {
var l = new a.A(3);
return l[0] = E[0], l[1] = E[1], l[2] = E[2], l;
}
var U, $ = function(E, l, m) {
return E[0] = l[0] - m[0], E[1] = l[1] - m[1], E[2] = l[2] - m[2], E;
};
U = new a.A(3), a.A != Float32Array && (U[0] = 0, U[1] = 0, U[2] = 0);
var rt = function(E) {
var l = E[0], m = E[1];
return l * l + m * m;
};
function tt(E) {
const l = [];
if (typeof E == "string")
l.push({ id: "default", url: E });
else if (E && E.length > 0) {
const m = [];
for (const { id: v, url: _ } of E) {
const M = `${v}${_}`;
m.indexOf(M) === -1 && (m.push(M), l.push({ id: v, url: _ }));
}
}
return l;
}
function at(E, l, m) {
const v = E.split("?");
return v[0] += `${l}${m}`, v.join("?");
}
(function() {
var E = new a.A(2);
a.A != Float32Array && (E[0] = 0, E[1] = 0);
})();
class lt {
constructor(l, m, v, _) {
this.context = l, this.format = v, this.texture = l.gl.createTexture(), this.update(m, _);
}
update(l, m, v) {
const { width: _, height: M } = l, I = !(this.size && this.size[0] === _ && 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)), I)
this.size = [_, 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, _, M, 0, this.format, j.UNSIGNED_BYTE, l.data);
else {
const { x: W, 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, W, Y, j.RGBA, j.UNSIGNED_BYTE, l) : j.texSubImage2D(j.TEXTURE_2D, 0, W, Y, _, M, j.RGBA, j.UNSIGNED_BYTE, l.data);
}
this.useMipmap && this.isSizePowerOfTwo() && j.generateMipmap(j.TEXTURE_2D);
}
bind(l, m, v) {
const { context: _ } = this, { gl: M } = _;
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 xt(E) {
const { userImage: l } = E;
return !!(l && l.render && l.render()) && (E.data.replace(new Uint8Array(l.data.buffer)), !0);
}
class Vt 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 _ = m.data || m.spriteData;
return this._validateStretch(m.stretchX, _ && _.width) || (this.fire(new a.j(new Error(`Image "${l}" has invalid "stretchX" value`))), v = !1), this._validateStretch(m.stretchY, _ && _.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 _ of l) {
if (_[0] < v || _[1] < _[0] || m < _[1])
return !1;
v = _[1];
}
return !0;
}
_validateContent(l, m) {
if (!l)
return !0;
if (l.length !== 4)
return !1;
const v = m.spriteData, _ = v && v.width || m.data.width, M = v && v.height || m.data.height;
return !(l[0] < 0 || _ < l[0] || l[1] < 0 || M < l[1] || l[2] < 0 || _ < l[2] || l[3] < 0 || M < l[3] || l[2] < l[0] || l[3] < l[1]);
}
updateImage(l, m, v = !0) {
const _ = this.getImage(l);
if (v && (_.data.width !== m.data.width || _.data.height !== m.data.height))
throw new Error(`size mismatch between old image (${_.data.width}x${_.data.height}) and new image (${m.data.width}x${m.data.height}).`);
m.version = _.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 _ = !0;
if (!this.isLoaded())
for (const M of l)
this.images[M] || (_ = !1);
this.isLoaded() || _ ? m(this._getImagesForIds(l)) : this.requestors.push({ ids: l, promiseResolve: m });
});
}
_getImagesForIds(l) {
const m = {};
for (const v of l) {
let _ = this.getImage(v);
_ || (this.fire(new a.k("styleimagemissing", { id: v })), _ = this.getImage(v)), _ ? m[v] = { data: _.data.clone(), pixelRatio: _.pixelRatio, sdf: _.sdf, version: _.version, stretchX: _.stretchX, stretchY: _.stretchY, content: _.content, textFitWidth: _.textFitWidth, textFitHeight: _.textFitHeight, hasRenderCallback: !!(_.userImage && _.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 _ = { w: v.data.width + 2, h: v.data.height + 2, x: 0, y: 0 }, M = new a.I(_, v);
this.patterns[l] = { bin: _, 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 lt(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), _ = this.atlasImage;
_.resize({ width: m || 1, height: v || 1 });
for (const M in this.patterns) {
const { bin: I } = this.patterns[M], D = I.x + 1, j = I.y + 1, W = this.getImage(M).data, Y = W.width, J = W.height;
a.R.copy(W, _, { x: 0, y: 0 }, { x: D, y: j }, { width: Y, height: J }), a.R.copy(W, _, { x: 0, y: J - 1 }, { x: D, y: j - 1 }, { width: Y, height: 1 }), a.R.copy(W, _, { x: 0, y: 0 }, { x: D, y: j + J }, { width: Y, height: 1 }), a.R.copy(W, _, { x: Y - 1, y: 0 }, { x: D - 1, y: j }, { width: 1, height: J }), a.R.copy(W, _, { 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`), xt(v) && this.updateImage(m, v);
}
}
}
const Zt = 1e20;
function ce(E, l, m, v, _, M, I, D, j) {
for (let W = l; W < l + v; W++)
oe(E, m * M + W, M, _, I, D, j);
for (let W = m; W < m + _; W++)
oe(E, W * M + l, 1, v, I, D, j);
}
function oe(E, l, m, v, _, M, I) {
M[0] = 0, I[0] = -Zt, I[1] = Zt, _[0] = E[l];
for (let D = 1, j = 0, W = 0; D < v; D++) {
_[D] = E[l + D * m];
const Y = D * D;
do {
const J = M[j];
W = (_[D] - _[J] + Y - J * J) / (D - J) / 2;
} while (W <= I[j] && --j > -1);
j++, M[j] = D, I[j] = W, I[j + 1] = Zt;
}
for (let D = 0, j = 0; D < v; D++) {
for (; I[j + 1] < D; )
j++;
const W = M[j], Y = D - W;
E[l + D * m] = _[W] + Y * Y;
}
}
class Se {
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 I of l[M])
m.push(this._getAndCacheGlyphsPromise(M, I));
const v = yield Promise.all(m), _ = {};
for (const { stack: M, id: I, glyph: D } of v)
_[M] || (_[M] = {}), _[M][I] = D && { id: D.id, bitmap: D.bitmap.clone(), metrics: D.metrics };
return _;
});
}
_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 _ = v.glyphs[m];
if (_ !== void 0)
return { stack: l, id: m, glyph: _ };
if (_ = this._tinySDF(v, l, m), _)
return v.glyphs[m] = _, { stack: l, id: m, glyph: _ };
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: _ };
if (!this.url)
throw new Error("glyphsUrl is not set");
if (!v.requests[M]) {
const D = Se.loadGlyphRange(l, M, this.url, this.requestManager);
v.requests[M] = D;
}
const I = yield v.requests[M];
for (const D in I)
this._doesCharSupportLocalGlyph(+D) || (v.glyphs[+D] = I[+D]);
return v.ranges[M] = !0, { stack: l, id: m, glyph: I[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 _ = this.localIdeographFontFamily;
if (!_ || !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 Se.TinySDF({ fontSize: 48, buffer: 6, radius: 16, cutoff: 0.25, fontFamily: _, fontWeight: D });
}
const I = M.draw(String.fromCharCode(v));
return { id: v, bitmap: new a.o({ width: I.width || 60, height: I.height || 60 }, I.data), metrics: { width: I.glyphWidth / 2 || 24, height: I.glyphHeight / 2 || 24, left: I.glyphLeft / 2 + 0.5 || 0, top: I.glyphTop / 2 - 27.5 || -8, advance: I.glyphAdvance / 2 || 24, isDoubleResolution: !0 } };
}
}
Se.loadGlyphRange = function(E, l, m, v) {
return a._(this, void 0, void 0, function* () {
const _ = 256 * l, M = _ + 255, I = v.transformRequest(m.replace("{fontstack}", E).replace("{range}", `${_}-${M}`), "Glyphs"), D = yield a.l(I, new AbortController());
if (!D || !D.data)
throw new Error(`Could not load glyph range. range: ${l}, ${_}-${M}`);
const j = {};
for (const W of a.n(D.data))
j[W.id] = W;
return j;
});
}, Se.TinySDF = class {
constructor({ fontSize: E = 24, buffer: l = 3, radius: m = 8, cutoff: v = 0.25, fontFamily: _ = "sans-serif", fontWeight: M = "normal", fontStyle: I = "normal" } = {}) {
this.buffer = l, this.cutoff = v, this.radius = m;
const D = this.size = E + 4 * l, j = this._createCanvas(D), W = this.ctx = j.getContext("2d", { willReadFrequently: !0 });
W.font = `${I} ${M} ${E}px ${_}`, W.textBaseline = "alphabetic", W.textAlign = "left", W.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(E) {
const l = document.createElement("canvas");
return l.width = l.height = E, l;
}
draw(E) {
const { width: l, actualBoundingBoxAscent: m, actualBoundingBoxDescent: v, actualBoundingBoxLeft: _, actualBoundingBoxRight: M } = this.ctx.measureText(E), I = Math.ceil(m), D = Math.max(0, Math.min(this.size - this.buffer, Math.ceil(M - _))), j = Math.min(this.size - this.buffer, I + Math.ceil(v)), W = D + 2 * this.buffer, Y = j + 2 * this.buffer, J = Math.max(W * Y, 0), ct = new Uint8ClampedArray(J), ft = { data: ct, width: W, height: Y, glyphWidth: D, glyphHeight: j, glyphTop: I, glyphLeft: 0, glyphAdvance: l };
if (D === 0 || j === 0)
return ft;
const { ctx: Qt, buffer: Lt, gridInner: Et, gridOuter: Ht } = this;
Qt.clearRect(Lt, Lt, D, j), Qt.fillText(E, Lt, Lt + I);
const Ct = Qt.getImageData(Lt, Lt, D, j);
Ht.fill(Zt, 0, J), Et.fill(0, 0, J);
for (let _t = 0; _t < j; _t++)
for (let Nt = 0; Nt < D; Nt++) {
const Dt = Ct.data[4 * (_t * D + Nt) + 3] / 255;
if (Dt === 0)
continue;
const Wt = (_t + Lt) * W + Nt + Lt;
if (Dt === 1)
Ht[Wt] = 0, Et[Wt] = Zt;
else {
const he = 0.5 - Dt;
Ht[Wt] = he > 0 ? he * he : 0, Et[Wt] = he < 0 ? he * he : 0;
}
}
ce(Ht, 0, 0, W, Y, W, this.f, this.v, this.z), ce(Et, Lt, Lt, D, j, W, this.f, this.v, this.z);
for (let _t = 0; _t < J; _t++) {
const Nt = Math.sqrt(Ht[_t]) - Math.sqrt(Et[_t]);
ct[_t] = Math.round(255 - 255 * (Nt / this.radius + this.cutoff));
}
return ft;
}
};
class Ir {
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 ne extends a.E {
constructor(l) {
super(), qr = qr || new a.q({ anchor: new a.D(a.v.light.anchor), position: new Ir(), 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 _ = l[v];
v.endsWith("-transition") ? this._transitionable.setTransition(v.slice(0, -11), _) : this._transitionable.setValue(v, _);
}
}
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 _ = l[v];
v.endsWith("-transition") ? this._transitionable.setTransition(v.slice(0, -11), _) : this._transitionable.setValue(v, _);
}
}
}
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 Ae {
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 _ = [];
let M = l.length % 2 == 1 ? -l[l.length - 1] * v : 0, I = l[0] * v, D = !0;
_.push({ left: M, right: I, isDash: D, zeroLength: l[0] === 0 });
let j = l[0];
for (let W = 1; W < l.length; W++) {
D = !D;
const Y = l[W];
M = j * v, j += Y, I = j * v, _.push({ left: M, right: I, isDash: D, zeroLength: Y === 0 });
}
return _;
}
addRoundDash(l, m, v) {
const _ = m / 2;
for (let M = -v; M <= v; M++) {
const I = this.width * (this.nextRow + v + M);
let D = 0, j = l[D];
for (let W = 0; W < this.width; W++) {
W / j.right > 1 && (j = l[++D]);
const Y = Math.abs(W - j.left), J = Math.abs(W - j.right), ct = Math.min(Y, J);
let ft;
const Qt = M / v * (_ + 1);
if (j.isDash) {
const Lt = _ - Math.abs(Qt);
ft = Math.sqrt(ct * ct + Lt * Lt);
} else
ft = _ - Math.sqrt(ct * ct + Qt * Qt);
this.data[I + W] = Math.max(0, Math.min(255, ft + 128));
}
}
}
addRegularDash(l) {
for (let D = l.length - 1; D >= 0; --D) {
const j = l[D], W = l[D + 1];
j.zeroLength ? l.splice(D, 1) : W && W.isDash === j.isDash && (W.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 _ = this.width * this.nextRow;
let M = 0, I = l[M];
for (let D = 0; D < this.width; D++) {
D / I.right > 1 && (I = l[++M]);
const j = Math.abs(D - I.left), W = Math.abs(D - I.right), Y = Math.min(j, W);
this.data[_ + D] = Math.max(0, Math.min(255, (I.isDash ? Y : -Y) + 128));
}
}
addDash(l, m) {
const v = m ? 7 : 0, _ = 2 * v + 1;
if (this.nextRow + _ > 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 I = { y: (this.nextRow + v + 0.5) / this.height, height: 2 * v / this.height, width: M };
return this.nextRow += _, this.dirty = !0, I;
}
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 _ = 0; _ < v.length; _++) {
const M = new a.F(v[_], m);
M.name = `Worker ${_}`, this.actors.push(M);
}
if (!this.actors.length)
throw new Error("No actors found");
}
broadcast(l, m) {
const v = [];
for (const _ of this.actors)
v.push(_.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", (E, l, m) => a.m(l, m))), te;
}
function Tr(E, l) {
const m = a.H();
return a.J(m, m, [1, 1, 0]), a.K(m, m, [0.5 * E.width, 0.5 * E.height, 1]), a.L(m, m, E.calculatePosMatrix(l.toUnwrapped()));
}
function qe(E, l, m, v, _, M) {
const I = function(J, ct, ft) {
if (J)
for (const Qt of J) {
const Lt = ct[Qt];
if (Lt && Lt.source === ft && Lt.type === "fill-extrusion")
return !0;
}
else
for (const Qt in ct) {
const Lt = ct[Qt];
if (Lt.source === ft && Lt.type === "fill-extrusion")
return !0;
}
return !1;
}(_ && _.layers, l, E.id), D = M.maxPitchScaleFactor(), j = E.tilesIn(v, D, I);
j.sort($e);
const W = [];
for (const J of j)
W.push({ wrappedTileID: J.tileID.wrapped().key, queryResults: J.tile.queryRenderedFeatures(l, m, E._state, J.queryGeometry, J.cameraQueryGeometry, J.scale, _, M, D, Tr(E.transform, J.tileID)) });
const Y = function(J) {
const ct = {}, ft = {};
for (const Qt of J) {
const Lt = Qt.queryResults, Et = Qt.wrappedTileID, Ht = ft[Et] = ft[Et] || {};
for (const Ct in Lt) {
const _t = Lt[Ct], Nt = Ht[Ct] = Ht[Ct] || {}, Dt = ct[Ct] = ct[Ct] || [];
for (const Wt of _t)
Nt[Wt.featureIndex] || (Nt[Wt.featureIndex] = !0, Dt.push(Wt));
}
}
return ct;
}(W);
for (const J in Y)
Y[J].forEach((ct) => {
const ft = ct.feature, Qt = E.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(E, l) {
const m = E.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(E, l, m) {
return a._(this, void 0, void 0, function* () {
let v = E;
if (E.url ? v = (yield a.h(l.transformRequest(E.url, "Source"), m)).data : yield f.frameAsync(m), !v)
return null;
const _ = a.M(a.e(v, E), ["tiles", "minzoom", "maxzoom", "attribution", "bounds", "scheme", "tileSize", "encoding"]);
return "vector_layers" in v && v.vector_layers && (_.vectorLayerIds = v.vector_layers.map((M) => M.id)), _;
});
}
class Ot {
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 _, M;
if (l instanceof a.N)
_ = l, M = l;
else {
if (!(l instanceof Ot))
return Array.isArray(l) ? l.length === 4 || l.every(Array.isArray) ? this.extend(Ot.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 (_ = l._sw, M = l._ne, !_ || !M)
return this;
}
return m || v ? (m.lng = Math.min(_.lng, m.lng), m.lat = Math.min(_.lat, m.lat), v.lng = Math.max(M.lng, v.lng), v.lat = Math.max(M.lat, v.lat)) : (this._sw = new a.N(_.lng, _.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 _ = this._sw.lng <= m && m <= this._ne.lng;
return this._sw.lng > this._ne.lng && (_ = this._sw.lng >= m && m >= this._ne.lng), this._sw.lat <= v && v <= this._ne.lat && _;
}
static convert(l) {
return l instanceof Ot ? l : l && new Ot(l);
}
static fromLngLat(l, m = 0) {
const v = 360 * m / 40075017, _ = v / Math.cos(Math.PI / 180 * l.lat);
return new Ot(new a.N(l.lng - _, l.lat - v), new a.N(l.lng + _, 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 Ot(l, l.lng > m.lng ? new a.N(m.lng + 360, m.lat) : m);
}
}
class en {
constructor(l, m, v) {
this.bounds = Ot.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), _ = Math.floor(a.Q(this.bounds.getNorth()) * m), M = Math.ceil(a.O(this.bounds.getEast()) * m), I = Math.ceil(a.Q(this.bounds.getSouth()) * m);
return l.x >= v && l.x < M && l.y >= _ && l.y < I;
}
}
class Jr extends a.E {
constructor(l, m, v, _) {
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(_);
}
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 _ = "RT";
if (l.actor && l.state !== "expired") {
if (l.state === "loading")
return new Promise((M, I) => {
l.reloadPromise = { resolve: M, reject: I };
});
} else
l.actor = this.dispatcher.getActor(), _ = "LT";
l.abortController = new AbortController();
try {
const M = yield l.actor.sendAsync({ type: _, 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 Sr extends a.E {
constructor(l, m, v, _) {
super(), this.id = l, this.dispatcher = v, this.setEventedParent(_), 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 P.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 _ = this.map.painter.context, M = _.gl, I = v.data;
l.texture = this.map.painter.getTileTexture(I.width), l.texture ? l.texture.update(I, { useMipmap: !0 }) : (l.texture = new lt(_, I, 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 Sr {
constructor(l, m, v, _) {
super(l, m, v, _), 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 _ = yield P.getImage(v, l.abortController, this.map._refreshExpiredTiles);
if (delete l.abortController, l.aborted)
return void (l.state = "unloaded");
if (_ && _.data) {
const M = _.data;
this.map._refreshExpiredTiles && _.cacheControl && _.expires && l.setExpiryData({ cacheControl: _.cacheControl, expires: _.expires });
const I = a.b(M) && a.U() ? M : yield this.readImageNow(M), D = { type: this.type, uid: l.uid, source: this.id, rawImageData: I, 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 (_) {
if (delete l.abortController, l.aborted)
l.state = "unloaded";
else if (_)
throw l.state = "errored", _;
}
});
}
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), _ = (m.x - 1 + v) % v, M = m.x === 0 ? l.wrap - 1 : l.wrap, I = (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, _, m.y).key] = { backfilled: !1 }, j[new a.S(l.overscaledZ, D, m.z, I, m.y).key] = { backfilled: !1 }, m.y > 0 && (j[new a.S(l.overscaledZ, M, m.z, _, 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, I, m.y - 1).key] = { backfilled: !1 }), m.y + 1 < v && (j[new a.S(l.overscaledZ, M, m.z, _, 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, I, 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, _) {
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(_), 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 _ = null;
v.resourceTiming && v.resourceTiming[this.id] && (_ = v.resourceTiming[this.id].slice(0));
const M = { dataType: "source" };
this._collectResourceTiming && _ && _.length > 0 && a.e(M, { resourceTiming: _ }), 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 _ = yield this.actor.sendAsync({ type: m, data: v }, l.abortController);
delete l.abortController, l.unloadVectorData(), l.aborted || l.loadVectorData(_, 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, _) {
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(_), 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 P.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(_) {
let M = 1 / 0, I = 1 / 0, D = -1 / 0, j = -1 / 0;
for (const ct of _)
M = Math.min(M, ct.x), I = Math.min(I, ct.y), D = Math.max(D, ct.x), j = Math.max(j, ct.y);
const W = Math.max(D - M, j - I), Y = Math.max(0, Math.floor(-Math.log(W) / Math.LN2)), J = Math.pow(2, Y);
return new a.a1(Y, Math.floor((M + D) / 2 * J), Math.floor((I + j) / 2 * J));
}(m), this.minzoom = this.maxzoom = this.tileID.z;
const v = m.map((_) => this.tileID.getTilePoint(_)._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 lt(l, this.image, m.RGBA), this.texture.bind(m.LINEAR, m.CLAMP_TO_EDGE));
let v = !1;
for (const _ in this.tiles) {
const M = this.tiles[_];
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 Pi extends Ji {
constructor(l, m, v, _) {
super(l, m, v, _), 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 lt(l, this.video, m.RGBA), this.texture.bind(m.LINEAR, m.CLAMP_TO_EDGE));
let v = !1;
for (const _ in this.tiles) {
const M = this.tiles[_];
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, _) {
super(l, m, v, _), m.coordinates ? Array.isArray(m.coordinates) && m.coordinates.length === 4 && !m.coordinates.some((M) => !Array.isArray(M) || M.length !== 2 || M.some((I) => typeof I != "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 lt(m, this.canvas, v.RGBA, { premultiply: !0 });
let _ = !1;
for (const M in this.tiles) {
const I = this.tiles[M];
I.state !== "loaded" && (I.state = "loaded", I.texture = this.texture, _ = !0);
}
_ && 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 ki = {}, c1 = (E) => {
switch (E) {
case "geojson":
return dn;
case "image":
return Ji;
case "raster":
return Sr;
case "raster-dem":
return Rr;
case "vector":
return Jr;
case "video":
return Pi;
case "canvas":
return _i;
}
return ki[E];
}, 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(_, M) {
const I = {};
if (!M)
return I;
for (const D of _) {
const j = D.layerIds.map((W) => M.getLayer(W)).filter(Boolean);
if (j.length !== 0) {
D.layers = j, D.stateDependentLayerIds && (D.stateDependentLayers = D.stateDependentLayerIds.map((W) => j.filter((Y) => Y.id === W)[0]));
for (const W of j)
I[W.id] = D;
}
}
return I;
}(l.buckets, m.style), this.hasSymbolBuckets = !1;
for (const _ in this.buckets) {
const M = this.buckets[_];
if (M instanceof a.a6) {
if (this.hasSymbolBuckets = !0, !v)
break;
M.justReloaded = !0;
}
}
if (this.hasRTLText = !1, this.hasSymbolBuckets)
for (const _ in this.buckets) {
const M = this.buckets[_];
if (M instanceof a.a6 && M.hasRTLText) {
this.hasRTLText = !0, Hi().lazyLoad();
break;
}
}
this.queryPadding = 0;
for (const _ in this.buckets) {
const M = this.buckets[_];
this.queryPadding = Math.max(this.queryPadding, m.style.getLayer(_).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 _ = this.buckets[v];
_.uploadPending() && _.upload(l);
}
const m = l.gl;
this.imageAtlas && !this.imageAtlas.uploaded && (this.imageAtlasTexture = new lt(l, this.imageAtlas.image, m.RGBA), this.imageAtlas.uploaded = !0), this.glyphAtlasImage && (this.glyphAtlasTexture = new lt(l, this.glyphAtlasImage, m.ALPHA), this.glyphAtlasImage = null);
}
prepare(l) {
this.imageAtlas && this.imageAtlas.patchUpdatedImages(l, this.imageAtlasTexture);
}
queryRenderedFeatures(l, m, v, _, M, I, D, j, W, Y) {
return this.latestFeatureIndex && this.latestFeatureIndex.rawTileData ? this.latestFeatureIndex.query({ queryGeometry: _, cameraQueryGeometry: M, scale: I, tileSize: this.tileSize, pixelPosMatrix: Y, transform: j, params: D, queryPadding: this.queryPadding * W }, l, m, v) : {};
}
querySourceFeatures(l, m) {
const v = this.latestFeatureIndex;
if (!v || !v.rawTileData)
return;
const _ = v.loadVTLayers(), M = m && m.sourceLayer ? m.sourceLayer : "", I = _._geojsonTileLayer || _[M];
if (!I)
return;
const D = a.a7(m && m.filter), { z: j, x: W, y: Y } = this.tileID.canonical, J = { z: j, x: W, y: Y };
for (let ct = 0; ct < I.length; ct++) {
const ft = I.feature(ct);
if (D.needGeometry) {
const Et = a.a8(ft, !0);
if (!D.filter(new a.z(this.tileID.overscaledZ), Et, this.tileID.canonical))
continue;
} else if (!D.filter(new a.z(this.tileID.overscaledZ), ft))
continue;
const Qt = v.getId(ft, M), Lt = new a.a9(ft, j, W, Y, Qt);
Lt.tile = J, l.push(Lt);
}
}
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 _ = !1;
if (this.expirationTime > v)
_ = !1;
else if (m)
if (this.expirationTime < m)
_ = !0;
else {
const M = this.expirationTime - m;
M ? this.expirationTime = v + Math.max(M, 3e4) : _ = !0;
}
else
_ = !0;
_ ? (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 _ in this.buckets) {
if (!m.style.hasLayer(_))
continue;
const M = this.buckets[_], I = M.layers[0].sourceLayer || "_geojsonTileLayer", D = v[I], j = l[I];
if (!D || !j || Object.keys(j).length === 0)
continue;
M.update(j, D, this.imageAtlas && this.imageAtlas.patternPositions || {});
const W = m && m.style && m.style.getLayer(_);
W && (this.queryPadding = Math.max(this.queryPadding, W.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 _ of m)
v[_] = !0;
this.dependencies[l] = v;
}
hasDependency(l, m) {
for (const v of l) {
const _ = this.dependencies[v];
if (_) {
for (const M of m)
if (_[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 _ = l.wrapped().key;
this.data[_] === void 0 && (this.data[_] = []);
const M = { value: m, timeout: void 0 };
if (v !== void 0 && (M.timeout = setTimeout(() => {
this.remove(l, M);
}, v)), this.data[_].push(M), this.order.push(_), this.order.length > this.max) {
const I = this._getAndRemoveByKey(this.order[0]);
I && this.onRemove(I);
}
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, _ = m === void 0 ? 0 : this.data[v].indexOf(m), M = this.data[v][_];
return this.data[v].splice(_, 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 _ of this.data[v])
l(_.value) || m.push(_);
for (const v of m)
this.remove(v.value.tileID, v);
}
}
class Fr {
constructor() {
this.state = {}, this.stateChanges = {}, this.deletedStates = {};
}
updateState(l, m, v) {
const _ = String(m);
if (this.stateChanges[l] = this.stateChanges[l] || {}, this.stateChanges[l][_] = this.stateChanges[l][_] || {}, a.e(this.stateChanges[l][_], v), this.deletedStates[l] === null) {
this.deletedStates[l] = {};
for (const M in this.state[l])
M !== _ && (this.deletedStates[l][M] = null);
} else if (this.deletedStates[l] && this.deletedStates[l][_] === null) {
this.deletedStates[l][_] = {};
for (const M in this.state[l][_])
v[M] || (this.deletedStates[l][_][M] = null);
} else
for (const M in v)
this.deletedStates[l] && this.deletedStates[l][_] && this.deletedStates[l][_][M] === null && delete this.deletedStates[l][_][M];
}
removeFeatureState(l, m, v) {
if (this.deletedStates[l] === null)
return;
const _ = String(m);
if (this.deletedStates[l] = this.deletedStates[l] || {}, v && m !== void 0)
this.deletedStates[l][_] !== null && (this.deletedStates[l][_] = this.deletedStates[l][_] || {}, this.deletedStates[l][_][v] = null);
else if (m !== void 0)
if (this.stateChanges[l] && this.stateChanges[l][_])
for (v in this.deletedStates[l][_] = {}, this.stateChanges[l][_])
this.deletedStates[l][_][v] = null;
else
this.deletedStates[l][_] = null;
else
this.deletedStates[l] = null;
}
getState(l, m) {
const v = String(m), _ = 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 I in M)
delete _[I];
}
return _;
}
initializeTileState(l, m) {
l.setFeatureState(this.state, m);
}
coalesceChanges(l, m) {
const v = {};
for (const _ in this.stateChanges) {
this.state[_] = this.state[_] || {};
const M = {};
for (const I in this.stateChanges[_])
this.state[_][I] || (this.state[_][I] = {}), a.e(this.state[_][I], this.stateChanges[_][I]), M[I] = this.state[_][I];
v[_] = M;
}
for (const _ in this.deletedStates) {
this.state[_] = this.state[_] || {};
const M = {};
if (this.deletedStates[_] === null)
for (const I in this.state[_])
M[I] = {}, this.state[_][I] = {};
else
for (const I in this.deletedStates[_]) {
if (this.deletedStates[_][I] === null)
this.state[_][I] = {};
else
for (const D of Object.keys(this.deletedStates[_][I]))
delete this.state[_][I][D];
M[I] = this.state[_][I];
}
v[_] = v[_] || {}, a.e(v[_], M);
}
if (this.stateChanges = {}, this.deletedStates = {}, Object.keys(v).length !== 0)
for (const _ in l)
l[_].setFeatureState(v, m);
}
}
class _r extends a.E {
constructor(l, m, v) {
super(), this.id = l, this.dispatcher = v, this.on("data", (_) => this._dataHandler(_)), this.on("dataloading", () => {
this._sourceErrored = !1;
}), this.on("error", () => {
this._sourceErrored = this._source.loaded();
}), this._source = ((_, M, I, D) => {
const j = new (c1(M.type))(_, M, I, D);
if (j.id !== _)
throw new Error(`Expected Source id to be ${_} instead of ${j.id}`);
return j;
})(l, m, v, this), this._tiles = {}, this._cache = new xe(0, (_) => this._unloadTile(_)), this._timers = {}, this._cacheTimers = {}, this._maxTileCacheSize = null, this._maxTileCacheZoomLevels = null, this._loadedParentTiles = {}, this._coveredTiles = {}, this._state = new Fr(), 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 (_) {
l.state = "errored", _.status !== 404 ? this._source.fire(new a.j(_, { 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(In).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, _) => {
const M = v.tileID, I = _.tileID, D = new a.P(M.canonical.x, M.canonical.y)._rotate(this.transform.angle), j = new a.P(I.canonical.x, I.canonical.y)._rotate(this.transform.angle);
return M.overscaledZ - I.overscaledZ || j.y - D.y || j.x - D.x;
}).map((v) => v.tileID.key) : m.map((v) => v.tileID).sort(In).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 _ = 0; _ < m.length; _++) {
const M = m[_];
if (l.neighboringTiles && l.neighboringTiles[M]) {
const I = this.getTileByID(M);
v(l, I), v(I, l);
}
}
function v(_, M) {
_.needsHillshadePrepare = !0, _.needsTerrainPrepare = !0;
let I = M.tileID.canonical.x - _.tileID.canonical.x;
const D = M.tileID.canonical.y - _.tileID.canonical.y, j = Math.pow(2, _.tileID.canonical.z), W = M.tileID.key;
I === 0 && D === 0 || Math.abs(D) > 1 || (Math.abs(I) > 1 && (Math.abs(I + j) === 1 ? I += j : Math.abs(I - j) === 1 && (I -= j)), M.dem && _.dem && (_.dem.backfillBorder(M.dem, I, D), _.neighboringTiles && _.neighboringTiles[W] && (_.neighboringTiles[W].backfilled = !0)));
}
}
getTile(l) {
return this.getTileByID(l.key);
}
getTileByID(l) {
return this._tiles[l];
}
_retainLoadedChildren(l, m, v, _) {
for (const M in this._tiles) {
let I = this._tiles[M];
if (_[M] || !I.hasData() || I.tileID.overscaledZ <= m || I.tileID.overscaledZ > v)
continue;
let D = I.tileID;
for (; I && I.tileID.overscaledZ > m + 1; ) {
const W = I.tileID.scaledTo(I.tileID.overscaledZ - 1);
I = this._tiles[W.key], I && I.hasData() && (D = W);
}
let j = D;
for (; j.overscaledZ > m; )
if (j = j.scaledTo(j.overscaledZ - 1), l[j.key]) {
_[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 _ = l.scaledTo(v), M = this._getLoadedTile(_);
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, _ = 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, _) : _;
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 _ in this._tiles) {
const M = this._tiles[_];
M.tileID = M.tileID.unwrapTo(M.tileID.wrap + m), v[M.tileID.key] = M;
}
this._tiles = v;
for (const _ in this._timers)
clearTimeout(this._timers[_]), delete this._timers[_];
for (const _ in this._tiles)
this._setTileReloadTimer(_, this._tiles[_]);
}
}
_updateCoveredAndRetainedTiles(l, m, v, _, M, I) {
const D = {}, j = {}, W = Object.keys(l), Y = f.now();
for (const J of W) {
const ct = l[J], ft = this._tiles[J];
if (!ft || ft.fadeEndTime !== 0 && ft.fadeEndTime <= Y)
continue;
const Qt = this.findLoadedParent(ct, m), Lt = this.findLoadedSibling(ct), Et = Qt || Lt || null;
Et && (this._addTile(Et.tileID), D[Et.tileID.key] = Et.tileID), j[J] = ct;
}
this._retainLoadedChildren(j, _, v, l);
for (const J in D)
l[J] || (this._coveredTiles[J] = !0, l[J] = D[J]);
if (I) {
const J = {}, ct = {};
for (const ft of M)
this._tiles[ft.key].hasData() ? J[ft.key] = ft : ct[ft.key] = ft;
for (const ft in ct) {
const Qt = ct[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 ct[ft]);
}
for (const ft in ct) {
const Qt = ct[ft], Lt = this.findLoadedParent(Qt, this._source.minzoom), Et = this.findLoadedSibling(Qt), Ht = Lt || Et || null;
if (Ht) {
J[Ht.tileID.key] = l[Ht.tileID.key] = Ht.tileID;
for (const Ct in J)
J[Ct].isChildOf(Ht.tileID) && delete J[Ct];
}
}
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 _ = l.coveringZoomLevel(this._source), M = Math.max(_ - _r.maxOverzooming, this._source.minzoom), I = Math.max(_ + _r.maxUnderzooming, this._source.minzoom);
if (this.usedForTerrain) {
const Y = {};
for (const J of v)
if (J.canonical.z > this._source.minzoom) {
const ct = J.scaledTo(J.canonical.z - 1);
Y[ct.key] = ct;
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, _);
y1(this._source.type) && this._updateCoveredAndRetainedTiles(j, M, I, _, v, m);
for (const Y in j)
this._tiles[Y].clearFadeHold();
const W = a.ab(this._tiles, j);
for (const Y of W) {
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 _ = {}, M = {}, I = Math.max(m - _r.maxOverzooming, this._source.minzoom), D = Math.max(m + _r.maxUnderzooming, this._source.minzoom), j = {};
for (const W of l) {
const Y = this._addTile(W);
_[W.key] = W, Y.hasData() || m < this._source.maxzoom && (j[W.key] = W);
}
this._retainLoadedChildren(j, m, D, _);
for (const W of l) {
let Y = this._tiles[W.key];
if (Y.hasData())
continue;
if (m + 1 > this._source.maxzoom) {
const ct = W.children(this._source.maxzoom)[0], ft = this.getTile(ct);
if (ft && ft.hasData()) {
_[ct.key] = ct;
continue;
}
} else {
const ct = W.children(this._source.maxzoom);
if (_[ct[0].key] && _[ct[1].key] && _[ct[2].key] && _[ct[3].key])
continue;
}
let J = Y.wasRequested();
for (let ct = W.overscaledZ - 1; ct >= I; --ct) {
const ft = W.scaledTo(ct);
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) && (_[ft.key] = ft), J = Y.wasRequested(), Qt)
break;
}
}
}
return _;
}
_updateLoadedParentTileCache() {
this._loadedParentTiles = {};
for (const l in this._tiles) {
const m = [];
let v, _ = this._tiles[l].tileID;
for (; _.overscaledZ > 0; ) {
if (_.key in this._loadedParentTiles) {
v = this._loadedParentTiles[_.key];
break;
}
m.push(_.key);
const M = _.scaledTo(_.overscaledZ - 1);
if (v = this._getLoadedTile(M), v)
break;
_ = 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 _ = [], M = this.transform;
if (!M)
return _;
const I = v ? M.getCameraQueryGeometry(l) : l, D = l.map((Qt) => M.pointCoordinate(Qt, this.terrain)), j = I.map((Qt) => M.pointCoordinate(Qt, this.terrain)), W = this.getIds();
let Y = 1 / 0, J = 1 / 0, ct = -1 / 0, ft = -1 / 0;
for (const Qt of j)
Y = Math.min(Y, Qt.x), J = Math.min(J, Qt.y), ct = Math.max(ct, Qt.x), ft = Math.max(ft, Qt.y);
for (let Qt = 0; Qt < W.length; Qt++) {
const Lt = this._tiles[W[Qt]];
if (Lt.holdingForFade())
continue;
const Et = Lt.tileID, Ht = Math.pow(2, M.zoom - Lt.tileID.overscaledZ), Ct = m * Lt.queryPadding * a.X / Lt.tileSize / Ht, _t = [Et.getTilePoint(new a.Z(Y, J)), Et.getTilePoint(new a.Z(ct, ft))];
if (_t[0].x - Ct < a.X && _t[0].y - Ct < a.X && _t[1].x + Ct >= 0 && _t[1].y + Ct >= 0) {
const Nt = D.map((Wt) => Et.getTilePoint(Wt)), Dt = j.map((Wt) => Et.getTilePoint(Wt));
_.push({ tile: Lt, tileID: Et, queryGeometry: Nt, cameraQueryGeometry: Dt, scale: Ht });
}
}
return _;
}
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 _ = this._tiles[l];
_ && _.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 In(E, l) {
const m = Math.abs(2 * E.wrap) - +(E.wrap < 0), v = Math.abs(2 * l.wrap) - +(l.wrap < 0);
return E.overscaledZ - l.overscaledZ || v - m || l.canonical.y - E.canonical.y || l.canonical.x - E.canonical.x;
}
function y1(E) {
return E === "raster" || E === "image" || E === "video";
}
_r.maxOverzooming = 10, _r.maxUnderzooming = 3;
class Lr {
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 _ = l * this.paddedLength + this.padding;
for (; v < _ && m < this._distances.length; )
v = this._distances[++m];
const M = m - 1, I = this._distances[M], D = v - I, j = D > 0 ? (_ - I) / D : 0;
return this.points[M].mult(1 - j).add(this.points[m].mult(j));
}
}
function Vi(E, l) {
let m = !0;
return E === "always" || E !== "never" && l !== "never" || (m = !1), m;
}
class H1 {
constructor(l, m, v) {
const _ = this.boxCells = [], M = this.circleCells = [];
this.xCellCount = Math.ceil(l / v), this.yCellCount = Math.ceil(m / v);
for (let I = 0; I < this.xCellCount * this.yCellCount; I++)
_.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, _, M) {
this._forEachCell(m, v, _, M, this._insertBoxCell, this.boxUid++), this.boxKeys.push(l), this.bboxes.push(m), this.bboxes.push(v), this.bboxes.push(_), this.bboxes.push(M);
}
insertCircle(l, m, v, _) {
this._forEachCell(m - _, v - _, m + _, v + _, this._insertCircleCell, this.circleUid++), this.circleKeys.push(l), this.circles.push(m), this.circles.push(v), this.circles.push(_);
}
_insertBoxCell(l, m, v, _, M, I) {
this.boxCells[M].push(I);
}
_insertCircleCell(l, m, v, _, M, I) {
this.circleCells[M].push(I);
}
_query(l, m, v, _, M, I, D) {
if (v < 0 || l > this.width || _ < 0 || m > this.height)
return [];
const j = [];
if (l <= 0 && m <= 0 && this.width <= v && this.height <= _) {
if (M)
return [{ key: null, x1: l, y1: m, x2: v, y2: _ }];
for (let W = 0; W < this.boxKeys.length; W++)
j.push({ key: this.boxKeys[W], x1: this.bboxes[4 * W], y1: this.bboxes[4 * W + 1], x2: this.bboxes[4 * W + 2], y2: this.bboxes[4 * W + 3] });
for (let W = 0; W < this.circleKeys.length; W++) {
const Y = this.circles[3 * W], J = this.circles[3 * W + 1], ct = this.circles[3 * W + 2];
j.push({ key: this.circleKeys[W], x1: Y - ct, y1: J - ct, x2: Y + ct, y2: J + ct });
}
} else
this._forEachCell(l, m, v, _, this._queryCell, j, { hitTest: M, overlapMode: I, seenUids: { box: {}, circle: {} } }, D);
return j;
}
query(l, m, v, _) {
return this._query(l, m, v, _, !1, null);
}
hitTest(l, m, v, _, M, I) {
return this._query(l, m, v, _, !0, M, I).length > 0;
}
hitTestCircle(l, m, v, _, M) {
const I = l - v, D = l + v, j = m - v, W = m + v;
if (D < 0 || I > this.width || W < 0 || j > this.height)
return !1;
const Y = [];
return this._forEachCell(I, j, D, W, this._queryCellCircle, Y, { hitTest: !0, overlapMode: _, circle: { x: l, y: m, radius: v }, seenUids: { box: {}, circle: {} } }, M), Y.length > 0;
}
_queryCell(l, m, v, _, M, I, D, j) {
const { seenUids: W, hitTest: Y, overlapMode: J } = D, ct = this.boxCells[M];
if (ct !== null) {
const Qt = this.bboxes;
for (const Lt of ct)
if (!W.box[Lt]) {
W.box[Lt] = !0;
const Et = 4 * Lt, Ht = this.boxKeys[Lt];
if (l <= Qt[Et + 2] && m <= Qt[Et + 3] && v >= Qt[Et + 0] && _ >= Qt[Et + 1] && (!j || j(Ht)) && (!Y || !Vi(J, Ht.overlapMode)) && (I.push({ key: Ht, x1: Qt[Et], y1: Qt[Et + 1], x2: Qt[Et + 2], y2: Qt[Et + 3] }), Y))
return !0;
}
}
const ft = this.circleCells[M];
if (ft !== null) {
const Qt = this.circles;
for (const Lt of ft)
if (!W.circle[Lt]) {
W.circle[Lt] = !0;
const Et = 3 * Lt, Ht = this.circleKeys[Lt];
if (this._circleAndRectCollide(Qt[Et], Qt[Et + 1], Qt[Et + 2], l, m, v, _) && (!j || j(Ht)) && (!Y || !Vi(J, Ht.overlapMode))) {
const Ct = Qt[Et], _t = Qt[Et + 1], Nt = Qt[Et + 2];
if (I.push({ key: Ht, x1: Ct - Nt, y1: _t - Nt, x2: Ct + Nt, y2: _t + Nt }), Y)
return !0;
}
}
}
return !1;
}
_queryCellCircle(l, m, v, _, M, I, D, j) {
const { circle: W, seenUids: Y, overlapMode: J } = D, ct = this.boxCells[M];
if (ct !== null) {
const Qt = this.bboxes;
for (const Lt of ct)
if (!Y.box[Lt]) {
Y.box[Lt] = !0;
const Et = 4 * Lt, Ht = this.boxKeys[Lt];
if (this._circleAndRectCollide(W.x, W.y, W.radius, Qt[Et + 0], Qt[Et + 1], Qt[Et + 2], Qt[Et + 3]) && (!j || j(Ht)) && !Vi(J, Ht.overlapMode))
return I.push(!0), !0;
}
}
const ft = this.circleCells[M];
if (ft !== null) {
const Qt = this.circles;
for (const Lt of ft)
if (!Y.circle[Lt]) {
Y.circle[Lt] = !0;
const Et = 3 * Lt, Ht = this.circleKeys[Lt];
if (this._circlesCollide(Qt[Et], Qt[Et + 1], Qt[Et + 2], W.x, W.y, W.radius) && (!j || j(Ht)) && !Vi(J, Ht.overlapMode))
return I.push(!0), !0;
}
}
}
_forEachCell(l, m, v, _, M, I, D, j) {
const W = this._convertToXCellCoord(l), Y = this._convertToYCellCoord(m), J = this._convertToXCellCoord(v), ct = this._convertToYCellCoord(_);
for (let ft = W; ft <= J; ft++)
for (let Qt = Y; Qt <= ct; Qt++)
if (M.call(this, l, m, v, _, this.xCellCount * Qt + ft, I, 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, _, M, I) {
const D = _ - l, j = M - m, W = v + I;
return W * W > D * D + j * j;
}
_circleAndRectCollide(l, m, v, _, M, I, D) {
const j = (I - _) / 2, W = Math.abs(l - (_ + j));
if (W > j + v)
return !1;
const Y = (D - M) / 2, J = Math.abs(m - (M + Y));
if (J > Y + v)
return !1;
if (W <= j || J <= Y)
return !0;
const ct = W - j, ft = J - Y;
return ct * ct + ft * ft <= v * v;
}
}
function Ii(E, l, m, v, _) {
const M = a.H();
return l ? (a.K(M, M, [1 / _, 1 / _, 1]), m || a.ad(M, M, v.angle)) : a.L(M, v.labelPlaneMatrix, E), M;
}
function Rn(E, l, m, v, _) {
if (l) {
const M = a.ae(E);
return a.K(M, M, [_, _, 1]), m || a.ad(M, M, -v.angle), M;
}
return v.glCoordMatrix;
}
function wt(E, l, m, v) {
let _;
v ? (_ = [E, l, v(E, l), 1], a.af(_, _, m)) : (_ = [E, l, 0, 1], Te(_, _, m));
const M = _[3];
return { point: new a.P(_[0] / M, _[1] / M), signedDistanceFromCamera: M, isOccluded: !1 };
}
function it(E, l) {
return 0.5 + E / l * 0.5;
}
function ot(E, l) {
return E.x >= -l[0] && E.x <= l[0] && E.y >= -l[1] && E.y <= l[1];
}
function pt(E, l, m, v, _, M, I, D, j, W, Y, J, ct, ft, Qt) {
const Lt = v ? E.textSizeData : E.iconSizeData, Et = a.ag(Lt, m.transform.zoom), Ht = [256 / m.width * 2 + 1, 256 / m.height * 2 + 1], Ct = v ? E.text.dynamicLayoutVertexArray : E.icon.dynamicLayoutVertexArray;
Ct.clear();
const _t = E.lineVertexArray, Nt = v ? E.text.placedSymbolArray : E.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, Ct);
continue;
}
Wt = !1;
const De = wt(we.anchorX, we.anchorY, l, Qt);
if (!ot(De.point, Ht)) {
Rt(we.numGlyphs, Ct);
continue;
}
const tr = it(m.transform.cameraToCenterDistance, De.signedDistanceFromCamera), Oe = a.ai(Lt, Et, we), Ce = I ? Oe / tr : Oe * tr, ur = { getElevation: Qt, labelPlaneMatrix: _, lineVertexArray: _t, pitchWithMap: I, projectionCache: { projections: {}, offsets: {}, cachedAnchorPoint: void 0, anyProjectionOccluded: !1 }, projection: W, tileAnchorPoint: new a.P(we.anchorX, we.anchorY), unwrappedTileID: Y, width: J, height: ct, translation: ft }, Dr = It(ur, we, Ce, !1, D, l, M, E.glyphOffsetArray, Ct, Dt, j);
Wt = Dr.useVertical, (Dr.notEnoughRoom || Wt || Dr.needsFlipping && It(ur, we, Ce, !0, D, l, M, E.glyphOffsetArray, Ct, Dt, j).notEnoughRoom) && Rt(we.numGlyphs, Ct);
}
v ? E.text.dynamicLayoutVertexBuffer.updateData(Ct) : E.icon.dynamicLayoutVertexBuffer.updateData(Ct);
}
function gt(E, l, m, v, _, M, I, D) {
const j = M.glyphStartIndex + M.numGlyphs, W = M.lineStartIndex, Y = M.lineStartIndex + M.lineLength, J = l.getoffsetX(M.glyphStartIndex), ct = l.getoffsetX(j - 1), ft = Le(E * J, m, v, _, M.segment, W, Y, D, I);
if (!ft)
return null;
const Qt = Le(E * ct, m, v, _, M.segment, W, Y, D, I);
return Qt ? D.projectionCache.anyProjectionOccluded ? null : { first: ft, last: Qt } : null;
}
function At(E, l, m, v) {
return E === a.ah.horizontal && Math.abs(m.y - l.y) > Math.abs(m.x - l.x) * v ? { useVertical: !0 } : (E === a.ah.vertical ? l.y < m.y : l.x > m.x) ? { needsFlipping: !0 } : null;
}
function It(E, l, m, v, _, M, I, D, j, W, Y) {
const J = m / 24, ct = l.lineOffsetX * J, ft = l.lineOffsetY * J;
let Qt;
if (l.numGlyphs > 1) {
const Lt = l.glyphStartIndex + l.numGlyphs, Et = l.lineStartIndex, Ht = l.lineStartIndex + l.lineLength, Ct = gt(J, D, ct, ft, v, l, Y, E);
if (!Ct)
return { notEnoughRoom: !0 };
const _t = wt(Ct.first.point.x, Ct.first.point.y, I, E.getElevation).point, Nt = wt(Ct.last.point.x, Ct.last.point.y, I, E.getElevation).point;
if (_ && !v) {
const Dt = At(l.writingMode, _t, Nt, W);
if (Dt)
return Dt;
}
Qt = [Ct.first];
for (let Dt = l.glyphStartIndex + 1; Dt < Lt - 1; Dt++)
Qt.push(Le(J * D.getoffsetX(Dt), ct, ft, v, l.segment, Et, Ht, E, Y));
Qt.push(Ct.last);
} else {
if (_ && !v) {
const Et = wt(E.tileAnchorPoint.x, E.tileAnchorPoint.y, M, E.getElevation).point, Ht = l.lineStartIndex + l.segment + 1, Ct = new a.P(E.lineVertexArray.getx(Ht), E.lineVertexArray.gety(Ht)), _t = wt(Ct.x, Ct.y, M, E.getElevation), Nt = _t.signedDistanceFromCamera > 0 ? _t.point : function(Wt, he, we, De, tr, Oe) {
return jt(Wt, he, we, 1, tr, Oe);
}(E.tileAnchorPoint, Ct, Et, 0, M, E), Dt = At(l.writingMode, Et, Nt, W);
if (Dt)
return Dt;
}
const Lt = Le(J * D.getoffsetX(l.glyphStartIndex), ct, ft, v, l.segment, l.lineStartIndex, l.lineStartIndex + l.lineLength, E, Y);
if (!Lt || E.projectionCache.anyProjectionOccluded)
return { notEnoughRoom: !0 };
Qt = [Lt];
}
for (const Lt of Qt)
a.aj(j, Lt.point, Lt.angle);
return {};
}
function jt(E, l, m, v, _, M) {
const I = E.add(E.sub(l)._unit()), D = _ !== void 0 ? wt(I.x, I.y, _, M.getElevation).point : Jt(I.x, I.y, M).point, j = m.sub(D);
return m.add(j._mult(v / j.mag()));
}
function St(E, l, m) {
const v = l.projectionCache;
if (v.projections[E])
return v.projections[E];
const _ = new a.P(l.lineVertexArray.getx(E), l.lineVertexArray.gety(E)), M = Jt(_.x, _.y, l);
if (M.signedDistanceFromCamera > 0)
return v.projections[E] = M.point, v.anyProjectionOccluded = v.anyProjectionOccluded || M.isOccluded, M.point;
const I = E - m.direction;
return function(D, j, W, Y, J) {
return jt(D, j, W, Y, void 0, J);
}(m.distanceFromAnchor === 0 ? l.tileAnchorPoint : new a.P(l.lineVertexArray.getx(I), l.lineVertexArray.gety(I)), _, m.previousVertex, m.absOffsetX - m.distanceFromAnchor + 1, l);
}
function Jt(E, l, m) {
const v = E + m.translation[0], _ = l + m.translation[1];
let M;
return !m.pitchWithMap && m.projection.useSpecialProjectionForSymbols ? (M = m.projection.projectTileCoordinates(v, _, 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 = wt(v, _, m.labelPlaneMatrix, m.getElevation), M.isOccluded = !1), M;
}
function se(E, l, m) {
return E._unit()._perp()._mult(l * m);
}
function Xt(E, l, m, v, _, M, I, D, j) {
if (D.projectionCache.offsets[E])
return D.projectionCache.offsets[E];
const W = m.add(l);
if (E + j.direction < v || E + j.direction >= _)
return D.projectionCache.offsets[E] = W, W;
const Y = St(E + j.direction, D, j), J = se(Y.sub(m), I, j.direction), ct = m.add(J), ft = Y.add(J);
return D.projectionCache.offsets[E] = a.ak(M, W, ct, ft) || W, D.projectionCache.offsets[E];
}
function Le(E, l, m, v, _, M, I, D, j) {
const W = v ? E - l : E + l;
let Y = W > 0 ? 1 : -1, J = 0;
v && (Y *= -1, J = Math.PI), Y < 0 && (J += Math.PI);
let ct, ft = Y > 0 ? M + _ : M + _ + 1;
D.projectionCache.cachedAnchorPoint ? ct = D.projectionCache.cachedAnchorPoint : (ct = Jt(D.tileAnchorPoint.x, D.tileAnchorPoint.y, D).point, D.projectionCache.cachedAnchorPoint = ct);
let Qt, Lt, Et = ct, Ht = ct, Ct = 0, _t = 0;
const Nt = Math.abs(W), Dt = [];
let Wt;
for (; Ct + _t <= Nt; ) {
if (ft += Y, ft < M || ft >= I)
return null;
Ct += _t, Ht = Et, Lt = Qt;
const De = { absOffsetX: Nt, direction: Y, distanceFromAnchor: Ct, previousVertex: Ht };
if (Et = St(ft, D, De), m === 0)
Dt.push(Ht), Wt = Et.sub(Ht);
else {
let tr;
const Oe = Et.sub(Ht);
tr = Oe.mag() === 0 ? se(St(ft + Y, D, De).sub(Et), m, Y) : se(Oe, m, Y), Lt || (Lt = Ht.add(tr)), Qt = Xt(ft, tr, Et, M, I, Lt, m, D, De), Dt.push(Lt), Wt = Qt.sub(Lt);
}
_t = Wt.mag();
}
const he = Wt._mult((Nt - Ct) / _t)._add(Lt || Ht), we = J + Math.atan2(Et.y - Ht.y, Et.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(E, l) {
for (let m = 0; m < E; m++) {
const v = l.length;
l.resize(v + 4), l.float32.set(or, 3 * v);
}
}
function Te(E, l, m) {
const v = l[0], _ = l[1];
return E[0] = m[0] * v + m[4] * _ + m[12], E[1] = m[1] * v + m[5] * _ + m[13], E[3] = m[3] * v + m[7] * _ + m[15], E;
}
const He = 100;
class lr {
constructor(l, m, v = new H1(l.width + 200, l.height + 200, 25), _ = new H1(l.width + 200, l.height + 200, 25)) {
this.transform = l, this.mapProjection = m, this.grid = v, this.ignoredGrid = _, this.pitchFactor = Math.cos(l._pitch) * l.cameraToCenterDistance, this.screenRightBoundary = l.width + He, this.screenBottomBoundary = l.height + He, this.gridRightBoundary = l.width + 200, this.gridBottomBoundary = l.height + 200, this.perspectiveRatioCutoff = 0.6;
}
placeCollisionBox(l, m, v, _, M, I, D, j, W, Y, J) {
const ct = l.anchorPointX + j[0], ft = l.anchorPointY + j[1], Qt = this.projectAndGetPerspectiveRatio(_, ct, ft, M, Y), Lt = v * Qt.perspectiveRatio;
let Et;
if (I || D)
Et = this._projectCollisionBox(l, Lt, _, M, I, D, j, Qt, Y, J);
else {
const Dt = Qt.point.x + (J ? J.x * Lt : 0), Wt = Qt.point.y + (J ? J.y * Lt : 0);
Et = { allPointsOccluded: !1, box: [Dt + l.x1 * Lt, Wt + l.y1 * Lt, Dt + l.x2 * Lt, Wt + l.y2 * Lt] };
}
const [Ht, Ct, _t, Nt] = Et.box;
return this.mapProjection.useSpecialProjectionForSymbols && (I ? Et.allPointsOccluded : this.mapProjection.isOccluded(ct, ft, M)) || Qt.perspectiveRatio < this.perspectiveRatioCutoff || !this.isInsideGrid(Ht, Ct, _t, Nt) || m !== "always" && this.grid.hitTest(Ht, Ct, _t, Nt, m, W) ? { box: [Ht, Ct, _t, Nt], placeable: !1, offscreen: !1 } : { box: [Ht, Ct, _t, Nt], placeable: !0, offscreen: this.isOffscreen(Ht, Ct, _t, Nt) };
}
placeCollisionCircles(l, m, v, _, M, I, D, j, W, Y, J, ct, ft, Qt, Lt, Et) {
const Ht = [], Ct = new a.P(m.anchorX, m.anchorY), _t = this.getPerspectiveRatio(I, Ct.x, Ct.y, D, Et), Nt = (J ? M / _t : M * _t) / a.ap, Dt = { getElevation: Et, labelPlaneMatrix: j, lineVertexArray: v, pitchWithMap: J, projectionCache: { projections: {}, offsets: {}, cachedAnchorPoint: void 0, anyProjectionOccluded: !1 }, projection: this.mapProjection, tileAnchorPoint: Ct, unwrappedTileID: D, width: this.transform.width, height: this.transform.height, translation: Lt }, Wt = gt(Nt, _, m.lineOffsetX * Nt, m.lineOffsetY * Nt, !1, m, !1, Dt);
let he = !1, we = !1, De = !0;
if (Wt) {
const tr = 0.5 * ft * _t + Qt, Oe = new a.P(-100, -100), Ce = new a.P(this.screenRightBoundary, this.screenBottomBoundary), ur = new Lr(), Dr = Wt.first, Ie = Wt.last;
let Ze = [];
for (let Zr = Dr.path.length - 1; Zr >= 1; Zr--)
Ze.push(Dr.path[Zr]);
for (let Zr = 1; Zr < Ie.path.length; Zr++)
Ze.push(Ie.path[Zr]);
const Or = 2.5 * tr;
if (W) {
const Zr = this.projectPathToScreenSpace(Ze, Dt, W);
Ze = Zr.some((nn) => nn.signedDistanceFromCamera <= 0) ? [] : Zr.map((nn) => nn.point);
}
let ei = [];
if (Ze.length > 0) {
const Zr = Ze[0].clone(), nn = Ze[0].clone();
for (let ri = 1; ri < Ze.length; ri++)
Zr.x = Math.min(Zr.x, Ze[ri].x), Zr.y = Math.min(Zr.y, Ze[ri].y), nn.x = Math.max(nn.x, Ze[ri].x), nn.y = Math.max(nn.y, Ze[ri].y);
ei = Zr.x >= Oe.x && nn.x <= Ce.x && Zr.y >= Oe.y && nn.y <= Ce.y ? [Ze] : nn.x < Oe.x || Zr.x > Ce.x || nn.y < Oe.y || Zr.y > Ce.y ? [] : a.al([Ze], Oe.x, Oe.y, Ce.x, Ce.y);
}
for (const Zr of ei) {
ur.reset(Zr, 0.25 * tr);
let nn = 0;
nn = ur.length <= 0.5 * tr ? 1 : Math.ceil(ur.paddedLength / Or) + 1;
for (let ri = 0; ri < nn; ri++) {
const O1 = ri / Math.max(nn - 1, 1), C2 = ur.lerp(O1), ni = C2.x + He, mo = C2.y + He;
Ht.push(ni, mo, tr, 0);
const q1 = ni - tr, P1 = mo - tr, X1 = ni + tr, ms = mo + tr;
if (De = De && this.isOffscreen(q1, P1, X1, ms), we = we || this.isInsideGrid(q1, P1, X1, ms), l !== "always" && this.grid.hitTestCircle(ni, mo, tr, l, ct) && (he = !0, !Y))
return { circles: [], offscreen: !1, collisionDetected: he };
}
}
}
return { circles: !Y && he || !we || _t < this.perspectiveRatioCutoff ? [] : Ht, offscreen: De, collisionDetected: he };
}
projectPathToScreenSpace(l, m, v) {
return l.map((_) => wt(_.x, _.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, _ = 1 / 0, M = -1 / 0, I = -1 / 0;
for (const Y of l) {
const J = new a.P(Y.x + He, Y.y + He);
v = Math.min(v, J.x), _ = Math.min(_, J.y), M = Math.max(M, J.x), I = Math.max(I, J.y), m.push(J);
}
const D = this.grid.query(v, _, M, I).concat(this.ignoredGrid.query(v, _, M, I)), j = {}, W = {};
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 ct = [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, ct) && (j[J.bucketInstanceId][J.featureIndex] = !0, W[J.bucketInstanceId] === void 0 && (W[J.bucketInstanceId] = []), W[J.bucketInstanceId].push(J.featureIndex));
}
return W;
}
insertCollisionBox(l, m, v, _, M, I) {
(v ? this.ignoredGrid : this.grid).insert({ bucketInstanceId: _, featureIndex: M, collisionGroupID: I, overlapMode: m }, l[0], l[1], l[2], l[3]);
}
insertCollisionCircles(l, m, v, _, M, I) {
const D = v ? this.ignoredGrid : this.grid, j = { bucketInstanceId: _, featureIndex: M, collisionGroupID: I, overlapMode: m };
for (let W = 0; W < l.length; W += 4)
D.insertCircle(j, l[W], l[W + 1], l[W + 2]);
}
projectAndGetPerspectiveRatio(l, m, v, _, M) {
let I;
M ? (I = [m, v, M(m, v), 1], a.af(I, I, l)) : (I = [m, v, 0, 1], Te(I, I, l));
const D = I[3];
return { point: new a.P((I[0] / D + 1) / 2 * this.transform.width + He, (-I[1] / D + 1) / 2 * this.transform.height + He), perspectiveRatio: 0.5 + this.transform.cameraToCenterDistance / D * 0.5, isOccluded: !1, signedDistanceFromCamera: D };
}
getPerspectiveRatio(l, m, v, _, M) {
const I = this.mapProjection.useSpecialProjectionForSymbols ? this.mapProjection.projectTileCoordinates(m, v, _, M) : wt(m, v, l, M);
return 0.5 + this.transform.cameraToCenterDistance / I.signedDistanceFromCamera * 0.5;
}
isOffscreen(l, m, v, _) {
return v < He || l >= this.screenRightBoundary || _ < He || m > this.screenBottomBoundary;
}
isInsideGrid(l, m, v, _) {
return v >= 0 && l < this.gridRightBoundary && _ >= 0 && m < this.gridBottomBoundary;
}
getViewportMatrix() {
const l = a.an([]);
return a.J(l, l, [-100, -100, 0]), l;
}
_projectCollisionBox(l, m, v, _, M, I, D, j, W, Y) {
let J = new a.P(1, 0), ct = new a.P(0, 1);
const ft = new a.P(l.anchorPointX + D[0], l.anchorPointY + D[1]);
if (I && !M) {
const De = this.projectAndGetPerspectiveRatio(v, ft.x + 1, ft.y, _, W).point.sub(j.point).unit(), tr = Math.atan(De.y / De.x) + (De.x < 0 ? Math.PI : 0), Oe = Math.sin(tr), Ce = Math.cos(tr);
J = new a.P(Ce, Oe), ct = new a.P(-Oe, Ce);
} else if (!I && M) {
const De = -this.transform.angle, tr = Math.sin(De), Oe = Math.cos(De);
J = new a.P(Oe, tr), ct = new a.P(-tr, Oe);
}
let Qt = j.point, Lt = m;
if (M) {
Qt = ft;
const De = this.transform.zoom - Math.floor(this.transform.zoom);
Lt = Math.pow(2, -De), Lt *= this.mapProjection.getPitchedTextCorrection(this.transform, ft, _), Y || (Lt *= a.ac(0.5 + j.signedDistanceFromCamera / this.transform.cameraToCenterDistance * 0.5, 0, 4));
}
Y && (Qt = Qt.add(J.mult(Y.x * Lt)).add(ct.mult(Y.y * Lt)));
const Et = l.x1 * Lt, Ht = l.x2 * Lt, Ct = (Et + Ht) / 2, _t = l.y1 * Lt, Nt = l.y2 * Lt, Dt = (_t + Nt) / 2, Wt = [{ offsetX: Et, offsetY: _t }, { offsetX: Ct, offsetY: _t }, { offsetX: Ht, offsetY: _t }, { offsetX: Ht, offsetY: Dt }, { offsetX: Ht, offsetY: Nt }, { offsetX: Ct, offsetY: Nt }, { offsetX: Et, offsetY: Nt }, { offsetX: Et, offsetY: Dt }];
let he = [];
for (const { offsetX: De, offsetY: tr } of Wt)
he.push(new a.P(Qt.x + J.x * De + ct.x * tr, Qt.y + J.y * De + ct.y * tr));
let we = !1;
if (M) {
const De = he.map((tr) => this.projectAndGetPerspectiveRatio(v, tr.x, tr.y, _, W));
we = De.some((tr) => !tr.isOccluded), he = De.map((tr) => tr.point);
} else
we = !0;
return { box: a.ao(he), allPointsOccluded: !we };
}
}
function Hr(E, l, m) {
return l * (a.X / (E.tileSize * Math.pow(2, m - E.tileID.overscaledZ)));
}
class vn {
constructor(l, m, v, _) {
this.opacity = l ? Math.max(0, Math.min(1, l.opacity + (l.placed ? m : -m))) : _ && v ? 1 : 0, this.placed = v;
}
isHidden() {
return this.opacity === 0 && !this.placed;
}
}
class Nr {
constructor(l, m, v, _, M) {
this.text = new vn(l ? l.text : null, m, v, M), this.icon = new vn(l ? l.icon : null, m, _, M);
}
isHidden() {
return this.text.isHidden() && this.icon.isHidden();
}
}
class vr {
constructor(l, m, v) {
this.text = l, this.icon = m, this.skipFade = v;
}
}
class $r {
constructor() {
this.invProjMatrix = a.H(), this.viewportMatrix = a.H(), this.circles = [];
}
}
class cn {
constructor(l, m, v, _, M) {
this.bucketInstanceId = l, this.featureIndex = m, this.sourceLayerIndex = v, this.bucketIndex = _, 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(E, l, m, v, _) {
const { horizontalAlign: M, verticalAlign: I } = a.au(E);
return new a.P(-(M - 0.5) * l + v[0] * _, -(I - 0.5) * m + v[1] * _);
}
class Ri {
constructor(l, m, v, _, M, I) {
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 = _, this.retainedQueryData = {}, this.collisionGroups = new Kn(M), this.collisionCircleArrays = {}, this.collisionBoxArrays = /* @__PURE__ */ new Map(), this.prevPlacement = I, I && (I.prevPlacement = void 0), this.placedOrientations = {};
}
_getTerrainElevationFunc(l) {
const m = this.terrain;
return m ? (v, _) => m.getElevation(l, v, _) : null;
}
getBucketParts(l, m, v, _) {
const M = v.getBucket(m), I = v.latestFeatureIndex;
if (!M || !I || m.id !== M.layerIds[0])
return;
const D = v.collisionBoxArray, j = M.layers[0].layout, W = M.layers[0].paint, Y = Math.pow(2, this.transform.zoom - v.tileID.overscaledZ), J = v.tileSize / a.X, ct = v.tileID.toUnwrapped(), ft = this.transform.calculatePosMatrix(ct), Qt = j.get("text-pitch-alignment") === "map", Lt = j.get("text-rotation-alignment") === "map", Et = Hr(v, 1, this.transform.zoom), Ht = this.collisionIndex.mapProjection.translatePosition(this.transform, v, W.get("text-translate"), W.get("text-translate-anchor")), Ct = this.collisionIndex.mapProjection.translatePosition(this.transform, v, W.get("icon-translate"), W.get("icon-translate-anchor")), _t = Ii(ft, Qt, Lt, this.transform, Et);
let Nt = null;
if (Qt) {
const Wt = Rn(ft, Qt, Lt, this.transform, Et);
Nt = a.L([], this.transform.labelPlaneMatrix, Wt);
}
this.retainedQueryData[M.bucketInstanceId] = new cn(M.bucketInstanceId, I, M.sourceLayerIndex, M.index, v.tileID);
const Dt = { bucket: M, layout: j, translationText: Ht, translationIcon: Ct, posMatrix: ft, unwrappedTileID: ct, textLabelPlaneMatrix: _t, 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 (_)
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, _, M, I, D, j, W, Y, J, ct, ft, Qt, Lt, Et, Ht, Ct, _t) {
const Nt = a.aq[l.textAnchor], Dt = [l.textOffset0, l.textOffset1], Wt = Li(Nt, v, _, Dt, M), he = this.collisionIndex.placeCollisionBox(m, ct, j, W, Y, D, I, Et, J.predicate, _t, Wt);
if ((!Ct || this.collisionIndex.placeCollisionBox(Ct, ct, j, W, Y, D, I, Ht, J.predicate, _t, 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: _, anchor: Nt, textBoxScale: M, prevAnchor: we }, this.markUsedJustification(Qt, Nt, ft, Lt), Qt.allowVerticalPlacement && (this.markUsedOrientation(Qt, Lt, ft), this.placedOrientations[ft.crossTileID] = Lt), { shift: Wt, placedGlyphBoxes: he };
}
}
placeLayerBucketPart(l, m, v) {
const { bucket: _, layout: M, translationText: I, translationIcon: D, posMatrix: j, unwrappedTileID: W, textLabelPlaneMatrix: Y, labelToScreenMatrix: J, textPixelRatio: ct, holdingForFade: ft, collisionBoxArray: Qt, partiallyEvaluatedTextSize: Lt, collisionGroup: Et } = l.parameters, Ht = M.get("text-optional"), Ct = M.get("icon-optional"), _t = a.ar(M, "text-overlap", "text-allow-overlap"), Nt = _t === "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 || !_.hasIconData() || Ct), Ce = Wt && (Nt || !_.hasTextData() || Ht);
!_.collisionArrays && Qt && _.deserializeCollisionBoxes(Qt);
const ur = this._getTerrainElevationFunc(this.retainedQueryData[_.bucketInstanceId].tileID), Dr = (Ie, Ze, Or) => {
var ei, Zr;
if (m[Ie.crossTileID])
return;
if (ft)
return void (this.placements[Ie.crossTileID] = new vr(!1, !1, !1));
let nn = !1, ri = !1, O1 = !0, C2 = null, ni = { box: null, placeable: !1, offscreen: null }, mo = { box: null, placeable: !1, offscreen: null }, q1 = null, P1 = null, X1 = null, ms = 0, s6 = 0, kl = 0;
Ze.textFeatureIndex ? ms = Ze.textFeatureIndex : Ie.useRuntimeCollisionCircles && (ms = Ie.featureIndex), Ze.verticalTextFeatureIndex && (s6 = Ze.verticalTextFeatureIndex);
const a6 = Ze.textBox;
if (a6) {
const o2 = (b1) => {
let k1 = a.ah.horizontal;
if (_.allowVerticalPlacement && !b1 && this.prevPlacement) {
const Ro = this.prevPlacement.placedOrientations[Ie.crossTileID];
Ro && (this.placedOrientations[Ie.crossTileID] = Ro, k1 = Ro, this.markUsedOrientation(_, k1, Ie));
}
return k1;
}, s2 = (b1, k1) => {
if (_.allowVerticalPlacement && Ie.numVerticalGlyphVertices > 0 && Ze.verticalTextBox) {
for (const Ro of _.writingModes)
if (Ro === a.ah.vertical ? (ni = k1(), mo = ni) : ni = b1(), ni && ni.placeable)
break;
} else
ni = b1();
}, Ma = Ie.textAnchorOffsetStartIndex, O2 = Ie.textAnchorOffsetEndIndex;
if (O2 === Ma) {
const b1 = (k1, Ro) => {
const an = this.collisionIndex.placeCollisionBox(k1, _t, ct, j, W, we, he, I, Et.predicate, ur);
return an && an.placeable && (this.markUsedOrientation(_, Ro, Ie), this.placedOrientations[Ie.crossTileID] = Ro), an;
};
s2(() => b1(a6, a.ah.horizontal), () => {
const k1 = Ze.verticalTextBox;
return _.allowVerticalPlacement && Ie.numVerticalGlyphVertices > 0 && k1 ? b1(k1, a.ah.vertical) : { box: null, offscreen: null };
}), o2(ni && ni.placeable);
} else {
let b1 = a.aq[(Zr = (ei = this.prevPlacement) === null || ei === void 0 ? void 0 : ei.variableOffsets[Ie.crossTileID]) === null || Zr === void 0 ? void 0 : Zr.anchor];
const k1 = (an, B3, l6) => {
const c6 = an.x2 - an.x1, Lp = an.y2 - an.y1, b_ = Ie.textBoxScale, wp = De && Dt === "never" ? B3 : null;
let Ea = null, xp = _t === "never" ? 1 : 2, Il = "never";
b1 && xp++;
for (let R0 = 0; R0 < xp; R0++) {
for (let Rl = Ma; Rl < O2; Rl++) {
const Nl = _.textAnchorOffsets.get(Rl);
if (b1 && Nl.textAnchor !== b1)
continue;
const u6 = this.attemptAnchorPlacement(Nl, an, c6, Lp, b_, he, we, ct, j, W, Et, Il, Ie, _, l6, I, D, wp, ur);
if (u6 && (Ea = u6.placedGlyphBoxes, Ea && Ea.placeable))
return nn = !0, C2 = u6.shift, Ea;
}
b1 ? b1 = null : Il = _t;
}
return v && !Ea && (Ea = { box: this.collisionIndex.placeCollisionBox(a6, "always", ct, j, W, we, he, I, Et.predicate, ur, new a.P(0, 0)).box, offscreen: !1, placeable: !1 }), Ea;
};
s2(() => k1(a6, Ze.iconBox, a.ah.horizontal), () => {
const an = Ze.verticalTextBox;
return _.allowVerticalPlacement && (!ni || !ni.placeable) && Ie.numVerticalGlyphVertices > 0 && an ? k1(an, Ze.verticalIconBox, a.ah.vertical) : { box: null, occluded: !0, offscreen: null };
}), ni && (nn = ni.placeable, O1 = ni.offscreen);
const Ro = o2(ni && ni.placeable);
if (!nn && this.prevPlacement) {
const an = this.prevPlacement.variableOffsets[Ie.crossTileID];
an && (this.variableOffsets[Ie.crossTileID] = an, this.markUsedJustification(_, an.anchor, Ie, Ro));
}
}
}
if (q1 = ni, nn = q1 && q1.placeable, O1 = q1 && q1.offscreen, Ie.useRuntimeCollisionCircles) {
const o2 = _.text.placedSymbolArray.get(Ie.centerJustifiedTextSymbolIndex), s2 = a.ai(_.textSizeData, Lt, o2), Ma = M.get("text-padding");
P1 = this.collisionIndex.placeCollisionCircles(_t, o2, _.lineVertexArray, _.glyphOffsetArray, s2, j, W, Y, J, v, we, Et.predicate, Ie.collisionCircleDiameter, Ma, I, ur), P1.circles.length && P1.collisionDetected && !v && a.w("Collisions detected, but collision boxes are not shown"), nn = Nt || P1.circles.length > 0 && !P1.collisionDetected, O1 = O1 && P1.offscreen;
}
if (Ze.iconFeatureIndex && (kl = Ze.iconFeatureIndex), Ze.iconBox) {
const o2 = (s2) => this.collisionIndex.placeCollisionBox(s2, Dt, ct, j, W, we, he, D, Et.predicate, ur, De && C2 ? C2 : void 0);
mo && mo.placeable && Ze.verticalIconBox ? (X1 = o2(Ze.verticalIconBox), ri = X1.placeable) : (X1 = o2(Ze.iconBox), ri = X1.placeable), O1 = O1 && X1.offscreen;
}
const i2 = Ht || Ie.numHorizontalGlyphVertices === 0 && Ie.numVerticalGlyphVertices === 0, Vl = Ct || Ie.numIconVertices === 0;
i2 || Vl ? Vl ? 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, _t, M.get("text-ignore-placement"), _.bucketInstanceId, mo && mo.placeable && s6 ? s6 : ms, Et.ID), jc && this.collisionIndex.insertCollisionBox(X1.box, Dt, M.get("icon-ignore-placement"), _.bucketInstanceId, kl, Et.ID), P1 && nn && this.collisionIndex.insertCollisionCircles(P1.circles, _t, M.get("text-ignore-placement"), _.bucketInstanceId, ms, Et.ID), v && this.storeCollisionData(_.bucketInstanceId, Or, Ze, q1, X1, P1), Ie.crossTileID === 0)
throw new Error("symbolInstance.crossTileID can't be 0");
if (_.bucketInstanceId === 0)
throw new Error("bucket.bucketInstanceId can't be 0");
this.placements[Ie.crossTileID] = new vr(nn || Oe, ri || Ce, O1 || _.justReloaded), m[Ie.crossTileID] = !0;
};
if (tr) {
if (l.symbolInstanceStart !== 0)
throw new Error("bucket.bucketInstanceId should be 0");
const Ie = _.getSortedSymbolIndexes(this.transform.angle);
for (let Ze = Ie.length - 1; Ze >= 0; --Ze) {
const Or = Ie[Ze];
Dr(_.symbolInstances.get(Or), _.collisionArrays[Or], Or);
}
} else
for (let Ie = l.symbolInstanceStart; Ie < l.symbolInstanceEnd; Ie++)
Dr(_.symbolInstances.get(Ie), _.collisionArrays[Ie], Ie);
if (v && _.bucketInstanceId in this.collisionCircleArrays) {
const Ie = this.collisionCircleArrays[_.bucketInstanceId];
a.as(Ie.invProjMatrix, j), Ie.viewportMatrix = this.collisionIndex.getViewportMatrix();
}
_.justReloaded = !1;
}
storeCollisionData(l, m, v, _, M, I) {
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 = _.box), v.iconBox && (j.icon = M.box);
}
if (I) {
let D = this.collisionCircleArrays[l];
D === void 0 && (D = this.collisionCircleArrays[l] = new $r());
for (let j = 0; j < I.circles.length; j += 4)
D.circles.push(I.circles[j + 0]), D.circles.push(I.circles[j + 1]), D.circles.push(I.circles[j + 2]), D.circles.push(I.collisionDetected ? 1 : 0);
}
}
markUsedJustification(l, m, v, _) {
let M;
M = _ === a.ah.vertical ? v.verticalPlacedTextSymbolIndex : { left: v.leftJustifiedTextSymbolIndex, center: v.centerJustifiedTextSymbolIndex, right: v.rightJustifiedTextSymbolIndex }[a.at(m)];
const I = [v.leftJustifiedTextSymbolIndex, v.centerJustifiedTextSymbolIndex, v.rightJustifiedTextSymbolIndex, v.verticalPlacedTextSymbolIndex];
for (const D of I)
D >= 0 && (l.text.placedSymbolArray.get(D).crossTileID = M >= 0 && D !== M ? 0 : v.crossTileID);
}
markUsedOrientation(l, m, v) {
const _ = m === a.ah.horizontal || m === a.ah.horizontalOnly ? m : 0, M = m === a.ah.vertical ? m : 0, I = [v.leftJustifiedTextSymbolIndex, v.centerJustifiedTextSymbolIndex, v.rightJustifiedTextSymbolIndex];
for (const D of I)
l.text.placedSymbolArray.get(D).placedOrientation = _;
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 _ = m ? m.symbolFadeChange(l) : 1, M = m ? m.opacities : {}, I = m ? m.variableOffsets : {}, D = m ? m.placedOrientations : {};
for (const j in this.placements) {
const W = this.placements[j], Y = M[j];
Y ? (this.opacities[j] = new Nr(Y, _, W.text, W.icon), v = v || W.text !== Y.text.placed || W.icon !== Y.icon.placed) : (this.opacities[j] = new Nr(null, _, W.text, W.icon, W.skipFade), v = v || W.text || W.icon);
}
for (const j in M) {
const W = M[j];
if (!this.opacities[j]) {
const Y = new Nr(W, _, !1, !1);
Y.isHidden() || (this.opacities[j] = Y, v = v || W.text.placed || W.icon.placed);
}
}
for (const j in I)
this.variableOffsets[j] || !this.opacities[j] || this.opacities[j].isHidden() || (this.variableOffsets[j] = I[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 _ of m) {
const M = _.getBucket(l);
M && _.latestFeatureIndex && l.id === M.layerIds[0] && this.updateBucketOpacities(M, _.tileID, v, _.collisionBoxArray);
}
}
updateBucketOpacities(l, m, v, _) {
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], I = M.layout, D = new Nr(null, 0, !1, !1, !0), j = I.get("text-allow-overlap"), W = I.get("icon-allow-overlap"), Y = M._unevaluatedLayout.hasValue("text-variable-anchor") || M._unevaluatedLayout.hasValue("text-variable-anchor-offset"), J = I.get("text-rotation-alignment") === "map", ct = I.get("text-pitch-alignment") === "map", ft = I.get("icon-text-fit") !== "none", Qt = new Nr(null, 0, j && (W || !l.hasIconData() || I.get("icon-optional")), W && (j || !l.hasTextData() || I.get("text-optional")), !0);
!l.collisionArrays && _ && (l.hasIconCollisionBoxData() || l.hasTextCollisionBoxData()) && l.deserializeCollisionBoxes(_);
const Lt = (Ht, Ct, _t) => {
for (let Nt = 0; Nt < Ct / 4; Nt++)
Ht.opacityVertexArray.emplaceBack(_t);
Ht.hasVisibleVertices = Ht.hasVisibleVertices || _t !== uo;
}, Et = this.collisionBoxArrays.get(l.bucketInstanceId);
for (let Ht = 0; Ht < l.symbolInstances.length; Ht++) {
const Ct = l.symbolInstances.get(Ht), { numHorizontalGlyphVertices: _t, numVerticalGlyphVertices: Nt, crossTileID: Dt } = Ct;
let Wt = this.opacities[Dt];
v[Dt] ? Wt = D : Wt || (Wt = Qt, this.opacities[Dt] = Wt), v[Dt] = !0;
const he = Ct.numIconVertices > 0, we = this.placedOrientations[Ct.crossTileID], De = we === a.ah.vertical, tr = we === a.ah.horizontal || we === a.ah.horizontalOnly;
if (_t > 0 || Nt > 0) {
const Ce = pn(Wt.text);
Lt(l.text, _t, De ? uo : Ce), Lt(l.text, Nt, tr ? uo : Ce);
const ur = Wt.text.isHidden();
[Ct.rightJustifiedTextSymbolIndex, Ct.centerJustifiedTextSymbolIndex, Ct.leftJustifiedTextSymbolIndex].forEach((Ze) => {
Ze >= 0 && (l.text.placedSymbolArray.get(Ze).hidden = ur || De ? 1 : 0);
}), Ct.verticalPlacedTextSymbolIndex >= 0 && (l.text.placedSymbolArray.get(Ct.verticalPlacedTextSymbolIndex).hidden = ur || tr ? 1 : 0);
const Dr = this.variableOffsets[Ct.crossTileID];
Dr && this.markUsedJustification(l, Dr.anchor, Ct, we);
const Ie = this.placedOrientations[Ct.crossTileID];
Ie && (this.markUsedJustification(l, "left", Ct, Ie), this.markUsedOrientation(l, Ie, Ct));
}
if (he) {
const Ce = pn(Wt.icon), ur = !(ft && Ct.verticalPlacedIconSymbolIndex && De);
Ct.placedIconSymbolIndex >= 0 && (Lt(l.icon, Ct.numIconVertices, ur ? Ce : uo), l.icon.placedSymbolArray.get(Ct.placedIconSymbolIndex).hidden = Wt.icon.isHidden()), Ct.verticalPlacedIconSymbolIndex >= 0 && (Lt(l.icon, Ct.numVerticalIconVertices, ur ? uo : Ce), l.icon.placedSymbolArray.get(Ct.verticalPlacedIconSymbolIndex).hidden = Wt.icon.isHidden());
}
const Oe = Et && Et.has(Ht) ? Et.get(Ht) : { text: null, icon: null };
if (l.hasIconCollisionBoxData() || l.hasTextCollisionBoxData()) {
const Ce = l.collisionArrays[Ht];
if (Ce) {
let ur = new a.P(0, 0);
if (Ce.textBox || Ce.verticalTextBox) {
let Dr = !0;
if (Y) {
const Ie = this.variableOffsets[Dt];
Ie ? (ur = Li(Ie.anchor, Ie.width, Ie.height, Ie.textOffset, Ie.textBoxScale), J && ur._rotate(ct ? this.transform.angle : -this.transform.angle)) : Dr = !1;
}
if (Ce.textBox || Ce.verticalTextBox) {
let Ie;
Ce.textBox && (Ie = De), Ce.verticalTextBox && (Ie = tr), rs(l.textCollisionBox.collisionVertexArray, Wt.text.placed, !Dr || Ie, Oe.text, ur.x, ur.y);
}
}
if (Ce.iconBox || Ce.verticalIconBox) {
const Dr = !!(!tr && Ce.verticalIconBox);
let Ie;
Ce.iconBox && (Ie = Dr), Ce.verticalIconBox && (Ie = !Dr), rs(l.iconCollisionBox.collisionVertexArray, Wt.icon.placed, Ie, 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(E, l, m, v, _, M) {
v && v.length !== 0 || (v = [0, 0, 0, 0]);
const I = v[0] - He, D = v[1] - He, j = v[2] - He, W = v[3] - He;
E.emplaceBack(l ? 1 : 0, m ? 1 : 0, _ || 0, M || 0, I, D), E.emplaceBack(l ? 1 : 0, m ? 1 : 0, _ || 0, M || 0, j, D), E.emplaceBack(l ? 1 : 0, m ? 1 : 0, _ || 0, M || 0, j, W), E.emplaceBack(l ? 1 : 0, m ? 1 : 0, _ || 0, M || 0, I, W);
}
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(E) {
if (E.opacity === 0 && !E.placed)
return 0;
if (E.opacity === 1 && E.placed)
return 4294967295;
const l = E.placed ? 1 : 0, m = Math.floor(127 * E.opacity);
return m * tn + l * zi + m * co + l * Xr + m * Yn + l * ns + m * _n + l;
}
const uo = 0;
function u1() {
return { isOccluded: (E, l, m) => !1, getPitchedTextCorrection: (E, l, m) => 1, get useSpecialProjectionForSymbols() {
return !1;
}, projectTileCoordinates(E, l, m, v) {
throw new Error("Not implemented.");
}, translatePosition: (E, l, m, v) => function(_, M, I, D, j = !1) {
if (!I[0] && !I[1])
return [0, 0];
const W = j ? D === "map" ? _.angle : 0 : D === "viewport" ? -_.angle : 0;
if (W) {
const Y = Math.sin(W), J = Math.cos(W);
I = [I[0] * J - I[1] * Y, I[0] * Y + I[1] * J];
}
return [j ? I[0] : Hr(M, I[0], _.zoom), j ? I[1] : Hr(M, I[1], _.zoom)];
}(E, l, m, v), getCircleRadiusCorrection: (E) => 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, _, M) {
const I = this._bucketParts;
for (; this._currentTileIndex < l.length; )
if (m.getBucketParts(I, _, l[this._currentTileIndex], this._sortAcrossTiles), this._currentTileIndex++, M())
return !0;
for (this._sortAcrossTiles && (this._sortAcrossTiles = !1, I.sort((D, j) => D.sortKey - j.sortKey)); this._currentPartIndex < I.length; )
if (m.placeLayerBucketPart(I[this._currentPartIndex], this._seenCrossTileIDs, v), this._currentPartIndex++, M())
return !0;
return !1;
}
}
class Ui {
constructor(l, m, v, _, M, I, D, j) {
this.placement = new Ri(l, u1(), m, I, D, j), this._currentPlacementIndex = v.length - 1, this._forceFullPlacement = _, this._showCollisionBoxes = M, this._done = !1;
}
isDone() {
return this._done;
}
continuePlacement(l, m, v) {
const _ = f.now(), M = () => !this._forceFullPlacement && f.now() - _ > 2;
for (; this._currentPlacementIndex >= 0; ) {
const I = m[l[this._currentPlacementIndex]], D = this.placement.collisionIndex.transform.zoom;
if (I.type === "symbol" && (!I.minzoom || I.minzoom <= D) && (!I.maxzoom || I.maxzoom > D)) {
if (this._inProgressLayer || (this._inProgressLayer = new Qn(I)), this._inProgressLayer.continuePlacement(v[I.source], this.placement, this._showCollisionBoxes, I, 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 _ = /* @__PURE__ */ new Map();
for (let M = 0; M < m.length; M++) {
const I = m.get(M), D = I.key, j = _.get(D);
j ? j.push(I) : _.set(D, [I]);
}
for (const [M, I] of _) {
const D = { positions: I.map((j) => ({ x: Math.floor(j.anchorX * h1), y: Math.floor(j.anchorY * h1) })), crossTileIDs: I.map((j) => j.crossTileID) };
if (D.positions.length > 128) {
const j = new a.av(D.positions.length, 16, Uint16Array);
for (const { x: W, y: Y } of D.positions)
j.add(W, Y);
j.finish(), delete D.positions, D.index = j;
}
this._symbolsByKey[M] = D;
}
}
getScaledCoordinates(l, m) {
const { x: v, y: _, z: M } = this.tileID.canonical, { x: I, y: D, z: j } = m.canonical, W = h1 / Math.pow(2, j - M), Y = (D * a.X + l.anchorY) * W, J = _ * a.X * h1;
return { x: Math.floor((I * a.X + l.anchorX) * W - v * a.X * h1), y: Math.floor(Y - J) };
}
findMatches(l, m, v) {
const _ = 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 I = l.get(M);
if (I.crossTileID)
continue;
const D = this._symbolsByKey[I.key];
if (!D)
continue;
const j = this.getScaledCoordinates(I, m);
if (D.index) {
const W = D.index.range(j.x - _, j.y - _, j.x + _, j.y + _).sort();
for (const Y of W) {
const J = D.crossTileIDs[Y];
if (!v[J]) {
v[J] = !0, I.crossTileID = J;
break;
}
}
} else if (D.positions)
for (let W = 0; W < D.positions.length; W++) {
const Y = D.positions[W], J = D.crossTileIDs[W];
if (Math.abs(Y.x - j.x) <= _ && Math.abs(Y.y - j.y) <= _ && !v[J]) {
v[J] = !0, I.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 _ = this.indexes[v], M = {};
for (const I in _) {
const D = _[I];
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 _ = this.usedCrossTileIDs[l.overscaledZ];
for (const M in this.indexes) {
const I = this.indexes[M];
if (Number(M) > l.overscaledZ)
for (const D in I) {
const j = I[D];
j.tileID.isChildOf(l) && j.findMatches(m.symbolInstances, l, _);
}
else {
const D = I[l.scaledTo(Number(M)).key];
D && D.findMatches(m.symbolInstances, l, _);
}
}
for (let M = 0; M < m.symbolInstances.length; M++) {
const I = m.symbolInstances.get(M);
I.crossTileID || (I.crossTileID = v.generate(), _[I.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 _ of v)
delete this.usedCrossTileIDs[l][_];
}
removeStaleBuckets(l) {
let m = !1;
for (const v in this.indexes) {
const _ = this.indexes[v];
for (const M in _)
l[_[M].bucketInstanceId] || (this.removeBucketCrossTileIDs(v, _[M]), delete _[M], m = !0);
}
return m;
}
}
class b2 {
constructor() {
this.layerIndexes = {}, this.crossTileIDs = new is(), this.maxBucketInstanceId = 0, this.bucketsInCurrentPlacement = {};
}
addLayer(l, m, v) {
let _ = this.layerIndexes[l.id];
_ === void 0 && (_ = this.layerIndexes[l.id] = new d1());
let M = !1;
const I = {};
_.handleWrapJump(v);
for (const D of m) {
const j = D.getBucket(l);
j && l.id === j.layerIds[0] && (j.bucketInstanceId || (j.bucketInstanceId = ++this.maxBucketInstanceId), _.addBucket(D.tileID, j, this.crossTileIDs) && (M = !0), I[j.bucketInstanceId] = !0);
}
return _.removeStaleBuckets(I) && (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 = (E, l) => a.t(E, 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 _ = this.sourceCaches[v].getSource().type;
_ !== "vector" && _ !== "geojson" || this.sourceCaches[v].reload();
}
}, this.map = l, this.dispatcher = new de(me(), l._getMapId()), this.dispatcher.registerMessageHandler("GG", (v, _) => this.getGlyphs(v, _)), this.dispatcher.registerMessageHandler("GI", (v, _) => this.getImages(v, _)), this.imageManager = new Vt(), this.imageManager.setEventedParent(this), this.glyphManager = new Se(l._requestManager, m.localIdeographFontFamily), this.lineAtlas = new Ae(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 _ = this.sourceCaches[v.sourceId];
if (!_)
return;
const M = _.getSource();
if (M && M.vectorLayerIds)
for (const I in this._layers) {
const D = this._layers[I];
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 _ = this.map._requestManager.transformRequest(l, "Style");
this._loadStyleRequest = new AbortController();
const M = this._loadStyleRequest;
a.h(_, this._loadStyleRequest).then((I) => {
this._loadStyleRequest = null, this._load(I.data, m, v);
}).catch((I) => {
this._loadStyleRequest = null, I && !M.signal.aborted && this.fire(new a.j(I));
});
}
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 _;
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 I in M.sources)
this.addSource(I, M.sources[I], { validate: !1 });
M.sprite ? this._loadSprite(M.sprite) : this.imageManager.setLoaded(!0), this.glyphManager.setURL(M.glyphs), this._createLayers(), this.light = new ne(this.stylesheet.light), this.sky = new Ke(this.stylesheet.sky), this.map.setTerrain((_ = this.stylesheet.terrain) !== null && _ !== void 0 ? _ : 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 _;
this.imageManager.setLoaded(!1), this._spriteRequest = new AbortController(), function(M, I, D, j) {
return a._(this, void 0, void 0, function* () {
const W = tt(M), Y = D > 1 ? "@2x" : "", J = {}, ct = {};
for (const { id: ft, url: Qt } of W) {
const Lt = I.transformRequest(at(Qt, Y, ".json"), "SpriteJSON");
J[ft] = a.h(Lt, j);
const Et = I.transformRequest(at(Qt, Y, ".png"), "SpriteImage");
ct[ft] = P.getImage(Et, j);
}
return yield Promise.all([...Object.values(J), ...Object.values(ct)]), function(ft, Qt) {
return a._(this, void 0, void 0, function* () {
const Lt = {};
for (const Et in ft) {
Lt[Et] = {};
const Ht = f.getImageCanvasContext((yield Qt[Et]).data), Ct = (yield ft[Et]).data;
for (const _t in Ct) {
const { width: Nt, height: Dt, x: Wt, y: he, sdf: we, pixelRatio: De, stretchX: tr, stretchY: Oe, content: Ce, textFitWidth: ur, textFitHeight: Dr } = Ct[_t];
Lt[Et][_t] = { data: null, pixelRatio: De, sdf: we, stretchX: tr, stretchY: Oe, content: Ce, textFitWidth: ur, textFitHeight: Dr, spriteData: { width: Nt, height: Dt, x: Wt, y: he, context: Ht } };
}
}
return Lt;
});
}(J, ct);
});
}(l, this.map._requestManager, this.map.getPixelRatio(), this._spriteRequest).then((M) => {
if (this._spriteRequest = null, M)
for (const I in M) {
this._spritesImagesIds[I] = [];
const D = this._spritesImagesIds[I] ? this._spritesImagesIds[I].filter((j) => !(j in M)) : [];
for (const j of D)
this.imageManager.removeImage(j), this._changedImages[j] = !0;
for (const j in M[I]) {
const W = I === "default" ? j : `${I}:${j}`;
this._spritesImagesIds[I].push(W), W in this.imageManager.images ? this.imageManager.updateImage(W, M[I][j], !1) : this.imageManager.addImage(W, M[I][j]), m && (this._changedImages[W] = !0);
}
}
}).catch((M) => {
this._spriteRequest = null, _ = M, this.fire(new a.j(_));
}).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(_);
});
}
_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 _ = m.getSource();
(_.type === "geojson" || _.vectorLayerIds && _.vectorLayerIds.indexOf(v) === -1) && this.fire(new a.j(new Error(`Source layer "${v}" does not exist on source "${_.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 _ = [];
for (const M of l)
if (v[M]) {
const I = m ? a.aB(v[M]) : v[M];
_.push(I);
}
return _;
}
_serializedAllLayers() {
let l = this._serializedLayers;
if (l)
return l;
l = this._serializedLayers = {};
const m = Object.keys(this._layers);
for (const v of m) {
const _ = this._layers[v];
_.type !== "custom" && (l[v] = _.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 _ = Object.keys(this._updatedLayers), M = Object.keys(this._removedLayers);
(_.length || M.length) && this._updateWorkerLayers(_, M);
for (const I in this._updatedSources) {
const D = this._updatedSources[I];
if (D === "reload")
this._reloadSource(I);
else {
if (D !== "clear")
throw new Error(`Invalid action ${D}`);
this._clearSource(I);
}
}
this._updateTilesForChangedImages(), this._updateTilesForChangedGlyphs();
for (const I in this._updatedPaintProps)
this._layers[I].updateTransitions(l);
this.light.updateTransitions(l), this.sky.updateTransitions(l), this._resetUpdates();
}
const v = {};
for (const _ in this.sourceCaches) {
const M = this.sourceCaches[_];
v[_] = M.used, M.used = !1;
}
for (const _ of this._order) {
const M = this._layers[_];
M.recalculate(l, this._availableImages), !M.isHidden(l.zoom) && M.source && (this.sourceCaches[M.source].used = !0);
}
for (const _ in v) {
const M = this.sourceCaches[_];
!!v[_] != !!M.used && M.fire(new a.k("data", { sourceDataType: "visibility", dataType: "source", sourceId: _ }));
}
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 _ = this.serialize();
if (l = m.transformStyle ? m.transformStyle(_, 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(_, l), I = this._getOperationsToPerform(M);
if (I.unimplemented.length > 0)
throw new Error(`Unimplemented: ${I.unimplemented.join(", ")}.`);
if (I.operations.length === 0)
return !1;
for (const D of I.operations)
D();
return this.stylesheet = l, this._serializedLayers = null, !0;
}
_getOperationsToPerform(l) {
const m = [], v = [];
for (const _ of l)
switch (_.command) {
case "setCenter":
case "setZoom":
case "setBearing":
case "setPitch":
continue;
case "addLayer":
m.push(() => this.addLayer.apply(this, _.args));
break;
case "removeLayer":
m.push(() => this.removeLayer.apply(this, _.args));
break;
case "setPaintProperty":
m.push(() => this.setPaintProperty.apply(this, _.args));
break;
case "setLayoutProperty":
m.push(() => this.setLayoutProperty.apply(this, _.args));
break;
case "setFilter":
m.push(() => this.setFilter.apply(this, _.args));
break;
case "addSource":
m.push(() => this.addSource.apply(this, _.args));
break;
case "removeSource":
m.push(() => this.removeSource.apply(this, _.args));
break;
case "setLayerZoomRange":
m.push(() => this.setLayerZoomRange.apply(this, _.args));
break;
case "setLight":
m.push(() => this.setLight.apply(this, _.args));
break;
case "setGeoJSONSourceData":
m.push(() => this.setGeoJSONSourceData.apply(this, _.args));
break;
case "setGlyphs":
m.push(() => this.setGlyphs.apply(this, _.args));
break;
case "setSprite":
m.push(() => this.setSprite.apply(this, _.args));
break;
case "setSky":
m.push(() => this.setSky.apply(this, _.args));
break;
case "setTerrain":
m.push(() => this.map.setTerrain.apply(this, _.args));
break;
case "setTransition":
m.push(() => {
});
break;
default:
v.push(_.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 _ = this.sourceCaches[l] = new _r(l, m, this.dispatcher);
_.style = this, _.setEventedParent(this, () => ({ isSourceLoaded: _.loaded(), source: _.serialize(), sourceId: l })), _.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 _ = l.id;
if (this.getLayer(_))
return void this.fire(new a.j(new Error(`Layer "${_}" 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(_, l.source), l = a.aB(l), l = a.e(l, { source: _ })), this._validate(a.u.layer, `layers.${_}`, l, { arrayIndex: -1 }, v))
return;
M = a.aA(l), this._validateLayer(M), M.setEventedParent(this, { layer: { id: _ } });
}
const I = m ? this._order.indexOf(m) : this._order.length;
if (m && I === -1)
this.fire(new a.j(new Error(`Cannot add layer "${_}" before non-existing layer "${m}".`)));
else {
if (this._order.splice(I, 0, _), this._layerOrderChanged = !0, this._layers[_] = M, this._removedLayers[_] && M.source && M.type !== "custom") {
const D = this._removedLayers[_];
delete this._removedLayers[_], 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 _ = m ? this._order.indexOf(m) : this._order.length;
m && _ === -1 ? this.fire(new a.j(new Error(`Cannot move layer "${l}" before non-existing layer "${m}".`))) : (this._order.splice(_, 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 _ = this.getLayer(l);
_ ? _.minzoom === m && _.maxzoom === v || (m != null && (_.minzoom = m), v != null && (_.maxzoom = v), this._updateLayer(_)) : this.fire(new a.j(new Error(`Cannot set the zoom range of non-existing layer "${l}".`)));
}
setFilter(l, m, v = {}) {
this._checkLoaded();
const _ = this.getLayer(l);
if (_) {
if (!a.aE(_.filter, m))
return m == null ? (_.filter = void 0, void this._updateLayer(_)) : void (this._validate(a.u.filter, `layers.${_.id}.filter`, m, null, v) || (_.filter = a.aB(m), this._updateLayer(_)));
} 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, _ = {}) {
this._checkLoaded();
const M = this.getLayer(l);
M ? a.aE(M.getLayoutProperty(m), v) || (M.setLayoutProperty(m, v, _), 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, _ = {}) {
this._checkLoaded();
const M = this.getLayer(l);
M ? a.aE(M.getPaintProperty(m), v) || (M.setPaintProperty(m, v, _) && 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, _ = 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 I = M.getSource().type;
I === "geojson" && _ ? this.fire(new a.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))) : I !== "vector" || _ ? (l.id === void 0 && this.fire(new a.j(new Error("The feature id parameter must be provided."))), M.setFeatureState(_, 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, _ = this.sourceCaches[v];
if (_ === void 0)
return void this.fire(new a.j(new Error(`The source '${v}' does not exist in the map's style.`)));
const M = _.getSource().type, I = M === "vector" ? l.sourceLayer : void 0;
M !== "vector" || I ? 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."))) : _.removeFeatureState(I, 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, _ = this.sourceCaches[m];
if (_ !== void 0)
return _.getSource().type !== "vector" || v ? (l.id === void 0 && this.fire(new a.j(new Error("The feature id parameter must be provided."))), _.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, _ = this.stylesheet;
return a.aG({ version: _.version, name: _.name, metadata: _.metadata, light: _.light, sky: _.sky, center: _.center, zoom: _.zoom, bearing: _.bearing, pitch: _.pitch, sprite: _.sprite, glyphs: _.glyphs, transition: _.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 = (I) => this._layers[I].type === "fill-extrusion", v = {}, _ = [];
for (let I = this._order.length - 1; I >= 0; I--) {
const D = this._order[I];
if (m(D)) {
v[D] = I;
for (const j of l) {
const W = j[D];
if (W)
for (const Y of W)
_.push(Y);
}
}
}
_.sort((I, D) => D.intersectionZ - I.intersectionZ);
const M = [];
for (let I = this._order.length - 1; I >= 0; I--) {
const D = this._order[I];
if (m(D))
for (let j = _.length - 1; j >= 0; j--) {
const W = _[j].feature;
if (v[W.layer.id] < I)
break;
M.push(W), _.pop();
}
else
for (const j of l) {
const W = j[D];
if (W)
for (const Y of W)
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 _ = {};
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.`))), [];
_[j.source] = !0;
}
}
const M = [];
m.availableImages = this._availableImages;
const I = this._serializedAllLayers();
for (const D in this.sourceCaches)
m.layers && !_[D] || M.push(qe(this.sourceCaches[D], this._layers, I, l, m, v));
return this.placement && M.push(function(D, j, W, Y, J, ct, ft) {
const Qt = {}, Lt = ct.queryRenderedSymbols(Y), Et = [];
for (const Ht of Object.keys(Lt).map(Number))
Et.push(ft[Ht]);
Et.sort($e);
for (const Ht of Et) {
const Ct = Ht.featureIndex.lookupSymbolFeatures(Lt[Ht.bucketInstanceId], j, Ht.bucketIndex, Ht.sourceLayerIndex, J.filter, J.layers, J.availableImages, D);
for (const _t in Ct) {
const Nt = Qt[_t] = Qt[_t] || [], Dt = Ct[_t];
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((Ct) => {
const _t = Ct.feature, Nt = W[D[Ht].source].getFeatureState(_t.layer["source-layer"], _t.id);
_t.source = _t.layer.source, _t.layer["source-layer"] && (_t.sourceLayer = _t.layer["source-layer"]), _t.state = Nt;
});
return Qt;
}(this._layers, I, 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(_, M) {
const I = _.getRenderableIds().map((W) => _.getTileByID(W)), D = [], j = {};
for (let W = 0; W < I.length; W++) {
const Y = I[W], 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 _ = !1;
for (const I in l)
if (!a.aE(l[I], v[I])) {
_ = !0;
break;
}
if (!_)
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 _ = !1;
if (!l && !v)
return;
if (l && !v)
_ = !0;
else if (!l && v)
_ = !0;
else
for (const I in l)
if (!a.aE(l[I], v[I])) {
_ = !0;
break;
}
if (!_)
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, _, M = {}) {
return (!M || M.validate !== !1) && e1(this, l.call(a.u, a.e({ key: m, style: this.serialize(), value: v, styleSpec: a.v }, _)));
}
_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, _, M = !1) {
let I = !1, D = !1;
const j = {};
for (const W of this._order) {
const Y = this._layers[W];
if (Y.type !== "symbol")
continue;
if (!j[Y.source]) {
const ct = this.sourceCaches[Y.source];
j[Y.source] = ct.getRenderableIds(!0).map((ft) => ct.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);
I = I || 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, _, 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), I && this.pauseablePlacement.placement.setStale()), D || I)
for (const W of this._order) {
const Y = this._layers[W];
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 _ = this.sourceCaches[m.source];
return _ && _.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), _ = this.sourceCaches[m.source];
return _ && _.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 = {}, _) {
this._checkLoaded();
const M = [{ id: l, url: m }], I = [...tt(this.stylesheet.sprite), ...M];
this._validate(a.u.sprite, "sprite", I, null, v) || (this.stylesheet.sprite = I, this._loadSprite(M, !0, _));
}
removeSprite(l) {
this._checkLoaded();
const m = tt(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 tt(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(E, l) {
const m = /#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g, v = l.match(/attribute ([\w]+) ([\w]+)/g), _ = E.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), M = l.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), I = M ? M.concat(_) : _, D = {};
return { fragmentSource: E = E.replace(m, (j, W, Y, J, ct) => (D[ct] = !0, W === "define" ? `
#ifndef HAS_UNIFORM_u_${ct}
varying ${Y} ${J} ${ct};
#else
uniform ${Y} ${J} u_${ct};
#endif
` : `
#ifdef HAS_UNIFORM_u_${ct}
${Y} ${J} ${ct} = u_${ct};
#endif
`)), vertexSource: l = l.replace(m, (j, W, Y, J, ct) => {
const ft = J === "float" ? "vec2" : "vec4", Qt = ct.match(/color/) ? "color" : ft;
return D[ct] ? W === "define" ? `
#ifndef HAS_UNIFORM_u_${ct}
uniform lowp float u_${ct}_t;
attribute ${Y} ${ft} a_${ct};
varying ${Y} ${J} ${ct};
#else
uniform ${Y} ${J} u_${ct};
#endif
` : Qt === "vec4" ? `
#ifndef HAS_UNIFORM_u_${ct}
${ct} = a_${ct};
#else
${Y} ${J} ${ct} = u_${ct};
#endif
` : `
#ifndef HAS_UNIFORM_u_${ct}
${ct} = unpack_mix_${Qt}(a_${ct}, u_${ct}_t);
#else
${Y} ${J} ${ct} = u_${ct};
#endif
` : W === "define" ? `
#ifndef HAS_UNIFORM_u_${ct}
uniform lowp float u_${ct}_t;
attribute ${Y} ${ft} a_${ct};
#else
uniform ${Y} ${J} u_${ct};
#endif
` : Qt === "vec4" ? `
#ifndef HAS_UNIFORM_u_${ct}
${Y} ${J} ${ct} = a_${ct};
#else
${Y} ${J} ${ct} = u_${ct};
#endif
` : `
#ifndef HAS_UNIFORM_u_${ct}
${Y} ${J} ${ct} = unpack_mix_${Qt}(a_${ct}, u_${ct}_t);
#else
${Y} ${J} ${ct} = u_${ct};
#endif
`;
}), staticAttributes: v, staticUniforms: I };
}
class k {
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, _, M, I, D, j, W) {
this.context = l;
let Y = this.boundPaintVertexBuffers.length !== _.length;
for (let J = 0; !Y && J < _.length; J++)
this.boundPaintVertexBuffers[J] !== _[J] && (Y = !0);
!this.vao || this.boundProgram !== m || this.boundLayoutVertexBuffer !== v || Y || this.boundIndexBuffer !== M || this.boundVertexOffset !== I || this.boundDynamicVertexBuffer !== D || this.boundDynamicVertexBuffer2 !== j || this.boundDynamicVertexBuffer3 !== W ? this.freshBind(m, v, _, M, I, D, j, W) : (l.bindVertexArray.set(this.vao), D && D.bind(), M && M.dynamicDraw && M.bind(), j && j.bind(), W && W.bind());
}
freshBind(l, m, v, _, M, I, D, j) {
const W = 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 = _, this.boundVertexOffset = M, this.boundDynamicVertexBuffer = I, this.boundDynamicVertexBuffer2 = D, this.boundDynamicVertexBuffer3 = j, m.enableAttributes(J, l);
for (const ct of v)
ct.enableAttributes(J, l);
I && I.enableAttributes(J, l), D && D.enableAttributes(J, l), j && j.enableAttributes(J, l), m.bind(), m.setVertexAttribPointers(J, l, M);
for (const ct of v)
ct.bind(), ct.setVertexAttribPointers(J, l, M);
I && (I.bind(), I.setVertexAttribPointers(J, l, M)), _ && _.bind(), D && (D.bind(), D.setVertexAttribPointers(J, l, M)), j && (j.bind(), j.setVertexAttribPointers(J, l, M)), Y.currentNumAttributes = W;
}
destroy() {
this.vao && (this.context.deleteVertexArray(this.vao), this.vao = null);
}
}
const G = (E, l, m, v, _) => ({ u_matrix: E, 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(_) : 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(E) {
const l = [];
for (let m = 0; m < E.length; m++) {
if (E[m] === null)
continue;
const v = E[m].split(" ");
l.push(v.pop());
}
return l;
}
class q {
constructor(l, m, v, _, M, I) {
const D = l.gl;
this.program = D.createProgram();
const j = B(m.staticAttributes), W = v ? v.getBinderAttributes() : [], Y = j.concat(W), J = ho.prelude.staticUniforms ? B(ho.prelude.staticUniforms) : [], ct = m.staticUniforms ? B(m.staticUniforms) : [], ft = v ? v.getBinderUniforms() : [], Qt = J.concat(ct).concat(ft), Lt = [];
for (const Wt of Qt)
Lt.indexOf(Wt) < 0 && Lt.push(Wt);
const Et = v ? v.defines() : [];
M && Et.push("#define OVERDRAW_INSPECTOR;"), I && Et.push("#define TERRAIN3D;");
const Ht = Et.concat(ho.prelude.fragmentSource, m.fragmentSource).join(`
`), Ct = Et.concat(ho.prelude.vertexSource, m.vertexSource).join(`
`), _t = D.createShader(D.FRAGMENT_SHADER);
if (D.isContextLost())
return void (this.failedToCreate = !0);
if (D.shaderSource(_t, Ht), D.compileShader(_t), !D.getShaderParameter(_t, D.COMPILE_STATUS))
throw new Error(`Could not compile fragment shader: ${D.getShaderInfoLog(_t)}`);
D.attachShader(this.program, _t);
const Nt = D.createShader(D.VERTEX_SHADER);
if (D.isContextLost())
return void (this.failedToCreate = !0);
if (D.shaderSource(Nt, Ct), 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(_t);
for (let Wt = 0; Wt < Lt.length; Wt++) {
const he = Lt[Wt];
if (he && !Dt[he]) {
const we = D.getUniformLocation(this.program, he);
we && (Dt[he] = we);
}
}
this.fixedUniforms = _(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, _, M, I, D, j, W, Y, J, ct, ft, Qt, Lt, Et, Ht, Ct) {
const _t = l.gl;
if (this.failedToCreate)
return;
if (l.program.set(this.program), l.setDepthMode(v), l.setStencilMode(_), l.setColorMode(M), l.setCullFace(I), j) {
l.activeTexture.set(_t.TEXTURE2), _t.bindTexture(_t.TEXTURE_2D, j.depthTexture), l.activeTexture.set(_t.TEXTURE3), _t.bindTexture(_t.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]);
Lt && Lt.setUniforms(l, this.binderUniforms, ft, { zoom: Qt });
let Nt = 0;
switch (m) {
case _t.LINES:
Nt = 2;
break;
case _t.TRIANGLES:
Nt = 3;
break;
case _t.LINE_STRIP:
Nt = 1;
}
for (const Dt of ct.get()) {
const Wt = Dt.vaos || (Dt.vaos = {});
(Wt[W] || (Wt[W] = new k())).bind(l, this, Y, Lt ? Lt.getPaintVertexBuffers() : [], J, Dt.vertexOffset, Et, Ht, Ct), _t.drawElements(m, Dt.primitiveLength * Nt, _t.UNSIGNED_SHORT, Dt.primitiveOffset * Nt * 2);
}
}
}
function nt(E, l, m) {
const v = 1 / Hr(m, 1, l.transform.tileZoom), _ = Math.pow(2, m.tileID.overscaledZ), M = m.tileSize * Math.pow(2, l.transform.tileZoom) / _, I = M * (m.tileID.canonical.x + m.tileID.wrap * _), D = M * m.tileID.canonical.y;
return { u_image: 0, u_texsize: m.imageAtlasTexture.size, u_scale: [v, E.fromScale, E.toScale], u_fade: E.t, u_pixel_coord_upper: [I >> 16, D >> 16], u_pixel_coord_lower: [65535 & I, 65535 & D] };
}
const ht = (E, l, m, v) => {
const _ = l.style.light, M = _.properties.get("position"), I = [M.x, M.y, M.z], D = function() {
var W = new a.A(9);
return a.A != Float32Array && (W[1] = 0, W[2] = 0, W[3] = 0, W[5] = 0, W[6] = 0, W[7] = 0), W[0] = 1, W[4] = 1, W[8] = 1, W;
}();
_.properties.get("anchor") === "viewport" && function(W, Y) {
var J = Math.sin(Y), ct = Math.cos(Y);
W[0] = ct, W[1] = J, W[2] = 0, W[3] = -J, W[4] = ct, W[5] = 0, W[6] = 0, W[7] = 0, W[8] = 1;
}(D, -l.transform.angle), function(W, Y, J) {
var ct = Y[0], ft = Y[1], Qt = Y[2];
W[0] = ct * J[0] + ft * J[3] + Qt * J[6], W[1] = ct * J[1] + ft * J[4] + Qt * J[7], W[2] = ct * J[2] + ft * J[5] + Qt * J[8];
}(I, I, D);
const j = _.properties.get("color");
return { u_matrix: E, u_lightpos: I, u_lightintensity: _.properties.get("intensity"), u_lightcolor: [j.r, j.g, j.b], u_vertical_gradient: +m, u_opacity: v };
}, mt = (E, l, m, v, _, M, I) => a.e(ht(E, l, m, v), nt(M, l, I), { u_height_factor: -Math.pow(2, _.overscaledZ) / I.tileSize / 8 }), qt = (E) => ({ u_matrix: E }), ae = (E, l, m, v) => a.e(qt(E), nt(m, l, v)), ve = (E, l) => ({ u_matrix: E, u_world: l }), Ee = (E, l, m, v, _) => a.e(ae(E, l, m, v), { u_world: _ }), be = (E, l, m, v) => {
const _ = E.transform;
let M, I;
if (v.paint.get("circle-pitch-alignment") === "map") {
const D = Hr(m, 1, _.zoom);
M = !0, I = [D, D];
} else
M = !1, I = _.pixelsToGLUnits;
return { u_camera_to_center_distance: _.cameraToCenterDistance, u_scale_with_map: +(v.paint.get("circle-pitch-scale") === "map"), u_matrix: E.translatePosMatrix(l.posMatrix, m, v.paint.get("circle-translate"), v.paint.get("circle-translate-anchor")), u_pitch_with_map: +M, u_device_pixel_ratio: E.pixelRatio, u_extrude_scale: I };
}, fr = (E, l, m) => ({ u_matrix: E, u_inv_matrix: l, u_camera_to_center_distance: m.cameraToCenterDistance, u_viewport_size: [m.width, m.height] }), Pn = (E, l, m = 1) => ({ u_matrix: E, u_color: l, u_overlay: 0, u_overlay_scale: m }), wr = (E) => ({ u_matrix: E }), un = (E, l, m, v) => ({ u_matrix: E, u_extrude_scale: Hr(l, 1, m), u_intensity: v }), pe = (E, l, m, v) => {
const _ = a.H();
a.aP(_, 0, E.width, E.height, 0, 0, 1);
const M = E.context.gl;
return { u_matrix: _, u_world: [M.drawingBufferWidth, M.drawingBufferHeight], u_image: m, u_color_ramp: v, u_opacity: l.paint.get("heatmap-opacity") };
};
function dr(E, 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 = (E, l, m, v) => {
const _ = E.transform;
return { u_matrix: Nn(E, l, m, v), u_ratio: 1 / Hr(l, 1, _.zoom), u_device_pixel_ratio: E.pixelRatio, u_units_to_pixels: [1 / _.pixelsToGLUnits[0], 1 / _.pixelsToGLUnits[1]] };
}, Ni = (E, l, m, v, _) => a.e(Tn(E, l, m, _), { u_image: 0, u_image_height: v }), zn = (E, l, m, v, _) => {
const M = E.transform, I = _l(l, M);
return { u_matrix: Nn(E, l, m, _), u_texsize: l.imageAtlasTexture.size, u_ratio: 1 / Hr(l, 1, M.zoom), u_device_pixel_ratio: E.pixelRatio, u_image: 0, u_scale: [I, v.fromScale, v.toScale], u_fade: v.t, u_units_to_pixels: [1 / M.pixelsToGLUnits[0], 1 / M.pixelsToGLUnits[1]] };
}, b0 = (E, l, m, v, _, M) => {
const I = E.lineAtlas, D = _l(l, E.transform), j = m.layout.get("line-cap") === "round", W = I.getDash(v.from, j), Y = I.getDash(v.to, j), J = W.width * _.fromScale, ct = Y.width * _.toScale;
return a.e(Tn(E, l, m, M), { u_patternscale_a: [D / J, -W.height / 2], u_patternscale_b: [D / ct, -Y.height / 2], u_sdfgamma: I.width / (256 * Math.min(J, ct) * E.pixelRatio) / 2, u_image: 0, u_tex_y_a: W.y, u_tex_y_b: Y.y, u_mix: _.t });
};
function _l(E, l) {
return 1 / Hr(E, 1, l.tileZoom);
}
function Nn(E, l, m, v) {
return E.translatePosMatrix(v ? v.posMatrix : l.tileID.posMatrix, l, m.paint.get("line-translate"), m.paint.get("line-translate-anchor"));
}
const bl = (E, l, m, v, _) => {
return { u_matrix: E, u_tl_parent: l, u_scale_parent: m, u_buffer_scale: 1, u_fade_t: v.mix, u_opacity: v.opacity * _.paint.get("raster-opacity"), u_image0: 0, u_image1: 1, u_brightness_low: _.paint.get("raster-brightness-min"), u_brightness_high: _.paint.get("raster-brightness-max"), u_saturation_factor: (I = _.paint.get("raster-saturation"), I > 0 ? 1 - 1 / (1.001 - I) : -I), u_contrast_factor: (M = _.paint.get("raster-contrast"), M > 0 ? 1 / (1 - M) : 1 + M), u_spin_weights: vc(_.paint.get("raster-hue-rotate")) };
var M, I;
};
function vc(E) {
E *= Math.PI / 180;
const l = Math.sin(E), m = Math.cos(E);
return [(2 * m + 1) / 3, (-Math.sqrt(3) * l - m + 1) / 3, (Math.sqrt(3) * l - m + 1) / 3];
}
const Ko = (E, l, m, v, _, M, I, D, j, W, Y, J, ct, ft) => {
const Qt = I.transform;
return { u_is_size_zoom_constant: +(E === "constant" || E === "source"), u_is_size_feature_constant: +(E === "constant" || E === "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: I.options.fadeDuration ? I.symbolFadeChange : 1, u_matrix: D, u_label_plane_matrix: j, u_coord_matrix: W, u_is_text: +J, u_pitch_with_map: +v, u_is_along_line: _, u_is_variable_anchor: M, u_texsize: ct, u_texture: 0, u_translation: Y, u_pitched_scale: ft };
}, ga = (E, l, m, v, _, M, I, D, j, W, Y, J, ct, ft, Qt) => {
const Lt = I.transform;
return a.e(Ko(E, l, m, v, _, M, I, D, j, W, Y, J, ct, Qt), { u_gamma_scale: v ? Math.cos(Lt._pitch) * Lt.cameraToCenterDistance : 1, u_device_pixel_ratio: I.pixelRatio, u_is_halo: +ft });
}, D4 = (E, l, m, v, _, M, I, D, j, W, Y, J, ct, ft) => a.e(ga(E, l, m, v, _, M, I, D, j, W, Y, !0, J, !0, ft), { u_texsize_icon: ct, u_texture_icon: 1 }), A3 = (E, l, m) => ({ u_matrix: E, u_opacity: l, u_color: m }), C3 = (E, l, m, v, _, M) => a.e(function(I, D, j, W) {
const Y = j.imageManager.getPattern(I.from.toString()), J = j.imageManager.getPattern(I.to.toString()), { width: ct, height: ft } = j.imageManager.getPixelSize(), Qt = Math.pow(2, W.tileID.overscaledZ), Lt = W.tileSize * Math.pow(2, j.transform.tileZoom) / Qt, Et = Lt * (W.tileID.canonical.x + W.tileID.wrap * Qt), Ht = Lt * W.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: [ct, 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 / Hr(W, 1, j.transform.tileZoom), u_pixel_coord_upper: [Et >> 16, Ht >> 16], u_pixel_coord_lower: [65535 & Et, 65535 & Ht] };
}(v, M, m, _), { u_matrix: E, u_opacity: l }), F4 = { fillExtrusion: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_lightpos: new a.aN(E, l.u_lightpos), u_lightintensity: new a.aI(E, l.u_lightintensity), u_lightcolor: new a.aN(E, l.u_lightcolor), u_vertical_gradient: new a.aI(E, l.u_vertical_gradient), u_opacity: new a.aI(E, l.u_opacity) }), fillExtrusionPattern: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_lightpos: new a.aN(E, l.u_lightpos), u_lightintensity: new a.aI(E, l.u_lightintensity), u_lightcolor: new a.aN(E, l.u_lightcolor), u_vertical_gradient: new a.aI(E, l.u_vertical_gradient), u_height_factor: new a.aI(E, l.u_height_factor), u_image: new a.aH(E, l.u_image), u_texsize: new a.aO(E, l.u_texsize), u_pixel_coord_upper: new a.aO(E, l.u_pixel_coord_upper), u_pixel_coord_lower: new a.aO(E, l.u_pixel_coord_lower), u_scale: new a.aN(E, l.u_scale), u_fade: new a.aI(E, l.u_fade), u_opacity: new a.aI(E, l.u_opacity) }), fill: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix) }), fillPattern: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_image: new a.aH(E, l.u_image), u_texsize: new a.aO(E, l.u_texsize), u_pixel_coord_upper: new a.aO(E, l.u_pixel_coord_upper), u_pixel_coord_lower: new a.aO(E, l.u_pixel_coord_lower), u_scale: new a.aN(E, l.u_scale), u_fade: new a.aI(E, l.u_fade) }), fillOutline: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_world: new a.aO(E, l.u_world) }), fillOutlinePattern: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_world: new a.aO(E, l.u_world), u_image: new a.aH(E, l.u_image), u_texsize: new a.aO(E, l.u_texsize), u_pixel_coord_upper: new a.aO(E, l.u_pixel_coord_upper), u_pixel_coord_lower: new a.aO(E, l.u_pixel_coord_lower), u_scale: new a.aN(E, l.u_scale), u_fade: new a.aI(E, l.u_fade) }), circle: (E, l) => ({ u_camera_to_center_distance: new a.aI(E, l.u_camera_to_center_distance), u_scale_with_map: new a.aH(E, l.u_scale_with_map), u_pitch_with_map: new a.aH(E, l.u_pitch_with_map), u_extrude_scale: new a.aO(E, l.u_extrude_scale), u_device_pixel_ratio: new a.aI(E, l.u_device_pixel_ratio), u_matrix: new a.aJ(E, l.u_matrix) }), collisionBox: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_pixel_extrude_scale: new a.aO(E, l.u_pixel_extrude_scale) }), collisionCircle: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_inv_matrix: new a.aJ(E, l.u_inv_matrix), u_camera_to_center_distance: new a.aI(E, l.u_camera_to_center_distance), u_viewport_size: new a.aO(E, l.u_viewport_size) }), debug: (E, l) => ({ u_color: new a.aL(E, l.u_color), u_matrix: new a.aJ(E, l.u_matrix), u_overlay: new a.aH(E, l.u_overlay), u_overlay_scale: new a.aI(E, l.u_overlay_scale) }), clippingMask: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix) }), heatmap: (E, l) => ({ u_extrude_scale: new a.aI(E, l.u_extrude_scale), u_intensity: new a.aI(E, l.u_intensity), u_matrix: new a.aJ(E, l.u_matrix) }), heatmapTexture: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_world: new a.aO(E, l.u_world), u_image: new a.aH(E, l.u_image), u_color_ramp: new a.aH(E, l.u_color_ramp), u_opacity: new a.aI(E, l.u_opacity) }), hillshade: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_image: new a.aH(E, l.u_image), u_latrange: new a.aO(E, l.u_latrange), u_light: new a.aO(E, l.u_light), u_shadow: new a.aL(E, l.u_shadow), u_highlight: new a.aL(E, l.u_highlight), u_accent: new a.aL(E, l.u_accent) }), hillshadePrepare: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_image: new a.aH(E, l.u_image), u_dimension: new a.aO(E, l.u_dimension), u_zoom: new a.aI(E, l.u_zoom), u_unpack: new a.aK(E, l.u_unpack) }), line: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_ratio: new a.aI(E, l.u_ratio), u_device_pixel_ratio: new a.aI(E, l.u_device_pixel_ratio), u_units_to_pixels: new a.aO(E, l.u_units_to_pixels) }), lineGradient: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_ratio: new a.aI(E, l.u_ratio), u_device_pixel_ratio: new a.aI(E, l.u_device_pixel_ratio), u_units_to_pixels: new a.aO(E, l.u_units_to_pixels), u_image: new a.aH(E, l.u_image), u_image_height: new a.aI(E, l.u_image_height) }), linePattern: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_texsize: new a.aO(E, l.u_texsize), u_ratio: new a.aI(E, l.u_ratio), u_device_pixel_ratio: new a.aI(E, l.u_device_pixel_ratio), u_image: new a.aH(E, l.u_image), u_units_to_pixels: new a.aO(E, l.u_units_to_pixels), u_scale: new a.aN(E, l.u_scale), u_fade: new a.aI(E, l.u_fade) }), lineSDF: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_ratio: new a.aI(E, l.u_ratio), u_device_pixel_ratio: new a.aI(E, l.u_device_pixel_ratio), u_units_to_pixels: new a.aO(E, l.u_units_to_pixels), u_patternscale_a: new a.aO(E, l.u_patternscale_a), u_patternscale_b: new a.aO(E, l.u_patternscale_b), u_sdfgamma: new a.aI(E, l.u_sdfgamma), u_image: new a.aH(E, l.u_image), u_tex_y_a: new a.aI(E, l.u_tex_y_a), u_tex_y_b: new a.aI(E, l.u_tex_y_b), u_mix: new a.aI(E, l.u_mix) }), raster: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_tl_parent: new a.aO(E, l.u_tl_parent), u_scale_parent: new a.aI(E, l.u_scale_parent), u_buffer_scale: new a.aI(E, l.u_buffer_scale), u_fade_t: new a.aI(E, l.u_fade_t), u_opacity: new a.aI(E, l.u_opacity), u_image0: new a.aH(E, l.u_image0), u_image1: new a.aH(E, l.u_image1), u_brightness_low: new a.aI(E, l.u_brightness_low), u_brightness_high: new a.aI(E, l.u_brightness_high), u_saturation_factor: new a.aI(E, l.u_saturation_factor), u_contrast_factor: new a.aI(E, l.u_contrast_factor), u_spin_weights: new a.aN(E, l.u_spin_weights) }), symbolIcon: (E, l) => ({ u_is_size_zoom_constant: new a.aH(E, l.u_is_size_zoom_constant), u_is_size_feature_constant: new a.aH(E, l.u_is_size_feature_constant), u_size_t: new a.aI(E, l.u_size_t), u_size: new a.aI(E, l.u_size), u_camera_to_center_distance: new a.aI(E, l.u_camera_to_center_distance), u_pitch: new a.aI(E, l.u_pitch), u_rotate_symbol: new a.aH(E, l.u_rotate_symbol), u_aspect_ratio: new a.aI(E, l.u_aspect_ratio), u_fade_change: new a.aI(E, l.u_fade_change), u_matrix: new a.aJ(E, l.u_matrix), u_label_plane_matrix: new a.aJ(E, l.u_label_plane_matrix), u_coord_matrix: new a.aJ(E, l.u_coord_matrix), u_is_text: new a.aH(E, l.u_is_text), u_pitch_with_map: new a.aH(E, l.u_pitch_with_map), u_is_along_line: new a.aH(E, l.u_is_along_line), u_is_variable_anchor: new a.aH(E, l.u_is_variable_anchor), u_texsize: new a.aO(E, l.u_texsize), u_texture: new a.aH(E, l.u_texture), u_translation: new a.aO(E, l.u_translation), u_pitched_scale: new a.aI(E, l.u_pitched_scale) }), symbolSDF: (E, l) => ({ u_is_size_zoom_constant: new a.aH(E, l.u_is_size_zoom_constant), u_is_size_feature_constant: new a.aH(E, l.u_is_size_feature_constant), u_size_t: new a.aI(E, l.u_size_t), u_size: new a.aI(E, l.u_size), u_camera_to_center_distance: new a.aI(E, l.u_camera_to_center_distance), u_pitch: new a.aI(E, l.u_pitch), u_rotate_symbol: new a.aH(E, l.u_rotate_symbol), u_aspect_ratio: new a.aI(E, l.u_aspect_ratio), u_fade_change: new a.aI(E, l.u_fade_change), u_matrix: new a.aJ(E, l.u_matrix), u_label_plane_matrix: new a.aJ(E, l.u_label_plane_matrix), u_coord_matrix: new a.aJ(E, l.u_coord_matrix), u_is_text: new a.aH(E, l.u_is_text), u_pitch_with_map: new a.aH(E, l.u_pitch_with_map), u_is_along_line: new a.aH(E, l.u_is_along_line), u_is_variable_anchor: new a.aH(E, l.u_is_variable_anchor), u_texsize: new a.aO(E, l.u_texsize), u_texture: new a.aH(E, l.u_texture), u_gamma_scale: new a.aI(E, l.u_gamma_scale), u_device_pixel_ratio: new a.aI(E, l.u_device_pixel_ratio), u_is_halo: new a.aH(E, l.u_is_halo), u_translation: new a.aO(E, l.u_translation), u_pitched_scale: new a.aI(E, l.u_pitched_scale) }), symbolTextAndIcon: (E, l) => ({ u_is_size_zoom_constant: new a.aH(E, l.u_is_size_zoom_constant), u_is_size_feature_constant: new a.aH(E, l.u_is_size_feature_constant), u_size_t: new a.aI(E, l.u_size_t), u_size: new a.aI(E, l.u_size), u_camera_to_center_distance: new a.aI(E, l.u_camera_to_center_distance), u_pitch: new a.aI(E, l.u_pitch), u_rotate_symbol: new a.aH(E, l.u_rotate_symbol), u_aspect_ratio: new a.aI(E, l.u_aspect_ratio), u_fade_change: new a.aI(E, l.u_fade_change), u_matrix: new a.aJ(E, l.u_matrix), u_label_plane_matrix: new a.aJ(E, l.u_label_plane_matrix), u_coord_matrix: new a.aJ(E, l.u_coord_matrix), u_is_text: new a.aH(E, l.u_is_text), u_pitch_with_map: new a.aH(E, l.u_pitch_with_map), u_is_along_line: new a.aH(E, l.u_is_along_line), u_is_variable_anchor: new a.aH(E, l.u_is_variable_anchor), u_texsize: new a.aO(E, l.u_texsize), u_texsize_icon: new a.aO(E, l.u_texsize_icon), u_texture: new a.aH(E, l.u_texture), u_texture_icon: new a.aH(E, l.u_texture_icon), u_gamma_scale: new a.aI(E, l.u_gamma_scale), u_device_pixel_ratio: new a.aI(E, l.u_device_pixel_ratio), u_is_halo: new a.aH(E, l.u_is_halo), u_translation: new a.aO(E, l.u_translation), u_pitched_scale: new a.aI(E, l.u_pitched_scale) }), background: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_opacity: new a.aI(E, l.u_opacity), u_color: new a.aL(E, l.u_color) }), backgroundPattern: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_opacity: new a.aI(E, l.u_opacity), u_image: new a.aH(E, l.u_image), u_pattern_tl_a: new a.aO(E, l.u_pattern_tl_a), u_pattern_br_a: new a.aO(E, l.u_pattern_br_a), u_pattern_tl_b: new a.aO(E, l.u_pattern_tl_b), u_pattern_br_b: new a.aO(E, l.u_pattern_br_b), u_texsize: new a.aO(E, l.u_texsize), u_mix: new a.aI(E, l.u_mix), u_pattern_size_a: new a.aO(E, l.u_pattern_size_a), u_pattern_size_b: new a.aO(E, l.u_pattern_size_b), u_scale_a: new a.aI(E, l.u_scale_a), u_scale_b: new a.aI(E, l.u_scale_b), u_pixel_coord_upper: new a.aO(E, l.u_pixel_coord_upper), u_pixel_coord_lower: new a.aO(E, l.u_pixel_coord_lower), u_tile_units_to_pixels: new a.aI(E, l.u_tile_units_to_pixels) }), terrain: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_texture: new a.aH(E, l.u_texture), u_ele_delta: new a.aI(E, l.u_ele_delta), u_fog_matrix: new a.aJ(E, l.u_fog_matrix), u_fog_color: new a.aL(E, l.u_fog_color), u_fog_ground_blend: new a.aI(E, l.u_fog_ground_blend), u_fog_ground_blend_opacity: new a.aI(E, l.u_fog_ground_blend_opacity), u_horizon_color: new a.aL(E, l.u_horizon_color), u_horizon_fog_blend: new a.aI(E, l.u_horizon_fog_blend) }), terrainDepth: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_ele_delta: new a.aI(E, l.u_ele_delta) }), terrainCoords: (E, l) => ({ u_matrix: new a.aJ(E, l.u_matrix), u_texture: new a.aH(E, l.u_texture), u_terrain_coords_id: new a.aI(E, l.u_terrain_coords_id), u_ele_delta: new a.aI(E, l.u_ele_delta) }), sky: (E, l) => ({ u_sky_color: new a.aL(E, l.u_sky_color), u_horizon_color: new a.aL(E, l.u_horizon_color), u_horizon: new a.aI(E, l.u_horizon), u_sky_horizon_blend: new a.aI(E, l.u_sky_horizon_blend) }) };
class Ao {
constructor(l, m, v) {
this.context = l;
const _ = l.gl;
this.buffer = _.createBuffer(), this.dynamicDraw = !!v, this.context.unbindVAO(), l.bindElementBuffer.set(this.buffer), _.bufferData(_.ELEMENT_ARRAY_BUFFER, m.arrayBuffer, this.dynamicDraw ? _.DYNAMIC_DRAW : _.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, _) {
this.length = m.length, this.attributes = v, this.itemSize = m.bytesPerElement, this.dynamicDraw = _, 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 _ = m.attributes[this.attributes[v].name];
_ !== void 0 && l.enableVertexAttribArray(_);
}
}
setVertexAttribPointers(l, m, v) {
for (let _ = 0; _ < this.attributes.length; _++) {
const M = this.attributes[_], I = m.attributes[M.name];
I !== void 0 && l.vertexAttribPointer(I, 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(E) {
var l;
if (Bs.has(E))
return Bs.get(E);
{
const m = (l = E.getParameter(E.VERSION)) === null || l === void 0 ? void 0 : l.startsWith("WebGL 2.0");
return Bs.set(E, 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 O3 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 Co 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 P3 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 M0 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 E0 extends hn {
getDefault() {
return null;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.useProgram(l), this.current = l, this.dirty = !1);
}
}
class k3 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 Z4 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 W4 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 M2 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, _, M) {
this.context = l, this.width = m, this.height = v;
const I = l.gl, D = this.framebuffer = I.createFramebuffer();
if (this.colorAttachment = new x2(l, D), _)
this.depthAttachment = M ? new M2(l, D) : new v1(l, D);
else if (M)
throw new Error("Stencil cannot be set without depth");
if (I.checkFramebufferStatus(I.FRAMEBUFFER) !== I.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 En {
constructor(l, m, v) {
this.blendFunction = l, this.blendColor = m, this.mask = v;
}
}
En.Replace = [1, 0], En.disabled = new En(En.Replace, a.aM.transparent, [!1, !1, !1, !1]), En.unblended = new En(En.Replace, a.aM.transparent, [!0, !0, !0, !0]), En.alphaBlended = new En([1, 771], a.aM.transparent, [!0, !0, !0, !0]);
class xc {
constructor(l) {
var m, v;
if (this.gl = l, this.clearColor = new O3(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 Co(this), this.stencilOp = new z4(this), this.stencilTest = new w0(this), this.depthRange = new wl(this), this.depthTest = new x0(this), this.depthFunc = new P3(this), this.blend = new os(this), this.blendFunc = new M0(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 E0(this), this.activeTexture = new k3(this), this.viewport = new G4(this), this.bindFramebuffer = new $4(this), this.bindRenderbuffer = new Z4(this), this.bindTexture = new js(this), this.bindVertexBuffer = new xl(this), this.bindElementBuffer = new W4(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 _ = l.getExtension("EXT_color_buffer_half_float");
this.RGBA16F = (m = l.RGBA16F) !== null && m !== void 0 ? m : _ == null ? void 0 : _.RGBA16F_EXT, this.RGB16F = (v = l.RGB16F) !== null && v !== void 0 ? v : _ == null ? void 0 : _.RGB16F_EXT, l.getExtension("EXT_color_buffer_float");
} else {
l.getExtension("EXT_color_buffer_half_float"), l.getExtension("OES_texture_half_float_linear");
const _ = l.getExtension("OES_texture_half_float");
this.HALF_FLOAT = _ == null ? void 0 : _.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 _ = this.gl, M = _.createRenderbuffer();
return this.bindRenderbuffer.set(M), _.renderbufferStorage(_.RENDERBUFFER, l, m, v), this.bindRenderbuffer.set(null), M;
}
createFramebuffer(l, m, v, _) {
return new X4(this, l, m, v, _);
}
clear({ color: l, depth: m, stencil: v }) {
const _ = this.gl;
let M = 0;
l && (M |= _.COLOR_BUFFER_BIT, this.clearColor.set(l), this.colorMask.set([!0, !0, !0, !0])), m !== void 0 && (M |= _.DEPTH_BUFFER_BIT, this.depthRange.set([0, 1]), this.clearDepth.set(m), this.depthMask.set(!0)), v !== void 0 && (M |= _.STENCIL_BUFFER_BIT, this.clearStencil.set(v), this.stencilMask.set(255)), _.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, En.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 Gr {
constructor(l, m, v) {
this.func = l, this.mask = m, this.range = v;
}
}
Gr.ReadOnly = !1, Gr.ReadWrite = !0, Gr.disabled = new Gr(519, Gr.ReadOnly, [0, 1]);
const as = 7680;
class An {
constructor(l, m, v, _, M, I) {
this.test = l, this.ref = m, this.mask = v, this.fail = _, this.depthFail = M, this.pass = I;
}
}
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 V3(E, l, m, v, _) {
const M = E.context, I = M.gl, D = E.useProgram("collisionBox"), j = [];
let W = 0, Y = 0;
for (let Ht = 0; Ht < v.length; Ht++) {
const Ct = v[Ht], _t = l.getTile(Ct).getBucket(m);
if (!_t)
continue;
const Nt = _ ? _t.textCollisionBox : _t.iconCollisionBox, Dt = _t.collisionCircleArray;
if (Dt.length > 0) {
const Wt = a.H();
a.aQ(Wt, _t.placementInvProjMatrix, E.transform.glCoordMatrix), a.aQ(Wt, Wt, _t.placementViewportMatrix), j.push({ circleArray: Dt, circleOffset: Y, transform: Ct.posMatrix, invTransform: Wt, coord: Ct }), W += Dt.length / 4, Y = W;
}
Nt && D.draw(M, I.LINES, Gr.disabled, An.disabled, E.colorModeForRenderPass(), bn.disabled, { u_matrix: Ct.posMatrix, u_pixel_extrude_scale: [1 / (J = E.transform).width, 1 / J.height] }, E.style.map.terrain && E.style.map.terrain.getTerrainData(Ct), m.id, Nt.layoutVertexBuffer, Nt.indexBuffer, Nt.segments, null, E.transform.zoom, null, null, Nt.collisionVertexBuffer);
}
var J;
if (!_ || !j.length)
return;
const ct = E.useProgram("collisionCircle"), ft = new a.aR();
ft.resize(4 * W), ft._trim();
let Qt = 0;
for (const Ht of j)
for (let Ct = 0; Ct < Ht.circleArray.length / 4; Ct++) {
const _t = 4 * Ct, Nt = Ht.circleArray[_t + 0], Dt = Ht.circleArray[_t + 1], Wt = Ht.circleArray[_t + 2], he = Ht.circleArray[_t + 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 * W) && (zs = function(Ht) {
const Ct = 2 * Ht, _t = new a.aT();
_t.resize(Ct), _t._trim();
for (let Nt = 0; Nt < Ct; Nt++) {
const Dt = 6 * Nt;
_t.uint16[Dt + 0] = 4 * Nt + 0, _t.uint16[Dt + 1] = 4 * Nt + 1, _t.uint16[Dt + 2] = 4 * Nt + 2, _t.uint16[Dt + 3] = 4 * Nt + 2, _t.uint16[Dt + 4] = 4 * Nt + 3, _t.uint16[Dt + 5] = 4 * Nt + 0;
}
return _t;
}(W));
const Lt = M.createIndexBuffer(zs, !0), Et = M.createVertexBuffer(ft, a.aS.members, !0);
for (const Ht of j) {
const Ct = fr(Ht.transform, Ht.invTransform, E.transform);
ct.draw(M, I.TRIANGLES, Gr.disabled, An.disabled, E.colorModeForRenderPass(), bn.disabled, Ct, E.style.map.terrain && E.style.map.terrain.getTerrainData(Ht.coord), m.id, Et, Lt, a.a0.simpleSegment(0, 2 * Ht.circleOffset, Ht.circleArray.length, Ht.circleArray.length / 2), null, E.transform.zoom, null, null, null);
}
Et.destroy(), Lt.destroy();
}
bn.disabled = new bn(!1, 1029, 2305), bn.backCCW = new bn(!0, 1029, 2305);
const ba = a.an(new Float32Array(16));
function K4(E, l, m, v, _, M) {
const { horizontalAlign: I, verticalAlign: D } = a.au(E);
return new a.P((-(I - 0.5) * l / _ + v[0]) * M, (-(D - 0.5) * m / _ + v[1]) * M);
}
function Yo(E, l, m, v, _, M) {
const I = l.tileAnchorPoint.add(new a.P(l.translation[0], l.translation[1]));
if (l.pitchWithMap) {
let D = v.mult(M);
m || (D = D.rotate(-_));
const j = I.add(D);
return wt(j.x, j.y, l.labelPlaneMatrix, l.getElevation).point;
}
if (m) {
const D = Jt(l.tileAnchorPoint.x + 1, l.tileAnchorPoint.y, l).point.sub(E), j = Math.atan(D.y / D.x) + (D.x < 0 ? Math.PI : 0);
return E.add(v.rotate(j));
}
return E.add(v);
}
function Oo(E, l, m, v, _, M, I, D, j, W, Y, J, ct, ft) {
const Qt = E.text.placedSymbolArray, Lt = E.text.dynamicLayoutVertexArray, Et = E.icon.dynamicLayoutVertexArray, Ht = {};
Lt.clear();
for (let Ct = 0; Ct < Qt.length; Ct++) {
const _t = Qt.get(Ct), Nt = _t.hidden || !_t.crossTileID || E.allowVerticalPlacement && !_t.placedOrientation ? null : v[_t.crossTileID];
if (Nt) {
const Dt = new a.P(_t.anchorX, _t.anchorY), Wt = { getElevation: ft, width: _.width, height: _.height, labelPlaneMatrix: M, lineVertexArray: null, pitchWithMap: m, projection: Y, projectionCache: null, tileAnchorPoint: Dt, translation: J, unwrappedTileID: ct }, he = m ? wt(Dt.x, Dt.y, I, ft) : Jt(Dt.x, Dt.y, Wt), we = it(_.cameraToCenterDistance, he.signedDistanceFromCamera);
let De = a.ai(E.textSizeData, j, _t) * we / a.ap;
m && (De *= E.tilePixelRatio / D);
const { width: tr, height: Oe, anchor: Ce, textOffset: ur, textBoxScale: Dr } = Nt, Ie = K4(Ce, tr, Oe, ur, Dr, De), Ze = Y.getPitchedTextCorrection(_, Dt.add(new a.P(J[0], J[1])), ct), Or = Yo(he.point, Wt, l, Ie, _.angle, Ze), ei = E.allowVerticalPlacement && _t.placedOrientation === a.ah.vertical ? Math.PI / 2 : 0;
for (let Zr = 0; Zr < _t.numGlyphs; Zr++)
a.aj(Lt, Or, ei);
W && _t.associatedIconIndex >= 0 && (Ht[_t.associatedIconIndex] = { shiftedAnchor: Or, angle: ei });
} else
Rt(_t.numGlyphs, Lt);
}
if (W) {
Et.clear();
const Ct = E.icon.placedSymbolArray;
for (let _t = 0; _t < Ct.length; _t++) {
const Nt = Ct.get(_t);
if (Nt.hidden)
Rt(Nt.numGlyphs, Et);
else {
const Dt = Ht[_t];
if (Dt)
for (let Wt = 0; Wt < Nt.numGlyphs; Wt++)
a.aj(Et, Dt.shiftedAnchor, Dt.angle);
else
Rt(Nt.numGlyphs, Et);
}
}
E.icon.dynamicLayoutVertexBuffer.updateData(Et);
}
E.text.dynamicLayoutVertexBuffer.updateData(Lt);
}
function po(E, l, m) {
return m.iconsInText && l ? "symbolTextAndIcon" : E ? "symbolSDF" : "symbolIcon";
}
function Jo(E, l, m, v, _, M, I, D, j, W, Y, J) {
const ct = E.context, ft = ct.gl, Qt = E.transform, Lt = u1(), Et = D === "map", Ht = j === "map", Ct = D !== "viewport" && m.layout.get("symbol-placement") !== "point", _t = Et && !Ht && !Ct, Nt = !Ht && Ct, Dt = !m.layout.get("symbol-sort-key").isConstant();
let Wt = !1;
const he = E.depthModeForSublayer(0, Gr.ReadOnly), we = m._unevaluatedLayout.hasValue("text-variable-anchor") || m._unevaluatedLayout.hasValue("text-variable-anchor-offset"), De = [], tr = Lt.getCircleRadiusCorrection(Qt);
for (const Oe of v) {
const Ce = l.getTile(Oe), ur = Ce.getBucket(m);
if (!ur)
continue;
const Dr = _ ? ur.text : ur.icon;
if (!Dr || !Dr.segments.get().length || !Dr.hasVisibleVertices)
continue;
const Ie = Dr.programConfigurations.get(m.id), Ze = _ || ur.sdfIcons, Or = _ ? ur.textSizeData : ur.iconSizeData, ei = Ht || Qt.pitch !== 0, Zr = E.useProgram(po(Ze, _, ur), Ie), nn = a.ag(Or, Qt.zoom), ri = E.style.map.terrain && E.style.map.terrain.getTerrainData(Oe);
let O1, C2, ni, mo, q1 = [0, 0], P1 = null;
if (_)
C2 = Ce.glyphAtlasTexture, ni = ft.LINEAR, O1 = Ce.glyphAtlasTexture.size, ur.iconsInText && (q1 = Ce.imageAtlasTexture.size, P1 = Ce.imageAtlasTexture, mo = ei || E.options.rotating || E.options.zooming || Or.kind === "composite" || Or.kind === "camera" ? ft.LINEAR : ft.NEAREST);
else {
const an = m.layout.get("icon-size").constantOr(0) !== 1 || ur.iconsNeedLinear;
C2 = Ce.imageAtlasTexture, ni = Ze || E.options.rotating || E.options.zooming || an || ei ? ft.LINEAR : ft.NEAREST, O1 = Ce.imageAtlasTexture.size;
}
const X1 = Hr(Ce, 1, E.transform.zoom), ms = Nt ? Oe.posMatrix : ba, s6 = Ii(ms, Ht, Et, E.transform, X1), kl = Rn(ms, Ht, Et, E.transform, X1), a6 = Rn(Oe.posMatrix, Ht, Et, E.transform, X1), i2 = Lt.translatePosition(E.transform, Ce, M, I), Vl = we && ur.hasTextData(), jc = m.layout.get("icon-text-fit") !== "none" && Vl && ur.hasIconData();
if (Ct) {
const an = E.style.map.terrain ? (l6, c6) => E.style.map.terrain.getElevation(Oe, l6, c6) : null, B3 = m.layout.get("text-rotation-alignment") === "map";
pt(ur, Oe.posMatrix, E, _, s6, a6, Ht, W, B3, Lt, Oe.toUnwrapped(), Qt.width, Qt.height, i2, an);
}
const o2 = Oe.posMatrix, s2 = _ && we || jc, Ma = Ct || s2 ? ba : s6, O2 = kl, b1 = Ze && m.paint.get(_ ? "text-halo-width" : "icon-halo-width").constantOr(1) !== 0;
let k1;
k1 = Ze ? ur.iconsInText ? D4(Or.kind, nn, _t, Ht, Ct, s2, E, o2, Ma, O2, i2, O1, q1, tr) : ga(Or.kind, nn, _t, Ht, Ct, s2, E, o2, Ma, O2, i2, _, O1, !0, tr) : Ko(Or.kind, nn, _t, Ht, Ct, s2, E, o2, Ma, O2, i2, _, O1, tr);
const Ro = { program: Zr, buffers: Dr, uniformValues: k1, atlasTexture: C2, atlasTextureIcon: P1, atlasInterpolation: ni, atlasInterpolationIcon: mo, isSDF: Ze, hasHalo: b1 };
if (Dt && ur.canOverlap) {
Wt = !0;
const an = Dr.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: Dr.segments, sortKey: 0, state: Ro, terrainData: ri });
}
Wt && De.sort((Oe, Ce) => Oe.sortKey - Ce.sortKey);
for (const Oe of De) {
const Ce = Oe.state;
if (ct.activeTexture.set(ft.TEXTURE0), Ce.atlasTexture.bind(Ce.atlasInterpolation, ft.CLAMP_TO_EDGE), Ce.atlasTextureIcon && (ct.activeTexture.set(ft.TEXTURE1), Ce.atlasTextureIcon && Ce.atlasTextureIcon.bind(Ce.atlasInterpolationIcon, ft.CLAMP_TO_EDGE)), Ce.isSDF) {
const ur = Ce.uniformValues;
Ce.hasHalo && (ur.u_is_halo = 1, A0(Ce.buffers, Oe.segments, m, E, Ce.program, he, Y, J, ur, Oe.terrainData)), ur.u_is_halo = 0;
}
A0(Ce.buffers, Oe.segments, m, E, Ce.program, he, Y, J, Ce.uniformValues, Oe.terrainData);
}
}
function A0(E, l, m, v, _, M, I, D, j, W) {
const Y = v.context;
_.draw(Y, Y.gl.TRIANGLES, M, I, D, bn.disabled, j, W, m.id, E.layoutVertexBuffer, E.indexBuffer, l, m.paint, v.transform.zoom, E.programConfigurations.get(m.id), E.dynamicLayoutVertexBuffer, E.opacityVertexBuffer);
}
function E2(E, l, m, v) {
const _ = E.context, M = _.gl, I = An.disabled, D = new En([M.ONE, M.ONE], a.aM.transparent, [!0, !0, !0, !0]), j = l.getBucket(m);
if (!j)
return;
const W = v.key;
let Y = m.heatmapFbos.get(W);
Y || (Y = I3(_, l.tileSize, l.tileSize), m.heatmapFbos.set(W, Y)), _.bindFramebuffer.set(Y.framebuffer), _.viewport.set([0, 0, l.tileSize, l.tileSize]), _.clear({ color: a.aM.transparent });
const J = j.programConfigurations.get(m.id), ct = E.useProgram("heatmap", J), ft = E.style.map.terrain.getTerrainData(v);
ct.draw(_, M.TRIANGLES, Gr.disabled, I, D, bn.disabled, un(v.posMatrix, l, E.transform.zoom, m.paint.get("heatmap-intensity")), ft, m.id, j.layoutVertexBuffer, j.indexBuffer, j.segments, m.paint, E.transform.zoom, J);
}
function ls(E, l, m) {
const v = E.context, _ = v.gl;
v.setColorMode(E.colorModeForRenderPass());
const M = cs(v, l), I = m.key, D = l.heatmapFbos.get(I);
D && (v.activeTexture.set(_.TEXTURE0), _.bindTexture(_.TEXTURE_2D, D.colorAttachment.get()), v.activeTexture.set(_.TEXTURE1), M.bind(_.LINEAR, _.CLAMP_TO_EDGE), E.useProgram("heatmapTexture").draw(v, _.TRIANGLES, Gr.disabled, An.disabled, E.colorModeForRenderPass(), bn.disabled, pe(E, l, 0, 1), null, l.id, E.rasterBoundsBuffer, E.quadTriangleIndexBuffer, E.rasterBoundsSegments, l.paint, E.transform.zoom), D.destroy(), l.heatmapFbos.delete(I));
}
function I3(E, l, m) {
var v, _;
const M = E.gl, I = M.createTexture();
M.bindTexture(M.TEXTURE_2D, I), 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 = E.HALF_FLOAT) !== null && v !== void 0 ? v : M.UNSIGNED_BYTE, j = (_ = E.RGBA16F) !== null && _ !== void 0 ? _ : M.RGBA;
M.texImage2D(M.TEXTURE_2D, 0, j, l, m, 0, M.RGBA, D, null);
const W = E.createFramebuffer(l, m, !1, !1);
return W.colorAttachment.set(I), W;
}
function cs(E, l) {
return l.colorRampTexture || (l.colorRampTexture = new lt(E, l.colorRamp, E.gl.RGBA)), l.colorRampTexture;
}
function us(E, l, m, v, _) {
if (!m || !v || !v.imageAtlas)
return;
const M = v.imageAtlas.patternPositions;
let I = M[m.to.toString()], D = M[m.from.toString()];
if (!I && D && (I = D), !D && I && (D = I), !I || !D) {
const j = _.getPaintProperty(l);
I = M[j], D = M[j];
}
I && D && E.setConstantPatternPositions(I, D);
}
function La(E, l, m, v, _, M, I) {
const D = E.context.gl, j = "fill-pattern", W = m.paint.get(j), Y = W && W.constantOr(1), J = m.getCrossfadeParameters();
let ct, ft, Qt, Lt, Et;
I ? (ft = Y && !m.getPaintProperty("fill-outline-color") ? "fillOutlinePattern" : "fillOutline", ct = D.LINES) : (ft = Y ? "fillPattern" : "fill", ct = D.TRIANGLES);
const Ht = W.constantOr(null);
for (const Ct of v) {
const _t = l.getTile(Ct);
if (Y && !_t.patternsLoaded())
continue;
const Nt = _t.getBucket(m);
if (!Nt)
continue;
const Dt = Nt.programConfigurations.get(m.id), Wt = E.useProgram(ft, Dt), he = E.style.map.terrain && E.style.map.terrain.getTerrainData(Ct);
Y && (E.context.activeTexture.set(D.TEXTURE0), _t.imageAtlasTexture.bind(D.LINEAR, D.CLAMP_TO_EDGE), Dt.updatePaintBuffers(J)), us(Dt, j, Ht, _t, m);
const we = he ? Ct : null, De = E.translatePosMatrix(we ? we.posMatrix : Ct.posMatrix, _t, m.paint.get("fill-translate"), m.paint.get("fill-translate-anchor"));
if (I) {
Lt = Nt.indexBuffer2, Et = Nt.segments2;
const tr = [D.drawingBufferWidth, D.drawingBufferHeight];
Qt = ft === "fillOutlinePattern" && Y ? Ee(De, E, J, _t, tr) : ve(De, tr);
} else
Lt = Nt.indexBuffer, Et = Nt.segments, Qt = Y ? ae(De, E, J, _t) : qt(De);
Wt.draw(E.context, ct, _, E.stencilModeForClipping(Ct), M, bn.disabled, Qt, he, m.id, Nt.layoutVertexBuffer, Lt, Et, m.paint, E.transform.zoom, Dt);
}
}
function R3(E, l, m, v, _, M, I) {
const D = E.context, j = D.gl, W = "fill-extrusion-pattern", Y = m.paint.get(W), J = Y.constantOr(1), ct = m.getCrossfadeParameters(), ft = m.paint.get("fill-extrusion-opacity"), Qt = Y.constantOr(null);
for (const Lt of v) {
const Et = l.getTile(Lt), Ht = Et.getBucket(m);
if (!Ht)
continue;
const Ct = E.style.map.terrain && E.style.map.terrain.getTerrainData(Lt), _t = Ht.programConfigurations.get(m.id), Nt = E.useProgram(J ? "fillExtrusionPattern" : "fillExtrusion", _t);
J && (E.context.activeTexture.set(j.TEXTURE0), Et.imageAtlasTexture.bind(j.LINEAR, j.CLAMP_TO_EDGE), _t.updatePaintBuffers(ct)), us(_t, W, Qt, Et, m);
const Dt = E.translatePosMatrix(Lt.posMatrix, Et, 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, E, Wt, ft, Lt, ct, Et) : ht(Dt, E, Wt, ft);
Nt.draw(D, D.gl.TRIANGLES, _, M, I, bn.backCCW, he, Ct, m.id, Ht.layoutVertexBuffer, Ht.indexBuffer, Ht.segments, m.paint, E.transform.zoom, _t, E.style.map.terrain && Ht.centroidVertexBuffer);
}
}
function Us(E, l, m, v, _, M, I) {
const D = E.context, j = D.gl, W = m.fbo;
if (!W)
return;
const Y = E.useProgram("hillshade"), J = E.style.map.terrain && E.style.map.terrain.getTerrainData(l);
D.activeTexture.set(j.TEXTURE0), j.bindTexture(j.TEXTURE_2D, W.colorAttachment.get()), Y.draw(D, j.TRIANGLES, _, M, I, bn.disabled, ((ct, ft, Qt, Lt) => {
const Et = Qt.paint.get("hillshade-shadow-color"), Ht = Qt.paint.get("hillshade-highlight-color"), Ct = Qt.paint.get("hillshade-accent-color");
let _t = Qt.paint.get("hillshade-illumination-direction") * (Math.PI / 180);
Qt.paint.get("hillshade-illumination-anchor") === "viewport" && (_t -= ct.transform.angle);
const Nt = !ct.options.moving;
return { u_matrix: Lt ? Lt.posMatrix : ct.transform.calculatePosMatrix(ft.tileID.toUnwrapped(), Nt), u_image: 0, u_latrange: dr(0, ft.tileID), u_light: [Qt.paint.get("hillshade-exaggeration"), _t], u_shadow: Et, u_highlight: Ht, u_accent: Ct };
})(E, m, v, J ? l : null), J, v.id, E.rasterBoundsBuffer, E.quadTriangleIndexBuffer, E.rasterBoundsSegments);
}
function t2(E, l, m, v, _, M) {
const I = E.context, D = I.gl, j = l.dem;
if (j && j.data) {
const W = j.dim, Y = j.stride, J = j.getPixels();
if (I.activeTexture.set(D.TEXTURE1), I.pixelStoreUnpackPremultiplyAlpha.set(!1), l.demTexture = l.demTexture || E.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 lt(I, J, D.RGBA, { premultiply: !1 }), l.demTexture.bind(D.NEAREST, D.CLAMP_TO_EDGE);
I.activeTexture.set(D.TEXTURE0);
let ct = l.fbo;
if (!ct) {
const ft = new lt(I, { width: W, height: W, data: null }, D.RGBA);
ft.bind(D.LINEAR, D.CLAMP_TO_EDGE), ct = l.fbo = I.createFramebuffer(W, W, !0, !1), ct.colorAttachment.set(ft.texture);
}
I.bindFramebuffer.set(ct.framebuffer), I.viewport.set([0, 0, W, W]), E.useProgram("hillshadePrepare").draw(I, D.TRIANGLES, v, _, M, bn.disabled, ((ft, Qt) => {
const Lt = Qt.stride, Et = a.H();
return a.aP(Et, 0, a.X, -a.X, 0, 0, 1), a.J(Et, Et, [0, -a.X, 0]), { u_matrix: Et, u_image: 1, u_dimension: [Lt, Lt], u_zoom: ft.overscaledZ, u_unpack: Qt.getUnpackVector() };
})(l.tileID, j), null, m.id, E.rasterBoundsBuffer, E.quadTriangleIndexBuffer, E.rasterBoundsSegments), l.needsHillshadePrepare = !1;
}
}
function C0(E, l, m, v, _, M) {
const I = v.paint.get("raster-fade-duration");
if (!M && I > 0) {
const D = f.now(), j = (D - E.timeAdded) / I, W = l ? (D - l.timeAdded) / I : -1, Y = m.getSource(), J = _.coveringZoomLevel({ tileSize: Y.tileSize, roundZoom: Y.roundZoom }), ct = !l || Math.abs(l.tileID.overscaledZ - J) > Math.abs(E.tileID.overscaledZ - J), ft = ct && E.refreshedUponExpiration ? 1 : a.ac(ct ? j : 1 - W, 0, 1);
return E.refreshedUponExpiration && j >= 1 && (E.refreshedUponExpiration = !1), l ? { opacity: 1, mix: 1 - ft } : { opacity: ft, mix: 0 };
}
return { opacity: 1, mix: 0 };
}
const O0 = new a.aM(1, 0, 0, 1), Pt = new a.aM(0, 1, 0, 1), re = new a.aM(0, 0, 1, 1), Fe = new a.aM(1, 0, 1, 1), br = new a.aM(0, 1, 1, 1);
function Ln(E, l, m, v) {
Jn(E, 0, l + m / 2, E.transform.width, m, v);
}
function rn(E, l, m, v) {
Jn(E, l - m / 2, 0, m, E.transform.height, v);
}
function Jn(E, l, m, v, _, M) {
const I = E.context, D = I.gl;
D.enable(D.SCISSOR_TEST), D.scissor(l * E.pixelRatio, m * E.pixelRatio, v * E.pixelRatio, _ * E.pixelRatio), I.clear({ color: M }), D.disable(D.SCISSOR_TEST);
}
function wi(E, l, m) {
const v = E.context, _ = v.gl, M = m.posMatrix, I = E.useProgram("debug"), D = Gr.disabled, j = An.disabled, W = E.colorModeForRenderPass(), Y = "$debug", J = E.style.map.terrain && E.style.map.terrain.getTerrainData(m);
v.activeTexture.set(_.TEXTURE0);
const ct = l.getTileByID(m.key).latestRawTileData, ft = Math.floor((ct && ct.byteLength || 0) / 1024), Qt = l.getTile(m).tileSize, Lt = 512 / Math.min(Qt, 512) * (m.overscaledZ / E.transform.zoom) * 0.5;
let Et = m.canonical.toString();
m.overscaledZ !== m.canonical.z && (Et += ` => ${m.overscaledZ}`), function(Ht, Ct) {
Ht.initDebugOverlayCanvas();
const _t = Ht.debugOverlayCanvas, Nt = Ht.context.gl, Dt = Ht.debugOverlayCanvas.getContext("2d");
Dt.clearRect(0, 0, _t.width, _t.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(Ct, 5, 5), Dt.strokeText(Ct, 5, 5), Ht.debugOverlayTexture.update(_t), Ht.debugOverlayTexture.bind(Nt.LINEAR, Nt.CLAMP_TO_EDGE);
}(E, `${Et} ${ft}kB`), I.draw(v, _.TRIANGLES, D, j, En.alphaBlended, bn.disabled, Pn(M, a.aM.transparent, Lt), null, Y, E.debugBuffer, E.quadTriangleIndexBuffer, E.debugSegments), I.draw(v, _.LINE_STRIP, D, j, W, bn.disabled, Pn(M, a.aM.red), J, Y, E.debugBuffer, E.tileBorderIndexBuffer, E.debugSegments);
}
function To(E, l, m) {
const v = E.context, _ = v.gl, M = E.colorModeForRenderPass(), I = new Gr(_.LEQUAL, Gr.ReadWrite, E.depthRangeFor3D), D = E.useProgram("terrain"), j = l.getTerrainMesh();
v.bindFramebuffer.set(null), v.viewport.set([0, 0, E.width, E.height]);
for (const W of m) {
const Y = E.renderToTexture.getTexture(W), J = l.getTerrainData(W.tileID);
v.activeTexture.set(_.TEXTURE0), _.bindTexture(_.TEXTURE_2D, Y.texture);
const ct = E.transform.calculatePosMatrix(W.tileID.toUnwrapped()), ft = l.getMeshFrameDelta(E.transform.zoom), Qt = E.transform.calculateFogMatrix(W.tileID.toUnwrapped()), Lt = G(ct, ft, Qt, E.style.sky, E.transform.pitch);
D.draw(v, _.TRIANGLES, I, An.disabled, M, bn.backCCW, Lt, 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 _ of this.style._order)
this.style._layers[_].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 _ = new a.$();
_.emplaceBack(0, 0, 0, 0), _.emplaceBack(a.X, 0, a.X, 0), _.emplaceBack(0, a.X, 0, a.X), _.emplaceBack(a.X, a.X, a.X, a.X), this.rasterBoundsBuffer = l.createVertexBuffer(_, 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 I = new a.aZ();
I.emplaceBack(0), I.emplaceBack(1), I.emplaceBack(3), I.emplaceBack(2), I.emplaceBack(0), this.tileBorderIndexBuffer = l.createIndexBuffer(I);
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, Gr.disabled, this.stencilClearMode, En.disabled, bn.disabled, wr(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, _ = v.gl;
this.nextStencilID + m.length > 256 && this.clearStencil(), v.setColorMode(En.disabled), v.setDepthMode(Gr.disabled);
const M = this.useProgram("clippingMask");
this._tileClippingMaskIDs = {};
for (const I of m) {
const D = this._tileClippingMaskIDs[I.key] = this.nextStencilID++, j = this.style.map.terrain && this.style.map.terrain.getTerrainData(I);
M.draw(v, _.TRIANGLES, Gr.disabled, new An({ func: _.ALWAYS, mask: 0 }, D, 255, _.KEEP, _.KEEP, _.REPLACE), En.disabled, bn.disabled, wr(I.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((I, D) => D.overscaledZ - I.overscaledZ), _ = v[v.length - 1].overscaledZ, M = v[0].overscaledZ - _ + 1;
if (M > 1) {
this.currentStencilSource = void 0, this.nextStencilID + M > 256 && this.clearStencil();
const I = {};
for (let D = 0; D < M; D++)
I[D + _] = new An({ func: m.GEQUAL, mask: 255 }, D + this.nextStencilID, 255, m.KEEP, m.KEEP, m.REPLACE);
return this.nextStencilID += M, [I, v];
}
return [{ [_]: An.disabled }, v];
}
colorModeForRenderPass() {
const l = this.context.gl;
return this._showOverdrawInspector ? new En([l.CONSTANT_COLOR, l.ONE], new a.aM(0.125, 0.125, 0.125, 0), [!0, !0, !0, !0]) : this.renderPass === "opaque" ? En.unblended : En.alphaBlended;
}
depthModeForSublayer(l, m, v) {
if (!this.opaquePassEnabledForLayer())
return Gr.disabled;
const _ = 1 - ((1 + this.currentLayer) * this.numSublayers + l) * this.depthEpsilon;
return new Gr(v || this.context.gl.LEQUAL, m, [_, _]);
}
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, _ = this.style.sourceCaches, M = {}, I = {}, D = {};
for (const j in _) {
const W = _[j];
W.used && W.prepare(this.context), M[j] = W.getVisibleCoordinates(), I[j] = M[j].slice().reverse(), D[j] = W.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 W = this.style._layers[j];
if (!W.hasOffscreenPass() || W.isHidden(this.transform.zoom))
continue;
const Y = I[W.source];
(W.type === "custom" || Y.length) && this.renderLayer(this, _[W.source], W, 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, W) {
const Y = j.context, J = Y.gl, ct = ((Ht, Ct, _t) => ({ u_sky_color: Ht.properties.get("sky-color"), u_horizon_color: Ht.properties.get("horizon-color"), u_horizon: (Ct.height / 2 + Ct.getHorizon()) * _t, u_sky_horizon_blend: Ht.properties.get("sky-horizon-blend") * Ct.height / 2 * _t }))(W, j.style.map.transform, j.pixelRatio), ft = new Gr(J.LEQUAL, Gr.ReadWrite, [0, 1]), Qt = An.disabled, Lt = j.colorModeForRenderPass(), Et = j.useProgram("sky");
if (!W.mesh) {
const Ht = new a.aX();
Ht.emplaceBack(-1, -1), Ht.emplaceBack(1, -1), Ht.emplaceBack(1, 1), Ht.emplaceBack(-1, 1);
const Ct = new a.aY();
Ct.emplaceBack(0, 1, 2), Ct.emplaceBack(0, 2, 3), W.mesh = new gi(Y.createVertexBuffer(Ht, Xo.members), Y.createIndexBuffer(Ct), a.a0.simpleSegment(0, 0, Ht.length, Ct.length));
}
Et.draw(Y, J.TRIANGLES, ft, Qt, Lt, bn.disabled, ct, void 0, "sky", W.mesh.vertexBuffer, W.mesh.indexBuffer, W.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]], W = _[j.source], Y = M[j.source];
this._renderTileClippingMasks(j, Y), this.renderLayer(this, W, j, Y);
}
for (this.renderPass = "translucent", this.currentLayer = 0; this.currentLayer < v.length; this.currentLayer++) {
const j = this.style._layers[v[this.currentLayer]], W = _[j.source];
if (this.renderToTexture && this.renderToTexture.renderLayer(j))
continue;
const Y = (j.type === "symbol" ? D : I)[j.source];
this._renderTileClippingMasks(j, M[j.source]), this.renderLayer(this, W, j, Y);
}
if (this.options.showTileBoundaries) {
const j = function(W, Y) {
let J = null;
const ct = Object.values(W._layers).flatMap((Et) => Et.source && !Et.isHidden(Y) ? [W.sourceCaches[Et.source]] : []), ft = ct.filter((Et) => Et.getSource().type === "vector"), Qt = ct.filter((Et) => Et.getSource().type !== "vector"), Lt = (Et) => {
(!J || J.getSource().maxzoom < Et.getSource().maxzoom) && (J = Et);
};
return ft.forEach((Et) => Lt(Et)), J || Qt.forEach((Et) => Lt(Et)), J;
}(this.style, this.transform.zoom);
j && function(W, Y, J) {
for (let ct = 0; ct < J.length; ct++)
wi(W, Y, J[ct]);
}(this, j, j.getVisibleCoordinates());
}
this.options.showPadding && function(j) {
const W = j.transform.padding;
Ln(j, j.transform.height - (W.top || 0), 3, O0), Ln(j, W.bottom || 0, 3, Pt), rn(j, W.left || 0, 3, re), rn(j, j.transform.width - (W.right || 0), 3, Fe);
const Y = j.transform.centerPoint;
(function(J, ct, ft, Qt) {
Jn(J, ct - 1, ft - 10, 2, 20, Qt), Jn(J, ct - 10, ft - 1, 20, 2, Qt);
})(j, Y.x, j.transform.height - Y.y, br);
}(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 _ = this.terrainFacilitator.dirty;
_ || (_ = l ? !a.a_(m, v) : !a.a$(m, v)), _ || (_ = this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length > 0), _ && (a.b0(m, v), this.terrainFacilitator.renderTime = Date.now(), this.terrainFacilitator.dirty = !1, function(M, I) {
const D = M.context, j = D.gl, W = En.unblended, Y = new Gr(j.LEQUAL, Gr.ReadWrite, [0, 1]), J = I.getTerrainMesh(), ct = I.sourceCache.getRenderableTiles(), ft = M.useProgram("terrainDepth");
D.bindFramebuffer.set(I.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 ct) {
const Lt = I.getTerrainData(Qt.tileID), Et = { u_matrix: M.transform.calculatePosMatrix(Qt.tileID.toUnwrapped()), u_ele_delta: I.getMeshFrameDelta(M.transform.zoom) };
ft.draw(D, j.TRIANGLES, Y, An.disabled, W, bn.backCCW, Et, Lt, "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, I) {
const D = M.context, j = D.gl, W = En.unblended, Y = new Gr(j.LEQUAL, Gr.ReadWrite, [0, 1]), J = I.getTerrainMesh(), ct = I.getCoordsTexture(), ft = I.sourceCache.getRenderableTiles(), Qt = M.useProgram("terrainCoords");
D.bindFramebuffer.set(I.getFramebuffer("coords").framebuffer), D.viewport.set([0, 0, M.width / devicePixelRatio, M.height / devicePixelRatio]), D.clear({ color: a.aM.transparent, depth: 1 }), I.coordsIndex = [];
for (const Lt of ft) {
const Et = I.getTerrainData(Lt.tileID);
D.activeTexture.set(j.TEXTURE0), j.bindTexture(j.TEXTURE_2D, ct.texture);
const Ht = { u_matrix: M.transform.calculatePosMatrix(Lt.tileID.toUnwrapped()), u_terrain_coords_id: (255 - I.coordsIndex.length) / 255, u_texture: 0, u_ele_delta: I.getMeshFrameDelta(M.transform.zoom) };
Qt.draw(D, j.TRIANGLES, Y, An.disabled, W, bn.backCCW, Ht, Et, "terrain", J.vertexBuffer, J.indexBuffer, J.segments), I.coordsIndex.push(Lt.tileID.key);
}
D.bindFramebuffer.set(null), D.viewport.set([0, 0, M.width, M.height]);
}(this, this.style.map.terrain));
}
renderLayer(l, m, v, _) {
if (!v.isHidden(this.transform.zoom) && (v.type === "background" || v.type === "custom" || (_ || []).length))
switch (this.id = v.id, v.type) {
case "symbol":
(function(M, I, D, j, W) {
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(ct, ft, Qt, Lt, Et, Ht, Ct, _t, Nt) {
const Dt = ft.transform, Wt = u1(), he = Et === "map", we = Ht === "map";
for (const De of ct) {
const tr = Lt.getTile(De), Oe = tr.getBucket(Qt);
if (!Oe || !Oe.text || !Oe.text.segments.get().length)
continue;
const Ce = a.ag(Oe.textSizeData, Dt.zoom), ur = Hr(tr, 1, ft.transform.zoom), Dr = Ii(De.posMatrix, we, he, ft.transform, ur), Ie = Qt.layout.get("icon-text-fit") !== "none" && Oe.hasIconData();
if (Ce) {
const Ze = Math.pow(2, Dt.zoom - tr.tileID.overscaledZ), Or = ft.style.map.terrain ? (Zr, nn) => ft.style.map.terrain.getElevation(De, Zr, nn) : null, ei = Wt.translatePosition(Dt, tr, Ct, _t);
Oo(Oe, he, we, Nt, Dt, Dr, De.posMatrix, Ze, Ce, Ie, Wt, ei, De.toUnwrapped(), Or);
}
}
}(j, M, D, I, D.layout.get("text-rotation-alignment"), D.layout.get("text-pitch-alignment"), D.paint.get("text-translate"), D.paint.get("text-translate-anchor"), W), D.paint.get("icon-opacity").constantOr(1) !== 0 && Jo(M, I, 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, I, 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), I.map.showCollisionBoxes && (V3(M, I, D, j, !0), V3(M, I, D, j, !1));
})(l, m, v, _, this.style.placement.variableOffsets);
break;
case "circle":
(function(M, I, D, j) {
if (M.renderPass !== "translucent")
return;
const W = D.paint.get("circle-opacity"), Y = D.paint.get("circle-stroke-width"), J = D.paint.get("circle-stroke-opacity"), ct = !D.layout.get("circle-sort-key").isConstant();
if (W.constantOr(1) === 0 && (Y.constantOr(1) === 0 || J.constantOr(1) === 0))
return;
const ft = M.context, Qt = ft.gl, Lt = M.depthModeForSublayer(0, Gr.ReadOnly), Et = An.disabled, Ht = M.colorModeForRenderPass(), Ct = [];
for (let _t = 0; _t < j.length; _t++) {
const Nt = j[_t], Dt = I.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), Ce = { programConfiguration: he, program: we, layoutVertexBuffer: De, indexBuffer: tr, uniformValues: be(M, Nt, Dt, D), terrainData: Oe };
if (ct) {
const ur = Wt.segments.get();
for (const Dr of ur)
Ct.push({ segments: new a.a0([Dr]), sortKey: Dr.sortKey, state: Ce });
} else
Ct.push({ segments: Wt.segments, sortKey: 0, state: Ce });
}
ct && Ct.sort((_t, Nt) => _t.sortKey - Nt.sortKey);
for (const _t of Ct) {
const { programConfiguration: Nt, program: Dt, layoutVertexBuffer: Wt, indexBuffer: he, uniformValues: we, terrainData: De } = _t.state;
Dt.draw(ft, Qt.TRIANGLES, Lt, Et, Ht, bn.disabled, we, De, D.id, Wt, he, _t.segments, D.paint, M.transform.zoom, Nt);
}
})(l, m, v, _);
break;
case "heatmap":
(function(M, I, D, j) {
if (D.paint.get("heatmap-opacity") === 0)
return;
const W = M.context;
if (M.style.map.terrain) {
for (const Y of j) {
const J = I.getTile(Y);
I.hasRenderableParent(Y) || (M.renderPass === "offscreen" ? E2(M, J, D, Y) : M.renderPass === "translucent" && ls(M, D, Y));
}
W.viewport.set([0, 0, M.width, M.height]);
} else
M.renderPass === "offscreen" ? function(Y, J, ct, ft) {
const Qt = Y.context, Lt = Qt.gl, Et = An.disabled, Ht = new En([Lt.ONE, Lt.ONE], a.aM.transparent, [!0, !0, !0, !0]);
(function(Ct, _t, Nt) {
const Dt = Ct.gl;
Ct.activeTexture.set(Dt.TEXTURE1), Ct.viewport.set([0, 0, _t.width / 4, _t.height / 4]);
let Wt = Nt.heatmapFbos.get(a.aU);
Wt ? (Dt.bindTexture(Dt.TEXTURE_2D, Wt.colorAttachment.get()), Ct.bindFramebuffer.set(Wt.framebuffer)) : (Wt = I3(Ct, _t.width / 4, _t.height / 4), Nt.heatmapFbos.set(a.aU, Wt));
})(Qt, Y, ct), Qt.clear({ color: a.aM.transparent });
for (let Ct = 0; Ct < ft.length; Ct++) {
const _t = ft[Ct];
if (J.hasRenderableParent(_t))
continue;
const Nt = J.getTile(_t), Dt = Nt.getBucket(ct);
if (!Dt)
continue;
const Wt = Dt.programConfigurations.get(ct.id), he = Y.useProgram("heatmap", Wt), { zoom: we } = Y.transform;
he.draw(Qt, Lt.TRIANGLES, Gr.disabled, Et, Ht, bn.disabled, un(_t.posMatrix, Nt, we, ct.paint.get("heatmap-intensity")), null, ct.id, Dt.layoutVertexBuffer, Dt.indexBuffer, Dt.segments, ct.paint, Y.transform.zoom, Wt);
}
Qt.viewport.set([0, 0, Y.width, Y.height]);
}(M, I, D, j) : M.renderPass === "translucent" && function(Y, J) {
const ct = Y.context, ft = ct.gl;
ct.setColorMode(Y.colorModeForRenderPass());
const Qt = J.heatmapFbos.get(a.aU);
Qt && (ct.activeTexture.set(ft.TEXTURE0), ft.bindTexture(ft.TEXTURE_2D, Qt.colorAttachment.get()), ct.activeTexture.set(ft.TEXTURE1), cs(ct, J).bind(ft.LINEAR, ft.CLAMP_TO_EDGE), Y.useProgram("heatmapTexture").draw(ct, ft.TRIANGLES, Gr.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, _);
break;
case "line":
(function(M, I, D, j) {
if (M.renderPass !== "translucent")
return;
const W = D.paint.get("line-opacity"), Y = D.paint.get("line-width");
if (W.constantOr(1) === 0 || Y.constantOr(1) === 0)
return;
const J = M.depthModeForSublayer(0, Gr.ReadOnly), ct = M.colorModeForRenderPass(), ft = D.paint.get("line-dasharray"), Qt = D.paint.get("line-pattern"), Lt = Qt.constantOr(1), Et = D.paint.get("line-gradient"), Ht = D.getCrossfadeParameters(), Ct = Lt ? "linePattern" : ft ? "lineSDF" : Et ? "lineGradient" : "line", _t = M.context, Nt = _t.gl;
let Dt = !0;
for (const Wt of j) {
const he = I.getTile(Wt);
if (Lt && !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(Ct, De), Ce = Dt || Oe.program !== tr, ur = M.style.map.terrain && M.style.map.terrain.getTerrainData(Wt), Dr = Qt.constantOr(null);
if (Dr && he.imageAtlas) {
const Or = he.imageAtlas, ei = Or.patternPositions[Dr.to.toString()], Zr = Or.patternPositions[Dr.from.toString()];
ei && Zr && De.setConstantPatternPositions(ei, Zr);
}
const Ie = ur ? Wt : null, Ze = Lt ? zn(M, he, D, Ht, Ie) : ft ? b0(M, he, D, ft, Ht, Ie) : Et ? Ni(M, he, D, we.lineClipsArray.length, Ie) : Tn(M, he, D, Ie);
if (Lt)
_t.activeTexture.set(Nt.TEXTURE0), he.imageAtlasTexture.bind(Nt.LINEAR, Nt.CLAMP_TO_EDGE), De.updatePaintBuffers(Ht);
else if (ft && (Ce || M.lineAtlas.dirty))
_t.activeTexture.set(Nt.TEXTURE0), M.lineAtlas.bind(_t);
else if (Et) {
const Or = we.gradients[D.id];
let ei = Or.texture;
if (D.gradientVersion !== Or.version) {
let Zr = 256;
if (D.stepInterpolant) {
const nn = I.getSource().maxzoom, ri = Wt.canonical.z === nn ? Math.ceil(1 << M.transform.maxZoom - Wt.canonical.z) : 1;
Zr = a.ac(a.aV(we.maxLineLength / a.X * 1024 * ri), 256, _t.maxTextureSize);
}
Or.gradient = a.aW({ expression: D.gradientExpression(), evaluationKey: "lineProgress", resolution: Zr, image: Or.gradient || void 0, clips: we.lineClipsArray }), Or.texture ? Or.texture.update(Or.gradient) : Or.texture = new lt(_t, Or.gradient, Nt.RGBA), Or.version = D.gradientVersion, ei = Or.texture;
}
_t.activeTexture.set(Nt.TEXTURE0), ei.bind(D.stepInterpolant ? Nt.NEAREST : Nt.LINEAR, Nt.CLAMP_TO_EDGE);
}
Oe.draw(_t, Nt.TRIANGLES, J, M.stencilModeForClipping(Wt), ct, bn.disabled, Ze, ur, D.id, we.layoutVertexBuffer, we.indexBuffer, we.segments, D.paint, M.transform.zoom, De, we.layoutVertexBuffer2), Dt = !1;
}
})(l, m, v, _);
break;
case "fill":
(function(M, I, D, j) {
const W = D.paint.get("fill-color"), Y = D.paint.get("fill-opacity");
if (Y.constantOr(1) === 0)
return;
const J = M.colorModeForRenderPass(), ct = D.paint.get("fill-pattern"), ft = M.opaquePassEnabledForLayer() && !ct.constantOr(1) && W.constantOr(a.aM.transparent).a === 1 && Y.constantOr(0) === 1 ? "opaque" : "translucent";
if (M.renderPass === ft) {
const Qt = M.depthModeForSublayer(1, M.renderPass === "opaque" ? Gr.ReadWrite : Gr.ReadOnly);
La(M, I, 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, Gr.ReadOnly);
La(M, I, D, j, Qt, J, !0);
}
})(l, m, v, _);
break;
case "fill-extrusion":
(function(M, I, D, j) {
const W = D.paint.get("fill-extrusion-opacity");
if (W !== 0 && M.renderPass === "translucent") {
const Y = new Gr(M.context.gl.LEQUAL, Gr.ReadWrite, M.depthRangeFor3D);
if (W !== 1 || D.paint.get("fill-extrusion-pattern").constantOr(1))
R3(M, I, D, j, Y, An.disabled, En.disabled), R3(M, I, D, j, Y, M.stencilModeFor3D(), M.colorModeForRenderPass());
else {
const J = M.colorModeForRenderPass();
R3(M, I, D, j, Y, An.disabled, J);
}
}
})(l, m, v, _);
break;
case "hillshade":
(function(M, I, D, j) {
if (M.renderPass !== "offscreen" && M.renderPass !== "translucent")
return;
const W = M.context, Y = M.depthModeForSublayer(0, Gr.ReadOnly), J = M.colorModeForRenderPass(), [ct, ft] = M.renderPass === "translucent" ? M.stencilConfigForOverlap(j) : [{}, j];
for (const Qt of ft) {
const Lt = I.getTile(Qt);
Lt.needsHillshadePrepare !== void 0 && Lt.needsHillshadePrepare && M.renderPass === "offscreen" ? t2(M, Lt, D, Y, An.disabled, J) : M.renderPass === "translucent" && Us(M, Qt, Lt, D, Y, ct[Qt.overscaledZ], J);
}
W.viewport.set([0, 0, M.width, M.height]);
})(l, m, v, _);
break;
case "raster":
(function(M, I, D, j) {
if (M.renderPass !== "translucent" || D.paint.get("raster-opacity") === 0 || !j.length)
return;
const W = M.context, Y = W.gl, J = I.getSource(), ct = M.useProgram("raster"), ft = M.colorModeForRenderPass(), [Qt, Lt] = J instanceof Ji ? [{}, j] : M.stencilConfigForOverlap(j), Et = Lt[Lt.length - 1].overscaledZ, Ht = !M.options.moving;
for (const Ct of Lt) {
const _t = M.depthModeForSublayer(Ct.overscaledZ - Et, D.paint.get("raster-opacity") === 1 ? Gr.ReadWrite : Gr.ReadOnly, Y.LESS), Nt = I.getTile(Ct);
Nt.registerFadeDuration(D.paint.get("raster-fade-duration"));
const Dt = I.findLoadedParent(Ct, 0), Wt = I.findLoadedSibling(Ct), he = C0(Nt, Dt || Wt || null, I, D, M.transform, M.style.map.terrain);
let we, De;
const tr = D.paint.get("raster-resampling") === "nearest" ? Y.NEAREST : Y.LINEAR;
W.activeTexture.set(Y.TEXTURE0), Nt.texture.bind(tr, Y.CLAMP_TO_EDGE, Y.LINEAR_MIPMAP_NEAREST), W.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 && W.extTextureFilterAnisotropic && M.transform.pitch > 20 && Y.texParameterf(Y.TEXTURE_2D, W.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, W.extTextureFilterAnisotropicMax);
const Oe = M.style.map.terrain && M.style.map.terrain.getTerrainData(Ct), Ce = Oe ? Ct : null, ur = Ce ? Ce.posMatrix : M.transform.calculatePosMatrix(Ct.toUnwrapped(), Ht), Dr = bl(ur, De || [0, 0], we || 1, he, D);
J instanceof Ji ? ct.draw(W, Y.TRIANGLES, _t, An.disabled, ft, bn.disabled, Dr, Oe, D.id, J.boundsBuffer, M.quadTriangleIndexBuffer, J.boundsSegments) : ct.draw(W, Y.TRIANGLES, _t, Qt[Ct.overscaledZ], ft, bn.disabled, Dr, Oe, D.id, M.rasterBoundsBuffer, M.quadTriangleIndexBuffer, M.rasterBoundsSegments);
}
})(l, m, v, _);
break;
case "background":
(function(M, I, D, j) {
const W = D.paint.get("background-color"), Y = D.paint.get("background-opacity");
if (Y === 0)
return;
const J = M.context, ct = J.gl, ft = M.transform, Qt = ft.tileSize, Lt = D.paint.get("background-pattern");
if (M.isPatternMissing(Lt))
return;
const Et = !Lt && W.a === 1 && Y === 1 && M.opaquePassEnabledForLayer() ? "opaque" : "translucent";
if (M.renderPass !== Et)
return;
const Ht = An.disabled, Ct = M.depthModeForSublayer(0, Et === "opaque" ? Gr.ReadWrite : Gr.ReadOnly), _t = M.colorModeForRenderPass(), Nt = M.useProgram(Lt ? "backgroundPattern" : "background"), Dt = j || ft.coveringTiles({ tileSize: Qt, terrain: M.style.map.terrain });
Lt && (J.activeTexture.set(ct.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 = Lt ? C3(we, Y, M, Lt, { tileID: he, tileSize: Qt }, Wt) : A3(we, Y, W), tr = M.style.map.terrain && M.style.map.terrain.getTerrainData(he);
Nt.draw(J, ct.TRIANGLES, Ct, Ht, _t, bn.disabled, De, tr, D.id, M.tileExtentBuffer, M.quadTriangleIndexBuffer, M.tileExtentSegments);
}
})(l, 0, v, _);
break;
case "custom":
(function(M, I, D) {
const j = M.context, W = D.implementation;
if (M.renderPass === "offscreen") {
const Y = W.prerender;
Y && (M.setCustomLayerDefaults(), j.setColorMode(M.colorModeForRenderPass()), Y.call(W, 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 = W.renderingMode === "3d" ? new Gr(M.context.gl.LEQUAL, Gr.ReadWrite, M.depthRangeFor3D) : M.depthModeForSublayer(0, Gr.ReadOnly);
j.setDepthMode(Y), W.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, _, M) {
if (!v[0] && !v[1])
return l;
const I = M ? _ === "map" ? this.transform.angle : 0 : _ === "viewport" ? -this.transform.angle : 0;
if (I) {
const W = Math.sin(I), Y = Math.cos(I);
v = [v[0] * Y - v[1] * W, v[0] * W + v[1] * Y];
}
const D = [M ? v[0] : Hr(m, v[0], this.transform.zoom), M ? v[1] : Hr(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 lt(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 _ = 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 * _;
return a.b1(D, D, [j, j, 1 / D[3], j]);
}), I = [[0, 1, 2], [6, 5, 4], [0, 3, 7], [2, 1, 5], [3, 2, 6], [0, 4, 5]].map((D) => {
const j = function(ct, ft) {
var Qt = ft[0], Lt = ft[1], Et = ft[2], Ht = Qt * Qt + Lt * Lt + Et * Et;
return Ht > 0 && (Ht = 1 / Math.sqrt(Ht)), ct[0] = ft[0] * Ht, ct[1] = ft[1] * Ht, ct[2] = ft[2] * Ht, ct;
}([], function(ct, ft, Qt) {
var Lt = ft[0], Et = ft[1], Ht = ft[2], Ct = Qt[0], _t = Qt[1], Nt = Qt[2];
return ct[0] = Et * Nt - Ht * _t, ct[1] = Ht * Ct - Lt * Nt, ct[2] = Lt * _t - Et * Ct, ct;
}([], $([], M[D[0]], M[D[1]]), $([], M[D[2]], M[D[1]]))), W = -((Y = j)[0] * (J = M[D[1]])[0] + Y[1] * J[1] + Y[2] * J[2]);
var Y, J;
return j.concat(W);
});
return new _1(M, I);
}
}
class A1 {
constructor(l, m) {
this.min = l, this.max = m, this.center = function(v, _, M) {
return v[0] = 0.5 * _[0], v[1] = 0.5 * _[1], v[2] = 0.5 * _[2], v;
}([], function(v, _, M) {
return v[0] = _[0] + M[0], v[1] = _[1] + M[1], v[2] = _[2] + M[2], v;
}([], this.min, this.max));
}
quadrant(l) {
const m = [l % 2 == 0, l < 2], v = F(this.min), _ = F(this.max);
for (let M = 0; M < m.length; M++)
v[M] = m[M] ? this.min[M] : this.center[M], _[M] = m[M] ? this.center[M] : this.max[M];
return _[2] = this.max[2], new A1(v, _);
}
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 _ = 0; _ < l.planes.length; _++) {
const M = l.planes[_];
let I = 0;
for (let D = 0; D < m.length; D++)
a.b2(M, m[D]) >= 0 && I++;
if (I === 0)
return 0;
I !== m.length && (v = !1);
}
if (v)
return 2;
for (let _ = 0; _ < 3; _++) {
let M = Number.MAX_VALUE, I = -Number.MAX_VALUE;
for (let D = 0; D < l.points.length; D++) {
const j = l.points[D][_] - this.min[_];
M = Math.min(M, j), I = Math.max(I, j);
}
if (I < 0 || M > this.max[_] - this.min[_])
return 0;
}
return 1;
}
}
class Ai {
constructor(l = 0, m = 0, v = 0, _ = 0) {
if (isNaN(l) || l < 0 || isNaN(m) || m < 0 || isNaN(v) || v < 0 || isNaN(_) || _ < 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 = _;
}
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), _ = a.ac((this.top + m - this.bottom) / 2, 0, m);
return new a.P(v, _);
}
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 Po = 85.051129;
class ko {
constructor(l, m, v, _, M) {
this.tileSize = 512, this._renderWorldCopies = M === void 0 || !!M, this._minZoom = l || 0, this._maxZoom = m || 22, this._minPitch = v ?? 0, this._maxPitch = _ ?? 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 ko(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, _, M) {
var I = _[0], D = _[1], j = _[2], W = _[3], Y = Math.sin(M), J = Math.cos(M);
v[0] = I * J + j * Y, v[1] = D * J + W * Y, v[2] = I * -Y + j * J, v[3] = D * -Y + W * 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)), _ = this.pointCoordinate(new a.P(this.width, 0)), M = this.pointCoordinate(new a.P(this.width, this.height)), I = this.pointCoordinate(new a.P(0, this.height)), D = Math.floor(Math.min(v.x, _.x, M.x, I.x)), j = Math.floor(Math.max(v.x, _.x, M.x, I.x)), W = 1;
for (let Y = D - W; Y <= j + W; Y++)
Y !== 0 && m.push(new a.b4(Y, l));
}
return m;
}
coveringTiles(l) {
var m, v;
let _ = this.coveringZoomLevel(l);
const M = _;
if (l.minzoom !== void 0 && _ < l.minzoom)
return [];
l.maxzoom !== void 0 && _ > l.maxzoom && (_ = l.maxzoom);
const I = this.pointCoordinate(this.getCameraPoint()), D = a.Z.fromLngLat(this.center), j = Math.pow(2, _), W = [j * I.x, j * I.y, 0], Y = [j * D.x, j * D.y, 0], J = _1.fromInvProjectionMatrix(this.invModelViewProjectionMatrix, this.worldSize, _);
let ct = l.minzoom || 0;
!l.terrain && this.pitch <= 60 && this._edgeInsets.top < 0.1 && (ct = _);
const ft = l.terrain ? 2 / Math.min(this.tileSize, l.tileSize) * this.tileSize : 3, Qt = (_t) => ({ aabb: new A1([_t * j, 0, 0], [(_t + 1) * j, j, 0]), zoom: 0, x: 0, y: 0, wrap: _t, fullyVisible: !1 }), Lt = [], Et = [], Ht = _, Ct = l.reparseOverscaled ? M : _;
if (this._renderWorldCopies)
for (let _t = 1; _t <= 3; _t++)
Lt.push(Qt(-_t)), Lt.push(Qt(_t));
for (Lt.push(Qt(0)); Lt.length > 0; ) {
const _t = Lt.pop(), Nt = _t.x, Dt = _t.y;
let Wt = _t.fullyVisible;
if (!Wt) {
const Oe = _t.aabb.intersects(J);
if (Oe === 0)
continue;
Wt = Oe === 2;
}
const he = l.terrain ? W : Y, we = _t.aabb.distanceX(he), De = _t.aabb.distanceY(he), tr = Math.max(Math.abs(we), Math.abs(De));
if (_t.zoom === Ht || tr > ft + (1 << Ht - _t.zoom) - 2 && _t.zoom >= ct) {
const Oe = Ht - _t.zoom, Ce = W[0] - 0.5 - (Nt << Oe), ur = W[1] - 0.5 - (Dt << Oe);
Et.push({ tileID: new a.S(_t.zoom === Ht ? Ct : _t.zoom, _t.wrap, _t.zoom, Nt, Dt), distanceSq: rt([Y[0] - 0.5 - Nt, Y[1] - 0.5 - Dt]), tileDistanceToCamera: Math.sqrt(Ce * Ce + ur * ur) });
} else
for (let Oe = 0; Oe < 4; Oe++) {
const Ce = (Nt << 1) + Oe % 2, ur = (Dt << 1) + (Oe >> 1), Dr = _t.zoom + 1;
let Ie = _t.aabb.quadrant(Oe);
if (l.terrain) {
const Ze = new a.S(Dr, _t.wrap, Dr, Ce, ur), Or = l.terrain.getMinMaxElevation(Ze), ei = (m = Or.minElevation) !== null && m !== void 0 ? m : this.elevation, Zr = (v = Or.maxElevation) !== null && v !== void 0 ? v : this.elevation;
Ie = new A1([Ie.min[0], Ie.min[1], ei], [Ie.max[0], Ie.max[1], Zr]);
}
Lt.push({ aabb: Ie, zoom: Dr, x: Ce, y: ur, wrap: _t.wrap, fullyVisible: Wt });
}
}
return Et.sort((_t, Nt) => _t.distanceSq - Nt.distanceSq).map((_t) => _t.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, Po);
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, _ = this.pointLocation(this.centerPoint, l), M = l.getElevationForLngLatZoom(_, this.tileZoom);
if (!(this.elevation - M))
return;
const I = v + m - M, D = Math.cos(this._pitch) * this.cameraToCenterDistance / I / a.b5(1, _.lat), j = this.scaleZoom(D / this.tileSize);
this._elevation = M, this._center = _, this.zoom = j;
}
setLocationAtPoint(l, m) {
const v = this.pointCoordinate(m), _ = this.pointCoordinate(this.centerPoint), M = this.locationCoordinate(l), I = new a.Z(M.x - (v.x - _.x), M.y - (v.y - _.y));
this.center = this.coordinateLocation(I), 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 ct = m.pointCoordinate(l);
if (ct != null)
return ct;
}
const v = [l.x, l.y, 0, 1], _ = [l.x, l.y, 1, 1];
a.af(v, v, this.pixelMatrixInverse), a.af(_, _, this.pixelMatrixInverse);
const M = v[3], I = _[3], D = v[1] / M, j = _[1] / I, W = v[2] / M, Y = _[2] / I, J = W === Y ? 0 : (0 - W) / (Y - W);
return new a.Z(a.y.number(v[0] / M, _[0] / I, J) / this.worldSize, a.y.number(D, j, J) / this.worldSize);
}
coordinatePoint(l, m = 0, v = this.pixelMatrix) {
const _ = [l.x * this.worldSize, l.y * this.worldSize, m, 1];
return a.af(_, _, v), new a.P(_[0] / _[3], _[1] / _[3]);
}
getBounds() {
const l = Math.max(0, this.height / 2 - this.getHorizon());
return new Ot().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 Ot([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, Po]);
}
calculateTileMatrix(l) {
const m = l.canonical, v = this.worldSize / this.zoomScale(m.z), _ = m.x + Math.pow(2, m.z) * l.wrap, M = a.an(new Float64Array(16));
return a.J(M, M, [_ * 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, _ = m ? this._alignedPosMatrixCache : this._posMatrixCache;
if (_[v])
return _[v];
const M = this.calculateTileMatrix(l);
return a.L(M, m ? this.alignedModelViewProjectionMatrix : this.modelViewProjectionMatrix, M), _[v] = new Float32Array(M), _[v];
}
calculateFogMatrix(l) {
const m = l.key, v = this._fogMatrixCache;
if (v[m])
return v[m];
const _ = this.calculateTileMatrix(l);
return a.L(_, this.fogMatrix, _), v[m] = new Float32Array(_), 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 _ = this.lngRange;
if (!this._renderWorldCopies && _ === null) {
const _t = 179.9999999999;
_ = [-_t, _t];
}
const M = this.tileSize * this.zoomScale(v.zoom);
let I = 0, D = M, j = 0, W = M, Y = 0, J = 0;
const { x: ct, y: ft } = this.size;
if (this.latRange) {
const _t = this.latRange;
I = a.Q(_t[1]) * M, D = a.Q(_t[0]) * M, D - I < ft && (Y = ft / (D - I));
}
_ && (j = a.b3(a.O(_[0]) * M, 0, M), W = a.b3(a.O(_[1]) * M, 0, M), W < j && (W += M), W - j < ct && (J = ct / (W - j)));
const { x: Qt, y: Lt } = this.project.call({ worldSize: M }, l);
let Et, Ht;
const Ct = Math.max(J || 0, Y || 0);
if (Ct) {
const _t = new a.P(J ? (W + j) / 2 : Qt, Y ? (D + I) / 2 : Lt);
return v.center = this.unproject.call({ worldSize: M }, _t).wrap(), v.zoom += this.scaleZoom(Ct), v;
}
if (this.latRange) {
const _t = ft / 2;
Lt - _t < I && (Ht = I + _t), Lt + _t > D && (Ht = D - _t);
}
if (_) {
const _t = (j + W) / 2;
let Nt = Qt;
this._renderWorldCopies && (Nt = a.b3(Qt, _t - M / 2, _t + M / 2));
const Dt = ct / 2;
Nt - Dt < j && (Et = j + Dt), Nt + Dt > W && (Et = W - Dt);
}
if (Et !== void 0 || Ht !== void 0) {
const _t = new a.P(Et ?? Qt, Ht ?? Lt);
v.center = this.unproject.call({ worldSize: M }, _t).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 _ = a.an(new Float64Array(16));
a.K(_, _, [this.width / 2, -this.height / 2, 1]), a.J(_, _, [1, -1, 0]), this.labelPlaneMatrix = _, _ = a.an(new Float64Array(16)), a.K(_, _, [1, -1, 1]), a.J(_, _, [-1, -1, 0]), a.K(_, _, [2 / this.width, 2 / this.height, 1]), this.glCoordMatrix = _;
const M = this.cameraToCenterDistance + this._elevation * this._pixelPerMeter / Math.cos(this._pitch), I = Math.min(this.elevation, this.minElevationForCurrentTile), D = M - I * this._pixelPerMeter / Math.cos(this._pitch), j = I < 0 ? D : M, W = 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 - W - Y, 0.01, Math.PI - 0.01)), ct = this.getHorizon(), ft = 2 * Math.atan(ct / this.cameraToCenterDistance) * (0.5 + l.y / (2 * ct)), Qt = Math.sin(ft) * j / Math.sin(a.ac(Math.PI - W - ft, 0.01, Math.PI - 0.01)), Lt = Math.min(J, Qt);
this.farZ = 1.01 * (Math.cos(Math.PI / 2 - this._pitch) * Lt + j), this.nearZ = this.height / 50, _ = new Float64Array(16), a.b6(_, this._fov, this.width / this.height, this.nearZ, this.farZ), _[8] = 2 * -l.x / this.width, _[9] = 2 * l.y / this.height, this.projectionMatrix = a.ae(_), a.K(_, _, [1, -1, 1]), a.J(_, _, [0, 0, -this.cameraToCenterDistance]), a.b7(_, _, this._pitch), a.ad(_, _, this.angle), a.J(_, _, [-m, -v, 0]), this.mercatorMatrix = a.K([], _, [this.worldSize, this.worldSize, this.worldSize]), a.K(_, _, [1, 1, this._pixelPerMeter]), this.pixelMatrix = a.L(new Float64Array(16), this.labelPlaneMatrix, _), a.J(_, _, [0, 0, -this.elevation]), this.modelViewProjectionMatrix = _, this.invModelViewProjectionMatrix = a.as([], _), 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, _);
const Et = this.width % 2 / 2, Ht = this.height % 2 / 2, Ct = Math.cos(this.angle), _t = Math.sin(this.angle), Nt = m - Math.round(m) + Ct * Et + _t * Ht, Dt = v - Math.round(v) + Ct * Ht + _t * Et, Wt = new Float64Array(_);
if (a.J(Wt, Wt, [Nt > 0.5 ? Nt - 1 : Nt, Dt > 0.5 ? Dt - 1 : Dt, 0]), this.alignedModelViewProjectionMatrix = Wt, _ = a.as(new Float64Array(16), this.pixelMatrix), !_)
throw new Error("failed to invert matrix");
this.pixelMatrixInverse = _, 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, _ = m.y, M = m.x, I = m.y;
for (const D of l)
v = Math.min(v, D.x), _ = Math.min(_, D.y), M = Math.max(M, D.x), I = Math.max(I, D.y);
return [new a.P(v, _), new a.P(M, _), new a.P(M, I), new a.P(v, I), new a.P(v, _)];
}
}
lngLatToCameraDepth(l, m) {
const v = this.locationCoordinate(l), _ = [v.x * this.worldSize, v.y * this.worldSize, m, 1];
return a.af(_, _, this.modelViewProjectionMatrix), _[2] / _[3];
}
}
function hs(E, l) {
let m, v = !1, _ = null, M = null;
const I = () => {
_ = null, v && (E.apply(M, m), _ = setTimeout(I, l), v = !1);
};
return (...D) => (v = !0, M = this, m = D, _ || I(), _);
}
class S2 {
constructor(l) {
this._getCurrentHash = () => {
const m = window.location.hash.replace("#", "");
if (this._hashName) {
let v;
return m.split("&").map((_) => _.split("=")).forEach((_) => {
_[0] === this._hashName && (v = _);
}), (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 _ = v;
_.split("&").length > 0 && (_ = _.split("&")[0]), this._hashName && (_ = `${this._hashName}=${v}`);
let M = window.location.hash.replace(_, "");
M.startsWith("#&") ? M = M.slice(0, 1) + M.slice(2) : M === "#" && (M = "");
let I = window.location.href.replace(/(#.+)?$/, M);
I = I.replace("&&", "&"), window.history.replaceState(window.history.state, null, I);
}, 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, _ = Math.ceil((v * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10), M = Math.pow(10, _), I = Math.round(m.lng * M) / M, D = Math.round(m.lat * M) / M, j = this._map.getBearing(), W = this._map.getPitch();
let Y = "";
if (Y += l ? `/${I}/${D}/${v}` : `${v}/${D}/${I}`, (j || W) && (Y += "/" + Math.round(10 * j) / 10), W && (Y += `/${Math.round(W)}`), this._hashName) {
const J = this._hashName;
let ct = !1;
const ft = window.location.hash.slice(1).split("&").map((Qt) => {
const Lt = Qt.split("=")[0];
return Lt === J ? (ct = !0, `${Lt}=${Y}`) : Qt;
}).filter((Qt) => Qt);
return ct || 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), Mc = a.e({ deceleration: 20, maxSpeed: 1400 }, ds), Ml = 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, _ = {};
if (m.pan.mag()) {
const M = fo(m.pan.mag(), v, a.e({}, Y4, l || {}));
_.offset = m.pan.mult(M.amount / m.pan.mag()), _.center = this._map.transform.center, ps(_, M);
}
if (m.zoom) {
const M = fo(m.zoom, v, Mc);
_.zoom = this._map.transform.zoom + M.amount, ps(_, M);
}
if (m.bearing) {
const M = fo(m.bearing, v, Ml);
_.bearing = this._map.transform.bearing + a.ac(M.amount, -179, 179), ps(_, M);
}
if (m.pitch) {
const M = fo(m.pitch, v, wn);
_.pitch = this._map.transform.pitch + M.amount, ps(_, M);
}
if (_.zoom || _.bearing) {
const M = m.pinchAround === void 0 ? m.around : m.pinchAround;
_.around = M ? this._map.unproject(M) : this._map.getCenter();
}
return this.clear(), a.e(_, { noMoveStart: !0 });
}
}
function ps(E, l) {
(!E.duration || E.duration < l.duration) && (E.duration = l.duration, E.easing = l.easing);
}
function fo(E, l, m) {
const { maxSpeed: v, linearity: _, deceleration: M } = m, I = a.ac(E * _ / (l / 1e3), -v, v), D = Math.abs(I) / (M * _);
return { easing: m.easing, duration: 1e3 * D, amount: I * (D / 2) };
}
class Gi extends a.k {
preventDefault() {
this._defaultPrevented = !0;
}
get defaultPrevented() {
return this._defaultPrevented;
}
constructor(l, m, v, _ = {}) {
const M = Q.mousePos(m.getCanvas(), v), I = m.unproject(M);
super(l, a.e({ point: M, lngLat: I, originalEvent: v }, _)), 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 _ = l === "touchend" ? v.changedTouches : v.touches, M = Q.touchPos(m.getCanvasContainer(), _), I = M.map((j) => m.unproject(j)), D = M.reduce((j, W, Y, J) => j.add(W.div(J.length)), new a.P(0, 0));
super(l, { points: M, point: D, lngLats: I, 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 C1 {
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 Zi {
constructor(l, m) {
this._map = l, this._tr = new C1(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 _ = 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(_.x, v.x), I = Math.max(_.x, v.x), D = Math.min(_.y, v.y), j = Math.max(_.y, v.y);
Q.setTransform(this._box, `translate(${M}px,${D}px)`), this._box.style.width = I - M + "px", this._box.style.height = j - D + "px";
}
mouseupWindow(l, m) {
if (!this._active || l.button !== 0)
return;
const v = this._startPos, _ = m;
if (this.reset(), Q.suppressClick(), v.x !== _.x || v.y !== _.y)
return this._map.fire(new a.k("boxzoomend", { originalEvent: l })), { cameraAnimation: (M) => M.fitScreenCoordinates(v, _, 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 Vo(E, l) {
if (E.length !== l.length)
throw new Error(`The number of touches and points are not equal - touches ${E.length}, points ${l.length}`);
const m = {};
for (let v = 0; v < E.length; v++)
m[E[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(_) {
const M = new a.P(0, 0);
for (const I of _)
M._add(I);
return M.div(_.length);
}(m), this.touches = Vo(v, m)));
}
touchmove(l, m, v) {
if (this.aborted || !this.centroid)
return;
const _ = Vo(v, m);
for (const M in this.touches) {
const I = _[M];
(!I || I.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 _ = !this.aborted && this.centroid;
if (this.reset(), _)
return _;
}
}
}
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 _ = this.singleTap.touchend(l, m, v);
if (_) {
const M = l.timeStamp - this.lastTime < 500, I = !this.lastTap || this.lastTap.dist(_) < 30;
if (M && I || this.reset(), this.count++, this.lastTime = l.timeStamp, this.lastTap = _, this.count === this.numTaps)
return this.reset(), _;
}
}
}
class Ts {
constructor(l) {
this._tr = new C1(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 _ = this._zoomIn.touchend(l, m, v), M = this._zoomOut.touchend(l, m, v), I = this._tr;
return _ ? (this._active = !0, l.preventDefault(), setTimeout(() => this.reset(), 0), { cameraAnimation: (D) => D.easeTo({ duration: 300, zoom: I.zoom + 1, around: I.unproject(_) }, { originalEvent: l }) }) : M ? (this._active = !0, l.preventDefault(), setTimeout(() => this.reset(), 0), { cameraAnimation: (D) => D.easeTo({ duration: 300, zoom: I.zoom - 1, around: I.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 _ = m.length ? m[0] : m;
return !this._moved && _.dist(v) < this._clickTolerance ? void 0 : (this._moved = !0, this._lastPoint = _, this._move(v, _));
}
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 _ = wa[v];
return m.buttons === void 0 || (m.buttons & _) !== _;
}(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 = (E) => {
E.mousedown = E.dragStart, E.mousemoveWindow = E.dragMove, E.mouseup = E.dragEnd, E.contextmenu = (l) => {
l.preventDefault();
};
}, Ec = ({ enable: E, clickTolerance: l, bearingDegreesPerPixelMoved: m = 0.8 }) => {
const v = new N3({ checkCorrectEvent: (_) => Q.mouseButton(_) === 0 && _.ctrlKey || Q.mouseButton(_) === 2 });
return new Qo({ clickTolerance: l, move: (_, M) => ({ bearingDelta: (M.x - _.x) * m }), moveStateManager: v, enable: E, assignEvents: $s });
}, Sc = ({ enable: E, clickTolerance: l, pitchDegreesPerPixelMoved: m = -0.5 }) => {
const v = new N3({ checkCorrectEvent: (_) => Q.mouseButton(_) === 0 && _.ctrlKey || Q.mouseButton(_) === 2 });
return new Qo({ clickTolerance: l, move: (_, M) => ({ pitchDelta: (M.y - _.y) * m }), moveStateManager: v, enable: E, 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 _ = Vo(v, m), M = new a.P(0, 0), I = new a.P(0, 0);
let D = 0;
for (const W in _) {
const Y = _[W], J = this._touches[W];
J && (M._add(Y), I._add(Y.sub(J)), D++, _[W] = Y);
}
if (this._touches = _, this._shouldBePrevented(D) || !I.mag())
return;
const j = I.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 El {
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 [_, M] = this._firstTwoTouches, I = P0(v, m, _), D = P0(v, m, M);
if (!I || !D)
return;
const j = this._aroundCenter ? null : I.add(D).div(2);
return this._move([I, D], j, l);
}
touchend(l, m, v) {
if (!this._firstTwoTouches)
return;
const [_, M] = this._firstTwoTouches, I = P0(v, m, _), D = P0(v, m, M);
I && 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 P0(E, l, m) {
for (let v = 0; v < E.length; v++)
if (E[v].identifier === m)
return l[v];
}
function Hc(E, l) {
return Math.log(E / l) / Math.LN2;
}
class Ac extends El {
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 Cc(E, l) {
return 180 * E.angleWith(l) / Math.PI;
}
class Oc extends El {
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 _ = this._vector;
if (this._vector = l[0].sub(l[1]), this._active || !this._isBelowThreshold(this._vector))
return this._active = !0, { bearingDelta: Cc(this._vector, _), pinchAround: m };
}
_isBelowThreshold(l) {
this._minDiameter = Math.min(this._minDiameter, l.mag());
const m = 25 / (Math.PI * this._minDiameter) * 360, v = Cc(l, this._startVector);
return Math.abs(v) < m;
}
}
function Sl(E) {
return Math.abs(E.y) > Math.abs(E.x);
}
class t6 extends El {
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 _ = l[0].sub(this._lastPoints[0]), M = l[1].sub(this._lastPoints[1]);
return this._valid = this.gestureBeginsVertically(_, M, v.timeStamp), this._valid ? (this._lastPoints = l, this._active = !0, { pitchDelta: (_.y + M.y) / 2 * -0.5 }) : void 0;
}
gestureBeginsVertically(l, m, v) {
if (this._valid !== void 0)
return this._valid;
const _ = l.mag() >= 2, M = m.mag() >= 2;
if (!_ && !M)
return;
if (!_ || !M)
return this._firstMove === void 0 && (this._firstMove = v), v - this._firstMove < 100 && void 0;
const I = l.y > 0 == m.y > 0;
return Sl(l) && Sl(m) && I;
}
}
const Qp = { panStep: 100, bearingStep: 15, pitchStep: 10 };
class r2 {
constructor(l) {
this._tr = new C1(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, _ = 0, M = 0, I = 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 ? _ = 1 : (l.preventDefault(), I = -1);
break;
case 40:
l.shiftKey ? _ = -1 : (l.preventDefault(), I = 1);
break;
default:
return;
}
return this._rotationDisabled && (v = 0, _ = 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 + _ * this._pitchStep, offset: [-M * this._panStep, -I * 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(E) {
return E * (2 - E);
}
const Pc = 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 C1(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(), _ = v - (this._lastWheelEventTime || 0);
this._lastWheelEventTime = v, m !== 0 && m % Pc == 0 ? this._type = "wheel" : m !== 0 && Math.abs(m) < 4 ? this._type = "trackpad" : _ > 400 ? (this._type = null, this._lastValue = m, this._timeout = setTimeout(this._onTimeout, 40, l)) : this._type || (this._type = Math.abs(_ * 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) > Pc ? this._wheelZoomRate : this._defaultZoomRate;
let W = 2 / (1 + Math.exp(-Math.abs(this._delta * j)));
this._delta < 0 && W !== 0 && (W = 1 / W);
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 * W))), 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, _ = this._easing;
let M, I = !1;
const D = f.now() - this._lastWheelEventTime;
if (this._type === "wheel" && v && _ && D) {
const j = Math.min(D / 200, 1), W = _(j);
M = a.y.number(v, m, W), j < 1 ? this._frameId || (this._frameId = !0) : I = !0;
} else
M = m, I = !0;
return this._active = !0, I && (this._active = !1, this._finishTimeout = setTimeout(() => {
this._zooming = !1, this._triggerRenderFrame(), delete this._targetZoom, delete this._finishTimeout;
}, 200)), { noInertia: !0, needsRenderFrame: !I, zoomDelta: M - l.zoom, around: this._aroundPoint, originalEvent: this._lastWheelEvent };
}
_smoothOutEasing(l) {
let m = a.b9;
if (this._prevEase) {
const v = this._prevEase, _ = (f.now() - v.start) / v.duration, M = v.easing(_ + 0.01) - v.easing(_), I = 0.27 / Math.sqrt(M * M + 1e-4) * 0.01, D = Math.sqrt(0.0729 - I * I);
m = a.b8(I, 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 C1(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 _ = m[0], M = l.timeStamp - this._tapTime < 500, I = this._tapPoint.dist(_) < 30;
M && I ? v.length > 0 && (this._swipePoint = _, 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 _ = m[0], M = _.y - this._swipePoint.y;
return this._swipePoint = _, 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 _ = this._tap.touchend(l, m, v);
_ && (this._tapTime = l.timeStamp, this._tapPoint = _);
}
}
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 kc {
constructor(l, m, v, _) {
this._el = l, this._touchZoom = m, this._touchRotate = v, this._tapDragZoom = _, 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"), _ = document.createElement("div");
_.className = "maplibregl-desktop-message", _.textContent = m, this._container.appendChild(_);
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 = (E) => E.zoom || E.drag || E.pitch || E.rotate;
class nr extends a.k {
}
function Hl(E) {
return E.panDelta && E.panDelta.mag() || E.zoomDelta || E.bearingDelta || E.pitchDelta;
}
class Vc {
constructor(l, m) {
this.handleWindowEvent = (_) => {
this.handleEvent(_, `${_.type}Window`);
}, this.handleEvent = (_, M) => {
if (_.type === "blur")
return void this.stop(!0);
this._updatingCamera = !0;
const I = _.type === "renderFrame" ? void 0 : _, D = { needsRenderFrame: !1 }, j = {}, W = {}, Y = _.touches, J = Y ? this._getMapTouches(Y) : void 0, ct = J ? Q.touchPos(this._map.getCanvas(), J) : Q.mousePos(this._map.getCanvas(), _);
for (const { handlerName: Lt, handler: Et, allowed: Ht } of this._handlers) {
if (!Et.isEnabled())
continue;
let Ct;
this._blockedByActive(W, Ht, Lt) ? Et.reset() : Et[M || _.type] && (Ct = Et[M || _.type](_, ct, J), this.mergeHandlerResult(D, j, Ct, Lt, I), Ct && Ct.needsRenderFrame && this._triggerRenderFrame()), (Ct || Et.isActive()) && (W[Lt] = Et);
}
const ft = {};
for (const Lt in this._previousActiveHandlers)
W[Lt] || (ft[Lt] = I);
this._previousActiveHandlers = W, (Object.keys(ft).length || Hl(D)) && (this._changes.push([D, j, ft]), this._triggerRenderFrame()), (Object.keys(W).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 [_, M, I] of this._listeners)
Q.addEventListener(_, M, _ === document ? this.handleWindowEvent : this.handleEvent, I);
}
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 _ = m.boxZoom = new Zi(m, l);
this._add("boxZoom", _), l.interactive && l.boxZoom && _.enable();
const M = m.cooperativeGestures = new e6(m, l.cooperativeGestures);
this._add("cooperativeGestures", M), l.cooperativeGestures && M.enable();
const I = new Ts(m), D = new f_(m);
m.doubleClickZoom = new F3(D, I), this._add("tapZoom", I), this._add("clickZoom", D), l.interactive && l.doubleClickZoom && m.doubleClickZoom.enable();
const j = new Q_();
this._add("tapDragZoom", j);
const W = m.touchPitch = new t6(m);
this._add("touchPitch", W), l.interactive && l.touchPitch && m.touchPitch.enable(l.touchPitch);
const Y = Ec(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 ct = (({ enable: Ct, clickTolerance: _t }) => {
const Nt = new N3({ checkCorrectEvent: (Dt) => Q.mouseButton(Dt) === 0 && !Dt.ctrlKey });
return new Qo({ clickTolerance: _t, move: (Dt, Wt) => ({ around: Wt, panDelta: Wt.sub(Dt) }), activateOnStart: !0, moveStateManager: Nt, enable: Ct, assignEvents: $s });
})(l), ft = new D3(l, m);
m.dragPan = new mp(v, ct, ft), this._add("mousePan", ct), this._add("touchPan", ft, ["touchZoom", "touchRotate"]), l.interactive && l.dragPan && m.dragPan.enable(l.dragPan);
const Qt = new Oc(), Lt = new Ac();
m.touchZoomRotate = new kc(v, Lt, Qt, j), this._add("touchRotate", Qt, ["touchPan", "touchZoom"]), this._add("touchZoom", Lt, ["touchPan", "touchRotate"]), l.interactive && l.touchZoomRotate && m.touchZoomRotate.enable(l.touchZoomRotate);
const Et = m.scrollZoom = new A2(m, () => this._triggerRenderFrame());
this._add("scrollZoom", Et, ["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 _ in l)
if (_ !== v && (!m || m.indexOf(_) < 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, _, M) {
if (!v)
return;
a.e(l, v);
const I = { handlerName: _, originalEvent: v.originalEvent || M };
v.zoomDelta !== void 0 && (m.zoom = I), v.panDelta !== void 0 && (m.drag = I), v.pitchDelta !== void 0 && (m.pitch = I), v.bearingDelta !== void 0 && (m.rotate = I);
}
_applyChanges() {
const l = {}, m = {}, v = {};
for (const [_, M, I] of this._changes)
_.panDelta && (l.panDelta = (l.panDelta || new a.P(0, 0))._add(_.panDelta)), _.zoomDelta && (l.zoomDelta = (l.zoomDelta || 0) + _.zoomDelta), _.bearingDelta && (l.bearingDelta = (l.bearingDelta || 0) + _.bearingDelta), _.pitchDelta && (l.pitchDelta = (l.pitchDelta || 0) + _.pitchDelta), _.around !== void 0 && (l.around = _.around), _.pinchAround !== void 0 && (l.pinchAround = _.pinchAround), _.noInertia && (l.noInertia = _.noInertia), a.e(m, M), a.e(v, I);
this._updateMapTransform(l, m, v), this._changes = [];
}
_updateMapTransform(l, m, v) {
const _ = this._map, M = _._getTransformForUpdate(), I = _.terrain;
if (!(Hl(l) || I && this._terrainMovement))
return this._fireEvents(m, v, !0);
let { panDelta: D, zoomDelta: j, bearingDelta: W, pitchDelta: Y, around: J, pinchAround: ct } = l;
ct !== void 0 && (J = ct), _._stop(!0), J = J || _.transform.centerPoint;
const ft = M.pointLocation(D ? J.sub(D) : J);
W && (M.bearing += W), Y && (M.pitch += Y), j && (M.zoom += j), I ? 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), _._applyUpdatedTransform(M), this._map._update(), l.noInertia || this._inertia.record(l), this._fireEvents(m, v, !0);
}
_fireEvents(l, m, v) {
const _ = n2(this._eventsInProgress), M = n2(l), I = {};
for (const J in l) {
const { originalEvent: ct } = l[J];
this._eventsInProgress[J] || (I[`${J}start`] = ct), this._eventsInProgress[J] = l[J];
}
!_ && M && this._fireEvent("movestart", M.originalEvent);
for (const J in I)
this._fireEvent(J, I[J]);
M && this._fireEvent("move", M.originalEvent);
for (const J in l) {
const { originalEvent: ct } = l[J];
this._fireEvent(J, ct);
}
const D = {};
let j;
for (const J in this._eventsInProgress) {
const { handlerName: ct, originalEvent: ft } = this._eventsInProgress[J];
this._handlersById[ct].isActive() || (delete this._eventsInProgress[J], j = m[ct] || ft, D[`${J}end`] = j);
}
for (const J in D)
this._fireEvent(J, D[J]);
const W = n2(this._eventsInProgress), Y = (_ || M) && !W;
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), ct = (ft) => ft !== 0 && -this._bearingSnap < ft && ft < this._bearingSnap;
!J || !J.essential && f.prefersReducedMotion ? (this._map.fire(new a.k("moveend", { originalEvent: j })), ct(this._map.getBearing()) && this._map.resetNorth()) : (ct(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 = Ot.convert(l).adjustAntiMeridian();
const v = m && m.bearing || 0;
return this._cameraForBoxAndBearing(l.getNorthWest(), l.getSouthEast(), v, m);
}
_cameraForBoxAndBearing(l, m, v, _) {
const M = { top: 0, bottom: 0, right: 0, left: 0 };
if (typeof (_ = a.e({ padding: M, offset: [0, 0], maxZoom: this.transform.maxZoom }, _)).padding == "number") {
const Oe = _.padding;
_.padding = { top: Oe, bottom: Oe, right: Oe, left: Oe };
}
_.padding = a.e(M, _.padding);
const I = this.transform, D = I.padding, j = new Ot(l, m), W = I.project(j.getNorthWest()), Y = I.project(j.getNorthEast()), J = I.project(j.getSouthEast()), ct = I.project(j.getSouthWest()), ft = a.ba(-v), Qt = W.rotate(ft), Lt = Y.rotate(ft), Et = J.rotate(ft), Ht = ct.rotate(ft), Ct = new a.P(Math.max(Qt.x, Lt.x, Ht.x, Et.x), Math.max(Qt.y, Lt.y, Ht.y, Et.y)), _t = new a.P(Math.min(Qt.x, Lt.x, Ht.x, Et.x), Math.min(Qt.y, Lt.y, Ht.y, Et.y)), Nt = Ct.sub(_t), Dt = (I.width - (D.left + D.right + _.padding.left + _.padding.right)) / Nt.x, Wt = (I.height - (D.top + D.bottom + _.padding.top + _.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(I.scaleZoom(I.scale * Math.min(Dt, Wt)), _.maxZoom), we = a.P.convert(_.offset), De = new a.P((_.padding.left - _.padding.right) / 2, (_.padding.top - _.padding.bottom) / 2).rotate(a.ba(v)), tr = we.add(De).mult(I.scale / I.zoomScale(he));
return { center: I.unproject(W.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, _, M) {
return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(a.P.convert(l)), this.transform.pointLocation(a.P.convert(m)), v, _), _, 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 _ = !1, M = !1, I = !1;
return "zoom" in l && v.zoom !== +l.zoom && (_ = !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 && (I = !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)), _ && 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)), I && 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, _ = 0) {
const M = a.Z.fromLngLat(l, m), I = a.Z.fromLngLat(v, _), D = I.x - M.x, j = I.y - M.y, W = I.z - M.z, Y = Math.hypot(D, j, W);
if (Y === 0)
throw new Error("Can't calculate camera options with same From and To");
const J = Math.hypot(D, j), ct = 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 = W < 0 ? 90 - Qt : 90 + Qt, { center: I.toLngLat(), zoom: ct, 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 _ = this._getTransformForUpdate(), M = _.zoom, I = _.bearing, D = _.pitch, j = _.padding, W = "bearing" in l ? this._normalizeBearing(l.bearing, I) : I, Y = "pitch" in l ? +l.pitch : D, J = "padding" in l ? l.padding : _.padding, ct = a.P.convert(l.offset);
let ft = _.centerPoint.add(ct);
const Qt = _.pointLocation(ft), { center: Lt, zoom: Et } = _.getConstrained(a.N.convert(l.center || Qt), (v = l.zoom) !== null && v !== void 0 ? v : M);
this._normalizeCenter(Lt, _);
const Ht = _.project(Qt), Ct = _.project(Lt).sub(Ht), _t = _.zoomScale(Et - M);
let Nt, Dt;
l.around && (Nt = a.N.convert(l.around), Dt = _.locationPoint(Nt));
const Wt = { moving: this._moving, zooming: this._zooming, rotating: this._rotating, pitching: this._pitching };
return this._zooming = this._zooming || Et !== M, this._rotating = this._rotating || I !== W, this._pitching = this._pitching || Y !== D, this._padding = !_.isPaddingEqual(J), this._easeId = l.easeId, this._prepareEase(m, l.noMoveStart, Wt), this.terrain && this._prepareElevation(Lt), this._ease((he) => {
if (this._zooming && (_.zoom = a.y.number(M, Et, he)), this._rotating && (_.bearing = a.y.number(I, W, he)), this._pitching && (_.pitch = a.y.number(D, Y, he)), this._padding && (_.interpolatePadding(j, J, he), ft = _.centerPoint.add(ct)), this.terrain && !l.freezeElevation && this._updateElevation(he), Nt)
_.setLocationAtPoint(Nt, Dt);
else {
const we = _.zoomScale(_.zoom - M), De = Et > M ? Math.min(2, _t) : Math.max(0.5, _t), tr = Math.pow(De, 1 - he), Oe = _.unproject(Ht.add(Ct.mult(he * tr)).mult(we));
_.setLocationAtPoint(_.renderWorldCopies ? Oe.wrap() : Oe, ft);
}
this._applyUpdatedTransform(_), 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 _ = this.calculateCameraOptionsFromTo(m.lngLat, v, l.center, l.elevation);
return { pitch: _.pitch, zoom: _.zoom };
}
return {};
}
_applyUpdatedTransform(l) {
const m = [];
if (this.terrain && m.push((_) => this._elevateCameraIfInsideTerrain(_)), this.transformCameraUpdate && m.push((_) => this.transformCameraUpdate(_)), !m.length)
return;
const v = l.clone();
for (const _ of m) {
const M = v.clone(), { center: I, zoom: D, pitch: j, bearing: W, elevation: Y } = _(M);
I && (M.center = I), D !== void 0 && (M.zoom = D), j !== void 0 && (M.pitch = j), W !== void 0 && (M.bearing = W), 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, _ = 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)), _ && 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 Ze = a.M(l, ["center", "zoom", "bearing", "pitch", "around"]);
return this.jumpTo(Ze, m);
}
this.stop(), l = a.e({ offset: [0, 0], speed: 1.2, curve: 1.42, easing: a.b9 }, l);
const _ = this._getTransformForUpdate(), M = _.zoom, I = _.bearing, D = _.pitch, j = _.padding, W = "bearing" in l ? this._normalizeBearing(l.bearing, I) : I, Y = "pitch" in l ? +l.pitch : D, J = "padding" in l ? l.padding : _.padding, ct = a.P.convert(l.offset);
let ft = _.centerPoint.add(ct);
const Qt = _.pointLocation(ft), { center: Lt, zoom: Et } = _.getConstrained(a.N.convert(l.center || Qt), (v = l.zoom) !== null && v !== void 0 ? v : M);
this._normalizeCenter(Lt, _);
const Ht = _.zoomScale(Et - M), Ct = _.project(Qt), _t = _.project(Lt).sub(Ct);
let Nt = l.curve;
const Dt = Math.max(_.width, _.height), Wt = Dt / Ht, he = _t.mag();
if ("minZoom" in l) {
const Ze = a.ac(Math.min(l.minZoom, M, Et), _.minZoom, _.maxZoom), Or = Dt / _.zoomScale(Ze - M);
Nt = Math.sqrt(Or / he * 2);
}
const we = Nt * Nt;
function De(Ze) {
const Or = (Wt * Wt - Dt * Dt + (Ze ? -1 : 1) * we * we * he * he) / (2 * (Ze ? Wt : Dt) * we * he);
return Math.log(Math.sqrt(Or * Or + 1) - Or);
}
function tr(Ze) {
return (Math.exp(Ze) - Math.exp(-Ze)) / 2;
}
function Oe(Ze) {
return (Math.exp(Ze) + Math.exp(-Ze)) / 2;
}
const Ce = De(!1);
let ur = function(Ze) {
return Oe(Ce) / Oe(Ce + Nt * Ze);
}, Dr = function(Ze) {
return Dt * ((Oe(Ce) * (tr(Or = Ce + Nt * Ze) / Oe(Or)) - tr(Ce)) / we) / he;
var Or;
}, Ie = (De(!0) - Ce) / Nt;
if (Math.abs(he) < 1e-6 || !isFinite(Ie)) {
if (Math.abs(Dt - Wt) < 1e-6)
return this.easeTo(l, m);
const Ze = Wt < Dt ? -1 : 1;
Ie = Math.abs(Math.log(Wt / Dt)) / Nt, Dr = () => 0, ur = (Or) => Math.exp(Ze * Nt * Or);
}
return l.duration = "duration" in l ? +l.duration : 1e3 * Ie / ("screenSpeed" in l ? +l.screenSpeed / Nt : +l.speed), l.maxDuration && l.duration > l.maxDuration && (l.duration = 0), this._zooming = !0, this._rotating = I !== W, this._pitching = Y !== D, this._padding = !_.isPaddingEqual(J), this._prepareEase(m, !1), this.terrain && this._prepareElevation(Lt), this._ease((Ze) => {
const Or = Ze * Ie, ei = 1 / ur(Or);
_.zoom = Ze === 1 ? Et : M + _.scaleZoom(ei), this._rotating && (_.bearing = a.y.number(I, W, Ze)), this._pitching && (_.pitch = a.y.number(D, Y, Ze)), this._padding && (_.interpolatePadding(j, J, Ze), ft = _.centerPoint.add(ct)), this.terrain && !l.freezeElevation && this._updateElevation(Ze);
const Zr = Ze === 1 ? Lt : _.unproject(Ct.add(_t.mult(Dr(Or))).mult(ei));
_.setLocationAtPoint(_.renderWorldCopies ? Zr.wrap() : Zr, ft), this._applyUpdatedTransform(_), 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 _ = this._onEaseEnd;
delete this._onEaseEnd, _.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((_) => typeof _ != "string" ? "" : _)) : typeof this.options.customAttribution == "string" && l.push(this.options.customAttribution)), this._map.style.stylesheet) {
const _ = this._map.style.stylesheet;
this.styleOwner = _.owner, this.styleId = _.id;
}
const m = this._map.style.sourceCaches;
for (const _ in m) {
const M = m[_];
if (M.used || M.usedForTerrain) {
const I = M.getSource();
I.attribution && l.indexOf(I.attribution) < 0 && l.push(I.attribution);
}
}
l = l.filter((_) => String(_).trim()), l.sort((_, M) => _.length - M.length), l = l.filter((_, M) => {
for (let I = M + 1; I < l.length; I++)
if (l[I].indexOf(_) >= 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 Ic {
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 _ of v)
if (_.id === l)
return void (_.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 _ of l.coveringTiles({ tileSize: this.tileSize, minzoom: this.minzoom, maxzoom: this.maxzoom, reparseOverscaled: !1, terrain: m }))
v[_.key] = !0, this._renderableTilesKeys.push(_.key), this._tiles[_.key] || (_.posMatrix = new Float64Array(16), a.aP(_.posMatrix, 0, a.X, 0, a.X, 0, 1), this._tiles[_.key] = new t1(_, this.tileSize));
for (const _ in this._tiles)
v[_] || delete this._tiles[_];
}
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 _ = this._tiles[v].tileID;
if (_.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 (_.canonical.isChildOf(l.canonical)) {
const M = l.clone();
M.posMatrix = new Float64Array(16);
const I = _.canonical.z - l.canonical.z, D = _.canonical.x - (_.canonical.x >> I << I), j = _.canonical.y - (_.canonical.y >> I << I), W = a.X >> I;
a.aP(M.posMatrix, 0, W, 0, W, 0, 1), a.J(M.posMatrix, M.posMatrix, [-D * W, -j * W, 0]), m[v] = M;
} else if (l.canonical.isChildOf(_.canonical)) {
const M = l.clone();
M.posMatrix = new Float64Array(16);
const I = l.canonical.z - _.canonical.z, D = l.canonical.x - (l.canonical.x >> I << I), j = l.canonical.y - (l.canonical.y >> I << I), W = a.X >> I;
a.aP(M.posMatrix, 0, a.X, 0, a.X, 0, 1), a.J(M.posMatrix, M.posMatrix, [D * W, j * W, 0]), a.K(M.posMatrix, M.posMatrix, [1 / 2 ** I, 1 / 2 ** I, 0]), m[v] = M;
}
}
return m;
}
getSourceTile(l, m) {
const v = this.sourceCache._source;
let _ = l.overscaledZ - this.deltaZoom;
if (_ > v.maxzoom && (_ = v.maxzoom), _ < v.minzoom)
return null;
this._sourceTileCache[l.key] || (this._sourceTileCache[l.key] = l.scaledTo(_).key);
let M = this.sourceCache.getTileByID(this._sourceTileCache[l.key]);
if ((!M || !M.dem) && m)
for (; _ >= v.minzoom && (!M || !M.dem); )
M = this.sourceCache.getTileByID(l.scaledTo(_--).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, _ = a.X) {
var M;
if (!(m >= 0 && m < _ && v >= 0 && v < _))
return 0;
const I = this.getTerrainData(l), D = (M = I.tile) === null || M === void 0 ? void 0 : M.dem;
if (!D)
return 0;
const j = function(Qt, Lt, Et) {
var Ht = Lt[0], Ct = Lt[1];
return Qt[0] = Et[0] * Ht + Et[4] * Ct + Et[12], Qt[1] = Et[1] * Ht + Et[5] * Ct + Et[13], Qt;
}([], [m / _ * a.X, v / _ * a.X], I.u_terrain_matrix), W = [j[0] * D.dim, j[1] * D.dim], Y = Math.floor(W[0]), J = Math.floor(W[1]), ct = W[0] - Y, ft = W[1] - J;
return D.get(Y, J) * (1 - ct) * (1 - ft) + D.get(Y + 1, J) * ct * (1 - ft) + D.get(Y, J + 1) * (1 - ct) * ft + D.get(Y + 1, J + 1) * ct * ft;
}
getElevationForLngLatZoom(l, m) {
if (!a.bb(m, l.wrap()))
return 0;
const { tileID: v, mercatorX: _, mercatorY: M } = this._getOverscaledTileIDFromLngLatZoom(l, m);
return this.getElevation(v, _ % a.X, M % a.X, a.X);
}
getElevation(l, m, v, _ = a.X) {
return this.getDEMElevation(l, m, v, _) * this.exaggeration;
}
getTerrainData(l) {
if (!this._emptyDemTexture) {
const _ = this.painter.context, M = new a.R({ width: 1, height: 1 }, new Uint8Array(4));
this._emptyDepthTexture = new lt(_, M, _.gl.RGBA, { premultiply: !1 }), this._emptyDemUnpack = [0, 0, 0, 0], this._emptyDemTexture = new lt(_, new a.R({ width: 1, height: 1 }), _.gl.RGBA, { premultiply: !1 }), this._emptyDemTexture.bind(_.gl.NEAREST, _.gl.CLAMP_TO_EDGE), this._emptyDemMatrix = a.an([]);
}
const m = this.sourceCache.getSourceTile(l, !0);
if (m && m.dem && (!m.demTexture || m.needsTerrainPrepare)) {
const _ = this.painter.context;
m.demTexture = this.painter.getTileTexture(m.dem.stride), m.demTexture ? m.demTexture.update(m.dem.getPixels(), { premultiply: !1 }) : m.demTexture = new lt(_, m.dem.getPixels(), _.gl.RGBA, { premultiply: !1 }), m.demTexture.bind(_.gl.NEAREST, _.gl.CLAMP_TO_EDGE), m.needsTerrainPrepare = !1;
}
const v = m && m + m.tileID.key + l.key;
if (v && !this._demMatrixCache[v]) {
const _ = this.sourceCache.sourceCache._source.maxzoom;
let M = l.canonical.z - m.tileID.canonical.z;
l.overscaledZ > l.canonical.z && (l.canonical.z >= _ ? M = l.canonical.z - _ : a.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));
const I = 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, [I * 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, _ = m.height / devicePixelRatio;
return !this._fbo || this._fbo.width === v && this._fbo.height === _ || (this._fbo.destroy(), this._fboCoordsTexture.destroy(), this._fboDepthTexture.destroy(), delete this._fbo, delete this._fboDepthTexture, delete this._fboCoordsTexture), this._fboCoordsTexture || (this._fboCoordsTexture = new lt(m.context, { width: v, height: _, 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 lt(m.context, { width: v, height: _, 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, _, !0, !1), this._fbo.depthAttachment.set(m.context.createRenderbuffer(m.context.gl.DEPTH_COMPONENT16, v, _))), 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, I = 0; M < this._coordsTextureSize; M++)
for (let D = 0; D < this._coordsTextureSize; D++, I += 4)
m[I + 0] = 255 & D, m[I + 1] = 255 & M, m[I + 2] = D >> 8 << 4 | M >> 8, m[I + 3] = 0;
const v = new a.R({ width: this._coordsTextureSize, height: this._coordsTextureSize }, new Uint8Array(m.buffer)), _ = new lt(l, v, l.gl.RGBA, { premultiply: !1 });
return _.bind(l.gl.NEAREST, l.gl.CLAMP_TO_EDGE), this._coordsTexture = _, _;
}
pointCoordinate(l) {
this.painter.maybeDrawDepthAndCoords(!0);
const m = new Uint8Array(4), v = this.painter.context, _ = v.gl, M = Math.round(l.x * this.painter.pixelRatio / devicePixelRatio), I = Math.round(l.y * this.painter.pixelRatio / devicePixelRatio), D = Math.round(this.painter.height / devicePixelRatio);
v.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer), _.readPixels(M, D - I - 1, 1, 1, _.RGBA, _.UNSIGNED_BYTE, m), v.bindFramebuffer.set(null);
const j = m[0] + (m[2] >> 4 << 8), W = m[1] + ((15 & m[2]) << 8), Y = this.coordsIndex[255 - m[3]], J = Y && this.sourceCache.getTileByID(Y);
if (!J)
return null;
const ct = this._coordsTextureSize, ft = (1 << J.tileID.canonical.z) * ct;
return new a.Z((J.tileID.canonical.x * ct + j) / ft + J.tileID.wrap, (J.tileID.canonical.y * ct + W) / ft, this.getElevation(J.tileID, j, W, ct));
}
depthAtPoint(l) {
const m = new Uint8Array(4), v = this.painter.context, _ = v.gl;
return v.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer), _.readPixels(l.x, this.painter.height / devicePixelRatio - l.y - 1, 1, 1, _.RGBA, _.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(), _ = this.meshSize, M = a.X / _, I = _ * _;
for (let J = 0; J <= _; J++)
for (let ct = 0; ct <= _; ct++)
m.emplaceBack(ct * M, J * M, 0);
for (let J = 0; J < I; J += _ + 1)
for (let ct = 0; ct < _; ct++)
v.emplaceBack(ct + J, _ + ct + J + 1, _ + ct + J + 2), v.emplaceBack(ct + J, _ + ct + J + 2, ct + J + 1);
const D = m.length, j = D + 2 * (_ + 1);
for (const J of [0, 1])
for (let ct = 0; ct <= _; ct++)
for (const ft of [0, 1])
m.emplaceBack(ct * M, J * a.X, ft);
for (let J = 0; J < 2 * _; 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 W = m.length, Y = W + 2 * (_ + 1);
for (const J of [0, 1])
for (let ct = 0; ct <= _; ct++)
for (const ft of [0, 1])
m.emplaceBack(J * a.X, ct * M, ft);
for (let J = 0; J < 2 * _; J += 2)
v.emplaceBack(W + J, W + J + 1, W + J + 3), v.emplaceBack(W + J, W + J + 3, W + 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: _ } = this._getOverscaledTileIDFromLngLatZoom(l, m);
return (v = this.getMinMaxElevation(_).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()), _ = (1 << m) * a.X, M = v.x * _, I = v.y * _, D = Math.floor(M / a.X), j = Math.floor(I / a.X);
return { tileID: new a.S(m, 0, m, D, j), mercatorX: M, mercatorY: I };
}
}
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 lt(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 _ = l.sourceCaches[v].getVisibleCoordinates();
for (const M of _) {
const I = this.terrain.sourceCache.getTerrainCoords(M);
for (const D in I)
this._coordsDescendingInv[v][D] || (this._coordsDescendingInv[v][D] = []), this._coordsDescendingInv[v][D].push(I[D]);
}
}
this._coordsDescendingInvStr = {};
for (const v of l._order) {
const _ = l._layers[v], M = _.source;
if (i6[_.type] && !this._coordsDescendingInvStr[M]) {
this._coordsDescendingInvStr[M] = {};
for (const I in this._coordsDescendingInv[M])
this._coordsDescendingInvStr[M][I] = this._coordsDescendingInv[M][I].map((D) => D.key).sort().join();
}
}
for (const v of this._renderableTiles)
for (const _ in this._coordsDescendingInvStr) {
const M = this._coordsDescendingInvStr[_][v.tileID.key];
M && M !== v.rttCoords[_] && (v.rtt = []);
}
}
renderLayer(l) {
if (l.isHidden(this.painter.transform.zoom))
return !1;
const m = l.type, v = this.painter, _ = 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), !_))
return !0;
if (i6[this._prevType] || i6[m] && _) {
this._prevType = m;
const M = this._stacks.length - 1, I = 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 W = this.pool.getObjectForId(D.rtt[M].id);
if (W.stamp === D.rtt[M].stamp) {
this.pool.useObject(W);
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 W = 0; W < I.length; W++) {
const Y = v.style._layers[I[W]], 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 = (E) => {
E.touchstart = E.dragStart, E.touchmoveWindow = E.dragMove, E.touchend = E.dragEnd;
}, v_ = { showCompass: !0, showZoom: !0, visualizePitch: !1 };
class __ {
constructor(l, m, v = !1) {
this.mousedown = (I) => {
this.startMouse(a.e({}, I, { ctrlKey: !0, preventDefault: () => I.preventDefault() }), Q.mousePos(this.element, I)), Q.addEventListener(window, "mousemove", this.mousemove), Q.addEventListener(window, "mouseup", this.mouseup);
}, this.mousemove = (I) => {
this.moveMouse(I, Q.mousePos(this.element, I));
}, this.mouseup = (I) => {
this.mouseRotate.dragEnd(I), this.mousePitch && this.mousePitch.dragEnd(I), this.offTemp();
}, this.touchstart = (I) => {
I.targetTouches.length !== 1 ? this.reset() : (this._startPos = this._lastPos = Q.touchPos(this.element, I.targetTouches)[0], this.startTouch(I, this._startPos), Q.addEventListener(window, "touchmove", this.touchmove, { passive: !1 }), Q.addEventListener(window, "touchend", this.touchend));
}, this.touchmove = (I) => {
I.targetTouches.length !== 1 ? this.reset() : (this._lastPos = Q.touchPos(this.element, I.targetTouches)[0], this.moveTouch(I, this._lastPos));
}, this.touchend = (I) => {
I.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 _ = l.dragRotate._mouseRotate.getClickTolerance(), M = l.dragRotate._mousePitch.getClickTolerance();
this.element = m, this.mouseRotate = Ec({ clickTolerance: _, enable: !0 }), this.touchRotate = (({ enable: I, clickTolerance: D, bearingDegreesPerPixelMoved: j = 0.8 }) => {
const W = new xa();
return new Qo({ clickTolerance: D, move: (Y, J) => ({ bearingDelta: (J.x - Y.x) * j }), moveStateManager: W, enable: I, assignEvents: Fc });
})({ clickTolerance: _, enable: !0 }), this.map = l, v && (this.mousePitch = Sc({ clickTolerance: M, enable: !0 }), this.touchPitch = (({ enable: I, clickTolerance: D, pitchDegreesPerPixelMoved: j = -0.5 }) => {
const W = new xa();
return new Qo({ clickTolerance: D, move: (Y, J) => ({ pitchDelta: (J.y - Y.y) * j }), moveStateManager: W, enable: I, 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: _ } = this.mouseRotate.dragMove(l, m) || {};
if (_ && v.setBearing(v.getBearing() + _), this.mousePitch) {
const { pitchDelta: M } = this.mousePitch.dragMove(l, m) || {};
M && v.setPitch(v.getPitch() + M);
}
}
moveTouch(l, m) {
const v = this.map, { bearingDelta: _ } = this.touchRotate.dragMove(l, m) || {};
if (_ && v.setBearing(v.getBearing() + _), 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 Io;
function ti(E, l, m) {
const v = new a.N(E.lng, E.lat);
if (E = new a.N(E.lng, E.lat), l) {
const _ = new a.N(E.lng - 360, E.lat), M = new a.N(E.lng + 360, E.lat), I = m.locationPoint(E).distSqr(l);
m.locationPoint(_).distSqr(l) < I ? E = _ : m.locationPoint(M).distSqr(l) < I && (E = M);
}
for (; Math.abs(E.lng - m.center.lng) > 180; ) {
const _ = m.locationPoint(E);
if (_.x >= 0 && _.y >= 0 && _.x <= m.width && _.y <= m.height)
break;
E.lng > m.center.lng ? E.lng -= 360 : E.lng += 360;
}
return E.lng !== v.lng && m.locationPoint(E).y > m.height / 2 - m.getHorizon() ? E : 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(E, l, m) {
const v = E.classList;
for (const _ in o6)
v.remove(`maplibregl-${m}-anchor-${_}`);
v.add(`maplibregl-${m}-anchor-${l}`);
}
class Cl extends a.E {
constructor(l) {
if (super(), this._onKeyPress = (m) => {
const v = m.code, _ = m.charCode || m.keyCode;
v !== "Space" && v !== "Enter" && _ !== 32 && _ !== 13 || this.togglePopup();
}, this._onMapClick = (m) => {
const v = m.originalEvent.target, _ = this._element;
this._popup && (v === _ || _.contains(v)) && this.togglePopup();
}, this._update = (m) => {
var v;
if (!this._map)
return;
const _ = this._map.loaded() && !this._map.isMoving();
((m == null ? void 0 : m.type) === "terrain" || (m == null ? void 0 : m.type) === "render" && !_) && 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 I = "";
this._pitchAlignment === "viewport" || this._pitchAlignment === "auto" ? I = "rotateX(0deg)" : this._pitchAlignment === "map" && (I = `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) ${I} ${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, _ = 27;
m.setAttributeNS(null, "display", "block"), m.setAttributeNS(null, "height", `${v}px`), m.setAttributeNS(null, "width", `${_}px`), m.setAttributeNS(null, "viewBox", `0 0 ${_} ${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 I = Q.createNS("http://www.w3.org/2000/svg", "g");
I.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 Ct = Q.createNS("http://www.w3.org/2000/svg", "ellipse");
Ct.setAttributeNS(null, "opacity", "0.04"), Ct.setAttributeNS(null, "cx", "10.5"), Ct.setAttributeNS(null, "cy", "5.80029008"), Ct.setAttributeNS(null, "rx", Ht.rx), Ct.setAttributeNS(null, "ry", Ht.ry), D.appendChild(Ct);
}
const W = Q.createNS("http://www.w3.org/2000/svg", "g");
W.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"), W.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 ct = Q.createNS("http://www.w3.org/2000/svg", "path");
ct.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(ct);
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 Lt = Q.createNS("http://www.w3.org/2000/svg", "circle");
Lt.setAttributeNS(null, "fill", "#000000"), Lt.setAttributeNS(null, "opacity", "0.25"), Lt.setAttributeNS(null, "cx", "5.5"), Lt.setAttributeNS(null, "cy", "5.5"), Lt.setAttributeNS(null, "r", "5.4999962");
const Et = Q.createNS("http://www.w3.org/2000/svg", "circle");
Et.setAttributeNS(null, "fill", "#FFFFFF"), Et.setAttributeNS(null, "cx", "5.5"), Et.setAttributeNS(null, "cy", "5.5"), Et.setAttributeNS(null, "r", "5.4999962"), Qt.appendChild(Lt), Qt.appendChild(Et), I.appendChild(D), I.appendChild(W), I.appendChild(J), I.appendChild(ft), I.appendChild(Qt), m.appendChild(I), m.setAttributeNS(null, "height", v * this._scale + "px"), m.setAttributeNS(null, "width", _ * 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 _ = this._map, M = _.terrain.depthAtPoint(this._pos), I = _.terrain.getElevationForLngLatZoom(this._lngLat, _.transform.tileZoom);
if (_.transform.lngLatToCameraDepth(this._lngLat, I) - M < 6e-3)
return void (this._element.style.opacity = this._opacity);
const D = -this._offset.y / _.transform._pixelPerMeter, j = Math.sin(_.getPitch() * Math.PI / 180) * D, W = _.terrain.depthAtPoint(new a.P(this._pos.x, this._pos.y - this._offset.y)), Y = _.transform.lngLatToCameraDepth(this._lngLat, I + j) - W > 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 k0 = 0, V0 = !1;
const Qs = { maxWidth: 100, unit: "metric" };
function I0(E, l, m) {
const v = m && m.maxWidth || 100, _ = E._container.clientHeight / 2, M = E.unproject([0, _]), I = E.unproject([v, _]), D = M.distanceTo(I);
if (m && m.unit === "imperial") {
const j = 3.2808 * D;
j > 5280 ? cr(l, v, j / 5280, E._getUIString("ScaleControl.Miles")) : cr(l, v, j, E._getUIString("ScaleControl.Feet"));
} else
m && m.unit === "nautical" ? cr(l, v, D / 1852, E._getUIString("ScaleControl.NauticalMiles")) : D >= 1e3 ? cr(l, v, D / 1e3, E._getUIString("ScaleControl.Kilometers")) : cr(l, v, D, E._getUIString("ScaleControl.Meters"));
}
function cr(E, l, m, v) {
const _ = function(M) {
const I = Math.pow(10, `${Math.floor(M)}`.length - 1);
let D = M / I;
return D = D >= 10 ? 10 : D >= 5 ? 5 : D >= 3 ? 3 : D >= 2 ? 2 : D >= 1 ? 1 : function(j) {
const W = Math.pow(10, Math.ceil(-Math.log(j) / Math.LN10));
return Math.round(j * W) / W;
}(D), I * D;
}(m);
E.style.width = l * (_ / m) + "px", E.innerHTML = `${_} ${v}`;
}
const Mr = { closeButton: !0, closeOnClick: !0, focusAfterOpen: !0, className: "", maxWidth: "240px", subpixelPositioning: !1 }, Ol = ["a[href]", "[tabindex]:not([tabindex='-1'])", "[contenteditable]:not([contenteditable='false'])", "button:not([disabled])", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].join(", ");
function Pl(E) {
if (E) {
if (typeof E == "number") {
const l = Math.round(Math.abs(E) / Math.SQRT2);
return { center: new a.P(0, 0), top: new a.P(0, E), "top-left": new a.P(l, l), "top-right": new a.P(-l, l), bottom: new a.P(0, -E), "bottom-left": new a.P(l, -l), "bottom-right": new a.P(-l, -l), left: new a.P(E, 0), right: new a.P(-E, 0) };
}
if (E instanceof a.P || Array.isArray(E)) {
const l = a.P.convert(E);
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(E.center || [0, 0]), top: a.P.convert(E.top || [0, 0]), "top-left": a.P.convert(E["top-left"] || [0, 0]), "top-right": a.P.convert(E["top-right"] || [0, 0]), bottom: a.P.convert(E.bottom || [0, 0]), "bottom-left": a.P.convert(E["bottom-left"] || [0, 0]), "bottom-right": a.P.convert(E["bottom-right"] || [0, 0]), left: a.P.convert(E.left || [0, 0]), right: a.P.convert(E.right || [0, 0]) };
}
return Pl(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 = Zi, 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(E = {}) {
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, E && E.container && (E.container instanceof HTMLElement ? this._container = E.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(E) {
return this._map = E, 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 E = this._fullscreenButton = Q.create("button", "maplibregl-ctrl-fullscreen", this._controlContainer);
Q.create("span", "maplibregl-ctrl-icon", E).setAttribute("aria-hidden", "true"), E.type = "button", this._updateTitle(), this._fullscreenButton.addEventListener("click", this._onClickFullscreen), window.document.addEventListener(this._fullscreenchange, this._onFullscreenChange);
}
_updateTitle() {
const E = this._getTitle();
this._fullscreenButton.setAttribute("aria-label", E), this._fullscreenButton.title = E;
}
_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(E) {
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, _ = this._map.getBearing(), M = a.e({ bearing: _ }, this.options.fitBoundsOptions), I = Ot.fromLngLat(m, v);
this._map.fitBounds(I, 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 && V0)
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 Cl({ element: this._dotElement }), this._circleElement = Q.create("div", "maplibregl-user-location-accuracy-circle"), this._accuracyCircleMarker = new Cl({ 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, E);
}
onAdd(E) {
return this._map = E, this._container = Q.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._setupUI(), function() {
return a._(this, arguments, void 0, function* (l = !1) {
if (Io !== void 0 && !l)
return Io;
if (window.navigator.permissions === void 0)
return Io = !!window.navigator.geolocation, Io;
try {
Io = (yield window.navigator.permissions.query({ name: "geolocation" })).state !== "denied";
} catch {
Io = !!window.navigator.geolocation;
}
return Io;
});
}().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, k0 = 0, V0 = !1;
}
_isOutOfMapMaxBounds(E) {
const l = this._map.getMaxBounds(), m = E.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 E = this._map.getBounds(), l = E.getSouthEast(), m = E.getNorthEast(), v = l.distanceTo(m), _ = Math.ceil(this._accuracy / (v / this._map._container.clientHeight) * 2);
this._circleElement.style.width = `${_}px`, this._circleElement.style.height = `${_}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":
k0--, V0 = !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 E;
this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "true"), k0++, k0 > 1 ? (E = { maximumAge: 6e5, timeout: 0 }, V0 = !0) : (E = this.options.positionOptions, V0 = !1), this._geolocationWatchID = window.navigator.geolocation.watchPosition(this._onSuccess, this._onError, E);
}
} else
window.navigator.geolocation.getCurrentPosition(this._onSuccess, this._onError, this.options.positionOptions), this._timeoutId = setTimeout(this._finish, 1e4);
return !0;
}
_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 = Ot, s.LogoControl = Ic, s.Map = class extends yp {
constructor(E) {
a.bf.mark(a.bg.create);
const l = Object.assign(Object.assign({}, y_), E);
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 ko(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 = P.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((_) => {
this._trackResize && !this._removed && (this.resize(_), this.redraw());
}, 50);
this._resizeObserver = new ResizeObserver((_) => {
m ? v(_) : m = !0;
}), this._resizeObserver.observe(this._container);
}
this.handlers = new Vc(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 Ic(), 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(E, l) {
if (l === void 0 && (l = E.getDefaultPosition ? E.getDefaultPosition() : "top-right"), !E || !E.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 = E.onAdd(this);
this._controls.push(E);
const v = this._controlPositions[l];
return l.indexOf("bottom") !== -1 ? v.insertBefore(m, v.firstChild) : v.appendChild(m), this;
}
removeControl(E) {
if (!E || !E.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(E);
return l > -1 && this._controls.splice(l, 1), E.onRemove(this), this;
}
hasControl(E) {
return this._controls.indexOf(E) > -1;
}
calculateCameraOptionsFromTo(E, l, m, v) {
return v == null && this.terrain && (v = this.terrain.getElevationForLngLatZoom(m, this.transform.tileZoom)), super.calculateCameraOptionsFromTo(E, l, m, v);
}
resize(E) {
var l;
const m = this._containerDimensions(), v = m[0], _ = m[1], M = this._getClampedPixelRatio(v, _);
if (this._resizeCanvas(v, _, M), this.painter.resize(v, _, M), this.painter.overLimit()) {
const D = this.painter.context.gl;
this._maxCanvasSize = [D.drawingBufferWidth, D.drawingBufferHeight];
const j = this._getClampedPixelRatio(v, _);
this._resizeCanvas(v, _, j), this.painter.resize(v, _, j);
}
this.transform.resize(v, _), (l = this._requestedCameraState) === null || l === void 0 || l.resize(v, _);
const I = !this._moving;
return I && (this.stop(), this.fire(new a.k("movestart", E)).fire(new a.k("move", E))), this.fire(new a.k("resize", E)), I && this.fire(new a.k("moveend", E)), this;
}
_getClampedPixelRatio(E, l) {
const { 0: m, 1: v } = this._maxCanvasSize, _ = this.getPixelRatio(), M = E * _, I = l * _;
return Math.min(M > m ? m / M : 1, I > v ? v / I : 1) * _;
}
getPixelRatio() {
var E;
return (E = this._overridePixelRatio) !== null && E !== void 0 ? E : devicePixelRatio;
}
setPixelRatio(E) {
this._overridePixelRatio = E, this.resize();
}
getBounds() {
return this.transform.getBounds();
}
getMaxBounds() {
return this.transform.getMaxBounds();
}
setMaxBounds(E) {
return this.transform.setMaxBounds(Ot.convert(E)), this._update();
}
setMinZoom(E) {
if ((E = E ?? -2) >= -2 && E <= this.transform.maxZoom)
return this.transform.minZoom = E, this._update(), this.getZoom() < E && this.setZoom(E), this;
throw new Error("minZoom must be between -2 and the current maxZoom, inclusive");
}
getMinZoom() {
return this.transform.minZoom;
}
setMaxZoom(E) {
if ((E = E ?? 22) >= this.transform.minZoom)
return this.transform.maxZoom = E, this._update(), this.getZoom() > E && this.setZoom(E), this;
throw new Error("maxZoom must be greater than the current minZoom");
}
getMaxZoom() {
return this.transform.maxZoom;
}
setMinPitch(E) {
if ((E = E ?? 0) < 0)
throw new Error("minPitch must be greater than or equal to 0");
if (E >= 0 && E <= this.transform.maxPitch)
return this.transform.minPitch = E, this._update(), this.getPitch() < E && this.setPitch(E), this;
throw new Error("minPitch must be between 0 and the current maxPitch, inclusive");
}
getMinPitch() {
return this.transform.minPitch;
}
setMaxPitch(E) {
if ((E = E ?? 60) > 85)
throw new Error("maxPitch must be less than or equal to 85");
if (E >= this.transform.minPitch)
return this.transform.maxPitch = E, this._update(), this.getPitch() > E && this.setPitch(E), this;
throw new Error("maxPitch must be greater than the current minPitch");
}
getMaxPitch() {
return this.transform.maxPitch;
}
getRenderWorldCopies() {
return this.transform.renderWorldCopies;
}
setRenderWorldCopies(E) {
return this.transform.renderWorldCopies = E, this._update();
}
project(E) {
return this.transform.locationPoint(a.N.convert(E), this.style && this.terrain);
}
unproject(E) {
return this.transform.pointLocation(a.P.convert(E), this.terrain);
}
isMoving() {
var E;
return this._moving || ((E = this.handlers) === null || E === void 0 ? void 0 : E.isMoving());
}
isZooming() {
var E;
return this._zooming || ((E = this.handlers) === null || E === void 0 ? void 0 : E.isZooming());
}
isRotating() {
var E;
return this._rotating || ((E = this.handlers) === null || E === void 0 ? void 0 : E.isRotating());
}
_createDelegatedListener(E, l, m) {
if (E === "mouseenter" || E === "mouseover") {
let v = !1;
return { layers: l, listener: m, delegates: { mousemove: (_) => {
const M = l.filter((D) => this.getLayer(D)), I = M.length !== 0 ? this.queryRenderedFeatures(_.point, { layers: M }) : [];
I.length ? v || (v = !0, m.call(this, new Gi(E, this, _.originalEvent, { features: I }))) : v = !1;
}, mouseout: () => {
v = !1;
} } };
}
if (E === "mouseleave" || E === "mouseout") {
let v = !1;
return { layers: l, listener: m, delegates: { mousemove: (_) => {
const M = l.filter((I) => this.getLayer(I));
(M.length !== 0 ? this.queryRenderedFeatures(_.point, { layers: M }) : []).length ? v = !0 : v && (v = !1, m.call(this, new Gi(E, this, _.originalEvent)));
}, mouseout: (_) => {
v && (v = !1, m.call(this, new Gi(E, this, _.originalEvent)));
} } };
}
{
const v = (_) => {
const M = l.filter((D) => this.getLayer(D)), I = M.length !== 0 ? this.queryRenderedFeatures(_.point, { layers: M }) : [];
I.length && (_.features = I, m.call(this, _), delete _.features);
};
return { layers: l, listener: m, delegates: { [E]: v } };
}
}
_saveDelegatedListener(E, l) {
this._delegatedListeners = this._delegatedListeners || {}, this._delegatedListeners[E] = this._delegatedListeners[E] || [], this._delegatedListeners[E].push(l);
}
_removeDelegatedListener(E, l, m) {
if (!this._delegatedListeners || !this._delegatedListeners[E])
return;
const v = this._delegatedListeners[E];
for (let _ = 0; _ < v.length; _++) {
const M = v[_];
if (M.listener === m && M.layers.length === l.length && M.layers.every((I) => l.includes(I))) {
for (const I in M.delegates)
this.off(I, M.delegates[I]);
return void v.splice(_, 1);
}
}
}
on(E, l, m) {
if (m === void 0)
return super.on(E, l);
const v = this._createDelegatedListener(E, typeof l == "string" ? [l] : l, m);
this._saveDelegatedListener(E, v);
for (const _ in v.delegates)
this.on(_, v.delegates[_]);
return this;
}
once(E, l, m) {
if (m === void 0)
return super.once(E, l);
const v = typeof l == "string" ? [l] : l, _ = this._createDelegatedListener(E, v, m);
for (const M in _.delegates) {
const I = _.delegates[M];
_.delegates[M] = (...D) => {
this._removeDelegatedListener(E, v, m), I(...D);
};
}
this._saveDelegatedListener(E, _);
for (const M in _.delegates)
this.once(M, _.delegates[M]);
return this;
}
off(E, l, m) {
return m === void 0 ? super.off(E, l) : (this._removeDelegatedListener(E, typeof l == "string" ? [l] : l, m), this);
}
queryRenderedFeatures(E, l) {
if (!this.style)
return [];
let m;
const v = E instanceof a.P || Array.isArray(E), _ = v ? E : [[0, 0], [this.transform.width, this.transform.height]];
if (l = l || (v ? {} : E) || {}, _ instanceof a.P || typeof _[0] == "number")
m = [a.P.convert(_)];
else {
const M = a.P.convert(_[0]), I = a.P.convert(_[1]);
m = [M, new a.P(I.x, M.y), I, new a.P(M.x, I.y), M];
}
return this.style.queryRenderedFeatures(m, l, this.transform);
}
querySourceFeatures(E, l) {
return this.style.querySourceFeatures(E, l);
}
setStyle(E, l) {
return (l = a.e({}, { localIdeographFontFamily: this._localIdeographFontFamily, validate: this._validateStyle }, l)).diff !== !1 && l.localIdeographFontFamily === this._localIdeographFontFamily && this.style && E ? (this._diffStyle(E, l), this) : (this._localIdeographFontFamily = l.localIdeographFontFamily, this._updateStyle(E, l));
}
setTransformRequest(E) {
return this._requestManager.setTransformRequest(E), this;
}
_getUIString(E) {
const l = this._locale[E];
if (l == null)
throw new Error(`Missing UI string '${E}'`);
return l;
}
_updateStyle(E, l) {
if (l.transformStyle && this.style && !this.style._loaded)
return void this.style.once("style.load", () => this._updateStyle(E, l));
const m = this.style && l.transformStyle ? this.style.serialize() : void 0;
return this.style && (this.style.setEventedParent(null), this.style._remove(!E)), E ? (this.style = new ma(this, l || {}), this.style.setEventedParent(this, { style: this.style }), typeof E == "string" ? this.style.loadURL(E, l, m) : this.style.loadJSON(E, 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(E, l) {
if (typeof E == "string") {
const m = this._requestManager.transformRequest(E, "Style");
a.h(m, new AbortController()).then((v) => {
this._updateDiff(v.data, l);
}).catch((v) => {
v && this.fire(new a.j(v));
});
} else
typeof E == "object" && this._updateDiff(E, l);
}
_updateDiff(E, l) {
try {
this.style.setState(E, 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(E, 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(E, l) {
return this._lazyInitEmptyStyle(), this.style.addSource(E, l), this._update(!0);
}
isSourceLoaded(E) {
const l = this.style && this.style.sourceCaches[E];
if (l !== void 0)
return l.loaded();
this.fire(new a.j(new Error(`There is no source with ID '${E}'`)));
}
setTerrain(E) {
if (this.style._checkLoaded(), this._terrainDataCallback && this.style.off("data", this._terrainDataCallback), E) {
const l = this.style.sourceCaches[E.source];
if (!l)
throw new Error(`cannot load terrain, because there exists no source with ID: ${E.source}`);
this.terrain === null && l.reload();
for (const m in this.style._layers) {
const v = this.style._layers[m];
v.type === "hillshade" && v.source === E.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, E), 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 !== E.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: E })), this;
}
getTerrain() {
var E, l;
return (l = (E = this.terrain) === null || E === void 0 ? void 0 : E.options) !== null && l !== void 0 ? l : null;
}
areTilesLoaded() {
const E = this.style && this.style.sourceCaches;
for (const l in E) {
const m = E[l]._tiles;
for (const v in m) {
const _ = m[v];
if (_.state !== "loaded" && _.state !== "errored")
return !1;
}
}
return !0;
}
removeSource(E) {
return this.style.removeSource(E), this._update(!0);
}
getSource(E) {
return this.style.getSource(E);
}
addImage(E, l, m = {}) {
const { pixelRatio: v = 1, sdf: _ = !1, stretchX: M, stretchY: I, content: D, textFitWidth: j, textFitHeight: W } = 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: ct } = l, ft = l;
return this.style.addImage(E, { data: new a.R({ width: Y, height: J }, new Uint8Array(ct)), pixelRatio: v, stretchX: M, stretchY: I, content: D, textFitWidth: j, textFitHeight: W, sdf: _, version: 0, userImage: ft }), ft.onAdd && ft.onAdd(this, E), this;
}
}
{
const { width: Y, height: J, data: ct } = f.getImageData(l);
this.style.addImage(E, { data: new a.R({ width: Y, height: J }, ct), pixelRatio: v, stretchX: M, stretchY: I, content: D, textFitWidth: j, textFitHeight: W, sdf: _, version: 0 });
}
}
updateImage(E, l) {
const m = this.style.getImage(E);
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: _, height: M, data: I } = v;
if (_ === 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 (_ !== 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(I, D), this.style.updateImage(E, m), this;
}
getImage(E) {
return this.style.getImage(E);
}
hasImage(E) {
return E ? !!this.style.getImage(E) : (this.fire(new a.j(new Error("Missing required image id"))), !1);
}
removeImage(E) {
this.style.removeImage(E);
}
loadImage(E) {
return P.getImage(this._requestManager.transformRequest(E, "Image"), new AbortController());
}
listImages() {
return this.style.listImages();
}
addLayer(E, l) {
return this._lazyInitEmptyStyle(), this.style.addLayer(E, l), this._update(!0);
}
moveLayer(E, l) {
return this.style.moveLayer(E, l), this._update(!0);
}
removeLayer(E) {
return this.style.removeLayer(E), this._update(!0);
}
getLayer(E) {
return this.style.getLayer(E);
}
getLayersOrder() {
return this.style.getLayersOrder();
}
setLayerZoomRange(E, l, m) {
return this.style.setLayerZoomRange(E, l, m), this._update(!0);
}
setFilter(E, l, m = {}) {
return this.style.setFilter(E, l, m), this._update(!0);
}
getFilter(E) {
return this.style.getFilter(E);
}
setPaintProperty(E, l, m, v = {}) {
return this.style.setPaintProperty(E, l, m, v), this._update(!0);
}
getPaintProperty(E, l) {
return this.style.getPaintProperty(E, l);
}
setLayoutProperty(E, l, m, v = {}) {
return this.style.setLayoutProperty(E, l, m, v), this._update(!0);
}
getLayoutProperty(E, l) {
return this.style.getLayoutProperty(E, l);
}
setGlyphs(E, l = {}) {
return this._lazyInitEmptyStyle(), this.style.setGlyphs(E, l), this._update(!0);
}
getGlyphs() {
return this.style.getGlyphsUrl();
}
addSprite(E, l, m = {}) {
return this._lazyInitEmptyStyle(), this.style.addSprite(E, l, m, (v) => {
v || this._update(!0);
}), this;
}
removeSprite(E) {
return this._lazyInitEmptyStyle(), this.style.removeSprite(E), this._update(!0);
}
getSprite() {
return this.style.getSprite();
}
setSprite(E, l = {}) {
return this._lazyInitEmptyStyle(), this.style.setSprite(E, l, (m) => {
m || this._update(!0);
}), this;
}
setLight(E, l = {}) {
return this._lazyInitEmptyStyle(), this.style.setLight(E, l), this._update(!0);
}
getLight() {
return this.style.getLight();
}
setSky(E) {
return this._lazyInitEmptyStyle(), this.style.setSky(E), this._update(!0);
}
getSky() {
return this.style.getSky();
}
setFeatureState(E, l) {
return this.style.setFeatureState(E, l), this._update();
}
removeFeatureState(E, l) {
return this.style.removeFeatureState(E, l), this._update();
}
getFeatureState(E) {
return this.style.getFeatureState(E);
}
getContainer() {
return this._container;
}
getCanvasContainer() {
return this._canvasContainer;
}
getCanvas() {
return this._canvas;
}
_containerDimensions() {
let E = 0, l = 0;
return this._container && (E = this._container.clientWidth || 400, l = this._container.clientHeight || 300), [E, l];
}
_setupContainer() {
const E = this._container;
E.classList.add("maplibregl-map");
const l = this._canvasContainer = Q.create("div", "maplibregl-canvas-container", E);
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 _ = this._controlContainer = Q.create("div", "maplibregl-control-container", E), M = this._controlPositions = {};
["top-left", "top-right", "bottom-left", "bottom-right"].forEach((I) => {
M[I] = Q.create("div", `maplibregl-ctrl-${I} `, _);
}), this._container.addEventListener("scroll", this._onMapScroll, !1);
}
_resizeCanvas(E, l, m) {
this._canvas.width = Math.floor(m * E), this._canvas.height = Math.floor(m * l), this._canvas.style.width = `${E}px`, this._canvas.style.height = `${l}px`;
}
_setupPainter() {
const E = { 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: E }, v && (l.statusMessage = v.statusMessage, l.type = v.type);
}, { once: !0 });
const m = this._canvas.getContext("webgl2", E) || this._canvas.getContext("webgl", E);
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(E) {
return this.style && this.style._loaded ? (this._styleDirty = this._styleDirty || E, this._sourcesDirty = !0, this.triggerRepaint(), this) : this;
}
_requestRenderFrame(E) {
return this._update(), this._renderTaskQueue.add(E);
}
_cancelRenderFrame(E) {
this._renderTaskQueue.remove(E);
}
_render(E) {
const l = this._idleTriggered ? this._fadeDuration : 0;
if (this.painter.context.setDirty(), this.painter.setBaseState(), this._renderTaskQueue.run(E), this._removed)
return;
let m = !1;
if (this.style && this._styleDirty) {
this._styleDirty = !1;
const _ = this.transform.zoom, M = f.now();
this.style.zoomHistory.update(_, M);
const I = new a.z(_, { now: M, fadeDuration: l, zoomHistory: this.style.zoomHistory, transition: this.style.getTransition() }), D = I.crossFadingFactor();
D === 1 && D === this._crossFadingFactor || (m = !0, this._crossFadingFactor = D), this.style.update(I);
}
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 E;
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), P.removeThrottleControl(this._imageQueueHandle), (E = this._resizeObserver) === null || E === void 0 || E.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((E) => {
a.bf.frame(E), this._frameRequest = null, this._render(E);
}).catch(() => {
}));
}
get showTileBoundaries() {
return !!this._showTileBoundaries;
}
set showTileBoundaries(E) {
this._showTileBoundaries !== E && (this._showTileBoundaries = E, this._update());
}
get showPadding() {
return !!this._showPadding;
}
set showPadding(E) {
this._showPadding !== E && (this._showPadding = E, this._update());
}
get showCollisionBoxes() {
return !!this._showCollisionBoxes;
}
set showCollisionBoxes(E) {
this._showCollisionBoxes !== E && (this._showCollisionBoxes = E, E ? this.style._generateCollisionBoxes() : this._update());
}
get showOverdrawInspector() {
return !!this._showOverdrawInspector;
}
set showOverdrawInspector(E) {
this._showOverdrawInspector !== E && (this._showOverdrawInspector = E, this._update());
}
get repaint() {
return !!this._repaint;
}
set repaint(E) {
this._repaint !== E && (this._repaint = E, this.triggerRepaint());
}
get vertices() {
return !!this._vertices;
}
set vertices(E) {
this._vertices = E, this._update();
}
get version() {
return _p;
}
getCameraTargetElevation() {
return this.transform.elevation;
}
}, s.MapMouseEvent = Gi, s.MapTouchEvent = $i, s.MapWheelEvent = e2, s.Marker = Cl, s.NavigationControl = class {
constructor(E) {
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_, E), 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(E) {
return this._map = E, 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(E, l) {
const m = Q.create("button", E, this._container);
return m.type = "button", m.addEventListener("click", l), m;
}
}, s.Popup = class extends a.E {
constructor(E) {
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 _ = this.options.anchor;
const M = Pl(this.options.offset);
if (!_) {
const D = this._container.offsetWidth, j = this._container.offsetHeight;
let W;
W = v.y + M.bottom.y < j ? ["top"] : v.y > this._map.transform.height - j ? ["bottom"] : [], v.x < D / 2 ? W.push("left") : v.x > this._map.transform.width - D / 2 && W.push("right"), _ = W.length === 0 ? "bottom" : W.join("-");
}
let I = v.add(M[_]);
this.options.subpixelPositioning || (I = I.round()), Q.setTransform(this._container, `${o6[_]} translate(${I.x}px,${I.y}px)`), Al(this._container, _, "popup");
}, this._onClose = () => {
this.remove();
}, this.options = a.e(Object.create(Mr), E);
}
addTo(E) {
return this._map && this.remove(), this._map = E, this.options.closeOnClick && this._map.on("click", this._onClose), this.options.closeOnMove && this._map.on("move", this._onClose), this._map.on("remove", this.remove), this._update(), this._focusFirstElement(), this._trackPointer ? (this._map.on("mousemove", this._onMouseMove), this._map.on("mouseup", this._onMouseUp), this._container && this._container.classList.add("maplibregl-popup-track-pointer"), 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(E) {
return this._lngLat = a.N.convert(E), 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(E) {
return this.setDOMContent(document.createTextNode(E));
}
setHTML(E) {
const l = document.createDocumentFragment(), m = document.createElement("body");
let v;
for (m.innerHTML = E; v = m.firstChild, v; )
l.appendChild(v);
return this.setDOMContent(l);
}
getMaxWidth() {
var E;
return (E = this._container) === null || E === void 0 ? void 0 : E.style.maxWidth;
}
setMaxWidth(E) {
return this.options.maxWidth = E, this._update(), this;
}
setDOMContent(E) {
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(E), this._createCloseButton(), this._update(), this._focusFirstElement(), this;
}
addClassName(E) {
return this._container && this._container.classList.add(E), this;
}
removeClassName(E) {
return this._container && this._container.classList.remove(E), this;
}
setOffset(E) {
return this.options.offset = E, this._update(), this;
}
toggleClassName(E) {
if (this._container)
return this._container.classList.toggle(E);
}
setSubpixelPositioning(E) {
this.options.subpixelPositioning = E;
}
_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 E = this._container.querySelector(Ol);
E && E.focus();
}
}, s.RasterDEMTileSource = Rr, s.RasterTileSource = Sr, s.ScaleControl = class {
constructor(E) {
this._onMove = () => {
I0(this._map, this._container, this.options);
}, this.setUnit = (l) => {
this.options.unit = l, I0(this._map, this._container, this.options);
}, this.options = Object.assign(Object.assign({}, Qs), E);
}
getDefaultPosition() {
return "bottom-left";
}
onAdd(E) {
return this._map = E, this._container = Q.create("div", "maplibregl-ctrl maplibregl-ctrl-scale", E.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(E) {
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 = E;
}
onAdd(E) {
return this._map = E, 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 = Oc, s.TwoFingersTouchZoomHandler = Ac, s.TwoFingersTouchZoomRotateHandler = kc, s.VectorTileSource = Jr, s.VideoSource = Pi, s.addSourceType = (E, l) => a._(void 0, void 0, void 0, function* () {
if (c1(E))
throw new Error(`A source type called "${E}" already exists.`);
((m, v) => {
ki[m] = v;
})(E, l);
}), s.clearPrewarmedResources = function() {
const E = Gt;
E && (E.isPreloaded() && E.numActive() === 1 ? (E.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(E) {
return Ge().broadcast("IS", E);
}, s.prewarm = function() {
me().acquire(er);
}, s.setMaxParallelImageRequests = function(E) {
a.a.MAX_PARALLEL_IMAGE_REQUESTS = E;
}, s.setRTLTextPlugin = function(E, l) {
return Hi().setRTLTextPlugin(E, l);
}, s.setWorkerCount = function(E) {
Je.workerCount = E;
}, s.setWorkerUrl = function(E) {
a.a.WORKER_URL = E;
};
});
var o = r;
return o;
});
})(qG);
var Y9t = qG.exports;
const Uo = /* @__PURE__ */ p0(Y9t);
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 J9t(e).geometry;
case "MultiPoint":
return eht(e).geometry;
case "MultiLineString":
return tht(e).geometry;
case "MultiPolygon":
return rht(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 (!Ix(t[0]) || !Ix(t[1]))
throw new Error("coordinates must contain numbers");
var n = {
type: "Point",
coordinates: t
};
return ic(n, e, r);
}
function J9t(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 tht(t, e, r) {
r === void 0 && (r = {});
var n = {
type: "MultiLineString",
coordinates: t
};
return ic(n, e, r);
}
function eht(t, e, r) {
r === void 0 && (r = {});
var n = {
type: "MultiPoint",
coordinates: t
};
return ic(n, e, r);
}
function rht(t, e, r) {
r === void 0 && (r = {});
var n = {
type: "MultiPolygon",
coordinates: t
};
return ic(n, e, r);
}
function Ix(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
var N2 = 63710088e-1, nht = {
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 iht(t, e = "kilometers") {
const r = nht[e];
if (!r)
throw new Error(e + " units is invalid");
return t * r;
}
function cT(t) {
return t % 360 * Math.PI / 180;
}
function DV(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 = DV(t), i = DV(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 iht(
2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d)),
r.units
);
}
var FV = Object.prototype.toString, JG = function(t) {
var e = FV.call(t), r = e === "[object Arguments]";
return r || (r = e !== "[object Array]" && t !== null && typeof t == "object" && typeof t.length == "number" && t.length >= 0 && FV.call(t.callee) === "[object Function]"), r;
}, Jb, BV;
function oht() {
if (BV)
return Jb;
BV = 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", b = r.call(Q) === "[object Function]", w = n(Q), S = y && r.call(Q) === "[object String]", x = [];
if (!y && !b && !w)
throw new TypeError("Object.keys called on a non-object");
var C = s && b;
if (S && Q.length > 0 && !e.call(Q, 0))
for (var P = 0; P < Q.length; ++P)
x.push(String(P));
if (w && Q.length > 0)
for (var R = 0; R < Q.length; ++R)
x.push(String(R));
else
for (var F in Q)
!(C && 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 sht = Array.prototype.slice, aht = JG, jV = Object.keys, Lf = jV ? function(t) {
return jV(t);
} : oht(), zV = 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 aht(e) ? zV(sht.call(e)) : zV(e);
});
} else
Object.keys = Lf;
return Object.keys || Lf;
};
var oH = Lf, lht = Error, cht = EvalError, uht = RangeError, hht = ReferenceError, t$ = SyntaxError, f0 = TypeError, dht = 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;
}, UV = typeof Symbol < "u" && Symbol, pht = Dg, sH = function() {
return typeof UV != "function" || typeof Symbol != "function" || typeof UV("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? !1 : pht();
}, tL = {
__proto__: null,
foo: {}
}, Tht = Object, fht = function() {
return { __proto__: tL }.foo === tL.foo && !(tL instanceof Tht);
}, Qht = "Function.prototype.bind called on incompatible ", mht = Object.prototype.toString, ght = Math.max, yht = "[object Function]", GV = 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;
}, vht = function(t, e) {
for (var r = [], n = e, i = 0; n < t.length; n += 1, i += 1)
r[i] = t[n];
return r;
}, _ht = function(t, e) {
for (var r = "", n = 0; n < t.length; n += 1)
r += t[n], n + 1 < t.length && (r += e);
return r;
}, bht = function(t) {
var e = this;
if (typeof e != "function" || mht.apply(e) !== yht)
throw new TypeError(Qht + e);
for (var r = vht(arguments, 1), n, i = function() {
if (this instanceof n) {
var d = e.apply(
this,
GV(r, arguments)
);
return Object(d) === d ? d : this;
}
return e.apply(
t,
GV(r, arguments)
);
}, o = ght(0, e.length - r.length), s = [], a = 0; a < o; a++)
s[a] = "$" + a;
if (n = Function("binder", "return function (" + _ht(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;
}, Lht = bht, aH = Function.prototype.bind || Lht, wht = Function.prototype.call, xht = Object.prototype.hasOwnProperty, Mht = aH, e$ = Mht.call(wht, xht), gn, Eht = lht, Sht = cht, Hht = uht, Aht = hht, H8 = t$, d8 = f0, Cht = dht, r$ = Function, eL = function(t) {
try {
return r$('"use strict"; return (' + t + ").constructor;")();
} catch {
}
}, V5 = Object.getOwnPropertyDescriptor;
if (V5)
try {
V5({}, "");
} catch {
V5 = null;
}
var rL = function() {
throw new d8();
}, Oht = V5 ? function() {
try {
return arguments.callee, rL;
} catch {
try {
return V5(arguments, "callee").get;
} catch {
return rL;
}
}
}() : rL, Jl = sH(), Pht = fht(), B1 = Object.getPrototypeOf || (Pht ? function(t) {
return t.__proto__;
} : null), x7 = {}, kht = typeof Uint8Array > "u" || !B1 ? gn : B1(Uint8Array), I5 = {
__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%": Eht,
"%eval%": eval,
// eslint-disable-line no-eval
"%EvalError%": Sht,
"%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%": Hht,
"%ReferenceError%": Aht,
"%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%": Oht,
"%TypedArray%": kht,
"%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%": Cht,
"%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 Vht = B1(B1(t));
I5["%Error.prototype%"] = Vht;
}
var Iht = 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 I5[e] = r, r;
}, $V = {
__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$, Rht = wd.call(Function.call, Array.prototype.concat), Nht = wd.call(Function.apply, Array.prototype.splice), ZV = wd.call(Function.call, String.prototype.replace), $Q = wd.call(Function.call, String.prototype.slice), Dht = wd.call(Function.call, RegExp.prototype.exec), Fht = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, Bht = /\\(\\)?/g, jht = 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 ZV(t, Fht, function(i, o, s, a) {
n[n.length] = s ? ZV(a, Bht, "$1") : o || i;
}), n;
}, zht = function(t, e) {
var r = t, n;
if (GQ($V, r) && (n = $V[r], r = "%" + n[0] + "%"), GQ(I5, r)) {
var i = I5[r];
if (i === x7 && (i = Iht(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 (Dht(/^%?[^%]*%?$/, t) === null)
throw new H8("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
var r = jht(t), n = r.length > 0 ? r[0] : "", i = zht("%" + n + "%", e), o = i.name, s = i.value, a = !1, u = i.alias;
u && (n = u[0], Nht(r, Rht([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(I5, o))
s = I5[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 (V5 && d + 1 >= r.length) {
var b = V5(s, f);
T = !!b, T && "get" in b && !("originalValue" in b.get) ? s = b.get : s = s[f];
} else
T = GQ(s, f), s = s[f];
T && !a && (I5[o] = s);
}
}
return s;
}, Uht = x3, wf = Uht("%Object.defineProperty%", !0) || !1;
if (wf)
try {
wf({}, "a", { value: 1 });
} catch {
wf = !1;
}
var lH = wf, Ght = x3, xf = Ght("%Object.getOwnPropertyDescriptor%", !0);
if (xf)
try {
xf([], "length");
} catch {
xf = null;
}
var cH = xf, WV = lH, $ht = t$, t7 = f0, qV = 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 = !!qV && qV(t, e);
if (WV)
WV(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 $ht("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$, Zht = oH, Wht = typeof Symbol == "function" && typeof Symbol("foo") == "symbol", qht = Object.prototype.toString, Xht = Array.prototype.concat, XV = uH, Kht = function(t) {
return typeof t == "function" && qht.call(t) === "[object Function]";
}, i$ = hH(), Yht = function(t, e, r, n) {
if (e in t) {
if (n === !0) {
if (t[e] === r)
return;
} else if (!Kht(n) || !n())
return;
}
i$ ? XV(t, e, r, !0) : XV(t, e, r);
}, o$ = function(t, e) {
var r = arguments.length > 2 ? arguments[2] : {}, n = Zht(e);
Wht && (n = Xht.call(n, Object.getOwnPropertySymbols(e)));
for (var i = 0; i < n.length; i += 1)
Yht(t, n[i], e[n[i]], r[n[i]]);
};
o$.supportsDescriptors = !!i$;
var hl = o$, s$ = { exports: {} }, Jht = x3, KV = uH, tdt = hH(), YV = cH, JV = f0, edt = Jht("%Math.floor%"), rdt = function(t, e) {
if (typeof t != "function")
throw new JV("`fn` is not a function");
if (typeof e != "number" || e < 0 || e > 4294967295 || edt(e) !== e)
throw new JV("`length` must be a positive 32-bit integer");
var r = arguments.length > 2 && !!arguments[2], n = !0, i = !0;
if ("length" in t && YV) {
var o = YV(t, "length");
o && !o.configurable && (n = !1), o && !o.writable && (i = !1);
}
return (n || i || !r) && (tdt ? KV(
/** @type {Parameters[0]} */
t,
"length",
e,
!0,
!0
) : KV(
/** @type {Parameters[0]} */
t,
"length",
e
)), t;
};
(function(t) {
var e = aH, r = x3, n = rdt, 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, ndt = l$(a$("String.prototype.indexOf")), Fs = function(t, e) {
var r = a$(t, !!e);
return typeof r == "function" && ndt(t, ".prototype.") > -1 ? l$(r) : r;
}, idt = oH, c$ = Dg(), u$ = Fs, tI = Object, odt = u$("Array.prototype.push"), eI = u$("Object.prototype.propertyIsEnumerable"), sdt = c$ ? Object.getOwnPropertySymbols : null, h$ = function(t, e) {
if (t == null)
throw new TypeError("target must be an object");
var r = tI(t);
if (arguments.length === 1)
return r;
for (var n = 1; n < arguments.length; ++n) {
var i = tI(arguments[n]), o = idt(i), s = c$ && (Object.getOwnPropertySymbols || sdt);
if (s)
for (var a = s(i), u = 0; u < a.length; ++u) {
var d = a[u];
eI(i, d) && odt(o, d);
}
for (var T = 0; T < o.length; ++T) {
var f = o[T];
if (eI(i, f)) {
var Q = i[f];
r[f] = Q;
}
}
}
return r;
}, adt = h$, ldt = 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;
}, cdt = 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 || ldt() || cdt() ? adt : Object.assign;
}, udt = hl, hdt = d$, ddt = function() {
var t = hdt();
return udt(
Object,
{ assign: t },
{ assign: function() {
return Object.assign !== t;
} }
), t;
}, pdt = hl, Tdt = oc, fdt = h$, p$ = d$, Qdt = ddt, mdt = Tdt.apply(p$()), T$ = function(t, e) {
return mdt(Object, arguments);
};
pdt(T$, {
getPolyfill: p$,
implementation: fdt,
shim: Qdt
});
var gdt = 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 ydt = Function.prototype.bind;
zh.boundFunctionsHaveNames = function() {
return zh() && typeof ydt == "function" && (function() {
}).bind().name !== "";
};
var vdt = zh, rI = uH, _dt = hH(), bdt = vdt.functionsHaveConfigurableNames(), Ldt = f0, wdt = function(t, e) {
if (typeof t != "function")
throw new Ldt("`fn` is not a function");
var r = arguments.length > 2 && !!arguments[2];
return (!r || bdt) && (_dt ? rI(
/** @type {Parameters[0]} */
t,
"name",
e,
!0,
!0
) : rI(
/** @type {Parameters[0]} */
t,
"name",
e
)), t;
}, xdt = wdt, Mdt = f0, Edt = Object, f$ = xdt(function() {
if (this == null || this !== Edt(this))
throw new Mdt("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), Sdt = f$, Hdt = hl.supportsDescriptors, Adt = Object.getOwnPropertyDescriptor, Q$ = function() {
if (Hdt && /a/mig.flags === "gim") {
var t = Adt(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 Sdt;
}, Cdt = hl.supportsDescriptors, Odt = Q$, Pdt = Object.getOwnPropertyDescriptor, kdt = Object.defineProperty, Vdt = TypeError, nI = Object.getPrototypeOf, Idt = /a/, Rdt = function() {
if (!Cdt || !nI)
throw new Vdt("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");
var t = Odt(), e = nI(Idt), r = Pdt(e, "flags");
return (!r || r.get !== t) && kdt(e, "flags", {
configurable: !0,
enumerable: !1,
get: t
}), t;
}, Ndt = hl, Ddt = oc, Fdt = f$, m$ = Q$, Bdt = Rdt, g$ = Ddt(m$());
Ndt(g$, {
getPolyfill: m$,
implementation: Fdt,
shim: Bdt
});
var jdt = g$, Mf = { exports: {} }, zdt = Dg, dl = function() {
return zdt() && !!Symbol.toStringTag;
}, Udt = dl(), Gdt = Fs, Nx = Gdt("Object.prototype.toString"), Fg = function(t) {
return Udt && 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]";
}, $dt = function() {
return Fg(arguments);
}();
Fg.isLegacyArguments = y$;
var v$ = $dt ? Fg : y$;
const Zdt = {}, Wdt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Zdt
}, Symbol.toStringTag, { value: "Module" })), qdt = /* @__PURE__ */ X4t(Wdt);
var dH = typeof Map == "function" && Map.prototype, nL = Object.getOwnPropertyDescriptor && dH ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, ZQ = dH && nL && typeof nL.get == "function" ? nL.get : null, iI = dH && Map.prototype.forEach, pH = typeof Set == "function" && Set.prototype, iL = Object.getOwnPropertyDescriptor && pH ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, WQ = pH && iL && typeof iL.get == "function" ? iL.get : null, oI = pH && Set.prototype.forEach, Xdt = typeof WeakMap == "function" && WeakMap.prototype, oh = Xdt ? WeakMap.prototype.has : null, Kdt = typeof WeakSet == "function" && WeakSet.prototype, sh = Kdt ? WeakSet.prototype.has : null, Ydt = typeof WeakRef == "function" && WeakRef.prototype, sI = Ydt ? WeakRef.prototype.deref : null, Jdt = Boolean.prototype.valueOf, tpt = Object.prototype.toString, ept = Function.prototype.toString, rpt = String.prototype.match, TH = String.prototype.slice, K6 = String.prototype.replace, npt = String.prototype.toUpperCase, aI = String.prototype.toLowerCase, _$ = RegExp.prototype.test, lI = Array.prototype.concat, Ja = Array.prototype.join, ipt = Array.prototype.slice, cI = 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", Mo = typeof Symbol == "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === A8 || !0) ? Symbol.toStringTag : null, b$ = Object.prototype.propertyIsEnumerable, uI = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(t) {
return t.__proto__;
} : null);
function hI(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 ? -cI(-t) : cI(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 = qdt, dI = Bx.custom, pI = w$(dI) ? dI : null, opt = 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 M$(e, o);
if (typeof e == "number") {
if (e === 0)
return 1 / 0 / e > 0 ? "0" : "-0";
var u = String(e);
return a ? hI(e, u) : u;
}
if (typeof e == "bigint") {
var d = String(e) + "n";
return a ? hI(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 = Lpt(o, n);
if (typeof i > "u")
i = [];
else if (x$(i, e) >= 0)
return "[Circular]";
function Q(Vt, Zt, ce) {
if (Zt && (i = ipt.call(i), i.push(Zt)), ce) {
var oe = {
depth: o.depth
};
return U6(o, "quoteStyle") && (oe.quoteStyle = o.quoteStyle), t(Vt, oe, n + 1, i);
}
return t(Vt, o, n + 1, i);
}
if (typeof e == "function" && !TI(e)) {
var y = Tpt(e), b = uT(e, Q);
return "[Function" + (y ? ": " + y : " (anonymous)") + "]" + (b.length > 0 ? " { " + Ja.call(b, ", ") + " }" : "");
}
if (w$(e)) {
var w = A8 ? K6.call(String(e), /^(Symbol\(.*\))_[^)]*$/, "$1") : Fx.call(e);
return typeof e == "object" && !A8 ? fu(w) : w;
}
if (vpt(e)) {
for (var S = "<" + aI.call(String(e.nodeName)), x = e.attributes || [], C = 0; C < x.length; C++)
S += " " + x[C].name + "=" + L$(spt(x[C].value), "double", o);
return S += ">", e.childNodes && e.childNodes.length && (S += "..."), S += "" + aI.call(String(e.nodeName)) + ">", S;
}
if (jx(e)) {
if (e.length === 0)
return "[]";
var P = uT(e, Q);
return f && !bpt(P) ? "[" + zx(P, f) + "]" : "[ " + Ja.call(P, ", ") + " ]";
}
if (lpt(e)) {
var R = uT(e, Q);
return !("cause" in Error.prototype) && "cause" in e && !b$.call(e, "cause") ? "{ [" + String(e) + "] " + Ja.call(lI.call("[cause]: " + Q(e.cause), R), ", ") + " }" : R.length === 0 ? "[" + String(e) + "]" : "{ [" + String(e) + "] " + Ja.call(R, ", ") + " }";
}
if (typeof e == "object" && s) {
if (pI && typeof e[pI] == "function" && Bx)
return Bx(e, { depth: T - n });
if (s !== "symbol" && typeof e.inspect == "function")
return e.inspect();
}
if (fpt(e)) {
var F = [];
return iI && iI.call(e, function(Vt, Zt) {
F.push(Q(Zt, e, !0) + " => " + Q(Vt, e));
}), fI("Map", ZQ.call(e), F, f);
}
if (gpt(e)) {
var U = [];
return oI && oI.call(e, function(Vt) {
U.push(Q(Vt, e));
}), fI("Set", WQ.call(e), U, f);
}
if (Qpt(e))
return sL("WeakMap");
if (ypt(e))
return sL("WeakSet");
if (mpt(e))
return sL("WeakRef");
if (upt(e))
return fu(Q(Number(e)));
if (dpt(e))
return fu(Q(Dx.call(e)));
if (hpt(e))
return fu(Jdt.call(e));
if (cpt(e))
return fu(Q(String(e)));
if (typeof window < "u" && e === window)
return "{ [object Window] }";
if (e === V)
return "{ [object globalThis] }";
if (!apt(e) && !TI(e)) {
var $ = uT(e, Q), rt = uI ? uI(e) === Object.prototype : e instanceof Object || e.constructor === Object, tt = e instanceof Object ? "" : "null prototype", at = !rt && Mo && Object(e) === e && Mo in e ? TH.call(Q0(e), 8, -1) : tt ? "Object" : "", lt = rt || typeof e.constructor != "function" ? "" : e.constructor.name ? e.constructor.name + " " : "", xt = lt + (at || tt ? "[" + Ja.call(lI.call([], at || [], tt || []), ": ") + "] " : "");
return $.length === 0 ? xt + "{}" : f ? xt + "{" + zx($, f) + "}" : xt + "{ " + Ja.call($, ", ") + " }";
}
return String(e);
};
function L$(t, e, r) {
var n = (r.quoteStyle || e) === "double" ? '"' : "'";
return n + t + n;
}
function spt(t) {
return K6.call(String(t), /"/g, """);
}
function jx(t) {
return Q0(t) === "[object Array]" && (!Mo || !(typeof t == "object" && Mo in t));
}
function apt(t) {
return Q0(t) === "[object Date]" && (!Mo || !(typeof t == "object" && Mo in t));
}
function TI(t) {
return Q0(t) === "[object RegExp]" && (!Mo || !(typeof t == "object" && Mo in t));
}
function lpt(t) {
return Q0(t) === "[object Error]" && (!Mo || !(typeof t == "object" && Mo in t));
}
function cpt(t) {
return Q0(t) === "[object String]" && (!Mo || !(typeof t == "object" && Mo in t));
}
function upt(t) {
return Q0(t) === "[object Number]" && (!Mo || !(typeof t == "object" && Mo in t));
}
function hpt(t) {
return Q0(t) === "[object Boolean]" && (!Mo || !(typeof t == "object" && Mo 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 dpt(t) {
if (!t || typeof t != "object" || !Dx)
return !1;
try {
return Dx.call(t), !0;
} catch {
}
return !1;
}
var ppt = Object.prototype.hasOwnProperty || function(t) {
return t in this;
};
function U6(t, e) {
return ppt.call(t, e);
}
function Q0(t) {
return tpt.call(t);
}
function Tpt(t) {
if (t.name)
return t.name;
var e = rpt.call(ept.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 fpt(t) {
if (!ZQ || !t || typeof t != "object")
return !1;
try {
ZQ.call(t);
try {
WQ.call(t);
} catch {
return !0;
}
return t instanceof Map;
} catch {
}
return !1;
}
function Qpt(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 mpt(t) {
if (!sI || !t || typeof t != "object")
return !1;
try {
return sI.call(t), !0;
} catch {
}
return !1;
}
function gpt(t) {
if (!WQ || !t || typeof t != "object")
return !1;
try {
WQ.call(t);
try {
ZQ.call(t);
} catch {
return !0;
}
return t instanceof Set;
} catch {
}
return !1;
}
function ypt(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 vpt(t) {
return !t || typeof t != "object" ? !1 : typeof HTMLElement < "u" && t instanceof HTMLElement ? !0 : typeof t.nodeName == "string" && typeof t.getAttribute == "function";
}
function M$(t, e) {
if (t.length > e.maxStringLength) {
var r = t.length - e.maxStringLength, n = "... " + r + " more character" + (r > 1 ? "s" : "");
return M$(TH.call(t, 0, e.maxStringLength), e) + n;
}
var i = K6.call(K6.call(t, /(['\\])/g, "\\$1"), /[\x00-\x1f]/g, _pt);
return L$(i, "single", e);
}
function _pt(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" : "") + npt.call(e.toString(16));
}
function fu(t) {
return "Object(" + t + ")";
}
function sL(t) {
return t + " { ? }";
}
function fI(t, e, r, n) {
var i = n ? zx(r, n) : Ja.call(r, ", ");
return t + " (" + e + ") {" + i + "}";
}
function bpt(t) {
for (var e = 0; e < t.length; e++)
if (x$(t[e], `
`) >= 0)
return !1;
return !0;
}
function Lpt(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 E$ = x3, sc = Fs, wpt = opt, xpt = f0, hT = E$("%WeakMap%", !0), dT = E$("%Map%", !0), Mpt = sc("WeakMap.prototype.get", !0), Ept = sc("WeakMap.prototype.set", !0), Spt = sc("WeakMap.prototype.has", !0), Hpt = sc("Map.prototype.get", !0), Apt = sc("Map.prototype.set", !0), Cpt = 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;
}, Opt = function(t, e) {
var r = fH(t, e);
return r && r.value;
}, Ppt = 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
};
}, kpt = function(t, e) {
return !!fH(t, e);
}, S$ = function() {
var t, e, r, n = {
assert: function(i) {
if (!n.has(i))
throw new xpt("Side channel does not contain " + wpt(i));
},
get: function(i) {
if (hT && i && (typeof i == "object" || typeof i == "function")) {
if (t)
return Mpt(t, i);
} else if (dT) {
if (e)
return Hpt(e, i);
} else if (r)
return Opt(r, i);
},
has: function(i) {
if (hT && i && (typeof i == "object" || typeof i == "function")) {
if (t)
return Spt(t, i);
} else if (dT) {
if (e)
return Cpt(e, i);
} else if (r)
return kpt(r, i);
return !1;
},
set: function(i, o) {
hT && i && (typeof i == "object" || typeof i == "function") ? (t || (t = new hT()), Ept(t, i, o)) : dT ? (e || (e = new dT()), Apt(e, i, o)) : (r || (r = { key: {}, next: null }), Ppt(r, i, o));
}
};
return n;
}, Vpt = e$, Qu = S$(), Z3 = f0, QH = {
assert: function(t, e) {
if (!t || typeof t != "object" && typeof t != "function")
throw new Z3("`O` is not an object");
if (typeof e != "string")
throw new Z3("`slot` must be a string");
if (Qu.assert(t), !QH.has(t, e))
throw new Z3("`" + e + "` is not present on `O`");
},
get: function(t, e) {
if (!t || typeof t != "object" && typeof t != "function")
throw new Z3("`O` is not an object");
if (typeof e != "string")
throw new Z3("`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 Z3("`O` is not an object");
if (typeof e != "string")
throw new Z3("`slot` must be a string");
var r = Qu.get(t);
return !!r && Vpt(r, "$" + e);
},
set: function(t, e, r) {
if (!t || typeof t != "object" && typeof t != "function")
throw new Z3("`O` is not an object");
if (typeof e != "string")
throw new Z3("`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 Ipt = QH, mu = Ipt, Rpt = SyntaxError, QI = typeof StopIteration == "object" ? StopIteration : null, Npt = function(t) {
if (!QI)
throw new Rpt("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 !== QI)
throw i;
return {
done: !0,
value: void 0
};
}
}
};
return mu.set(e, "[[Iterator]]", t), e;
}, Dpt = {}.toString, H$ = Array.isArray || function(t) {
return Dpt.call(t) == "[object Array]";
}, Fpt = String.prototype.valueOf, Bpt = function(t) {
try {
return Fpt.call(t), !0;
} catch {
return !1;
}
}, jpt = Object.prototype.toString, zpt = "[object String]", Upt = dl(), A$ = function(t) {
return typeof t == "string" ? !0 : typeof t != "object" ? !1 : Upt ? Bpt(t) : jpt.call(t) === zpt;
}, mH = typeof Map == "function" && Map.prototype ? Map : null, Gpt = typeof Set == "function" && Set.prototype ? Set : null, qQ;
mH || (qQ = function(t) {
return !1;
});
var C$ = mH ? Map.prototype.has : null, mI = Gpt ? Set.prototype.has : null;
!qQ && !C$ && (qQ = function(t) {
return !1;
});
var O$ = qQ || function(t) {
if (!t || typeof t != "object")
return !1;
try {
if (C$.call(t), mI)
try {
mI.call(t);
} catch {
return !0;
}
return t instanceof mH;
} catch {
}
return !1;
}, $pt = typeof Map == "function" && Map.prototype ? Map : null, gH = typeof Set == "function" && Set.prototype ? Set : null, XQ;
gH || (XQ = function(t) {
return !1;
});
var gI = $pt ? Map.prototype.has : null, P$ = gH ? Set.prototype.has : null;
!XQ && !P$ && (XQ = function(t) {
return !1;
});
var k$ = XQ || function(t) {
if (!t || typeof t != "object")
return !1;
try {
if (P$.call(t), gI)
try {
gI.call(t);
} catch {
return !0;
}
return t instanceof gH;
} catch {
}
return !1;
}, yI = v$, vI = Npt;
if (sH() || Dg()) {
var aL = Symbol.iterator;
Mf.exports = function(t) {
if (t != null && typeof t[aL] < "u")
return t[aL]();
if (yI(t))
return Array.prototype[aL].call(t);
};
} else {
var Zpt = H$, Wpt = A$, _I = x3, qpt = _I("%Map%", !0), Xpt = _I("%Set%", !0), Xs = Fs, bI = Xs("Array.prototype.push"), LI = Xs("String.prototype.charCodeAt"), Kpt = Xs("String.prototype.slice"), Ypt = function(t, e) {
var r = t.length;
if (e + 1 >= r)
return e + 1;
var n = LI(t, e);
if (n < 55296 || n > 56319)
return e + 1;
var i = LI(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
};
}
};
}, wI = function(t, e) {
if (Zpt(t) || yI(t))
return lL(t);
if (Wpt(t)) {
var r = 0;
return {
next: function() {
var n = Ypt(t, r), i = Kpt(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 (!qpt && !Xpt)
Mf.exports = function(t) {
if (t != null)
return wI(t, !0);
};
else {
var Jpt = O$, tTt = k$, xI = Xs("Map.prototype.forEach", !0), MI = Xs("Set.prototype.forEach", !0);
if (typeof process > "u" || !process.versions || !process.versions.node)
var EI = Xs("Map.prototype.iterator", !0), SI = Xs("Set.prototype.iterator", !0);
var HI = Xs("Map.prototype.@@iterator", !0) || Xs("Map.prototype._es6-shim iterator_", !0), AI = Xs("Set.prototype.@@iterator", !0) || Xs("Set.prototype._es6-shim iterator_", !0), eTt = function(t) {
if (Jpt(t)) {
if (EI)
return vI(EI(t));
if (HI)
return HI(t);
if (xI) {
var e = [];
return xI(t, function(n, i) {
bI(e, [i, n]);
}), lL(e);
}
}
if (tTt(t)) {
if (SI)
return vI(SI(t));
if (AI)
return AI(t);
if (MI) {
var r = [];
return MI(t, function(n) {
bI(r, n);
}), lL(r);
}
}
};
Mf.exports = function(t) {
return eTt(t) || wI(t);
};
}
}
var rTt = Mf.exports, CI = function(t) {
return t !== t;
}, V$ = function(t, e) {
return t === 0 && e === 0 ? 1 / t === 1 / e : !!(t === e || CI(t) && CI(e));
}, nTt = V$, I$ = function() {
return typeof Object.is == "function" ? Object.is : nTt;
}, iTt = I$, oTt = hl, sTt = function() {
var t = iTt();
return oTt(Object, { is: t }, {
is: function() {
return Object.is !== t;
}
}), t;
}, aTt = hl, lTt = oc, cTt = V$, R$ = I$, uTt = sTt, N$ = lTt(R$(), Object);
aTt(N$, {
getPolyfill: R$,
implementation: cTt,
shim: uTt
});
var hTt = N$, dTt = oc, D$ = Fs, pTt = x3, Ux = pTt("%ArrayBuffer%", !0), Ef = D$("ArrayBuffer.prototype.byteLength", !0), TTt = D$("Object.prototype.toString"), OI = !!Ux && !Ef && new Ux(0).slice, PI = !!OI && dTt(OI), F$ = Ef || PI ? function(t) {
if (!t || typeof t != "object")
return !1;
try {
return Ef ? Ef(t) : PI(t, 0), !0;
} catch {
return !1;
}
} : Ux ? function(t) {
return TTt(t) === "[object ArrayBuffer]";
} : function(t) {
return !1;
}, fTt = Date.prototype.getDay, QTt = function(t) {
try {
return fTt.call(t), !0;
} catch {
return !1;
}
}, mTt = Object.prototype.toString, gTt = "[object Date]", yTt = dl(), vTt = function(t) {
return typeof t != "object" || t === null ? !1 : yTt ? QTt(t) : mTt.call(t) === gTt;
}, Gx = Fs, B$ = dl(), j$, z$, $x, Zx;
if (B$) {
j$ = Gx("Object.prototype.hasOwnProperty"), z$ = Gx("RegExp.prototype.exec"), $x = {};
var cL = function() {
throw $x;
};
Zx = {
toString: cL,
valueOf: cL
}, typeof Symbol.toPrimitive == "symbol" && (Zx[Symbol.toPrimitive] = cL);
}
var _Tt = Gx("Object.prototype.toString"), bTt = Object.getOwnPropertyDescriptor, LTt = "[object RegExp]", wTt = B$ ? function(t) {
if (!t || typeof t != "object")
return !1;
var e = bTt(t, "lastIndex"), r = e && j$(e, "value");
if (!r)
return !1;
try {
z$(t, Zx);
} catch (n) {
return n === $x;
}
} : function(t) {
return !t || typeof t != "object" && typeof t != "function" ? !1 : _Tt(t) === LTt;
}, xTt = Fs, kI = xTt("SharedArrayBuffer.prototype.byteLength", !0), MTt = kI ? function(t) {
if (!t || typeof t != "object")
return !1;
try {
return kI(t), !0;
} catch {
return !1;
}
} : function(t) {
return !1;
}, ETt = Number.prototype.toString, STt = function(t) {
try {
return ETt.call(t), !0;
} catch {
return !1;
}
}, HTt = Object.prototype.toString, ATt = "[object Number]", CTt = dl(), OTt = function(t) {
return typeof t == "number" ? !0 : typeof t != "object" ? !1 : CTt ? STt(t) : HTt.call(t) === ATt;
}, U$ = Fs, PTt = U$("Boolean.prototype.toString"), kTt = U$("Object.prototype.toString"), VTt = function(t) {
try {
return PTt(t), !0;
} catch {
return !1;
}
}, ITt = "[object Boolean]", RTt = dl(), NTt = function(t) {
return typeof t == "boolean" ? !0 : t === null || typeof t != "object" ? !1 : RTt && Symbol.toStringTag in t ? VTt(t) : kTt(t) === ITt;
}, Wx = { exports: {} }, DTt = Object.prototype.toString, FTt = sH();
if (FTt) {
var BTt = Symbol.prototype.toString, jTt = /^Symbol\(.*\)$/, zTt = function(t) {
return typeof t.valueOf() != "symbol" ? !1 : jTt.test(BTt.call(t));
};
Wx.exports = function(t) {
if (typeof t == "symbol")
return !0;
if (DTt.call(t) !== "[object Symbol]")
return !1;
try {
return zTt(t);
} catch {
return !1;
}
};
} else
Wx.exports = function(t) {
return !1;
};
var UTt = Wx.exports, qx = { exports: {} }, VI = typeof BigInt < "u" && BigInt, GTt = function() {
return typeof VI == "function" && typeof BigInt == "function" && typeof VI(42) == "bigint" && typeof BigInt(42) == "bigint";
}, $Tt = GTt();
if ($Tt) {
var ZTt = BigInt.prototype.valueOf, WTt = function(t) {
try {
return ZTt.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 : WTt(t);
};
} else
qx.exports = function(t) {
return !1;
};
var qTt = qx.exports, XTt = A$, KTt = OTt, YTt = NTt, JTt = UTt, tft = qTt, eft = function(t) {
if (t == null || typeof t != "object" && typeof t != "function")
return null;
if (XTt(t))
return "String";
if (KTt(t))
return "Number";
if (YTt(t))
return "Boolean";
if (JTt(t))
return "Symbol";
if (tft(t))
return "BigInt";
}, KQ = typeof WeakMap == "function" && WeakMap.prototype ? WeakMap : null, II = typeof WeakSet == "function" && WeakSet.prototype ? WeakSet : null, YQ;
KQ || (YQ = function(t) {
return !1;
});
var Xx = KQ ? KQ.prototype.has : null, uL = II ? II.prototype.has : null;
!YQ && !Xx && (YQ = function(t) {
return !1;
});
var rft = 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: {} }, nft = x3, G$ = Fs, ift = nft("%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 ift;
} catch {
}
return !1;
};
} else
Kx.exports = function(t) {
return !1;
};
var oft = Kx.exports, sft = O$, aft = k$, lft = rft, cft = oft, uft = function(t) {
if (t && typeof t == "object") {
if (sft(t))
return "Map";
if (aft(t))
return "Set";
if (lft(t))
return "WeakMap";
if (cft(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 hft = /^\s*class\b/, Jx = function(t) {
try {
var e = $$.call(t);
return hft.test(e);
} catch {
return !1;
}
}, pL = function(t) {
try {
return Jx(t) ? !1 : ($$.call(t), !0);
} catch {
return !1;
}
}, Hf = Object.prototype.toString, dft = "[object Object]", pft = "[object Function]", Tft = "[object GeneratorFunction]", fft = "[object HTMLAllCollection]", Qft = "[object HTML document.all class]", mft = "[object HTMLCollection]", gft = typeof Symbol == "function" && !!Symbol.toStringTag, yft = !(0 in [,]), tM = function() {
return !1;
};
if (typeof document == "object") {
var vft = document.all;
Hf.call(vft) === Hf.call(document.all) && (tM = function(t) {
if ((yft || !t) && (typeof t > "u" || typeof t == "object"))
try {
var e = Hf.call(t);
return (e === fft || e === Qft || e === mft || e === dft) && t("") == null;
} catch {
}
return !1;
});
}
var _ft = Y7 ? function(t) {
if (tM(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 (tM(t))
return !0;
if (!t || typeof t != "function" && typeof t != "object")
return !1;
if (gft)
return pL(t);
if (Jx(t))
return !1;
var e = Hf.call(t);
return e !== pft && e !== Tft && !/^\[object HTML/.test(e) ? !1 : pL(t);
}, bft = _ft, Lft = Object.prototype.toString, Z$ = Object.prototype.hasOwnProperty, wft = function(t, e, r) {
for (var n = 0, i = t.length; n < i; n++)
Z$.call(t, n) && (r == null ? e(t[n], n, t) : e.call(r, t[n], n, t));
}, xft = 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);
}, Mft = function(t, e, r) {
for (var n in t)
Z$.call(t, n) && (r == null ? e(t[n], n, t) : e.call(r, t[n], n, t));
}, Eft = function(t, e, r) {
if (!bft(e))
throw new TypeError("iterator must be a function");
var n;
arguments.length >= 3 && (n = r), Lft.call(t) === "[object Array]" ? wft(t, e, n) : typeof t == "string" ? xft(t, e, n) : Mft(t, e, n);
}, Sft = Eft, Hft = [
"Float32Array",
"Float64Array",
"Int8Array",
"Int16Array",
"Int32Array",
"Uint8Array",
"Uint8ClampedArray",
"Uint16Array",
"Uint32Array",
"BigInt64Array",
"BigUint64Array"
], TL = Hft, Aft = typeof globalThis > "u" ? V : globalThis, Cft = function() {
for (var t = [], e = 0; e < TL.length; e++)
typeof Aft[TL[e]] == "function" && (t[t.length] = TL[e]);
return t;
}, JQ = Sft, Oft = Cft, RI = oc, yH = Fs, Af = cH, Pft = yH("Object.prototype.toString"), W$ = dl(), NI = typeof globalThis > "u" ? V : globalThis, eM = Oft(), vH = yH("String.prototype.slice"), fL = Object.getPrototypeOf, kft = 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 };
W$ && Af && fL ? JQ(eM, function(t) {
var e = new NI[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] = RI(n.get);
}
}) : JQ(eM, function(t) {
var e = new NI[t](), r = e.slice || e.set;
r && (tm["$" + t] = RI(r));
});
var Vft = 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;
}, Ift = 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;
}, Rft = function(t) {
if (!t || typeof t != "object")
return !1;
if (!W$) {
var e = vH(Pft(t), 8, -1);
return kft(eM, e) > -1 ? e : e !== "Object" ? !1 : Ift(t);
}
return Af ? Vft(t) : null;
}, Nft = Fs, DI = Nft("ArrayBuffer.prototype.byteLength", !0), Dft = F$, Fft = function(t) {
return Dft(t) ? DI ? DI(t) : t.byteLength : NaN;
}, q$ = gdt, M3 = Fs, FI = jdt, Bft = x3, C8 = rTt, jft = S$, BI = hTt, jI = v$, zI = H$, UI = F$, GI = vTt, $I = wTt, ZI = MTt, WI = oH, qI = eft, XI = uft, KI = Rft, YI = Fft, JI = M3("SharedArrayBuffer.prototype.byteLength", !0), tR = M3("Date.prototype.getTime"), QL = Object.getPrototypeOf, eR = M3("Object.prototype.toString"), em = Bft("%Set%", !0), rM = M3("Map.prototype.has", !0), rm = M3("Map.prototype.get", !0), rR = M3("Map.prototype.size", !0), nm = M3("Set.prototype.add", !0), X$ = M3("Set.prototype.delete", !0), im = M3("Set.prototype.has", !0), Cf = M3("Set.prototype.size", !0);
function nR(t, e, r, n) {
for (var i = C8(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 zft(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" && !rM(e, s) || !oa(n, a, u, o) ? !1 : !rM(t, s) && oa(n, a, u, o);
}
function Uft(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 = C8(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 ? BI(t, e) : t === e)
return !0;
var o = qI(t), s = qI(e);
if (o !== s)
return !1;
if (!t || !e || typeof t != "object" && typeof e != "object")
return i.strict ? BI(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), Zft(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 Gft(t, e, r, n) {
if (Cf(t) !== Cf(e))
return !1;
for (var i = C8(t), o = C8(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 || !Uft(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 Cf(u) === 0;
}
return !0;
}
function $ft(t, e, r, n) {
if (rR(t) !== rR(e))
return !1;
for (var i = C8(t), o = C8(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" && !rM(e, d) || !oa(T, f, r, n)) {
if (r.strict || !zft(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 Cf(u) === 0;
}
return !0;
}
function Zft(t, e, r, n) {
var i, o;
if (typeof t != typeof e || t == null || e == null || eR(t) !== eR(e) || jI(t) !== jI(e))
return !1;
var s = zI(t), a = zI(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 = $I(t), f = $I(e);
if (T !== f || (T || f) && (t.source !== e.source || FI(t) !== FI(e)))
return !1;
var Q = GI(t), y = GI(e);
if (Q !== y || (Q || y) && tR(t) !== tR(e) || r.strict && QL && QL(t) !== QL(e))
return !1;
var b = KI(t), w = KI(e);
if (b !== w)
return !1;
if (b || w) {
if (t.length !== e.length)
return !1;
for (i = 0; i < t.length; i++)
if (t[i] !== e[i])
return !1;
return !0;
}
var S = oR(t), x = oR(e);
if (S !== x)
return !1;
if (S || 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 C = UI(t), P = UI(e);
if (C !== P)
return !1;
if (C || P)
return YI(t) !== YI(e) ? !1 : typeof Uint8Array == "function" && oa(new Uint8Array(t), new Uint8Array(e), r, n);
var R = ZI(t), F = ZI(e);
if (R !== F)
return !1;
if (R || F)
return JI(t) !== JI(e) ? !1 : typeof Uint8Array == "function" && oa(new Uint8Array(t), new Uint8Array(e), r, n);
if (typeof t != typeof e)
return !1;
var U = WI(t), $ = WI(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 rt = XI(t), tt = XI(e);
return rt !== tt ? !1 : rt === "Set" || tt === "Set" ? Gft(t, e, r, n) : rt === "Map" ? $ft(t, e, r, n) : !0;
}
var Wft = function(t, e, r) {
return oa(t, e, r, jft());
};
const _H = /* @__PURE__ */ p0(Wft);
var qft = Object.defineProperty, $n = (t, e) => qft(t, "name", { value: e, configurable: !0 }), Xft = 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 = nM(t), n = nM(
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(Xft, "GeojsonEquality");
function c9(t, e) {
return t.coordinates ? t.coordinates.length === e.coordinates.length : t.length === e.length;
}
$n(c9, "sameLength");
function nM(t) {
return t.coordinates.map((e) => ({
type: t.type.replace("Multi", ""),
coordinates: e
}));
}
$n(nM, "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 Kft(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 tZ(e).geometry;
case "MultiLineString":
return J$(e).geometry;
case "MultiPolygon":
return eZ(e).geometry;
default:
throw new Error(t + " is invalid");
}
}
$n(Kft, "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 Yft(t, e, r = {}) {
return Bg(
t.map((n) => c4(n, e)),
r
);
}
$n(Yft, "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 Jft(t, e, r = {}) {
return Bg(
t.map((n) => bH(n, e)),
r
);
}
$n(Jft, "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 tQt(t, e, r = {}) {
return Bg(
t.map((n) => Q4(n, e)),
r
);
}
$n(tQt, "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 tZ(t, e, r = {}) {
return T3({
type: "MultiPoint",
coordinates: t
}, e, r);
}
$n(tZ, "multiPoint");
function eZ(t, e, r = {}) {
return T3({
type: "MultiPolygon",
coordinates: t
}, e, r);
}
$n(eZ, "multiPolygon");
function eQt(t, e, r = {}) {
return T3({
type: "GeometryCollection",
geometries: t
}, e, r);
}
$n(eQt, "geometryCollection");
function rQt(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(rQt, "round");
function rZ(t, e = "kilometers") {
const r = Y$[e];
if (!r)
throw new Error(e + " units is invalid");
return t * r;
}
$n(rZ, "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 nQt(t, e) {
return nZ(LH(t, e));
}
$n(nQt, "lengthToDegrees");
function iQt(t) {
let e = t % 360;
return e < 0 && (e += 360), e;
}
$n(iQt, "bearingToAzimuth");
function nZ(t) {
return t % (2 * Math.PI) * 180 / Math.PI;
}
$n(nZ, "radiansToDegrees");
function oQt(t) {
return t % 360 * Math.PI / 180;
}
$n(oQt, "degreesToRadians");
function sQt(t, e = "kilometers", r = "kilometers") {
if (!(t >= 0))
throw new Error("length must be a positive number");
return rZ(LH(t, e), r);
}
$n(sQt, "convertLength");
function aQt(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(aQt, "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 lQt(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(lQt, "validateBBox");
function cQt(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(cQt, "validateId");
var uQt = Object.defineProperty, so = (t, e) => uQt(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, b = y === "FeatureCollection", w = y === "Feature", S = b ? t.features.length : 1, x = 0; x < S; x++) {
d = b ? t.features[x].geometry : w ? t.geometry : t, Q = d ? d.type === "GeometryCollection" : !1, a = Q ? d.geometries.length : 1;
for (var C = 0; C < a; C++) {
var P = 0, R = 0;
if (s = Q ? d.geometries[C] : 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,
P,
R
) === !1)
return !1;
f++, P++;
break;
case "LineString":
case "MultiPoint":
for (n = 0; n < u.length; n++) {
if (e(
u[n],
f,
x,
P,
R
) === !1)
return !1;
f++, F === "MultiPoint" && P++;
}
F === "LineString" && P++;
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,
P,
R
) === !1)
return !1;
f++;
}
F === "MultiLineString" && P++, F === "Polygon" && R++;
}
F === "Polygon" && P++;
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,
P,
R
) === !1)
return !1;
f++;
}
R++;
}
P++;
}
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 hQt(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(hQt, "coordReduce");
function iZ(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(iZ, "propEach");
function dQt(t, e, r) {
var n = r;
return iZ(t, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
so(dQt, "propReduce");
function oZ(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(oZ, "featureEach");
function pQt(t, e, r) {
var n = r;
return oZ(t, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
so(pQt, "featureReduce");
function TQt(t) {
var e = [];
return xd(t, function(r) {
e.push(r);
}), e;
}
so(TQt, "coordAll");
function xH(t, e) {
var r, n, i, o, s, a, u, d, T, f, Q = 0, y = t.type === "FeatureCollection", b = t.type === "Feature", w = y ? t.features.length : 1;
for (r = 0; r < w; r++) {
for (a = y ? t.features[r].geometry : b ? t.geometry : t, d = y ? t.features[r].properties : b ? t.properties : {}, T = y ? t.features[r].bbox : b ? t.bbox : void 0, f = y ? t.features[r].id : b ? 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 fQt(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(fQt, "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 QQt(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(QQt, "flattenReduce");
function sZ(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, b, w) {
if (a === void 0 || n > u || b > d || w > T) {
a = f, u = n, d = b, T = w, o = 0;
return;
}
var S = Q4(
[a, f],
r.properties
);
if (e(
S,
n,
i,
w,
o
) === !1)
return !1;
o++, a = f;
}
) === !1)
return !1;
}
}
});
}
so(sZ, "segmentEach");
function aZ(t, e, r) {
var n = r, i = !1;
return sZ(
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(aZ, "segmentReduce");
function lZ(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(lZ, "lineEach");
function mQt(t, e, r) {
var n = r;
return lZ(
t,
function(i, o, s, a) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a
);
}
), n;
}
so(mQt, "lineReduce");
function gQt(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(gQt, "findSegment");
function yQt(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(yQt, "findPoint");
var vQt = Object.defineProperty, _Qt = (t, e) => vQt(t, "name", { value: e, configurable: !0 });
function cZ(t, e = {}) {
return aZ(
t,
(r, n) => {
const i = n.geometry.coordinates;
return r + g5(i[0], i[1], e);
},
0
);
}
_Qt(cZ, "length");
const mL = 1.3;
var Of, Pf, kf, u9;
class bQt {
constructor(e) {
Ft(this, Of, void 0), Ft(this, Pf, ""), Ft(this, kf, 0), Ft(this, u9, []), Yt(this, Of, e);
}
get latestSource() {
return K(this, Pf);
}
get knowledgeSchema() {
return K(this, kf);
}
async initialise() {
try {
const e = await this.loadJSON("knowledge/schema-version");
if (e === void 0)
return;
"version" in e && Yt(this, kf, +e.version);
const r = await this.loadJSON("knowledge/sources");
r && "sources" in r && (Yt(this, u9, r.sources), K(this, u9).length && Yt(this, Pf, K(this, u9)[0]));
} catch {
}
}
url(e = "") {
return new URL(e, K(this, Of)).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;
}
}
}
Of = /* @__PURE__ */ new WeakMap(), Pf = /* @__PURE__ */ new WeakMap(), kf = /* @__PURE__ */ new WeakMap(), u9 = /* @__PURE__ */ new WeakMap();
function LQt(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 uZ(t, e, r) {
return e && LQt(t.prototype, e), t;
}
function wQt(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) {
wQt(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 xQt(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 hZ(t, e) {
var r;
if (typeof Symbol > "u" || t[Symbol.iterator] == null) {
if (Array.isArray(t) || (r = xQt(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 === pZ ? this.value() : this.type === dZ ? this.key() : [this.key(), this.value()];
}, e[Symbol.iterator] = function() {
return this;
}, t;
}(), MQt = "ENTRIES", dZ = "KEYS", pZ = "VALUES", $o = "", y6 = function(t) {
return t[t.length - 1];
}, EQt = 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 b = d + (e.length - f), w = i[T] || [null, 1 / 0], S = w[1];
b <= r && b < S && (i[T] = [u[y], b]);
} else
SQt(e, y, r - d, f, Q, o).forEach(function(x) {
var C = x.distance, P = x.i, R = x.edit;
n.push({
node: u[y],
distance: d + C,
key: T + y,
i: P,
edit: R
});
});
});
}; n.length > 0; )
s();
return i;
}, SQt = 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: HQt
});
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: AQt
}));
}
}
return s;
}, HQt = 0, AQt = 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 = TZ(this._tree, r.slice(this._prefix.length)), i = n[0], o = n[1];
if (i === void 0) {
var s = MH(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, OQt(this._tree, r);
}, e.entries = function() {
return new gL(this, MQt);
}, e.forEach = function(r) {
for (var n = hZ(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 EQt(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, dZ);
}, 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, pZ);
}, e[Symbol.iterator] = function() {
return this.entries();
}, uZ(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 = hZ(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 TZ = 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 = CQt(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));
}, CQt = 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]);
}, OQt = function(t, e) {
var r = TZ(t, e), n = r[0], i = r[1];
if (n !== void 0) {
delete n[$o];
var o = Object.keys(n);
o.length === 0 && PQt(i), o.length === 1 && kQt(i, o[0], n[o[0]]);
}
}, PQt = function t(e) {
if (e.length !== 0) {
var r = MH(e), n = r[0], i = r[1];
delete n[i], Object.keys(n).length === 0 && t(e.slice(0, -1));
}
}, kQt = function(t, e, r) {
if (t.length !== 0) {
var n = MH(t), i = n[0], o = n[1];
i[o + e] = r, delete i[o];
}
}, MH = function(t) {
return t[t.length - 1];
}, pT, sm = "or", VQt = "and", fZ = /* @__PURE__ */ function() {
function t(r) {
r === void 0 && (r = {}), this._options = F1(F1({}, LL), r), this._options.searchOptions = F1(F1({}, $Qt), 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 = {}, DQt(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 = NQt(this, T);
BQt(this, f, r), u.forEach(function(Q) {
var y = o(r, Q);
if (y != null) {
var b = s(y.toString(), Q);
FQt(n, f, n._fieldIds[Q], n.documentCount - 1, b.length), b.forEach(function(w) {
var S = a(w, Q);
bL(S) && IQt(n, n._fieldIds[Q], f, S);
});
}
});
}, 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, b) {
var w = Q.chunk, S = Q.promise;
return w.push(y), (b + 1) % a === 0 ? {
chunk: [],
promise: S.then(function() {
return i.addAll(w);
})
} : {
chunk: w,
promise: S
};
}, 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 b = y[1];
return T === b;
}) || [], 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 b = a(r, y);
if (b != null) {
var w = o(b.toString(), y);
w.forEach(function(S) {
var x = s(S, y);
bL(x) && RQt(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(w) {
return f(w);
}).filter(bL).map(UQt(n)), y = Q.map(function(w) {
return i.executeQuery(w, n);
}), b = this.combineResults(y, n.combineWith);
return Object.entries(b).reduce(function(w, S) {
var x = S[0], C = S[1], P = C.score, R = C.match, F = C.terms, U = {
id: i._documentIds[x],
terms: GQt(F),
score: P,
match: R
};
return Object.assign(U, i._storedFields[x]), (n.filter == null || n.filter(U)) && w.push(U), w;
}, []).sort(function(w, S) {
var x = w.score, C = S.score;
return x < C ? 1 : -1;
});
}, e.autoSuggest = function(r, n) {
n === void 0 && (n = {}), n = F1(F1({}, ZQt), 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(S, x) {
var C;
return F1(F1({}, S), {}, (C = {}, C[x] = QZ(S, x) || 1, C));
}, 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 b = [y];
if (r.prefix && this._index.atPrefix(r.term).forEach(function(S, x) {
var C = 0.3 * (S.length - r.term.length) / S.length;
b.push(_L(i, S, o, a, x, Q, C));
}), r.fuzzy) {
var w = r.fuzzy < 1 ? Math.round(r.term.length * r.fuzzy) : r.fuzzy;
Object.entries(this._index.fuzzyGet(r.term, w)).forEach(function(S) {
var x = S[0], C = S[1], P = C[0], R = C[1], F = R / x.length;
b.push(_L(i, x, o, a, P, T, F));
});
}
return b.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
};
}, uZ(t, [{
key: "documentCount",
get: function() {
return this._documentCount;
}
}]), t;
}();
fZ.SearchableMap = n0;
var IQt = 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));
});
}, RQt = 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!');
}
}, NQt = function(t, e) {
var r = t._nextId.toString(36);
return t._documentIds[r] = e, t._documentCount += 1, t._nextId += 1, r;
}, DQt = 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, b = Q.ds;
return Object.entries(b).forEach(function(w) {
var S = w[0], x = w[1], C = n ? n(t._documentIds[S], e) : 1;
if (C) {
var P = t._fieldLength[S][f] / t._averageFieldLength[f];
a[S] = a[S] || {
score: 0,
match: {},
terms: []
}, a[S].terms.push(e), a[S].match[e] = QZ(a[S].match, e) || [], a[S].score += C * zQt(x, y, t._documentCount, P, T, s), a[S].match[e].push(d);
}
}), a;
}, {});
}, QZ = function(t, e) {
return Object.prototype.hasOwnProperty.call(t, e) ? t[e] : void 0;
}, FQt = 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);
}, BQt = 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[VQt] = 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), jQt = function(t, e, r) {
return t * Math.log(r / e);
}, zQt = function(t, e, r, n, i, o) {
var s = i / (1 + 0.333 * i * o);
return s * jQt(t, e, r) / n;
}, UQt = 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
};
};
}, GQt = 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(WQt);
},
processTerm: function(t, e) {
return t.toLowerCase();
},
fields: void 0,
searchOptions: void 0,
storeFields: []
}, $Qt = {
combineWith: sm,
prefix: !1,
fuzzy: !1,
weights: {}
}, ZQt = {
prefix: function(t, e, r) {
return e === r.length - 1;
}
}, WQt = /[\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 mZ = [
"id",
"label",
"models",
"source"
];
var h9, o5;
class qQt {
constructor() {
Ft(this, h9, []), Ft(this, o5, void 0), Yt(this, o5, new fZ({
fields: ["text"],
storeFields: ["text"],
tokenize: (e, r) => e.split(" ")
}));
}
indexMetadata(e, r) {
const n = [];
for (const i of mZ)
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 XQt(n);
}
}
h9 = /* @__PURE__ */ new WeakMap(), o5 = /* @__PURE__ */ new WeakMap();
var Vf, If;
class XQt {
constructor(e) {
Ft(this, Vf, void 0), Ft(this, If, void 0), Yt(this, If, e.sort((r, n) => n.score - r.score)), Yt(this, Vf, e.map((r) => r.featureId));
}
get featureIds() {
return K(this, Vf);
}
get results() {
return K(this, If);
}
}
Vf = /* @__PURE__ */ new WeakMap(), If = /* @__PURE__ */ new WeakMap();
function EH(t, e, r) {
if (t !== null)
for (var n, i, o, s, a, u, d, T = 0, f = 0, Q, y = t.type, b = y === "FeatureCollection", w = y === "Feature", S = b ? t.features.length : 1, x = 0; x < S; x++) {
d = b ? t.features[x].geometry : w ? t.geometry : t, Q = d ? d.type === "GeometryCollection" : !1, a = Q ? d.geometries.length : 1;
for (var C = 0; C < a; C++) {
var P = 0, R = 0;
if (s = Q ? d.geometries[C] : d, s !== null) {
u = s.coordinates;
var F = s.type;
switch (T = 0, F) {
case null:
break;
case "Point":
if (e(
u,
f,
x,
P,
R
) === !1)
return !1;
f++, P++;
break;
case "LineString":
case "MultiPoint":
for (n = 0; n < u.length; n++) {
if (e(
u[n],
f,
x,
P,
R
) === !1)
return !1;
f++, F === "MultiPoint" && P++;
}
F === "LineString" && P++;
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,
P,
R
) === !1)
return !1;
f++;
}
F === "MultiLineString" && P++, F === "Polygon" && R++;
}
F === "Polygon" && P++;
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,
P,
R
) === !1)
return !1;
f++;
}
R++;
}
P++;
}
break;
case "GeometryCollection":
for (n = 0; n < s.geometries.length; n++)
if (EH(s.geometries[n], e) === !1)
return !1;
break;
default:
throw new Error("Unknown Geometry Type");
}
}
}
}
}
function KQt(t, e) {
var r, n, i, o, s, a, u, d, T, f, Q = 0, y = t.type === "FeatureCollection", b = t.type === "Feature", w = y ? t.features.length : 1;
for (r = 0; r < w; r++) {
for (a = y ? t.features[r].geometry : b ? t.geometry : t, d = y ? t.features[r].properties : b ? t.properties : {}, T = y ? t.features[r].bbox : b ? t.bbox : void 0, f = y ? t.features[r].id : b ? 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 YQt(t, e, r) {
var n = r;
return KQt(
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 JQt(t) {
return YQt(t, function(e, r) {
return e + tmt(r);
}, 0);
}
function tmt(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 emt(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 rmt(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 emt(Math.atan2(d, T));
}
function rmt(t, e) {
let r = SH(e, t);
return r = (r + 180) % 360, r;
}
var F2 = 63710088e-1, nmt = {
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 imt(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 omt(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 imt({
type: "Point",
coordinates: t
}, e, r);
}
function smt(t, e = "kilometers") {
const r = nmt[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 amt(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 iM(t, e, r, n = {}) {
const i = amt(t), o = xL(i[0]), s = xL(i[1]), a = xL(r), u = smt(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 omt([f, Q], n.properties);
}
function lmt(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 lmt({
type: "Point",
coordinates: t
}, e, r);
}
function vR(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
function cmt(t) {
return t.type === "Feature" ? t.geometry : t;
}
function umt(t, e, r = {}) {
const n = cmt(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 iM(
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 hmt = umt;
function oM(t) {
var e = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
return EH(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;
}
oM.default = oM;
var dmt = Object.defineProperty, Zn = (t, e) => dmt(t, "name", { value: e, configurable: !0 }), pmt = 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 = sM(t), n = sM(
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);
}
};
Zn(pmt, "GeojsonEquality");
function d9(t, e) {
return t.coordinates ? t.coordinates.length === e.coordinates.length : t.length === e.length;
}
Zn(d9, "sameLength");
function sM(t) {
return t.coordinates.map((e) => ({
type: t.type.replace("Multi", ""),
coordinates: e
}));
}
Zn(sM, "explode");
var B2 = 63710088e-1, gZ = {
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;
}
Zn(f3, "feature");
function Tmt(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 vZ(e).geometry;
case "MultiLineString":
return yZ(e).geometry;
case "MultiPolygon":
return _Z(e).geometry;
default:
throw new Error(t + " is invalid");
}
}
Zn(Tmt, "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);
}
Zn(zg, "point");
function fmt(t, e, r = {}) {
return O8(
t.map((n) => zg(n, e)),
r
);
}
Zn(fmt, "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);
}
Zn(HH, "polygon");
function Qmt(t, e, r = {}) {
return O8(
t.map((n) => HH(n, e)),
r
);
}
Zn(Qmt, "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);
}
Zn(AH, "lineString");
function mmt(t, e, r = {}) {
return O8(
t.map((n) => AH(n, e)),
r
);
}
Zn(mmt, "lineStrings");
function O8(t, e = {}) {
const r = { type: "FeatureCollection" };
return e.id && (r.id = e.id), e.bbox && (r.bbox = e.bbox), r.features = t, r;
}
Zn(O8, "featureCollection");
function yZ(t, e, r = {}) {
return f3({
type: "MultiLineString",
coordinates: t
}, e, r);
}
Zn(yZ, "multiLineString");
function vZ(t, e, r = {}) {
return f3({
type: "MultiPoint",
coordinates: t
}, e, r);
}
Zn(vZ, "multiPoint");
function _Z(t, e, r = {}) {
return f3({
type: "MultiPolygon",
coordinates: t
}, e, r);
}
Zn(_Z, "multiPolygon");
function gmt(t, e, r = {}) {
return f3({
type: "GeometryCollection",
geometries: t
}, e, r);
}
Zn(gmt, "geometryCollection");
function ymt(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(ymt, "round");
function bZ(t, e = "kilometers") {
const r = gZ[e];
if (!r)
throw new Error(e + " units is invalid");
return t * r;
}
Zn(bZ, "radiansToLength");
function CH(t, e = "kilometers") {
const r = gZ[e];
if (!r)
throw new Error(e + " units is invalid");
return t / r;
}
Zn(CH, "lengthToRadians");
function vmt(t, e) {
return LZ(CH(t, e));
}
Zn(vmt, "lengthToDegrees");
function _mt(t) {
let e = t % 360;
return e < 0 && (e += 360), e;
}
Zn(_mt, "bearingToAzimuth");
function LZ(t) {
return t % (2 * Math.PI) * 180 / Math.PI;
}
Zn(LZ, "radiansToDegrees");
function bmt(t) {
return t % 360 * Math.PI / 180;
}
Zn(bmt, "degreesToRadians");
function Lmt(t, e = "kilometers", r = "kilometers") {
if (!(t >= 0))
throw new Error("length must be a positive number");
return bZ(CH(t, e), r);
}
Zn(Lmt, "convertLength");
function wmt(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;
}
Zn(wmt, "convertArea");
function am(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
Zn(am, "isNumber");
function xmt(t) {
return t !== null && typeof t == "object" && !Array.isArray(t);
}
Zn(xmt, "isObject");
function Mmt(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");
});
}
Zn(Mmt, "validateBBox");
function Emt(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(Emt, "validateId");
let wZ = class {
constructor(t = [], e = Smt) {
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 Smt(t, e) {
return t < e ? -1 : t > e ? 1 : 0;
}
function xZ(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 Hmt(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 Amt(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, xZ(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 Cmt {
constructor(e) {
this.leftSweepEvent = e, this.rightSweepEvent = e.otherEvent;
}
}
function Omt(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, b = Q / T;
if (y >= 0 && y <= 1 && b >= 0 && b <= 1) {
const w = r + y * (i - r), S = n + y * (o - n);
return [w, S];
}
return !1;
}
function Pmt(t, e) {
e = e || !1;
const r = [], n = new wZ([], Hmt);
for (; t.length; ) {
const i = t.pop();
if (i.isLeftEndpoint) {
const o = new Cmt(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 = Omt(o, a);
u !== !1 && r.push(u);
}
n.push(o);
} else
i.isLeftEndpoint === !1 && n.pop();
}
return r;
}
function kmt(t, e) {
const r = new wZ([], xZ);
return Amt(t, r), Pmt(r, e);
}
var Vmt = Object.defineProperty, Imt = (t, e) => Vmt(t, "name", { value: e, configurable: !0 }), Rmt = kmt;
function MZ(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 = Rmt(
O8(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 O8(a.map((u) => zg(u)));
}
Imt(MZ, "lineIntersect");
var Nmt = Object.defineProperty, Wn = (t, e) => Nmt(t, "name", { value: e, configurable: !0 }), Dmt = 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 = aM(t), n = aM(
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);
}
};
Wn(Dmt, "GeojsonEquality");
function p9(t, e) {
return t.coordinates ? t.coordinates.length === e.coordinates.length : t.length === e.length;
}
Wn(p9, "sameLength");
function aM(t) {
return t.coordinates.map((e) => ({
type: t.type.replace("Multi", ""),
coordinates: e
}));
}
Wn(aM, "explode");
var j2 = 63710088e-1, EZ = {
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;
}
Wn(Q3, "feature");
function Fmt(t, e, r = {}) {
switch (t) {
case "Point":
return Ms(e).geometry;
case "LineString":
return ra(e).geometry;
case "Polygon":
return OH(e).geometry;
case "MultiPoint":
return HZ(e).geometry;
case "MultiLineString":
return SZ(e).geometry;
case "MultiPolygon":
return AZ(e).geometry;
default:
throw new Error(t + " is invalid");
}
}
Wn(Fmt, "geometry");
function Ms(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 (!P8(t[0]) || !P8(t[1]))
throw new Error("coordinates must contain numbers");
return Q3({
type: "Point",
coordinates: t
}, e, r);
}
Wn(Ms, "point");
function Bmt(t, e, r = {}) {
return Ug(
t.map((n) => Ms(n, e)),
r
);
}
Wn(Bmt, "points");
function OH(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);
}
Wn(OH, "polygon");
function jmt(t, e, r = {}) {
return Ug(
t.map((n) => OH(n, e)),
r
);
}
Wn(jmt, "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);
}
Wn(ra, "lineString");
function zmt(t, e, r = {}) {
return Ug(
t.map((n) => ra(n, e)),
r
);
}
Wn(zmt, "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;
}
Wn(Ug, "featureCollection");
function SZ(t, e, r = {}) {
return Q3({
type: "MultiLineString",
coordinates: t
}, e, r);
}
Wn(SZ, "multiLineString");
function HZ(t, e, r = {}) {
return Q3({
type: "MultiPoint",
coordinates: t
}, e, r);
}
Wn(HZ, "multiPoint");
function AZ(t, e, r = {}) {
return Q3({
type: "MultiPolygon",
coordinates: t
}, e, r);
}
Wn(AZ, "multiPolygon");
function Umt(t, e, r = {}) {
return Q3({
type: "GeometryCollection",
geometries: t
}, e, r);
}
Wn(Umt, "geometryCollection");
function Gmt(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(Gmt, "round");
function CZ(t, e = "kilometers") {
const r = EZ[e];
if (!r)
throw new Error(e + " units is invalid");
return t * r;
}
Wn(CZ, "radiansToLength");
function PH(t, e = "kilometers") {
const r = EZ[e];
if (!r)
throw new Error(e + " units is invalid");
return t / r;
}
Wn(PH, "lengthToRadians");
function $mt(t, e) {
return OZ(PH(t, e));
}
Wn($mt, "lengthToDegrees");
function Zmt(t) {
let e = t % 360;
return e < 0 && (e += 360), e;
}
Wn(Zmt, "bearingToAzimuth");
function OZ(t) {
return t % (2 * Math.PI) * 180 / Math.PI;
}
Wn(OZ, "radiansToDegrees");
function Wmt(t) {
return t % 360 * Math.PI / 180;
}
Wn(Wmt, "degreesToRadians");
function qmt(t, e = "kilometers", r = "kilometers") {
if (!(t >= 0))
throw new Error("length must be a positive number");
return CZ(PH(t, e), r);
}
Wn(qmt, "convertLength");
function Xmt(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;
}
Wn(Xmt, "convertArea");
function P8(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
Wn(P8, "isNumber");
function kH(t) {
return t !== null && typeof t == "object" && !Array.isArray(t);
}
Wn(kH, "isObject");
function Kmt(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 (!P8(e))
throw new Error("bbox must only contain numbers");
});
}
Wn(Kmt, "validateBBox");
function Ymt(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(Ymt, "validateId");
var Jmt = Object.defineProperty, ao = (t, e) => Jmt(t, "name", { value: e, configurable: !0 });
function Md(t, e, r) {
if (t !== null)
for (var n, i, o, s, a, u, d, T = 0, f = 0, Q, y = t.type, b = y === "FeatureCollection", w = y === "Feature", S = b ? t.features.length : 1, x = 0; x < S; x++) {
d = b ? t.features[x].geometry : w ? t.geometry : t, Q = d ? d.type === "GeometryCollection" : !1, a = Q ? d.geometries.length : 1;
for (var C = 0; C < a; C++) {
var P = 0, R = 0;
if (s = Q ? d.geometries[C] : 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,
P,
R
) === !1)
return !1;
f++, P++;
break;
case "LineString":
case "MultiPoint":
for (n = 0; n < u.length; n++) {
if (e(
u[n],
f,
x,
P,
R
) === !1)
return !1;
f++, F === "MultiPoint" && P++;
}
F === "LineString" && P++;
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,
P,
R
) === !1)
return !1;
f++;
}
F === "MultiLineString" && P++, F === "Polygon" && R++;
}
F === "Polygon" && P++;
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,
P,
R
) === !1)
return !1;
f++;
}
R++;
}
P++;
}
break;
case "GeometryCollection":
for (n = 0; n < s.geometries.length; n++)
if (Md(s.geometries[n], e, r) === !1)
return !1;
break;
default:
throw new Error("Unknown Geometry Type");
}
}
}
}
}
ao(Md, "coordEach");
function tgt(t, e, r, n) {
var i = r;
return Md(
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(tgt, "coordReduce");
function PZ(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(PZ, "propEach");
function egt(t, e, r) {
var n = r;
return PZ(t, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
ao(egt, "propReduce");
function kZ(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(kZ, "featureEach");
function rgt(t, e, r) {
var n = r;
return kZ(t, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
ao(rgt, "featureReduce");
function ngt(t) {
var e = [];
return Md(t, function(r) {
e.push(r);
}), e;
}
ao(ngt, "coordAll");
function VH(t, e) {
var r, n, i, o, s, a, u, d, T, f, Q = 0, y = t.type === "FeatureCollection", b = t.type === "Feature", w = y ? t.features.length : 1;
for (r = 0; r < w; r++) {
for (a = y ? t.features[r].geometry : b ? t.geometry : t, d = y ? t.features[r].properties : b ? t.properties : {}, T = y ? t.features[r].bbox : b ? t.bbox : void 0, f = y ? t.features[r].id : b ? 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(VH, "geomEach");
function igt(t, e, r) {
var n = r;
return VH(
t,
function(i, o, s, a, u) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a,
u
);
}
), n;
}
ao(igt, "geomReduce");
function Ed(t, e) {
VH(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(Ed, "flattenEach");
function ogt(t, e, r) {
var n = r;
return Ed(
t,
function(i, o, s) {
o === 0 && s === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s
);
}
), n;
}
ao(ogt, "flattenReduce");
function VZ(t, e) {
Ed(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 (Md(
r,
function(f, Q, y, b, w) {
if (a === void 0 || n > u || b > d || w > T) {
a = f, u = n, d = b, T = w, o = 0;
return;
}
var S = ra(
[a, f],
r.properties
);
if (e(
S,
n,
i,
w,
o
) === !1)
return !1;
o++, a = f;
}
) === !1)
return !1;
}
}
});
}
ao(VZ, "segmentEach");
function sgt(t, e, r) {
var n = r, i = !1;
return VZ(
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(sgt, "segmentReduce");
function IZ(t, e) {
if (!t)
throw new Error("geojson is required");
Ed(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(IZ, "lineEach");
function agt(t, e, r) {
var n = r;
return IZ(
t,
function(i, o, s, a) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a
);
}
), n;
}
ao(agt, "lineReduce");
function lgt(t, e) {
if (e = e || {}, !kH(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(lgt, "findSegment");
function cgt(t, e) {
if (e = e || {}, !kH(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 Ms(u, s, e);
case "MultiPoint":
return n < 0 && (n = u.length + n), Ms(u[n], s, e);
case "LineString":
return o < 0 && (o = u.length + o), Ms(u[o], s, e);
case "Polygon":
return i < 0 && (i = u.length + i), o < 0 && (o = u[i].length + o), Ms(u[i][o], s, e);
case "MultiLineString":
return n < 0 && (n = u.length + n), o < 0 && (o = u[n].length + o), Ms(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), Ms(
u[n][i][o],
s,
e
);
}
throw new Error("geojson is invalid");
}
ao(cgt, "findPoint");
var ugt = Object.defineProperty, m0 = (t, e) => ugt(t, "name", { value: e, configurable: !0 });
function hgt(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(hgt, "getCoord");
function RZ(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(RZ, "getCoords");
function NZ(t) {
if (t.length > 1 && P8(t[0]) && P8(t[1]))
return !0;
if (Array.isArray(t[0]) && t[0].length)
return NZ(t[0]);
throw new Error("coordinates must only contain numbers");
}
m0(NZ, "containsNumber");
function dgt(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(dgt, "geojsonType");
function pgt(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(pgt, "featureOf");
function Tgt(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(Tgt, "collectionOf");
function fgt(t) {
return t.type === "Feature" ? t.geometry : t;
}
m0(fgt, "getGeom");
function Qgt(t, e) {
return t.type === "FeatureCollection" ? "FeatureCollection" : t.type === "GeometryCollection" ? "GeometryCollection" : t.type === "Feature" && t.geometry !== null ? t.geometry.type : t.type;
}
m0(Qgt, "getType");
var DZ = Object.defineProperty, mgt = Object.defineProperties, ggt = Object.getOwnPropertyDescriptors, xR = Object.getOwnPropertySymbols, ygt = Object.prototype.hasOwnProperty, vgt = Object.prototype.propertyIsEnumerable, MR = (t, e, r) => e in t ? DZ(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, $0 = (t, e) => {
for (var r in e || (e = {}))
ygt.call(e, r) && MR(t, r, e[r]);
if (xR)
for (var r of xR(e))
vgt.call(e, r) && MR(t, r, e[r]);
return t;
}, Z0 = (t, e) => mgt(t, ggt(e)), _gt = (t, e) => DZ(t, "name", { value: e, configurable: !0 });
function FZ(t, e, r = {}) {
if (!t || !e)
throw new Error("lines and pt are required arguments");
let n = Ms([1 / 0, 1 / 0], {
dist: 1 / 0,
index: -1,
location: -1
}), i = 0;
return Ed(t, function(o) {
const s = RZ(o);
for (let a = 0; a < s.length - 1; a++) {
const u = Ms(s[a]);
u.properties.dist = g5(e, u, r);
const d = Ms(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 = iM(
e,
f,
Q + 90,
r
), b = iM(
e,
f,
Q - 90,
r
), w = MZ(
ra([
y.geometry.coordinates,
b.geometry.coordinates
]),
ra([u.geometry.coordinates, d.geometry.coordinates])
);
let S;
w.features.length > 0 && w.features[0] && (S = Z0($0({}, w.features[0]), {
properties: {
dist: g5(e, w.features[0], r),
location: i + g5(u, w.features[0], r)
}
})), u.properties.dist < n.properties.dist && (n = Z0($0({}, u), {
properties: Z0($0({}, u.properties), { index: a, location: i })
})), d.properties.dist < n.properties.dist && (n = Z0($0({}, d), {
properties: Z0($0({}, d.properties), {
index: a + 1,
location: i + T
})
})), S && S.properties.dist < n.properties.dist && (n = Z0($0({}, S), {
properties: Z0($0({}, S.properties), { index: a })
})), i += T;
}
}), n;
}
_gt(FZ, "nearestPointOnLine");
function bgt(t) {
if (!t)
throw new Error("geojson is required");
switch (t.type) {
case "Feature":
return BZ(t);
case "FeatureCollection":
return Lgt(t);
case "Point":
case "LineString":
case "Polygon":
case "MultiPoint":
case "MultiLineString":
case "MultiPolygon":
case "GeometryCollection":
return IH(t);
default:
throw new Error("unknown GeoJSON type");
}
}
function BZ(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 = jZ(t.properties), e.geometry = IH(t.geometry), e;
}
function jZ(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] = jZ(n) : e[r] = n;
}), e;
}
function Lgt(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 BZ(r);
}), e;
}
function IH(t) {
var e = { type: t.type };
return t.bbox && (e.bbox = t.bbox), t.type === "GeometryCollection" ? (e.geometries = t.geometries.map(function(r) {
return IH(r);
}), e) : (e.coordinates = zZ(t.coordinates), e);
}
function zZ(t) {
var e = t;
return typeof e[0] != "object" ? e.slice() : e.map(function(r) {
return zZ(r);
});
}
function wgt(t, e) {
return e === void 0 && (e = {}), xgt(t, "mercator", e);
}
function xgt(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) && Ix(t[0]) ? t = ER(t) : (n !== !0 && (t = bgt(t)), EH(t, function(i) {
var o = ER(i);
i[0] = o[0], i[1] = o[1];
})), t;
}
function ER(t) {
var e = Math.PI / 180, r = 6378137, n = 20037508342789244e-9, i = Math.abs(t[0]) <= 180 ? t[0] : t[0] - Mgt(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 Mgt(t) {
return t < 0 ? -1 : t > 0 ? 1 : 0;
}
class Egt {
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 Sgt(t, e = 1, r = !1) {
let n = 1 / 0, i = 1 / 0, o = -1 / 0, s = -1 / 0;
for (const [x, C] of t[0])
x < n && (n = x), C < i && (i = C), x > o && (o = x), C > s && (s = C);
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 Egt([], (x, C) => C.max - x.max);
let f = Agt(t);
const Q = new lm(n + a / 2, i + u / 2, 0, t);
Q.d > f.d && (f = Q);
let y = 2;
function b(x, C, P) {
const R = new lm(x, C, P, 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 w = d / 2;
for (let x = n; x < o; x += d)
for (let C = i; C < s; C += d)
b(x + w, C + w, w);
for (; T.length; ) {
const { max: x, x: C, y: P, h: R } = T.pop();
if (x - f.d <= e)
break;
w = R / 2, b(C - w, P - w, w), b(C + w, P - w, w), b(C - w, P + w, w), b(C + w, P + w, w);
}
r && console.log(`num probes: ${y}
best distance: ${f.d}`);
const S = [f.x, f.y];
return S.distance = f.d, S;
}
function lm(t, e, r, n) {
this.x = t, this.y = e, this.h = r, this.d = Hgt(t, e, n), this.max = this.d + this.h * Math.SQRT2;
}
function Hgt(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, Cgt(t, e, d, T));
}
return i === 0 ? 0 : (n ? 1 : -1) * Math.sqrt(i);
}
function Agt(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 Cgt(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 ie(this, ah, Rf).call(this, K(this, di));
}
match(e) {
return ie(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) => ie(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 = ie(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) => ie(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 = !ie(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 Ogt = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, W3 = 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;
}, Es = function(t, e, r) {
return e === void 0 && (e = 0), r === void 0 && (r = 1), t > r ? r : t > e ? t : e;
}, UZ = function(t) {
return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;
}, SR = function(t) {
return { r: Es(t.r, 0, 255), g: Es(t.g, 0, 255), b: Es(t.b, 0, 255), a: Es(t.a) };
}, ML = function(t) {
return { r: z1(t.r), g: z1(t.g), b: z1(t.b), a: z1(t.a, 3) };
}, Pgt = /^#([0-9a-f]{3,8})$/i, gT = function(t) {
var e = t.toString(16);
return e.length < 2 ? "0" + e : e;
}, GZ = 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 };
}, $Z = 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: UZ(t.h), s: Es(t.s, 0, 100), l: Es(t.l, 0, 100), a: Es(t.a) };
}, AR = function(t) {
return { h: z1(t.h), s: z1(t.s), l: z1(t.l), a: z1(t.a, 3) };
}, CR = function(t) {
return $Z((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 = GZ(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;
}, kgt = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Vgt = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Igt = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Rgt = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, OR = { string: [[function(t) {
var e = Pgt.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 = Igt.exec(t) || Rgt.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 = kgt.exec(t) || Vgt.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) * (Ogt[n] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) });
return CR(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 W3(e) && W3(r) && W3(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 (!W3(e) || !W3(r) || !W3(n))
return null;
var s = HR({ h: Number(e), s: Number(r), l: Number(n), a: Number(o) });
return CR(s);
}, "hsl"], [function(t) {
var e = t.h, r = t.s, n = t.v, i = t.a, o = i === void 0 ? 1 : i;
if (!W3(e) || !W3(r) || !W3(n))
return null;
var s = function(a) {
return { h: UZ(a.h), s: Es(a.s, 0, 100), v: Es(a.v, 0, 100), a: Es(a.a) };
}({ h: Number(e), s: Number(r), v: Number(n), a: Number(o) });
return $Z(s);
}, "hsv"]] }, PR = 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];
}, Ngt = function(t) {
return typeof t == "string" ? PR(t.trim(), OR.string) : typeof t == "object" && t !== null ? PR(t, OR.object) : [null, void 0];
}, EL = function(t, e) {
var r = ch(t);
return { h: r.h, s: Es(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;
}, kR = function(t, e) {
var r = ch(t);
return { h: r.h, s: r.s, l: Es(r.l + 100 * e, 0, 100), a: r.a };
}, VR = function() {
function t(e) {
this.parsed = Ngt(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 = ML(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 ML(this.rgba);
}, t.prototype.toRgbString = function() {
return e = ML(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 = GZ(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(EL(this.rgba, e));
}, t.prototype.desaturate = function(e) {
return e === void 0 && (e = 0.1), ja(EL(this.rgba, -e));
}, t.prototype.grayscale = function() {
return ja(EL(this.rgba, -1));
}, t.prototype.lighten = function(e) {
return e === void 0 && (e = 0.1), ja(kR(this.rgba, e));
}, t.prototype.darken = function(e) {
return e === void 0 && (e = 0.1), ja(kR(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 VR ? t : new VR(t);
};
const IR = {
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 Dgt {
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 IR && "0123456789".includes(r[0]) ? (e[e.length - 1] = r.padStart(IR[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 Fgt(t, e = 0) {
let r;
return function(...n) {
clearTimeout(r), r = setTimeout(() => t.apply(this, n), e);
};
}
const Z2 = "pathways", Bgt = "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])), ZZ = cm.flatMap((t) => [["==", ["get", "kind"], t.type], t.colour]);
function jgt(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 zgt = ["NO-NERVES", "No associated nerves"];
var Ff, f9, M7, Q9, Bf, m9, J3, C6, a4, E7, za, u4, O6, g9, S7, P6, t4, s5, lM, WZ, Ua, e4, qZ, H7, uh, jf, cM;
class Ugt {
constructor(e, r) {
if (Ft(this, lM), Ft(this, Ua), Ft(this, qZ), Ft(this, jf), Ft(this, Ff, void 0), Ft(this, f9, /* @__PURE__ */ new Map()), Ft(this, M7, void 0), Ft(this, Q9, !1), Ft(this, Bf, void 0), Ft(this, m9, !0), Ft(this, J3, void 0), Ft(this, C6, /* @__PURE__ */ new Map()), Ft(this, a4, void 0), Ft(this, E7, /* @__PURE__ */ new Map()), Ft(this, za, void 0), Ft(this, u4, void 0), Ft(this, O6, void 0), Ft(this, g9, void 0), Ft(this, S7, void 0), Ft(this, P6, 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, M7, {}), Yt(this, S7, {}), "models" in e.pathways)
for (const a of e.pathways.models) {
K(this, M7)[a.id] = a.paths;
for (const u of a.paths)
K(this, S7)[u] = a.id;
}
Yt(this, za, {}), Yt(this, P6, {}), 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, E7).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, P6)[a] = d;
}
for (const d of u.centrelines || [])
K(this, C6).has(d) || K(this, C6).set(d, /* @__PURE__ */ new Set()), K(this, C6).get(d).add(a);
}
Yt(this, O6, RR(K(this, E7))), 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)))
ie(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, C6).has(d)) && T && "models" in T && K(this, f9).set(T.models, T.label || T.models);
}
ie(this, lM, WZ).call(this), e.options.style === no.CENTRELINE ? Yt(this, Q9, !0) : Yt(this, m9, K(this, f9).size > 0);
}
get nerveCentrelineDetails() {
return [zgt, ...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, O6).has(n) && ie(this, Ua, e4).call(this, K(this, O6).get(n), r);
return r;
}
nerveFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
return K(this, g9).has(e) && ie(this, Ua, e4).call(this, K(this, g9).get(e), r), r;
}
pathProperties(e) {
const r = Object.assign({}, e.properties);
if (K(this, O6).has(e.id))
for (const n of K(this, O6).get(e.id))
n in K(this, S7) && (r.connectivity = K(this, S7)[n]), n in K(this, P6) && (r.models = K(this, P6)[n]);
return r;
}
connectivityModelFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
return e in K(this, M7) && ie(this, Ua, e4).call(this, K(this, M7)[e], r), r;
}
pathModelFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
return e in K(this, za) && ie(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) && ie(this, Ua, e4).call(this, K(this, J3)[e], r), r;
}
enablePathLines(e, r = !1) {
for (const n of K(this, O6).keys())
K(this, s5).enableFeature(n, e, r);
}
enablePathsByCentreline(e, r, n = !1) {
if (K(this, C6).has(e)) {
if (K(this, E7).has(e))
for (const o of K(this, E7).get(e))
K(this, s5).enableFeature(o, r, n);
const i = /* @__PURE__ */ new Set();
ie(this, Ua, e4).call(this, K(this, C6).get(e), i);
for (const o of i)
K(this, s5).enableFeature(o, r, n);
ie(this, jf, cM).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();
ie(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 && ie(this, jf, cM).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, P6) && r.add(K(this, P6)[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(), M7 = /* @__PURE__ */ new WeakMap(), Q9 = /* @__PURE__ */ new WeakMap(), Bf = /* @__PURE__ */ new WeakMap(), m9 = /* @__PURE__ */ new WeakMap(), J3 = /* @__PURE__ */ new WeakMap(), C6 = /* @__PURE__ */ new WeakMap(), a4 = /* @__PURE__ */ new WeakMap(), E7 = /* @__PURE__ */ new WeakMap(), za = /* @__PURE__ */ new WeakMap(), u4 = /* @__PURE__ */ new WeakMap(), O6 = /* @__PURE__ */ new WeakMap(), g9 = /* @__PURE__ */ new WeakMap(), S7 = /* @__PURE__ */ new WeakMap(), P6 = /* @__PURE__ */ new WeakMap(), t4 = /* @__PURE__ */ new WeakMap(), s5 = /* @__PURE__ */ new WeakMap(), lM = /* @__PURE__ */ new WeakSet(), WZ = 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));
}
}, qZ = /* @__PURE__ */ new WeakSet(), H7 = /* @__PURE__ */ new WeakMap(), uh = /* @__PURE__ */ new WeakMap(), jf = /* @__PURE__ */ new WeakSet(), cM = function(t = {}) {
for (const e of K(this, uh).values())
e(t);
};
const XZ = 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;
}
};
XZ._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 uM = XZ;
class Ggt {
/************************
* 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;
/