UNPKG

@solarpunkltd/comment-system

Version:

A library for writing and reading comments from the Swarm network.

1,431 lines 107 kB
import { FeedIndex as V, Bee as q, PrivateKey as bc, Topic as Et, Bytes as St } from "@ethersphere/bee-js"; function xc(s) { return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s; } var pr = {}, Hn; function Ac() { return Hn || (Hn = 1, function(s) { var l; Object.defineProperty(s, "__esModule", { value: !0 }), s.Vector = s.Cache = s.Assertions = s.Strings = s.Types = s.Objects = s.Dates = s.Promises = s.Numbers = s.System = s.Arrays = s.Random = s.Elliptic = s.Binary = s.TrieRouter = s.AsyncQueue = s.PubSubChannel = s.FixedPointNumber = s.MerkleTree = s.Chunk = s.Uint8ArrayWriter = s.Uint8ArrayReader = s.AsyncLazy = s.Lazy = s.Optional = void 0; async function h(t) { return new Promise((e, r) => t.then(r, e)); } async function f(t) { return h(Promise.all(t.map(h))); } async function w(t, e = 1) { const r = pn(t, e), n = [], i = r.map(async (o) => { for (const a of o) n.push(await a()); }); return await Promise.all(i), n; } async function g(t) { return new Promise( (e) => setTimeout(() => { e(!0); }, t) ); } function p(t, e = Math.random) { for (let r = t.length - 1; r > 0; r--) { const n = Math.floor(e() * (r + 1)), i = t[r]; t[r] = t[n], t[n] = i; } return t; } function y(t) { if (t.length === 1) return t[0]; throw Error(`Expected exactly one element, actual: ${t.length}`); } function m(t) { return t.length === 1 ? t[0] : null; } function b(t) { return t.length > 0 ? t[0] : null; } function U(t) { if (!t.length) throw Error("Received empty array"); return t[0]; } function B(t, e) { const r = []; for (let n = 0; n < t; n++) r.push(e(n)); return r; } function C(t) { const e = []; for (let r = 0; r < t[0].length; r++) { e.push([]); for (let n = 0; n < t.length; n++) e[r].push(t[n][r]); } return e; } function j(t, e, r) { const n = []; for (let i = 0; i < t; i++) { n.push([]); for (let o = 0; o < e; o++) n[i].push(r); } return n; } function v(t, e, r, n) { if (r < 0 || n < 0 || n + e[0].length > t[0].length || r + e.length > t.length) return !1; for (let i = 0; i < e.length; i++) for (let o = 0; o < e[i].length; o++) if (e[i][o] !== void 0 && t[r + i][n + o] !== e[i][o]) return !1; return !0; } function $(t, e, r = Math.random) { return p(jr(0, t.length - 1), r).slice(0, e); } function H(t, e) { return t.map((r) => r[e]); } function qt(t) { let e = t, r = 3405648695, n = 3735928559; return function() { return e += r, r ^= e << 7, e *= n, n ^= e << 13, e ^= r ^ n, (e >>> 0) / 4294967296; }; } function Ht(t, e, r = Math.random) { return Math.floor(r() * (e - t + 1)) + t; } function Yn(t, e, r = Math.random) { return r() * (e - t) + t; } function ti() { return Math.random() * 2 - 1; } function ei(t, e, r) { return e >= t.x && e < t.x + t.width && r >= t.y && r < t.y + t.height; } function ri(t, e, r, n = Math.random) { let i, o; do i = Ht(0, t - 1, n), o = Ht(0, e - 1, n); while (r && ei(r, i, o)); return [i, o]; } function ni(t, e = Math.random) { const r = Math.floor(t), n = t - r; return Er(n, e) ? r + 1 : r; } function Er(t, e = Math.random) { return e() < t; } function Kt(t, e = Math.random) { return t[Math.floor(t.length * e())]; } function ii(t, e, r = Math.random) { if (e > t.length) throw new Error(`Count (${e}) is greater than array length (${t.length})`); return $(t, e, r).map((n) => t[n]); } function oi(t, e, r, n = Math.random) { if (e > t.length) throw new Error(`Count (${e}) is greater than array length (${t.length})`); const i = []; for (; i.length < e; ) { const o = Kt(t, n); i.some((a) => r(a, o)) || i.push(o); } return i; } function si(t, e, r, n, i, o = Math.random) { const a = t.filter((u) => u !== e && u !== r), c = []; for (e !== null && c.push(e); a.length && c.length < n; ) { const u = s.Random.intBetween(0, a.length - 1, o); i(a[u], c) && c.push(a[u]), a.splice(u, 1); } return p(c, o), { values: c, indexOfGuaranteed: e !== null ? c.indexOf(e) : -1 }; } function ot(t) { if (!t.length) throw Error("Received empty array"); return t[t.length - 1]; } function vr(t, e, r) { return r(e.reduce((n, i) => i(n), t)); } function ai(t, e) { return (r) => vr(r, t, e); } function ui(t, e, r) { if (r === void 0 && (r = Math.random()), t.length !== e.length) throw new Error("Array length mismatch"); let n = e.reduce((o, a) => o + a, 0); const i = r * n; for (let o = 0; o < t.length - 1; o++) if (n -= e[o], i >= n) return t[o]; return ot(t); } function ci(t, e, r = Math.random) { const n = e.map((o) => r() * o), i = []; for (let o = 0; o < t.length; o++) i.push([t[o], n[o]]); return i.sort((o, a) => a[1] - o[1]).map((o) => o[0]); } function K(t, e) { if (t == null) return null; const r = e.split("."); let n = t; for (const i of r) { if (n[i] === null || n[i] === void 0) return null; n = n[i]; } return n; } function J(t, e, r) { const n = e.split(/\.|\[/); let i = t; for (let o = 0; o < n.length; o++) { const a = n[o], c = o < n.length - 1 && n[o + 1].includes("]"), u = a.includes("]") ? a.replace(/\[|\]/g, "") : a; if (o === n.length - 1) return i[u] = r, r; P(i[u]) || (c ? i[u] = [] : i[u] = {}), i = i[u]; } return r; } function li(t, e, r = 1) { const n = K(t, e) || 0; return J(t, e, n + r), n; } function fi(t, e, r) { return K(t, e) || J(t, e, r); } function hi(t, e) { const r = te(e, "."), n = Pr(e, "."); if (!r || !n) return; const i = K(t, r); i && delete i[n]; } function di(t, e, r) { const n = K(t, e); if (!n) throw new Error("Key '" + e + "' does not exist."); return J(t, e, r), n; } function gi(t, e, r) { for (const n of e) { const i = K(t, n); if (i) return i; } if (r) { const n = Object.values(t); if (n.length) return n[0]; } return null; } async function mi(t, e, r) { for (; ; ) { try { await t(); } catch (n) { r && r("Error in forever", n); } await g(e); } } function pi(t, e) { t(); const r = setInterval(() => { t(); }, e); return () => clearInterval(r); } function yi() { const t = globalThis.process; return t ? t.browser === !0 ? "browser" : "node" : "browser"; } function wi(t) { return t / 1024 / 1024; } function bi(t, e = 1024) { return t >= e * e * e * e ? (t / e / e / e / e).toFixed(3) + " TB" : t >= e * e * e ? (t / e / e / e).toFixed(3) + " GB" : t >= e * e ? (t / e / e).toFixed(3) + " MB" : t >= e ? (t / e).toFixed(3) + " KB" : t + " B"; } function xi(t) { const e = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t.toLowerCase()); if (!e) throw new Error("Invalid hex color: " + t); return [parseInt(e[1], 16), parseInt(e[2], 16), parseInt(e[3], 16)]; } function Ai(t) { return "#" + t.map((e) => e.toString(16).padStart(2, "0")).join(""); } function Ei(t, e, r, n) { const i = t * Math.PI / 180, o = r * Math.PI / 180, a = (r - t) * Math.PI / 180, c = (n - e) * Math.PI / 180, u = Math.sin(a / 2) * Math.sin(a / 2) + Math.cos(i) * Math.cos(o) * Math.sin(c / 2) * Math.sin(c / 2); return 6371e3 * (2 * Math.atan2(Math.sqrt(u), Math.sqrt(1 - u))); } function Ot(t, e) { return Math.round(t / e) * e; } function vi(t) { return t > 1e3 ? (t / 1e3).toFixed(0) + " km" : t >= 500 ? Ot(t, 100) + " m" : t >= 100 ? Ot(t, 50) + " m" : Ot(t, 10) + " m"; } function $i(t) { return t * (t + 1) / 2; } function Si(t) { const e = t.match(/-?\d+(\.\d+)?/); if (!e) throw Error("No float found in " + t); return parseFloat(e[0]); } function P(t, e = !0) { return !t || e && !Jt(t._readableState) || e && t.constructor && (t.constructor.isBuffer || t.constructor.name == "Uint8Array" || t.constructor.name === "ArrayBuffer" || t.constructor.name === "ReadableStream") ? !1 : typeof t == "object"; } function G(t) { return P(t) && !Array.isArray(t); } function $r(t) { return Array.isArray(t) && t.length === 0; } function Oi(t) { return G(t) && Object.keys(t).length === 0; } function Jt(t) { return t === void 0; } function Tt(t) { return Object.prototype.toString.call(t) === "[object Function]" || Object.prototype.toString.call(t) === "[object AsyncFunction]"; } function k(t) { return Object.prototype.toString.call(t) === "[object String]"; } function R(t) { return typeof t == "number" && isFinite(t); } function Sr(t) { return t === !0 || t === !1; } function Y(t) { return Object.prototype.toString.call(t) === "[object Date]"; } function Mt(t) { return !k(t) || t.trim().length === 0; } function Zt(t) { return R(t) && Number.isInteger(t) && t >= 1; } function Or(t) { return k(t) && t.match(/^-?\d+$/) !== null; } function Tr(t) { return k(t) && t.match(/^(0x)?[0-9a-f]+$/i) !== null; } const Ti = "!@#$%^&*()_+-=[]{}|;:<>?,./", Mi = "!@#$%^&*()_+-=[]{}|;:<>?,./".split(""), Qt = "abcdefghijklmnopqrstuvwxyz", ki = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", Ii = "1234567890", Xt = Qt + ki + Ii, Mr = Xt + Ti, kr = ["—", "\\", "東", "京", "都", "𝖆", "𝖇", "𝖈", "👾", "🙇", "💁", "🙅", "ᚠ", "ᛇ", "ᚻ", "ᛦ"], Ir = "0123456789abcdef"; function Ui(t, e = Math.random) { let r = ""; for (let n = 0; n < t; n++) r += Qt[Math.floor(e() * Qt.length)]; return r; } function Bi(t, e = Math.random) { let r = ""; for (let n = 0; n < t; n++) r += Xt[Math.floor(e() * Xt.length)]; return r; } function Ci(t, e = Math.random) { let r = ""; for (let n = 0; n < t; n++) r += Mr[Math.floor(e() * Mr.length)]; return r; } function Di(t, e = Math.random) { let r = ""; for (let n = 0; n < t; n++) r += kr[Math.floor(e() * kr.length)]; return r; } function Ni(t, e) { const r = new RegExp(`[0-9a-f]{${e}}`, "i"), n = t.match(r); return n ? n[0] : null; } function ji(t, e, r = Mi) { const n = Rr(t, r); for (const i of n) if (e(i)) return i; return null; } function Pi(t, e = Math.random) { let r = ""; for (let n = 0; n < t; n++) r += Ir[Math.floor(e() * Ir.length)]; return r; } function Ri(t, e) { if (!Or(t)) throw new TypeError(`Expected integer string${e?.name ? ` for ${e.name}` : ""}, got: ` + t); const r = BigInt(t); if (e && (e.min && r < e.min || e.max && r > e.max)) throw RangeError(`Expected integer string${e?.name ? ` for ${e.name}` : ""} in range: ${e.min ?? "-inf"}..${e.max ?? "inf"}; got: ` + r); return t; } function Ur(t, e) { if (Mt(t)) throw new TypeError(`Expected string${e?.name ? ` for ${e.name}` : ""}, got: ` + t); if (e && (e.min !== void 0 && t.length < e.min || e.max !== void 0 && t.length > e.max)) throw RangeError(`Expected string${e?.name ? ` for ${e.name}` : ""} length in range: ${e.min ?? "-inf"}..${e.max ?? "inf"}; got: ${t.length}`); return t; } function Fi(t, e) { if (!Tr(t)) throw new TypeError(`Expected hex string${e?.name ? ` for ${e.name}` : ""}, got: ` + t); const r = t.replace(/^0x/, ""); if (r.length % 2 !== 0) throw RangeError(`Expected even number of hex digits${e?.name ? ` for ${e.name}` : ""}; got: ` + t); if (e && e.byteLength && r.length !== e.byteLength * 2) throw RangeError(`Expected hex string${e?.name ? ` for ${e.name}` : ""} of byte length ${e.byteLength}; got: ` + r); return r; } function Li(t, e) { if (!Ur(t, e).split("").every((r) => r === "_" || ut(r))) throw new TypeError(`Expected safe string${e?.name ? ` for ${e.name}` : ""}, got: ` + t); return t; } function Br(t, e) { if (e.min !== void 0 && t < e.min || e.max !== void 0 && t > e.max) throw RangeError(`Expected value${e?.name ? ` for ${e.name}` : ""} in range: ${e.min ?? "-inf"}..${e.max ?? "inf"}; got: ${t}`); } function zi(t, e) { if (!Tt(t)) throw new TypeError(`Expected function${e?.name ? ` for ${e.name}` : ""}, got: ` + t); return t; } function kt(t, e) { if (R(t)) return e && Br(t, e), t; if (!k(t) || !t.match(/^-?\d+(\.\d+)?$/)) throw new TypeError(`Expected number${e?.name ? ` for ${e.name}` : ""}, got: ` + t); const r = parseFloat(t); return e && Br(r, e), r; } function _t(t, e) { return kt(t, e) | 0; } function Wi(t, e) { if (t === "true") return !0; if (t === "false") return !1; if (!Sr(t)) throw new TypeError(`Expected boolean${e?.name ? ` for ${e.name}` : ""}, got: ` + t); return t; } function Vi(t, e) { if (!Y(t)) throw new TypeError(`Expected date${e?.name ? ` for ${e.name}` : ""}, got: ` + t); return t; } function qi(t) { return Mt(t) ? null : t; } function Hi(t, e) { if (!k(t)) throw new TypeError(`Expected string${e?.name ? ` for ${e.name}` : ""}, got: ` + t); return t; } function Ki(t, e) { if (Zt(t)) return t; const r = parseInt(t, 10); if (!Zt(r)) throw new TypeError(`Expected id${e?.name ? ` for ${e.name}` : ""}, got: ` + t); return r; } function Ji(t, e) { if (!k(t)) throw new TypeError(`Expected time${e?.name ? ` for ${e.name}` : ""}, got: ` + t); const r = t.split(":"); if (r.length !== 2) throw new TypeError(`Expected time${e?.name ? ` for ${e.name}` : ""}, got: ` + t); const n = parseInt(r[0], 10), i = parseInt(r[1], 10); if (!R(n) || !R(i) || n < 0 || n > 23 || i < 0 || i > 59) throw new TypeError(`Expected time, got${e?.name ? ` for ${e.name}` : ""}: ` + t); return `${String(n).padStart(2, "0")}:${String(i).padStart(2, "0")}`; } function Zi(t, e) { if (!Array.isArray(t)) throw new TypeError(`Expected array${e?.name ? ` for ${e.name}` : ""}, got: ` + t); return t; } function It(t, e) { if (!G(t)) throw new TypeError(`Expected object${e?.name ? ` for ${e.name}` : ""}, got: ` + t); return t; } function Qi(t, e) { return t === null ? null : It(t, e); } function Xi(t, e) { const r = It(t, e); for (const n of Object.keys(r)) if (!k(r[n])) throw new TypeError(`Expected string map${e?.name ? ` for ${e.name}` : ""}, got: ` + t); return r; } function _i(t, e) { const r = It(t), n = Object.keys(r), i = Object.values(r); if (!n.every(k) || !i.every(R)) throw new TypeError(`Expected numeric dictionary${e?.name ? ` for ${e.name}` : ""}, got: ` + t); return r; } function Cr(t) { return k(t) && t.match(/^https?:\/\/.+/) !== null; } function Gi(t, e) { if (!Cr(t)) throw new TypeError(`Expected url${e?.name ? ` for ${e.name}` : ""}, got: ` + t); return t; } function Yi(t, e) { return e == null ? !0 : t(e); } function to(t, e) { return e == null ? null : t(e); } function eo(t, e) { return e === "" ? void 0 : t(e); } function ro(t, e) { return e == null ? void 0 : t(e); } function Dr(t, e) { for (const [r, n] of Object.entries(e)) if (!n(t[r])) throw TypeError(`${r} in value does not exist or match shape`); for (const r of Object.keys(t)) if (!e[r]) throw TypeError(`${r} exists in value but not in shape`); return !0; } function no(t, e) { return t.every((r) => Dr(r, e)); } function st(t, e = "json", r = 0) { if (t && Tt(t.represent)) { const n = t.represent(); if (k(n)) return e === "json" && r === 0 ? JSON.stringify(n) : n; } if (P(t, !1)) { if (r > 1) return "[object Object]"; if (e === "json") { if (Array.isArray(t)) { const i = t.map((o) => st(o, "json", r + 1)); return r === 0 ? JSON.stringify(i) : i; } const n = {}; t.message && (n.message = st(t.message, "json", r + 1)); for (const [i, o] of Object.entries(t)) n[i] = st(o, "json", r + 1); return r === 0 ? JSON.stringify(n) : n; } else if (e === "key-value") { const n = Object.keys(t); return t.message && !n.includes("message") && n.unshift("message"), n.map((i) => `${i}=${JSON.stringify(st(t[i], "json", r + 1))}`).join(" "); } } return Jt(t) && (t = "undefined"), r === 0 ? JSON.stringify(t) : t; } function io(t, e) { if (k(t)) return t; const r = Object.keys(t); t.message && !r.includes("message") && r.push("message"); const n = r.map((i) => `${i}: ${t[i]}`).join("; "); return e && t.stack ? n + ` ` + t.stack : n; } function Z(t, e) { if (G(t) && G(e)) for (const r in e) G(e[r]) ? (t[r] || (t[r] = {}), Z(t[r], e[r])) : Array.isArray(e[r]) ? t[r] = [...e[r]] : (e[r] !== null && e[r] !== void 0 || t[r] === null || t[r] === void 0) && (t[r] = e[r]); return t; } function oo(t, e) { const r = {}; return Z(r, t), Z(r, e), r; } function so(t, e, r) { const n = {}; return Z(n, t), Z(n, e), Z(n, r), n; } function Nr(t, e) { const r = {}; for (const n of t) for (const i of Object.keys(n)) r[i] ? r[i] = e(r[i], n[i]) : r[i] = n[i]; return r; } function ao(t) { return Nr(t, (e, r) => e + r); } function uo(t, e, r) { t[e] || (t[e] = []), t[e].push(r); } function co(t, e, r) { for (t.unshift(e); t.length > r; ) t.pop(); } function lo(t, e) { let r = e % t.length; return r < 0 && (r += t.length), t[r]; } function Ut(t, e) { Array.prototype.push.apply(t, e); } function fo(t, e) { Array.prototype.unshift.apply(t, e); } async function ho(t, e) { const r = []; for (const n of t) r.push(await e(n)); return r; } function go(t, e) { const r = []; for (let n = 0; n < t.length; n++) r.push(t[n]), n < t.length - 1 && (Tt(e) ? r.push(e()) : r.push(e)); return r; } function mo(t, e) { if (t !== e) throw Error(`Expected [${t}] to equal [${e}]`); return [t, e]; } function po(t) { if (t !== !0) throw Error(`Expected [true], got: [${t}]`); return t; } function yo(t) { if (!t) throw Error(`Expected truthy value, got: [${t}]`); return t; } function wo(t) { if (t !== !1) throw Error(`Expected [false], got: [${t}]`); return t; } function bo(t) { if (t) throw Error(`Expected falsy value, got: [${t}]`); return t; } function xo(t, e) { if (!e.includes(t)) throw Error(`Expected any of [${e.join(", ")}], got: [${t}]`); return t; } function Ao(t, e) { for (let r = 0; r < t.length; r++) { const n = t[r], i = e[r], o = Math.max(0, i.getTime() - Date.now()); setTimeout(n, o); } } function Eo(t, e, r) { return t + (e - t) * r; } function vo(t) { return t.reduce((e, r) => e + r, 0); } function $o(t) { return t.reduce((e, r) => e + r, 0) / t.length; } function So(t) { const e = [...t].sort((n, i) => n - i), r = Math.floor(e.length / 2); return e.length % 2 === 0 ? (e[r] + e[r - 1]) / 2 : e[r]; } function Oo(t, e) { return t - (e - 1) / 2; } function jr(t, e) { const r = []; for (let n = t; n <= e; n++) r.push(n); return r; } function To(t, e) { return e.some((r) => t.includes(r)); } function Mo(t) { return /^[\u4E00-\u9FA5]+$/.test(t); } function Gt(t, e = () => !1) { return t.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").split("").map((r) => /[a-z0-9]/.test(r) || e(r) ? r : "-").join("").replace(/-+/g, "-").replace(/^-|-$/g, ""); } function ko(t) { return Gt(t).replaceAll("-", ""); } function Io(t) { return Dt(t.replace(/([A-Z])/g, " $1")); } function Uo(t) { return t.split("-").map(Dt).join(" "); } function Bo(t) { return Lr(t.split("-").map(Dt).join("")); } function Co(t, e = ", ", r = " and ") { return !t || !t.length ? "" : t.length === 1 ? t[0] : t.length === 2 ? `${t[0]}${r}${t[1]}` : `${t.slice(0, t.length - 1).join(e)}${r}${t[t.length - 1]}`; } function Do(t, e) { return e + t.split("").join(e) + e; } function No(t) { return Gt(t).replace(/-/g, "_").toUpperCase(); } function Bt(t, e) { if (e.length === 0) return 0; const r = t.toLowerCase(), n = e.toLowerCase(); return t === e ? 1e4 : r.startsWith(n) ? 1e4 - t.length : r.includes(n) ? 5e3 - t.length : new RegExp(".*" + n.split("").join(".*") + ".*").test(r) ? 1e3 - t.length : 0; } function jo(t, e) { return t.filter((r) => Bt(r, e)).sort((r, n) => Bt(n, e) - Bt(r, e)); } function Po(t) { return t.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"); } const Ro = { "&amp;": "&", "&quot;": '"', "&apos;": "'", "&gt;": ">", "&lt;": "<" }; function Fo(t) { let e = t.replace(/&#(\d+);/g, (r, n) => String.fromCharCode(n)).replace(/&#x(\d+);/g, (r, n) => String.fromCharCode(parseInt(n, 16))); for (const [r, n] of Object.entries(Ro)) e = e.replaceAll(r, n); return e; } function Yt(t, e) { const r = t.indexOf(e); return r === -1 ? null : t.slice(0, r); } function Ct(t, e) { const r = t.indexOf(e); return r === -1 ? null : t.slice(r + e.length); } function te(t, e) { const r = t.lastIndexOf(e); return r === -1 ? null : t.slice(0, r); } function Pr(t, e) { const r = t.lastIndexOf(e); return r === -1 ? null : t.slice(r + e.length); } function Lo(t, e, r) { const n = te(t, r); return n ? Ct(n, e) : null; } function zo(t, e, r) { const n = Ct(t, e); return n ? Yt(n, r) : null; } function ee(t, e, r = !1) { const n = r ? t.lastIndexOf(e) : t.indexOf(e); return n === -1 ? r ? [null, t] : [t, null] : [t.slice(0, n), t.slice(n + e.length)]; } function Rr(t, e) { let r = [t]; for (const n of e) r = r.flatMap((i) => i.split(n)); return r.filter((n) => n); } function re(t) { const e = ot(t.split(/\\|\//g)), r = e.lastIndexOf(".", e.length - 1); return r <= 0 ? "" : e.slice(r + 1); } function ne(t) { const e = ot(t.split(/\\|\//g)), r = e.lastIndexOf(".", e.length - 1); return r <= 0 ? e : e.slice(0, r); } function Wo(t) { let [e, r] = t.split("@"); e = at(e.replaceAll(".", "").toLowerCase()).replaceAll(" ", ""); const [n] = e.split("+"); if (!n || !r || r.indexOf(".") === -1 || r.indexOf(".") === r.length - 1) throw new Error("Invalid email"); return r = at(r.toLowerCase()).replaceAll(" ", ""), `${n}@${r}`; } function Vo(t) { const e = ne(t), r = re(t); return r ? `${e}.${r}` : e; } function qo(t) { const e = ne(t), r = re(t); return { basename: e, extension: r, filename: r ? `${e}.${r}` : e }; } function Ho(t, e = Math.random) { return t.replace(/\{(.+?)\}/g, (r, n) => Kt(n.split("|"), e)); } function Fr(t) { const e = /\{(.+?)\}/, r = t.match(e); if (!r || !r.index) return [t]; const n = r[1].split(","), i = t.slice(0, r.index), o = t.slice(r.index + r[0].length); let a = []; for (const c of n) { const u = Fr(i + c + o); a = a.concat(u); } return a; } function at(t) { return t.split( ` ` ).map((e) => e.trim().replace(/\s+/g, " ")).filter((e) => e.length > 0).join(` `); } function Dt(t) { return t.charAt(0).toUpperCase() + t.slice(1); } function Lr(t) { return t.charAt(0).toLowerCase() + t.slice(1); } function zr(t) { if (!t) return !1; const e = t.charCodeAt(0); return e >= 65 && e <= 90 || e >= 97 && e <= 122; } function Wr(t) { if (!t) return !1; const e = t.charCodeAt(0); return e >= 48 && e <= 57; } function ut(t) { return zr(t) || Wr(t); } const Ko = ` \r.,?!:;"'\`(){}[]~@#$%^&*-+=|<>/\\`.split(""); function Jo(t) { return Ko.includes(t); } function Zo(t) { return ut(t) || t === "." || t === "[" || t === "]" || t === "_"; } function Qo(t, e, r, n, i) { return t.slice(0, e) + n + t.slice(e, e + r) + i + t.slice(e + r); } function Vr(t, e, r = 0) { const n = e.exec(t.slice(r)); return n ? { index: n.index, match: n[0] } : null; } function qr(t, e, r = !0) { if (!r) return e.every((i) => i instanceof RegExp ? i.test(t) : t.indexOf(i, 0) !== -1); let n = 0; for (const i of e) if (i instanceof RegExp) { const o = Vr(t, i, n); if (!o) return !1; n = o.index + o.match.length; } else { const o = t.indexOf(i, n); if (o === -1) return !1; n = o + i.length; } return !0; } function Xo(t, e, r = !0) { let n = 0; for (const i of e) { let o = !1; for (; !o && n < t.length; ) qr(t[n], i, r) && (o = !0), n++; if (!o) return !1; } return !0; } function _o(t) { return t.match(/"|,/) ? `"${t.replace(/"/g, '""')}"` : t; } function Hr(t, e, r = 0) { const n = []; let i = t.indexOf(e, r); for (; i !== -1; ) n.push(i), i = t.indexOf(e, i + e.length); return n; } function tt(t, e, r = 0) { let n = -1; for (const i of e) { const o = t.indexOf(i, r); o !== -1 && (n === -1 || o < n) && (n = o); } return n; } function Go(t, e = 0) { for (let r = e; r < t.length; r++) if (Jo(t[r])) return r; return -1; } function Yo(t, e = 0) { for (let r = e; r < t.length; r++) if (t[r] === "#" && ut(t[r + 1])) return r; return -1; } function Kr(t, e, r = 0) { return t.slice(0, r).lastIndexOf(e); } function Jr(t, e = 0, r = "{", n = "}") { let i = 1; for (let o = e; o < t.length; o++) if (t.slice(o, o + n.length) === n) { if (--i === 0) return o; } else t.slice(o, o + r.length) === r && i++; return -1; } function Zr(t, e) { const r = e.wordBoundary ? tt( t, [ `${e.opening} `, `${e.opening} ` ], e.start || 0 ) : t.indexOf(e.opening, e.start || 0); if (r === -1) return null; const n = Jr(t, r + e.opening.length, e.opening, e.closing); return n === -1 ? null : e.exclusive ? t.slice(r + e.opening.length, n) : t.slice(r, n + e.closing.length); } function ts(t, e) { const r = []; let n = e.wordBoundary ? tt( t, [ `${e.opening} `, `${e.opening} ` ], e.start || 0 ) : t.indexOf(e.opening, e.start || 0); for (; ; ) { if (n === -1) return r; const i = Zr(t, { ...e, start: n }); if (!i) return r; r.push(i), n = e.wordBoundary ? tt( t, [ `${e.opening} `, `${e.opening} ` ], n + i.length ) : t.indexOf(e.opening, n + i.length); } } function es(t, e, r) { let n = 0; for (; ; ) { const i = s.Strings.extractBlock(t, { ...r, start: n }); if (!i) return t; const o = e(i); n = t.indexOf(i, n) + o.length, t = t.replace(i, o); } } function rs(t, e) { const r = []; let n = 0; for (; n < t.length; ) { const i = t.indexOf(e, n); if (i === -1) { r.push({ string: t.slice(n), symbol: null }); break; } const o = t.indexOf(e, i + e.length); if (i > n && o !== -1 && r.push({ string: t.slice(n, i), symbol: null }), o === -1) { r.push({ string: t.slice(n), symbol: null }); break; } r.push({ string: t.slice(i + e.length, o), symbol: e }), n = o + e.length; } return r; } function ns(t) { const e = []; let r = 0; for (; r < t.length; ) { const n = Yo(t, r); if (n === -1) { e.push({ string: t.slice(r), symbol: null }); break; } const i = Go(t, n + 1); if (i === -1) { e.push({ string: t.slice(r, n), symbol: null }), e.push({ string: t.slice(n + 1), symbol: "#" }); break; } n > r && e.push({ string: t.slice(r, n), symbol: null }), e.push({ string: t.slice(n + 1, i), symbol: "#" }), r = i; } return e; } function is(t) { const e = []; let r = 0; for (; r < t.length; ) { const n = tt(t, ["http://", "https://"], r); if (n === -1) { e.push({ string: t.slice(r), symbol: null }); break; } const i = tt( t, [ " ", ` ` ], n ); if (i === -1) { n > r && e.push({ string: t.slice(r, n), symbol: null }), e.push({ string: t.slice(n), symbol: "http" }); break; } n > r && e.push({ string: t.slice(r, n), symbol: null }), e.push({ string: t.slice(n, i), symbol: "http" }), r = i; } return e; } const Qr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Xr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; function os(t) { return _r(t, Qr); } function ss(t) { return Gr(t, Qr); } function as(t) { return _r(t, Xr); } function us(t) { return Gr(t, Xr); } function _r(t, e) { const r = "=", n = e.length; let i = 0, o = 0; const a = []; for (let c = 0; c < t.length; c++) { const u = t[c]; if (u === r) break; const d = e.indexOf(u); if (d === -1) throw new Error(`Invalid character: ${u}`); o = o << Math.log2(n) | d, i += Math.log2(n), i >= 8 && (i -= 8, a.push(o >> i & 255)); } return new Uint8Array(a); } function Gr(t, e) { const r = e.length; let n = 0, i = 0, o = ""; for (let a = 0; a < t.length; a++) for (i = i << 8 | t[a], n += 8; n >= Math.log2(r); ) n -= Math.log2(r), o += e[i >> n & r - 1]; return n > 0 && (o += e[i << Math.log2(r) - n & r - 1]), o.length % 4 !== 0 && (o += "=".repeat(4 - o.length % 4)), o; } function cs(t) { (t.startsWith("0x") || t.startsWith("0X")) && (t = t.slice(2)); const e = t.length / 2, r = new Uint8Array(e); for (let n = 0; n < e; n++) { const i = parseInt(t.slice(n * 2, n * 2 + 2), 16); r[n] = i; } return r; } function ls(t) { return Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join(""); } function fs(t) { return Array.from(t).map((e) => e.toString(2).padStart(8, "0")).join(""); } function hs(t) { const e = Math.ceil(t.length / 8), r = new Uint8Array(e); for (let n = 0; n < e; n++) { const i = parseInt(t.slice(n * 8, n * 8 + 8), 2); r[n] = i; } return r; } function ds(t, e) { const r = t.split("/").filter((o) => o), n = e.split("/").filter((o) => o); if (r.length !== n.length) return null; const i = {}; for (let o = 0; o < r.length; o++) { const a = r[o]; if (a.startsWith(":")) i[a.slice(1)] = n[o]; else if (a !== n[o]) return null; } return i; } function ie(t, e, r) { const n = []; for (const i of r) i !== e && n.push(t.replace(e, i)); return n; } function gs(t, e, r, n = Math.random) { const i = s.Arrays.shuffle( e.map((a) => ({ variants: s.Arrays.shuffle( a.variants.map((c) => c), n ), avoid: a.avoid })), n ), o = []; for (const a of i) { const c = a.variants.filter((d) => d !== a.avoid), u = c.find((d) => t.includes(d)); if (u && (Ut(o, ie(t, u, c)), o.length >= r)) break; } if (o.length < r) for (const a of i) { const c = a.variants.find((u) => t.includes(u)); if (c && (Ut(o, ie(t, c, a.variants)), o.length >= r)) break; } return o.slice(0, r); } function ms(t, e, r, n = !1) { const i = new RegExp(n ? `(?<=\\s|^)${e}(?=\\s|$)` : `\\b${e}\\b`, "g"); return t.replace(i, r); } function ps(t, e) { const r = /\b[A-Z][a-zA-Z0-9]*\b/g; return t.replace(r, (n) => n.toUpperCase() === n ? n : e(n)); } function ys(t) { return t.replace(/<[^>]*>/g, ""); } function Yr(t) { const e = t.lastIndexOf(" "); if (e === -1) return { line: t, rest: "" }; const r = t.slice(0, e), n = t.slice(e + 1); return { line: r, rest: n }; } function ws(t, e = {}) { return [...t].reduce((r, n) => r + (e[n] || 1), 0); } function bs(t, e, r = {}) { const n = []; let i = "", o = 0; for (let a = 0; a < t.length; a++) { const c = t[a], u = r[c] || 1; if (i += c, o += u, o > e) { const { line: d, rest: S } = Yr(i); n.push(d), i = S, o = S.split("").map((I) => r[I] || 1).reduce((I, it) => I + it, 0); } } return i && n.push(i), n; } function xs(t, e) { const r = []; for (let n = 0; n <= t.length; n++) r[n] = [n]; for (let n = 0; n <= e.length; n++) r[0][n] = n; for (let n = 1; n <= t.length; n++) for (let i = 1; i <= e.length; i++) { const o = t[n - 1] === e[i - 1] ? 0 : 1; r[n][i] = Math.min(r[n - 1][i] + 1, r[n][i - 1] + 1, r[n - 1][i - 1] + o); } return r[t.length][e.length]; } function tn(t) { const e = t.reduce((n, i) => n.length < i.length ? n : i); let r = ""; for (let n = 0; n < e.length; n++) { const i = e[n]; if (t.every((o) => o[n] === i)) r += i; else break; } return r; } function As(t) { const e = tn(t), r = e.lastIndexOf("/"); return r === -1 ? "" : e.slice(0, r + 1); } function oe(t, e) { return new RegExp(`\\b${e}\\b`).test(t); } function Es(t, e, r) { return r === "any" ? e.some((n) => oe(t, n)) : e.every((n) => oe(t, n)); } function vs(t) { const e = {}, r = t.match(/([a-z\-]+)="([^"]+)"/g); if (r) for (const n of r) { const [i, o] = ee(n, "="); e[i] = o.slice(1, o.length - 1); } return e; } function ct(t, e, r = []) { let n = ""; for (; e < t.length && (ut(t[e]) || r.includes(t[e])); ) n += t[e++]; return n; } function $s(t, e, r = []) { const n = Hr(t, e), i = []; for (const o of n) i.push(ct(t, o + e.length, r)); return i; } function Ss(t, e, r = "$", n = ":") { for (const i in e) t = en(t, i, e[i], r, n); return t = rn(t), t; } function en(t, e, r, n = "$", i = ":") { if (r === "") return t; let o = t.indexOf(`${n}${e}`); for (; o !== -1; ) { if (t[o + e.length + 1] === i) if (t[o + e.length + 2] === i) t = t.replace(`${n}${e}${i}${i}`, r); else { const a = ct(t, o + e.length + 2, ["_"]); t = t.replace(`${n}${e}${i}${a}`, r); } else t = t.replace(`${n}${e}`, r); o = t.indexOf(`${n}${e}`, o + r.length); } return t; } function rn(t, e = "$", r = ":") { let n = t.indexOf(e); for (; n !== -1; ) { const i = ct(t, n + 1); if (t[n + i.length + 1] === r) if (t[n + i.length + 2] === r) t = t.replace(`${e}${i}${r}${r}`, ""); else { const o = ct(t, n + i.length + 2); t = t.replace(`${e}${i}${r}${o}`, o); } n = t.indexOf(e, n + 1); } return t; } function Os(t, e) { let r = t.indexOf("]("); for (; r !== -1; ) { const n = Kr(t, "[", r), i = t.indexOf(")", r); if (n !== -1 && i !== -1) { const [o, a] = t.slice(n + 1, i).split("]("), c = e(o, a); t = t.slice(0, n) + c + t.slice(i + 1); } r = t.indexOf("](", r + 1); } return t; } function nn(t, e = !0) { const r = Object.entries(t).filter(([n, i]) => i != null).map(([n, i]) => `${n}=${encodeURIComponent(i)}`).join("&"); return r ? (e ? "?" : "") + r : ""; } function Ts(t) { const e = {}, r = t.split("&"); for (const n of r) { const [i, o] = n.split("="); i && o && (e[i] = decodeURIComponent(o)); } return e; } function Ms(t, e) { return Object.prototype.hasOwnProperty.call(t, e); } function ks(t, e) { let r = null, n = -1 / 0; for (const [i, o] of Object.entries(t)) { const a = e(o); a > n && (n = a, r = i); } return r ? [r, t[r]] : null; } function Is(t, e, r, n) { const i = t.find((a) => a[e] === r), o = t.find((a) => a[e] === r + n); i && o ? (i[e] = r + n, o[e] = r) : i && (i[e] = r + n), t.sort((a, c) => kt(a[e]) - kt(c[e])), t.forEach((a, c) => a[e] = c + 1); } function Us(t) { const e = Object.keys(t); if (e.length === 1) return t[e[0]]; throw new Error("Expected object to have a single key"); } function Bs(t, e = ":") { return Object.fromEntries( t.map((r) => ee(r, e)).map((r) => r[0] && r[1] ? [at(r[0]), at(r[1])] : null).filter((r) => r) ); } function Cs(t, e, r) { return un([t, e]) + nn(r || {}); } function Ds(t, e = ",", r = '"') { const n = []; let i = "", o = !1; const a = t.split(""); for (const c of a) c === e && !o ? (n.push(i), i = "") : c === r && (!i && !o || o) ? o = !o : i += c; return n.push(i), n; } function Ns(t) { return `[${Math.floor(t.progress * 100)}%] ${Nt(t.deltaMs)} out of ${Nt(t.totalTimeMs)} (${Nt(t.remainingTimeMs)} left) [${Math.round(t.baseTimeMs)} ms each]`; } async function js(t, e) { let r = e.requiredConsecutivePasses || 1, n = 0; for (let i = 0; i < e.attempts; i++) { try { if (await t()) { if (n++, n >= r) return; } else n = 0; } catch { n = 0; } i < e.attempts - 1 && await g(e.waitMillis); } throw Error("Timed out waiting for predicate"); } function Ps(t, e) { const r = []; for (let n = t.length - 1; n >= 0; n--) e(t[n]) && r.push(t.splice(n, 1)[0]); return r; } function Rs(t) { return JSON.parse(JSON.stringify(t)); } function Fs(t) { return Math.ceil((t || Date.now()) / 1e3); } function Ls(t) { return (t || /* @__PURE__ */ new Date()).toISOString().slice(0, 10); } function zs(t) { return (t || /* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace(/T|:/g, "-"); } function Ws(t) { const e = new Date(t); return new Date(e.getTime() - e.getTimezoneOffset() * 6e4); } function Vs(t) { return new Date(t); } function D(t) { return String(Math.floor(t)).padStart(2, "0"); } function qs(t) { let [e, r] = t.split(":"); R(parseInt(e, 10)) || (e = "0"), R(parseInt(r, 10)) || (r = "0"); let n = le(_t(e), 0, 23), i = le(_t(r), 0, 59); return `${D(n)}:${D(i)}`; } function Nt(t) { const e = Math.floor(t / 36e5); t = t % 36e5; const r = Math.floor(t / 6e4); t = t % 6e4; const n = Math.floor(t / 1e3); return e ? `${D(e)}:${D(r)}:${D(n)}` : `${D(r)}:${D(n)}`; } function Q(t) { return Math.floor((Y(t) ? t.getTime() : t) / 864e5); } const Hs = { today: (t, e) => D(t) + ":" + D(e), yesterday: () => "Yesterday", monday: () => "Mon", tuesday: () => "Tue", wednesday: () => "Wed", thursday: () => "Thu", friday: () => "Fri", saturday: () => "Sat", sunday: () => "Sun", weeks: (t) => `${t}w` }; function Ks(t, e) { const r = new Date(e?.now || Date.now()), n = e?.labels || Hs, i = Y(t) ? t : new Date(t); if (Q(r) === Q(i)) return n.today(i.getUTCHours(), i.getUTCMinutes(), i.getUTCHours() > 12); if (Q(r) - Q(i) === 1) return n.yesterday(); const o = ae(i); return Q(r) - Q(i) < 7 ? n[o.day]() : n.weeks(Math.round((r.getTime() - i.getTime()) / 6048e5)); } const on = { now: () => "A few seconds", seconds: (t) => `${t} seconds`, minutes: (t) => `${t} minutes`, hours: (t) => `${t} hours`, days: (t) => `${t} days`, weeks: (t) => `${t} weeks` }; function sn(t, e) { const r = e?.now ?? Date.now(), n = e?.labels || on, i = s.Types.isDate(t) ? t.getTime() : t; let o = (r - i) / 1e3; return o < 10 ? n.now() : o < 120 ? n.seconds(Math.floor(o)) : (o /= 60, o < 120 ? n.minutes(Math.floor(o)) : (o /= 60, o < 48 ? n.hours(Math.floor(o)) : (o /= 24, o < 14 ? n.days(Math.floor(o)) : (o /= 7, n.weeks(Math.floor(o)))))); } function Js(t, e = on) { return sn(0, { now: t * 1e3, labels: e }); } function Zs(t, e, r) { const n = (r?.now ?? Date.now()) - t, i = Math.floor(n / e), o = e / (r?.precision ?? 1) - Math.ceil(n % e / (r?.precision ?? 1)); return { cycles: i, remaining: o }; } const se = {}; function Qs(t, e) { return !se[t] || Date.now() > se[t] ? (se[t] = Date.now() + e, !0) : !1; } const Xs = { s: 1e3, m: 6e4, h: 36e5, d: 864e5 }; function _s(t, e, r) { return e = Y(e) ? e.getTime() : e, r = r ? Y(r) ? r.getTime() : r : Date.now(), (r - e) / Xs[t]; } function Gs(t, e, r, n) { n || (n = Date.now()); const i = e / r, o = n - t, a = o / e, c = a * r, u = c - o; return { deltaMs: o, progress: i, baseTimeMs: a, totalTimeMs: c, remainingTimeMs: u }; } const Ys = { 0: "sunday", 1: "monday", 2: "tuesday", 3: "wednesday", 4: "thursday", 5: "friday", 6: "saturday" }; function an(t) { return { zeroBasedIndex: t, day: Ys[t] }; } function ae(t) { return an(t.getDay()); } function ta(t) { return ae(new Date(t)); } function ea(t) { return t * 1e3; } function ra(t) { return t * 6e4; } function na(t) { return t * 36e5; } function ia(t) { return t * 864e5; } const oa = { ms: 1, milli: 1, millis: 1, millisecond: 1, milliseconds: 1, s: 1e3, sec: 1e3, second: 1e3, seconds: 1e3, m: 6e4, min: 6e4, minute: 6e4, minutes: 6e4, h: 36e5, hour: 36e5, hours: 36e5, d: 864e5, day: 864e5, days: 864e5, w: 6048e5, week: 6048e5, weeks: 6048e5, month: 2592e6, months: 2592e6, y: 31536e6, year: 31536e6, years: 31536e6 }; function sa(t) { const e = parseFloat(t); if (isNaN(e)) throw Error("makeDate got NaN for input"); const r = t.replace(/^-?[0-9.]+/, "").trim().toLowerCase(), n = oa[r]; if (!n) throw Error(`Unknown unit: "${r}"`); return e * n; } const aa = { b: 1, byte: 1, bytes: 1, kb: 1024, kilobyte: 1024, kilobytes: 1024, mb: 1024 ** 2, megabyte: 1024 ** 2, megabytes: 1024 ** 2, gb: 1024 ** 3, gigabyte: 1024 ** 3, gigabytes: 1024 ** 3, tb: 1024 ** 4, terabyte: 1024 ** 4, terabytes: 1024 ** 4 }; function ua(t) { const e = parseFloat(t); if (isNaN(e)) throw Error("makeDate got NaN for input"); const r = t.replace(/^-?[0-9.]+/, "").trim().toLowerCase(), n = aa[r]; if (!n) throw Error(`Unknown unit: "${r}"`); return e * n; } function ca(t) { return t.replace(/ +/g, " ").replace(/^ /gm, ""); } const ue = {}; async function la(t, e, r) { const n = Date.now(), i = ue[t]; if (i && i.validUntil > n) return i.value; const o = await r(), a = n + e; return ue[t] = { value: o, validUntil: a }, o; } function fa(t) { delete ue[t]; } function un(t, e = !1) { t = t.filter((o) => o), e && k(t[1]) && (t[1] = "../" + t[1]); let r = ""; k(t[0]) && t[0].includes("://") && (r = Yt(t[0], "://") ?? "", t[0] = Ct(t[0], "://") ?? ""); const n = t.map((o) => String(o)).flatMap((o) => o.split("/")), i = []; for (let o = 0; o < n.length; o++) n[o] !== "." && (n[o] === ".." ? (!r || i.length > 1) && i.pop() : i.push(n[o])); return (r ? r + "://" : "") + i.join("/").replaceAll(/\/{2,}/g, "/"); } function ha(t, e, r, n, i = !0) { const o = t.indexOf(e), a = t.indexOf(r, o + e.length); if (o === -1 || a === -1) throw Error("Start or end not found"); return i ? t.substring(0, o + e.length) + n + t.substring(a) : t.substring(0, o) + n + t.substring(a + r.length); } function da(t) { let e = "p"; t.startsWith("#") ? (e = "h1", t = t.slice(1).trim()) : t.startsWith("-") && (e = "li", t = t.slice(1).trim()); const r = t[0] === t[0].toUpperCase(), n = /[.?!]$/.test(t), i = /:$/.test(t); return { type: e, isCapitalized: r, hasPunctuation: n, endsWithColon: i }; } function ga(t, e = "(", r = ")") { let n = 0, i = 0; for (; i < t.length; ) if (t.startsWith(e, i) ? (n++, i += e.length) : t.startsWith(r, i) ? (n--, i += r.length) : i++, n < 0) return !1; return e === r ? n % 2 === 0 : n === 0; } function ma(t) { t = t.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); let e = t.length; for (; t = t.replace(/(\w+)[\s,']+\w+/g, "$1"), t.length !== e; ) e = t.length; return t = t.replaceAll(/[A-Z][a-zA-Z0-9]*/g, "A"), t = t.replaceAll(/[a-z][a-zA-Z0-9]*/g, "a"), t = t.replaceAll(/[\u4E00-\u9FA5]+/g, "Z"), t; } function cn(t) { const e = Object.keys(t).sort((n, i) => n.localeCompare(i)), r = {}; for (const n of e) r[n] = X(t[n]); return r; } function ln(t) { const e = []; return t.sort((r, n) => JSON.stringify(X(r)).localeCompare(JSON.stringify(X(n)))).forEach((r) => e.push(X(r))), e; } function X(t) { return Array.isArray(t) ? ln(t) : P(t) ? cn(t) : t; } function fn(t, e) { return JSON.stringify(X(t)) === JSON.stringify(X(e)); } function pa(...t) { for (let e = 1; e < t.length; e++) if (!fn(t[e - 1], t[e])) return !1; return !0; } function ya(t) { try { return JSON.parse(t); } catch { return null; } } function wa() { let t = 0; return { next: () => t++ }; } function ba(t) { let e = 0; return { next: () => t[e++ % t.length] }; } function xa(t) { let e; return (r) => { const n = r === t && e !== t; return e = r, n; }; } function Aa(t, e, r, n, i) { const o = {}; for (const a of Object.keys(e)) o[a] = []; o[n] = [], i && (t = t.sort(i)); for (const a of t) { const c = a[r], u = e[c] ? c : n; o[u].length >= e[u] ? o[n].push(a) : o[u].push(a); } return o; } function Ea(t, e) { const r = Object.keys(t), n = Object.keys(e); return { uniqueToA: r.filter((i) => !n.includes(i)), uniqueToB: n.filter((i) => !r.includes(i)) }; } function hn(t) { const e = Object.keys(t); return e[Math.floor(Math.random() * e.length)]; } function va(t, e) { const r = hn(t); return t[r] = e(t[r]), r; } function $a(t) { return t = t.replace( /\r\n/g, ` ` ), t = t.replace(/(\w+)\((.+)\)/g, (e, r, n) => `${r}(${n.replaceAll(",", "&comma;")})`), t = t.replace(/(,)(\s+})/g, "$2"), t = t.replace(/\.\.\..+?,/g, ""), t = t.replace(/({\s+)([a-zA-Z]\w+),/g, "$1$2: '$2',"), t = t.replace(/(,\s+)([a-zA-Z]\w+),/g, "$1$2: '$2',"), t = t.replace(/:(.+)\?(.+):/g, (e, r, n) => `: (${r.trim()} && ${n.trim()}) ||`), t = t.replace(/([a-zA-Z0-9]+)( ?: ?{)/g, '"$1"$2'), t = t.replace(/([a-zA-Z0-9]+) ?: ?(.+?)(,|\n|})/g, (e, r, n, i) => `"${r}":"${n.trim()}"${i}`), t = t.replace(/("'|'")/g, '"'), t = t.replaceAll("&comma;", ","), JSON.parse(t); } const F = [1e3, 1e6, 1e9, 1e12, 1e15, 1e18, 1e21, 1e24, 1e27, 1e30, 1e9, 1e16, 1e18, 1e18, 1e18, 1e33], Sa = ["thousand", "million", "billion", "trillion", "quadrillion", "quintillion", "sextillion", "septillion", "octillion", "nonillion", "gwei", "bzz", "btc", "eth", "dai", "decillion"], dn = ["K", "M", "B", "T", "Qa", "Qi", "Sx", "Sp", "O", "N", "gwei", "bzz", "eth", "btc", "dai", "D"]; function Oa(t, e, r) { let n = t.length - e; if (n <= 0) return "0." + "0".repeat(-n) + t + (r ? " " + r : ""); let i = t.substring(0, n), o = t.subs