Files
bitvid/blog.html
Keep Creating Online 4c9b03e485 edited blog theme
2025-02-07 11:45:11 -05:00

30445 lines
987 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<!-- Configure with your npub/nprofile -->
<meta
name="author"
value="npub13yarr7j6vjqjjkahd63dmr27curypehx45ucue286ac7sft27y0srnpmpe"
/>
<!-- Personalize your relays list -->
<meta
name="relays"
value="wss://nos.lol, wss://relay.damus.io, wss://relay.nostr.band, wss://nostr.wine"
/>
<!-- Show top notes with images, use a even value, zero to disable -->
<meta name="top-notes" value="2" />
<!-- Show short notes as carousel (value 'carousel') or in the main feed (value 'main'), empty to disable -->
<meta name="short-notes" value="carousel" />
<!-- Show short notes with X minimum characters for the 'short-notes' setting, zero to disable -->
<meta name="short-notes-min-chars" value="800" />
<!-- Size in characters of the short notes preview in the feed, zero to display full content -->
<meta name="short-notes-summary-max-chars" value="400" />
<!-- Enable navigation by topics (tags), empty to disable -->
<meta name="topics" value="" />
<!-- Enable comments, 'yes' to enable -->
<meta name="comments" value="yes" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title></title>
<script type="module" crossorigin>
var pv = Object.defineProperty;
var gv = (e, t, n) =>
t in e
? pv(e, t, {
enumerable: !0,
configurable: !0,
writable: !0,
value: n,
})
: (e[t] = n);
var Be = (e, t, n) => (gv(e, typeof t != "symbol" ? t + "" : t, n), n);
function wv(e, t) {
for (var n = 0; n < t.length; n++) {
const r = t[n];
if (typeof r != "string" && !Array.isArray(r)) {
for (const o in r)
if (o !== "default" && !(o in e)) {
const s = Object.getOwnPropertyDescriptor(r, o);
s &&
Object.defineProperty(
e,
o,
s.get ? s : { enumerable: !0, get: () => r[o] }
);
}
}
}
return Object.freeze(
Object.defineProperty(e, Symbol.toStringTag, { value: "Module" })
);
}
(function () {
const t = document.createElement("link").relList;
if (t && t.supports && t.supports("modulepreload")) return;
for (const o of document.querySelectorAll('link[rel="modulepreload"]'))
r(o);
new MutationObserver((o) => {
for (const s of o)
if (s.type === "childList")
for (const c of s.addedNodes)
c.tagName === "LINK" && c.rel === "modulepreload" && r(c);
}).observe(document, { childList: !0, subtree: !0 });
function n(o) {
const s = {};
return (
o.integrity && (s.integrity = o.integrity),
o.referrerPolicy && (s.referrerPolicy = o.referrerPolicy),
o.crossOrigin === "use-credentials"
? (s.credentials = "include")
: o.crossOrigin === "anonymous"
? (s.credentials = "omit")
: (s.credentials = "same-origin"),
s
);
}
function r(o) {
if (o.ep) return;
o.ep = !0;
const s = n(o);
fetch(o.href, s);
}
})();
const mv = "modulepreload",
bv = function (e, t) {
return new URL(e, t).href;
},
Bh = {},
yv = function (t, n, r) {
let o = Promise.resolve();
if (n && n.length > 0) {
const s = document.getElementsByTagName("link"),
c = document.querySelector("meta[property=csp-nonce]"),
f =
(c == null ? void 0 : c.nonce) ||
(c == null ? void 0 : c.getAttribute("nonce"));
o = Promise.all(
n.map((d) => {
if (((d = bv(d, r)), d in Bh)) return;
Bh[d] = !0;
const h = d.endsWith(".css"),
y = h ? '[rel="stylesheet"]' : "";
if (!!r)
for (let P = s.length - 1; P >= 0; P--) {
const C = s[P];
if (C.href === d && (!h || C.rel === "stylesheet")) return;
}
else if (document.querySelector(`link[href="${d}"]${y}`))
return;
const v = document.createElement("link");
if (
((v.rel = h ? "stylesheet" : mv),
h || ((v.as = "script"), (v.crossOrigin = "")),
(v.href = d),
f && v.setAttribute("nonce", f),
document.head.appendChild(v),
h)
)
return new Promise((P, C) => {
v.addEventListener("load", P),
v.addEventListener("error", () =>
C(new Error(`Unable to preload CSS for ${d}`))
);
});
})
);
}
return o
.then(() => t())
.catch((s) => {
const c = new Event("vite:preloadError", { cancelable: !0 });
if (
((c.payload = s), window.dispatchEvent(c), !c.defaultPrevented)
)
throw s;
});
};
function At() {}
function Rn(e, t) {
for (const n in t) e[n] = t[n];
return e;
}
function fg(e) {
return e();
}
function Ch() {
return Object.create(null);
}
function gs(e) {
e.forEach(fg);
}
function hg(e) {
return typeof e == "function";
}
function jn(e, t) {
return e != e
? t == t
: e !== t || (e && typeof e == "object") || typeof e == "function";
}
let qs;
function Kr(e, t) {
return e === t
? !0
: (qs || (qs = document.createElement("a")),
(qs.href = t),
e === qs.href);
}
function vv(e) {
return Object.keys(e).length === 0;
}
function za(e, t, n, r) {
if (e) {
const o = pg(e, t, n, r);
return e[0](o);
}
}
function pg(e, t, n, r) {
return e[1] && r ? Rn(n.ctx.slice(), e[1](r(t))) : n.ctx;
}
function Ua(e, t, n, r) {
if (e[2] && r) {
const o = e[2](r(n));
if (t.dirty === void 0) return o;
if (typeof o == "object") {
const s = [],
c = Math.max(t.dirty.length, o.length);
for (let f = 0; f < c; f += 1) s[f] = t.dirty[f] | o[f];
return s;
}
return t.dirty | o;
}
return t.dirty;
}
function Ma(e, t, n, r, o, s) {
if (o) {
const c = pg(t, n, r, s);
e.p(c, o);
}
}
function Ha(e) {
if (e.ctx.length > 32) {
const t = [],
n = e.ctx.length / 32;
for (let r = 0; r < n; r++) t[r] = -1;
return t;
}
return -1;
}
function Zl(e) {
const t = {};
for (const n in e) n[0] !== "$" && (t[n] = e[n]);
return t;
}
function pi(e, t) {
const n = {};
t = new Set(t);
for (const r in e) !t.has(r) && r[0] !== "$" && (n[r] = e[r]);
return n;
}
function we(e, t) {
e.appendChild(t);
}
function Ne(e, t, n) {
e.insertBefore(t, n || null);
}
function Ie(e) {
e.parentNode && e.parentNode.removeChild(e);
}
function ja(e, t) {
for (let n = 0; n < e.length; n += 1) e[n] && e[n].d(t);
}
function ke(e) {
return document.createElement(e);
}
function Xe(e) {
return document.createTextNode(e);
}
function Ge() {
return Xe(" ");
}
function Uo() {
return Xe("");
}
function _v(e, t, n, r) {
return (
e.addEventListener(t, n, r), () => e.removeEventListener(t, n, r)
);
}
function Ee(e, t, n) {
n == null
? e.removeAttribute(t)
: e.getAttribute(t) !== n && e.setAttribute(t, n);
}
const Ev = ["width", "height"];
function gi(e, t) {
const n = Object.getOwnPropertyDescriptors(e.__proto__);
for (const r in t)
t[r] == null
? e.removeAttribute(r)
: r === "style"
? (e.style.cssText = t[r])
: r === "__value"
? (e.value = e[r] = t[r])
: n[r] && n[r].set && Ev.indexOf(r) === -1
? (e[r] = t[r])
: Ee(e, r, t[r]);
}
function Vs(e, t, n) {
const r = t.toLowerCase();
r in e
? (e[r] = typeof e[r] == "boolean" && n === "" ? !0 : n)
: t in e
? (e[t] = typeof e[t] == "boolean" && n === "" ? !0 : n)
: Ee(e, t, n);
}
function kv(e) {
return Array.from(e.childNodes);
}
function It(e, t) {
(t = "" + t), e.data !== t && (e.data = t);
}
function Ih(e, t, n) {
e.classList.toggle(t, !!n);
}
function Av(e, t, { bubbles: n = !1, cancelable: r = !1 } = {}) {
return new CustomEvent(e, { detail: t, bubbles: n, cancelable: r });
}
let ns;
function Ji(e) {
ns = e;
}
function Da() {
if (!ns)
throw new Error("Function called outside component initialization");
return ns;
}
function qa(e) {
Da().$$.on_mount.push(e);
}
function Sv(e) {
Da().$$.after_update.push(e);
}
function $v(e) {
Da().$$.on_destroy.push(e);
}
function xv() {
const e = Da();
return (t, n, { cancelable: r = !1 } = {}) => {
const o = e.$$.callbacks[t];
if (o) {
const s = Av(t, n, { cancelable: r });
return (
o.slice().forEach((c) => {
c.call(e, s);
}),
!s.defaultPrevented
);
}
return !0;
};
}
const Qo = [],
tl = [];
let ii = [];
const Oh = [],
Tv = Promise.resolve();
let nl = !1;
function Pv() {
nl || ((nl = !0), Tv.then(Mr));
}
function rl(e) {
ii.push(e);
}
const _u = new Set();
let Wo = 0;
function Mr() {
if (Wo !== 0) return;
const e = ns;
do {
try {
for (; Wo < Qo.length; ) {
const t = Qo[Wo];
Wo++, Ji(t), Lv(t.$$);
}
} catch (t) {
throw ((Qo.length = 0), (Wo = 0), t);
}
for (Ji(null), Qo.length = 0, Wo = 0; tl.length; ) tl.pop()();
for (let t = 0; t < ii.length; t += 1) {
const n = ii[t];
_u.has(n) || (_u.add(n), n());
}
ii.length = 0;
} while (Qo.length);
for (; Oh.length; ) Oh.pop()();
(nl = !1), _u.clear(), Ji(e);
}
function Lv(e) {
if (e.fragment !== null) {
e.update(), gs(e.before_update);
const t = e.dirty;
(e.dirty = [-1]),
e.fragment && e.fragment.p(e.ctx, t),
e.after_update.forEach(rl);
}
}
function Bv(e) {
const t = [],
n = [];
ii.forEach((r) => (e.indexOf(r) === -1 ? t.push(r) : n.push(r))),
n.forEach((r) => r()),
(ii = t);
}
const Xs = new Set();
let xo;
function to() {
xo = { r: 0, c: [], p: xo };
}
function no() {
xo.r || gs(xo.c), (xo = xo.p);
}
function Ve(e, t) {
e && e.i && (Xs.delete(e), e.i(t));
}
function Ze(e, t, n, r) {
if (e && e.o) {
if (Xs.has(e)) return;
Xs.add(e),
xo.c.push(() => {
Xs.delete(e), r && (n && e.d(1), r());
}),
e.o(t);
} else r && r();
}
function Wr(e) {
return (e == null ? void 0 : e.length) !== void 0 ? e : Array.from(e);
}
function Yl(e, t) {
const n = {},
r = {},
o = { $$scope: 1 };
let s = e.length;
for (; s--; ) {
const c = e[s],
f = t[s];
if (f) {
for (const d in c) d in f || (r[d] = 1);
for (const d in f) o[d] || ((n[d] = f[d]), (o[d] = 1));
e[s] = f;
} else for (const d in c) o[d] = 1;
}
for (const c in r) c in n || (n[c] = void 0);
return n;
}
function dr(e) {
e && e.c();
}
function Dn(e, t, n) {
const { fragment: r, after_update: o } = e.$$;
r && r.m(t, n),
rl(() => {
const s = e.$$.on_mount.map(fg).filter(hg);
e.$$.on_destroy ? e.$$.on_destroy.push(...s) : gs(s),
(e.$$.on_mount = []);
}),
o.forEach(rl);
}
function qn(e, t) {
const n = e.$$;
n.fragment !== null &&
(Bv(n.after_update),
gs(n.on_destroy),
n.fragment && n.fragment.d(t),
(n.on_destroy = n.fragment = null),
(n.ctx = []));
}
function Cv(e, t) {
e.$$.dirty[0] === -1 && (Qo.push(e), Pv(), e.$$.dirty.fill(0)),
(e.$$.dirty[(t / 31) | 0] |= 1 << t % 31);
}
function ro(e, t, n, r, o, s, c = null, f = [-1]) {
const d = ns;
Ji(e);
const h = (e.$$ = {
fragment: null,
ctx: [],
props: s,
update: At,
not_equal: o,
bound: Ch(),
on_mount: [],
on_destroy: [],
on_disconnect: [],
before_update: [],
after_update: [],
context: new Map(t.context || (d ? d.$$.context : [])),
callbacks: Ch(),
dirty: f,
skip_bound: !1,
root: t.target || d.$$.root,
});
c && c(h.root);
let y = !1;
if (
((h.ctx = n
? n(e, t.props || {}, (m, v, ...P) => {
const C = P.length ? P[0] : v;
return (
h.ctx &&
o(h.ctx[m], (h.ctx[m] = C)) &&
(!h.skip_bound && h.bound[m] && h.bound[m](C),
y && Cv(e, m)),
v
);
})
: []),
h.update(),
(y = !0),
gs(h.before_update),
(h.fragment = r ? r(h.ctx) : !1),
t.target)
) {
if (t.hydrate) {
const m = kv(t.target);
h.fragment && h.fragment.l(m), m.forEach(Ie);
} else h.fragment && h.fragment.c();
t.intro && Ve(e.$$.fragment), Dn(e, t.target, t.anchor), Mr();
}
Ji(d);
}
class oo {
constructor() {
Be(this, "$$");
Be(this, "$$set");
}
$destroy() {
qn(this, 1), (this.$destroy = At);
}
$on(t, n) {
if (!hg(n)) return At;
const r = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
return (
r.push(n),
() => {
const o = r.indexOf(n);
o !== -1 && r.splice(o, 1);
}
);
}
$set(t) {
this.$$set &&
!vv(t) &&
((this.$$.skip_bound = !0),
this.$$set(t),
(this.$$.skip_bound = !1));
}
}
const Iv = "4";
typeof window < "u" &&
(window.__svelte || (window.__svelte = { v: new Set() })).v.add(Iv);
const Eu =
typeof globalThis == "object" && "crypto" in globalThis
? globalThis.crypto
: void 0;
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const Jl =
(e) => e instanceof Uint8Array,
ku = (e) => new DataView(e.buffer, e.byteOffset, e.byteLength),
$n = (e, t) => (e << (32 - t)) | (e >>> t),
Ov = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
if (!Ov) throw new Error("Non little-endian hardware is not supported");
const Nv = Array.from({ length: 256 }, (e, t) =>
t.toString(16).padStart(2, "0")
);
function wt(e) {
if (!Jl(e)) throw new Error("Uint8Array expected");
let t = "";
for (let n = 0; n < e.length; n++) t += Nv[e[n]];
return t;
}
function Bo(e) {
if (typeof e != "string")
throw new Error("hex string expected, got " + typeof e);
const t = e.length;
if (t % 2)
throw new Error(
"padded hex string expected, got unpadded hex of length " + t
);
const n = new Uint8Array(t / 2);
for (let r = 0; r < n.length; r++) {
const o = r * 2,
s = e.slice(o, o + 2),
c = Number.parseInt(s, 16);
if (Number.isNaN(c) || c < 0)
throw new Error("Invalid byte sequence");
n[r] = c;
}
return n;
}
function gg(e) {
if (typeof e != "string")
throw new Error(`utf8ToBytes expected string, got ${typeof e}`);
return new Uint8Array(new TextEncoder().encode(e));
}
function rs(e) {
if ((typeof e == "string" && (e = gg(e)), !Jl(e)))
throw new Error(`expected Uint8Array, got ${typeof e}`);
return e;
}
function ca(...e) {
const t = new Uint8Array(e.reduce((r, o) => r + o.length, 0));
let n = 0;
return (
e.forEach((r) => {
if (!Jl(r)) throw new Error("Uint8Array expected");
t.set(r, n), (n += r.length);
}),
t
);
}
let wg = class {
clone() {
return this._cloneInto();
}
};
function mg(e) {
const t = (r) => e().update(rs(r)).digest(),
n = e();
return (
(t.outputLen = n.outputLen),
(t.blockLen = n.blockLen),
(t.create = () => e()),
t
);
}
function bg(e = 32) {
if (Eu && typeof Eu.getRandomValues == "function")
return Eu.getRandomValues(new Uint8Array(e));
throw new Error("crypto.getRandomValues must be defined");
}
/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */ function Pi(
e
) {
if (!Number.isSafeInteger(e)) throw new Error(`Wrong integer: ${e}`);
}
function fr(...e) {
const t = (o, s) => (c) => o(s(c)),
n = Array.from(e)
.reverse()
.reduce((o, s) => (o ? t(o, s.encode) : s.encode), void 0),
r = e.reduce((o, s) => (o ? t(o, s.decode) : s.decode), void 0);
return { encode: n, decode: r };
}
function hr(e) {
return {
encode: (t) => {
if (!Array.isArray(t) || (t.length && typeof t[0] != "number"))
throw new Error(
"alphabet.encode input should be an array of numbers"
);
return t.map((n) => {
if ((Pi(n), n < 0 || n >= e.length))
throw new Error(
`Digit index outside alphabet: ${n} (alphabet: ${e.length})`
);
return e[n];
});
},
decode: (t) => {
if (!Array.isArray(t) || (t.length && typeof t[0] != "string"))
throw new Error(
"alphabet.decode input should be array of strings"
);
return t.map((n) => {
if (typeof n != "string")
throw new Error(`alphabet.decode: not string element=${n}`);
const r = e.indexOf(n);
if (r === -1)
throw new Error(`Unknown letter: "${n}". Allowed: ${e}`);
return r;
});
},
};
}
function pr(e = "") {
if (typeof e != "string")
throw new Error("join separator should be string");
return {
encode: (t) => {
if (!Array.isArray(t) || (t.length && typeof t[0] != "string"))
throw new Error("join.encode input should be array of strings");
for (let n of t)
if (typeof n != "string")
throw new Error(`join.encode: non-string input=${n}`);
return t.join(e);
},
decode: (t) => {
if (typeof t != "string")
throw new Error("join.decode input should be string");
return t.split(e);
},
};
}
function Va(e, t = "=") {
if ((Pi(e), typeof t != "string"))
throw new Error("padding chr should be string");
return {
encode(n) {
if (!Array.isArray(n) || (n.length && typeof n[0] != "string"))
throw new Error(
"padding.encode input should be array of strings"
);
for (let r of n)
if (typeof r != "string")
throw new Error(`padding.encode: non-string input=${r}`);
for (; (n.length * e) % 8; ) n.push(t);
return n;
},
decode(n) {
if (!Array.isArray(n) || (n.length && typeof n[0] != "string"))
throw new Error(
"padding.encode input should be array of strings"
);
for (let o of n)
if (typeof o != "string")
throw new Error(`padding.decode: non-string input=${o}`);
let r = n.length;
if ((r * e) % 8)
throw new Error(
"Invalid padding: string should have whole number of bytes"
);
for (; r > 0 && n[r - 1] === t; r--)
if (!(((r - 1) * e) % 8))
throw new Error("Invalid padding: string has too much padding");
return n.slice(0, r);
},
};
}
function yg(e) {
if (typeof e != "function")
throw new Error("normalize fn should be function");
return { encode: (t) => t, decode: (t) => e(t) };
}
function Nh(e, t, n) {
if (t < 2)
throw new Error(
`convertRadix: wrong from=${t}, base cannot be less than 2`
);
if (n < 2)
throw new Error(
`convertRadix: wrong to=${n}, base cannot be less than 2`
);
if (!Array.isArray(e))
throw new Error("convertRadix: data should be array");
if (!e.length) return [];
let r = 0;
const o = [],
s = Array.from(e);
for (
s.forEach((c) => {
if ((Pi(c), c < 0 || c >= t))
throw new Error(`Wrong integer: ${c}`);
});
;
) {
let c = 0,
f = !0;
for (let d = r; d < s.length; d++) {
const h = s[d],
y = t * c + h;
if (
!Number.isSafeInteger(y) ||
(t * c) / t !== c ||
y - h !== t * c
)
throw new Error("convertRadix: carry overflow");
if (
((c = y % n),
(s[d] = Math.floor(y / n)),
!Number.isSafeInteger(s[d]) || s[d] * n + c !== y)
)
throw new Error("convertRadix: carry overflow");
if (f) s[d] ? (f = !1) : (r = d);
else continue;
}
if ((o.push(c), f)) break;
}
for (let c = 0; c < e.length - 1 && e[c] === 0; c++) o.push(0);
return o.reverse();
}
const vg = (e, t) => (t ? vg(t, e % t) : e),
ua = (e, t) => e + (t - vg(e, t));
function ol(e, t, n, r) {
if (!Array.isArray(e))
throw new Error("convertRadix2: data should be array");
if (t <= 0 || t > 32) throw new Error(`convertRadix2: wrong from=${t}`);
if (n <= 0 || n > 32) throw new Error(`convertRadix2: wrong to=${n}`);
if (ua(t, n) > 32)
throw new Error(
`convertRadix2: carry overflow from=${t} to=${n} carryBits=${ua(
t,
n
)}`
);
let o = 0,
s = 0;
const c = 2 ** n - 1,
f = [];
for (const d of e) {
if ((Pi(d), d >= 2 ** t))
throw new Error(`convertRadix2: invalid data word=${d} from=${t}`);
if (((o = (o << t) | d), s + t > 32))
throw new Error(`convertRadix2: carry overflow pos=${s} from=${t}`);
for (s += t; s >= n; s -= n) f.push(((o >> (s - n)) & c) >>> 0);
o &= 2 ** s - 1;
}
if (((o = (o << (n - s)) & c), !r && s >= t))
throw new Error("Excess padding");
if (!r && o) throw new Error(`Non-zero padding: ${o}`);
return r && s > 0 && f.push(o >>> 0), f;
}
function Rv(e) {
return (
Pi(e),
{
encode: (t) => {
if (!(t instanceof Uint8Array))
throw new Error("radix.encode input should be Uint8Array");
return Nh(Array.from(t), 2 ** 8, e);
},
decode: (t) => {
if (!Array.isArray(t) || (t.length && typeof t[0] != "number"))
throw new Error(
"radix.decode input should be array of strings"
);
return Uint8Array.from(Nh(t, e, 2 ** 8));
},
}
);
}
function io(e, t = !1) {
if ((Pi(e), e <= 0 || e > 32))
throw new Error("radix2: bits should be in (0..32]");
if (ua(8, e) > 32 || ua(e, 8) > 32)
throw new Error("radix2: carry overflow");
return {
encode: (n) => {
if (!(n instanceof Uint8Array))
throw new Error("radix2.encode input should be Uint8Array");
return ol(Array.from(n), 8, e, !t);
},
decode: (n) => {
if (!Array.isArray(n) || (n.length && typeof n[0] != "number"))
throw new Error("radix2.decode input should be array of strings");
return Uint8Array.from(ol(n, e, 8, t));
},
};
}
function Rh(e) {
if (typeof e != "function")
throw new Error("unsafeWrapper fn should be function");
return function (...t) {
try {
return e.apply(null, t);
} catch {}
};
}
const zv = fr(io(4), hr("0123456789ABCDEF"), pr("")),
Uv = fr(io(5), hr("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), Va(5), pr(""));
fr(io(5), hr("0123456789ABCDEFGHIJKLMNOPQRSTUV"), Va(5), pr(""));
fr(
io(5),
hr("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),
pr(""),
yg((e) => e.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1"))
);
const ar = fr(
io(6),
hr(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
),
Va(6),
pr("")
),
Mv = fr(
io(6),
hr(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
),
Va(6),
pr("")
),
Xl = (e) => fr(Rv(58), hr(e), pr("")),
il = Xl("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
Xl("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");
Xl("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");
const zh = [0, 2, 3, 5, 6, 7, 9, 10, 11],
Hv = {
encode(e) {
let t = "";
for (let n = 0; n < e.length; n += 8) {
const r = e.subarray(n, n + 8);
t += il.encode(r).padStart(zh[r.length], "1");
}
return t;
},
decode(e) {
let t = [];
for (let n = 0; n < e.length; n += 11) {
const r = e.slice(n, n + 11),
o = zh.indexOf(r.length),
s = il.decode(r);
for (let c = 0; c < s.length - o; c++)
if (s[c] !== 0) throw new Error("base58xmr: wrong padding");
t = t.concat(Array.from(s.slice(s.length - o)));
}
return Uint8Array.from(t);
},
},
sl = fr(hr("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), pr("")),
Uh = [996825010, 642813549, 513874426, 1027748829, 705979059];
function qi(e) {
const t = e >> 25;
let n = (e & 33554431) << 5;
for (let r = 0; r < Uh.length; r++)
((t >> r) & 1) === 1 && (n ^= Uh[r]);
return n;
}
function Mh(e, t, n = 1) {
const r = e.length;
let o = 1;
for (let s = 0; s < r; s++) {
const c = e.charCodeAt(s);
if (c < 33 || c > 126) throw new Error(`Invalid prefix (${e})`);
o = qi(o) ^ (c >> 5);
}
o = qi(o);
for (let s = 0; s < r; s++) o = qi(o) ^ (e.charCodeAt(s) & 31);
for (let s of t) o = qi(o) ^ s;
for (let s = 0; s < 6; s++) o = qi(o);
return (o ^= n), sl.encode(ol([o % 2 ** 30], 30, 5, !1));
}
function _g(e) {
const t = e === "bech32" ? 1 : 734539939,
n = io(5),
r = n.decode,
o = n.encode,
s = Rh(r);
function c(y, m, v = 90) {
if (typeof y != "string")
throw new Error(
`bech32.encode prefix should be string, not ${typeof y}`
);
if (!Array.isArray(m) || (m.length && typeof m[0] != "number"))
throw new Error(
`bech32.encode words should be array of numbers, not ${typeof m}`
);
const P = y.length + 7 + m.length;
if (v !== !1 && P > v)
throw new TypeError(`Length ${P} exceeds limit ${v}`);
return (y = y.toLowerCase()), `${y}1${sl.encode(m)}${Mh(y, m, t)}`;
}
function f(y, m = 90) {
if (typeof y != "string")
throw new Error(
`bech32.decode input should be string, not ${typeof y}`
);
if (y.length < 8 || (m !== !1 && y.length > m))
throw new TypeError(
`Wrong string length: ${y.length} (${y}). Expected (8..${m})`
);
const v = y.toLowerCase();
if (y !== v && y !== y.toUpperCase())
throw new Error("String must be lowercase or uppercase");
y = v;
const P = y.lastIndexOf("1");
if (P === 0 || P === -1)
throw new Error(
'Letter "1" must be present between prefix and data only'
);
const C = y.slice(0, P),
A = y.slice(P + 1);
if (A.length < 6)
throw new Error("Data must be at least 6 characters long");
const O = sl.decode(A).slice(0, -6),
M = Mh(C, O, t);
if (!A.endsWith(M))
throw new Error(`Invalid checksum in ${y}: expected "${M}"`);
return { prefix: C, words: O };
}
const d = Rh(f);
function h(y) {
const { prefix: m, words: v } = f(y, !1);
return { prefix: m, words: v, bytes: r(v) };
}
return {
encode: c,
decode: f,
decodeToBytes: h,
decodeUnsafe: d,
fromWords: r,
fromWordsUnsafe: s,
toWords: o,
};
}
const Gr = _g("bech32");
_g("bech32m");
const jv = {
encode: (e) => new TextDecoder().decode(e),
decode: (e) => new TextEncoder().encode(e),
},
Dv = fr(
io(4),
hr("0123456789abcdef"),
pr(""),
yg((e) => {
if (typeof e != "string" || e.length % 2)
throw new TypeError(
`hex.decode: expected string, got ${typeof e} with length ${
e.length
}`
);
return e.toLowerCase();
})
),
qv = {
utf8: jv,
hex: Dv,
base16: zv,
base32: Uv,
base64: ar,
base64url: Mv,
base58: il,
base58xmr: Hv,
};
`${Object.keys(qv).join(", ")}`;
new TextDecoder("utf-8");
new TextEncoder();
var Vv = 5e3;
function Fv(e) {
return Wv("note", Bo(e));
}
function Kv(e, t) {
let n = Gr.toWords(t);
return Gr.encode(e, n, Vv);
}
function Wv(e, t) {
return Kv(e, t);
}
const Fa = () => {
var M, T;
const e = document.querySelector('meta[name="author"]'),
t = document.querySelector('meta[name="relays"]'),
n = document.querySelector('meta[name="top-notes"]'),
r = document.querySelector('meta[name="short-notes"]'),
o = document.querySelector('meta[name="short-notes-min-chars"]'),
s = document.querySelector(
'meta[name="short-notes-summary-max-chars"]'
),
c = document.querySelector('meta[name="topics"]'),
f = document.querySelector('meta[name="comments"]');
if (!e || !t || !n || !r || !o || !s || !c || !f)
throw new Error("Missing meta tags for configuration");
const d = e.getAttribute("value"),
h =
(M = t.getAttribute("value")) == null
? void 0
: M.split(",").map((N) => N.trim()),
y = n.getAttribute("value") || 0;
function m(N) {
if (N == null || N.trim() === "") return 0;
{
let l = parseFloat(N);
return isNaN(l) ? 0 : l;
}
}
const v = m(o.getAttribute("value")),
P = (() => {
switch (r.getAttribute("value")) {
case "carousel":
return "carousel";
case "main":
return "main";
default:
return "";
}
})(),
C = m(s.getAttribute("value")),
A =
(T = c.getAttribute("value")) == null
? void 0
: T.split(",")
.map((N) => N.trim())
.filter((N) => N !== ""),
O = f.getAttribute("value") == "yes";
return {
npub: d,
relays: h,
topNotes: y,
shortNotesMinChars: v,
shortNotes: P,
shortFeedSummaryMaxChars: C,
topics: A,
comments: O,
};
},
Go = [];
function Gv(e, t = At) {
let n;
const r = new Set();
function o(f) {
if (jn(e, f) && ((e = f), n)) {
const d = !Go.length;
for (const h of r) h[1](), Go.push(h, e);
if (d) {
for (let h = 0; h < Go.length; h += 2) Go[h][0](Go[h + 1]);
Go.length = 0;
}
}
}
function s(f) {
o(f(e));
}
function c(f, d = At) {
const h = [f, d];
return (
r.add(h),
r.size === 1 && (n = t(o, s) || At),
f(e),
() => {
r.delete(h), r.size === 0 && n && (n(), (n = null));
}
);
}
return { set: o, update: s, subscribe: c };
}
function Hh(e) {
if (!Number.isSafeInteger(e) || e < 0)
throw new Error(`Wrong positive integer: ${e}`);
}
function Eg(e, ...t) {
if (!(e instanceof Uint8Array)) throw new Error("Expected Uint8Array");
if (t.length > 0 && !t.includes(e.length))
throw new Error(
`Expected Uint8Array of length ${t}, not of length=${e.length}`
);
}
function Zv(e) {
if (typeof e != "function" || typeof e.create != "function")
throw new Error("Hash should be wrapped by utils.wrapConstructor");
Hh(e.outputLen), Hh(e.blockLen);
}
function la(e, t = !0) {
if (e.destroyed) throw new Error("Hash instance has been destroyed");
if (t && e.finished)
throw new Error("Hash#digest() has already been called");
}
function Yv(e, t) {
Eg(e);
const n = t.outputLen;
if (e.length < n)
throw new Error(
`digestInto() expects output buffer of length at least ${n}`
);
}
const Au =
typeof globalThis == "object" && "crypto" in globalThis
? globalThis.crypto
: void 0;
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const kg =
(e) => e instanceof Uint8Array,
Su = (e) => new DataView(e.buffer, e.byteOffset, e.byteLength),
xn = (e, t) => (e << (32 - t)) | (e >>> t),
Jv = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
if (!Jv) throw new Error("Non little-endian hardware is not supported");
function Xv(e) {
if (typeof e != "string")
throw new Error(`utf8ToBytes expected string, got ${typeof e}`);
return new Uint8Array(new TextEncoder().encode(e));
}
function Ql(e) {
if ((typeof e == "string" && (e = Xv(e)), !kg(e)))
throw new Error(`expected Uint8Array, got ${typeof e}`);
return e;
}
function Qv(...e) {
const t = new Uint8Array(e.reduce((r, o) => r + o.length, 0));
let n = 0;
return (
e.forEach((r) => {
if (!kg(r)) throw new Error("Uint8Array expected");
t.set(r, n), (n += r.length);
}),
t
);
}
class Ag {
clone() {
return this._cloneInto();
}
}
function e2(e) {
const t = (r) => e().update(Ql(r)).digest(),
n = e();
return (
(t.outputLen = n.outputLen),
(t.blockLen = n.blockLen),
(t.create = () => e()),
t
);
}
function Sg(e = 32) {
if (Au && typeof Au.getRandomValues == "function")
return Au.getRandomValues(new Uint8Array(e));
throw new Error("crypto.getRandomValues must be defined");
}
function t2(e, t, n, r) {
if (typeof e.setBigUint64 == "function") return e.setBigUint64(t, n, r);
const o = BigInt(32),
s = BigInt(4294967295),
c = Number((n >> o) & s),
f = Number(n & s),
d = r ? 4 : 0,
h = r ? 0 : 4;
e.setUint32(t + d, c, r), e.setUint32(t + h, f, r);
}
let n2 = class extends Ag {
constructor(t, n, r, o) {
super(),
(this.blockLen = t),
(this.outputLen = n),
(this.padOffset = r),
(this.isLE = o),
(this.finished = !1),
(this.length = 0),
(this.pos = 0),
(this.destroyed = !1),
(this.buffer = new Uint8Array(t)),
(this.view = Su(this.buffer));
}
update(t) {
la(this);
const { view: n, buffer: r, blockLen: o } = this;
t = Ql(t);
const s = t.length;
for (let c = 0; c < s; ) {
const f = Math.min(o - this.pos, s - c);
if (f === o) {
const d = Su(t);
for (; o <= s - c; c += o) this.process(d, c);
continue;
}
r.set(t.subarray(c, c + f), this.pos),
(this.pos += f),
(c += f),
this.pos === o && (this.process(n, 0), (this.pos = 0));
}
return (this.length += t.length), this.roundClean(), this;
}
digestInto(t) {
la(this), Yv(t, this), (this.finished = !0);
const { buffer: n, view: r, blockLen: o, isLE: s } = this;
let { pos: c } = this;
(n[c++] = 128),
this.buffer.subarray(c).fill(0),
this.padOffset > o - c && (this.process(r, 0), (c = 0));
for (let m = c; m < o; m++) n[m] = 0;
t2(r, o - 8, BigInt(this.length * 8), s), this.process(r, 0);
const f = Su(t),
d = this.outputLen;
if (d % 4)
throw new Error("_sha2: outputLen should be aligned to 32bit");
const h = d / 4,
y = this.get();
if (h > y.length)
throw new Error("_sha2: outputLen bigger than state");
for (let m = 0; m < h; m++) f.setUint32(4 * m, y[m], s);
}
digest() {
const { buffer: t, outputLen: n } = this;
this.digestInto(t);
const r = t.slice(0, n);
return this.destroy(), r;
}
_cloneInto(t) {
t || (t = new this.constructor()), t.set(...this.get());
const {
blockLen: n,
buffer: r,
length: o,
finished: s,
destroyed: c,
pos: f,
} = this;
return (
(t.length = o),
(t.pos = f),
(t.finished = s),
(t.destroyed = c),
o % n && t.buffer.set(r),
t
);
}
};
const r2 = (e, t, n) => (e & t) ^ (~e & n),
o2 = (e, t, n) => (e & t) ^ (e & n) ^ (t & n),
i2 = new Uint32Array([
1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993,
2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987,
1925078388, 2162078206, 2614888103, 3248222580, 3835390401,
4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692,
1996064986, 2554220882, 2821834349, 2952996808, 3210313671,
3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912,
1294757372, 1396182291, 1695183700, 1986661051, 2177026350,
2456956037, 2730485921, 2820302411, 3259730800, 3345764771,
3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616,
659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779,
1955562222, 2024104815, 2227730452, 2361852424, 2428436474,
2756734187, 3204031479, 3329325298,
]),
Br = new Uint32Array([
1779033703, 3144134277, 1013904242, 2773480762, 1359893119,
2600822924, 528734635, 1541459225,
]),
Cr = new Uint32Array(64);
let s2 = class extends n2 {
constructor() {
super(64, 32, 8, !1),
(this.A = Br[0] | 0),
(this.B = Br[1] | 0),
(this.C = Br[2] | 0),
(this.D = Br[3] | 0),
(this.E = Br[4] | 0),
(this.F = Br[5] | 0),
(this.G = Br[6] | 0),
(this.H = Br[7] | 0);
}
get() {
const { A: t, B: n, C: r, D: o, E: s, F: c, G: f, H: d } = this;
return [t, n, r, o, s, c, f, d];
}
set(t, n, r, o, s, c, f, d) {
(this.A = t | 0),
(this.B = n | 0),
(this.C = r | 0),
(this.D = o | 0),
(this.E = s | 0),
(this.F = c | 0),
(this.G = f | 0),
(this.H = d | 0);
}
process(t, n) {
for (let m = 0; m < 16; m++, n += 4) Cr[m] = t.getUint32(n, !1);
for (let m = 16; m < 64; m++) {
const v = Cr[m - 15],
P = Cr[m - 2],
C = xn(v, 7) ^ xn(v, 18) ^ (v >>> 3),
A = xn(P, 17) ^ xn(P, 19) ^ (P >>> 10);
Cr[m] = (A + Cr[m - 7] + C + Cr[m - 16]) | 0;
}
let { A: r, B: o, C: s, D: c, E: f, F: d, G: h, H: y } = this;
for (let m = 0; m < 64; m++) {
const v = xn(f, 6) ^ xn(f, 11) ^ xn(f, 25),
P = (y + v + r2(f, d, h) + i2[m] + Cr[m]) | 0,
A = ((xn(r, 2) ^ xn(r, 13) ^ xn(r, 22)) + o2(r, o, s)) | 0;
(y = h),
(h = d),
(d = f),
(f = (c + P) | 0),
(c = s),
(s = o),
(o = r),
(r = (P + A) | 0);
}
(r = (r + this.A) | 0),
(o = (o + this.B) | 0),
(s = (s + this.C) | 0),
(c = (c + this.D) | 0),
(f = (f + this.E) | 0),
(d = (d + this.F) | 0),
(h = (h + this.G) | 0),
(y = (y + this.H) | 0),
this.set(r, o, s, c, f, d, h, y);
}
roundClean() {
Cr.fill(0);
}
destroy() {
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
}
};
const al = e2(() => new s2());
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const $g =
BigInt(0),
Ka = BigInt(1),
a2 = BigInt(2),
Wa = (e) => e instanceof Uint8Array,
c2 = Array.from({ length: 256 }, (e, t) =>
t.toString(16).padStart(2, "0")
);
function wi(e) {
if (!Wa(e)) throw new Error("Uint8Array expected");
let t = "";
for (let n = 0; n < e.length; n++) t += c2[e[n]];
return t;
}
function xg(e) {
const t = e.toString(16);
return t.length & 1 ? `0${t}` : t;
}
function ed(e) {
if (typeof e != "string")
throw new Error("hex string expected, got " + typeof e);
return BigInt(e === "" ? "0" : `0x${e}`);
}
function mi(e) {
if (typeof e != "string")
throw new Error("hex string expected, got " + typeof e);
const t = e.length;
if (t % 2)
throw new Error(
"padded hex string expected, got unpadded hex of length " + t
);
const n = new Uint8Array(t / 2);
for (let r = 0; r < n.length; r++) {
const o = r * 2,
s = e.slice(o, o + 2),
c = Number.parseInt(s, 16);
if (Number.isNaN(c) || c < 0)
throw new Error("Invalid byte sequence");
n[r] = c;
}
return n;
}
function Vt(e) {
return ed(wi(e));
}
function td(e) {
if (!Wa(e)) throw new Error("Uint8Array expected");
return ed(wi(Uint8Array.from(e).reverse()));
}
function Zr(e, t) {
return mi(e.toString(16).padStart(t * 2, "0"));
}
function nd(e, t) {
return Zr(e, t).reverse();
}
function u2(e) {
return mi(xg(e));
}
function Tt(e, t, n) {
let r;
if (typeof t == "string")
try {
r = mi(t);
} catch (s) {
throw new Error(
`${e} must be valid hex string, got "${t}". Cause: ${s}`
);
}
else if (Wa(t)) r = Uint8Array.from(t);
else throw new Error(`${e} must be hex string or Uint8Array`);
const o = r.length;
if (typeof n == "number" && o !== n)
throw new Error(`${e} expected ${n} bytes, got ${o}`);
return r;
}
function Co(...e) {
const t = new Uint8Array(e.reduce((r, o) => r + o.length, 0));
let n = 0;
return (
e.forEach((r) => {
if (!Wa(r)) throw new Error("Uint8Array expected");
t.set(r, n), (n += r.length);
}),
t
);
}
function l2(e, t) {
if (e.length !== t.length) return !1;
for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
return !0;
}
function d2(e) {
if (typeof e != "string")
throw new Error(`utf8ToBytes expected string, got ${typeof e}`);
return new Uint8Array(new TextEncoder().encode(e));
}
function f2(e) {
let t;
for (t = 0; e > $g; e >>= Ka, t += 1);
return t;
}
function h2(e, t) {
return (e >> BigInt(t)) & Ka;
}
const p2 = (e, t, n) => e | ((n ? Ka : $g) << BigInt(t)),
rd = (e) => (a2 << BigInt(e - 1)) - Ka,
$u = (e) => new Uint8Array(e),
jh = (e) => Uint8Array.from(e);
function Tg(e, t, n) {
if (typeof e != "number" || e < 2)
throw new Error("hashLen must be a number");
if (typeof t != "number" || t < 2)
throw new Error("qByteLen must be a number");
if (typeof n != "function")
throw new Error("hmacFn must be a function");
let r = $u(e),
o = $u(e),
s = 0;
const c = () => {
r.fill(1), o.fill(0), (s = 0);
},
f = (...m) => n(o, r, ...m),
d = (m = $u()) => {
(o = f(jh([0]), m)),
(r = f()),
m.length !== 0 && ((o = f(jh([1]), m)), (r = f()));
},
h = () => {
if (s++ >= 1e3) throw new Error("drbg: tried 1000 values");
let m = 0;
const v = [];
for (; m < t; ) {
r = f();
const P = r.slice();
v.push(P), (m += r.length);
}
return Co(...v);
};
return (m, v) => {
c(), d(m);
let P;
for (; !(P = v(h())); ) d();
return c(), P;
};
}
const g2 = {
bigint: (e) => typeof e == "bigint",
function: (e) => typeof e == "function",
boolean: (e) => typeof e == "boolean",
string: (e) => typeof e == "string",
stringOrUint8Array: (e) =>
typeof e == "string" || e instanceof Uint8Array,
isSafeInteger: (e) => Number.isSafeInteger(e),
array: (e) => Array.isArray(e),
field: (e, t) => t.Fp.isValid(e),
hash: (e) =>
typeof e == "function" && Number.isSafeInteger(e.outputLen),
};
function ws(e, t, n = {}) {
const r = (o, s, c) => {
const f = g2[s];
if (typeof f != "function")
throw new Error(`Invalid validator "${s}", expected function`);
const d = e[o];
if (!(c && d === void 0) && !f(d, e))
throw new Error(
`Invalid param ${String(o)}=${d} (${typeof d}), expected ${s}`
);
};
for (const [o, s] of Object.entries(t)) r(o, s, !1);
for (const [o, s] of Object.entries(n)) r(o, s, !0);
return e;
}
const w2 = Object.freeze(
Object.defineProperty(
{
__proto__: null,
bitGet: h2,
bitLen: f2,
bitMask: rd,
bitSet: p2,
bytesToHex: wi,
bytesToNumberBE: Vt,
bytesToNumberLE: td,
concatBytes: Co,
createHmacDrbg: Tg,
ensureBytes: Tt,
equalBytes: l2,
hexToBytes: mi,
hexToNumber: ed,
numberToBytesBE: Zr,
numberToBytesLE: nd,
numberToHexUnpadded: xg,
numberToVarBytesBE: u2,
utf8ToBytes: d2,
validateObject: ws,
},
Symbol.toStringTag,
{ value: "Module" }
)
);
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const mt =
BigInt(0),
ot = BigInt(1),
Ao = BigInt(2),
m2 = BigInt(3),
cl = BigInt(4),
Dh = BigInt(5),
qh = BigInt(8);
BigInt(9);
BigInt(16);
function Et(e, t) {
const n = e % t;
return n >= mt ? n : t + n;
}
function b2(e, t, n) {
if (n <= mt || t < mt) throw new Error("Expected power/modulo > 0");
if (n === ot) return mt;
let r = ot;
for (; t > mt; )
t & ot && (r = (r * e) % n), (e = (e * e) % n), (t >>= ot);
return r;
}
function tn(e, t, n) {
let r = e;
for (; t-- > mt; ) (r *= r), (r %= n);
return r;
}
function ul(e, t) {
if (e === mt || t <= mt)
throw new Error(
`invert: expected positive integers, got n=${e} mod=${t}`
);
let n = Et(e, t),
r = t,
o = mt,
s = ot;
for (; n !== mt; ) {
const f = r / n,
d = r % n,
h = o - s * f;
(r = n), (n = d), (o = s), (s = h);
}
if (r !== ot) throw new Error("invert: does not exist");
return Et(o, t);
}
function y2(e) {
const t = (e - ot) / Ao;
let n, r, o;
for (n = e - ot, r = 0; n % Ao === mt; n /= Ao, r++);
for (o = Ao; o < e && b2(o, t, e) !== e - ot; o++);
if (r === 1) {
const c = (e + ot) / cl;
return function (d, h) {
const y = d.pow(h, c);
if (!d.eql(d.sqr(y), h)) throw new Error("Cannot find square root");
return y;
};
}
const s = (n + ot) / Ao;
return function (f, d) {
if (f.pow(d, t) === f.neg(f.ONE))
throw new Error("Cannot find square root");
let h = r,
y = f.pow(f.mul(f.ONE, o), n),
m = f.pow(d, s),
v = f.pow(d, n);
for (; !f.eql(v, f.ONE); ) {
if (f.eql(v, f.ZERO)) return f.ZERO;
let P = 1;
for (let A = f.sqr(v); P < h && !f.eql(A, f.ONE); P++) A = f.sqr(A);
const C = f.pow(y, ot << BigInt(h - P - 1));
(y = f.sqr(C)), (m = f.mul(m, C)), (v = f.mul(v, y)), (h = P);
}
return m;
};
}
function v2(e) {
if (e % cl === m2) {
const t = (e + ot) / cl;
return function (r, o) {
const s = r.pow(o, t);
if (!r.eql(r.sqr(s), o)) throw new Error("Cannot find square root");
return s;
};
}
if (e % qh === Dh) {
const t = (e - Dh) / qh;
return function (r, o) {
const s = r.mul(o, Ao),
c = r.pow(s, t),
f = r.mul(o, c),
d = r.mul(r.mul(f, Ao), c),
h = r.mul(f, r.sub(d, r.ONE));
if (!r.eql(r.sqr(h), o)) throw new Error("Cannot find square root");
return h;
};
}
return y2(e);
}
const _2 = [
"create",
"isValid",
"is0",
"neg",
"inv",
"sqrt",
"sqr",
"eql",
"add",
"sub",
"mul",
"pow",
"div",
"addN",
"subN",
"mulN",
"sqrN",
];
function E2(e) {
const t = {
ORDER: "bigint",
MASK: "bigint",
BYTES: "isSafeInteger",
BITS: "isSafeInteger",
},
n = _2.reduce((r, o) => ((r[o] = "function"), r), t);
return ws(e, n);
}
function k2(e, t, n) {
if (n < mt) throw new Error("Expected power > 0");
if (n === mt) return e.ONE;
if (n === ot) return t;
let r = e.ONE,
o = t;
for (; n > mt; )
n & ot && (r = e.mul(r, o)), (o = e.sqr(o)), (n >>= ot);
return r;
}
function A2(e, t) {
const n = new Array(t.length),
r = t.reduce(
(s, c, f) => (e.is0(c) ? s : ((n[f] = s), e.mul(s, c))),
e.ONE
),
o = e.inv(r);
return (
t.reduceRight(
(s, c, f) =>
e.is0(c) ? s : ((n[f] = e.mul(s, n[f])), e.mul(s, c)),
o
),
n
);
}
function Pg(e, t) {
const n = t !== void 0 ? t : e.toString(2).length,
r = Math.ceil(n / 8);
return { nBitLength: n, nByteLength: r };
}
function S2(e, t, n = !1, r = {}) {
if (e <= mt) throw new Error(`Expected Field ORDER > 0, got ${e}`);
const { nBitLength: o, nByteLength: s } = Pg(e, t);
if (s > 2048)
throw new Error("Field lengths over 2048 bytes are not supported");
const c = v2(e),
f = Object.freeze({
ORDER: e,
BITS: o,
BYTES: s,
MASK: rd(o),
ZERO: mt,
ONE: ot,
create: (d) => Et(d, e),
isValid: (d) => {
if (typeof d != "bigint")
throw new Error(
`Invalid field element: expected bigint, got ${typeof d}`
);
return mt <= d && d < e;
},
is0: (d) => d === mt,
isOdd: (d) => (d & ot) === ot,
neg: (d) => Et(-d, e),
eql: (d, h) => d === h,
sqr: (d) => Et(d * d, e),
add: (d, h) => Et(d + h, e),
sub: (d, h) => Et(d - h, e),
mul: (d, h) => Et(d * h, e),
pow: (d, h) => k2(f, d, h),
div: (d, h) => Et(d * ul(h, e), e),
sqrN: (d) => d * d,
addN: (d, h) => d + h,
subN: (d, h) => d - h,
mulN: (d, h) => d * h,
inv: (d) => ul(d, e),
sqrt: r.sqrt || ((d) => c(f, d)),
invertBatch: (d) => A2(f, d),
cmov: (d, h, y) => (y ? h : d),
toBytes: (d) => (n ? nd(d, s) : Zr(d, s)),
fromBytes: (d) => {
if (d.length !== s)
throw new Error(`Fp.fromBytes: expected ${s}, got ${d.length}`);
return n ? td(d) : Vt(d);
},
});
return Object.freeze(f);
}
function Lg(e) {
if (typeof e != "bigint") throw new Error("field order must be bigint");
const t = e.toString(2).length;
return Math.ceil(t / 8);
}
function Bg(e) {
const t = Lg(e);
return t + Math.ceil(t / 2);
}
function $2(e, t, n = !1) {
const r = e.length,
o = Lg(t),
s = Bg(t);
if (r < 16 || r < s || r > 1024)
throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);
const c = n ? Vt(e) : td(e),
f = Et(c, t - ot) + ot;
return n ? nd(f, o) : Zr(f, o);
}
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const x2 =
BigInt(0),
xu = BigInt(1);
function T2(e, t) {
const n = (o, s) => {
const c = s.negate();
return o ? c : s;
},
r = (o) => {
const s = Math.ceil(t / o) + 1,
c = 2 ** (o - 1);
return { windows: s, windowSize: c };
};
return {
constTimeNegate: n,
unsafeLadder(o, s) {
let c = e.ZERO,
f = o;
for (; s > x2; )
s & xu && (c = c.add(f)), (f = f.double()), (s >>= xu);
return c;
},
precomputeWindow(o, s) {
const { windows: c, windowSize: f } = r(s),
d = [];
let h = o,
y = h;
for (let m = 0; m < c; m++) {
(y = h), d.push(y);
for (let v = 1; v < f; v++) (y = y.add(h)), d.push(y);
h = y.double();
}
return d;
},
wNAF(o, s, c) {
const { windows: f, windowSize: d } = r(o);
let h = e.ZERO,
y = e.BASE;
const m = BigInt(2 ** o - 1),
v = 2 ** o,
P = BigInt(o);
for (let C = 0; C < f; C++) {
const A = C * d;
let O = Number(c & m);
(c >>= P), O > d && ((O -= v), (c += xu));
const M = A,
T = A + Math.abs(O) - 1,
N = C % 2 !== 0,
l = O < 0;
O === 0 ? (y = y.add(n(N, s[M]))) : (h = h.add(n(l, s[T])));
}
return { p: h, f: y };
},
wNAFCached(o, s, c, f) {
const d = o._WINDOW_SIZE || 1;
let h = s.get(o);
return (
h ||
((h = this.precomputeWindow(o, d)), d !== 1 && s.set(o, f(h))),
this.wNAF(d, h, c)
);
},
};
}
function Cg(e) {
return (
E2(e.Fp),
ws(
e,
{ n: "bigint", h: "bigint", Gx: "field", Gy: "field" },
{ nBitLength: "isSafeInteger", nByteLength: "isSafeInteger" }
),
Object.freeze({ ...Pg(e.n, e.nBitLength), ...e, p: e.Fp.ORDER })
);
}
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ function P2(
e
) {
const t = Cg(e);
ws(
t,
{ a: "field", b: "field" },
{
allowedPrivateKeyLengths: "array",
wrapPrivateKey: "boolean",
isTorsionFree: "function",
clearCofactor: "function",
allowInfinityPoint: "boolean",
fromBytes: "function",
toBytes: "function",
}
);
const { endo: n, Fp: r, a: o } = t;
if (n) {
if (!r.eql(o, r.ZERO))
throw new Error(
"Endomorphism can only be defined for Koblitz curves that have a=0"
);
if (
typeof n != "object" ||
typeof n.beta != "bigint" ||
typeof n.splitScalar != "function"
)
throw new Error(
"Expected endomorphism with beta: bigint and splitScalar: function"
);
}
return Object.freeze({ ...t });
}
const { bytesToNumberBE: L2, hexToBytes: B2 } = w2,
To = {
Err: class extends Error {
constructor(t = "") {
super(t);
}
},
_parseInt(e) {
const { Err: t } = To;
if (e.length < 2 || e[0] !== 2)
throw new t("Invalid signature integer tag");
const n = e[1],
r = e.subarray(2, n + 2);
if (!n || r.length !== n)
throw new t("Invalid signature integer: wrong length");
if (r[0] & 128) throw new t("Invalid signature integer: negative");
if (r[0] === 0 && !(r[1] & 128))
throw new t(
"Invalid signature integer: unnecessary leading zero"
);
return { d: L2(r), l: e.subarray(n + 2) };
},
toSig(e) {
const { Err: t } = To,
n = typeof e == "string" ? B2(e) : e;
if (!(n instanceof Uint8Array)) throw new Error("ui8a expected");
let r = n.length;
if (r < 2 || n[0] != 48) throw new t("Invalid signature tag");
if (n[1] !== r - 2)
throw new t("Invalid signature: incorrect length");
const { d: o, l: s } = To._parseInt(n.subarray(2)),
{ d: c, l: f } = To._parseInt(s);
if (f.length)
throw new t("Invalid signature: left bytes after parsing");
return { r: o, s: c };
},
hexFromSig(e) {
const t = (h) => (Number.parseInt(h[0], 16) & 8 ? "00" + h : h),
n = (h) => {
const y = h.toString(16);
return y.length & 1 ? `0${y}` : y;
},
r = t(n(e.s)),
o = t(n(e.r)),
s = r.length / 2,
c = o.length / 2,
f = n(s),
d = n(c);
return `30${n(c + s + 4)}02${d}${o}02${f}${r}`;
},
},
Qn = BigInt(0),
rn = BigInt(1);
BigInt(2);
const Vh = BigInt(3);
BigInt(4);
function C2(e) {
const t = P2(e),
{ Fp: n } = t,
r =
t.toBytes ||
((C, A, O) => {
const M = A.toAffine();
return Co(Uint8Array.from([4]), n.toBytes(M.x), n.toBytes(M.y));
}),
o =
t.fromBytes ||
((C) => {
const A = C.subarray(1),
O = n.fromBytes(A.subarray(0, n.BYTES)),
M = n.fromBytes(A.subarray(n.BYTES, 2 * n.BYTES));
return { x: O, y: M };
});
function s(C) {
const { a: A, b: O } = t,
M = n.sqr(C),
T = n.mul(M, C);
return n.add(n.add(T, n.mul(C, A)), O);
}
if (!n.eql(n.sqr(t.Gy), s(t.Gx)))
throw new Error("bad generator point: equation left != right");
function c(C) {
return typeof C == "bigint" && Qn < C && C < t.n;
}
function f(C) {
if (!c(C))
throw new Error("Expected valid bigint: 0 < bigint < curve.n");
}
function d(C) {
const {
allowedPrivateKeyLengths: A,
nByteLength: O,
wrapPrivateKey: M,
n: T,
} = t;
if (A && typeof C != "bigint") {
if (
(C instanceof Uint8Array && (C = wi(C)),
typeof C != "string" || !A.includes(C.length))
)
throw new Error("Invalid key");
C = C.padStart(O * 2, "0");
}
let N;
try {
N = typeof C == "bigint" ? C : Vt(Tt("private key", C, O));
} catch {
throw new Error(
`private key must be ${O} bytes, hex or bigint, not ${typeof C}`
);
}
return M && (N = Et(N, T)), f(N), N;
}
const h = new Map();
function y(C) {
if (!(C instanceof m)) throw new Error("ProjectivePoint expected");
}
class m {
constructor(A, O, M) {
if (
((this.px = A),
(this.py = O),
(this.pz = M),
A == null || !n.isValid(A))
)
throw new Error("x required");
if (O == null || !n.isValid(O)) throw new Error("y required");
if (M == null || !n.isValid(M)) throw new Error("z required");
}
static fromAffine(A) {
const { x: O, y: M } = A || {};
if (!A || !n.isValid(O) || !n.isValid(M))
throw new Error("invalid affine point");
if (A instanceof m) throw new Error("projective point not allowed");
const T = (N) => n.eql(N, n.ZERO);
return T(O) && T(M) ? m.ZERO : new m(O, M, n.ONE);
}
get x() {
return this.toAffine().x;
}
get y() {
return this.toAffine().y;
}
static normalizeZ(A) {
const O = n.invertBatch(A.map((M) => M.pz));
return A.map((M, T) => M.toAffine(O[T])).map(m.fromAffine);
}
static fromHex(A) {
const O = m.fromAffine(o(Tt("pointHex", A)));
return O.assertValidity(), O;
}
static fromPrivateKey(A) {
return m.BASE.multiply(d(A));
}
_setWindowSize(A) {
(this._WINDOW_SIZE = A), h.delete(this);
}
assertValidity() {
if (this.is0()) {
if (t.allowInfinityPoint && !n.is0(this.py)) return;
throw new Error("bad point: ZERO");
}
const { x: A, y: O } = this.toAffine();
if (!n.isValid(A) || !n.isValid(O))
throw new Error("bad point: x or y not FE");
const M = n.sqr(O),
T = s(A);
if (!n.eql(M, T))
throw new Error("bad point: equation left != right");
if (!this.isTorsionFree())
throw new Error("bad point: not in prime-order subgroup");
}
hasEvenY() {
const { y: A } = this.toAffine();
if (n.isOdd) return !n.isOdd(A);
throw new Error("Field doesn't support isOdd");
}
equals(A) {
y(A);
const { px: O, py: M, pz: T } = this,
{ px: N, py: l, pz: w } = A,
p = n.eql(n.mul(O, w), n.mul(N, T)),
_ = n.eql(n.mul(M, w), n.mul(l, T));
return p && _;
}
negate() {
return new m(this.px, n.neg(this.py), this.pz);
}
double() {
const { a: A, b: O } = t,
M = n.mul(O, Vh),
{ px: T, py: N, pz: l } = this;
let w = n.ZERO,
p = n.ZERO,
_ = n.ZERO,
$ = n.mul(T, T),
R = n.mul(N, N),
L = n.mul(l, l),
E = n.mul(T, N);
return (
(E = n.add(E, E)),
(_ = n.mul(T, l)),
(_ = n.add(_, _)),
(w = n.mul(A, _)),
(p = n.mul(M, L)),
(p = n.add(w, p)),
(w = n.sub(R, p)),
(p = n.add(R, p)),
(p = n.mul(w, p)),
(w = n.mul(E, w)),
(_ = n.mul(M, _)),
(L = n.mul(A, L)),
(E = n.sub($, L)),
(E = n.mul(A, E)),
(E = n.add(E, _)),
(_ = n.add($, $)),
($ = n.add(_, $)),
($ = n.add($, L)),
($ = n.mul($, E)),
(p = n.add(p, $)),
(L = n.mul(N, l)),
(L = n.add(L, L)),
($ = n.mul(L, E)),
(w = n.sub(w, $)),
(_ = n.mul(L, R)),
(_ = n.add(_, _)),
(_ = n.add(_, _)),
new m(w, p, _)
);
}
add(A) {
y(A);
const { px: O, py: M, pz: T } = this,
{ px: N, py: l, pz: w } = A;
let p = n.ZERO,
_ = n.ZERO,
$ = n.ZERO;
const R = t.a,
L = n.mul(t.b, Vh);
let E = n.mul(O, N),
x = n.mul(M, l),
z = n.mul(T, w),
q = n.add(O, M),
I = n.add(N, l);
(q = n.mul(q, I)),
(I = n.add(E, x)),
(q = n.sub(q, I)),
(I = n.add(O, T));
let S = n.add(N, w);
return (
(I = n.mul(I, S)),
(S = n.add(E, z)),
(I = n.sub(I, S)),
(S = n.add(M, T)),
(p = n.add(l, w)),
(S = n.mul(S, p)),
(p = n.add(x, z)),
(S = n.sub(S, p)),
($ = n.mul(R, I)),
(p = n.mul(L, z)),
($ = n.add(p, $)),
(p = n.sub(x, $)),
($ = n.add(x, $)),
(_ = n.mul(p, $)),
(x = n.add(E, E)),
(x = n.add(x, E)),
(z = n.mul(R, z)),
(I = n.mul(L, I)),
(x = n.add(x, z)),
(z = n.sub(E, z)),
(z = n.mul(R, z)),
(I = n.add(I, z)),
(E = n.mul(x, I)),
(_ = n.add(_, E)),
(E = n.mul(S, I)),
(p = n.mul(q, p)),
(p = n.sub(p, E)),
(E = n.mul(q, x)),
($ = n.mul(S, $)),
($ = n.add($, E)),
new m(p, _, $)
);
}
subtract(A) {
return this.add(A.negate());
}
is0() {
return this.equals(m.ZERO);
}
wNAF(A) {
return P.wNAFCached(this, h, A, (O) => {
const M = n.invertBatch(O.map((T) => T.pz));
return O.map((T, N) => T.toAffine(M[N])).map(m.fromAffine);
});
}
multiplyUnsafe(A) {
const O = m.ZERO;
if (A === Qn) return O;
if ((f(A), A === rn)) return this;
const { endo: M } = t;
if (!M) return P.unsafeLadder(this, A);
let { k1neg: T, k1: N, k2neg: l, k2: w } = M.splitScalar(A),
p = O,
_ = O,
$ = this;
for (; N > Qn || w > Qn; )
N & rn && (p = p.add($)),
w & rn && (_ = _.add($)),
($ = $.double()),
(N >>= rn),
(w >>= rn);
return (
T && (p = p.negate()),
l && (_ = _.negate()),
(_ = new m(n.mul(_.px, M.beta), _.py, _.pz)),
p.add(_)
);
}
multiply(A) {
f(A);
let O = A,
M,
T;
const { endo: N } = t;
if (N) {
const { k1neg: l, k1: w, k2neg: p, k2: _ } = N.splitScalar(O);
let { p: $, f: R } = this.wNAF(w),
{ p: L, f: E } = this.wNAF(_);
($ = P.constTimeNegate(l, $)),
(L = P.constTimeNegate(p, L)),
(L = new m(n.mul(L.px, N.beta), L.py, L.pz)),
(M = $.add(L)),
(T = R.add(E));
} else {
const { p: l, f: w } = this.wNAF(O);
(M = l), (T = w);
}
return m.normalizeZ([M, T])[0];
}
multiplyAndAddUnsafe(A, O, M) {
const T = m.BASE,
N = (w, p) =>
p === Qn || p === rn || !w.equals(T)
? w.multiplyUnsafe(p)
: w.multiply(p),
l = N(this, O).add(N(A, M));
return l.is0() ? void 0 : l;
}
toAffine(A) {
const { px: O, py: M, pz: T } = this,
N = this.is0();
A == null && (A = N ? n.ONE : n.inv(T));
const l = n.mul(O, A),
w = n.mul(M, A),
p = n.mul(T, A);
if (N) return { x: n.ZERO, y: n.ZERO };
if (!n.eql(p, n.ONE)) throw new Error("invZ was invalid");
return { x: l, y: w };
}
isTorsionFree() {
const { h: A, isTorsionFree: O } = t;
if (A === rn) return !0;
if (O) return O(m, this);
throw new Error(
"isTorsionFree() has not been declared for the elliptic curve"
);
}
clearCofactor() {
const { h: A, clearCofactor: O } = t;
return A === rn ? this : O ? O(m, this) : this.multiplyUnsafe(t.h);
}
toRawBytes(A = !0) {
return this.assertValidity(), r(m, this, A);
}
toHex(A = !0) {
return wi(this.toRawBytes(A));
}
}
(m.BASE = new m(t.Gx, t.Gy, n.ONE)),
(m.ZERO = new m(n.ZERO, n.ONE, n.ZERO));
const v = t.nBitLength,
P = T2(m, t.endo ? Math.ceil(v / 2) : v);
return {
CURVE: t,
ProjectivePoint: m,
normPrivateKeyToScalar: d,
weierstrassEquation: s,
isWithinCurveOrder: c,
};
}
function I2(e) {
const t = Cg(e);
return (
ws(
t,
{ hash: "hash", hmac: "function", randomBytes: "function" },
{ bits2int: "function", bits2int_modN: "function", lowS: "boolean" }
),
Object.freeze({ lowS: !0, ...t })
);
}
function O2(e) {
const t = I2(e),
{ Fp: n, n: r } = t,
o = n.BYTES + 1,
s = 2 * n.BYTES + 1;
function c(I) {
return Qn < I && I < n.ORDER;
}
function f(I) {
return Et(I, r);
}
function d(I) {
return ul(I, r);
}
const {
ProjectivePoint: h,
normPrivateKeyToScalar: y,
weierstrassEquation: m,
isWithinCurveOrder: v,
} = C2({
...t,
toBytes(I, S, D) {
const K = S.toAffine(),
W = n.toBytes(K.x),
Z = Co;
return D
? Z(Uint8Array.from([S.hasEvenY() ? 2 : 3]), W)
: Z(Uint8Array.from([4]), W, n.toBytes(K.y));
},
fromBytes(I) {
const S = I.length,
D = I[0],
K = I.subarray(1);
if (S === o && (D === 2 || D === 3)) {
const W = Vt(K);
if (!c(W)) throw new Error("Point is not on curve");
const Z = m(W);
let G = n.sqrt(Z);
const oe = (G & rn) === rn;
return ((D & 1) === 1) !== oe && (G = n.neg(G)), { x: W, y: G };
} else if (S === s && D === 4) {
const W = n.fromBytes(K.subarray(0, n.BYTES)),
Z = n.fromBytes(K.subarray(n.BYTES, 2 * n.BYTES));
return { x: W, y: Z };
} else
throw new Error(
`Point of length ${S} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`
);
},
}),
P = (I) => wi(Zr(I, t.nByteLength));
function C(I) {
const S = r >> rn;
return I > S;
}
function A(I) {
return C(I) ? f(-I) : I;
}
const O = (I, S, D) => Vt(I.slice(S, D));
class M {
constructor(S, D, K) {
(this.r = S),
(this.s = D),
(this.recovery = K),
this.assertValidity();
}
static fromCompact(S) {
const D = t.nByteLength;
return (
(S = Tt("compactSignature", S, D * 2)),
new M(O(S, 0, D), O(S, D, 2 * D))
);
}
static fromDER(S) {
const { r: D, s: K } = To.toSig(Tt("DER", S));
return new M(D, K);
}
assertValidity() {
if (!v(this.r)) throw new Error("r must be 0 < r < CURVE.n");
if (!v(this.s)) throw new Error("s must be 0 < s < CURVE.n");
}
addRecoveryBit(S) {
return new M(this.r, this.s, S);
}
recoverPublicKey(S) {
const { r: D, s: K, recovery: W } = this,
Z = _(Tt("msgHash", S));
if (W == null || ![0, 1, 2, 3].includes(W))
throw new Error("recovery id invalid");
const G = W === 2 || W === 3 ? D + t.n : D;
if (G >= n.ORDER) throw new Error("recovery id 2 or 3 invalid");
const oe = W & 1 ? "03" : "02",
he = h.fromHex(oe + P(G)),
be = d(G),
Se = f(-Z * be),
re = f(K * be),
ye = h.BASE.multiplyAndAddUnsafe(he, Se, re);
if (!ye) throw new Error("point at infinify");
return ye.assertValidity(), ye;
}
hasHighS() {
return C(this.s);
}
normalizeS() {
return this.hasHighS()
? new M(this.r, f(-this.s), this.recovery)
: this;
}
toDERRawBytes() {
return mi(this.toDERHex());
}
toDERHex() {
return To.hexFromSig({ r: this.r, s: this.s });
}
toCompactRawBytes() {
return mi(this.toCompactHex());
}
toCompactHex() {
return P(this.r) + P(this.s);
}
}
const T = {
isValidPrivateKey(I) {
try {
return y(I), !0;
} catch {
return !1;
}
},
normPrivateKeyToScalar: y,
randomPrivateKey: () => {
const I = Bg(t.n);
return $2(t.randomBytes(I), t.n);
},
precompute(I = 8, S = h.BASE) {
return S._setWindowSize(I), S.multiply(BigInt(3)), S;
},
};
function N(I, S = !0) {
return h.fromPrivateKey(I).toRawBytes(S);
}
function l(I) {
const S = I instanceof Uint8Array,
D = typeof I == "string",
K = (S || D) && I.length;
return S
? K === o || K === s
: D
? K === 2 * o || K === 2 * s
: I instanceof h;
}
function w(I, S, D = !0) {
if (l(I)) throw new Error("first arg must be private key");
if (!l(S)) throw new Error("second arg must be public key");
return h.fromHex(S).multiply(y(I)).toRawBytes(D);
}
const p =
t.bits2int ||
function (I) {
const S = Vt(I),
D = I.length * 8 - t.nBitLength;
return D > 0 ? S >> BigInt(D) : S;
},
_ =
t.bits2int_modN ||
function (I) {
return f(p(I));
},
$ = rd(t.nBitLength);
function R(I) {
if (typeof I != "bigint") throw new Error("bigint expected");
if (!(Qn <= I && I < $))
throw new Error(`bigint expected < 2^${t.nBitLength}`);
return Zr(I, t.nByteLength);
}
function L(I, S, D = E) {
if (["recovered", "canonical"].some((Oe) => Oe in D))
throw new Error("sign() legacy options not supported");
const { hash: K, randomBytes: W } = t;
let { lowS: Z, prehash: G, extraEntropy: oe } = D;
Z == null && (Z = !0),
(I = Tt("msgHash", I)),
G && (I = Tt("prehashed msgHash", K(I)));
const he = _(I),
be = y(S),
Se = [R(be), R(he)];
if (oe != null) {
const Oe = oe === !0 ? W(n.BYTES) : oe;
Se.push(Tt("extraEntropy", Oe));
}
const re = Co(...Se),
ye = he;
function Ce(Oe) {
const Me = p(Oe);
if (!v(Me)) return;
const pt = d(Me),
Ke = h.BASE.multiply(Me).toAffine(),
se = f(Ke.x);
if (se === Qn) return;
const Re = f(pt * f(ye + se * be));
if (Re === Qn) return;
let Te = (Ke.x === se ? 0 : 2) | Number(Ke.y & rn),
Pe = Re;
return Z && C(Re) && ((Pe = A(Re)), (Te ^= 1)), new M(se, Pe, Te);
}
return { seed: re, k2sig: Ce };
}
const E = { lowS: t.lowS, prehash: !1 },
x = { lowS: t.lowS, prehash: !1 };
function z(I, S, D = E) {
const { seed: K, k2sig: W } = L(I, S, D),
Z = t;
return Tg(Z.hash.outputLen, Z.nByteLength, Z.hmac)(K, W);
}
h.BASE._setWindowSize(8);
function q(I, S, D, K = x) {
var Ke;
const W = I;
if (((S = Tt("msgHash", S)), (D = Tt("publicKey", D)), "strict" in K))
throw new Error("options.strict was renamed to lowS");
const { lowS: Z, prehash: G } = K;
let oe, he;
try {
if (typeof W == "string" || W instanceof Uint8Array)
try {
oe = M.fromDER(W);
} catch (se) {
if (!(se instanceof To.Err)) throw se;
oe = M.fromCompact(W);
}
else if (
typeof W == "object" &&
typeof W.r == "bigint" &&
typeof W.s == "bigint"
) {
const { r: se, s: Re } = W;
oe = new M(se, Re);
} else throw new Error("PARSE");
he = h.fromHex(D);
} catch (se) {
if (se.message === "PARSE")
throw new Error(
"signature must be Signature instance, Uint8Array or hex string"
);
return !1;
}
if (Z && oe.hasHighS()) return !1;
G && (S = t.hash(S));
const { r: be, s: Se } = oe,
re = _(S),
ye = d(Se),
Ce = f(re * ye),
Oe = f(be * ye),
Me =
(Ke = h.BASE.multiplyAndAddUnsafe(he, Ce, Oe)) == null
? void 0
: Ke.toAffine();
return Me ? f(Me.x) === be : !1;
}
return {
CURVE: t,
getPublicKey: N,
getSharedSecret: w,
sign: z,
verify: q,
ProjectivePoint: h,
Signature: M,
utils: T,
};
}
let Ig = class extends Ag {
constructor(t, n) {
super(), (this.finished = !1), (this.destroyed = !1), Zv(t);
const r = Ql(n);
if (
((this.iHash = t.create()), typeof this.iHash.update != "function")
)
throw new Error(
"Expected instance of class which extends utils.Hash"
);
(this.blockLen = this.iHash.blockLen),
(this.outputLen = this.iHash.outputLen);
const o = this.blockLen,
s = new Uint8Array(o);
s.set(r.length > o ? t.create().update(r).digest() : r);
for (let c = 0; c < s.length; c++) s[c] ^= 54;
this.iHash.update(s), (this.oHash = t.create());
for (let c = 0; c < s.length; c++) s[c] ^= 106;
this.oHash.update(s), s.fill(0);
}
update(t) {
return la(this), this.iHash.update(t), this;
}
digestInto(t) {
la(this),
Eg(t, this.outputLen),
(this.finished = !0),
this.iHash.digestInto(t),
this.oHash.update(t),
this.oHash.digestInto(t),
this.destroy();
}
digest() {
const t = new Uint8Array(this.oHash.outputLen);
return this.digestInto(t), t;
}
_cloneInto(t) {
t || (t = Object.create(Object.getPrototypeOf(this), {}));
const {
oHash: n,
iHash: r,
finished: o,
destroyed: s,
blockLen: c,
outputLen: f,
} = this;
return (
(t = t),
(t.finished = o),
(t.destroyed = s),
(t.blockLen = c),
(t.outputLen = f),
(t.oHash = n._cloneInto(t.oHash)),
(t.iHash = r._cloneInto(t.iHash)),
t
);
}
destroy() {
(this.destroyed = !0), this.oHash.destroy(), this.iHash.destroy();
}
};
const Og = (e, t, n) => new Ig(e, t).update(n).digest();
Og.create = (e, t) => new Ig(e, t);
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ function N2(
e
) {
return {
hash: e,
hmac: (t, ...n) => Og(e, t, Qv(...n)),
randomBytes: Sg,
};
}
function R2(e, t) {
const n = (r) => O2({ ...e, ...N2(r) });
return Object.freeze({ ...n(t), create: n });
}
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const Ga =
BigInt(
"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"
),
da = BigInt(
"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"
),
Ng = BigInt(1),
fa = BigInt(2),
Fh = (e, t) => (e + t / fa) / t;
function Rg(e) {
const t = Ga,
n = BigInt(3),
r = BigInt(6),
o = BigInt(11),
s = BigInt(22),
c = BigInt(23),
f = BigInt(44),
d = BigInt(88),
h = (e * e * e) % t,
y = (h * h * e) % t,
m = (tn(y, n, t) * y) % t,
v = (tn(m, n, t) * y) % t,
P = (tn(v, fa, t) * h) % t,
C = (tn(P, o, t) * P) % t,
A = (tn(C, s, t) * C) % t,
O = (tn(A, f, t) * A) % t,
M = (tn(O, d, t) * O) % t,
T = (tn(M, f, t) * A) % t,
N = (tn(T, n, t) * y) % t,
l = (tn(N, c, t) * C) % t,
w = (tn(l, r, t) * h) % t,
p = tn(w, fa, t);
if (!ll.eql(ll.sqr(p), e)) throw new Error("Cannot find square root");
return p;
}
const ll = S2(Ga, void 0, void 0, { sqrt: Rg }),
Li = R2(
{
a: BigInt(0),
b: BigInt(7),
Fp: ll,
n: da,
Gx: BigInt(
"55066263022277343669578718895168534326250603453777594175500187360389116729240"
),
Gy: BigInt(
"32670510020758816978083085130507043184471273380659243275938904335757337482424"
),
h: BigInt(1),
lowS: !0,
endo: {
beta: BigInt(
"0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"
),
splitScalar: (e) => {
const t = da,
n = BigInt("0x3086d221a7d46bcde86c90e49284eb15"),
r = -Ng * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),
o = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),
s = n,
c = BigInt("0x100000000000000000000000000000000"),
f = Fh(s * e, t),
d = Fh(-r * e, t);
let h = Et(e - f * n - d * o, t),
y = Et(-f * r - d * s, t);
const m = h > c,
v = y > c;
if ((m && (h = t - h), v && (y = t - y), h > c || y > c))
throw new Error("splitScalar: Endomorphism failed, k=" + e);
return { k1neg: m, k1: h, k2neg: v, k2: y };
},
},
},
al
),
Za = BigInt(0),
zg = (e) => typeof e == "bigint" && Za < e && e < Ga,
z2 = (e) => typeof e == "bigint" && Za < e && e < da,
Kh = {};
function ha(e, ...t) {
let n = Kh[e];
if (n === void 0) {
const r = al(Uint8Array.from(e, (o) => o.charCodeAt(0)));
(n = Co(r, r)), (Kh[e] = n);
}
return al(Co(n, ...t));
}
const od = (e) => e.toRawBytes(!0).slice(1),
dl = (e) => Zr(e, 32),
Tu = (e) => Et(e, Ga),
os = (e) => Et(e, da),
id = Li.ProjectivePoint,
U2 = (e, t, n) => id.BASE.multiplyAndAddUnsafe(e, t, n);
function fl(e) {
let t = Li.utils.normPrivateKeyToScalar(e),
n = id.fromPrivateKey(t);
return { scalar: n.hasEvenY() ? t : os(-t), bytes: od(n) };
}
function Ug(e) {
if (!zg(e)) throw new Error("bad x: need 0 < x < p");
const t = Tu(e * e),
n = Tu(t * e + BigInt(7));
let r = Rg(n);
r % fa !== Za && (r = Tu(-r));
const o = new id(e, r, Ng);
return o.assertValidity(), o;
}
function Mg(...e) {
return os(Vt(ha("BIP0340/challenge", ...e)));
}
function M2(e) {
return fl(e).bytes;
}
function H2(e, t, n = Sg(32)) {
const r = Tt("message", e),
{ bytes: o, scalar: s } = fl(t),
c = Tt("auxRand", n, 32),
f = dl(s ^ Vt(ha("BIP0340/aux", c))),
d = ha("BIP0340/nonce", f, o, r),
h = os(Vt(d));
if (h === Za) throw new Error("sign failed: k is zero");
const { bytes: y, scalar: m } = fl(h),
v = Mg(y, o, r),
P = new Uint8Array(64);
if ((P.set(y, 0), P.set(dl(os(m + v * s)), 32), !Hg(P, r, o)))
throw new Error("sign: Invalid signature produced");
return P;
}
function Hg(e, t, n) {
const r = Tt("signature", e, 64),
o = Tt("message", t),
s = Tt("publicKey", n, 32);
try {
const c = Ug(Vt(s)),
f = Vt(r.subarray(0, 32));
if (!zg(f)) return !1;
const d = Vt(r.subarray(32, 64));
if (!z2(d)) return !1;
const h = Mg(dl(f), od(c), o),
y = U2(c, d, os(-h));
return !(!y || !y.hasEvenY() || y.toAffine().x !== f);
} catch {
return !1;
}
}
const Cn = {
getPublicKey: M2,
sign: H2,
verify: Hg,
utils: {
randomPrivateKey: Li.utils.randomPrivateKey,
lift_x: Ug,
pointToBytes: od,
numberToBytesBE: Zr,
bytesToNumberBE: Vt,
taggedHash: ha,
mod: Et,
},
};
function hl(e) {
if (!Number.isSafeInteger(e) || e < 0)
throw new Error(`Wrong positive integer: ${e}`);
}
function j2(e) {
if (typeof e != "boolean")
throw new Error(`Expected boolean, not ${e}`);
}
function jg(e, ...t) {
if (!(e instanceof Uint8Array)) throw new Error("Expected Uint8Array");
if (t.length > 0 && !t.includes(e.length))
throw new Error(
`Expected Uint8Array of length ${t}, not of length=${e.length}`
);
}
function D2(e) {
if (typeof e != "function" || typeof e.create != "function")
throw new Error("Hash should be wrapped by utils.wrapConstructor");
hl(e.outputLen), hl(e.blockLen);
}
function q2(e, t = !0) {
if (e.destroyed) throw new Error("Hash instance has been destroyed");
if (t && e.finished)
throw new Error("Hash#digest() has already been called");
}
function V2(e, t) {
jg(e);
const n = t.outputLen;
if (e.length < n)
throw new Error(
`digestInto() expects output buffer of length at least ${n}`
);
}
const In = {
number: hl,
bool: j2,
bytes: jg,
hash: D2,
exists: q2,
output: V2,
};
function F2(e, t, n, r) {
if (typeof e.setBigUint64 == "function") return e.setBigUint64(t, n, r);
const o = BigInt(32),
s = BigInt(4294967295),
c = Number((n >> o) & s),
f = Number(n & s),
d = r ? 4 : 0,
h = r ? 0 : 4;
e.setUint32(t + d, c, r), e.setUint32(t + h, f, r);
}
class K2 extends wg {
constructor(t, n, r, o) {
super(),
(this.blockLen = t),
(this.outputLen = n),
(this.padOffset = r),
(this.isLE = o),
(this.finished = !1),
(this.length = 0),
(this.pos = 0),
(this.destroyed = !1),
(this.buffer = new Uint8Array(t)),
(this.view = ku(this.buffer));
}
update(t) {
In.exists(this);
const { view: n, buffer: r, blockLen: o } = this;
t = rs(t);
const s = t.length;
for (let c = 0; c < s; ) {
const f = Math.min(o - this.pos, s - c);
if (f === o) {
const d = ku(t);
for (; o <= s - c; c += o) this.process(d, c);
continue;
}
r.set(t.subarray(c, c + f), this.pos),
(this.pos += f),
(c += f),
this.pos === o && (this.process(n, 0), (this.pos = 0));
}
return (this.length += t.length), this.roundClean(), this;
}
digestInto(t) {
In.exists(this), In.output(t, this), (this.finished = !0);
const { buffer: n, view: r, blockLen: o, isLE: s } = this;
let { pos: c } = this;
(n[c++] = 128),
this.buffer.subarray(c).fill(0),
this.padOffset > o - c && (this.process(r, 0), (c = 0));
for (let m = c; m < o; m++) n[m] = 0;
F2(r, o - 8, BigInt(this.length * 8), s), this.process(r, 0);
const f = ku(t),
d = this.outputLen;
if (d % 4)
throw new Error("_sha2: outputLen should be aligned to 32bit");
const h = d / 4,
y = this.get();
if (h > y.length)
throw new Error("_sha2: outputLen bigger than state");
for (let m = 0; m < h; m++) f.setUint32(4 * m, y[m], s);
}
digest() {
const { buffer: t, outputLen: n } = this;
this.digestInto(t);
const r = t.slice(0, n);
return this.destroy(), r;
}
_cloneInto(t) {
t || (t = new this.constructor()), t.set(...this.get());
const {
blockLen: n,
buffer: r,
length: o,
finished: s,
destroyed: c,
pos: f,
} = this;
return (
(t.length = o),
(t.pos = f),
(t.finished = s),
(t.destroyed = c),
o % n && t.buffer.set(r),
t
);
}
}
const W2 = (e, t, n) => (e & t) ^ (~e & n),
G2 = (e, t, n) => (e & t) ^ (e & n) ^ (t & n),
Z2 = new Uint32Array([
1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993,
2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987,
1925078388, 2162078206, 2614888103, 3248222580, 3835390401,
4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692,
1996064986, 2554220882, 2821834349, 2952996808, 3210313671,
3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912,
1294757372, 1396182291, 1695183700, 1986661051, 2177026350,
2456956037, 2730485921, 2820302411, 3259730800, 3345764771,
3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616,
659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779,
1955562222, 2024104815, 2227730452, 2361852424, 2428436474,
2756734187, 3204031479, 3329325298,
]),
Ir = new Uint32Array([
1779033703, 3144134277, 1013904242, 2773480762, 1359893119,
2600822924, 528734635, 1541459225,
]),
Or = new Uint32Array(64);
class Dg extends K2 {
constructor() {
super(64, 32, 8, !1),
(this.A = Ir[0] | 0),
(this.B = Ir[1] | 0),
(this.C = Ir[2] | 0),
(this.D = Ir[3] | 0),
(this.E = Ir[4] | 0),
(this.F = Ir[5] | 0),
(this.G = Ir[6] | 0),
(this.H = Ir[7] | 0);
}
get() {
const { A: t, B: n, C: r, D: o, E: s, F: c, G: f, H: d } = this;
return [t, n, r, o, s, c, f, d];
}
set(t, n, r, o, s, c, f, d) {
(this.A = t | 0),
(this.B = n | 0),
(this.C = r | 0),
(this.D = o | 0),
(this.E = s | 0),
(this.F = c | 0),
(this.G = f | 0),
(this.H = d | 0);
}
process(t, n) {
for (let m = 0; m < 16; m++, n += 4) Or[m] = t.getUint32(n, !1);
for (let m = 16; m < 64; m++) {
const v = Or[m - 15],
P = Or[m - 2],
C = $n(v, 7) ^ $n(v, 18) ^ (v >>> 3),
A = $n(P, 17) ^ $n(P, 19) ^ (P >>> 10);
Or[m] = (A + Or[m - 7] + C + Or[m - 16]) | 0;
}
let { A: r, B: o, C: s, D: c, E: f, F: d, G: h, H: y } = this;
for (let m = 0; m < 64; m++) {
const v = $n(f, 6) ^ $n(f, 11) ^ $n(f, 25),
P = (y + v + W2(f, d, h) + Z2[m] + Or[m]) | 0,
A = (($n(r, 2) ^ $n(r, 13) ^ $n(r, 22)) + G2(r, o, s)) | 0;
(y = h),
(h = d),
(d = f),
(f = (c + P) | 0),
(c = s),
(s = o),
(o = r),
(r = (P + A) | 0);
}
(r = (r + this.A) | 0),
(o = (o + this.B) | 0),
(s = (s + this.C) | 0),
(c = (c + this.D) | 0),
(f = (f + this.E) | 0),
(d = (d + this.F) | 0),
(h = (h + this.G) | 0),
(y = (y + this.H) | 0),
this.set(r, o, s, c, f, d, h, y);
}
roundClean() {
Or.fill(0);
}
destroy() {
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
}
}
let Y2 = class extends Dg {
constructor() {
super(),
(this.A = -1056596264),
(this.B = 914150663),
(this.C = 812702999),
(this.D = -150054599),
(this.E = -4191439),
(this.F = 1750603025),
(this.G = 1694076839),
(this.H = -1090891868),
(this.outputLen = 28);
}
};
const si = mg(() => new Dg());
mg(() => new Y2());
var Eo = Symbol("verified"),
J2 = (e) => e instanceof Object;
function X2(e) {
if (
!J2(e) ||
typeof e.kind != "number" ||
typeof e.content != "string" ||
typeof e.created_at != "number" ||
typeof e.pubkey != "string" ||
!e.pubkey.match(/^[a-f0-9]{64}$/) ||
!Array.isArray(e.tags)
)
return !1;
for (let t = 0; t < e.tags.length; t++) {
let n = e.tags[t];
if (!Array.isArray(n)) return !1;
for (let r = 0; r < n.length; r++)
if (typeof n[r] == "object") return !1;
}
return !0;
}
new TextDecoder("utf-8");
var Q2 = new TextEncoder();
function Wi(e) {
e.indexOf("://") === -1 && (e = "wss://" + e);
let t = new URL(e);
return (
(t.pathname = t.pathname.replace(/\/+/g, "/")),
t.pathname.endsWith("/") && (t.pathname = t.pathname.slice(0, -1)),
((t.port === "80" && t.protocol === "ws:") ||
(t.port === "443" && t.protocol === "wss:")) &&
(t.port = ""),
t.searchParams.sort(),
(t.hash = ""),
t.toString()
);
}
var e3 = class {
constructor(t) {
Be(this, "value");
Be(this, "next", null);
Be(this, "prev", null);
this.value = t;
}
},
t3 = class {
constructor() {
Be(this, "first");
Be(this, "last");
(this.first = null), (this.last = null);
}
enqueue(t) {
const n = new e3(t);
return (
this.last
? this.last === this.first
? ((this.last = n),
(this.last.prev = this.first),
(this.first.next = n))
: ((n.prev = this.last),
(this.last.next = n),
(this.last = n))
: ((this.first = n), (this.last = n)),
!0
);
}
dequeue() {
if (!this.first) return null;
if (this.first === this.last) {
const n = this.first;
return (this.first = null), (this.last = null), n.value;
}
const t = this.first;
return (this.first = t.next), t.value;
}
},
n3 = class {
generateSecretKey() {
return Cn.utils.randomPrivateKey();
}
getPublicKey(t) {
return wt(Cn.getPublicKey(t));
}
finalizeEvent(t, n) {
const r = t;
return (
(r.pubkey = wt(Cn.getPublicKey(n))),
(r.id = Pu(r)),
(r.sig = wt(Cn.sign(Pu(r), n))),
(r[Eo] = !0),
r
);
}
verifyEvent(t) {
if (typeof t[Eo] == "boolean") return t[Eo];
const n = Pu(t);
if (n !== t.id) return (t[Eo] = !1), !1;
try {
const r = Cn.verify(t.sig, n, t.pubkey);
return (t[Eo] = r), r;
} catch {
return (t[Eo] = !1), !1;
}
}
};
function r3(e) {
if (!X2(e))
throw new Error(
"can't serialize event with wrong or missing properties"
);
return JSON.stringify([
0,
e.pubkey,
e.created_at,
e.kind,
e.tags,
e.content,
]);
}
function Pu(e) {
let t = si(Q2.encode(r3(e)));
return wt(t);
}
var Ya = new n3();
Ya.generateSecretKey;
Ya.getPublicKey;
Ya.finalizeEvent;
var o3 = Ya.verifyEvent,
i3 = 22242;
function s3(e, t) {
if (
(e.ids &&
e.ids.indexOf(t.id) === -1 &&
!e.ids.some((n) => t.id.startsWith(n))) ||
(e.kinds && e.kinds.indexOf(t.kind) === -1) ||
(e.authors &&
e.authors.indexOf(t.pubkey) === -1 &&
!e.authors.some((n) => t.pubkey.startsWith(n)))
)
return !1;
for (let n in e)
if (n[0] === "#") {
let r = n.slice(1),
o = e[`#${r}`];
if (
o &&
!t.tags.find(([s, c]) => s === n.slice(1) && o.indexOf(c) !== -1)
)
return !1;
}
return !(
(e.since && t.created_at < e.since) ||
(e.until && t.created_at > e.until)
);
}
function a3(e, t) {
for (let n = 0; n < e.length; n++) if (s3(e[n], t)) return !0;
return !1;
}
function c3(e, t) {
let n = t.length + 3,
r = e.indexOf(`"${t}":`) + n,
o = e.slice(r).indexOf('"') + r + 1;
return e.slice(o, o + 64);
}
function u3(e) {
let t = e.slice(0, 22).indexOf('"EVENT"');
if (t === -1) return null;
let n = e.slice(t + 7 + 1).indexOf('"');
if (n === -1) return null;
let r = t + 7 + 1 + n,
o = e.slice(r + 1, 80).indexOf('"');
if (o === -1) return null;
let s = r + 1 + o;
return e.slice(r + 1, s);
}
function l3(e, t) {
return {
kind: i3,
created_at: Math.floor(Date.now() / 1e3),
tags: [
["relay", e],
["challenge", t],
],
content: "",
};
}
async function d3() {
return new Promise((e) => {
const t = new MessageChannel(),
n = () => {
t.port1.removeEventListener("message", n), e();
};
t.port1.addEventListener("message", n),
t.port2.postMessage(0),
t.port1.start();
});
}
var f3 = (e) => ((e[Eo] = !0), !0),
qg;
try {
qg = WebSocket;
} catch {}
var Vg = class {
constructor(e, t) {
Be(this, "url");
Be(this, "_connected", !1);
Be(this, "onclose", null);
Be(this, "onnotice", (e) =>
console.debug(`NOTICE from ${this.url}: ${e}`)
);
Be(this, "_onauth", null);
Be(this, "baseEoseTimeout", 4400);
Be(this, "connectionTimeout", 4400);
Be(this, "openSubs", new Map());
Be(this, "connectionTimeoutHandle");
Be(this, "connectionPromise");
Be(this, "openCountRequests", new Map());
Be(this, "openEventPublishes", new Map());
Be(this, "ws");
Be(this, "incomingMessageQueue", new t3());
Be(this, "queueRunning", !1);
Be(this, "challenge");
Be(this, "serial", 0);
Be(this, "verifyEvent");
(this.url = Wi(e)), (this.verifyEvent = t.verifyEvent);
}
static async connect(e, t) {
const n = new Vg(e, t);
return await n.connect(), n;
}
closeAllSubscriptions(e) {
for (let [t, n] of this.openSubs) n.close(e);
this.openSubs.clear();
for (let [t, n] of this.openEventPublishes) n.reject(new Error(e));
this.openEventPublishes.clear();
for (let [t, n] of this.openCountRequests) n.reject(new Error(e));
this.openCountRequests.clear();
}
get connected() {
return this._connected;
}
async connect() {
return this.connectionPromise
? this.connectionPromise
: ((this.challenge = void 0),
(this.connectionPromise = new Promise((e, t) => {
this.connectionTimeoutHandle = setTimeout(() => {
var n;
t("connection timed out"),
(this.connectionPromise = void 0),
(n = this.onclose) == null || n.call(this),
this.closeAllSubscriptions("relay connection timed out");
}, this.connectionTimeout);
try {
this.ws = new qg(this.url);
} catch (n) {
t(n);
return;
}
(this.ws.onopen = () => {
clearTimeout(this.connectionTimeoutHandle),
(this._connected = !0),
e();
}),
(this.ws.onerror = (n) => {
var r;
t(n.message),
this._connected &&
((this._connected = !1),
(this.connectionPromise = void 0),
(r = this.onclose) == null || r.call(this),
this.closeAllSubscriptions(
"relay connection errored"
));
}),
(this.ws.onclose = async () => {
var n;
this._connected &&
((this._connected = !1),
(this.connectionPromise = void 0),
(n = this.onclose) == null || n.call(this),
this.closeAllSubscriptions("relay connection closed"));
}),
(this.ws.onmessage = this._onmessage.bind(this));
})),
this.connectionPromise);
}
async runQueue() {
for (this.queueRunning = !0; this.handleNext() !== !1; ) await d3();
this.queueRunning = !1;
}
handleNext() {
var n, r, o;
const e = this.incomingMessageQueue.dequeue();
if (!e) return !1;
const t = u3(e);
if (t) {
const s = this.openSubs.get(t);
if (!s) return;
const c = c3(e, "id"),
f = (n = s.alreadyHaveEvent) == null ? void 0 : n.call(s, c);
if (((r = s.receivedEvent) == null || r.call(s, this, c), f))
return;
}
try {
let s = JSON.parse(e);
switch (s[0]) {
case "EVENT": {
const c = this.openSubs.get(s[1]),
f = s[2];
this.verifyEvent(f) && a3(c.filters, f) && c.onevent(f);
return;
}
case "COUNT": {
const c = s[1],
f = s[2],
d = this.openCountRequests.get(c);
d && (d.resolve(f.count), this.openCountRequests.delete(c));
return;
}
case "EOSE": {
const c = this.openSubs.get(s[1]);
if (!c) return;
c.receivedEose();
return;
}
case "OK": {
const c = s[1],
f = s[2],
d = s[3],
h = this.openEventPublishes.get(c);
f ? h.resolve(d) : h.reject(new Error(d)),
this.openEventPublishes.delete(c);
return;
}
case "CLOSED": {
const c = s[1],
f = this.openSubs.get(c);
if (!f) return;
(f.closed = !0), f.close(s[2]);
return;
}
case "NOTICE":
this.onnotice(s[1]);
return;
case "AUTH": {
(this.challenge = s[1]),
(o = this._onauth) == null || o.call(this, s[1]);
return;
}
}
} catch {
return;
}
}
async send(e) {
if (!this.connectionPromise)
throw new Error("sending on closed connection");
this.connectionPromise.then(() => {
var t;
(t = this.ws) == null || t.send(e);
});
}
async auth(e) {
if (!this.challenge)
throw new Error("can't perform auth, no challenge was received");
const t = await e(l3(this.url, this.challenge)),
n = new Promise((r, o) => {
this.openEventPublishes.set(t.id, { resolve: r, reject: o });
});
return this.send('["AUTH",' + JSON.stringify(t) + "]"), n;
}
async publish(e) {
const t = new Promise((n, r) => {
this.openEventPublishes.set(e.id, { resolve: n, reject: r });
});
return this.send('["EVENT",' + JSON.stringify(e) + "]"), t;
}
async count(e, t) {
this.serial++;
const n = (t == null ? void 0 : t.id) || "count:" + this.serial,
r = new Promise((o, s) => {
this.openCountRequests.set(n, { resolve: o, reject: s });
});
return (
this.send(
'["COUNT","' + n + '",' + JSON.stringify(e).substring(1)
),
r
);
}
subscribe(e, t) {
const n = this.prepareSubscription(e, t);
return n.fire(), n;
}
prepareSubscription(e, t) {
this.serial++;
const n = t.id || "sub:" + this.serial,
r = new h3(this, n, e, t);
return this.openSubs.set(n, r), r;
}
close() {
var e;
this.closeAllSubscriptions("relay connection closed by us"),
(this._connected = !1),
(e = this.ws) == null || e.close();
}
_onmessage(e) {
this.incomingMessageQueue.enqueue(e.data),
this.queueRunning || this.runQueue();
}
},
h3 = class {
constructor(e, t, n, r) {
Be(this, "relay");
Be(this, "id");
Be(this, "closed", !1);
Be(this, "eosed", !1);
Be(this, "filters");
Be(this, "alreadyHaveEvent");
Be(this, "receivedEvent");
Be(this, "onevent");
Be(this, "oneose");
Be(this, "onclose");
Be(this, "eoseTimeout");
Be(this, "eoseTimeoutHandle");
(this.relay = e),
(this.filters = n),
(this.id = t),
(this.alreadyHaveEvent = r.alreadyHaveEvent),
(this.receivedEvent = r.receivedEvent),
(this.eoseTimeout = r.eoseTimeout || e.baseEoseTimeout),
(this.oneose = r.oneose),
(this.onclose = r.onclose),
(this.onevent =
r.onevent ||
((o) => {
console.warn(
`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,
o
);
}));
}
fire() {
this.relay.send(
'["REQ","' +
this.id +
'",' +
JSON.stringify(this.filters).substring(1)
),
(this.eoseTimeoutHandle = setTimeout(
this.receivedEose.bind(this),
this.eoseTimeout
));
}
receivedEose() {
var e;
this.eosed ||
(clearTimeout(this.eoseTimeoutHandle),
(this.eosed = !0),
(e = this.oneose) == null || e.call(this));
}
close(e = "closed by caller") {
var t;
!this.closed &&
this.relay.connected &&
(this.relay.send('["CLOSE",' + JSON.stringify(this.id) + "]"),
(this.closed = !0)),
this.relay.openSubs.delete(this.id),
(t = this.onclose) == null || t.call(this, e);
}
},
p3 = class {
constructor(t) {
Be(this, "relays", new Map());
Be(this, "seenOn", new Map());
Be(this, "trackRelays", !1);
Be(this, "verifyEvent");
Be(this, "trustedRelayURLs", new Set());
this.verifyEvent = t.verifyEvent;
}
async ensureRelay(t, n) {
t = Wi(t);
let r = this.relays.get(t);
return (
r ||
((r = new Vg(t, {
verifyEvent: this.trustedRelayURLs.has(t)
? f3
: this.verifyEvent,
})),
n != null &&
n.connectionTimeout &&
(r.connectionTimeout = n.connectionTimeout),
this.relays.set(t, r)),
await r.connect(),
r
);
}
close(t) {
t.map(Wi).forEach((n) => {
var r;
(r = this.relays.get(n)) == null || r.close();
});
}
subscribeMany(t, n, r) {
return this.subscribeManyMap(
Object.fromEntries(t.map((o) => [o, n])),
r
);
}
subscribeManyMap(t, n) {
this.trackRelays &&
(n.receivedEvent = (v, P) => {
let C = this.seenOn.get(P);
C || ((C = new Set()), this.seenOn.set(P, C)), C.add(v);
});
const r = new Set(),
o = [],
s = Object.keys(t).length,
c = [];
let f = (v) => {
var P;
(c[v] = !0),
c.filter((C) => C).length === s &&
((P = n.oneose) == null || P.call(n), (f = () => {}));
};
const d = [];
let h = (v, P) => {
var C;
f(v),
(d[v] = P),
d.filter((A) => A).length === s &&
((C = n.onclose) == null || C.call(n, d), (h = () => {}));
};
const y = (v) => {
var C;
if ((C = n.alreadyHaveEvent) != null && C.call(n, v)) return !0;
const P = r.has(v);
return r.add(v), P;
},
m = Promise.all(
Object.entries(t).map(async (v, P, C) => {
if (C.indexOf(v) !== P) {
h(P, "duplicate url");
return;
}
let [A, O] = v;
A = Wi(A);
let M;
try {
M = await this.ensureRelay(A, {
connectionTimeout: n.maxWait
? Math.max(n.maxWait * 0.8, n.maxWait - 1e3)
: void 0,
});
} catch (N) {
h(P, (N == null ? void 0 : N.message) || String(N));
return;
}
let T = M.subscribe(O, {
...n,
oneose: () => f(P),
onclose: (N) => h(P, N),
alreadyHaveEvent: y,
eoseTimeout: n.maxWait,
});
o.push(T);
})
);
return {
async close() {
await m,
o.forEach((v) => {
v.close();
});
},
};
}
subscribeManyEose(t, n, r) {
const o = this.subscribeMany(t, n, {
...r,
oneose() {
o.close();
},
});
return o;
}
async querySync(t, n, r) {
return new Promise(async (o) => {
const s = [];
this.subscribeManyEose(t, [n], {
...r,
onevent(c) {
s.push(c);
},
onclose(c) {
o(s);
},
});
});
}
async get(t, n, r) {
n.limit = 1;
const o = await this.querySync(t, n, r);
return o.sort((s, c) => c.created_at - s.created_at), o[0] || null;
}
publish(t, n) {
return t
.map(Wi)
.map(async (r, o, s) =>
s.indexOf(r) !== o
? Promise.reject("duplicate url")
: (await this.ensureRelay(r)).publish(n)
);
}
},
g3 = class extends p3 {
constructor() {
super({ verifyEvent: o3 });
}
};
const pa = new g3();
function Lu(e) {
if (!Number.isSafeInteger(e) || e < 0)
throw new Error(`positive integer expected, not ${e}`);
}
function Wh(e) {
if (typeof e != "boolean")
throw new Error(`boolean expected, not ${e}`);
}
function w3(e) {
return (
e instanceof Uint8Array ||
(e != null &&
typeof e == "object" &&
e.constructor.name === "Uint8Array")
);
}
function nr(e, ...t) {
if (!w3(e)) throw new Error("Uint8Array expected");
if (t.length > 0 && !t.includes(e.length))
throw new Error(
`Uint8Array expected of length ${t}, not of length=${e.length}`
);
}
/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */ const Lt =
(e) =>
new Uint32Array(
e.buffer,
e.byteOffset,
Math.floor(e.byteLength / 4)
),
m3 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
if (!m3) throw new Error("Non little-endian hardware is not supported");
function b3(e, t) {
if (t == null || typeof t != "object")
throw new Error("options must be defined");
return Object.assign(e, t);
}
function y3(e, t) {
if (e.length !== t.length) return !1;
let n = 0;
for (let r = 0; r < e.length; r++) n |= e[r] ^ t[r];
return n === 0;
}
const v3 = (e, t) => (Object.assign(t, e), t),
Vr = 16,
_3 = 283;
function sd(e) {
return (e << 1) ^ (_3 & -(e >> 7));
}
function ri(e, t) {
let n = 0;
for (; t > 0; t >>= 1) (n ^= e & -(t & 1)), (e = sd(e));
return n;
}
const pl = (() => {
let e = new Uint8Array(256);
for (let n = 0, r = 1; n < 256; n++, r ^= sd(r)) e[n] = r;
const t = new Uint8Array(256);
t[0] = 99;
for (let n = 0; n < 255; n++) {
let r = e[255 - n];
(r |= r << 8),
(t[e[n]] =
(r ^ (r >> 4) ^ (r >> 5) ^ (r >> 6) ^ (r >> 7) ^ 99) & 255);
}
return t;
})(),
E3 = pl.map((e, t) => pl.indexOf(t)),
k3 = (e) => (e << 24) | (e >>> 8),
Bu = (e) => (e << 8) | (e >>> 24);
function Fg(e, t) {
if (e.length !== 256) throw new Error("Wrong sbox length");
const n = new Uint32Array(256).map((h, y) => t(e[y])),
r = n.map(Bu),
o = r.map(Bu),
s = o.map(Bu),
c = new Uint32Array(256 * 256),
f = new Uint32Array(256 * 256),
d = new Uint16Array(256 * 256);
for (let h = 0; h < 256; h++)
for (let y = 0; y < 256; y++) {
const m = h * 256 + y;
(c[m] = n[h] ^ r[y]),
(f[m] = o[h] ^ s[y]),
(d[m] = (e[h] << 8) | e[y]);
}
return {
sbox: e,
sbox2: d,
T0: n,
T1: r,
T2: o,
T3: s,
T01: c,
T23: f,
};
}
const ad = Fg(
pl,
(e) => (ri(e, 3) << 24) | (e << 16) | (e << 8) | ri(e, 2)
),
Kg = Fg(
E3,
(e) =>
(ri(e, 11) << 24) | (ri(e, 13) << 16) | (ri(e, 9) << 8) | ri(e, 14)
),
A3 = (() => {
const e = new Uint8Array(16);
for (let t = 0, n = 1; t < 16; t++, n = sd(n)) e[t] = n;
return e;
})();
function Wg(e) {
nr(e);
const t = e.length;
if (![16, 24, 32].includes(t))
throw new Error(
`aes: wrong key size: should be 16, 24 or 32, got: ${t}`
);
const { sbox2: n } = ad,
r = Lt(e),
o = r.length,
s = (f) => On(n, f, f, f, f),
c = new Uint32Array(t + 28);
c.set(r);
for (let f = o; f < c.length; f++) {
let d = c[f - 1];
f % o === 0
? (d = s(k3(d)) ^ A3[f / o - 1])
: o > 6 && f % o === 4 && (d = s(d)),
(c[f] = c[f - o] ^ d);
}
return c;
}
function S3(e) {
const t = Wg(e),
n = t.slice(),
r = t.length,
{ sbox2: o } = ad,
{ T0: s, T1: c, T2: f, T3: d } = Kg;
for (let h = 0; h < r; h += 4)
for (let y = 0; y < 4; y++) n[h + y] = t[r - h - 4 + y];
t.fill(0);
for (let h = 4; h < r - 4; h++) {
const y = n[h],
m = On(o, y, y, y, y);
n[h] =
s[m & 255] ^ c[(m >>> 8) & 255] ^ f[(m >>> 16) & 255] ^ d[m >>> 24];
}
return n;
}
function Dr(e, t, n, r, o, s) {
return (
e[((n << 8) & 65280) | ((r >>> 8) & 255)] ^
t[((o >>> 8) & 65280) | ((s >>> 24) & 255)]
);
}
function On(e, t, n, r, o) {
return (
e[(t & 255) | (n & 65280)] |
(e[((r >>> 16) & 255) | ((o >>> 16) & 65280)] << 16)
);
}
function Gh(e, t, n, r, o) {
const { sbox2: s, T01: c, T23: f } = ad;
let d = 0;
(t ^= e[d++]), (n ^= e[d++]), (r ^= e[d++]), (o ^= e[d++]);
const h = e.length / 4 - 2;
for (let C = 0; C < h; C++) {
const A = e[d++] ^ Dr(c, f, t, n, r, o),
O = e[d++] ^ Dr(c, f, n, r, o, t),
M = e[d++] ^ Dr(c, f, r, o, t, n),
T = e[d++] ^ Dr(c, f, o, t, n, r);
(t = A), (n = O), (r = M), (o = T);
}
const y = e[d++] ^ On(s, t, n, r, o),
m = e[d++] ^ On(s, n, r, o, t),
v = e[d++] ^ On(s, r, o, t, n),
P = e[d++] ^ On(s, o, t, n, r);
return { s0: y, s1: m, s2: v, s3: P };
}
function $3(e, t, n, r, o) {
const { sbox2: s, T01: c, T23: f } = Kg;
let d = 0;
(t ^= e[d++]), (n ^= e[d++]), (r ^= e[d++]), (o ^= e[d++]);
const h = e.length / 4 - 2;
for (let C = 0; C < h; C++) {
const A = e[d++] ^ Dr(c, f, t, o, r, n),
O = e[d++] ^ Dr(c, f, n, t, o, r),
M = e[d++] ^ Dr(c, f, r, n, t, o),
T = e[d++] ^ Dr(c, f, o, r, n, t);
(t = A), (n = O), (r = M), (o = T);
}
const y = e[d++] ^ On(s, t, o, r, n),
m = e[d++] ^ On(s, n, t, o, r),
v = e[d++] ^ On(s, r, n, t, o),
P = e[d++] ^ On(s, o, r, n, t);
return { s0: y, s1: m, s2: v, s3: P };
}
function Gg(e, t) {
if (!t) return new Uint8Array(e);
if ((nr(t), t.length < e))
throw new Error(
`aes: wrong destination length, expected at least ${e}, got: ${t.length}`
);
return t;
}
function x3(e) {
if ((nr(e), e.length % Vr !== 0))
throw new Error(
`aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size ${Vr}`
);
}
function T3(e, t, n) {
let r = e.length;
const o = r % Vr;
if (!t && o !== 0)
throw new Error(
"aec/(cbc-ecb): unpadded plaintext with disabled padding"
);
const s = Lt(e);
if (t) {
let d = Vr - o;
d || (d = Vr), (r = r + d);
}
const c = Gg(r, n),
f = Lt(c);
return { b: s, o: f, out: c };
}
function P3(e, t) {
if (!t) return e;
const n = e.length;
if (!n) throw new Error("aes/pcks5: empty ciphertext not allowed");
const r = e[n - 1];
if (r <= 0 || r > 16)
throw new Error(`aes/pcks5: wrong padding byte: ${r}`);
const o = e.subarray(0, -r);
for (let s = 0; s < r; s++)
if (e[n - s - 1] !== r) throw new Error("aes/pcks5: wrong padding");
return o;
}
function L3(e) {
const t = new Uint8Array(16),
n = Lt(t);
t.set(e);
const r = Vr - e.length;
for (let o = Vr - r; o < Vr; o++) t[o] = r;
return n;
}
const Zg = v3(
{ blockSize: 16, nonceLength: 16 },
function (t, n, r = {}) {
nr(t), nr(n, 16);
const o = !r.disablePadding;
return {
encrypt: (s, c) => {
const f = Wg(t),
{ b: d, o: h, out: y } = T3(s, o, c),
m = Lt(n);
let v = m[0],
P = m[1],
C = m[2],
A = m[3],
O = 0;
for (; O + 4 <= d.length; )
(v ^= d[O + 0]),
(P ^= d[O + 1]),
(C ^= d[O + 2]),
(A ^= d[O + 3]),
({ s0: v, s1: P, s2: C, s3: A } = Gh(f, v, P, C, A)),
(h[O++] = v),
(h[O++] = P),
(h[O++] = C),
(h[O++] = A);
if (o) {
const M = L3(s.subarray(O * 4));
(v ^= M[0]),
(P ^= M[1]),
(C ^= M[2]),
(A ^= M[3]),
({ s0: v, s1: P, s2: C, s3: A } = Gh(f, v, P, C, A)),
(h[O++] = v),
(h[O++] = P),
(h[O++] = C),
(h[O++] = A);
}
return f.fill(0), y;
},
decrypt: (s, c) => {
x3(s);
const f = S3(t),
d = Lt(n),
h = Gg(s.length, c),
y = Lt(s),
m = Lt(h);
let v = d[0],
P = d[1],
C = d[2],
A = d[3];
for (let O = 0; O + 4 <= y.length; ) {
const M = v,
T = P,
N = C,
l = A;
(v = y[O + 0]),
(P = y[O + 1]),
(C = y[O + 2]),
(A = y[O + 3]);
const { s0: w, s1: p, s2: _, s3: $ } = $3(f, v, P, C, A);
(m[O++] = w ^ M),
(m[O++] = p ^ T),
(m[O++] = _ ^ N),
(m[O++] = $ ^ l);
}
return f.fill(0), P3(h, o);
},
};
}
),
Yg = (e) => Uint8Array.from(e.split("").map((t) => t.charCodeAt(0))),
B3 = Yg("expand 16-byte k"),
C3 = Yg("expand 32-byte k"),
I3 = Lt(B3),
Jg = Lt(C3);
Jg.slice();
function Fe(e, t) {
return (e << t) | (e >>> (32 - t));
}
function gl(e) {
return e.byteOffset % 4 === 0;
}
const Fs = 64,
O3 = 16,
Xg = 2 ** 32 - 1,
Zh = new Uint32Array();
function N3(e, t, n, r, o, s, c, f) {
const d = o.length,
h = new Uint8Array(Fs),
y = Lt(h),
m = gl(o) && gl(s),
v = m ? Lt(o) : Zh,
P = m ? Lt(s) : Zh;
for (let C = 0; C < d; c++) {
if ((e(t, n, r, y, c, f), c >= Xg))
throw new Error("arx: counter overflow");
const A = Math.min(Fs, d - C);
if (m && A === Fs) {
const O = C / 4;
if (C % 4 !== 0) throw new Error("arx: invalid block position");
for (let M = 0, T; M < O3; M++) (T = O + M), (P[T] = v[T] ^ y[M]);
C += Fs;
continue;
}
for (let O = 0, M; O < A; O++) (M = C + O), (s[M] = o[M] ^ h[O]);
C += A;
}
}
function R3(e, t) {
const {
allowShortKeys: n,
extendNonceFn: r,
counterLength: o,
counterRight: s,
rounds: c,
} = b3(
{
allowShortKeys: !1,
counterLength: 8,
counterRight: !1,
rounds: 20,
},
t
);
if (typeof e != "function") throw new Error("core must be a function");
return (
Lu(o),
Lu(c),
Wh(s),
Wh(n),
(f, d, h, y, m = 0) => {
nr(f), nr(d), nr(h);
const v = h.length;
if ((y || (y = new Uint8Array(v)), nr(y), Lu(m), m < 0 || m >= Xg))
throw new Error("arx: counter overflow");
if (y.length < v)
throw new Error(
`arx: output (${y.length}) is shorter than data (${v})`
);
const P = [];
let C = f.length,
A,
O;
if (C === 32) (A = f.slice()), P.push(A), (O = Jg);
else if (C === 16 && n)
(A = new Uint8Array(32)),
A.set(f),
A.set(f, 16),
(O = I3),
P.push(A);
else throw new Error(`arx: invalid 32-byte key, got length=${C}`);
gl(d) || ((d = d.slice()), P.push(d));
const M = Lt(A);
if (r) {
if (d.length !== 24)
throw new Error("arx: extended nonce must be 24 bytes");
r(O, M, Lt(d.subarray(0, 16)), M), (d = d.subarray(16));
}
const T = 16 - o;
if (T !== d.length)
throw new Error(`arx: nonce must be ${T} or 16 bytes`);
if (T !== 12) {
const l = new Uint8Array(12);
l.set(d, s ? 0 : 12 - d.length), (d = l), P.push(d);
}
const N = Lt(d);
for (N3(e, O, M, N, h, y, m, c); P.length > 0; ) P.pop().fill(0);
return y;
}
);
}
function z3(e, t, n, r, o, s = 20) {
let c = e[0],
f = e[1],
d = e[2],
h = e[3],
y = t[0],
m = t[1],
v = t[2],
P = t[3],
C = t[4],
A = t[5],
O = t[6],
M = t[7],
T = o,
N = n[0],
l = n[1],
w = n[2],
p = c,
_ = f,
$ = d,
R = h,
L = y,
E = m,
x = v,
z = P,
q = C,
I = A,
S = O,
D = M,
K = T,
W = N,
Z = l,
G = w;
for (let he = 0; he < s; he += 2)
(p = (p + L) | 0),
(K = Fe(K ^ p, 16)),
(q = (q + K) | 0),
(L = Fe(L ^ q, 12)),
(p = (p + L) | 0),
(K = Fe(K ^ p, 8)),
(q = (q + K) | 0),
(L = Fe(L ^ q, 7)),
(_ = (_ + E) | 0),
(W = Fe(W ^ _, 16)),
(I = (I + W) | 0),
(E = Fe(E ^ I, 12)),
(_ = (_ + E) | 0),
(W = Fe(W ^ _, 8)),
(I = (I + W) | 0),
(E = Fe(E ^ I, 7)),
($ = ($ + x) | 0),
(Z = Fe(Z ^ $, 16)),
(S = (S + Z) | 0),
(x = Fe(x ^ S, 12)),
($ = ($ + x) | 0),
(Z = Fe(Z ^ $, 8)),
(S = (S + Z) | 0),
(x = Fe(x ^ S, 7)),
(R = (R + z) | 0),
(G = Fe(G ^ R, 16)),
(D = (D + G) | 0),
(z = Fe(z ^ D, 12)),
(R = (R + z) | 0),
(G = Fe(G ^ R, 8)),
(D = (D + G) | 0),
(z = Fe(z ^ D, 7)),
(p = (p + E) | 0),
(G = Fe(G ^ p, 16)),
(S = (S + G) | 0),
(E = Fe(E ^ S, 12)),
(p = (p + E) | 0),
(G = Fe(G ^ p, 8)),
(S = (S + G) | 0),
(E = Fe(E ^ S, 7)),
(_ = (_ + x) | 0),
(K = Fe(K ^ _, 16)),
(D = (D + K) | 0),
(x = Fe(x ^ D, 12)),
(_ = (_ + x) | 0),
(K = Fe(K ^ _, 8)),
(D = (D + K) | 0),
(x = Fe(x ^ D, 7)),
($ = ($ + z) | 0),
(W = Fe(W ^ $, 16)),
(q = (q + W) | 0),
(z = Fe(z ^ q, 12)),
($ = ($ + z) | 0),
(W = Fe(W ^ $, 8)),
(q = (q + W) | 0),
(z = Fe(z ^ q, 7)),
(R = (R + L) | 0),
(Z = Fe(Z ^ R, 16)),
(I = (I + Z) | 0),
(L = Fe(L ^ I, 12)),
(R = (R + L) | 0),
(Z = Fe(Z ^ R, 8)),
(I = (I + Z) | 0),
(L = Fe(L ^ I, 7));
let oe = 0;
(r[oe++] = (c + p) | 0),
(r[oe++] = (f + _) | 0),
(r[oe++] = (d + $) | 0),
(r[oe++] = (h + R) | 0),
(r[oe++] = (y + L) | 0),
(r[oe++] = (m + E) | 0),
(r[oe++] = (v + x) | 0),
(r[oe++] = (P + z) | 0),
(r[oe++] = (C + q) | 0),
(r[oe++] = (A + I) | 0),
(r[oe++] = (O + S) | 0),
(r[oe++] = (M + D) | 0),
(r[oe++] = (T + K) | 0),
(r[oe++] = (N + W) | 0),
(r[oe++] = (l + Z) | 0),
(r[oe++] = (w + G) | 0);
}
const Yh = R3(z3, {
counterRight: !1,
counterLength: 4,
allowShortKeys: !1,
});
let Qg = class extends wg {
constructor(t, n) {
super(), (this.finished = !1), (this.destroyed = !1), In.hash(t);
const r = rs(n);
if (
((this.iHash = t.create()), typeof this.iHash.update != "function")
)
throw new Error(
"Expected instance of class which extends utils.Hash"
);
(this.blockLen = this.iHash.blockLen),
(this.outputLen = this.iHash.outputLen);
const o = this.blockLen,
s = new Uint8Array(o);
s.set(r.length > o ? t.create().update(r).digest() : r);
for (let c = 0; c < s.length; c++) s[c] ^= 54;
this.iHash.update(s), (this.oHash = t.create());
for (let c = 0; c < s.length; c++) s[c] ^= 106;
this.oHash.update(s), s.fill(0);
}
update(t) {
return In.exists(this), this.iHash.update(t), this;
}
digestInto(t) {
In.exists(this),
In.bytes(t, this.outputLen),
(this.finished = !0),
this.iHash.digestInto(t),
this.oHash.update(t),
this.oHash.digestInto(t),
this.destroy();
}
digest() {
const t = new Uint8Array(this.oHash.outputLen);
return this.digestInto(t), t;
}
_cloneInto(t) {
t || (t = Object.create(Object.getPrototypeOf(this), {}));
const {
oHash: n,
iHash: r,
finished: o,
destroyed: s,
blockLen: c,
outputLen: f,
} = this;
return (
(t = t),
(t.finished = o),
(t.destroyed = s),
(t.blockLen = c),
(t.outputLen = f),
(t.oHash = n._cloneInto(t.oHash)),
(t.iHash = r._cloneInto(t.iHash)),
t
);
}
destroy() {
(this.destroyed = !0), this.oHash.destroy(), this.iHash.destroy();
}
};
const Ja = (e, t, n) => new Qg(e, t).update(n).digest();
Ja.create = (e, t) => new Qg(e, t);
function U3(e, t, n) {
return In.hash(e), Ja(e, rs(n), rs(t));
}
const Cu = new Uint8Array([0]),
Jh = new Uint8Array();
function M3(e, t, n, r = 32) {
if ((In.hash(e), In.number(r), r > 255 * e.outputLen))
throw new Error("Length should be <= 255*HashLen");
const o = Math.ceil(r / e.outputLen);
n === void 0 && (n = Jh);
const s = new Uint8Array(o * e.outputLen),
c = Ja.create(e, t),
f = c._cloneInto(),
d = new Uint8Array(c.outputLen);
for (let h = 0; h < o; h++)
(Cu[0] = h + 1),
f
.update(h === 0 ? Jh : d)
.update(n)
.update(Cu)
.digestInto(d),
s.set(d, e.outputLen * h),
c._cloneInto(f);
return c.destroy(), f.destroy(), d.fill(0), Cu.fill(0), s.slice(0, r);
}
var e0 = Object.defineProperty,
H3 = (e, t, n) =>
t in e
? e0(e, t, {
enumerable: !0,
configurable: !0,
writable: !0,
value: n,
})
: (e[t] = n),
st = (e, t) => {
for (var n in t) e0(e, n, { get: t[n], enumerable: !0 });
},
Xa = (e, t, n) => (H3(e, typeof t != "symbol" ? t + "" : t, n), n),
Zo = Symbol("verified"),
j3 = (e) => e instanceof Object;
function t0(e) {
if (
!j3(e) ||
typeof e.kind != "number" ||
typeof e.content != "string" ||
typeof e.created_at != "number" ||
typeof e.pubkey != "string" ||
!e.pubkey.match(/^[a-f0-9]{64}$/) ||
!Array.isArray(e.tags)
)
return !1;
for (let t = 0; t < e.tags.length; t++) {
let n = e.tags[t];
if (!Array.isArray(n)) return !1;
for (let r = 0; r < n.length; r++)
if (typeof n[r] == "object") return !1;
}
return !0;
}
var D3 = {};
st(D3, {
Queue: () => K3,
QueueNode: () => n0,
binarySearch: () => cd,
insertEventIntoAscendingList: () => F3,
insertEventIntoDescendingList: () => V3,
normalizeURL: () => q3,
utf8Decoder: () => er,
utf8Encoder: () => zn,
});
var er = new TextDecoder("utf-8"),
zn = new TextEncoder();
function q3(e) {
e.indexOf("://") === -1 && (e = "wss://" + e);
let t = new URL(e);
return (
(t.pathname = t.pathname.replace(/\/+/g, "/")),
t.pathname.endsWith("/") && (t.pathname = t.pathname.slice(0, -1)),
((t.port === "80" && t.protocol === "ws:") ||
(t.port === "443" && t.protocol === "wss:")) &&
(t.port = ""),
t.searchParams.sort(),
(t.hash = ""),
t.toString()
);
}
function V3(e, t) {
const [n, r] = cd(e, (o) =>
t.id === o.id
? 0
: t.created_at === o.created_at
? -1
: o.created_at - t.created_at
);
return r || e.splice(n, 0, t), e;
}
function F3(e, t) {
const [n, r] = cd(e, (o) =>
t.id === o.id
? 0
: t.created_at === o.created_at
? -1
: t.created_at - o.created_at
);
return r || e.splice(n, 0, t), e;
}
function cd(e, t) {
let n = 0,
r = e.length - 1;
for (; n <= r; ) {
const o = Math.floor((n + r) / 2),
s = t(e[o]);
if (s === 0) return [o, !0];
s < 0 ? (r = o - 1) : (n = o + 1);
}
return [n, !1];
}
var n0 = class {
constructor(e) {
Be(this, "value");
Be(this, "next", null);
Be(this, "prev", null);
this.value = e;
}
},
K3 = class {
constructor() {
Be(this, "first");
Be(this, "last");
(this.first = null), (this.last = null);
}
enqueue(e) {
const t = new n0(e);
return (
this.last
? this.last === this.first
? ((this.last = t),
(this.last.prev = this.first),
(this.first.next = t))
: ((t.prev = this.last),
(this.last.next = t),
(this.last = t))
: ((this.first = t), (this.last = t)),
!0
);
}
dequeue() {
if (!this.first) return null;
if (this.first === this.last) {
const t = this.first;
return (this.first = null), (this.last = null), t.value;
}
const e = this.first;
return (this.first = e.next), e.value;
}
},
W3 = class {
generateSecretKey() {
return Cn.utils.randomPrivateKey();
}
getPublicKey(e) {
return wt(Cn.getPublicKey(e));
}
finalizeEvent(e, t) {
const n = e;
return (
(n.pubkey = wt(Cn.getPublicKey(t))),
(n.id = Qs(n)),
(n.sig = wt(Cn.sign(Qs(n), t))),
(n[Zo] = !0),
n
);
}
verifyEvent(e) {
if (typeof e[Zo] == "boolean") return e[Zo];
const t = Qs(e);
if (t !== e.id) return (e[Zo] = !1), !1;
try {
const n = Cn.verify(e.sig, t, e.pubkey);
return (e[Zo] = n), n;
} catch {
return (e[Zo] = !1), !1;
}
}
};
function G3(e) {
if (!t0(e))
throw new Error(
"can't serialize event with wrong or missing properties"
);
return JSON.stringify([
0,
e.pubkey,
e.created_at,
e.kind,
e.tags,
e.content,
]);
}
function Qs(e) {
let t = si(zn.encode(G3(e)));
return wt(t);
}
var Qa = new W3();
Qa.generateSecretKey;
Qa.getPublicKey;
var so = Qa.finalizeEvent,
ud = Qa.verifyEvent,
Z3 = {};
st(Z3, {
Application: () => Z8,
BadgeAward: () => o8,
BadgeDefinition: () => D8,
BlockedRelaysList: () => x8,
BookmarkList: () => A8,
Bookmarksets: () => M8,
Calendar: () => n_,
CalendarEventRSVP: () => r_,
ChannelCreation: () => a0,
ChannelHideMessage: () => l0,
ChannelMessage: () => u0,
ChannelMetadata: () => c0,
ChannelMuteUser: () => d0,
ClassifiedListing: () => X8,
ClientAuth: () => f0,
CommunitiesList: () => S8,
CommunityDefinition: () => s_,
CommunityPostApproval: () => h8,
Contacts: () => e8,
CreateOrUpdateProduct: () => F8,
CreateOrUpdateStall: () => V8,
Curationsets: () => H8,
Date: () => e_,
DraftClassifiedListing: () => Q8,
DraftLong: () => W8,
Emojisets: () => G8,
EncryptedDirectMessage: () => t8,
EncryptedDirectMessages: () => n8,
EventDeletion: () => r8,
FileMetadata: () => a8,
FileServerPreference: () => B8,
Followsets: () => R8,
GenericRepost: () => i8,
Genericlists: () => z8,
HTTPAuth: () => fd,
Handlerinformation: () => i_,
Handlerrecommendation: () => o_,
Highlights: () => v8,
InterestsList: () => P8,
Interestsets: () => q8,
JobFeedback: () => w8,
JobRequest: () => p8,
JobResult: () => g8,
Label: () => f8,
LightningPubRPC: () => I8,
LiveChatMessage: () => c8,
LiveEvent: () => Y8,
LongFormArticle: () => K8,
Metadata: () => J3,
Mutelist: () => _8,
NWCWalletInfo: () => C8,
NWCWalletRequest: () => h0,
NWCWalletResponse: () => O8,
NostrConnect: () => N8,
OpenTimestamps: () => s8,
Pinlist: () => E8,
ProblemTracker: () => u8,
ProfileBadges: () => j8,
PublicChatsList: () => $8,
Reaction: () => dd,
RecommendRelay: () => Q3,
RelayList: () => k8,
Relaysets: () => U8,
Report: () => l8,
Reporting: () => d8,
Repost: () => ld,
SearchRelaysList: () => T8,
ShortTextNote: () => X3,
Time: () => t_,
UserEmojiList: () => L8,
UserStatuses: () => J8,
Zap: () => y8,
ZapGoal: () => m8,
ZapRequest: () => b8,
classifyKind: () => Y3,
isEphemeralKind: () => i0,
isParameterizedReplaceableKind: () => s0,
isRegularKind: () => r0,
isReplaceableKind: () => o0,
});
function r0(e) {
return (
(1e3 <= e && e < 1e4) ||
[1, 2, 4, 5, 6, 7, 8, 16, 40, 41, 42, 43, 44].includes(e)
);
}
function o0(e) {
return [0, 3].includes(e) || (1e4 <= e && e < 2e4);
}
function i0(e) {
return 2e4 <= e && e < 3e4;
}
function s0(e) {
return 3e4 <= e && e < 4e4;
}
function Y3(e) {
return r0(e)
? "regular"
: o0(e)
? "replaceable"
: i0(e)
? "ephemeral"
: s0(e)
? "parameterized"
: "unknown";
}
var J3 = 0,
X3 = 1,
Q3 = 2,
e8 = 3,
t8 = 4,
n8 = 4,
r8 = 5,
ld = 6,
dd = 7,
o8 = 8,
i8 = 16,
a0 = 40,
c0 = 41,
u0 = 42,
l0 = 43,
d0 = 44,
s8 = 1040,
a8 = 1063,
c8 = 1311,
u8 = 1971,
l8 = 1984,
d8 = 1984,
f8 = 1985,
h8 = 4550,
p8 = 5999,
g8 = 6999,
w8 = 7e3,
m8 = 9041,
b8 = 9734,
y8 = 9735,
v8 = 9802,
_8 = 1e4,
E8 = 10001,
k8 = 10002,
A8 = 10003,
S8 = 10004,
$8 = 10005,
x8 = 10006,
T8 = 10007,
P8 = 10015,
L8 = 10030,
B8 = 10096,
C8 = 13194,
I8 = 21e3,
f0 = 22242,
h0 = 23194,
O8 = 23195,
N8 = 24133,
fd = 27235,
R8 = 3e4,
z8 = 30001,
U8 = 30002,
M8 = 30003,
H8 = 30004,
j8 = 30008,
D8 = 30009,
q8 = 30015,
V8 = 30017,
F8 = 30018,
K8 = 30023,
W8 = 30024,
G8 = 30030,
Z8 = 30078,
Y8 = 30311,
J8 = 30315,
X8 = 30402,
Q8 = 30403,
e_ = 31922,
t_ = 31923,
n_ = 31924,
r_ = 31925,
o_ = 31989,
i_ = 31990,
s_ = 34550,
a_ = {};
st(a_, {
getHex64: () => hd,
getInt: () => p0,
getSubscriptionId: () => c_,
matchEventId: () => u_,
matchEventKind: () => d_,
matchEventPubkey: () => l_,
});
function hd(e, t) {
let n = t.length + 3,
r = e.indexOf(`"${t}":`) + n,
o = e.slice(r).indexOf('"') + r + 1;
return e.slice(o, o + 64);
}
function p0(e, t) {
let n = t.length,
r = e.indexOf(`"${t}":`) + n + 3,
o = e.slice(r),
s = Math.min(o.indexOf(","), o.indexOf("}"));
return parseInt(o.slice(0, s), 10);
}
function c_(e) {
let t = e.slice(0, 22).indexOf('"EVENT"');
if (t === -1) return null;
let n = e.slice(t + 7 + 1).indexOf('"');
if (n === -1) return null;
let r = t + 7 + 1 + n,
o = e.slice(r + 1, 80).indexOf('"');
if (o === -1) return null;
let s = r + 1 + o;
return e.slice(r + 1, s);
}
function u_(e, t) {
return t === hd(e, "id");
}
function l_(e, t) {
return t === hd(e, "pubkey");
}
function d_(e, t) {
return t === p0(e, "kind");
}
var f_ = {};
st(f_, { makeAuthEvent: () => h_ });
function h_(e, t) {
return {
kind: f0,
created_at: Math.floor(Date.now() / 1e3),
tags: [
["relay", e],
["challenge", t],
],
content: "",
};
}
var p_;
try {
p_ = WebSocket;
} catch {}
var g0 = {};
st(g0, {
BECH32_REGEX: () => w0,
Bech32MaxSize: () => pd,
decode: () => ec,
encodeBytes: () => tc,
naddrEncode: () => __,
neventEncode: () => v_,
noteEncode: () => b_,
nprofileEncode: () => y_,
npubEncode: () => m_,
nrelayEncode: () => E_,
nsecEncode: () => w_,
});
var pd = 5e3,
w0 = /[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;
function g_(e) {
const t = new Uint8Array(4);
return (
(t[0] = (e >> 24) & 255),
(t[1] = (e >> 16) & 255),
(t[2] = (e >> 8) & 255),
(t[3] = e & 255),
t
);
}
function ec(e) {
var o, s, c, f, d, h, y, m;
let { prefix: t, words: n } = Gr.decode(e, pd),
r = new Uint8Array(Gr.fromWords(n));
switch (t) {
case "nprofile": {
let v = Ks(r);
if (!((o = v[0]) != null && o[0]))
throw new Error("missing TLV 0 for nprofile");
if (v[0][0].length !== 32)
throw new Error("TLV 0 should be 32 bytes");
return {
type: "nprofile",
data: {
pubkey: wt(v[0][0]),
relays: v[1] ? v[1].map((P) => er.decode(P)) : [],
},
};
}
case "nevent": {
let v = Ks(r);
if (!((s = v[0]) != null && s[0]))
throw new Error("missing TLV 0 for nevent");
if (v[0][0].length !== 32)
throw new Error("TLV 0 should be 32 bytes");
if (v[2] && v[2][0].length !== 32)
throw new Error("TLV 2 should be 32 bytes");
if (v[3] && v[3][0].length !== 4)
throw new Error("TLV 3 should be 4 bytes");
return {
type: "nevent",
data: {
id: wt(v[0][0]),
relays: v[1] ? v[1].map((P) => er.decode(P)) : [],
author: (c = v[2]) != null && c[0] ? wt(v[2][0]) : void 0,
kind:
(f = v[3]) != null && f[0]
? parseInt(wt(v[3][0]), 16)
: void 0,
},
};
}
case "naddr": {
let v = Ks(r);
if (!((d = v[0]) != null && d[0]))
throw new Error("missing TLV 0 for naddr");
if (!((h = v[2]) != null && h[0]))
throw new Error("missing TLV 2 for naddr");
if (v[2][0].length !== 32)
throw new Error("TLV 2 should be 32 bytes");
if (!((y = v[3]) != null && y[0]))
throw new Error("missing TLV 3 for naddr");
if (v[3][0].length !== 4)
throw new Error("TLV 3 should be 4 bytes");
return {
type: "naddr",
data: {
identifier: er.decode(v[0][0]),
pubkey: wt(v[2][0]),
kind: parseInt(wt(v[3][0]), 16),
relays: v[1] ? v[1].map((P) => er.decode(P)) : [],
},
};
}
case "nrelay": {
let v = Ks(r);
if (!((m = v[0]) != null && m[0]))
throw new Error("missing TLV 0 for nrelay");
return { type: "nrelay", data: er.decode(v[0][0]) };
}
case "nsec":
return { type: t, data: r };
case "npub":
case "note":
return { type: t, data: wt(r) };
default:
throw new Error(`unknown prefix ${t}`);
}
}
function Ks(e) {
let t = {},
n = e;
for (; n.length > 0; ) {
let r = n[0],
o = n[1],
s = n.slice(2, 2 + o);
if (((n = n.slice(2 + o)), s.length < o))
throw new Error(`not enough data to read on TLV ${r}`);
(t[r] = t[r] || []), t[r].push(s);
}
return t;
}
function w_(e) {
return tc("nsec", e);
}
function m_(e) {
return tc("npub", Bo(e));
}
function b_(e) {
return tc("note", Bo(e));
}
function ms(e, t) {
let n = Gr.toWords(t);
return Gr.encode(e, n, pd);
}
function tc(e, t) {
return ms(e, t);
}
function y_(e) {
let t = nc({
0: [Bo(e.pubkey)],
1: (e.relays || []).map((n) => zn.encode(n)),
});
return ms("nprofile", t);
}
function v_(e) {
let t;
e.kind !== void 0 && (t = g_(e.kind));
let n = nc({
0: [Bo(e.id)],
1: (e.relays || []).map((r) => zn.encode(r)),
2: e.author ? [Bo(e.author)] : [],
3: t ? [new Uint8Array(t)] : [],
});
return ms("nevent", n);
}
function __(e) {
let t = new ArrayBuffer(4);
new DataView(t).setUint32(0, e.kind, !1);
let n = nc({
0: [zn.encode(e.identifier)],
1: (e.relays || []).map((r) => zn.encode(r)),
2: [Bo(e.pubkey)],
3: [new Uint8Array(t)],
});
return ms("naddr", n);
}
function E_(e) {
let t = nc({ 0: [zn.encode(e)] });
return ms("nrelay", t);
}
function nc(e) {
let t = [];
return (
Object.entries(e)
.reverse()
.forEach(([n, r]) => {
r.forEach((o) => {
let s = new Uint8Array(o.length + 2);
s.set([parseInt(n)], 0),
s.set([o.length], 1),
s.set(o, 2),
t.push(s);
});
}),
ca(...t)
);
}
var k_ = {};
st(k_, { decrypt: () => A_, encrypt: () => m0 });
async function m0(e, t, n) {
const r = e instanceof Uint8Array ? wt(e) : e,
o = Li.getSharedSecret(r, "02" + t),
s = b0(o);
let c = Uint8Array.from(bg(16)),
f = zn.encode(n),
d = Zg(s, c).encrypt(f),
h = ar.encode(new Uint8Array(d)),
y = ar.encode(new Uint8Array(c.buffer));
return `${h}?iv=${y}`;
}
async function A_(e, t, n) {
const r = e instanceof Uint8Array ? wt(e) : e;
let [o, s] = n.split("?iv="),
c = Li.getSharedSecret(r, "02" + t),
f = b0(c),
d = ar.decode(s),
h = ar.decode(o),
y = Zg(f, d).decrypt(h);
return er.decode(y);
}
function b0(e) {
return e.slice(1, 33);
}
var S_ = {};
st(S_, {
NIP05_REGEX: () => y0,
isValid: () => T_,
queryProfile: () => v0,
searchDomain: () => x_,
useFetchImplementation: () => $_,
});
var y0 = /^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,
rc;
try {
rc = fetch;
} catch {}
function $_(e) {
rc = e;
}
async function x_(e, t = "") {
try {
const n = `https://${e}/.well-known/nostr.json?name=${t}`;
return (await (await rc(n, { redirect: "error" })).json()).names;
} catch {
return {};
}
}
async function v0(e) {
var s;
const t = e.match(y0);
if (!t) return null;
const [n, r = "_", o] = t;
try {
const c = `https://${o}/.well-known/nostr.json?name=${r}`,
f = await (await rc(c, { redirect: "error" })).json();
let d = f.names[r];
return d
? { pubkey: d, relays: (s = f.relays) == null ? void 0 : s[d] }
: null;
} catch {
return null;
}
}
async function T_(e, t) {
let n = await v0(t);
return n ? n.pubkey === e : !1;
}
var P_ = {};
st(P_, { parse: () => L_ });
function L_(e) {
const t = { reply: void 0, root: void 0, mentions: [], profiles: [] },
n = [];
for (const r of e.tags)
r[0] === "e" && r[1] && n.push(r),
r[0] === "p" &&
r[1] &&
t.profiles.push({ pubkey: r[1], relays: r[2] ? [r[2]] : [] });
for (let r = 0; r < n.length; r++) {
const o = n[r],
[s, c, f, d] = o,
h = { id: c, relays: f ? [f] : [] },
y = r === 0,
m = r === n.length - 1;
if (d === "root") {
t.root = h;
continue;
}
if (d === "reply") {
t.reply = h;
continue;
}
if (d === "mention") {
t.mentions.push(h);
continue;
}
if (y) {
t.root = h;
continue;
}
if (m) {
t.reply = h;
continue;
}
t.mentions.push(h);
}
return t;
}
var B_ = {};
st(B_, {
fetchRelayInformation: () => I_,
useFetchImplementation: () => C_,
});
var _0;
try {
_0 = fetch;
} catch {}
function C_(e) {
_0 = e;
}
async function I_(e) {
return await (
await fetch(
e.replace("ws://", "http://").replace("wss://", "https://"),
{ headers: { Accept: "application/nostr+json" } }
)
).json();
}
var O_ = {};
st(O_, { getPow: () => E0, minePow: () => N_ });
function E0(e) {
let t = 0;
for (let n = 0; n < e.length; n++) {
const r = parseInt(e[n], 16);
if (r === 0) t += 4;
else {
t += Math.clz32(r) - 28;
break;
}
}
return t;
}
function N_(e, t) {
let n = 0;
const r = e,
o = ["nonce", n.toString(), t.toString()];
for (r.tags.push(o); ; ) {
const s = Math.floor(new Date().getTime() / 1e3);
if (
(s !== r.created_at && ((n = 0), (r.created_at = s)),
(o[1] = (++n).toString()),
(r.id = Qs(r)),
E0(r.id) >= t)
)
break;
}
return r;
}
var R_ = {};
st(R_, {
finishRepostEvent: () => z_,
getRepostedEvent: () => U_,
getRepostedEventPointer: () => k0,
});
function z_(e, t, n, r) {
return so(
{
kind: ld,
tags: [...(e.tags ?? []), ["e", t.id, n], ["p", t.pubkey]],
content: e.content === "" ? "" : JSON.stringify(t),
created_at: e.created_at,
},
r
);
}
function k0(e) {
if (e.kind !== ld) return;
let t, n;
for (
let r = e.tags.length - 1;
r >= 0 && (t === void 0 || n === void 0);
r--
) {
const o = e.tags[r];
o.length >= 2 &&
(o[0] === "e" && t === void 0
? (t = o)
: o[0] === "p" && n === void 0 && (n = o));
}
if (t !== void 0)
return {
id: t[1],
relays: [t[2], n == null ? void 0 : n[2]].filter(
(r) => typeof r == "string"
),
author: n == null ? void 0 : n[1],
};
}
function U_(e, { skipVerification: t } = {}) {
const n = k0(e);
if (n === void 0 || e.content === "") return;
let r;
try {
r = JSON.parse(e.content);
} catch {
return;
}
if (r.id === n.id && !(!t && !ud(r))) return r;
}
var M_ = {};
st(M_, { NOSTR_URI_REGEX: () => oc, parse: () => j_, test: () => H_ });
var oc = new RegExp(`nostr:(${w0.source})`);
function H_(e) {
return typeof e == "string" && new RegExp(`^${oc.source}$`).test(e);
}
function j_(e) {
const t = e.match(new RegExp(`^${oc.source}$`));
if (!t) throw new Error(`Invalid Nostr URI: ${e}`);
return { uri: t[0], value: t[1], decoded: ec(t[1]) };
}
var D_ = {};
st(D_, {
finishReactionEvent: () => q_,
getReactedEventPointer: () => V_,
});
function q_(e, t, n) {
const r = t.tags.filter(
(o) => o.length >= 2 && (o[0] === "e" || o[0] === "p")
);
return so(
{
...e,
kind: dd,
tags: [...(e.tags ?? []), ...r, ["e", t.id], ["p", t.pubkey]],
content: e.content ?? "+",
},
n
);
}
function V_(e) {
if (e.kind !== dd) return;
let t, n;
for (
let r = e.tags.length - 1;
r >= 0 && (t === void 0 || n === void 0);
r--
) {
const o = e.tags[r];
o.length >= 2 &&
(o[0] === "e" && t === void 0
? (t = o)
: o[0] === "p" && n === void 0 && (n = o));
}
if (!(t === void 0 || n === void 0))
return {
id: t[1],
relays: [t[2], n[2]].filter((r) => r !== void 0),
author: n[1],
};
}
var F_ = {};
st(F_, { matchAll: () => K_, regex: () => gd, replaceAll: () => W_ });
var gd = () => new RegExp(`\\b${oc.source}\\b`, "g");
function* K_(e) {
const t = e.matchAll(gd());
for (const n of t)
try {
const [r, o] = n;
yield {
uri: r,
value: o,
decoded: ec(o),
start: n.index,
end: n.index + r.length,
};
} catch {}
}
function W_(e, t) {
return e.replaceAll(gd(), (n, r) =>
t({ uri: n, value: r, decoded: ec(r) })
);
}
var G_ = {};
st(G_, {
channelCreateEvent: () => Z_,
channelHideMessageEvent: () => X_,
channelMessageEvent: () => J_,
channelMetadataEvent: () => Y_,
channelMuteUserEvent: () => Q_,
});
var Z_ = (e, t) => {
let n;
if (typeof e.content == "object") n = JSON.stringify(e.content);
else if (typeof e.content == "string") n = e.content;
else return;
return so(
{
kind: a0,
tags: [...(e.tags ?? [])],
content: n,
created_at: e.created_at,
},
t
);
},
Y_ = (e, t) => {
let n;
if (typeof e.content == "object") n = JSON.stringify(e.content);
else if (typeof e.content == "string") n = e.content;
else return;
return so(
{
kind: c0,
tags: [["e", e.channel_create_event_id], ...(e.tags ?? [])],
content: n,
created_at: e.created_at,
},
t
);
},
J_ = (e, t) => {
const n = [["e", e.channel_create_event_id, e.relay_url, "root"]];
return (
e.reply_to_channel_message_event_id &&
n.push([
"e",
e.reply_to_channel_message_event_id,
e.relay_url,
"reply",
]),
so(
{
kind: u0,
tags: [...n, ...(e.tags ?? [])],
content: e.content,
created_at: e.created_at,
},
t
)
);
},
X_ = (e, t) => {
let n;
if (typeof e.content == "object") n = JSON.stringify(e.content);
else if (typeof e.content == "string") n = e.content;
else return;
return so(
{
kind: l0,
tags: [["e", e.channel_message_event_id], ...(e.tags ?? [])],
content: n,
created_at: e.created_at,
},
t
);
},
Q_ = (e, t) => {
let n;
if (typeof e.content == "object") n = JSON.stringify(e.content);
else if (typeof e.content == "string") n = e.content;
else return;
return so(
{
kind: d0,
tags: [["p", e.pubkey_to_mute], ...(e.tags ?? [])],
content: n,
created_at: e.created_at,
},
t
);
},
eE = {};
st(eE, {
EMOJI_SHORTCODE_REGEX: () => A0,
matchAll: () => tE,
regex: () => wd,
replaceAll: () => nE,
});
var A0 = /:(\w+):/,
wd = () => new RegExp(`\\B${A0.source}\\B`, "g");
function* tE(e) {
const t = e.matchAll(wd());
for (const n of t)
try {
const [r, o] = n;
yield {
shortcode: r,
name: o,
start: n.index,
end: n.index + r.length,
};
} catch {}
}
function nE(e, t) {
return e.replaceAll(wd(), (n, r) => t({ shortcode: n, name: r }));
}
var rE = {};
st(rE, { useFetchImplementation: () => oE, validateGithub: () => iE });
var md;
try {
md = fetch;
} catch {}
function oE(e) {
md = e;
}
async function iE(e, t, n) {
try {
return (
(await (
await md(`https://gist.github.com/${t}/${n}/raw`)
).text()) ===
`Verifying that I control the following Nostr public key: ${e}`
);
} catch {
return !1;
}
}
var sE = {};
st(sE, { default: () => cE, v2: () => bd });
var aE = new TextDecoder(),
Ln = class {
static utf8Decode(e) {
return aE.decode(e);
}
static getConversationKey(e, t) {
const n = Li.getSharedSecret(e, "02" + t).subarray(1, 33);
return U3(si, n, "nip44-v2");
}
static getMessageKeys(e, t) {
const n = M3(si, e, t, 76);
return {
chacha_key: n.subarray(0, 32),
chacha_nonce: n.subarray(32, 44),
hmac_key: n.subarray(44, 76),
};
}
static calcPaddedLen(e) {
if (!Number.isSafeInteger(e) || e < 1)
throw new Error("expected positive integer");
if (e <= 32) return 32;
const t = 1 << (Math.floor(Math.log2(e - 1)) + 1),
n = t <= 256 ? 32 : t / 8;
return n * (Math.floor((e - 1) / n) + 1);
}
static writeU16BE(e) {
if (
!Number.isSafeInteger(e) ||
e < Ln.minPlaintextSize ||
e > Ln.maxPlaintextSize
)
throw new Error(
"invalid plaintext size: must be between 1 and 65535 bytes"
);
const t = new Uint8Array(2);
return new DataView(t.buffer).setUint16(0, e, !1), t;
}
static pad(e) {
const t = Ln.utf8Encode(e),
n = t.length,
r = Ln.writeU16BE(n),
o = new Uint8Array(Ln.calcPaddedLen(n) - n);
return ca(r, t, o);
}
static unpad(e) {
const t = new DataView(e.buffer).getUint16(0),
n = e.subarray(2, 2 + t);
if (
t < Ln.minPlaintextSize ||
t > Ln.maxPlaintextSize ||
n.length !== t ||
e.length !== 2 + Ln.calcPaddedLen(t)
)
throw new Error("invalid padding");
return Ln.utf8Decode(n);
}
static hmacAad(e, t, n) {
if (n.length !== 32)
throw new Error("AAD associated data must be 32 bytes");
const r = ca(n, t);
return Ja(si, e, r);
}
static decodePayload(e) {
if (typeof e != "string")
throw new Error("payload must be a valid string");
const t = e.length;
if (t < 132 || t > 87472)
throw new Error("invalid payload length: " + t);
if (e[0] === "#") throw new Error("unknown encryption version");
let n;
try {
n = ar.decode(e);
} catch (s) {
throw new Error("invalid base64: " + s.message);
}
const r = n.length;
if (r < 99 || r > 65603)
throw new Error("invalid data length: " + r);
const o = n[0];
if (o !== 2) throw new Error("unknown encryption version " + o);
return {
nonce: n.subarray(1, 33),
ciphertext: n.subarray(33, -32),
mac: n.subarray(-32),
};
}
},
hn = Ln;
Xa(hn, "minPlaintextSize", 1);
Xa(hn, "maxPlaintextSize", 65535);
Xa(hn, "utf8Encode", gg);
var bd = class {
static encrypt(e, t, n = bg(32)) {
const {
chacha_key: r,
chacha_nonce: o,
hmac_key: s,
} = hn.getMessageKeys(t, n),
c = hn.pad(e),
f = Yh(r, o, c),
d = hn.hmacAad(s, f, n);
return ar.encode(ca(new Uint8Array([2]), n, f, d));
}
static decrypt(e, t) {
const { nonce: n, ciphertext: r, mac: o } = hn.decodePayload(e),
{
chacha_key: s,
chacha_nonce: c,
hmac_key: f,
} = hn.getMessageKeys(t, n),
d = hn.hmacAad(f, r, n);
if (!y3(d, o)) throw new Error("invalid MAC");
const h = Yh(s, c, r);
return hn.unpad(h);
}
};
Xa(bd, "utils", hn);
var cE = { v2: bd },
uE = {};
st(uE, {
makeNwcRequestEvent: () => dE,
parseConnectionString: () => lE,
});
function lE(e) {
const { pathname: t, searchParams: n } = new URL(e),
r = t,
o = n.get("relay"),
s = n.get("secret");
if (!r || !o || !s) throw new Error("invalid connection string");
return { pubkey: r, relay: o, secret: s };
}
async function dE(e, t, n) {
const o = await m0(
t,
e,
JSON.stringify({ method: "pay_invoice", params: { invoice: n } })
),
s = {
kind: h0,
created_at: Math.round(Date.now() / 1e3),
content: o,
tags: [["p", e]],
};
return so(s, t);
}
var fE = {};
st(fE, {
getZapEndpoint: () => pE,
makeZapReceipt: () => mE,
makeZapRequest: () => gE,
useFetchImplementation: () => hE,
validateZapRequest: () => wE,
});
var yd;
try {
yd = fetch;
} catch {}
function hE(e) {
yd = e;
}
async function pE(e) {
try {
let t = "",
{ lud06: n, lud16: r } = JSON.parse(e.content);
if (n) {
let { words: c } = Gr.decode(n, 1e3),
f = Gr.fromWords(c);
t = er.decode(f);
} else if (r) {
let [c, f] = r.split("@");
t = new URL(`/.well-known/lnurlp/${c}`, `https://${f}`).toString();
} else return null;
let s = await (await yd(t)).json();
if (s.allowsNostr && s.nostrPubkey) return s.callback;
} catch {}
return null;
}
function gE({
profile: e,
event: t,
amount: n,
relays: r,
comment: o = "",
}) {
if (!n) throw new Error("amount not given");
if (!e) throw new Error("profile not given");
let s = {
kind: 9734,
created_at: Math.round(Date.now() / 1e3),
content: o,
tags: [
["p", e],
["amount", n.toString()],
["relays", ...r],
],
};
return t && s.tags.push(["e", t]), s;
}
function wE(e) {
let t;
try {
t = JSON.parse(e);
} catch {
return "Invalid zap request JSON.";
}
if (!t0(t)) return "Zap request is not a valid Nostr event.";
if (!ud(t)) return "Invalid signature on zap request.";
let n = t.tags.find(([s, c]) => s === "p" && c);
if (!n) return "Zap request doesn't have a 'p' tag.";
if (!n[1].match(/^[a-f0-9]{64}$/))
return "Zap request 'p' tag is not valid hex.";
let r = t.tags.find(([s, c]) => s === "e" && c);
return r && !r[1].match(/^[a-f0-9]{64}$/)
? "Zap request 'e' tag is not valid hex."
: t.tags.find(([s, c]) => s === "relays" && c)
? null
: "Zap request doesn't have a 'relays' tag.";
}
function mE({ zapRequest: e, preimage: t, bolt11: n, paidAt: r }) {
let o = JSON.parse(e),
s = o.tags.filter(([f]) => f === "e" || f === "p" || f === "a"),
c = {
kind: 9735,
created_at: Math.round(r.getTime() / 1e3),
content: "",
tags: [...s, ["P", o.pubkey], ["bolt11", n], ["description", e]],
};
return t && c.tags.push(["preimage", t]), c;
}
var bE = {};
st(bE, {
getToken: () => yE,
hashPayload: () => vd,
unpackEventFromToken: () => $0,
validateEvent: () => C0,
validateEventKind: () => T0,
validateEventMethodTag: () => L0,
validateEventPayloadTag: () => B0,
validateEventTimestamp: () => x0,
validateEventUrlTag: () => P0,
validateToken: () => vE,
});
var S0 = "Nostr ";
async function yE(e, t, n, r = !1, o) {
const s = {
kind: fd,
tags: [
["u", e],
["method", t],
],
created_at: Math.round(new Date().getTime() / 1e3),
content: "",
};
o && s.tags.push(["payload", vd(o)]);
const c = await n(s);
return (r ? S0 : "") + ar.encode(zn.encode(JSON.stringify(c)));
}
async function vE(e, t, n) {
const r = await $0(e).catch((s) => {
throw s;
});
return await C0(r, t, n).catch((s) => {
throw s;
});
}
async function $0(e) {
if (!e) throw new Error("Missing token");
e = e.replace(S0, "");
const t = er.decode(ar.decode(e));
if (!t || t.length === 0 || !t.startsWith("{"))
throw new Error("Invalid token");
return JSON.parse(t);
}
function x0(e) {
return e.created_at
? Math.round(new Date().getTime() / 1e3) - e.created_at < 60
: !1;
}
function T0(e) {
return e.kind === fd;
}
function P0(e, t) {
const n = e.tags.find((r) => r[0] === "u");
return n ? n.length > 0 && n[1] === t : !1;
}
function L0(e, t) {
const n = e.tags.find((r) => r[0] === "method");
return n ? n.length > 0 && n[1].toLowerCase() === t.toLowerCase() : !1;
}
function vd(e) {
const t = si(zn.encode(JSON.stringify(e)));
return wt(t);
}
function B0(e, t) {
const n = e.tags.find((o) => o[0] === "payload");
if (!n) return !1;
const r = vd(t);
return n.length > 0 && n[1] === r;
}
async function C0(e, t, n, r) {
if (!ud(e)) throw new Error("Invalid nostr event, signature invalid");
if (!T0(e)) throw new Error("Invalid nostr event, kind invalid");
if (!x0(e))
throw new Error("Invalid nostr event, created_at timestamp invalid");
if (!P0(e, t)) throw new Error("Invalid nostr event, url tag invalid");
if (!L0(e, n))
throw new Error("Invalid nostr event, method tag invalid");
if (r && typeof r == "object" && Object.keys(r).length > 0 && !B0(e, r))
throw new Error(
"Invalid nostr event, payload tag does not match request body hash"
);
return !0;
}
var I0 =
typeof globalThis < "u"
? globalThis
: typeof window < "u"
? window
: typeof global < "u"
? global
: typeof self < "u"
? self
: {};
function _E(e) {
return e &&
e.__esModule &&
Object.prototype.hasOwnProperty.call(e, "default")
? e.default
: e;
}
var O0 = { exports: {} };
(function (e) {
(function () {
function t(l) {
var w = {
omitExtraWLInCodeBlocks: {
defaultValue: !1,
describe:
"Omit the default extra whiteline added to code blocks",
type: "boolean",
},
noHeaderId: {
defaultValue: !1,
describe: "Turn on/off generated header id",
type: "boolean",
},
prefixHeaderId: {
defaultValue: !1,
describe:
"Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",
type: "string",
},
rawPrefixHeaderId: {
defaultValue: !1,
describe:
'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',
type: "boolean",
},
ghCompatibleHeaderId: {
defaultValue: !1,
describe:
"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",
type: "boolean",
},
rawHeaderId: {
defaultValue: !1,
describe: `Remove only spaces, ' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids`,
type: "boolean",
},
headerLevelStart: {
defaultValue: !1,
describe: "The header blocks level start",
type: "integer",
},
parseImgDimensions: {
defaultValue: !1,
describe: "Turn on/off image dimension parsing",
type: "boolean",
},
simplifiedAutoLink: {
defaultValue: !1,
describe: "Turn on/off GFM autolink style",
type: "boolean",
},
excludeTrailingPunctuationFromURLs: {
defaultValue: !1,
describe:
"Excludes trailing punctuation from links generated with autoLinking",
type: "boolean",
},
literalMidWordUnderscores: {
defaultValue: !1,
describe: "Parse midword underscores as literal underscores",
type: "boolean",
},
literalMidWordAsterisks: {
defaultValue: !1,
describe: "Parse midword asterisks as literal asterisks",
type: "boolean",
},
strikethrough: {
defaultValue: !1,
describe: "Turn on/off strikethrough support",
type: "boolean",
},
tables: {
defaultValue: !1,
describe: "Turn on/off tables support",
type: "boolean",
},
tablesHeaderId: {
defaultValue: !1,
describe: "Add an id to table headers",
type: "boolean",
},
ghCodeBlocks: {
defaultValue: !0,
describe: "Turn on/off GFM fenced code blocks support",
type: "boolean",
},
tasklists: {
defaultValue: !1,
describe: "Turn on/off GFM tasklist support",
type: "boolean",
},
smoothLivePreview: {
defaultValue: !1,
describe:
"Prevents weird effects in live previews due to incomplete input",
type: "boolean",
},
smartIndentationFix: {
defaultValue: !1,
describe: "Tries to smartly fix indentation in es6 strings",
type: "boolean",
},
disableForced4SpacesIndentedSublists: {
defaultValue: !1,
describe:
"Disables the requirement of indenting nested sublists by 4 spaces",
type: "boolean",
},
simpleLineBreaks: {
defaultValue: !1,
describe: "Parses simple line breaks as <br> (GFM Style)",
type: "boolean",
},
requireSpaceBeforeHeadingText: {
defaultValue: !1,
describe:
"Makes adding a space between `#` and the header text mandatory (GFM Style)",
type: "boolean",
},
ghMentions: {
defaultValue: !1,
describe: "Enables github @mentions",
type: "boolean",
},
ghMentionsLink: {
defaultValue: "https://github.com/{u}",
describe:
"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",
type: "string",
},
encodeEmails: {
defaultValue: !0,
describe:
"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",
type: "boolean",
},
openLinksInNewWindow: {
defaultValue: !1,
describe: "Open all links in new windows",
type: "boolean",
},
backslashEscapesHTMLTags: {
defaultValue: !1,
describe: "Support for HTML Tag escaping. ex: <div>foo</div>",
type: "boolean",
},
emoji: {
defaultValue: !1,
describe: "Enable emoji support. Ex: `this is a :smile: emoji`",
type: "boolean",
},
underline: {
defaultValue: !1,
describe:
"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`",
type: "boolean",
},
ellipsis: {
defaultValue: !0,
describe:
"Replaces three dots with the ellipsis unicode character",
type: "boolean",
},
completeHTMLDocument: {
defaultValue: !1,
describe:
"Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags",
type: "boolean",
},
metadata: {
defaultValue: !1,
describe:
"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",
type: "boolean",
},
splitAdjacentBlockquotes: {
defaultValue: !1,
describe: "Split adjacent blockquote blocks",
type: "boolean",
},
};
if (l === !1) return JSON.parse(JSON.stringify(w));
var p = {};
for (var _ in w) w.hasOwnProperty(_) && (p[_] = w[_].defaultValue);
return p;
}
function n() {
var l = t(!0),
w = {};
for (var p in l) l.hasOwnProperty(p) && (w[p] = !0);
return w;
}
var r = {},
o = {},
s = {},
c = t(!0),
f = "vanilla",
d = {
github: {
omitExtraWLInCodeBlocks: !0,
simplifiedAutoLink: !0,
excludeTrailingPunctuationFromURLs: !0,
literalMidWordUnderscores: !0,
strikethrough: !0,
tables: !0,
tablesHeaderId: !0,
ghCodeBlocks: !0,
tasklists: !0,
disableForced4SpacesIndentedSublists: !0,
simpleLineBreaks: !0,
requireSpaceBeforeHeadingText: !0,
ghCompatibleHeaderId: !0,
ghMentions: !0,
backslashEscapesHTMLTags: !0,
emoji: !0,
splitAdjacentBlockquotes: !0,
},
original: { noHeaderId: !0, ghCodeBlocks: !1 },
ghost: {
omitExtraWLInCodeBlocks: !0,
parseImgDimensions: !0,
simplifiedAutoLink: !0,
excludeTrailingPunctuationFromURLs: !0,
literalMidWordUnderscores: !0,
strikethrough: !0,
tables: !0,
tablesHeaderId: !0,
ghCodeBlocks: !0,
tasklists: !0,
smoothLivePreview: !0,
simpleLineBreaks: !0,
requireSpaceBeforeHeadingText: !0,
ghMentions: !1,
encodeEmails: !0,
},
vanilla: t(!0),
allOn: n(),
};
(r.helper = {}),
(r.extensions = {}),
(r.setOption = function (l, w) {
return (c[l] = w), this;
}),
(r.getOption = function (l) {
return c[l];
}),
(r.getOptions = function () {
return c;
}),
(r.resetOptions = function () {
c = t(!0);
}),
(r.setFlavor = function (l) {
if (!d.hasOwnProperty(l))
throw Error(l + " flavor was not found");
r.resetOptions();
var w = d[l];
f = l;
for (var p in w) w.hasOwnProperty(p) && (c[p] = w[p]);
}),
(r.getFlavor = function () {
return f;
}),
(r.getFlavorOptions = function (l) {
if (d.hasOwnProperty(l)) return d[l];
}),
(r.getDefaultOptions = function (l) {
return t(l);
}),
(r.subParser = function (l, w) {
if (r.helper.isString(l))
if (typeof w < "u") o[l] = w;
else {
if (o.hasOwnProperty(l)) return o[l];
throw Error("SubParser named " + l + " not registered!");
}
}),
(r.extension = function (l, w) {
if (!r.helper.isString(l))
throw Error("Extension 'name' must be a string");
if (((l = r.helper.stdExtName(l)), r.helper.isUndefined(w))) {
if (!s.hasOwnProperty(l))
throw Error("Extension named " + l + " is not registered!");
return s[l];
} else {
typeof w == "function" && (w = w()),
r.helper.isArray(w) || (w = [w]);
var p = h(w, l);
if (p.valid) s[l] = w;
else throw Error(p.error);
}
}),
(r.getAllExtensions = function () {
return s;
}),
(r.removeExtension = function (l) {
delete s[l];
}),
(r.resetExtensions = function () {
s = {};
});
function h(l, w) {
var p = w
? "Error in " + w + " extension->"
: "Error in unnamed extension",
_ = { valid: !0, error: "" };
r.helper.isArray(l) || (l = [l]);
for (var $ = 0; $ < l.length; ++$) {
var R = p + " sub-extension " + $ + ": ",
L = l[$];
if (typeof L != "object")
return (
(_.valid = !1),
(_.error =
R + "must be an object, but " + typeof L + " given"),
_
);
if (!r.helper.isString(L.type))
return (
(_.valid = !1),
(_.error =
R +
'property "type" must be a string, but ' +
typeof L.type +
" given"),
_
);
var E = (L.type = L.type.toLowerCase());
if (
(E === "language" && (E = L.type = "lang"),
E === "html" && (E = L.type = "output"),
E !== "lang" && E !== "output" && E !== "listener")
)
return (
(_.valid = !1),
(_.error =
R +
"type " +
E +
' is not recognized. Valid values: "lang/language", "output/html" or "listener"'),
_
);
if (E === "listener") {
if (r.helper.isUndefined(L.listeners))
return (
(_.valid = !1),
(_.error =
R +
'. Extensions of type "listener" must have a property called "listeners"'),
_
);
} else if (
r.helper.isUndefined(L.filter) &&
r.helper.isUndefined(L.regex)
)
return (
(_.valid = !1),
(_.error =
R +
E +
' extensions must define either a "regex" property or a "filter" method'),
_
);
if (L.listeners) {
if (typeof L.listeners != "object")
return (
(_.valid = !1),
(_.error =
R +
'"listeners" property must be an object but ' +
typeof L.listeners +
" given"),
_
);
for (var x in L.listeners)
if (
L.listeners.hasOwnProperty(x) &&
typeof L.listeners[x] != "function"
)
return (
(_.valid = !1),
(_.error =
R +
'"listeners" property must be an hash of [event name]: [callback]. listeners.' +
x +
" must be a function but " +
typeof L.listeners[x] +
" given"),
_
);
}
if (L.filter) {
if (typeof L.filter != "function")
return (
(_.valid = !1),
(_.error =
R +
'"filter" must be a function, but ' +
typeof L.filter +
" given"),
_
);
} else if (L.regex) {
if (
(r.helper.isString(L.regex) &&
(L.regex = new RegExp(L.regex, "g")),
!(L.regex instanceof RegExp))
)
return (
(_.valid = !1),
(_.error =
R +
'"regex" property must either be a string or a RegExp object, but ' +
typeof L.regex +
" given"),
_
);
if (r.helper.isUndefined(L.replace))
return (
(_.valid = !1),
(_.error =
R +
'"regex" extensions must implement a replace string or function'),
_
);
}
}
return _;
}
(r.validateExtension = function (l) {
var w = h(l, null);
return w.valid ? !0 : (console.warn(w.error), !1);
}),
r.hasOwnProperty("helper") || (r.helper = {}),
(r.helper.isString = function (l) {
return typeof l == "string" || l instanceof String;
}),
(r.helper.isFunction = function (l) {
var w = {};
return l && w.toString.call(l) === "[object Function]";
}),
(r.helper.isArray = function (l) {
return Array.isArray(l);
}),
(r.helper.isUndefined = function (l) {
return typeof l > "u";
}),
(r.helper.forEach = function (l, w) {
if (r.helper.isUndefined(l))
throw new Error("obj param is required");
if (r.helper.isUndefined(w))
throw new Error("callback param is required");
if (!r.helper.isFunction(w))
throw new Error("callback param must be a function/closure");
if (typeof l.forEach == "function") l.forEach(w);
else if (r.helper.isArray(l))
for (var p = 0; p < l.length; p++) w(l[p], p, l);
else if (typeof l == "object")
for (var _ in l) l.hasOwnProperty(_) && w(l[_], _, l);
else
throw new Error(
"obj does not seem to be an array or an iterable object"
);
}),
(r.helper.stdExtName = function (l) {
return l
.replace(/[_?*+\/\\.^-]/g, "")
.replace(/\s/g, "")
.toLowerCase();
});
function y(l, w) {
var p = w.charCodeAt(0);
return "¨E" + p + "E";
}
(r.helper.escapeCharactersCallback = y),
(r.helper.escapeCharacters = function (l, w, p) {
var _ = "([" + w.replace(/([\[\]\\])/g, "\\$1") + "])";
p && (_ = "\\\\" + _);
var $ = new RegExp(_, "g");
return (l = l.replace($, y)), l;
}),
(r.helper.unescapeHTMLEntities = function (l) {
return l
.replace(/&quot;/g, '"')
.replace(/&lt;/g, "<")
.replace(/&gt;/g, ">")
.replace(/&amp;/g, "&");
});
var m = function (l, w, p, _) {
var $ = _ || "",
R = $.indexOf("g") > -1,
L = new RegExp(w + "|" + p, "g" + $.replace(/g/g, "")),
E = new RegExp(w, $.replace(/g/g, "")),
x = [],
z,
q,
I,
S,
D;
do
for (z = 0; (I = L.exec(l)); )
if (E.test(I[0]))
z++ || ((q = L.lastIndex), (S = q - I[0].length));
else if (z && !--z) {
D = I.index + I[0].length;
var K = {
left: { start: S, end: q },
match: { start: q, end: I.index },
right: { start: I.index, end: D },
wholeMatch: { start: S, end: D },
};
if ((x.push(K), !R)) return x;
}
while (z && (L.lastIndex = q));
return x;
};
(r.helper.matchRecursiveRegExp = function (l, w, p, _) {
for (var $ = m(l, w, p, _), R = [], L = 0; L < $.length; ++L)
R.push([
l.slice($[L].wholeMatch.start, $[L].wholeMatch.end),
l.slice($[L].match.start, $[L].match.end),
l.slice($[L].left.start, $[L].left.end),
l.slice($[L].right.start, $[L].right.end),
]);
return R;
}),
(r.helper.replaceRecursiveRegExp = function (l, w, p, _, $) {
if (!r.helper.isFunction(w)) {
var R = w;
w = function () {
return R;
};
}
var L = m(l, p, _, $),
E = l,
x = L.length;
if (x > 0) {
var z = [];
L[0].wholeMatch.start !== 0 &&
z.push(l.slice(0, L[0].wholeMatch.start));
for (var q = 0; q < x; ++q)
z.push(
w(
l.slice(L[q].wholeMatch.start, L[q].wholeMatch.end),
l.slice(L[q].match.start, L[q].match.end),
l.slice(L[q].left.start, L[q].left.end),
l.slice(L[q].right.start, L[q].right.end)
)
),
q < x - 1 &&
z.push(
l.slice(L[q].wholeMatch.end, L[q + 1].wholeMatch.start)
);
L[x - 1].wholeMatch.end < l.length &&
z.push(l.slice(L[x - 1].wholeMatch.end)),
(E = z.join(""));
}
return E;
}),
(r.helper.regexIndexOf = function (l, w, p) {
if (!r.helper.isString(l))
throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";
if (!(w instanceof RegExp))
throw "InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp";
var _ = l.substring(p || 0).search(w);
return _ >= 0 ? _ + (p || 0) : _;
}),
(r.helper.splitAtIndex = function (l, w) {
if (!r.helper.isString(l))
throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";
return [l.substring(0, w), l.substring(w)];
}),
(r.helper.encodeEmailAddress = function (l) {
var w = [
function (p) {
return "&#" + p.charCodeAt(0) + ";";
},
function (p) {
return "&#x" + p.charCodeAt(0).toString(16) + ";";
},
function (p) {
return p;
},
];
return (
(l = l.replace(/./g, function (p) {
if (p === "@") p = w[Math.floor(Math.random() * 2)](p);
else {
var _ = Math.random();
p = _ > 0.9 ? w[2](p) : _ > 0.45 ? w[1](p) : w[0](p);
}
return p;
})),
l
);
}),
(r.helper.padEnd = function (w, p, _) {
return (
(p = p >> 0),
(_ = String(_ || " ")),
w.length > p
? String(w)
: ((p = p - w.length),
p > _.length && (_ += _.repeat(p / _.length)),
String(w) + _.slice(0, p))
);
}),
typeof console > "u" &&
(console = {
warn: function (l) {
alert(l);
},
log: function (l) {
alert(l);
},
error: function (l) {
throw l;
},
}),
(r.helper.regexes = { asteriskDashAndColon: /([*_:~])/g }),
(r.helper.emojis = {
"+1": "👍",
"-1": "👎",
100: "💯",
1234: "🔢",
"1st_place_medal": "🥇",
"2nd_place_medal": "🥈",
"3rd_place_medal": "🥉",
"8ball": "🎱",
a: "🅰️",
ab: "🆎",
abc: "🔤",
abcd: "🔡",
accept: "🉑",
aerial_tramway: "🚡",
airplane: "✈️",
alarm_clock: "⏰",
alembic: "⚗️",
alien: "👽",
ambulance: "🚑",
amphora: "🏺",
anchor: "⚓️",
angel: "👼",
anger: "💢",
angry: "😠",
anguished: "😧",
ant: "🐜",
apple: "🍎",
aquarius: "♒️",
aries: "♈️",
arrow_backward: "◀️",
arrow_double_down: "⏬",
arrow_double_up: "⏫",
arrow_down: "⬇️",
arrow_down_small: "🔽",
arrow_forward: "▶️",
arrow_heading_down: "⤵️",
arrow_heading_up: "⤴️",
arrow_left: "⬅️",
arrow_lower_left: "↙️",
arrow_lower_right: "↘️",
arrow_right: "➡️",
arrow_right_hook: "↪️",
arrow_up: "⬆️",
arrow_up_down: "↕️",
arrow_up_small: "🔼",
arrow_upper_left: "↖️",
arrow_upper_right: "↗️",
arrows_clockwise: "🔃",
arrows_counterclockwise: "🔄",
art: "🎨",
articulated_lorry: "🚛",
artificial_satellite: "🛰",
astonished: "😲",
athletic_shoe: "👟",
atm: "🏧",
atom_symbol: "⚛️",
avocado: "🥑",
b: "🅱️",
baby: "👶",
baby_bottle: "🍼",
baby_chick: "🐤",
baby_symbol: "🚼",
back: "🔙",
bacon: "🥓",
badminton: "🏸",
baggage_claim: "🛄",
baguette_bread: "🥖",
balance_scale: "⚖️",
balloon: "🎈",
ballot_box: "🗳",
ballot_box_with_check: "☑️",
bamboo: "🎍",
banana: "🍌",
bangbang: "‼️",
bank: "🏦",
bar_chart: "📊",
barber: "💈",
baseball: "⚾️",
basketball: "🏀",
basketball_man: "⛹️",
basketball_woman: "⛹️&zwj;♀️",
bat: "🦇",
bath: "🛀",
bathtub: "🛁",
battery: "🔋",
beach_umbrella: "🏖",
bear: "🐻",
bed: "🛏",
bee: "🐝",
beer: "🍺",
beers: "🍻",
beetle: "🐞",
beginner: "🔰",
bell: "🔔",
bellhop_bell: "🛎",
bento: "🍱",
biking_man: "🚴",
bike: "🚲",
biking_woman: "🚴&zwj;♀️",
bikini: "👙",
biohazard: "☣️",
bird: "🐦",
birthday: "🎂",
black_circle: "⚫️",
black_flag: "🏴",
black_heart: "🖤",
black_joker: "🃏",
black_large_square: "⬛️",
black_medium_small_square: "◾️",
black_medium_square: "◼️",
black_nib: "✒️",
black_small_square: "▪️",
black_square_button: "🔲",
blonde_man: "👱",
blonde_woman: "👱&zwj;♀️",
blossom: "🌼",
blowfish: "🐡",
blue_book: "📘",
blue_car: "🚙",
blue_heart: "💙",
blush: "😊",
boar: "🐗",
boat: "⛵️",
bomb: "💣",
book: "📖",
bookmark: "🔖",
bookmark_tabs: "📑",
books: "📚",
boom: "💥",
boot: "👢",
bouquet: "💐",
bowing_man: "🙇",
bow_and_arrow: "🏹",
bowing_woman: "🙇&zwj;♀️",
bowling: "🎳",
boxing_glove: "🥊",
boy: "👦",
bread: "🍞",
bride_with_veil: "👰",
bridge_at_night: "🌉",
briefcase: "💼",
broken_heart: "💔",
bug: "🐛",
building_construction: "🏗",
bulb: "💡",
bullettrain_front: "🚅",
bullettrain_side: "🚄",
burrito: "🌯",
bus: "🚌",
business_suit_levitating: "🕴",
busstop: "🚏",
bust_in_silhouette: "👤",
busts_in_silhouette: "👥",
butterfly: "🦋",
cactus: "🌵",
cake: "🍰",
calendar: "📆",
call_me_hand: "🤙",
calling: "📲",
camel: "🐫",
camera: "📷",
camera_flash: "📸",
camping: "🏕",
cancer: "♋️",
candle: "🕯",
candy: "🍬",
canoe: "🛶",
capital_abcd: "🔠",
capricorn: "♑️",
car: "🚗",
card_file_box: "🗃",
card_index: "📇",
card_index_dividers: "🗂",
carousel_horse: "🎠",
carrot: "🥕",
cat: "🐱",
cat2: "🐈",
cd: "💿",
chains: "⛓",
champagne: "🍾",
chart: "💹",
chart_with_downwards_trend: "📉",
chart_with_upwards_trend: "📈",
checkered_flag: "🏁",
cheese: "🧀",
cherries: "🍒",
cherry_blossom: "🌸",
chestnut: "🌰",
chicken: "🐔",
children_crossing: "🚸",
chipmunk: "🐿",
chocolate_bar: "🍫",
christmas_tree: "🎄",
church: "⛪️",
cinema: "🎦",
circus_tent: "🎪",
city_sunrise: "🌇",
city_sunset: "🌆",
cityscape: "🏙",
cl: "🆑",
clamp: "🗜",
clap: "👏",
clapper: "🎬",
classical_building: "🏛",
clinking_glasses: "🥂",
clipboard: "📋",
clock1: "🕐",
clock10: "🕙",
clock1030: "🕥",
clock11: "🕚",
clock1130: "🕦",
clock12: "🕛",
clock1230: "🕧",
clock130: "🕜",
clock2: "🕑",
clock230: "🕝",
clock3: "🕒",
clock330: "🕞",
clock4: "🕓",
clock430: "🕟",
clock5: "🕔",
clock530: "🕠",
clock6: "🕕",
clock630: "🕡",
clock7: "🕖",
clock730: "🕢",
clock8: "🕗",
clock830: "🕣",
clock9: "🕘",
clock930: "🕤",
closed_book: "📕",
closed_lock_with_key: "🔐",
closed_umbrella: "🌂",
cloud: "☁️",
cloud_with_lightning: "🌩",
cloud_with_lightning_and_rain: "⛈",
cloud_with_rain: "🌧",
cloud_with_snow: "🌨",
clown_face: "🤡",
clubs: "♣️",
cocktail: "🍸",
coffee: "☕️",
coffin: "⚰️",
cold_sweat: "😰",
comet: "☄️",
computer: "💻",
computer_mouse: "🖱",
confetti_ball: "🎊",
confounded: "😖",
confused: "😕",
congratulations: "㊗️",
construction: "🚧",
construction_worker_man: "👷",
construction_worker_woman: "👷&zwj;♀️",
control_knobs: "🎛",
convenience_store: "🏪",
cookie: "🍪",
cool: "🆒",
policeman: "👮",
copyright: "©️",
corn: "🌽",
couch_and_lamp: "🛋",
couple: "👫",
couple_with_heart_woman_man: "💑",
couple_with_heart_man_man: "👨&zwj;❤️&zwj;👨",
couple_with_heart_woman_woman: "👩&zwj;❤️&zwj;👩",
couplekiss_man_man: "👨&zwj;❤️&zwj;💋&zwj;👨",
couplekiss_man_woman: "💏",
couplekiss_woman_woman: "👩&zwj;❤️&zwj;💋&zwj;👩",
cow: "🐮",
cow2: "🐄",
cowboy_hat_face: "🤠",
crab: "🦀",
crayon: "🖍",
credit_card: "💳",
crescent_moon: "🌙",
cricket: "🏏",
crocodile: "🐊",
croissant: "🥐",
crossed_fingers: "🤞",
crossed_flags: "🎌",
crossed_swords: "⚔️",
crown: "👑",
cry: "😢",
crying_cat_face: "😿",
crystal_ball: "🔮",
cucumber: "🥒",
cupid: "💘",
curly_loop: "➰",
currency_exchange: "💱",
curry: "🍛",
custard: "🍮",
customs: "🛃",
cyclone: "🌀",
dagger: "🗡",
dancer: "💃",
dancing_women: "👯",
dancing_men: "👯&zwj;♂️",
dango: "🍡",
dark_sunglasses: "🕶",
dart: "🎯",
dash: "💨",
date: "📅",
deciduous_tree: "🌳",
deer: "🦌",
department_store: "🏬",
derelict_house: "🏚",
desert: "🏜",
desert_island: "🏝",
desktop_computer: "🖥",
male_detective: "🕵️",
diamond_shape_with_a_dot_inside: "💠",
diamonds: "♦️",
disappointed: "😞",
disappointed_relieved: "😥",
dizzy: "💫",
dizzy_face: "😵",
do_not_litter: "🚯",
dog: "🐶",
dog2: "🐕",
dollar: "💵",
dolls: "🎎",
dolphin: "🐬",
door: "🚪",
doughnut: "🍩",
dove: "🕊",
dragon: "🐉",
dragon_face: "🐲",
dress: "👗",
dromedary_camel: "🐪",
drooling_face: "🤤",
droplet: "💧",
drum: "🥁",
duck: "🦆",
dvd: "📀",
"e-mail": "📧",
eagle: "🦅",
ear: "👂",
ear_of_rice: "🌾",
earth_africa: "🌍",
earth_americas: "🌎",
earth_asia: "🌏",
egg: "🥚",
eggplant: "🍆",
eight_pointed_black_star: "✴️",
eight_spoked_asterisk: "✳️",
electric_plug: "🔌",
elephant: "🐘",
email: "✉️",
end: "🔚",
envelope_with_arrow: "📩",
euro: "💶",
european_castle: "🏰",
european_post_office: "🏤",
evergreen_tree: "🌲",
exclamation: "❗️",
expressionless: "😑",
eye: "👁",
eye_speech_bubble: "👁&zwj;🗨",
eyeglasses: "👓",
eyes: "👀",
face_with_head_bandage: "🤕",
face_with_thermometer: "🤒",
fist_oncoming: "👊",
factory: "🏭",
fallen_leaf: "🍂",
family_man_woman_boy: "👪",
family_man_boy: "👨&zwj;👦",
family_man_boy_boy: "👨&zwj;👦&zwj;👦",
family_man_girl: "👨&zwj;👧",
family_man_girl_boy: "👨&zwj;👧&zwj;👦",
family_man_girl_girl: "👨&zwj;👧&zwj;👧",
family_man_man_boy: "👨&zwj;👨&zwj;👦",
family_man_man_boy_boy: "👨&zwj;👨&zwj;👦&zwj;👦",
family_man_man_girl: "👨&zwj;👨&zwj;👧",
family_man_man_girl_boy: "👨&zwj;👨&zwj;👧&zwj;👦",
family_man_man_girl_girl: "👨&zwj;👨&zwj;👧&zwj;👧",
family_man_woman_boy_boy: "👨&zwj;👩&zwj;👦&zwj;👦",
family_man_woman_girl: "👨&zwj;👩&zwj;👧",
family_man_woman_girl_boy: "👨&zwj;👩&zwj;👧&zwj;👦",
family_man_woman_girl_girl: "👨&zwj;👩&zwj;👧&zwj;👧",
family_woman_boy: "👩&zwj;👦",
family_woman_boy_boy: "👩&zwj;👦&zwj;👦",
family_woman_girl: "👩&zwj;👧",
family_woman_girl_boy: "👩&zwj;👧&zwj;👦",
family_woman_girl_girl: "👩&zwj;👧&zwj;👧",
family_woman_woman_boy: "👩&zwj;👩&zwj;👦",
family_woman_woman_boy_boy: "👩&zwj;👩&zwj;👦&zwj;👦",
family_woman_woman_girl: "👩&zwj;👩&zwj;👧",
family_woman_woman_girl_boy: "👩&zwj;👩&zwj;👧&zwj;👦",
family_woman_woman_girl_girl: "👩&zwj;👩&zwj;👧&zwj;👧",
fast_forward: "⏩",
fax: "📠",
fearful: "😨",
feet: "🐾",
female_detective: "🕵️&zwj;♀️",
ferris_wheel: "🎡",
ferry: "⛴",
field_hockey: "🏑",
file_cabinet: "🗄",
file_folder: "📁",
film_projector: "📽",
film_strip: "🎞",
fire: "🔥",
fire_engine: "🚒",
fireworks: "🎆",
first_quarter_moon: "🌓",
first_quarter_moon_with_face: "🌛",
fish: "🐟",
fish_cake: "🍥",
fishing_pole_and_fish: "🎣",
fist_raised: "✊",
fist_left: "🤛",
fist_right: "🤜",
flags: "🎏",
flashlight: "🔦",
fleur_de_lis: "⚜️",
flight_arrival: "🛬",
flight_departure: "🛫",
floppy_disk: "💾",
flower_playing_cards: "🎴",
flushed: "😳",
fog: "🌫",
foggy: "🌁",
football: "🏈",
footprints: "👣",
fork_and_knife: "🍴",
fountain: "⛲️",
fountain_pen: "🖋",
four_leaf_clover: "🍀",
fox_face: "🦊",
framed_picture: "🖼",
free: "🆓",
fried_egg: "🍳",
fried_shrimp: "🍤",
fries: "🍟",
frog: "🐸",
frowning: "😦",
frowning_face: "☹️",
frowning_man: "🙍&zwj;♂️",
frowning_woman: "🙍",
middle_finger: "🖕",
fuelpump: "⛽️",
full_moon: "🌕",
full_moon_with_face: "🌝",
funeral_urn: "⚱️",
game_die: "🎲",
gear: "⚙️",
gem: "💎",
gemini: "♊️",
ghost: "👻",
gift: "🎁",
gift_heart: "💝",
girl: "👧",
globe_with_meridians: "🌐",
goal_net: "🥅",
goat: "🐐",
golf: "⛳️",
golfing_man: "🏌️",
golfing_woman: "🏌️&zwj;♀️",
gorilla: "🦍",
grapes: "🍇",
green_apple: "🍏",
green_book: "📗",
green_heart: "💚",
green_salad: "🥗",
grey_exclamation: "❕",
grey_question: "❔",
grimacing: "😬",
grin: "😁",
grinning: "😀",
guardsman: "💂",
guardswoman: "💂&zwj;♀️",
guitar: "🎸",
gun: "🔫",
haircut_woman: "💇",
haircut_man: "💇&zwj;♂️",
hamburger: "🍔",
hammer: "🔨",
hammer_and_pick: "⚒",
hammer_and_wrench: "🛠",
hamster: "🐹",
hand: "✋",
handbag: "👜",
handshake: "🤝",
hankey: "💩",
hatched_chick: "🐥",
hatching_chick: "🐣",
headphones: "🎧",
hear_no_evil: "🙉",
heart: "❤️",
heart_decoration: "💟",
heart_eyes: "😍",
heart_eyes_cat: "😻",
heartbeat: "💓",
heartpulse: "💗",
hearts: "♥️",
heavy_check_mark: "✔️",
heavy_division_sign: "➗",
heavy_dollar_sign: "💲",
heavy_heart_exclamation: "❣️",
heavy_minus_sign: "",
heavy_multiplication_x: "✖️",
heavy_plus_sign: "",
helicopter: "🚁",
herb: "🌿",
hibiscus: "🌺",
high_brightness: "🔆",
high_heel: "👠",
hocho: "🔪",
hole: "🕳",
honey_pot: "🍯",
horse: "🐴",
horse_racing: "🏇",
hospital: "🏥",
hot_pepper: "🌶",
hotdog: "🌭",
hotel: "🏨",
hotsprings: "♨️",
hourglass: "⌛️",
hourglass_flowing_sand: "⏳",
house: "🏠",
house_with_garden: "🏡",
houses: "🏘",
hugs: "🤗",
hushed: "😯",
ice_cream: "🍨",
ice_hockey: "🏒",
ice_skate: "⛸",
icecream: "🍦",
id: "🆔",
ideograph_advantage: "🉐",
imp: "👿",
inbox_tray: "📥",
incoming_envelope: "📨",
tipping_hand_woman: "💁",
information_source: "",
innocent: "😇",
interrobang: "⁉️",
iphone: "📱",
izakaya_lantern: "🏮",
jack_o_lantern: "🎃",
japan: "🗾",
japanese_castle: "🏯",
japanese_goblin: "👺",
japanese_ogre: "👹",
jeans: "👖",
joy: "😂",
joy_cat: "😹",
joystick: "🕹",
kaaba: "🕋",
key: "🔑",
keyboard: "⌨️",
keycap_ten: "🔟",
kick_scooter: "🛴",
kimono: "👘",
kiss: "💋",
kissing: "😗",
kissing_cat: "😽",
kissing_closed_eyes: "😚",
kissing_heart: "😘",
kissing_smiling_eyes: "😙",
kiwi_fruit: "🥝",
koala: "🐨",
koko: "🈁",
label: "🏷",
large_blue_circle: "🔵",
large_blue_diamond: "🔷",
large_orange_diamond: "🔶",
last_quarter_moon: "🌗",
last_quarter_moon_with_face: "🌜",
latin_cross: "✝️",
laughing: "😆",
leaves: "🍃",
ledger: "📒",
left_luggage: "🛅",
left_right_arrow: "↔️",
leftwards_arrow_with_hook: "↩️",
lemon: "🍋",
leo: "♌️",
leopard: "🐆",
level_slider: "🎚",
libra: "♎️",
light_rail: "🚈",
link: "🔗",
lion: "🦁",
lips: "👄",
lipstick: "💄",
lizard: "🦎",
lock: "🔒",
lock_with_ink_pen: "🔏",
lollipop: "🍭",
loop: "➿",
loud_sound: "🔊",
loudspeaker: "📢",
love_hotel: "🏩",
love_letter: "💌",
low_brightness: "🔅",
lying_face: "🤥",
m: "Ⓜ️",
mag: "🔍",
mag_right: "🔎",
mahjong: "🀄️",
mailbox: "📫",
mailbox_closed: "📪",
mailbox_with_mail: "📬",
mailbox_with_no_mail: "📭",
man: "👨",
man_artist: "👨&zwj;🎨",
man_astronaut: "👨&zwj;🚀",
man_cartwheeling: "🤸&zwj;♂️",
man_cook: "👨&zwj;🍳",
man_dancing: "🕺",
man_facepalming: "🤦&zwj;♂️",
man_factory_worker: "👨&zwj;🏭",
man_farmer: "👨&zwj;🌾",
man_firefighter: "👨&zwj;🚒",
man_health_worker: "👨&zwj;⚕️",
man_in_tuxedo: "🤵",
man_judge: "👨&zwj;⚖️",
man_juggling: "🤹&zwj;♂️",
man_mechanic: "👨&zwj;🔧",
man_office_worker: "👨&zwj;💼",
man_pilot: "👨&zwj;✈️",
man_playing_handball: "🤾&zwj;♂️",
man_playing_water_polo: "🤽&zwj;♂️",
man_scientist: "👨&zwj;🔬",
man_shrugging: "🤷&zwj;♂️",
man_singer: "👨&zwj;🎤",
man_student: "👨&zwj;🎓",
man_teacher: "👨&zwj;🏫",
man_technologist: "👨&zwj;💻",
man_with_gua_pi_mao: "👲",
man_with_turban: "👳",
tangerine: "🍊",
mans_shoe: "👞",
mantelpiece_clock: "🕰",
maple_leaf: "🍁",
martial_arts_uniform: "🥋",
mask: "😷",
massage_woman: "💆",
massage_man: "💆&zwj;♂️",
meat_on_bone: "🍖",
medal_military: "🎖",
medal_sports: "🏅",
mega: "📣",
melon: "🍈",
memo: "📝",
men_wrestling: "🤼&zwj;♂️",
menorah: "🕎",
mens: "🚹",
metal: "🤘",
metro: "🚇",
microphone: "🎤",
microscope: "🔬",
milk_glass: "🥛",
milky_way: "🌌",
minibus: "🚐",
minidisc: "💽",
mobile_phone_off: "📴",
money_mouth_face: "🤑",
money_with_wings: "💸",
moneybag: "💰",
monkey: "🐒",
monkey_face: "🐵",
monorail: "🚝",
moon: "🌔",
mortar_board: "🎓",
mosque: "🕌",
motor_boat: "🛥",
motor_scooter: "🛵",
motorcycle: "🏍",
motorway: "🛣",
mount_fuji: "🗻",
mountain: "⛰",
mountain_biking_man: "🚵",
mountain_biking_woman: "🚵&zwj;♀️",
mountain_cableway: "🚠",
mountain_railway: "🚞",
mountain_snow: "🏔",
mouse: "🐭",
mouse2: "🐁",
movie_camera: "🎥",
moyai: "🗿",
mrs_claus: "🤶",
muscle: "💪",
mushroom: "🍄",
musical_keyboard: "🎹",
musical_note: "🎵",
musical_score: "🎼",
mute: "🔇",
nail_care: "💅",
name_badge: "📛",
national_park: "🏞",
nauseated_face: "🤢",
necktie: "👔",
negative_squared_cross_mark: "❎",
nerd_face: "🤓",
neutral_face: "😐",
new: "🆕",
new_moon: "🌑",
new_moon_with_face: "🌚",
newspaper: "📰",
newspaper_roll: "🗞",
next_track_button: "⏭",
ng: "🆖",
no_good_man: "🙅&zwj;♂️",
no_good_woman: "🙅",
night_with_stars: "🌃",
no_bell: "🔕",
no_bicycles: "🚳",
no_entry: "⛔️",
no_entry_sign: "🚫",
no_mobile_phones: "📵",
no_mouth: "😶",
no_pedestrians: "🚷",
no_smoking: "🚭",
"non-potable_water": "🚱",
nose: "👃",
notebook: "📓",
notebook_with_decorative_cover: "📔",
notes: "🎶",
nut_and_bolt: "🔩",
o: "⭕️",
o2: "🅾️",
ocean: "🌊",
octopus: "🐙",
oden: "🍢",
office: "🏢",
oil_drum: "🛢",
ok: "🆗",
ok_hand: "👌",
ok_man: "🙆&zwj;♂️",
ok_woman: "🙆",
old_key: "🗝",
older_man: "👴",
older_woman: "👵",
om: "🕉",
on: "🔛",
oncoming_automobile: "🚘",
oncoming_bus: "🚍",
oncoming_police_car: "🚔",
oncoming_taxi: "🚖",
open_file_folder: "📂",
open_hands: "👐",
open_mouth: "😮",
open_umbrella: "☂️",
ophiuchus: "⛎",
orange_book: "📙",
orthodox_cross: "☦️",
outbox_tray: "📤",
owl: "🦉",
ox: "🐂",
package: "📦",
page_facing_up: "📄",
page_with_curl: "📃",
pager: "📟",
paintbrush: "🖌",
palm_tree: "🌴",
pancakes: "🥞",
panda_face: "🐼",
paperclip: "📎",
paperclips: "🖇",
parasol_on_ground: "⛱",
parking: "🅿️",
part_alternation_mark: "〽️",
partly_sunny: "⛅️",
passenger_ship: "🛳",
passport_control: "🛂",
pause_button: "⏸",
peace_symbol: "☮️",
peach: "🍑",
peanuts: "🥜",
pear: "🍐",
pen: "🖊",
pencil2: "✏️",
penguin: "🐧",
pensive: "😔",
performing_arts: "🎭",
persevere: "😣",
person_fencing: "🤺",
pouting_woman: "🙎",
phone: "☎️",
pick: "⛏",
pig: "🐷",
pig2: "🐖",
pig_nose: "🐽",
pill: "💊",
pineapple: "🍍",
ping_pong: "🏓",
pisces: "♓️",
pizza: "🍕",
place_of_worship: "🛐",
plate_with_cutlery: "🍽",
play_or_pause_button: "⏯",
point_down: "👇",
point_left: "👈",
point_right: "👉",
point_up: "☝️",
point_up_2: "👆",
police_car: "🚓",
policewoman: "👮&zwj;♀️",
poodle: "🐩",
popcorn: "🍿",
post_office: "🏣",
postal_horn: "📯",
postbox: "📮",
potable_water: "🚰",
potato: "🥔",
pouch: "👝",
poultry_leg: "🍗",
pound: "💷",
rage: "😡",
pouting_cat: "😾",
pouting_man: "🙎&zwj;♂️",
pray: "🙏",
prayer_beads: "📿",
pregnant_woman: "🤰",
previous_track_button: "⏮",
prince: "🤴",
princess: "👸",
printer: "🖨",
purple_heart: "💜",
purse: "👛",
pushpin: "📌",
put_litter_in_its_place: "🚮",
question: "❓",
rabbit: "🐰",
rabbit2: "🐇",
racehorse: "🐎",
racing_car: "🏎",
radio: "📻",
radio_button: "🔘",
radioactive: "☢️",
railway_car: "🚃",
railway_track: "🛤",
rainbow: "🌈",
rainbow_flag: "🏳️&zwj;🌈",
raised_back_of_hand: "🤚",
raised_hand_with_fingers_splayed: "🖐",
raised_hands: "🙌",
raising_hand_woman: "🙋",
raising_hand_man: "🙋&zwj;♂️",
ram: "🐏",
ramen: "🍜",
rat: "🐀",
record_button: "⏺",
recycle: "♻️",
red_circle: "🔴",
registered: "®️",
relaxed: "☺️",
relieved: "😌",
reminder_ribbon: "🎗",
repeat: "🔁",
repeat_one: "🔂",
rescue_worker_helmet: "⛑",
restroom: "🚻",
revolving_hearts: "💞",
rewind: "⏪",
rhinoceros: "🦏",
ribbon: "🎀",
rice: "🍚",
rice_ball: "🍙",
rice_cracker: "🍘",
rice_scene: "🎑",
right_anger_bubble: "🗯",
ring: "💍",
robot: "🤖",
rocket: "🚀",
rofl: "🤣",
roll_eyes: "🙄",
roller_coaster: "🎢",
rooster: "🐓",
rose: "🌹",
rosette: "🏵",
rotating_light: "🚨",
round_pushpin: "📍",
rowing_man: "🚣",
rowing_woman: "🚣&zwj;♀️",
rugby_football: "🏉",
running_man: "🏃",
running_shirt_with_sash: "🎽",
running_woman: "🏃&zwj;♀️",
sa: "🈂️",
sagittarius: "♐️",
sake: "🍶",
sandal: "👡",
santa: "🎅",
satellite: "📡",
saxophone: "🎷",
school: "🏫",
school_satchel: "🎒",
scissors: "✂️",
scorpion: "🦂",
scorpius: "♏️",
scream: "😱",
scream_cat: "🙀",
scroll: "📜",
seat: "💺",
secret: "㊙️",
see_no_evil: "🙈",
seedling: "🌱",
selfie: "🤳",
shallow_pan_of_food: "🥘",
shamrock: "☘️",
shark: "🦈",
shaved_ice: "🍧",
sheep: "🐑",
shell: "🐚",
shield: "🛡",
shinto_shrine: "⛩",
ship: "🚢",
shirt: "👕",
shopping: "🛍",
shopping_cart: "🛒",
shower: "🚿",
shrimp: "🦐",
signal_strength: "📶",
six_pointed_star: "🔯",
ski: "🎿",
skier: "⛷",
skull: "💀",
skull_and_crossbones: "☠️",
sleeping: "😴",
sleeping_bed: "🛌",
sleepy: "😪",
slightly_frowning_face: "🙁",
slightly_smiling_face: "🙂",
slot_machine: "🎰",
small_airplane: "🛩",
small_blue_diamond: "🔹",
small_orange_diamond: "🔸",
small_red_triangle: "🔺",
small_red_triangle_down: "🔻",
smile: "😄",
smile_cat: "😸",
smiley: "😃",
smiley_cat: "😺",
smiling_imp: "😈",
smirk: "😏",
smirk_cat: "😼",
smoking: "🚬",
snail: "🐌",
snake: "🐍",
sneezing_face: "🤧",
snowboarder: "🏂",
snowflake: "❄️",
snowman: "⛄️",
snowman_with_snow: "☃️",
sob: "😭",
soccer: "⚽️",
soon: "🔜",
sos: "🆘",
sound: "🔉",
space_invader: "👾",
spades: "♠️",
spaghetti: "🍝",
sparkle: "❇️",
sparkler: "🎇",
sparkles: "✨",
sparkling_heart: "💖",
speak_no_evil: "🙊",
speaker: "🔈",
speaking_head: "🗣",
speech_balloon: "💬",
speedboat: "🚤",
spider: "🕷",
spider_web: "🕸",
spiral_calendar: "🗓",
spiral_notepad: "🗒",
spoon: "🥄",
squid: "🦑",
stadium: "🏟",
star: "⭐️",
star2: "🌟",
star_and_crescent: "☪️",
star_of_david: "✡️",
stars: "🌠",
station: "🚉",
statue_of_liberty: "🗽",
steam_locomotive: "🚂",
stew: "🍲",
stop_button: "⏹",
stop_sign: "🛑",
stopwatch: "⏱",
straight_ruler: "📏",
strawberry: "🍓",
stuck_out_tongue: "😛",
stuck_out_tongue_closed_eyes: "😝",
stuck_out_tongue_winking_eye: "😜",
studio_microphone: "🎙",
stuffed_flatbread: "🥙",
sun_behind_large_cloud: "🌥",
sun_behind_rain_cloud: "🌦",
sun_behind_small_cloud: "🌤",
sun_with_face: "🌞",
sunflower: "🌻",
sunglasses: "😎",
sunny: "☀️",
sunrise: "🌅",
sunrise_over_mountains: "🌄",
surfing_man: "🏄",
surfing_woman: "🏄&zwj;♀️",
sushi: "🍣",
suspension_railway: "🚟",
sweat: "😓",
sweat_drops: "💦",
sweat_smile: "😅",
sweet_potato: "🍠",
swimming_man: "🏊",
swimming_woman: "🏊&zwj;♀️",
symbols: "🔣",
synagogue: "🕍",
syringe: "💉",
taco: "🌮",
tada: "🎉",
tanabata_tree: "🎋",
taurus: "♉️",
taxi: "🚕",
tea: "🍵",
telephone_receiver: "📞",
telescope: "🔭",
tennis: "🎾",
tent: "⛺️",
thermometer: "🌡",
thinking: "🤔",
thought_balloon: "💭",
ticket: "🎫",
tickets: "🎟",
tiger: "🐯",
tiger2: "🐅",
timer_clock: "⏲",
tipping_hand_man: "💁&zwj;♂️",
tired_face: "😫",
tm: "™️",
toilet: "🚽",
tokyo_tower: "🗼",
tomato: "🍅",
tongue: "👅",
top: "🔝",
tophat: "🎩",
tornado: "🌪",
trackball: "🖲",
tractor: "🚜",
traffic_light: "🚥",
train: "🚋",
train2: "🚆",
tram: "🚊",
triangular_flag_on_post: "🚩",
triangular_ruler: "📐",
trident: "🔱",
triumph: "😤",
trolleybus: "🚎",
trophy: "🏆",
tropical_drink: "🍹",
tropical_fish: "🐠",
truck: "🚚",
trumpet: "🎺",
tulip: "🌷",
tumbler_glass: "🥃",
turkey: "🦃",
turtle: "🐢",
tv: "📺",
twisted_rightwards_arrows: "🔀",
two_hearts: "💕",
two_men_holding_hands: "👬",
two_women_holding_hands: "👭",
u5272: "🈹",
u5408: "🈴",
u55b6: "🈺",
u6307: "🈯️",
u6708: "🈷️",
u6709: "🈶",
u6e80: "🈵",
u7121: "🈚️",
u7533: "🈸",
u7981: "🈲",
u7a7a: "🈳",
umbrella: "☔️",
unamused: "😒",
underage: "🔞",
unicorn: "🦄",
unlock: "🔓",
up: "🆙",
upside_down_face: "🙃",
v: "✌️",
vertical_traffic_light: "🚦",
vhs: "📼",
vibration_mode: "📳",
video_camera: "📹",
video_game: "🎮",
violin: "🎻",
virgo: "♍️",
volcano: "🌋",
volleyball: "🏐",
vs: "🆚",
vulcan_salute: "🖖",
walking_man: "🚶",
walking_woman: "🚶&zwj;♀️",
waning_crescent_moon: "🌘",
waning_gibbous_moon: "🌖",
warning: "⚠️",
wastebasket: "🗑",
watch: "⌚️",
water_buffalo: "🐃",
watermelon: "🍉",
wave: "👋",
wavy_dash: "〰️",
waxing_crescent_moon: "🌒",
wc: "🚾",
weary: "😩",
wedding: "💒",
weight_lifting_man: "🏋️",
weight_lifting_woman: "🏋️&zwj;♀️",
whale: "🐳",
whale2: "🐋",
wheel_of_dharma: "☸️",
wheelchair: "♿️",
white_check_mark: "✅",
white_circle: "⚪️",
white_flag: "🏳️",
white_flower: "💮",
white_large_square: "⬜️",
white_medium_small_square: "◽️",
white_medium_square: "◻️",
white_small_square: "▫️",
white_square_button: "🔳",
wilted_flower: "🥀",
wind_chime: "🎐",
wind_face: "🌬",
wine_glass: "🍷",
wink: "😉",
wolf: "🐺",
woman: "👩",
woman_artist: "👩&zwj;🎨",
woman_astronaut: "👩&zwj;🚀",
woman_cartwheeling: "🤸&zwj;♀️",
woman_cook: "👩&zwj;🍳",
woman_facepalming: "🤦&zwj;♀️",
woman_factory_worker: "👩&zwj;🏭",
woman_farmer: "👩&zwj;🌾",
woman_firefighter: "👩&zwj;🚒",
woman_health_worker: "👩&zwj;⚕️",
woman_judge: "👩&zwj;⚖️",
woman_juggling: "🤹&zwj;♀️",
woman_mechanic: "👩&zwj;🔧",
woman_office_worker: "👩&zwj;💼",
woman_pilot: "👩&zwj;✈️",
woman_playing_handball: "🤾&zwj;♀️",
woman_playing_water_polo: "🤽&zwj;♀️",
woman_scientist: "👩&zwj;🔬",
woman_shrugging: "🤷&zwj;♀️",
woman_singer: "👩&zwj;🎤",
woman_student: "👩&zwj;🎓",
woman_teacher: "👩&zwj;🏫",
woman_technologist: "👩&zwj;💻",
woman_with_turban: "👳&zwj;♀️",
womans_clothes: "👚",
womans_hat: "👒",
women_wrestling: "🤼&zwj;♀️",
womens: "🚺",
world_map: "🗺",
worried: "😟",
wrench: "🔧",
writing_hand: "✍️",
x: "❌",
yellow_heart: "💛",
yen: "💴",
yin_yang: "☯️",
yum: "😋",
zap: "⚡️",
zipper_mouth_face: "🤐",
zzz: "💤",
octocat:
'<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">',
showdown: `<span style="font-family: 'Anonymous Pro', monospace; text-decoration: underline; text-decoration-style: dashed; text-decoration-color: #3e8b8a;text-underline-position: under;">S</span>`,
}),
(r.Converter = function (l) {
var w = {},
p = [],
_ = [],
$ = {},
R = f,
L = { parsed: {}, raw: "", format: "" };
E();
function E() {
l = l || {};
for (var S in c) c.hasOwnProperty(S) && (w[S] = c[S]);
if (typeof l == "object")
for (var D in l) l.hasOwnProperty(D) && (w[D] = l[D]);
else
throw Error(
"Converter expects the passed parameter to be an object, but " +
typeof l +
" was passed instead."
);
w.extensions && r.helper.forEach(w.extensions, x);
}
function x(S, D) {
if (((D = D || null), r.helper.isString(S)))
if (
((S = r.helper.stdExtName(S)), (D = S), r.extensions[S])
) {
console.warn(
"DEPRECATION WARNING: " +
S +
" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"
),
z(r.extensions[S], S);
return;
} else if (!r.helper.isUndefined(s[S])) S = s[S];
else
throw Error(
'Extension "' +
S +
'" could not be loaded. It was either not found or is not a valid extension.'
);
typeof S == "function" && (S = S()),
r.helper.isArray(S) || (S = [S]);
var K = h(S, D);
if (!K.valid) throw Error(K.error);
for (var W = 0; W < S.length; ++W) {
switch (S[W].type) {
case "lang":
p.push(S[W]);
break;
case "output":
_.push(S[W]);
break;
}
if (S[W].hasOwnProperty("listeners"))
for (var Z in S[W].listeners)
S[W].listeners.hasOwnProperty(Z) &&
q(Z, S[W].listeners[Z]);
}
}
function z(S, D) {
typeof S == "function" && (S = S(new r.Converter())),
r.helper.isArray(S) || (S = [S]);
var K = h(S, D);
if (!K.valid) throw Error(K.error);
for (var W = 0; W < S.length; ++W)
switch (S[W].type) {
case "lang":
p.push(S[W]);
break;
case "output":
_.push(S[W]);
break;
default:
throw Error(
"Extension loader error: Type unrecognized!!!"
);
}
}
function q(S, D) {
if (!r.helper.isString(S))
throw Error(
"Invalid argument in converter.listen() method: name must be a string, but " +
typeof S +
" given"
);
if (typeof D != "function")
throw Error(
"Invalid argument in converter.listen() method: callback must be a function, but " +
typeof D +
" given"
);
$.hasOwnProperty(S) || ($[S] = []), $[S].push(D);
}
function I(S) {
var D = S.match(/^\s*/)[0].length,
K = new RegExp("^\\s{0," + D + "}", "gm");
return S.replace(K, "");
}
(this._dispatch = function (D, K, W, Z) {
if ($.hasOwnProperty(D))
for (var G = 0; G < $[D].length; ++G) {
var oe = $[D][G](D, K, this, W, Z);
oe && typeof oe < "u" && (K = oe);
}
return K;
}),
(this.listen = function (S, D) {
return q(S, D), this;
}),
(this.makeHtml = function (S) {
if (!S) return S;
var D = {
gHtmlBlocks: [],
gHtmlMdBlocks: [],
gHtmlSpans: [],
gUrls: {},
gTitles: {},
gDimensions: {},
gListLevel: 0,
hashLinkCounts: {},
langExtensions: p,
outputModifiers: _,
converter: this,
ghCodeBlocks: [],
metadata: { parsed: {}, raw: "", format: "" },
};
return (
(S = S.replace(/¨/g, "¨T")),
(S = S.replace(/\$/g, "¨D")),
(S = S.replace(
/\r\n/g,
`
`
)),
(S = S.replace(
/\r/g,
`
`
)),
(S = S.replace(/\u00A0/g, "&nbsp;")),
w.smartIndentationFix && (S = I(S)),
(S =
`
` +
S +
`
`),
(S = r.subParser("detab")(S, w, D)),
(S = S.replace(/^[ \t]+$/gm, "")),
r.helper.forEach(p, function (K) {
S = r.subParser("runExtension")(K, S, w, D);
}),
(S = r.subParser("metadata")(S, w, D)),
(S = r.subParser("hashPreCodeTags")(S, w, D)),
(S = r.subParser("githubCodeBlocks")(S, w, D)),
(S = r.subParser("hashHTMLBlocks")(S, w, D)),
(S = r.subParser("hashCodeTags")(S, w, D)),
(S = r.subParser("stripLinkDefinitions")(S, w, D)),
(S = r.subParser("blockGamut")(S, w, D)),
(S = r.subParser("unhashHTMLSpans")(S, w, D)),
(S = r.subParser("unescapeSpecialChars")(S, w, D)),
(S = S.replace(/¨D/g, "$$")),
(S = S.replace(/¨T/g, "¨")),
(S = r.subParser("completeHTMLDocument")(S, w, D)),
r.helper.forEach(_, function (K) {
S = r.subParser("runExtension")(K, S, w, D);
}),
(L = D.metadata),
S
);
}),
(this.makeMarkdown = this.makeMd =
function (S, D) {
if (
((S = S.replace(
/\r\n/g,
`
`
)),
(S = S.replace(
/\r/g,
`
`
)),
(S = S.replace(/>[ \t]+</, ">¨NBSP;<")),
!D)
)
if (window && window.document) D = window.document;
else
throw new Error(
"HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM"
);
var K = D.createElement("div");
K.innerHTML = S;
var W = { preList: be(K) };
he(K);
for (
var Z = K.childNodes, G = "", oe = 0;
oe < Z.length;
oe++
)
G += r.subParser("makeMarkdown.node")(Z[oe], W);
function he(Se) {
for (var re = 0; re < Se.childNodes.length; ++re) {
var ye = Se.childNodes[re];
ye.nodeType === 3
? !/\S/.test(ye.nodeValue) &&
!/^[ ]+$/.test(ye.nodeValue)
? (Se.removeChild(ye), --re)
: ((ye.nodeValue = ye.nodeValue
.split(
`
`
)
.join(" ")),
(ye.nodeValue = ye.nodeValue.replace(
/(\s)+/g,
"$1"
)))
: ye.nodeType === 1 && he(ye);
}
}
function be(Se) {
for (
var re = Se.querySelectorAll("pre"), ye = [], Ce = 0;
Ce < re.length;
++Ce
)
if (
re[Ce].childElementCount === 1 &&
re[Ce].firstChild.tagName.toLowerCase() === "code"
) {
var Oe = re[Ce].firstChild.innerHTML.trim(),
Me =
re[Ce].firstChild.getAttribute("data-language") ||
"";
if (Me === "")
for (
var pt = re[Ce].firstChild.className.split(" "),
Ke = 0;
Ke < pt.length;
++Ke
) {
var se = pt[Ke].match(/^language-(.+)$/);
if (se !== null) {
Me = se[1];
break;
}
}
(Oe = r.helper.unescapeHTMLEntities(Oe)),
ye.push(Oe),
(re[Ce].outerHTML =
'<precode language="' +
Me +
'" precodenum="' +
Ce.toString() +
'"></precode>');
} else
ye.push(re[Ce].innerHTML),
(re[Ce].innerHTML = ""),
re[Ce].setAttribute("prenum", Ce.toString());
return ye;
}
return G;
}),
(this.setOption = function (S, D) {
w[S] = D;
}),
(this.getOption = function (S) {
return w[S];
}),
(this.getOptions = function () {
return w;
}),
(this.addExtension = function (S, D) {
(D = D || null), x(S, D);
}),
(this.useExtension = function (S) {
x(S);
}),
(this.setFlavor = function (S) {
if (!d.hasOwnProperty(S))
throw Error(S + " flavor was not found");
var D = d[S];
R = S;
for (var K in D) D.hasOwnProperty(K) && (w[K] = D[K]);
}),
(this.getFlavor = function () {
return R;
}),
(this.removeExtension = function (S) {
r.helper.isArray(S) || (S = [S]);
for (var D = 0; D < S.length; ++D) {
for (var K = S[D], W = 0; W < p.length; ++W)
p[W] === K && p.splice(W, 1);
for (var Z = 0; Z < _.length; ++Z)
_[Z] === K && _.splice(Z, 1);
}
}),
(this.getAllExtensions = function () {
return { language: p, output: _ };
}),
(this.getMetadata = function (S) {
return S ? L.raw : L.parsed;
}),
(this.getMetadataFormat = function () {
return L.format;
}),
(this._setMetadataPair = function (S, D) {
L.parsed[S] = D;
}),
(this._setMetadataFormat = function (S) {
L.format = S;
}),
(this._setMetadataRaw = function (S) {
L.raw = S;
});
}),
r.subParser("anchors", function (l, w, p) {
l = p.converter._dispatch("anchors.before", l, w, p);
var _ = function ($, R, L, E, x, z, q) {
if (
(r.helper.isUndefined(q) && (q = ""),
(L = L.toLowerCase()),
$.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1)
)
E = "";
else if (!E)
if (
(L || (L = R.toLowerCase().replace(/ ?\n/g, " ")),
(E = "#" + L),
!r.helper.isUndefined(p.gUrls[L]))
)
(E = p.gUrls[L]),
r.helper.isUndefined(p.gTitles[L]) || (q = p.gTitles[L]);
else return $;
E = E.replace(
r.helper.regexes.asteriskDashAndColon,
r.helper.escapeCharactersCallback
);
var I = '<a href="' + E + '"';
return (
q !== "" &&
q !== null &&
((q = q.replace(/"/g, "&quot;")),
(q = q.replace(
r.helper.regexes.asteriskDashAndColon,
r.helper.escapeCharactersCallback
)),
(I += ' title="' + q + '"')),
w.openLinksInNewWindow &&
!/^#/.test(E) &&
(I += ' rel="noopener noreferrer" target="¨E95Eblank"'),
(I += ">" + R + "</a>"),
I
);
};
return (
(l = l.replace(
/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,
_
)),
(l = l.replace(
/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
_
)),
(l = l.replace(
/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
_
)),
(l = l.replace(/\[([^\[\]]+)]()()()()()/g, _)),
w.ghMentions &&
(l = l.replace(
/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gim,
function ($, R, L, E, x) {
if (L === "\\") return R + E;
if (!r.helper.isString(w.ghMentionsLink))
throw new Error(
"ghMentionsLink option must be a string"
);
var z = w.ghMentionsLink.replace(/\{u}/g, x),
q = "";
return (
w.openLinksInNewWindow &&
(q =
' rel="noopener noreferrer" target="¨E95Eblank"'),
R + '<a href="' + z + '"' + q + ">" + E + "</a>"
);
}
)),
(l = p.converter._dispatch("anchors.after", l, w, p)),
l
);
});
var v =
/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,
P =
/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,
C = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,
A =
/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim,
O = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,
M = function (l) {
return function (w, p, _, $, R, L, E) {
_ = _.replace(
r.helper.regexes.asteriskDashAndColon,
r.helper.escapeCharactersCallback
);
var x = _,
z = "",
q = "",
I = p || "",
S = E || "";
return (
/^www\./i.test(_) &&
(_ = _.replace(/^www\./i, "http://www.")),
l.excludeTrailingPunctuationFromURLs && L && (z = L),
l.openLinksInNewWindow &&
(q = ' rel="noopener noreferrer" target="¨E95Eblank"'),
I + '<a href="' + _ + '"' + q + ">" + x + "</a>" + z + S
);
};
},
T = function (l, w) {
return function (p, _, $) {
var R = "mailto:";
return (
(_ = _ || ""),
($ = r.subParser("unescapeSpecialChars")($, l, w)),
l.encodeEmails
? ((R = r.helper.encodeEmailAddress(R + $)),
($ = r.helper.encodeEmailAddress($)))
: (R = R + $),
_ + '<a href="' + R + '">' + $ + "</a>"
);
};
};
r.subParser("autoLinks", function (l, w, p) {
return (
(l = p.converter._dispatch("autoLinks.before", l, w, p)),
(l = l.replace(C, M(w))),
(l = l.replace(O, T(w, p))),
(l = p.converter._dispatch("autoLinks.after", l, w, p)),
l
);
}),
r.subParser("simplifiedAutoLinks", function (l, w, p) {
return (
w.simplifiedAutoLink &&
((l = p.converter._dispatch(
"simplifiedAutoLinks.before",
l,
w,
p
)),
w.excludeTrailingPunctuationFromURLs
? (l = l.replace(P, M(w)))
: (l = l.replace(v, M(w))),
(l = l.replace(A, T(w, p))),
(l = p.converter._dispatch(
"simplifiedAutoLinks.after",
l,
w,
p
))),
l
);
}),
r.subParser("blockGamut", function (l, w, p) {
return (
(l = p.converter._dispatch("blockGamut.before", l, w, p)),
(l = r.subParser("blockQuotes")(l, w, p)),
(l = r.subParser("headers")(l, w, p)),
(l = r.subParser("horizontalRule")(l, w, p)),
(l = r.subParser("lists")(l, w, p)),
(l = r.subParser("codeBlocks")(l, w, p)),
(l = r.subParser("tables")(l, w, p)),
(l = r.subParser("hashHTMLBlocks")(l, w, p)),
(l = r.subParser("paragraphs")(l, w, p)),
(l = p.converter._dispatch("blockGamut.after", l, w, p)),
l
);
}),
r.subParser("blockQuotes", function (l, w, p) {
(l = p.converter._dispatch("blockQuotes.before", l, w, p)),
(l =
l +
`
`);
var _ = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;
return (
w.splitAdjacentBlockquotes &&
(_ = /^ {0,3}>[\s\S]*?(?:\n\n)/gm),
(l = l.replace(_, function ($) {
return (
($ = $.replace(/^[ \t]*>[ \t]?/gm, "")),
($ = $.replace(/¨0/g, "")),
($ = $.replace(/^[ \t]+$/gm, "")),
($ = r.subParser("githubCodeBlocks")($, w, p)),
($ = r.subParser("blockGamut")($, w, p)),
($ = $.replace(/(^|\n)/g, "$1 ")),
($ = $.replace(
/(\s*<pre>[^\r]+?<\/pre>)/gm,
function (R, L) {
var E = L;
return (
(E = E.replace(/^ /gm, "¨0")),
(E = E.replace(/¨0/g, "")),
E
);
}
)),
r.subParser("hashBlock")(
`<blockquote>
` +
$ +
`
</blockquote>`,
w,
p
)
);
})),
(l = p.converter._dispatch("blockQuotes.after", l, w, p)),
l
);
}),
r.subParser("codeBlocks", function (l, w, p) {
(l = p.converter._dispatch("codeBlocks.before", l, w, p)),
(l += "¨0");
var _ =
/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;
return (
(l = l.replace(_, function ($, R, L) {
var E = R,
x = L,
z = `
`;
return (
(E = r.subParser("outdent")(E, w, p)),
(E = r.subParser("encodeCode")(E, w, p)),
(E = r.subParser("detab")(E, w, p)),
(E = E.replace(/^\n+/g, "")),
(E = E.replace(/\n+$/g, "")),
w.omitExtraWLInCodeBlocks && (z = ""),
(E = "<pre><code>" + E + z + "</code></pre>"),
r.subParser("hashBlock")(E, w, p) + x
);
})),
(l = l.replace(/¨0/, "")),
(l = p.converter._dispatch("codeBlocks.after", l, w, p)),
l
);
}),
r.subParser("codeSpans", function (l, w, p) {
return (
(l = p.converter._dispatch("codeSpans.before", l, w, p)),
typeof l > "u" && (l = ""),
(l = l.replace(
/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
function (_, $, R, L) {
var E = L;
return (
(E = E.replace(/^([ \t]*)/g, "")),
(E = E.replace(/[ \t]*$/g, "")),
(E = r.subParser("encodeCode")(E, w, p)),
(E = $ + "<code>" + E + "</code>"),
(E = r.subParser("hashHTMLSpans")(E, w, p)),
E
);
}
)),
(l = p.converter._dispatch("codeSpans.after", l, w, p)),
l
);
}),
r.subParser("completeHTMLDocument", function (l, w, p) {
if (!w.completeHTMLDocument) return l;
l = p.converter._dispatch("completeHTMLDocument.before", l, w, p);
var _ = "html",
$ = `<!DOCTYPE HTML>
`,
R = "",
L = `<meta charset="utf-8">
`,
E = "",
x = "";
typeof p.metadata.parsed.doctype < "u" &&
(($ =
"<!DOCTYPE " +
p.metadata.parsed.doctype +
`>
`),
(_ = p.metadata.parsed.doctype.toString().toLowerCase()),
(_ === "html" || _ === "html5") &&
(L = '<meta charset="utf-8">'));
for (var z in p.metadata.parsed)
if (p.metadata.parsed.hasOwnProperty(z))
switch (z.toLowerCase()) {
case "doctype":
break;
case "title":
R =
"<title>" +
p.metadata.parsed.title +
`</title>
`;
break;
case "charset":
_ === "html" || _ === "html5"
? (L =
'<meta charset="' +
p.metadata.parsed.charset +
`">
`)
: (L =
'<meta name="charset" content="' +
p.metadata.parsed.charset +
`">
`);
break;
case "language":
case "lang":
(E = ' lang="' + p.metadata.parsed[z] + '"'),
(x +=
'<meta name="' +
z +
'" content="' +
p.metadata.parsed[z] +
`">
`);
break;
default:
x +=
'<meta name="' +
z +
'" content="' +
p.metadata.parsed[z] +
`">
`;
}
return (
(l =
$ +
"<html" +
E +
`>
<head>
` +
R +
L +
x +
`</head>
<body>
` +
l.trim() +
`
</body>
</html>`),
(l = p.converter._dispatch(
"completeHTMLDocument.after",
l,
w,
p
)),
l
);
}),
r.subParser("detab", function (l, w, p) {
return (
(l = p.converter._dispatch("detab.before", l, w, p)),
(l = l.replace(/\t(?=\t)/g, " ")),
(l = l.replace(/\t/g, "¨A¨B")),
(l = l.replace(/¨B(.+?)¨A/g, function (_, $) {
for (var R = $, L = 4 - (R.length % 4), E = 0; E < L; E++)
R += " ";
return R;
})),
(l = l.replace(/¨A/g, " ")),
(l = l.replace(/¨B/g, "")),
(l = p.converter._dispatch("detab.after", l, w, p)),
l
);
}),
r.subParser("ellipsis", function (l, w, p) {
return (
w.ellipsis &&
((l = p.converter._dispatch("ellipsis.before", l, w, p)),
(l = l.replace(/\.\.\./g, "…")),
(l = p.converter._dispatch("ellipsis.after", l, w, p))),
l
);
}),
r.subParser("emoji", function (l, w, p) {
if (!w.emoji) return l;
l = p.converter._dispatch("emoji.before", l, w, p);
var _ = /:([\S]+?):/g;
return (
(l = l.replace(_, function ($, R) {
return r.helper.emojis.hasOwnProperty(R)
? r.helper.emojis[R]
: $;
})),
(l = p.converter._dispatch("emoji.after", l, w, p)),
l
);
}),
r.subParser("encodeAmpsAndAngles", function (l, w, p) {
return (
(l = p.converter._dispatch(
"encodeAmpsAndAngles.before",
l,
w,
p
)),
(l = l.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&amp;")),
(l = l.replace(/<(?![a-z\/?$!])/gi, "&lt;")),
(l = l.replace(/</g, "&lt;")),
(l = l.replace(/>/g, "&gt;")),
(l = p.converter._dispatch(
"encodeAmpsAndAngles.after",
l,
w,
p
)),
l
);
}),
r.subParser("encodeBackslashEscapes", function (l, w, p) {
return (
(l = p.converter._dispatch(
"encodeBackslashEscapes.before",
l,
w,
p
)),
(l = l.replace(/\\(\\)/g, r.helper.escapeCharactersCallback)),
(l = l.replace(
/\\([`*_{}\[\]()>#+.!~=|:-])/g,
r.helper.escapeCharactersCallback
)),
(l = p.converter._dispatch(
"encodeBackslashEscapes.after",
l,
w,
p
)),
l
);
}),
r.subParser("encodeCode", function (l, w, p) {
return (
(l = p.converter._dispatch("encodeCode.before", l, w, p)),
(l = l
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(
/([*_{}\[\]\\=~-])/g,
r.helper.escapeCharactersCallback
)),
(l = p.converter._dispatch("encodeCode.after", l, w, p)),
l
);
}),
r.subParser(
"escapeSpecialCharsWithinTagAttributes",
function (l, w, p) {
l = p.converter._dispatch(
"escapeSpecialCharsWithinTagAttributes.before",
l,
w,
p
);
var _ = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,
$ = /<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi;
return (
(l = l.replace(_, function (R) {
return R.replace(/(.)<\/?code>(?=.)/g, "$1`").replace(
/([\\`*_~=|])/g,
r.helper.escapeCharactersCallback
);
})),
(l = l.replace($, function (R) {
return R.replace(
/([\\`*_~=|])/g,
r.helper.escapeCharactersCallback
);
})),
(l = p.converter._dispatch(
"escapeSpecialCharsWithinTagAttributes.after",
l,
w,
p
)),
l
);
}
),
r.subParser("githubCodeBlocks", function (l, w, p) {
return w.ghCodeBlocks
? ((l = p.converter._dispatch(
"githubCodeBlocks.before",
l,
w,
p
)),
(l += "¨0"),
(l = l.replace(
/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,
function (_, $, R, L) {
var E = w.omitExtraWLInCodeBlocks
? ""
: `
`;
return (
(L = r.subParser("encodeCode")(L, w, p)),
(L = r.subParser("detab")(L, w, p)),
(L = L.replace(/^\n+/g, "")),
(L = L.replace(/\n+$/g, "")),
(L =
"<pre><code" +
(R ? ' class="' + R + " language-" + R + '"' : "") +
">" +
L +
E +
"</code></pre>"),
(L = r.subParser("hashBlock")(L, w, p)),
`
¨G` +
(p.ghCodeBlocks.push({ text: _, codeblock: L }) - 1) +
`G
`
);
}
)),
(l = l.replace(/¨0/, "")),
p.converter._dispatch("githubCodeBlocks.after", l, w, p))
: l;
}),
r.subParser("hashBlock", function (l, w, p) {
return (
(l = p.converter._dispatch("hashBlock.before", l, w, p)),
(l = l.replace(/(^\n+|\n+$)/g, "")),
(l =
`
¨K` +
(p.gHtmlBlocks.push(l) - 1) +
`K
`),
(l = p.converter._dispatch("hashBlock.after", l, w, p)),
l
);
}),
r.subParser("hashCodeTags", function (l, w, p) {
l = p.converter._dispatch("hashCodeTags.before", l, w, p);
var _ = function ($, R, L, E) {
var x = L + r.subParser("encodeCode")(R, w, p) + E;
return "¨C" + (p.gHtmlSpans.push(x) - 1) + "C";
};
return (
(l = r.helper.replaceRecursiveRegExp(
l,
_,
"<code\\b[^>]*>",
"</code>",
"gim"
)),
(l = p.converter._dispatch("hashCodeTags.after", l, w, p)),
l
);
}),
r.subParser("hashElement", function (l, w, p) {
return function (_, $) {
var R = $;
return (
(R = R.replace(
/\n\n/g,
`
`
)),
(R = R.replace(/^\n/, "")),
(R = R.replace(/\n+$/g, "")),
(R =
`
¨K` +
(p.gHtmlBlocks.push(R) - 1) +
`K
`),
R
);
};
}),
r.subParser("hashHTMLBlocks", function (l, w, p) {
l = p.converter._dispatch("hashHTMLBlocks.before", l, w, p);
var _ = [
"pre",
"div",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"blockquote",
"table",
"dl",
"ol",
"ul",
"script",
"noscript",
"form",
"fieldset",
"iframe",
"math",
"style",
"section",
"header",
"footer",
"nav",
"article",
"aside",
"address",
"audio",
"canvas",
"figure",
"hgroup",
"output",
"video",
"p",
],
$ = function (S, D, K, W) {
var Z = S;
return (
K.search(/\bmarkdown\b/) !== -1 &&
(Z = K + p.converter.makeHtml(D) + W),
`
¨K` +
(p.gHtmlBlocks.push(Z) - 1) +
`K
`
);
};
w.backslashEscapesHTMLTags &&
(l = l.replace(/\\<(\/?[^>]+?)>/g, function (S, D) {
return "&lt;" + D + "&gt;";
}));
for (var R = 0; R < _.length; ++R)
for (
var L,
E = new RegExp("^ {0,3}(<" + _[R] + "\\b[^>]*>)", "im"),
x = "<" + _[R] + "\\b[^>]*>",
z = "</" + _[R] + ">";
(L = r.helper.regexIndexOf(l, E)) !== -1;
) {
var q = r.helper.splitAtIndex(l, L),
I = r.helper.replaceRecursiveRegExp(q[1], $, x, z, "im");
if (I === q[1]) break;
l = q[0].concat(I);
}
return (
(l = l.replace(
/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,
r.subParser("hashElement")(l, w, p)
)),
(l = r.helper.replaceRecursiveRegExp(
l,
function (S) {
return (
`
¨K` +
(p.gHtmlBlocks.push(S) - 1) +
`K
`
);
},
"^ {0,3}<!--",
"-->",
"gm"
)),
(l = l.replace(
/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,
r.subParser("hashElement")(l, w, p)
)),
(l = p.converter._dispatch("hashHTMLBlocks.after", l, w, p)),
l
);
}),
r.subParser("hashHTMLSpans", function (l, w, p) {
l = p.converter._dispatch("hashHTMLSpans.before", l, w, p);
function _($) {
return "¨C" + (p.gHtmlSpans.push($) - 1) + "C";
}
return (
(l = l.replace(/<[^>]+?\/>/gi, function ($) {
return _($);
})),
(l = l.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function ($) {
return _($);
})),
(l = l.replace(
/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,
function ($) {
return _($);
}
)),
(l = l.replace(/<[^>]+?>/gi, function ($) {
return _($);
})),
(l = p.converter._dispatch("hashHTMLSpans.after", l, w, p)),
l
);
}),
r.subParser("unhashHTMLSpans", function (l, w, p) {
l = p.converter._dispatch("unhashHTMLSpans.before", l, w, p);
for (var _ = 0; _ < p.gHtmlSpans.length; ++_) {
for (var $ = p.gHtmlSpans[_], R = 0; /¨C(\d+)C/.test($); ) {
var L = RegExp.$1;
if (
(($ = $.replace("¨C" + L + "C", p.gHtmlSpans[L])), R === 10)
) {
console.error("maximum nesting of 10 spans reached!!!");
break;
}
++R;
}
l = l.replace("¨C" + _ + "C", $);
}
return (
(l = p.converter._dispatch("unhashHTMLSpans.after", l, w, p)), l
);
}),
r.subParser("hashPreCodeTags", function (l, w, p) {
l = p.converter._dispatch("hashPreCodeTags.before", l, w, p);
var _ = function ($, R, L, E) {
var x = L + r.subParser("encodeCode")(R, w, p) + E;
return (
`
¨G` +
(p.ghCodeBlocks.push({ text: $, codeblock: x }) - 1) +
`G
`
);
};
return (
(l = r.helper.replaceRecursiveRegExp(
l,
_,
"^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>",
"^ {0,3}</code>\\s*</pre>",
"gim"
)),
(l = p.converter._dispatch("hashPreCodeTags.after", l, w, p)),
l
);
}),
r.subParser("headers", function (l, w, p) {
l = p.converter._dispatch("headers.before", l, w, p);
var _ = isNaN(parseInt(w.headerLevelStart))
? 1
: parseInt(w.headerLevelStart),
$ = w.smoothLivePreview
? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm
: /^(.+)[ \t]*\n=+[ \t]*\n+/gm,
R = w.smoothLivePreview
? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm
: /^(.+)[ \t]*\n-+[ \t]*\n+/gm;
(l = l.replace($, function (x, z) {
var q = r.subParser("spanGamut")(z, w, p),
I = w.noHeaderId ? "" : ' id="' + E(z) + '"',
S = _,
D = "<h" + S + I + ">" + q + "</h" + S + ">";
return r.subParser("hashBlock")(D, w, p);
})),
(l = l.replace(R, function (x, z) {
var q = r.subParser("spanGamut")(z, w, p),
I = w.noHeaderId ? "" : ' id="' + E(z) + '"',
S = _ + 1,
D = "<h" + S + I + ">" + q + "</h" + S + ">";
return r.subParser("hashBlock")(D, w, p);
}));
var L = w.requireSpaceBeforeHeadingText
? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm
: /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;
l = l.replace(L, function (x, z, q) {
var I = q;
w.customizedHeaderId &&
(I = q.replace(/\s?\{([^{]+?)}\s*$/, ""));
var S = r.subParser("spanGamut")(I, w, p),
D = w.noHeaderId ? "" : ' id="' + E(q) + '"',
K = _ - 1 + z.length,
W = "<h" + K + D + ">" + S + "</h" + K + ">";
return r.subParser("hashBlock")(W, w, p);
});
function E(x) {
var z, q;
if (w.customizedHeaderId) {
var I = x.match(/\{([^{]+?)}\s*$/);
I && I[1] && (x = I[1]);
}
return (
(z = x),
r.helper.isString(w.prefixHeaderId)
? (q = w.prefixHeaderId)
: w.prefixHeaderId === !0
? (q = "section-")
: (q = ""),
w.rawPrefixHeaderId || (z = q + z),
w.ghCompatibleHeaderId
? (z = z
.replace(/ /g, "-")
.replace(/&amp;/g, "")
.replace(/¨T/g, "")
.replace(/¨D/g, "")
.replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, "")
.toLowerCase())
: w.rawHeaderId
? (z = z
.replace(/ /g, "-")
.replace(/&amp;/g, "&")
.replace(/¨T/g, "¨")
.replace(/¨D/g, "$")
.replace(/["']/g, "-")
.toLowerCase())
: (z = z.replace(/[^\w]/g, "").toLowerCase()),
w.rawPrefixHeaderId && (z = q + z),
p.hashLinkCounts[z]
? (z = z + "-" + p.hashLinkCounts[z]++)
: (p.hashLinkCounts[z] = 1),
z
);
}
return (l = p.converter._dispatch("headers.after", l, w, p)), l;
}),
r.subParser("horizontalRule", function (l, w, p) {
l = p.converter._dispatch("horizontalRule.before", l, w, p);
var _ = r.subParser("hashBlock")("<hr />", w, p);
return (
(l = l.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, _)),
(l = l.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, _)),
(l = l.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, _)),
(l = p.converter._dispatch("horizontalRule.after", l, w, p)),
l
);
}),
r.subParser("images", function (l, w, p) {
l = p.converter._dispatch("images.before", l, w, p);
var _ =
/!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
$ =
/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,
R =
/!\[([^\]]*?)][ \t]*()\([ \t]?<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
L = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,
E = /!\[([^\[\]]+)]()()()()()/g;
function x(q, I, S, D, K, W, Z, G) {
return (D = D.replace(/\s/g, "")), z(q, I, S, D, K, W, Z, G);
}
function z(q, I, S, D, K, W, Z, G) {
var oe = p.gUrls,
he = p.gTitles,
be = p.gDimensions;
if (
((S = S.toLowerCase()),
G || (G = ""),
q.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1)
)
D = "";
else if (D === "" || D === null)
if (
((S === "" || S === null) &&
(S = I.toLowerCase().replace(/ ?\n/g, " ")),
(D = "#" + S),
!r.helper.isUndefined(oe[S]))
)
(D = oe[S]),
r.helper.isUndefined(he[S]) || (G = he[S]),
r.helper.isUndefined(be[S]) ||
((K = be[S].width), (W = be[S].height));
else return q;
(I = I.replace(/"/g, "&quot;").replace(
r.helper.regexes.asteriskDashAndColon,
r.helper.escapeCharactersCallback
)),
(D = D.replace(
r.helper.regexes.asteriskDashAndColon,
r.helper.escapeCharactersCallback
));
var Se = '<img src="' + D + '" alt="' + I + '"';
return (
G &&
r.helper.isString(G) &&
((G = G.replace(/"/g, "&quot;").replace(
r.helper.regexes.asteriskDashAndColon,
r.helper.escapeCharactersCallback
)),
(Se += ' title="' + G + '"')),
K &&
W &&
((K = K === "*" ? "auto" : K),
(W = W === "*" ? "auto" : W),
(Se += ' width="' + K + '"'),
(Se += ' height="' + W + '"')),
(Se += " />"),
Se
);
}
return (
(l = l.replace(L, z)),
(l = l.replace(R, x)),
(l = l.replace($, z)),
(l = l.replace(_, z)),
(l = l.replace(E, z)),
(l = p.converter._dispatch("images.after", l, w, p)),
l
);
}),
r.subParser("italicsAndBold", function (l, w, p) {
l = p.converter._dispatch("italicsAndBold.before", l, w, p);
function _($, R, L) {
return R + $ + L;
}
return (
w.literalMidWordUnderscores
? ((l = l.replace(/\b___(\S[\s\S]*?)___\b/g, function ($, R) {
return _(R, "<strong><em>", "</em></strong>");
})),
(l = l.replace(/\b__(\S[\s\S]*?)__\b/g, function ($, R) {
return _(R, "<strong>", "</strong>");
})),
(l = l.replace(/\b_(\S[\s\S]*?)_\b/g, function ($, R) {
return _(R, "<em>", "</em>");
})))
: ((l = l.replace(/___(\S[\s\S]*?)___/g, function ($, R) {
return /\S$/.test(R)
? _(R, "<strong><em>", "</em></strong>")
: $;
})),
(l = l.replace(/__(\S[\s\S]*?)__/g, function ($, R) {
return /\S$/.test(R) ? _(R, "<strong>", "</strong>") : $;
})),
(l = l.replace(/_([^\s_][\s\S]*?)_/g, function ($, R) {
return /\S$/.test(R) ? _(R, "<em>", "</em>") : $;
}))),
w.literalMidWordAsterisks
? ((l = l.replace(
/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g,
function ($, R, L) {
return _(L, R + "<strong><em>", "</em></strong>");
}
)),
(l = l.replace(
/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g,
function ($, R, L) {
return _(L, R + "<strong>", "</strong>");
}
)),
(l = l.replace(
/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g,
function ($, R, L) {
return _(L, R + "<em>", "</em>");
}
)))
: ((l = l.replace(
/\*\*\*(\S[\s\S]*?)\*\*\*/g,
function ($, R) {
return /\S$/.test(R)
? _(R, "<strong><em>", "</em></strong>")
: $;
}
)),
(l = l.replace(/\*\*(\S[\s\S]*?)\*\*/g, function ($, R) {
return /\S$/.test(R) ? _(R, "<strong>", "</strong>") : $;
})),
(l = l.replace(/\*([^\s*][\s\S]*?)\*/g, function ($, R) {
return /\S$/.test(R) ? _(R, "<em>", "</em>") : $;
}))),
(l = p.converter._dispatch("italicsAndBold.after", l, w, p)),
l
);
}),
r.subParser("lists", function (l, w, p) {
function _(L, E) {
p.gListLevel++,
(L = L.replace(
/\n{2,}$/,
`
`
)),
(L += "¨0");
var x =
/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,
z = /\n[ \t]*\n(?!¨0)/.test(L);
return (
w.disableForced4SpacesIndentedSublists &&
(x =
/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),
(L = L.replace(x, function (q, I, S, D, K, W, Z) {
Z = Z && Z.trim() !== "";
var G = r.subParser("outdent")(K, w, p),
oe = "";
return (
W &&
w.tasklists &&
((oe =
' class="task-list-item" style="list-style-type: none;"'),
(G = G.replace(/^[ \t]*\[(x|X| )?]/m, function () {
var he =
'<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';
return Z && (he += " checked"), (he += ">"), he;
}))),
(G = G.replace(
/^([-*+]|\d\.)[ \t]+[\S\n ]*/g,
function (he) {
return "¨A" + he;
}
)),
I || G.search(/\n{2,}/) > -1
? ((G = r.subParser("githubCodeBlocks")(G, w, p)),
(G = r.subParser("blockGamut")(G, w, p)))
: ((G = r.subParser("lists")(G, w, p)),
(G = G.replace(/\n$/, "")),
(G = r.subParser("hashHTMLBlocks")(G, w, p)),
(G = G.replace(
/\n\n+/g,
`
`
)),
z
? (G = r.subParser("paragraphs")(G, w, p))
: (G = r.subParser("spanGamut")(G, w, p))),
(G = G.replace("¨A", "")),
(G =
"<li" +
oe +
">" +
G +
`</li>
`),
G
);
})),
(L = L.replace(/¨0/g, "")),
p.gListLevel--,
E && (L = L.replace(/\s+$/, "")),
L
);
}
function $(L, E) {
if (E === "ol") {
var x = L.match(/^ *(\d+)\./);
if (x && x[1] !== "1") return ' start="' + x[1] + '"';
}
return "";
}
function R(L, E, x) {
var z = w.disableForced4SpacesIndentedSublists
? /^ ?\d+\.[ \t]/gm
: /^ {0,3}\d+\.[ \t]/gm,
q = w.disableForced4SpacesIndentedSublists
? /^ ?[*+-][ \t]/gm
: /^ {0,3}[*+-][ \t]/gm,
I = E === "ul" ? z : q,
S = "";
if (L.search(I) !== -1)
(function K(W) {
var Z = W.search(I),
G = $(L, E);
Z !== -1
? ((S +=
`
<` +
E +
G +
`>
` +
_(W.slice(0, Z), !!x) +
"</" +
E +
`>
`),
(E = E === "ul" ? "ol" : "ul"),
(I = E === "ul" ? z : q),
K(W.slice(Z)))
: (S +=
`
<` +
E +
G +
`>
` +
_(W, !!x) +
"</" +
E +
`>
`);
})(L);
else {
var D = $(L, E);
S =
`
<` +
E +
D +
`>
` +
_(L, !!x) +
"</" +
E +
`>
`;
}
return S;
}
return (
(l = p.converter._dispatch("lists.before", l, w, p)),
(l += "¨0"),
p.gListLevel
? (l = l.replace(
/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
function (L, E, x) {
var z = x.search(/[*+-]/g) > -1 ? "ul" : "ol";
return R(E, z, !0);
}
))
: (l = l.replace(
/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
function (L, E, x, z) {
var q = z.search(/[*+-]/g) > -1 ? "ul" : "ol";
return R(x, q, !1);
}
)),
(l = l.replace(/¨0/, "")),
(l = p.converter._dispatch("lists.after", l, w, p)),
l
);
}),
r.subParser("metadata", function (l, w, p) {
if (!w.metadata) return l;
l = p.converter._dispatch("metadata.before", l, w, p);
function _($) {
(p.metadata.raw = $),
($ = $.replace(/&/g, "&amp;").replace(/"/g, "&quot;")),
($ = $.replace(/\n {4}/g, " ")),
$.replace(/^([\S ]+): +([\s\S]+?)$/gm, function (R, L, E) {
return (p.metadata.parsed[L] = E), "";
});
}
return (
(l = l.replace(
/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,
function ($, R, L) {
return _(L), "¨M";
}
)),
(l = l.replace(
/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,
function ($, R, L) {
return R && (p.metadata.format = R), _(L), "¨M";
}
)),
(l = l.replace(/¨M/g, "")),
(l = p.converter._dispatch("metadata.after", l, w, p)),
l
);
}),
r.subParser("outdent", function (l, w, p) {
return (
(l = p.converter._dispatch("outdent.before", l, w, p)),
(l = l.replace(/^(\t|[ ]{1,4})/gm, "¨0")),
(l = l.replace(/¨0/g, "")),
(l = p.converter._dispatch("outdent.after", l, w, p)),
l
);
}),
r.subParser("paragraphs", function (l, w, p) {
(l = p.converter._dispatch("paragraphs.before", l, w, p)),
(l = l.replace(/^\n+/g, "")),
(l = l.replace(/\n+$/g, ""));
for (
var _ = l.split(/\n{2,}/g), $ = [], R = _.length, L = 0;
L < R;
L++
) {
var E = _[L];
E.search(/¨(K|G)(\d+)\1/g) >= 0
? $.push(E)
: E.search(/\S/) >= 0 &&
((E = r.subParser("spanGamut")(E, w, p)),
(E = E.replace(/^([ \t]*)/g, "<p>")),
(E += "</p>"),
$.push(E));
}
for (R = $.length, L = 0; L < R; L++) {
for (var x = "", z = $[L], q = !1; /¨(K|G)(\d+)\1/.test(z); ) {
var I = RegExp.$1,
S = RegExp.$2;
I === "K"
? (x = p.gHtmlBlocks[S])
: q
? (x = r.subParser("encodeCode")(
p.ghCodeBlocks[S].text,
w,
p
))
: (x = p.ghCodeBlocks[S].codeblock),
(x = x.replace(/\$/g, "$$$$")),
(z = z.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, x)),
/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(z) && (q = !0);
}
$[L] = z;
}
return (
(l = $.join(`
`)),
(l = l.replace(/^\n+/g, "")),
(l = l.replace(/\n+$/g, "")),
p.converter._dispatch("paragraphs.after", l, w, p)
);
}),
r.subParser("runExtension", function (l, w, p, _) {
if (l.filter) w = l.filter(w, _.converter, p);
else if (l.regex) {
var $ = l.regex;
$ instanceof RegExp || ($ = new RegExp($, "g")),
(w = w.replace($, l.replace));
}
return w;
}),
r.subParser("spanGamut", function (l, w, p) {
return (
(l = p.converter._dispatch("spanGamut.before", l, w, p)),
(l = r.subParser("codeSpans")(l, w, p)),
(l = r.subParser("escapeSpecialCharsWithinTagAttributes")(
l,
w,
p
)),
(l = r.subParser("encodeBackslashEscapes")(l, w, p)),
(l = r.subParser("images")(l, w, p)),
(l = r.subParser("anchors")(l, w, p)),
(l = r.subParser("autoLinks")(l, w, p)),
(l = r.subParser("simplifiedAutoLinks")(l, w, p)),
(l = r.subParser("emoji")(l, w, p)),
(l = r.subParser("underline")(l, w, p)),
(l = r.subParser("italicsAndBold")(l, w, p)),
(l = r.subParser("strikethrough")(l, w, p)),
(l = r.subParser("ellipsis")(l, w, p)),
(l = r.subParser("hashHTMLSpans")(l, w, p)),
(l = r.subParser("encodeAmpsAndAngles")(l, w, p)),
w.simpleLineBreaks
? /\n\n¨K/.test(l) ||
(l = l.replace(
/\n+/g,
`<br />
`
))
: (l = l.replace(
/ +\n/g,
`<br />
`
)),
(l = p.converter._dispatch("spanGamut.after", l, w, p)),
l
);
}),
r.subParser("strikethrough", function (l, w, p) {
function _($) {
return (
w.simplifiedAutoLink &&
($ = r.subParser("simplifiedAutoLinks")($, w, p)),
"<del>" + $ + "</del>"
);
}
return (
w.strikethrough &&
((l = p.converter._dispatch("strikethrough.before", l, w, p)),
(l = l.replace(
/(?:~){2}([\s\S]+?)(?:~){2}/g,
function ($, R) {
return _(R);
}
)),
(l = p.converter._dispatch("strikethrough.after", l, w, p))),
l
);
}),
r.subParser("stripLinkDefinitions", function (l, w, p) {
var _ =
/^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*<?([^>\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,
$ =
/^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm;
l += "¨0";
var R = function (L, E, x, z, q, I, S) {
return (
(E = E.toLowerCase()),
l.toLowerCase().split(E).length - 1 < 2
? L
: (x.match(/^data:.+?\/.+?;base64,/)
? (p.gUrls[E] = x.replace(/\s/g, ""))
: (p.gUrls[E] = r.subParser("encodeAmpsAndAngles")(
x,
w,
p
)),
I
? I + S
: (S && (p.gTitles[E] = S.replace(/"|'/g, "&quot;")),
w.parseImgDimensions &&
z &&
q &&
(p.gDimensions[E] = { width: z, height: q }),
""))
);
};
return (
(l = l.replace($, R)),
(l = l.replace(_, R)),
(l = l.replace(/¨0/, "")),
l
);
}),
r.subParser("tables", function (l, w, p) {
if (!w.tables) return l;
var _ =
/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,
$ =
/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm;
function R(q) {
return /^:[ \t]*--*$/.test(q)
? ' style="text-align:left;"'
: /^--*[ \t]*:[ \t]*$/.test(q)
? ' style="text-align:right;"'
: /^:[ \t]*--*[ \t]*:$/.test(q)
? ' style="text-align:center;"'
: "";
}
function L(q, I) {
var S = "";
return (
(q = q.trim()),
(w.tablesHeaderId || w.tableHeaderId) &&
(S = ' id="' + q.replace(/ /g, "_").toLowerCase() + '"'),
(q = r.subParser("spanGamut")(q, w, p)),
"<th" +
S +
I +
">" +
q +
`</th>
`
);
}
function E(q, I) {
var S = r.subParser("spanGamut")(q, w, p);
return (
"<td" +
I +
">" +
S +
`</td>
`
);
}
function x(q, I) {
for (
var S = `<table>
<thead>
<tr>
`,
D = q.length,
K = 0;
K < D;
++K
)
S += q[K];
for (
S += `</tr>
</thead>
<tbody>
`,
K = 0;
K < I.length;
++K
) {
S += `<tr>
`;
for (var W = 0; W < D; ++W) S += I[K][W];
S += `</tr>
`;
}
return (
(S += `</tbody>
</table>
`),
S
);
}
function z(q) {
var I,
S = q.split(`
`);
for (I = 0; I < S.length; ++I)
/^ {0,3}\|/.test(S[I]) &&
(S[I] = S[I].replace(/^ {0,3}\|/, "")),
/\|[ \t]*$/.test(S[I]) &&
(S[I] = S[I].replace(/\|[ \t]*$/, "")),
(S[I] = r.subParser("codeSpans")(S[I], w, p));
var D = S[0].split("|").map(function (Se) {
return Se.trim();
}),
K = S[1].split("|").map(function (Se) {
return Se.trim();
}),
W = [],
Z = [],
G = [],
oe = [];
for (S.shift(), S.shift(), I = 0; I < S.length; ++I)
S[I].trim() !== "" &&
W.push(
S[I].split("|").map(function (Se) {
return Se.trim();
})
);
if (D.length < K.length) return q;
for (I = 0; I < K.length; ++I) G.push(R(K[I]));
for (I = 0; I < D.length; ++I)
r.helper.isUndefined(G[I]) && (G[I] = ""),
Z.push(L(D[I], G[I]));
for (I = 0; I < W.length; ++I) {
for (var he = [], be = 0; be < Z.length; ++be)
r.helper.isUndefined(W[I][be]), he.push(E(W[I][be], G[be]));
oe.push(he);
}
return x(Z, oe);
}
return (
(l = p.converter._dispatch("tables.before", l, w, p)),
(l = l.replace(/\\(\|)/g, r.helper.escapeCharactersCallback)),
(l = l.replace(_, z)),
(l = l.replace($, z)),
(l = p.converter._dispatch("tables.after", l, w, p)),
l
);
}),
r.subParser("underline", function (l, w, p) {
return (
w.underline &&
((l = p.converter._dispatch("underline.before", l, w, p)),
w.literalMidWordUnderscores
? ((l = l.replace(
/\b___(\S[\s\S]*?)___\b/g,
function (_, $) {
return "<u>" + $ + "</u>";
}
)),
(l = l.replace(/\b__(\S[\s\S]*?)__\b/g, function (_, $) {
return "<u>" + $ + "</u>";
})))
: ((l = l.replace(/___(\S[\s\S]*?)___/g, function (_, $) {
return /\S$/.test($) ? "<u>" + $ + "</u>" : _;
})),
(l = l.replace(/__(\S[\s\S]*?)__/g, function (_, $) {
return /\S$/.test($) ? "<u>" + $ + "</u>" : _;
}))),
(l = l.replace(/(_)/g, r.helper.escapeCharactersCallback)),
(l = p.converter._dispatch("underline.after", l, w, p))),
l
);
}),
r.subParser("unescapeSpecialChars", function (l, w, p) {
return (
(l = p.converter._dispatch(
"unescapeSpecialChars.before",
l,
w,
p
)),
(l = l.replace(/¨E(\d+)E/g, function (_, $) {
var R = parseInt($);
return String.fromCharCode(R);
})),
(l = p.converter._dispatch(
"unescapeSpecialChars.after",
l,
w,
p
)),
l
);
}),
r.subParser("makeMarkdown.blockquote", function (l, w) {
var p = "";
if (l.hasChildNodes())
for (var _ = l.childNodes, $ = _.length, R = 0; R < $; ++R) {
var L = r.subParser("makeMarkdown.node")(_[R], w);
L !== "" && (p += L);
}
return (
(p = p.trim()),
(p =
"> " +
p.split(`
`).join(`
> `)),
p
);
}),
r.subParser("makeMarkdown.codeBlock", function (l, w) {
var p = l.getAttribute("language"),
_ = l.getAttribute("precodenum");
return (
"```" +
p +
`
` +
w.preList[_] +
"\n```"
);
}),
r.subParser("makeMarkdown.codeSpan", function (l) {
return "`" + l.innerHTML + "`";
}),
r.subParser("makeMarkdown.emphasis", function (l, w) {
var p = "";
if (l.hasChildNodes()) {
p += "*";
for (var _ = l.childNodes, $ = _.length, R = 0; R < $; ++R)
p += r.subParser("makeMarkdown.node")(_[R], w);
p += "*";
}
return p;
}),
r.subParser("makeMarkdown.header", function (l, w, p) {
var _ = new Array(p + 1).join("#"),
$ = "";
if (l.hasChildNodes()) {
$ = _ + " ";
for (var R = l.childNodes, L = R.length, E = 0; E < L; ++E)
$ += r.subParser("makeMarkdown.node")(R[E], w);
}
return $;
}),
r.subParser("makeMarkdown.hr", function () {
return "---";
}),
r.subParser("makeMarkdown.image", function (l) {
var w = "";
return (
l.hasAttribute("src") &&
((w += "![" + l.getAttribute("alt") + "]("),
(w += "<" + l.getAttribute("src") + ">"),
l.hasAttribute("width") &&
l.hasAttribute("height") &&
(w +=
" =" +
l.getAttribute("width") +
"x" +
l.getAttribute("height")),
l.hasAttribute("title") &&
(w += ' "' + l.getAttribute("title") + '"'),
(w += ")")),
w
);
}),
r.subParser("makeMarkdown.links", function (l, w) {
var p = "";
if (l.hasChildNodes() && l.hasAttribute("href")) {
var _ = l.childNodes,
$ = _.length;
p = "[";
for (var R = 0; R < $; ++R)
p += r.subParser("makeMarkdown.node")(_[R], w);
(p += "]("),
(p += "<" + l.getAttribute("href") + ">"),
l.hasAttribute("title") &&
(p += ' "' + l.getAttribute("title") + '"'),
(p += ")");
}
return p;
}),
r.subParser("makeMarkdown.list", function (l, w, p) {
var _ = "";
if (!l.hasChildNodes()) return "";
for (
var $ = l.childNodes,
R = $.length,
L = l.getAttribute("start") || 1,
E = 0;
E < R;
++E
)
if (
!(
typeof $[E].tagName > "u" ||
$[E].tagName.toLowerCase() !== "li"
)
) {
var x = "";
p === "ol" ? (x = L.toString() + ". ") : (x = "- "),
(_ += x + r.subParser("makeMarkdown.listItem")($[E], w)),
++L;
}
return (
(_ += `
<!-- -->
`),
_.trim()
);
}),
r.subParser("makeMarkdown.listItem", function (l, w) {
for (
var p = "", _ = l.childNodes, $ = _.length, R = 0;
R < $;
++R
)
p += r.subParser("makeMarkdown.node")(_[R], w);
return (
/\n$/.test(p)
? (p = p
.split(
`
`
)
.join(
`
`
)
.replace(/^ {4}$/gm, "")
.replace(
/\n\n+/g,
`
`
))
: (p += `
`),
p
);
}),
r.subParser("makeMarkdown.node", function (l, w, p) {
p = p || !1;
var _ = "";
if (l.nodeType === 3)
return r.subParser("makeMarkdown.txt")(l, w);
if (l.nodeType === 8)
return (
"<!--" +
l.data +
`-->
`
);
if (l.nodeType !== 1) return "";
var $ = l.tagName.toLowerCase();
switch ($) {
case "h1":
p ||
(_ =
r.subParser("makeMarkdown.header")(l, w, 1) +
`
`);
break;
case "h2":
p ||
(_ =
r.subParser("makeMarkdown.header")(l, w, 2) +
`
`);
break;
case "h3":
p ||
(_ =
r.subParser("makeMarkdown.header")(l, w, 3) +
`
`);
break;
case "h4":
p ||
(_ =
r.subParser("makeMarkdown.header")(l, w, 4) +
`
`);
break;
case "h5":
p ||
(_ =
r.subParser("makeMarkdown.header")(l, w, 5) +
`
`);
break;
case "h6":
p ||
(_ =
r.subParser("makeMarkdown.header")(l, w, 6) +
`
`);
break;
case "p":
p ||
(_ =
r.subParser("makeMarkdown.paragraph")(l, w) +
`
`);
break;
case "blockquote":
p ||
(_ =
r.subParser("makeMarkdown.blockquote")(l, w) +
`
`);
break;
case "hr":
p ||
(_ =
r.subParser("makeMarkdown.hr")(l, w) +
`
`);
break;
case "ol":
p ||
(_ =
r.subParser("makeMarkdown.list")(l, w, "ol") +
`
`);
break;
case "ul":
p ||
(_ =
r.subParser("makeMarkdown.list")(l, w, "ul") +
`
`);
break;
case "precode":
p ||
(_ =
r.subParser("makeMarkdown.codeBlock")(l, w) +
`
`);
break;
case "pre":
p ||
(_ =
r.subParser("makeMarkdown.pre")(l, w) +
`
`);
break;
case "table":
p ||
(_ =
r.subParser("makeMarkdown.table")(l, w) +
`
`);
break;
case "code":
_ = r.subParser("makeMarkdown.codeSpan")(l, w);
break;
case "em":
case "i":
_ = r.subParser("makeMarkdown.emphasis")(l, w);
break;
case "strong":
case "b":
_ = r.subParser("makeMarkdown.strong")(l, w);
break;
case "del":
_ = r.subParser("makeMarkdown.strikethrough")(l, w);
break;
case "a":
_ = r.subParser("makeMarkdown.links")(l, w);
break;
case "img":
_ = r.subParser("makeMarkdown.image")(l, w);
break;
default:
_ =
l.outerHTML +
`
`;
}
return _;
}),
r.subParser("makeMarkdown.paragraph", function (l, w) {
var p = "";
if (l.hasChildNodes())
for (var _ = l.childNodes, $ = _.length, R = 0; R < $; ++R)
p += r.subParser("makeMarkdown.node")(_[R], w);
return (p = p.trim()), p;
}),
r.subParser("makeMarkdown.pre", function (l, w) {
var p = l.getAttribute("prenum");
return "<pre>" + w.preList[p] + "</pre>";
}),
r.subParser("makeMarkdown.strikethrough", function (l, w) {
var p = "";
if (l.hasChildNodes()) {
p += "~~";
for (var _ = l.childNodes, $ = _.length, R = 0; R < $; ++R)
p += r.subParser("makeMarkdown.node")(_[R], w);
p += "~~";
}
return p;
}),
r.subParser("makeMarkdown.strong", function (l, w) {
var p = "";
if (l.hasChildNodes()) {
p += "**";
for (var _ = l.childNodes, $ = _.length, R = 0; R < $; ++R)
p += r.subParser("makeMarkdown.node")(_[R], w);
p += "**";
}
return p;
}),
r.subParser("makeMarkdown.table", function (l, w) {
var p = "",
_ = [[], []],
$ = l.querySelectorAll("thead>tr>th"),
R = l.querySelectorAll("tbody>tr"),
L,
E;
for (L = 0; L < $.length; ++L) {
var x = r.subParser("makeMarkdown.tableCell")($[L], w),
z = "---";
if ($[L].hasAttribute("style")) {
var q = $[L].getAttribute("style")
.toLowerCase()
.replace(/\s/g, "");
switch (q) {
case "text-align:left;":
z = ":---";
break;
case "text-align:right;":
z = "---:";
break;
case "text-align:center;":
z = ":---:";
break;
}
}
(_[0][L] = x.trim()), (_[1][L] = z);
}
for (L = 0; L < R.length; ++L) {
var I = _.push([]) - 1,
S = R[L].getElementsByTagName("td");
for (E = 0; E < $.length; ++E) {
var D = " ";
typeof S[E] < "u" &&
(D = r.subParser("makeMarkdown.tableCell")(S[E], w)),
_[I].push(D);
}
}
var K = 3;
for (L = 0; L < _.length; ++L)
for (E = 0; E < _[L].length; ++E) {
var W = _[L][E].length;
W > K && (K = W);
}
for (L = 0; L < _.length; ++L) {
for (E = 0; E < _[L].length; ++E)
L === 1
? _[L][E].slice(-1) === ":"
? (_[L][E] =
r.helper.padEnd(_[L][E].slice(-1), K - 1, "-") + ":")
: (_[L][E] = r.helper.padEnd(_[L][E], K, "-"))
: (_[L][E] = r.helper.padEnd(_[L][E], K));
p +=
"| " +
_[L].join(" | ") +
` |
`;
}
return p.trim();
}),
r.subParser("makeMarkdown.tableCell", function (l, w) {
var p = "";
if (!l.hasChildNodes()) return "";
for (var _ = l.childNodes, $ = _.length, R = 0; R < $; ++R)
p += r.subParser("makeMarkdown.node")(_[R], w, !0);
return p.trim();
}),
r.subParser("makeMarkdown.txt", function (l) {
var w = l.nodeValue;
return (
(w = w.replace(/ +/g, " ")),
(w = w.replace(/¨NBSP;/g, " ")),
(w = r.helper.unescapeHTMLEntities(w)),
(w = w.replace(/([*_~|`])/g, "\\$1")),
(w = w.replace(/^(\s*)>/g, "\\$1>")),
(w = w.replace(/^#/gm, "\\#")),
(w = w.replace(/^(\s*)([-=]{3,})(\s*)$/, "$1\\$2$3")),
(w = w.replace(/^( {0,3}\d+)\./gm, "$1\\.")),
(w = w.replace(/^( {0,3})([+-])/gm, "$1\\$2")),
(w = w.replace(/]([\s]*)\(/g, "\\]$1\\(")),
(w = w.replace(/^ {0,3}\[([\S \t]*?)]:/gm, "\\[$1]:")),
w
);
});
var N = this;
e.exports ? (e.exports = r) : (N.showdown = r);
}).call(I0);
})(O0);
var EE = O0.exports;
const kE = _E(EE);
function Xh(e) {
for (let t of e.tags)
if (t[0] === "e" && (t[3] === "root" || t[3] === "reply")) return !1;
return !0;
}
function ea(e) {
var r, o, s;
let t, n;
return (
e.kind == 30023
? ((t =
((r =
e == null ? void 0 : e.tags.find(([c]) => c === "title")) ==
null
? void 0
: r[1]) || "No title"),
(n =
((o =
e == null ? void 0 : e.tags.find(([c]) => c === "summary")) ==
null
? void 0
: o[1]) || void 0))
: ((t =
"Note of " +
new Intl.DateTimeFormat("en-US", {
day: "2-digit",
month: "long",
year: "numeric",
}).format(new Date(e.created_at * 1e3))),
(n = e.content.slice(0, 200) + "...")),
{
id: e.id,
kind: e.kind,
created_at: e.created_at,
title: t,
image:
((s = e == null ? void 0 : e.tags.find(([c]) => c === "image")) ==
null
? void 0
: s[1]) || void 0,
summary: n,
content: e.content,
}
);
}
async function N0(e) {
let t;
if (/^(nprofile|npub)/.test(e))
try {
const { type: r, data: o } = g0.decode(e);
r === "npub" ? (t = o) : r === "nprofile" && (t = o.pubkey);
} catch (r) {
return console.error("Failed to decode npub:", r), null;
}
else if (e.length === 64) t = e;
else return console.error("Invalid code format"), null;
const { relays: n } = Fa();
return new Promise((r, o) => {
let s = pa.subscribeMany(
n,
[{ kinds: [0], authors: [t], limit: 1 }],
{
onevent(c) {
s.close(), r(c);
},
onerror(c) {
console.error(`Subscription error: ${c}`), s.close(), o(c);
},
}
);
});
}
async function R0(e) {
if (e == null) return;
const t = /nostr:(npub1\w+|nprofile1\w+)/g,
r = (e.match(t) || []).map(async (c) => {
try {
const f = await N0(c.slice(6));
if (f) {
const h = JSON.parse(f.content).name || c.slice(0, 24);
return { match: c, replacement: `[${h}](${c})` };
} else return { match: c, replacement: c };
} catch (f) {
return (
console.error("Failed to fetch profile:", f),
{ match: c, replacement: c }
);
}
}),
o = await Promise.all(r);
let s = e;
return (
o.forEach(({ match: c, replacement: f }) => {
s = s.replace(c, f);
}),
s
);
}
function z0(e) {
if (e == null) return;
const t =
/(^|\s|\n|\()(nevent1\w+|note1\w+|npub1\w+|nprofile1\w+)(?=\s|\n|\)|$)/gm;
e = e.replace(t, (o, s, c) => (c.slice(0, 24), `${s}nostr:${c}`));
const n =
/(^|\s|\n)nostr:(nevent1\w+|note1\w+|npub1\w+|nprofile1\w+)(?=\s|\n|$)/gm;
e = e.replace(n, (o, s, c) => {
const f = c.slice(0, 24);
return `${s}[${f}...](nostr:${c})`;
});
const r = /\(nostr:([a-zA-Z0-9]+)\)/g;
return (e = e.replace(r, (o, s) => `(https://njump.me/${s})`)), e;
}
function AE(e) {
if (e == null) return;
const t = /\[([^\]]+)\]\(([^)]+)\)/g;
return e.replace(t, (r, o) => o);
}
function SE(e) {
if (e == null) return;
const t = /\s*(https?:\/\/\S+\.(?:png|jpg|jpeg|gif|bmp))\s*/gi;
return e.replace(t, (r, o) => ` ![Image](${o}) `);
}
function $E(e) {
if (e == null) return;
const t = /\s*(https?:\/\/\S+\.(?:mp4|webm|ogg|mov))(\s*|$)/gi;
return e.replace(
t,
(r, o) =>
` <video controls><source src="${o}" type="video/mp4"></video> `
);
}
function xE(e) {
const t = /\s*(https?:\/\/\S+\.(?:mp3))(\s*|$)/gi;
return e.replace(t, (r, o) => ` <audio controls src="${o}"></audio> `);
}
function TE(e) {
return e == null
? void 0
: ([
{ regex: /<<|»/g, replacement: "&laquo;" },
{ regex: />>|«/g, replacement: "&raquo;" },
{ regex: /\.\.\./g, replacement: "&hellip;" },
{ regex: /---/g, replacement: "&mdash;" },
{ regex: /--/g, replacement: "&mdash;" },
].forEach(({ regex: n, replacement: r }) => {
e = e.replace(n, r);
}),
e);
}
async function U0(e) {
let t = e.content;
return (
(t = await R0(t)),
(t = z0(t)),
(t = SE(t)),
(t = $E(t)),
(t = xE(t)),
(t = TE(t)),
e.kind == 1 &&
(t = t.replace(
/\n/g,
`
<br/>`
)),
(t = t.replace("# " + e.title, "")),
(t = new kE.Converter({
simplifiedAutoLink: !0,
tables: !0,
strikethrough: !0,
}).makeHtml(t)),
t
);
}
function Yr(e, t = !1) {
const n = new Date(e * 1e3),
r = { day: "2-digit", month: "long", year: "numeric" },
o = new Intl.DateTimeFormat("en-US", r).formatToParts(n);
let s, c, f;
o.forEach((h) => {
h.type === "day" && (s = h.value),
h.type === "month" && (c = h.value),
h.type === "year" && (f = h.value);
});
let d = `${s} ${c} ${f}`;
if (t) {
const h = { hour: "2-digit", minute: "2-digit", hourCycle: "h23" },
m = new Intl.DateTimeFormat("en-US", h).format(n);
d += ` - ${m}`;
}
return d;
}
const ga = Gv("");
function bi(...e) {
return e.filter(Boolean).join(" ");
}
function PE(e, t) {
if (e) {
const n = Object.keys(e);
for (let r = 0; r < n.length; r++) {
const o = n[r];
if (o !== "__proto__" && t(e[o], o) === !1) break;
}
}
return e;
}
function Qh(e) {
var n;
const t =
(n = e.Components.Elements) == null ? void 0 : n.list.children;
return (t && Array.prototype.slice.call(t)) || [];
}
function wa(e) {
return e !== null && typeof e == "object";
}
function wl(e, t) {
if (Array.isArray(e) && Array.isArray(t))
return e.length === t.length && !e.some((n, r) => !wl(n, t[r]));
if (wa(e) && wa(t)) {
const n = Object.keys(e),
r = Object.keys(t);
return (
n.length === r.length &&
!n.some(
(o) =>
!Object.prototype.hasOwnProperty.call(t, o) || !wl(e[o], t[o])
)
);
}
return e === t;
}
function LE(e, t) {
return e.length === t.length && !e.some((n, r) => n !== t[r]);
}
function ml(e, t) {
const n = e;
return (
PE(t, (r, o) => {
Array.isArray(r)
? (n[o] = r.slice())
: wa(r)
? (n[o] = ml(wa(n[o]) ? n[o] : {}, r))
: (n[o] = r);
}),
n
);
}
function BE(e, t) {
for (var n = 0; n < t.length; n++) {
var r = t[n];
(r.enumerable = r.enumerable || !1),
(r.configurable = !0),
"value" in r && (r.writable = !0),
Object.defineProperty(e, r.key, r);
}
}
function CE(e, t, n) {
return (
t && BE(e.prototype, t),
Object.defineProperty(e, "prototype", { writable: !1 }),
e
);
}
/*!
* Splide.js
* Version : 4.1.4
* License : MIT
* Copyright: 2022 Naotoshi Fujita
*/ var ep = "(prefers-reduced-motion: reduce)",
oi = 1,
IE = 2,
yi = 3,
Bi = 4,
bs = 5,
ta = 6,
ma = 7,
OE = {
CREATED: oi,
MOUNTED: IE,
IDLE: yi,
MOVING: Bi,
SCROLLING: bs,
DRAGGING: ta,
DESTROYED: ma,
};
function cr(e) {
e.length = 0;
}
function ao(e, t, n) {
return Array.prototype.slice.call(e, t, n);
}
function Qe(e) {
return e.bind.apply(e, [null].concat(ao(arguments, 1)));
}
var M0 = setTimeout,
bl = function () {};
function tp(e) {
return requestAnimationFrame(e);
}
function ic(e, t) {
return typeof t === e;
}
function is(e) {
return !Ed(e) && ic("object", e);
}
var _d = Array.isArray,
H0 = Qe(ic, "function"),
Jr = Qe(ic, "string"),
ys = Qe(ic, "undefined");
function Ed(e) {
return e === null;
}
function j0(e) {
try {
return (
e instanceof (e.ownerDocument.defaultView || window).HTMLElement
);
} catch {
return !1;
}
}
function vs(e) {
return _d(e) ? e : [e];
}
function dn(e, t) {
vs(e).forEach(t);
}
function kd(e, t) {
return e.indexOf(t) > -1;
}
function na(e, t) {
return e.push.apply(e, vs(t)), e;
}
function rr(e, t, n) {
e &&
dn(t, function (r) {
r && e.classList[n ? "add" : "remove"](r);
});
}
function Un(e, t) {
rr(e, Jr(t) ? t.split(" ") : t, !0);
}
function _s(e, t) {
dn(t, e.appendChild.bind(e));
}
function Ad(e, t) {
dn(e, function (n) {
var r = (t || n).parentNode;
r && r.insertBefore(n, t);
});
}
function ss(e, t) {
return j0(e) && (e.msMatchesSelector || e.matches).call(e, t);
}
function D0(e, t) {
var n = e ? ao(e.children) : [];
return t
? n.filter(function (r) {
return ss(r, t);
})
: n;
}
function Es(e, t) {
return t ? D0(e, t)[0] : e.firstElementChild;
}
var as = Object.keys;
function Lo(e, t, n) {
return (
e &&
(n ? as(e).reverse() : as(e)).forEach(function (r) {
r !== "__proto__" && t(e[r], r);
}),
e
);
}
function cs(e) {
return (
ao(arguments, 1).forEach(function (t) {
Lo(t, function (n, r) {
e[r] = t[r];
});
}),
e
);
}
function qr(e) {
return (
ao(arguments, 1).forEach(function (t) {
Lo(t, function (n, r) {
_d(n)
? (e[r] = n.slice())
: is(n)
? (e[r] = qr({}, is(e[r]) ? e[r] : {}, n))
: (e[r] = n);
});
}),
e
);
}
function np(e, t) {
dn(t || as(e), function (n) {
delete e[n];
});
}
function Mn(e, t) {
dn(e, function (n) {
dn(t, function (r) {
n && n.removeAttribute(r);
});
});
}
function Ue(e, t, n) {
is(t)
? Lo(t, function (r, o) {
Ue(e, o, r);
})
: dn(e, function (r) {
Ed(n) || n === "" ? Mn(r, t) : r.setAttribute(t, String(n));
});
}
function ai(e, t, n) {
var r = document.createElement(e);
return t && (Jr(t) ? Un(r, t) : Ue(r, t)), n && _s(n, r), r;
}
function pn(e, t, n) {
if (ys(n)) return getComputedStyle(e)[t];
Ed(n) || (e.style[t] = "" + n);
}
function us(e, t) {
pn(e, "display", t);
}
function q0(e) {
(e.setActive && e.setActive()) || e.focus({ preventScroll: !0 });
}
function wn(e, t) {
return e.getAttribute(t);
}
function rp(e, t) {
return e && e.classList.contains(t);
}
function sn(e) {
return e.getBoundingClientRect();
}
function Io(e) {
dn(e, function (t) {
t && t.parentNode && t.parentNode.removeChild(t);
});
}
function V0(e) {
return Es(new DOMParser().parseFromString(e, "text/html").body);
}
function Xn(e, t) {
e.preventDefault(),
t && (e.stopPropagation(), e.stopImmediatePropagation());
}
function F0(e, t) {
return e && e.querySelector(t);
}
function Sd(e, t) {
return t ? ao(e.querySelectorAll(t)) : [];
}
function or(e, t) {
rr(e, t, !1);
}
function yl(e) {
return e.timeStamp;
}
function _o(e) {
return Jr(e) ? e : e ? e + "px" : "";
}
var ks = "splide",
$d = "data-" + ks;
function Xi(e, t) {
if (!e) throw new Error("[" + ks + "] " + (t || ""));
}
var Xr = Math.min,
ba = Math.max,
ya = Math.floor,
ls = Math.ceil,
qt = Math.abs;
function K0(e, t, n) {
return qt(e - t) < n;
}
function ra(e, t, n, r) {
var o = Xr(t, n),
s = ba(t, n);
return r ? o < e && e < s : o <= e && e <= s;
}
function ei(e, t, n) {
var r = Xr(t, n),
o = ba(t, n);
return Xr(ba(r, e), o);
}
function vl(e) {
return +(e > 0) - +(e < 0);
}
function _l(e, t) {
return (
dn(t, function (n) {
e = e.replace("%s", "" + n);
}),
e
);
}
function xd(e) {
return e < 10 ? "0" + e : "" + e;
}
var op = {};
function NE(e) {
return "" + e + xd((op[e] = (op[e] || 0) + 1));
}
function W0() {
var e = [];
function t(c, f, d, h) {
o(c, f, function (y, m, v) {
var P = "addEventListener" in y,
C = P
? y.removeEventListener.bind(y, m, d, h)
: y.removeListener.bind(y, d);
P ? y.addEventListener(m, d, h) : y.addListener(d),
e.push([y, m, v, d, C]);
});
}
function n(c, f, d) {
o(c, f, function (h, y, m) {
e = e.filter(function (v) {
return v[0] === h &&
v[1] === y &&
v[2] === m &&
(!d || v[3] === d)
? (v[4](), !1)
: !0;
});
});
}
function r(c, f, d) {
var h,
y = !0;
return (
typeof CustomEvent == "function"
? (h = new CustomEvent(f, { bubbles: y, detail: d }))
: ((h = document.createEvent("CustomEvent")),
h.initCustomEvent(f, y, !1, d)),
c.dispatchEvent(h),
h
);
}
function o(c, f, d) {
dn(c, function (h) {
h &&
dn(f, function (y) {
y.split(" ").forEach(function (m) {
var v = m.split(".");
d(h, v[0], v[1]);
});
});
});
}
function s() {
e.forEach(function (c) {
c[4]();
}),
cr(e);
}
return { bind: t, unbind: n, dispatch: r, destroy: s };
}
var co = "mounted",
ip = "ready",
Hn = "move",
Oo = "moved",
va = "click",
El = "active",
kl = "inactive",
Al = "visible",
Sl = "hidden",
ft = "refresh",
Ot = "updated",
vi = "resize",
sc = "resized",
G0 = "drag",
Z0 = "dragging",
Y0 = "dragged",
ac = "scroll",
Mo = "scrolled",
RE = "overflow",
Td = "destroy",
$l = "arrows:mounted",
xl = "arrows:updated",
Tl = "pagination:mounted",
Pl = "pagination:updated",
_a = "navigation:mounted",
Pd = "autoplay:play",
Ll = "autoplay:playing",
Ld = "autoplay:pause",
Ea = "lazyload:loaded",
J0 = "sk",
X0 = "sh",
ka = "ei";
function tt(e) {
var t = e ? e.event.bus : document.createDocumentFragment(),
n = W0();
function r(s, c) {
n.bind(t, vs(s).join(" "), function (f) {
c.apply(c, _d(f.detail) ? f.detail : []);
});
}
function o(s) {
n.dispatch(t, s, ao(arguments, 1));
}
return (
e && e.event.on(Td, n.destroy),
cs(n, { bus: t, on: r, off: Qe(n.unbind, t), emit: o })
);
}
function cc(e, t, n, r) {
var o = Date.now,
s,
c = 0,
f,
d = !0,
h = 0;
function y() {
if (!d) {
if (
((c = e ? Xr((o() - s) / e, 1) : 1),
n && n(c),
c >= 1 && (t(), (s = o()), r && ++h >= r))
)
return v();
f = tp(y);
}
}
function m(M) {
M || C(), (s = o() - (M ? c * e : 0)), (d = !1), (f = tp(y));
}
function v() {
d = !0;
}
function P() {
(s = o()), (c = 0), n && n(c);
}
function C() {
f && cancelAnimationFrame(f), (c = 0), (f = 0), (d = !0);
}
function A(M) {
e = M;
}
function O() {
return d;
}
return {
start: m,
rewind: P,
pause: v,
cancel: C,
set: A,
isPaused: O,
};
}
function zE(e) {
var t = e;
function n(o) {
t = o;
}
function r(o) {
return kd(vs(o), t);
}
return { set: n, is: r };
}
function UE(e, t) {
var n = cc(0, e, null, 1);
return function () {
n.isPaused() && n.start();
};
}
function ME(e, t, n) {
var r = e.state,
o = n.breakpoints || {},
s = n.reducedMotion || {},
c = W0(),
f = [];
function d() {
var C = n.mediaQuery === "min";
as(o)
.sort(function (A, O) {
return C ? +A - +O : +O - +A;
})
.forEach(function (A) {
y(o[A], "(" + (C ? "min" : "max") + "-width:" + A + "px)");
}),
y(s, ep),
m();
}
function h(C) {
C && c.destroy();
}
function y(C, A) {
var O = matchMedia(A);
c.bind(O, "change", m), f.push([C, O]);
}
function m() {
var C = r.is(ma),
A = n.direction,
O = f.reduce(function (M, T) {
return qr(M, T[1].matches ? T[0] : {});
}, {});
np(n),
P(O),
n.destroy
? e.destroy(n.destroy === "completely")
: C
? (h(!0), e.mount())
: A !== n.direction && e.refresh();
}
function v(C) {
matchMedia(ep).matches && (C ? qr(n, s) : np(n, as(s)));
}
function P(C, A, O) {
qr(n, C),
A && qr(Object.getPrototypeOf(n), C),
(O || !r.is(oi)) && e.emit(Ot, n);
}
return { setup: d, destroy: h, reduce: v, set: P };
}
var uc = "Arrow",
lc = uc + "Left",
dc = uc + "Right",
Q0 = uc + "Up",
ew = uc + "Down",
sp = "rtl",
fc = "ttb",
Iu = {
width: ["height"],
left: ["top", "right"],
right: ["bottom", "left"],
x: ["y"],
X: ["Y"],
Y: ["X"],
ArrowLeft: [Q0, dc],
ArrowRight: [ew, lc],
};
function HE(e, t, n) {
function r(s, c, f) {
f = f || n.direction;
var d = f === sp && !c ? 1 : f === fc ? 0 : -1;
return (
(Iu[s] && Iu[s][d]) ||
s.replace(/width|left|right/i, function (h, y) {
var m = Iu[h.toLowerCase()][d] || h;
return y > 0 ? m.charAt(0).toUpperCase() + m.slice(1) : m;
})
);
}
function o(s) {
return s * (n.direction === sp ? 1 : -1);
}
return { resolve: r, orient: o };
}
var ir = "role",
ci = "tabindex",
jE = "disabled",
vn = "aria-",
As = vn + "controls",
tw = vn + "current",
ap = vn + "selected",
ln = vn + "label",
Bd = vn + "labelledby",
nw = vn + "hidden",
Cd = vn + "orientation",
ds = vn + "roledescription",
cp = vn + "live",
up = vn + "busy",
lp = vn + "atomic",
Id = [ir, ci, jE, As, tw, ln, Bd, nw, Cd, ds],
Vn = ks + "__",
uo = "is-",
Ou = ks,
dp = Vn + "track",
DE = Vn + "list",
hc = Vn + "slide",
rw = hc + "--clone",
qE = hc + "__container",
Od = Vn + "arrows",
pc = Vn + "arrow",
ow = pc + "--prev",
iw = pc + "--next",
gc = Vn + "pagination",
sw = gc + "__page",
VE = Vn + "progress",
FE = VE + "__bar",
KE = Vn + "toggle",
WE = Vn + "spinner",
GE = Vn + "sr",
ZE = uo + "initialized",
No = uo + "active",
aw = uo + "prev",
cw = uo + "next",
Bl = uo + "visible",
Cl = uo + "loading",
uw = uo + "focus-in",
lw = uo + "overflow",
YE = [No, Bl, aw, cw, Cl, uw, lw],
JE = {
slide: hc,
clone: rw,
arrows: Od,
arrow: pc,
prev: ow,
next: iw,
pagination: gc,
page: sw,
spinner: WE,
};
function XE(e, t) {
if (H0(e.closest)) return e.closest(t);
for (var n = e; n && n.nodeType === 1 && !ss(n, t); )
n = n.parentElement;
return n;
}
var QE = 5,
fp = 200,
dw = "touchstart mousedown",
Nu = "touchmove mousemove",
Ru = "touchend touchcancel mouseup click";
function e4(e, t, n) {
var r = tt(e),
o = r.on,
s = r.bind,
c = e.root,
f = n.i18n,
d = {},
h = [],
y = [],
m = [],
v,
P,
C;
function A() {
N(), l(), T();
}
function O() {
o(ft, M),
o(ft, A),
o(Ot, T),
s(
document,
dw + " keydown",
function (_) {
C = _.type === "keydown";
},
{ capture: !0 }
),
s(c, "focusin", function () {
rr(c, uw, !!C);
});
}
function M(_) {
var $ = Id.concat("style");
cr(h),
or(c, y),
or(v, m),
Mn([v, P], $),
Mn(c, _ ? $ : ["style", ds]);
}
function T() {
or(c, y),
or(v, m),
(y = p(Ou)),
(m = p(dp)),
Un(c, y),
Un(v, m),
Ue(c, ln, n.label),
Ue(c, Bd, n.labelledby);
}
function N() {
(v = w("." + dp)),
(P = Es(v, "." + DE)),
Xi(v && P, "A track/list element is missing."),
na(h, D0(P, "." + hc + ":not(." + rw + ")")),
Lo(
{
arrows: Od,
pagination: gc,
prev: ow,
next: iw,
bar: FE,
toggle: KE,
},
function (_, $) {
d[$] = w("." + _);
}
),
cs(d, { root: c, track: v, list: P, slides: h });
}
function l() {
var _ = c.id || NE(ks),
$ = n.role;
(c.id = _),
(v.id = v.id || _ + "-track"),
(P.id = P.id || _ + "-list"),
!wn(c, ir) && c.tagName !== "SECTION" && $ && Ue(c, ir, $),
Ue(c, ds, f.carousel),
Ue(P, ir, "presentation");
}
function w(_) {
var $ = F0(c, _);
return $ && XE($, "." + Ou) === c ? $ : void 0;
}
function p(_) {
return [
_ + "--" + n.type,
_ + "--" + n.direction,
n.drag && _ + "--draggable",
n.isNavigation && _ + "--nav",
_ === Ou && No,
];
}
return cs(d, { setup: A, mount: O, destroy: M });
}
var _i = "slide",
Ci = "loop",
Ss = "fade";
function t4(e, t, n, r) {
var o = tt(e),
s = o.on,
c = o.emit,
f = o.bind,
d = e.Components,
h = e.root,
y = e.options,
m = y.isNavigation,
v = y.updateOnMove,
P = y.i18n,
C = y.pagination,
A = y.slideFocus,
O = d.Direction.resolve,
M = wn(r, "style"),
T = wn(r, ln),
N = n > -1,
l = Es(r, "." + qE),
w;
function p() {
N ||
((r.id = h.id + "-slide" + xd(t + 1)),
Ue(r, ir, C ? "tabpanel" : "group"),
Ue(r, ds, P.slide),
Ue(r, ln, T || _l(P.slideLabel, [t + 1, e.length]))),
_();
}
function _() {
f(r, "click", Qe(c, va, K)),
f(r, "keydown", Qe(c, J0, K)),
s([Oo, X0, Mo], E),
s(_a, R),
v && s(Hn, L);
}
function $() {
(w = !0),
o.destroy(),
or(r, YE),
Mn(r, Id),
Ue(r, "style", M),
Ue(r, ln, T || "");
}
function R() {
var W = e.splides
.map(function (Z) {
var G = Z.splide.Components.Slides.getAt(t);
return G ? G.slide.id : "";
})
.join(" ");
Ue(r, ln, _l(P.slideX, (N ? n : t) + 1)),
Ue(r, As, W),
Ue(r, ir, A ? "button" : ""),
A && Mn(r, ds);
}
function L() {
w || E();
}
function E() {
if (!w) {
var W = e.index;
x(), z(), rr(r, aw, t === W - 1), rr(r, cw, t === W + 1);
}
}
function x() {
var W = I();
W !== rp(r, No) &&
(rr(r, No, W), Ue(r, tw, (m && W) || ""), c(W ? El : kl, K));
}
function z() {
var W = S(),
Z = !W && (!I() || N);
if (
(e.state.is([Bi, bs]) || Ue(r, nw, Z || ""),
Ue(Sd(r, y.focusableNodes || ""), ci, Z ? -1 : ""),
A && Ue(r, ci, Z ? -1 : 0),
W !== rp(r, Bl) && (rr(r, Bl, W), c(W ? Al : Sl, K)),
!W && document.activeElement === r)
) {
var G = d.Slides.getAt(e.index);
G && q0(G.slide);
}
}
function q(W, Z, G) {
pn((G && l) || r, W, Z);
}
function I() {
var W = e.index;
return W === t || (y.cloneStatus && W === n);
}
function S() {
if (e.is(Ss)) return I();
var W = sn(d.Elements.track),
Z = sn(r),
G = O("left", !0),
oe = O("right", !0);
return ya(W[G]) <= ls(Z[G]) && ya(Z[oe]) <= ls(W[oe]);
}
function D(W, Z) {
var G = qt(W - t);
return (
!N && (y.rewind || e.is(Ci)) && (G = Xr(G, e.length - G)), G <= Z
);
}
var K = {
index: t,
slideIndex: n,
slide: r,
container: l,
isClone: N,
mount: p,
destroy: $,
update: E,
style: q,
isWithin: D,
};
return K;
}
function n4(e, t, n) {
var r = tt(e),
o = r.on,
s = r.emit,
c = r.bind,
f = t.Elements,
d = f.slides,
h = f.list,
y = [];
function m() {
v(), o(ft, P), o(ft, v);
}
function v() {
d.forEach(function (E, x) {
A(E, x, -1);
});
}
function P() {
w(function (E) {
E.destroy();
}),
cr(y);
}
function C() {
w(function (E) {
E.update();
});
}
function A(E, x, z) {
var q = t4(e, x, z, E);
q.mount(),
y.push(q),
y.sort(function (I, S) {
return I.index - S.index;
});
}
function O(E) {
return E
? p(function (x) {
return !x.isClone;
})
: y;
}
function M(E) {
var x = t.Controller,
z = x.toIndex(E),
q = x.hasFocus() ? 1 : n.perPage;
return p(function (I) {
return ra(I.index, z, z + q - 1);
});
}
function T(E) {
return p(E)[0];
}
function N(E, x) {
dn(E, function (z) {
if ((Jr(z) && (z = V0(z)), j0(z))) {
var q = d[x];
q ? Ad(z, q) : _s(h, z), Un(z, n.classes.slide), $(z, Qe(s, vi));
}
}),
s(ft);
}
function l(E) {
Io(
p(E).map(function (x) {
return x.slide;
})
),
s(ft);
}
function w(E, x) {
O(x).forEach(E);
}
function p(E) {
return y.filter(
H0(E)
? E
: function (x) {
return Jr(E) ? ss(x.slide, E) : kd(vs(E), x.index);
}
);
}
function _(E, x, z) {
w(function (q) {
q.style(E, x, z);
});
}
function $(E, x) {
var z = Sd(E, "img"),
q = z.length;
q
? z.forEach(function (I) {
c(I, "load error", function () {
--q || x();
});
})
: x();
}
function R(E) {
return E ? d.length : y.length;
}
function L() {
return y.length > n.perPage;
}
return {
mount: m,
destroy: P,
update: C,
register: A,
get: O,
getIn: M,
getAt: T,
add: N,
remove: l,
forEach: w,
filter: p,
style: _,
getLength: R,
isEnough: L,
};
}
function r4(e, t, n) {
var r = tt(e),
o = r.on,
s = r.bind,
c = r.emit,
f = t.Slides,
d = t.Direction.resolve,
h = t.Elements,
y = h.root,
m = h.track,
v = h.list,
P = f.getAt,
C = f.style,
A,
O,
M;
function T() {
N(),
s(window, "resize load", UE(Qe(c, vi))),
o([Ot, ft], N),
o(vi, l);
}
function N() {
(A = n.direction === fc),
pn(y, "maxWidth", _o(n.width)),
pn(m, d("paddingLeft"), w(!1)),
pn(m, d("paddingRight"), w(!0)),
l(!0);
}
function l(K) {
var W = sn(y);
(K || O.width !== W.width || O.height !== W.height) &&
(pn(m, "height", p()),
C(d("marginRight"), _o(n.gap)),
C("width", $()),
C("height", R(), !0),
(O = W),
c(sc),
M !== (M = D()) && (rr(y, lw, M), c(RE, M)));
}
function w(K) {
var W = n.padding,
Z = d(K ? "right" : "left");
return (W && _o(W[Z] || (is(W) ? 0 : W))) || "0px";
}
function p() {
var K = "";
return (
A &&
((K = _()),
Xi(K, "height or heightRatio is missing."),
(K = "calc(" + K + " - " + w(!1) + " - " + w(!0) + ")")),
K
);
}
function _() {
return _o(n.height || sn(v).width * n.heightRatio);
}
function $() {
return n.autoWidth ? null : _o(n.fixedWidth) || (A ? "" : L());
}
function R() {
return _o(n.fixedHeight) || (A ? (n.autoHeight ? null : L()) : _());
}
function L() {
var K = _o(n.gap);
return (
"calc((100%" +
(K && " + " + K) +
")/" +
(n.perPage || 1) +
(K && " - " + K) +
")"
);
}
function E() {
return sn(v)[d("width")];
}
function x(K, W) {
var Z = P(K || 0);
return Z ? sn(Z.slide)[d("width")] + (W ? 0 : I()) : 0;
}
function z(K, W) {
var Z = P(K);
if (Z) {
var G = sn(Z.slide)[d("right")],
oe = sn(v)[d("left")];
return qt(G - oe) + (W ? 0 : I());
}
return 0;
}
function q(K) {
return z(e.length - 1) - z(0) + x(0, K);
}
function I() {
var K = P(0);
return (K && parseFloat(pn(K.slide, d("marginRight")))) || 0;
}
function S(K) {
return parseFloat(pn(m, d("padding" + (K ? "Right" : "Left")))) || 0;
}
function D() {
return e.is(Ss) || q(!0) > E();
}
return {
mount: T,
resize: l,
listSize: E,
slideSize: x,
sliderSize: q,
totalSize: z,
getPadding: S,
isOverflow: D,
};
}
var o4 = 2;
function i4(e, t, n) {
var r = tt(e),
o = r.on,
s = t.Elements,
c = t.Slides,
f = t.Direction.resolve,
d = [],
h;
function y() {
o(ft, m), o([Ot, vi], P), (h = O()) && (C(h), t.Layout.resize(!0));
}
function m() {
v(), y();
}
function v() {
Io(d), cr(d), r.destroy();
}
function P() {
var M = O();
h !== M && (h < M || !M) && r.emit(ft);
}
function C(M) {
var T = c.get().slice(),
N = T.length;
if (N) {
for (; T.length < M; ) na(T, T);
na(T.slice(-M), T.slice(0, M)).forEach(function (l, w) {
var p = w < M,
_ = A(l.slide, w);
p ? Ad(_, T[0].slide) : _s(s.list, _),
na(d, _),
c.register(_, w - M + (p ? 0 : N), l.index);
});
}
}
function A(M, T) {
var N = M.cloneNode(!0);
return (
Un(N, n.classes.clone), (N.id = e.root.id + "-clone" + xd(T + 1)), N
);
}
function O() {
var M = n.clones;
if (!e.is(Ci)) M = 0;
else if (ys(M)) {
var T = n[f("fixedWidth")] && t.Layout.slideSize(0),
N = T && ls(sn(s.track)[f("width")] / T);
M = N || (n[f("autoWidth")] && e.length) || n.perPage * o4;
}
return M;
}
return { mount: y, destroy: v };
}
function s4(e, t, n) {
var r = tt(e),
o = r.on,
s = r.emit,
c = e.state.set,
f = t.Layout,
d = f.slideSize,
h = f.getPadding,
y = f.totalSize,
m = f.listSize,
v = f.sliderSize,
P = t.Direction,
C = P.resolve,
A = P.orient,
O = t.Elements,
M = O.list,
T = O.track,
N;
function l() {
(N = t.Transition), o([co, sc, Ot, ft], w);
}
function w() {
t.Controller.isBusy() ||
(t.Scroll.cancel(), _(e.index), t.Slides.update());
}
function p(Z, G, oe, he) {
Z !== G && K(Z > oe) && (E(), $(L(q(), Z > oe), !0)),
c(Bi),
s(Hn, G, oe, Z),
N.start(G, function () {
c(yi), s(Oo, G, oe, Z), he && he();
});
}
function _(Z) {
$(z(Z, !0));
}
function $(Z, G) {
if (!e.is(Ss)) {
var oe = G ? Z : R(Z);
pn(M, "transform", "translate" + C("X") + "(" + oe + "px)"),
Z !== oe && s(X0);
}
}
function R(Z) {
if (e.is(Ci)) {
var G = x(Z),
oe = G > t.Controller.getEnd(),
he = G < 0;
(he || oe) && (Z = L(Z, oe));
}
return Z;
}
function L(Z, G) {
var oe = Z - D(G),
he = v();
return (Z -= A(he * (ls(qt(oe) / he) || 1)) * (G ? 1 : -1)), Z;
}
function E() {
$(q(), !0), N.cancel();
}
function x(Z) {
for (
var G = t.Slides.get(), oe = 0, he = 1 / 0, be = 0;
be < G.length;
be++
) {
var Se = G[be].index,
re = qt(z(Se, !0) - Z);
if (re <= he) (he = re), (oe = Se);
else break;
}
return oe;
}
function z(Z, G) {
var oe = A(y(Z - 1) - S(Z));
return G ? I(oe) : oe;
}
function q() {
var Z = C("left");
return sn(M)[Z] - sn(T)[Z] + A(h(!1));
}
function I(Z) {
return n.trimSpace && e.is(_i) && (Z = ei(Z, 0, A(v(!0) - m()))), Z;
}
function S(Z) {
var G = n.focus;
return G === "center" ? (m() - d(Z, !0)) / 2 : +G * d(Z) || 0;
}
function D(Z) {
return z(Z ? t.Controller.getEnd() : 0, !!n.trimSpace);
}
function K(Z) {
var G = A(L(q(), Z));
return Z ? G >= 0 : G <= M[C("scrollWidth")] - sn(T)[C("width")];
}
function W(Z, G) {
G = ys(G) ? q() : G;
var oe = Z !== !0 && A(G) < A(D(!1)),
he = Z !== !1 && A(G) > A(D(!0));
return oe || he;
}
return {
mount: l,
move: p,
jump: _,
translate: $,
shift: L,
cancel: E,
toIndex: x,
toPosition: z,
getPosition: q,
getLimit: D,
exceededLimit: W,
reposition: w,
};
}
function a4(e, t, n) {
var r = tt(e),
o = r.on,
s = r.emit,
c = t.Move,
f = c.getPosition,
d = c.getLimit,
h = c.toPosition,
y = t.Slides,
m = y.isEnough,
v = y.getLength,
P = n.omitEnd,
C = e.is(Ci),
A = e.is(_i),
O = Qe(q, !1),
M = Qe(q, !0),
T = n.start || 0,
N,
l = T,
w,
p,
_;
function $() {
R(), o([Ot, ft, ka], R), o(sc, L);
}
function R() {
(w = v(!0)), (p = n.perMove), (_ = n.perPage), (N = K());
var re = ei(T, 0, P ? N : w - 1);
re !== T && ((T = re), c.reposition());
}
function L() {
N !== K() && s(ka);
}
function E(re, ye, Ce) {
if (!Se()) {
var Oe = z(re),
Me = D(Oe);
Me > -1 && (ye || Me !== T) && (oe(Me), c.move(Oe, Me, l, Ce));
}
}
function x(re, ye, Ce, Oe) {
t.Scroll.scroll(re, ye, Ce, function () {
var Me = D(c.toIndex(f()));
oe(P ? Xr(Me, N) : Me), Oe && Oe();
});
}
function z(re) {
var ye = T;
if (Jr(re)) {
var Ce = re.match(/([+\-<>])(\d+)?/) || [],
Oe = Ce[1],
Me = Ce[2];
Oe === "+" || Oe === "-"
? (ye = I(T + +("" + Oe + (+Me || 1)), T))
: Oe === ">"
? (ye = Me ? W(+Me) : O(!0))
: Oe === "<" && (ye = M(!0));
} else ye = C ? re : ei(re, 0, N);
return ye;
}
function q(re, ye) {
var Ce = p || (be() ? 1 : _),
Oe = I(T + Ce * (re ? -1 : 1), T, !(p || be()));
return Oe === -1 && A && !K0(f(), d(!re), 1)
? re
? 0
: N
: ye
? Oe
: D(Oe);
}
function I(re, ye, Ce) {
if (m() || be()) {
var Oe = S(re);
Oe !== re && ((ye = re), (re = Oe), (Ce = !1)),
re < 0 || re > N
? !p && (ra(0, re, ye, !0) || ra(N, ye, re, !0))
? (re = W(Z(re)))
: C
? (re = Ce ? (re < 0 ? -(w % _ || _) : w) : re)
: n.rewind
? (re = re < 0 ? N : 0)
: (re = -1)
: Ce && re !== ye && (re = W(Z(ye) + (re < ye ? -1 : 1)));
} else re = -1;
return re;
}
function S(re) {
if (A && n.trimSpace === "move" && re !== T)
for (
var ye = f();
ye === h(re, !0) && ra(re, 0, e.length - 1, !n.rewind);
)
re < T ? --re : ++re;
return re;
}
function D(re) {
return C ? (re + w) % w || 0 : re;
}
function K() {
for (var re = w - (be() || (C && p) ? 1 : _); P && re-- > 0; )
if (h(w - 1, !0) !== h(re, !0)) {
re++;
break;
}
return ei(re, 0, w - 1);
}
function W(re) {
return ei(be() ? re : _ * re, 0, N);
}
function Z(re) {
return be() ? Xr(re, N) : ya((re >= N ? w - 1 : re) / _);
}
function G(re) {
var ye = c.toIndex(re);
return A ? ei(ye, 0, N) : ye;
}
function oe(re) {
re !== T && ((l = T), (T = re));
}
function he(re) {
return re ? l : T;
}
function be() {
return !ys(n.focus) || n.isNavigation;
}
function Se() {
return e.state.is([Bi, bs]) && !!n.waitForTransition;
}
return {
mount: $,
go: E,
scroll: x,
getNext: O,
getPrev: M,
getAdjacent: q,
getEnd: K,
setIndex: oe,
getIndex: he,
toIndex: W,
toPage: Z,
toDest: G,
hasFocus: be,
isBusy: Se,
};
}
var c4 = "http://www.w3.org/2000/svg",
u4 =
"m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z",
Ws = 40;
function l4(e, t, n) {
var r = tt(e),
o = r.on,
s = r.bind,
c = r.emit,
f = n.classes,
d = n.i18n,
h = t.Elements,
y = t.Controller,
m = h.arrows,
v = h.track,
P = m,
C = h.prev,
A = h.next,
O,
M,
T = {};
function N() {
w(), o(Ot, l);
}
function l() {
p(), N();
}
function w() {
var x = n.arrows;
x && !(C && A) && R(),
C &&
A &&
(cs(T, { prev: C, next: A }),
us(P, x ? "" : "none"),
Un(P, (M = Od + "--" + n.direction)),
x && (_(), E(), Ue([C, A], As, v.id), c($l, C, A)));
}
function p() {
r.destroy(),
or(P, M),
O ? (Io(m ? [C, A] : P), (C = A = null)) : Mn([C, A], Id);
}
function _() {
o([co, Oo, ft, Mo, ka], E),
s(A, "click", Qe($, ">")),
s(C, "click", Qe($, "<"));
}
function $(x) {
y.go(x, !0);
}
function R() {
(P = m || ai("div", f.arrows)),
(C = L(!0)),
(A = L(!1)),
(O = !0),
_s(P, [C, A]),
!m && Ad(P, v);
}
function L(x) {
var z =
'<button class="' +
f.arrow +
" " +
(x ? f.prev : f.next) +
'" type="button"><svg xmlns="' +
c4 +
'" viewBox="0 0 ' +
Ws +
" " +
Ws +
'" width="' +
Ws +
'" height="' +
Ws +
'" focusable="false"><path d="' +
(n.arrowPath || u4) +
'" />';
return V0(z);
}
function E() {
if (C && A) {
var x = e.index,
z = y.getPrev(),
q = y.getNext(),
I = z > -1 && x < z ? d.last : d.prev,
S = q > -1 && x > q ? d.first : d.next;
(C.disabled = z < 0),
(A.disabled = q < 0),
Ue(C, ln, I),
Ue(A, ln, S),
c(xl, C, A, z, q);
}
}
return { arrows: T, mount: N, destroy: p, update: E };
}
var d4 = $d + "-interval";
function f4(e, t, n) {
var r = tt(e),
o = r.on,
s = r.bind,
c = r.emit,
f = cc(n.interval, e.go.bind(e, ">"), _),
d = f.isPaused,
h = t.Elements,
y = t.Elements,
m = y.root,
v = y.toggle,
P = n.autoplay,
C,
A,
O = P === "pause";
function M() {
P && (T(), v && Ue(v, As, h.track.id), O || N(), p());
}
function T() {
n.pauseOnHover &&
s(m, "mouseenter mouseleave", function (R) {
(C = R.type === "mouseenter"), w();
}),
n.pauseOnFocus &&
s(m, "focusin focusout", function (R) {
(A = R.type === "focusin"), w();
}),
v &&
s(v, "click", function () {
O ? N() : l(!0);
}),
o([Hn, ac, ft], f.rewind),
o(Hn, $);
}
function N() {
d() &&
t.Slides.isEnough() &&
(f.start(!n.resetProgress), (A = C = O = !1), p(), c(Pd));
}
function l(R) {
R === void 0 && (R = !0), (O = !!R), p(), d() || (f.pause(), c(Ld));
}
function w() {
O || (C || A ? l(!1) : N());
}
function p() {
v && (rr(v, No, !O), Ue(v, ln, n.i18n[O ? "play" : "pause"]));
}
function _(R) {
var L = h.bar;
L && pn(L, "width", R * 100 + "%"), c(Ll, R);
}
function $(R) {
var L = t.Slides.getAt(R);
f.set((L && +wn(L.slide, d4)) || n.interval);
}
return { mount: M, destroy: f.cancel, play: N, pause: l, isPaused: d };
}
function h4(e, t, n) {
var r = tt(e),
o = r.on;
function s() {
n.cover && (o(Ea, Qe(f, !0)), o([co, Ot, ft], Qe(c, !0)));
}
function c(d) {
t.Slides.forEach(function (h) {
var y = Es(h.container || h.slide, "img");
y && y.src && f(d, y, h);
});
}
function f(d, h, y) {
y.style(
"background",
d ? 'center/cover no-repeat url("' + h.src + '")' : "",
!0
),
us(h, d ? "none" : "");
}
return { mount: s, destroy: Qe(c, !1) };
}
var p4 = 10,
g4 = 600,
w4 = 0.6,
m4 = 1.5,
b4 = 800;
function y4(e, t, n) {
var r = tt(e),
o = r.on,
s = r.emit,
c = e.state.set,
f = t.Move,
d = f.getPosition,
h = f.getLimit,
y = f.exceededLimit,
m = f.translate,
v = e.is(_i),
P,
C,
A = 1;
function O() {
o(Hn, l), o([Ot, ft], w);
}
function M(_, $, R, L, E) {
var x = d();
if ((l(), R && (!v || !y()))) {
var z = t.Layout.sliderSize(),
q = vl(_) * z * ya(qt(_) / z) || 0;
_ = f.toPosition(t.Controller.toDest(_ % z)) + q;
}
var I = K0(x, _, 1);
(A = 1),
($ = I ? 0 : $ || ba(qt(_ - x) / m4, b4)),
(C = L),
(P = cc($, T, Qe(N, x, _, E), 1)),
c(bs),
s(ac),
P.start();
}
function T() {
c(yi), C && C(), s(Mo);
}
function N(_, $, R, L) {
var E = d(),
x = _ + ($ - _) * p(L),
z = (x - E) * A;
m(E + z),
v &&
!R &&
y() &&
((A *= w4), qt(z) < p4 && M(h(y(!0)), g4, !1, C, !0));
}
function l() {
P && P.cancel();
}
function w() {
P && !P.isPaused() && (l(), T());
}
function p(_) {
var $ = n.easingFunc;
return $ ? $(_) : 1 - Math.pow(1 - _, 4);
}
return { mount: O, destroy: l, scroll: M, cancel: w };
}
var ti = { passive: !1, capture: !0 };
function v4(e, t, n) {
var r = tt(e),
o = r.on,
s = r.emit,
c = r.bind,
f = r.unbind,
d = e.state,
h = t.Move,
y = t.Scroll,
m = t.Controller,
v = t.Elements.track,
P = t.Media.reduce,
C = t.Direction,
A = C.resolve,
O = C.orient,
M = h.getPosition,
T = h.exceededLimit,
N,
l,
w,
p,
_,
$ = !1,
R,
L,
E;
function x() {
c(v, Nu, bl, ti),
c(v, Ru, bl, ti),
c(v, dw, q, ti),
c(v, "click", D, { capture: !0 }),
c(v, "dragstart", Xn),
o([co, Ot], z);
}
function z() {
var se = n.drag;
Ke(!se), (p = se === "free");
}
function q(se) {
if (((R = !1), !L)) {
var Re = Me(se);
Oe(se.target) &&
(Re || !se.button) &&
(m.isBusy()
? Xn(se, !0)
: ((E = Re ? v : window),
(_ = d.is([Bi, bs])),
(w = null),
c(E, Nu, I, ti),
c(E, Ru, S, ti),
h.cancel(),
y.cancel(),
K(se)));
}
}
function I(se) {
if ((d.is(ta) || (d.set(ta), s(G0)), se.cancelable))
if (_) {
h.translate(N + Ce(be(se)));
var Re = Se(se) > fp,
Te = $ !== ($ = T());
(Re || Te) && K(se), (R = !0), s(Z0), Xn(se);
} else G(se) && ((_ = Z(se)), Xn(se));
}
function S(se) {
d.is(ta) && (d.set(yi), s(Y0)),
_ && (W(se), Xn(se)),
f(E, Nu, I),
f(E, Ru, S),
(_ = !1);
}
function D(se) {
!L && R && Xn(se, !0);
}
function K(se) {
(w = l), (l = se), (N = M());
}
function W(se) {
var Re = oe(se),
Te = he(Re),
Pe = n.rewind && n.rewindByDrag;
P(!1),
p
? m.scroll(Te, 0, n.snap)
: e.is(Ss)
? m.go(O(vl(Re)) < 0 ? (Pe ? "<" : "-") : Pe ? ">" : "+")
: e.is(_i) && $ && Pe
? m.go(T(!0) ? ">" : "<")
: m.go(m.toDest(Te), !0),
P(!0);
}
function Z(se) {
var Re = n.dragMinThreshold,
Te = is(Re),
Pe = (Te && Re.mouse) || 0,
je = (Te ? Re.touch : +Re) || 10;
return qt(be(se)) > (Me(se) ? je : Pe);
}
function G(se) {
return qt(be(se)) > qt(be(se, !0));
}
function oe(se) {
if (e.is(Ci) || !$) {
var Re = Se(se);
if (Re && Re < fp) return be(se) / Re;
}
return 0;
}
function he(se) {
return (
M() +
vl(se) *
Xr(
qt(se) * (n.flickPower || 600),
p ? 1 / 0 : t.Layout.listSize() * (n.flickMaxPages || 1)
)
);
}
function be(se, Re) {
return ye(se, Re) - ye(re(se), Re);
}
function Se(se) {
return yl(se) - yl(re(se));
}
function re(se) {
return (l === se && w) || l;
}
function ye(se, Re) {
return (Me(se) ? se.changedTouches[0] : se)[
"page" + A(Re ? "Y" : "X")
];
}
function Ce(se) {
return se / ($ && e.is(_i) ? QE : 1);
}
function Oe(se) {
var Re = n.noDrag;
return !ss(se, "." + sw + ", ." + pc) && (!Re || !ss(se, Re));
}
function Me(se) {
return typeof TouchEvent < "u" && se instanceof TouchEvent;
}
function pt() {
return _;
}
function Ke(se) {
L = se;
}
return { mount: x, disable: Ke, isDragging: pt };
}
var _4 = { Spacebar: " ", Right: dc, Left: lc, Up: Q0, Down: ew };
function Nd(e) {
return (e = Jr(e) ? e : e.key), _4[e] || e;
}
var hp = "keydown";
function E4(e, t, n) {
var r = tt(e),
o = r.on,
s = r.bind,
c = r.unbind,
f = e.root,
d = t.Direction.resolve,
h,
y;
function m() {
v(), o(Ot, P), o(Ot, v), o(Hn, A);
}
function v() {
var M = n.keyboard;
M && ((h = M === "global" ? window : f), s(h, hp, O));
}
function P() {
c(h, hp);
}
function C(M) {
y = M;
}
function A() {
var M = y;
(y = !0),
M0(function () {
y = M;
});
}
function O(M) {
if (!y) {
var T = Nd(M);
T === d(lc) ? e.go("<") : T === d(dc) && e.go(">");
}
}
return { mount: m, destroy: P, disable: C };
}
var Qi = $d + "-lazy",
oa = Qi + "-srcset",
k4 = "[" + Qi + "], [" + oa + "]";
function A4(e, t, n) {
var r = tt(e),
o = r.on,
s = r.off,
c = r.bind,
f = r.emit,
d = n.lazyLoad === "sequential",
h = [Oo, Mo],
y = [];
function m() {
n.lazyLoad && (v(), o(ft, v));
}
function v() {
cr(y), P(), d ? M() : (s(h), o(h, C), C());
}
function P() {
t.Slides.forEach(function (T) {
Sd(T.slide, k4).forEach(function (N) {
var l = wn(N, Qi),
w = wn(N, oa);
if (l !== N.src || w !== N.srcset) {
var p = n.classes.spinner,
_ = N.parentElement,
$ = Es(_, "." + p) || ai("span", p, _);
y.push([N, T, $]), N.src || us(N, "none");
}
});
});
}
function C() {
(y = y.filter(function (T) {
var N = n.perPage * ((n.preloadPages || 1) + 1) - 1;
return T[1].isWithin(e.index, N) ? A(T) : !0;
})),
y.length || s(h);
}
function A(T) {
var N = T[0];
Un(T[1].slide, Cl),
c(N, "load error", Qe(O, T)),
Ue(N, "src", wn(N, Qi)),
Ue(N, "srcset", wn(N, oa)),
Mn(N, Qi),
Mn(N, oa);
}
function O(T, N) {
var l = T[0],
w = T[1];
or(w.slide, Cl),
N.type !== "error" && (Io(T[2]), us(l, ""), f(Ea, l, w), f(vi)),
d && M();
}
function M() {
y.length && A(y.shift());
}
return { mount: m, destroy: Qe(cr, y), check: C };
}
function S4(e, t, n) {
var r = tt(e),
o = r.on,
s = r.emit,
c = r.bind,
f = t.Slides,
d = t.Elements,
h = t.Controller,
y = h.hasFocus,
m = h.getIndex,
v = h.go,
P = t.Direction.resolve,
C = d.pagination,
A = [],
O,
M;
function T() {
N(), o([Ot, ft, ka], T);
var L = n.pagination;
C && us(C, L ? "" : "none"),
L &&
(o([Hn, ac, Mo], R),
l(),
R(),
s(Tl, { list: O, items: A }, $(e.index)));
}
function N() {
O && (Io(C ? ao(O.children) : O), or(O, M), cr(A), (O = null)),
r.destroy();
}
function l() {
var L = e.length,
E = n.classes,
x = n.i18n,
z = n.perPage,
q = y() ? h.getEnd() + 1 : ls(L / z);
(O = C || ai("ul", E.pagination, d.track.parentElement)),
Un(O, (M = gc + "--" + _())),
Ue(O, ir, "tablist"),
Ue(O, ln, x.select),
Ue(O, Cd, _() === fc ? "vertical" : "");
for (var I = 0; I < q; I++) {
var S = ai("li", null, O),
D = ai("button", { class: E.page, type: "button" }, S),
K = f.getIn(I).map(function (Z) {
return Z.slide.id;
}),
W = !y() && z > 1 ? x.pageX : x.slideX;
c(D, "click", Qe(w, I)),
n.paginationKeyboard && c(D, "keydown", Qe(p, I)),
Ue(S, ir, "presentation"),
Ue(D, ir, "tab"),
Ue(D, As, K.join(" ")),
Ue(D, ln, _l(W, I + 1)),
Ue(D, ci, -1),
A.push({ li: S, button: D, page: I });
}
}
function w(L) {
v(">" + L, !0);
}
function p(L, E) {
var x = A.length,
z = Nd(E),
q = _(),
I = -1;
z === P(dc, !1, q)
? (I = ++L % x)
: z === P(lc, !1, q)
? (I = (--L + x) % x)
: z === "Home"
? (I = 0)
: z === "End" && (I = x - 1);
var S = A[I];
S && (q0(S.button), v(">" + I), Xn(E, !0));
}
function _() {
return n.paginationDirection || n.direction;
}
function $(L) {
return A[h.toPage(L)];
}
function R() {
var L = $(m(!0)),
E = $(m());
if (L) {
var x = L.button;
or(x, No), Mn(x, ap), Ue(x, ci, -1);
}
if (E) {
var z = E.button;
Un(z, No), Ue(z, ap, !0), Ue(z, ci, "");
}
s(Pl, { list: O, items: A }, L, E);
}
return { items: A, mount: T, destroy: N, getAt: $, update: R };
}
var $4 = [" ", "Enter"];
function x4(e, t, n) {
var r = n.isNavigation,
o = n.slideFocus,
s = [];
function c() {
e.splides.forEach(function (C) {
C.isParent || (h(e, C.splide), h(C.splide, e));
}),
r && y();
}
function f() {
s.forEach(function (C) {
C.destroy();
}),
cr(s);
}
function d() {
f(), c();
}
function h(C, A) {
var O = tt(C);
O.on(Hn, function (M, T, N) {
A.go(A.is(Ci) ? N : M);
}),
s.push(O);
}
function y() {
var C = tt(e),
A = C.on;
A(va, v), A(J0, P), A([co, Ot], m), s.push(C), C.emit(_a, e.splides);
}
function m() {
Ue(t.Elements.list, Cd, n.direction === fc ? "vertical" : "");
}
function v(C) {
e.go(C.index);
}
function P(C, A) {
kd($4, Nd(A)) && (v(C), Xn(A));
}
return {
setup: Qe(t.Media.set, { slideFocus: ys(o) ? r : o }, !0),
mount: c,
destroy: f,
remount: d,
};
}
function T4(e, t, n) {
var r = tt(e),
o = r.bind,
s = 0;
function c() {
n.wheel && o(t.Elements.track, "wheel", f, ti);
}
function f(h) {
if (h.cancelable) {
var y = h.deltaY,
m = y < 0,
v = yl(h),
P = n.wheelMinThreshold || 0,
C = n.wheelSleep || 0;
qt(y) > P && v - s > C && (e.go(m ? "<" : ">"), (s = v)),
d(m) && Xn(h);
}
}
function d(h) {
return (
!n.releaseWheel ||
e.state.is(Bi) ||
t.Controller.getAdjacent(h) !== -1
);
}
return { mount: c };
}
var P4 = 90;
function L4(e, t, n) {
var r = tt(e),
o = r.on,
s = t.Elements.track,
c = n.live && !n.isNavigation,
f = ai("span", GE),
d = cc(P4, Qe(y, !1));
function h() {
c &&
(v(!t.Autoplay.isPaused()),
Ue(s, lp, !0),
(f.textContent = "…"),
o(Pd, Qe(v, !0)),
o(Ld, Qe(v, !1)),
o([Oo, Mo], Qe(y, !0)));
}
function y(P) {
Ue(s, up, P), P ? (_s(s, f), d.start()) : (Io(f), d.cancel());
}
function m() {
Mn(s, [cp, lp, up]), Io(f);
}
function v(P) {
c && Ue(s, cp, P ? "off" : "polite");
}
return { mount: h, disable: v, destroy: m };
}
var B4 = Object.freeze({
__proto__: null,
Media: ME,
Direction: HE,
Elements: e4,
Slides: n4,
Layout: r4,
Clones: i4,
Move: s4,
Controller: a4,
Arrows: l4,
Autoplay: f4,
Cover: h4,
Scroll: y4,
Drag: v4,
Keyboard: E4,
LazyLoad: A4,
Pagination: S4,
Sync: x4,
Wheel: T4,
Live: L4,
}),
C4 = {
prev: "Previous slide",
next: "Next slide",
first: "Go to first slide",
last: "Go to last slide",
slideX: "Go to slide %s",
pageX: "Go to page %s",
play: "Start autoplay",
pause: "Pause autoplay",
carousel: "carousel",
slide: "slide",
select: "Select a slide to show",
slideLabel: "%s of %s",
},
I4 = {
type: "slide",
role: "region",
speed: 400,
perPage: 1,
cloneStatus: !0,
arrows: !0,
pagination: !0,
paginationKeyboard: !0,
interval: 5e3,
pauseOnHover: !0,
pauseOnFocus: !0,
resetProgress: !0,
easing: "cubic-bezier(0.25, 1, 0.5, 1)",
drag: !0,
direction: "ltr",
trimSpace: !0,
focusableNodes: "a, button, textarea, input, select, iframe",
live: !0,
classes: JE,
i18n: C4,
reducedMotion: { speed: 0, rewindSpeed: 0, autoplay: "pause" },
};
function O4(e, t, n) {
var r = t.Slides;
function o() {
tt(e).on([co, ft], s);
}
function s() {
r.forEach(function (f) {
f.style("transform", "translateX(-" + 100 * f.index + "%)");
});
}
function c(f, d) {
r.style("transition", "opacity " + n.speed + "ms " + n.easing), M0(d);
}
return { mount: o, start: c, cancel: bl };
}
function N4(e, t, n) {
var r = t.Move,
o = t.Controller,
s = t.Scroll,
c = t.Elements.list,
f = Qe(pn, c, "transition"),
d;
function h() {
tt(e).bind(c, "transitionend", function (P) {
P.target === c && d && (m(), d());
});
}
function y(P, C) {
var A = r.toPosition(P, !0),
O = r.getPosition(),
M = v(P);
qt(A - O) >= 1 && M >= 1
? n.useScroll
? s.scroll(A, M, !1, C)
: (f("transform " + M + "ms " + n.easing),
r.translate(A, !0),
(d = C))
: (r.jump(P), C());
}
function m() {
f(""), s.cancel();
}
function v(P) {
var C = n.rewindSpeed;
if (e.is(_i) && C) {
var A = o.getIndex(!0),
O = o.getEnd();
if ((A === 0 && P >= O) || (A >= O && P === 0)) return C;
}
return n.speed;
}
return { mount: h, start: y, cancel: m };
}
var R4 = (function () {
function e(n, r) {
(this.event = tt()),
(this.Components = {}),
(this.state = zE(oi)),
(this.splides = []),
(this._o = {}),
(this._E = {});
var o = Jr(n) ? F0(document, n) : n;
Xi(o, o + " is invalid."),
(this.root = o),
(r = qr(
{ label: wn(o, ln) || "", labelledby: wn(o, Bd) || "" },
I4,
e.defaults,
r || {}
));
try {
qr(r, JSON.parse(wn(o, $d)));
} catch {
Xi(!1, "Invalid JSON");
}
this._o = Object.create(qr({}, r));
}
var t = e.prototype;
return (
(t.mount = function (r, o) {
var s = this,
c = this.state,
f = this.Components;
Xi(c.is([oi, ma]), "Already mounted!"),
c.set(oi),
(this._C = f),
(this._T = o || this._T || (this.is(Ss) ? O4 : N4)),
(this._E = r || this._E);
var d = cs({}, B4, this._E, { Transition: this._T });
return (
Lo(d, function (h, y) {
var m = h(s, f, s._o);
(f[y] = m), m.setup && m.setup();
}),
Lo(f, function (h) {
h.mount && h.mount();
}),
this.emit(co),
Un(this.root, ZE),
c.set(yi),
this.emit(ip),
this
);
}),
(t.sync = function (r) {
return (
this.splides.push({ splide: r }),
r.splides.push({ splide: this, isParent: !0 }),
this.state.is(yi) &&
(this._C.Sync.remount(), r.Components.Sync.remount()),
this
);
}),
(t.go = function (r) {
return this._C.Controller.go(r), this;
}),
(t.on = function (r, o) {
return this.event.on(r, o), this;
}),
(t.off = function (r) {
return this.event.off(r), this;
}),
(t.emit = function (r) {
var o;
return (
(o = this.event).emit.apply(o, [r].concat(ao(arguments, 1))),
this
);
}),
(t.add = function (r, o) {
return this._C.Slides.add(r, o), this;
}),
(t.remove = function (r) {
return this._C.Slides.remove(r), this;
}),
(t.is = function (r) {
return this._o.type === r;
}),
(t.refresh = function () {
return this.emit(ft), this;
}),
(t.destroy = function (r) {
r === void 0 && (r = !0);
var o = this.event,
s = this.state;
return (
s.is(oi)
? tt(this).on(ip, this.destroy.bind(this, r))
: (Lo(
this._C,
function (c) {
c.destroy && c.destroy(r);
},
!0
),
o.emit(Td),
o.destroy(),
r && cr(this.splides),
s.set(ma)),
this
);
}),
CE(e, [
{
key: "options",
get: function () {
return this._o;
},
set: function (r) {
this._C.Media.set(r, !0, !0);
},
},
{
key: "length",
get: function () {
return this._C.Slides.getLength(!0);
},
},
{
key: "index",
get: function () {
return this._C.Controller.getIndex();
},
},
]),
e
);
})(),
Rd = R4;
Rd.defaults = {};
Rd.STATES = OE;
const z4 = [co, ft, vi, sc, G0, Z0, Y0, ac, Mo, Td, Pd, Ld];
function U4(e, t) {
const n = (r, o = {}) => {
t(M4(r), { splide: e, ...o });
};
e.on(va, (r, o) => {
n(va, { Slide: r, e: o });
}),
e.on(Hn, (r, o, s) => {
n(Hn, { index: r, prev: o, dest: s });
}),
e.on(Oo, (r, o, s) => {
n(Oo, { index: r, prev: o, dest: s });
}),
e.on(El, (r) => {
n(El, { Slide: r });
}),
e.on(kl, (r) => {
n(kl, { Slide: r });
}),
e.on(Al, (r) => {
n(Al, { Slide: r });
}),
e.on(Sl, (r) => {
n(Sl, { Slide: r });
}),
e.on(Ot, (r) => {
n(Ot, r);
}),
e.on($l, (r, o) => {
n($l, { prev: r, next: o });
}),
e.on(xl, (r, o) => {
n(xl, { prev: r, next: o });
}),
e.on(Tl, (r, o) => {
n(Tl, { data: r, item: o });
}),
e.on(Pl, (r, o, s) => {
n(Pl, { data: r, prev: o, curr: s });
}),
e.on(_a, (r) => {
n(_a, { splides: r });
}),
e.on(Ll, (r) => {
n(Ll, { rate: r });
}),
e.on(Ea, (r, o) => {
n(Ea, { img: r, Slide: o });
}),
z4.forEach((r) => {
e.on(r, () => {
n(r);
});
});
}
function M4(e) {
return e
.split(":")
.map((t, n) => (n > 0 ? t.charAt(0).toUpperCase() + t.slice(1) : t))
.join("")
.replace("Lazyload", "LazyLoad");
}
function H4(e) {
let t;
const n = e[11].default,
r = za(n, e, e[13], null);
return {
c() {
r && r.c();
},
m(o, s) {
r && r.m(o, s), (t = !0);
},
p(o, s) {
r &&
r.p &&
(!t || s & 8192) &&
Ma(r, n, o, o[13], t ? Ua(n, o[13], s, null) : Ha(o[13]), null);
},
i(o) {
t || (Ve(r, o), (t = !0));
},
o(o) {
Ze(r, o), (t = !1);
},
d(o) {
r && r.d(o);
},
};
}
function j4(e) {
let t, n;
return (
(t = new G4({
props: { $$slots: { default: [D4] }, $$scope: { ctx: e } },
})),
{
c() {
dr(t.$$.fragment);
},
m(r, o) {
Dn(t, r, o), (n = !0);
},
p(r, o) {
const s = {};
o & 8192 && (s.$$scope = { dirty: o, ctx: r }), t.$set(s);
},
i(r) {
n || (Ve(t.$$.fragment, r), (n = !0));
},
o(r) {
Ze(t.$$.fragment, r), (n = !1);
},
d(r) {
qn(t, r);
},
}
);
}
function D4(e) {
let t;
const n = e[11].default,
r = za(n, e, e[13], null);
return {
c() {
r && r.c();
},
m(o, s) {
r && r.m(o, s), (t = !0);
},
p(o, s) {
r &&
r.p &&
(!t || s & 8192) &&
Ma(r, n, o, o[13], t ? Ua(n, o[13], s, null) : Ha(o[13]), null);
},
i(o) {
t || (Ve(r, o), (t = !0));
},
o(o) {
Ze(r, o), (t = !1);
},
d(o) {
r && r.d(o);
},
};
}
function q4(e) {
let t, n, r, o, s;
const c = [j4, H4],
f = [];
function d(m, v) {
return m[1] ? 0 : 1;
}
(n = d(e)), (r = f[n] = c[n](e));
let h = [{ class: (o = bi("splide", e[0])) }, e[3]],
y = {};
for (let m = 0; m < h.length; m += 1) y = Rn(y, h[m]);
return {
c() {
(t = ke("div")), r.c(), gi(t, y);
},
m(m, v) {
Ne(m, t, v), f[n].m(t, null), e[12](t), (s = !0);
},
p(m, [v]) {
let P = n;
(n = d(m)),
n === P
? f[n].p(m, v)
: (to(),
Ze(f[P], 1, 1, () => {
f[P] = null;
}),
no(),
(r = f[n]),
r ? r.p(m, v) : ((r = f[n] = c[n](m)), r.c()),
Ve(r, 1),
r.m(t, null)),
gi(
t,
(y = Yl(h, [
(!s || (v & 1 && o !== (o = bi("splide", m[0])))) && {
class: o,
},
v & 8 && m[3],
]))
);
},
i(m) {
s || (Ve(r), (s = !0));
},
o(m) {
Ze(r), (s = !1);
},
d(m) {
m && Ie(t), f[n].d(), e[12](null);
},
};
}
function V4(e, t, n) {
const r = [
"class",
"options",
"splide",
"extensions",
"transition",
"hasTrack",
"go",
"sync",
];
let o = pi(t, r),
{ $$slots: s = {}, $$scope: c } = t,
{ class: f = void 0 } = t,
{ options: d = {} } = t,
{ splide: h = void 0 } = t,
{ extensions: y = void 0 } = t,
{ transition: m = void 0 } = t,
{ hasTrack: v = !0 } = t;
const P = xv();
let C,
A,
O = ml({}, d);
qa(
() => (
n(4, (h = new Rd(C, d))),
U4(h, P),
h.mount(y, m),
(A = Qh(h)),
() => h.destroy()
)
),
Sv(() => {
if (h) {
const l = Qh(h);
LE(A, l) || (h.refresh(), (A = l.slice()));
}
});
function M(l) {
h == null || h.go(l);
}
function T(l) {
h == null || h.sync(l);
}
function N(l) {
tl[l ? "unshift" : "push"](() => {
(C = l), n(2, C);
});
}
return (
(e.$$set = (l) => {
(t = Rn(Rn({}, t), Zl(l))),
n(3, (o = pi(t, r))),
"class" in l && n(0, (f = l.class)),
"options" in l && n(5, (d = l.options)),
"splide" in l && n(4, (h = l.splide)),
"extensions" in l && n(6, (y = l.extensions)),
"transition" in l && n(7, (m = l.transition)),
"hasTrack" in l && n(1, (v = l.hasTrack)),
"$$scope" in l && n(13, (c = l.$$scope));
}),
(e.$$.update = () => {
e.$$.dirty & 1072 &&
h &&
!wl(O, d) &&
(n(4, (h.options = d), h), n(10, (O = ml({}, O))));
}),
[f, v, C, o, h, d, y, m, M, T, O, s, N, c]
);
}
class F4 extends oo {
constructor(t) {
super(),
ro(this, t, V4, q4, jn, {
class: 0,
options: 5,
splide: 4,
extensions: 6,
transition: 7,
hasTrack: 1,
go: 8,
sync: 9,
});
}
get class() {
return this.$$.ctx[0];
}
set class(t) {
this.$$set({ class: t }), Mr();
}
get options() {
return this.$$.ctx[5];
}
set options(t) {
this.$$set({ options: t }), Mr();
}
get splide() {
return this.$$.ctx[4];
}
set splide(t) {
this.$$set({ splide: t }), Mr();
}
get extensions() {
return this.$$.ctx[6];
}
set extensions(t) {
this.$$set({ extensions: t }), Mr();
}
get transition() {
return this.$$.ctx[7];
}
set transition(t) {
this.$$set({ transition: t }), Mr();
}
get hasTrack() {
return this.$$.ctx[1];
}
set hasTrack(t) {
this.$$set({ hasTrack: t }), Mr();
}
get go() {
return this.$$.ctx[8];
}
get sync() {
return this.$$.ctx[9];
}
}
function K4(e) {
let t, n, r, o;
const s = e[3].default,
c = za(s, e, e[2], null);
let f = [{ class: (r = bi("splide__track", e[0])) }, e[1]],
d = {};
for (let h = 0; h < f.length; h += 1) d = Rn(d, f[h]);
return {
c() {
(t = ke("div")),
(n = ke("ul")),
c && c.c(),
Ee(n, "class", "splide__list"),
gi(t, d);
},
m(h, y) {
Ne(h, t, y), we(t, n), c && c.m(n, null), (o = !0);
},
p(h, [y]) {
c &&
c.p &&
(!o || y & 4) &&
Ma(c, s, h, h[2], o ? Ua(s, h[2], y, null) : Ha(h[2]), null),
gi(
t,
(d = Yl(f, [
(!o || (y & 1 && r !== (r = bi("splide__track", h[0])))) && {
class: r,
},
y & 2 && h[1],
]))
);
},
i(h) {
o || (Ve(c, h), (o = !0));
},
o(h) {
Ze(c, h), (o = !1);
},
d(h) {
h && Ie(t), c && c.d(h);
},
};
}
function W4(e, t, n) {
const r = ["class"];
let o = pi(t, r),
{ $$slots: s = {}, $$scope: c } = t,
{ class: f = void 0 } = t;
return (
(e.$$set = (d) => {
(t = Rn(Rn({}, t), Zl(d))),
n(1, (o = pi(t, r))),
"class" in d && n(0, (f = d.class)),
"$$scope" in d && n(2, (c = d.$$scope));
}),
[f, o, c, s]
);
}
class G4 extends oo {
constructor(t) {
super(), ro(this, t, W4, K4, jn, { class: 0 });
}
}
function Z4(e) {
let t, n, r;
const o = e[3].default,
s = za(o, e, e[2], null);
let c = [{ class: (n = bi("splide__slide", e[0])) }, e[1]],
f = {};
for (let d = 0; d < c.length; d += 1) f = Rn(f, c[d]);
return {
c() {
(t = ke("li")), s && s.c(), gi(t, f);
},
m(d, h) {
Ne(d, t, h), s && s.m(t, null), (r = !0);
},
p(d, [h]) {
s &&
s.p &&
(!r || h & 4) &&
Ma(s, o, d, d[2], r ? Ua(o, d[2], h, null) : Ha(d[2]), null),
gi(
t,
(f = Yl(c, [
(!r || (h & 1 && n !== (n = bi("splide__slide", d[0])))) && {
class: n,
},
h & 2 && d[1],
]))
);
},
i(d) {
r || (Ve(s, d), (r = !0));
},
o(d) {
Ze(s, d), (r = !1);
},
d(d) {
d && Ie(t), s && s.d(d);
},
};
}
function Y4(e, t, n) {
const r = ["class"];
let o = pi(t, r),
{ $$slots: s = {}, $$scope: c } = t,
{ class: f = void 0 } = t;
return (
(e.$$set = (d) => {
(t = Rn(Rn({}, t), Zl(d))),
n(1, (o = pi(t, r))),
"class" in d && n(0, (f = d.class)),
"$$scope" in d && n(2, (c = d.$$scope));
}),
[f, o, c, s]
);
}
class J4 extends oo {
constructor(t) {
super(), ro(this, t, Y4, Z4, jn, { class: 0 });
}
}
function X4(e) {
let t;
return {
c() {
(t = ke("div")),
(t.innerHTML = '<div class="loader svelte-181fgen"></div>'),
Ee(t, "class", "loader-container svelte-181fgen");
},
m(n, r) {
Ne(n, t, r);
},
p: At,
i: At,
o: At,
d(n) {
n && Ie(t);
},
};
}
class fw extends oo {
constructor(t) {
super(), ro(this, t, null, X4, jn, {});
}
}
function pp(e, t, n) {
const r = e.slice();
return (r[19] = t[n]), r;
}
function gp(e, t, n) {
const r = e.slice();
return (r[19] = t[n]), r;
}
function wp(e, t, n) {
const r = e.slice();
return (r[19] = t[n]), r;
}
function mp(e, t, n) {
const r = e.slice();
return (r[26] = t[n]), r;
}
function bp(e) {
let t,
n,
r,
o,
s,
c,
f = Wr(e[6]),
d = [];
for (let h = 0; h < f.length; h += 1) d[h] = yp(mp(e, f, h));
return {
c() {
(t = ke("div")),
(n = ke("div")),
(r = ke("a")),
(o = Xe("Home")),
(c = Ge());
for (let h = 0; h < d.length; h += 1) d[h].c();
Ee(r, "href", "#"),
Ee(r, "class", (s = e[0] == "" ? "selected" : "")),
Ee(t, "class", "topic-wrapper");
},
m(h, y) {
Ne(h, t, y), we(t, n), we(n, r), we(r, o), we(t, c);
for (let m = 0; m < d.length; m += 1) d[m] && d[m].m(t, null);
},
p(h, y) {
if (
(y & 1 &&
s !== (s = h[0] == "" ? "selected" : "") &&
Ee(r, "class", s),
y & 65)
) {
f = Wr(h[6]);
let m;
for (m = 0; m < f.length; m += 1) {
const v = mp(h, f, m);
d[m]
? d[m].p(v, y)
: ((d[m] = yp(v)), d[m].c(), d[m].m(t, null));
}
for (; m < d.length; m += 1) d[m].d(1);
d.length = f.length;
}
},
d(h) {
h && Ie(t), ja(d, h);
},
};
}
function yp(e) {
let t,
n,
r,
o = e[26] + "",
s,
c,
f;
return {
c() {
(t = ke("div")),
(n = ke("a")),
(r = Xe("#")),
(s = Xe(o)),
Ee(n, "href", (c = "#tags/" + e[26])),
Ee(n, "class", (f = e[26] == e[0] ? "selected" : ""));
},
m(d, h) {
Ne(d, t, h), we(t, n), we(n, r), we(n, s);
},
p(d, h) {
h & 64 && o !== (o = d[26] + "") && It(s, o),
h & 64 && c !== (c = "#tags/" + d[26]) && Ee(n, "href", c),
h & 65 &&
f !== (f = d[26] == d[0] ? "selected" : "") &&
Ee(n, "class", f);
},
d(d) {
d && Ie(t);
},
};
}
function Q4(e) {
let t;
return {
c() {
(t = ke("div")), Ee(t, "class", "separator");
},
m(n, r) {
Ne(n, t, r);
},
p: At,
d(n) {
n && Ie(t);
},
};
}
function e6(e) {
let t, n;
return {
c() {
(t = ke("div")), (n = Xe(e[4])), Ee(t, "class", "about");
},
m(r, o) {
Ne(r, t, o), we(t, n);
},
p(r, o) {
o & 16 && It(n, r[4]);
},
d(r) {
r && Ie(t);
},
};
}
function t6(e) {
let t, n;
return (
(t = new fw({})),
{
c() {
dr(t.$$.fragment);
},
m(r, o) {
Dn(t, r, o), (n = !0);
},
p: At,
i(r) {
n || (Ve(t.$$.fragment, r), (n = !0));
},
o(r) {
Ze(t.$$.fragment, r), (n = !1);
},
d(r) {
qn(t, r);
},
}
);
}
function n6(e) {
let t,
n,
r,
o,
s = e[10].length > 0 && vp(e),
c = e[8].length > 0 && !e[0] && kp(e),
f = e[9].length > 0 && Sp(e);
return {
c() {
s && s.c(),
(t = Ge()),
c && c.c(),
(n = Ge()),
f && f.c(),
(r = Uo());
},
m(d, h) {
s && s.m(d, h),
Ne(d, t, h),
c && c.m(d, h),
Ne(d, n, h),
f && f.m(d, h),
Ne(d, r, h),
(o = !0);
},
p(d, h) {
d[10].length > 0
? s
? s.p(d, h)
: ((s = vp(d)), s.c(), s.m(t.parentNode, t))
: s && (s.d(1), (s = null)),
d[8].length > 0 && !d[0]
? c
? (c.p(d, h), h & 257 && Ve(c, 1))
: ((c = kp(d)), c.c(), Ve(c, 1), c.m(n.parentNode, n))
: c &&
(to(),
Ze(c, 1, 1, () => {
c = null;
}),
no()),
d[9].length > 0
? f
? f.p(d, h)
: ((f = Sp(d)), f.c(), f.m(r.parentNode, r))
: f && (f.d(1), (f = null));
},
i(d) {
o || (Ve(c), (o = !0));
},
o(d) {
Ze(c), (o = !1);
},
d(d) {
d && (Ie(t), Ie(n), Ie(r)), s && s.d(d), c && c.d(d), f && f.d(d);
},
};
}
function vp(e) {
let t,
n = Wr(e[10]),
r = [];
for (let o = 0; o < n.length; o += 1) r[o] = Ep(wp(e, n, o));
return {
c() {
t = ke("div");
for (let o = 0; o < r.length; o += 1) r[o].c();
Ee(t, "class", "top-notes");
},
m(o, s) {
Ne(o, t, s);
for (let c = 0; c < r.length; c += 1) r[c] && r[c].m(t, null);
},
p(o, s) {
if (s & 1024) {
n = Wr(o[10]);
let c;
for (c = 0; c < n.length; c += 1) {
const f = wp(o, n, c);
r[c]
? r[c].p(f, s)
: ((r[c] = Ep(f)), r[c].c(), r[c].m(t, null));
}
for (; c < r.length; c += 1) r[c].d(1);
r.length = n.length;
}
},
d(o) {
o && Ie(t), ja(r, o);
},
};
}
function _p(e) {
let t,
n = e[19].summary + "";
return {
c() {
(t = ke("div")), Ee(t, "class", "summary");
},
m(r, o) {
Ne(r, t, o), (t.innerHTML = n);
},
p(r, o) {
o & 1024 && n !== (n = r[19].summary + "") && (t.innerHTML = n);
},
d(r) {
r && Ie(t);
},
};
}
function Ep(e) {
let t,
n,
r,
o,
s,
c,
f = e[19].title + "",
d,
h,
y,
m,
v,
P = Yr(e[19].created_at) + "",
C,
A,
O = e[19].summary && _p(e);
return {
c() {
(t = ke("div")),
(n = ke("a")),
(r = ke("img")),
(s = Ge()),
(c = ke("div")),
(d = Xe(f)),
(y = Ge()),
O && O.c(),
(m = Ge()),
(v = ke("div")),
(C = Xe(P)),
(A = Ge()),
Kr(r.src, (o = e[19].image)) || Ee(r, "src", o),
Ee(c, "class", "title"),
Ee(n, "href", (h = `#${e[19].id}`)),
Ee(v, "class", "date"),
Ee(t, "class", "note");
},
m(M, T) {
Ne(M, t, T),
we(t, n),
we(n, r),
we(n, s),
we(n, c),
we(c, d),
we(t, y),
O && O.m(t, null),
we(t, m),
we(t, v),
we(v, C),
we(t, A);
},
p(M, T) {
T & 1024 && !Kr(r.src, (o = M[19].image)) && Ee(r, "src", o),
T & 1024 && f !== (f = M[19].title + "") && It(d, f),
T & 1024 && h !== (h = `#${M[19].id}`) && Ee(n, "href", h),
M[19].summary
? O
? O.p(M, T)
: ((O = _p(M)), O.c(), O.m(t, m))
: O && (O.d(1), (O = null)),
T & 1024 && P !== (P = Yr(M[19].created_at) + "") && It(C, P);
},
d(M) {
M && Ie(t), O && O.d();
},
};
}
function kp(e) {
let t, n;
return (
(t = new F4({
props: {
class: "short-notes",
options: {
type: "loop",
gap: "1rem",
pagination: !1,
perPage: 3,
breakpoints: { 640: { perPage: 2 } },
autoplay: !0,
},
$$slots: { default: [o6] },
$$scope: { ctx: e },
},
})),
{
c() {
dr(t.$$.fragment);
},
m(r, o) {
Dn(t, r, o), (n = !0);
},
p(r, o) {
const s = {};
o & 536871168 && (s.$$scope = { dirty: o, ctx: r }), t.$set(s);
},
i(r) {
n || (Ve(t.$$.fragment, r), (n = !0));
},
o(r) {
Ze(t.$$.fragment, r), (n = !1);
},
d(r) {
qn(t, r);
},
}
);
}
function r6(e) {
let t,
n,
r = Yr(e[19].created_at, !0) + "",
o,
s,
c = e[19].summary + "",
f,
d,
h;
return {
c() {
(t = ke("a")),
(n = ke("div")),
(o = Xe(r)),
(s = Ge()),
(f = Xe(c)),
(h = Ge()),
Ee(n, "class", "date"),
Ee(t, "href", (d = `#${e[19].id}`));
},
m(y, m) {
Ne(y, t, m), we(t, n), we(n, o), we(t, s), we(t, f), Ne(y, h, m);
},
p(y, m) {
m & 256 && r !== (r = Yr(y[19].created_at, !0) + "") && It(o, r),
m & 256 && c !== (c = y[19].summary + "") && It(f, c),
m & 256 && d !== (d = `#${y[19].id}`) && Ee(t, "href", d);
},
d(y) {
y && (Ie(t), Ie(h));
},
};
}
function Ap(e) {
let t, n;
return (
(t = new J4({
props: { $$slots: { default: [r6] }, $$scope: { ctx: e } },
})),
{
c() {
dr(t.$$.fragment);
},
m(r, o) {
Dn(t, r, o), (n = !0);
},
p(r, o) {
const s = {};
o & 536871168 && (s.$$scope = { dirty: o, ctx: r }), t.$set(s);
},
i(r) {
n || (Ve(t.$$.fragment, r), (n = !0));
},
o(r) {
Ze(t.$$.fragment, r), (n = !1);
},
d(r) {
qn(t, r);
},
}
);
}
function o6(e) {
let t,
n,
r = Wr(e[8]),
o = [];
for (let c = 0; c < r.length; c += 1) o[c] = Ap(gp(e, r, c));
const s = (c) =>
Ze(o[c], 1, 1, () => {
o[c] = null;
});
return {
c() {
for (let c = 0; c < o.length; c += 1) o[c].c();
t = Uo();
},
m(c, f) {
for (let d = 0; d < o.length; d += 1) o[d] && o[d].m(c, f);
Ne(c, t, f), (n = !0);
},
p(c, f) {
if (f & 256) {
r = Wr(c[8]);
let d;
for (d = 0; d < r.length; d += 1) {
const h = gp(c, r, d);
o[d]
? (o[d].p(h, f), Ve(o[d], 1))
: ((o[d] = Ap(h)),
o[d].c(),
Ve(o[d], 1),
o[d].m(t.parentNode, t));
}
for (to(), d = r.length; d < o.length; d += 1) s(d);
no();
}
},
i(c) {
if (!n) {
for (let f = 0; f < r.length; f += 1) Ve(o[f]);
n = !0;
}
},
o(c) {
o = o.filter(Boolean);
for (let f = 0; f < o.length; f += 1) Ze(o[f]);
n = !1;
},
d(c) {
c && Ie(t), ja(o, c);
},
};
}
function Sp(e) {
let t,
n,
r = Wr(e[9]),
o = [];
for (let s = 0; s < r.length; s += 1) o[s] = xp(pp(e, r, s));
return {
c() {
(t = ke("div")), (n = ke("ul"));
for (let s = 0; s < o.length; s += 1) o[s].c();
Ee(t, "class", "listing-notes"), Ih(t, "short-feed-full", e[7]);
},
m(s, c) {
Ne(s, t, c), we(t, n);
for (let f = 0; f < o.length; f += 1) o[f] && o[f].m(n, null);
},
p(s, c) {
if (c & 640) {
r = Wr(s[9]);
let f;
for (f = 0; f < r.length; f += 1) {
const d = pp(s, r, f);
o[f]
? o[f].p(d, c)
: ((o[f] = xp(d)), o[f].c(), o[f].m(n, null));
}
for (; f < o.length; f += 1) o[f].d(1);
o.length = r.length;
}
c & 128 && Ih(t, "short-feed-full", s[7]);
},
d(s) {
s && Ie(t), ja(o, s);
},
};
}
function i6(e) {
let t,
n = e[19].summary + "",
r;
return {
c() {
(t = ke("div")), (r = Xe(n)), Ee(t, "class", "summary");
},
m(o, s) {
Ne(o, t, s), we(t, r);
},
p(o, s) {
s & 512 && n !== (n = o[19].summary + "") && It(r, n);
},
d(o) {
o && Ie(t);
},
};
}
function s6(e) {
let t,
n = e[19].content + "";
return {
c() {
(t = ke("div")), Ee(t, "class", "summary full");
},
m(r, o) {
Ne(r, t, o), (t.innerHTML = n);
},
p(r, o) {
o & 512 && n !== (n = r[19].content + "") && (t.innerHTML = n);
},
d(r) {
r && Ie(t);
},
};
}
function $p(e) {
let t,
n = Yr(e[19].created_at) + "",
r;
return {
c() {
(t = ke("div")), (r = Xe(n)), Ee(t, "class", "date");
},
m(o, s) {
Ne(o, t, s), we(t, r);
},
p(o, s) {
s & 512 && n !== (n = Yr(o[19].created_at) + "") && It(r, n);
},
d(o) {
o && Ie(t);
},
};
}
function xp(e) {
let t,
n,
r,
o = e[19].title + "",
s,
c,
f,
d,
h;
function y(C, A) {
if (C[19].kind == 1 && C[7]) return s6;
if (C[19].summary) return i6;
}
let m = y(e),
v = m && m(e),
P = !(e[19].kind == 1 && e[7]) && $p(e);
return {
c() {
(t = ke("li")),
(n = ke("h2")),
(r = ke("a")),
(s = Xe(o)),
(f = Ge()),
v && v.c(),
(d = Ge()),
P && P.c(),
(h = Ge()),
Ee(r, "href", (c = `#${e[19].id}`));
},
m(C, A) {
Ne(C, t, A),
we(t, n),
we(n, r),
we(r, s),
we(t, f),
v && v.m(t, null),
we(t, d),
P && P.m(t, null),
we(t, h);
},
p(C, A) {
A & 512 && o !== (o = C[19].title + "") && It(s, o),
A & 512 && c !== (c = `#${C[19].id}`) && Ee(r, "href", c),
m === (m = y(C)) && v
? v.p(C, A)
: (v && v.d(1), (v = m && m(C)), v && (v.c(), v.m(t, d))),
C[19].kind == 1 && C[7]
? P && (P.d(1), (P = null))
: P
? P.p(C, A)
: ((P = $p(C)), P.c(), P.m(t, h));
},
d(C) {
C && Ie(t), v && v.d(), P && P.d();
},
};
}
function a6(e) {
let t,
n,
r,
o,
s = e[5].slice(0, 9) + "..." + e[5].slice(-5),
c,
f,
d,
h,
y,
m,
v,
P,
C,
A,
O,
M,
T,
N,
l,
w,
p = e[6].length > 0 && bp(e);
function _(z, q) {
return z[0] == "" ? e6 : Q4;
}
let $ = _(e),
R = $(e);
const L = [n6, t6],
E = [];
function x(z, q) {
return z[1].length > 0 ? 0 : 1;
}
return (
(T = x(e)),
(N = E[T] = L[T](e)),
{
c() {
(t = ke("div")),
(n = ke("div")),
(r = Xe("Profile: ")),
(o = ke("a")),
(c = Xe(s)),
(d = Ge()),
(h = ke("h1")),
(y = ke("div")),
(m = ke("img")),
(P = Ge()),
(C = Xe(e[2])),
(A = Ge()),
p && p.c(),
(O = Ge()),
R.c(),
(M = Ge()),
N.c(),
(l = Uo()),
Ee(o, "href", (f = "https://njump.me/" + e[5])),
Ee(n, "class", "external-link"),
Kr(m.src, (v = e[3])) || Ee(m, "src", v),
Ee(y, "class", "picture-container"),
Ee(t, "class", "header home");
},
m(z, q) {
Ne(z, t, q),
we(t, n),
we(n, r),
we(n, o),
we(o, c),
we(t, d),
we(t, h),
we(h, y),
we(y, m),
we(h, P),
we(h, C),
Ne(z, A, q),
p && p.m(z, q),
Ne(z, O, q),
R.m(z, q),
Ne(z, M, q),
E[T].m(z, q),
Ne(z, l, q),
(w = !0);
},
p(z, [q]) {
(!w || q & 32) &&
s !== (s = z[5].slice(0, 9) + "..." + z[5].slice(-5)) &&
It(c, s),
(!w || (q & 32 && f !== (f = "https://njump.me/" + z[5]))) &&
Ee(o, "href", f),
(!w || (q & 8 && !Kr(m.src, (v = z[3])))) && Ee(m, "src", v),
(!w || q & 4) && It(C, z[2]),
z[6].length > 0
? p
? p.p(z, q)
: ((p = bp(z)), p.c(), p.m(O.parentNode, O))
: p && (p.d(1), (p = null)),
$ === ($ = _(z)) && R
? R.p(z, q)
: (R.d(1), (R = $(z)), R && (R.c(), R.m(M.parentNode, M)));
let I = T;
(T = x(z)),
T === I
? E[T].p(z, q)
: (to(),
Ze(E[I], 1, 1, () => {
E[I] = null;
}),
no(),
(N = E[T]),
N ? N.p(z, q) : ((N = E[T] = L[T](z)), N.c()),
Ve(N, 1),
N.m(l.parentNode, l));
},
i(z) {
w || (Ve(N), (w = !0));
},
o(z) {
Ze(N), (w = !1);
},
d(z) {
z && (Ie(t), Ie(A), Ie(O), Ie(M), Ie(l)),
p && p.d(z),
R.d(z),
E[T].d(z);
},
}
);
}
function c6(e, t, n) {
let r,
o,
s,
c = [],
f = [],
d = new Set(),
h = "",
y = "",
m = "",
v = "",
P = "",
C = "",
A = !1,
O = 0,
{ tag: M } = t,
{ profile: T } = t;
qa(async () => {
const {
npub: l,
relays: w,
topNotes: p,
shortNotesMinChars: _,
shortNotes: $,
shortFeedSummaryMaxChars: R,
topics: L,
} = Fa();
n(5, (v = l)), (P = T.pubkey);
const E = JSON.parse(T.content);
n(2, (h = E.name || null)),
n(3, (y = E.picture || null)),
n(4, (m = E.about || null)),
n(13, (O = p)),
n(6, (C = L)),
n(7, (A = R == 0));
let x = [30023];
$ == "main" && x.push(1), ga.set(h + " home, powered by Nostr");
let z = { kinds: x, authors: [P], limit: 1e3 };
M && (n(0, (M = M.substring(5))), (z = { ...z, "#t": [M] }));
let q = pa.subscribeMany(w, [z], {
onevent: async (I) => {
if (!d.has(I.id)) {
if (I.kind == 1 && (I.content.length < _ || !Xh(I))) return;
I.kind == 1 && A && (I.content = await U0(I)),
n(1, (c = [...c, I])),
d.add(I.id),
c.sort((S, D) => D.created_at - S.created_at);
}
},
oneose() {
console.log("No subscribers left. Closing subscription."),
q.close();
},
});
$ == "carousel" &&
(q = pa.subscribeMany(
w,
[{ kinds: [1], authors: [P], limit: 1e3 }],
{
onevent: async (I) => {
if (!d.has(I.id) && I.content.length > _ && Xh(I)) {
if (((I = await N(I)), I.content.length < _)) return;
n(12, (f = [...f, I])),
d.add(I.id),
f.sort((S, D) => D.created_at - S.created_at);
}
},
oneose() {
console.log("No subscribers left. Closing subscription."),
q.close();
},
}
));
});
async function N(l) {
let w;
return (
(w = await R0(l.content)),
(w = z0(w)),
(w = AE(w)),
(l.content = w),
l
);
}
return (
(e.$$set = (l) => {
"tag" in l && n(0, (M = l.tag)),
"profile" in l && n(11, (T = l.profile));
}),
(e.$$.update = () => {
e.$$.dirty & 8194 &&
n(
10,
(r =
O > 0
? c
.filter((l) => l.kind === 30023)
.slice(0, O)
.map(ea)
: [])
),
e.$$.dirty & 8194 && n(9, (o = c.slice(O).map(ea))),
e.$$.dirty & 4096 && n(8, (s = f.map(ea)));
}),
ga.subscribe((l) => {
document.title = l;
}),
[M, c, h, y, m, v, C, A, s, o, r, T, f, O]
);
}
class hw extends oo {
constructor(t) {
super(), ro(this, t, c6, a6, jn, { tag: 0, profile: 11 });
}
}
var u6 = Object.defineProperty,
l6 = (e, t, n) =>
t in e
? u6(e, t, {
enumerable: !0,
configurable: !0,
writable: !0,
value: n,
})
: (e[t] = n),
pe = (e, t, n) => (l6(e, typeof t != "symbol" ? t + "" : t, n), n);
const d6 = (e, t) => e === t,
Ft = Symbol("solid-proxy"),
fs = Symbol("solid-track"),
Aa = { equals: d6 };
let pw = yw;
const gr = 1,
Sa = 2,
gw = { owned: null, cleanups: null, context: null, owner: null },
zu = {};
var ht = null;
let Uu = null,
et = null,
Ct = null,
sr = null,
wc = 0;
function Il(e, t) {
const n = et,
r = ht,
o = e.length === 0,
s = t === void 0 ? r : t,
c = o
? gw
: {
owned: null,
cleanups: null,
context: s ? s.context : null,
owner: s,
},
f = o ? e : () => e(() => bn(() => bc(c)));
(ht = c), (et = null);
try {
return Qr(f, !0);
} finally {
(et = n), (ht = r);
}
}
function dt(e, t) {
t = t ? Object.assign({}, Aa, t) : Aa;
const n = {
value: e,
observers: null,
observerSlots: null,
comparator: t.equals || void 0,
},
r = (o) => (typeof o == "function" && (o = o(n.value)), bw(n, o));
return [mw.bind(n), r];
}
function Hr(e, t, n) {
const r = mc(e, t, !0, gr);
Ii(r);
}
function cn(e, t, n) {
const r = mc(e, t, !1, gr);
Ii(r);
}
function Ei(e, t, n) {
pw = w6;
const r = mc(e, t, !1, gr);
(r.user = !0), sr ? sr.push(r) : Ii(r);
}
function De(e, t, n) {
n = n ? Object.assign({}, Aa, n) : Aa;
const r = mc(e, t, !0, 0);
return (
(r.observers = null),
(r.observerSlots = null),
(r.comparator = n.equals || void 0),
Ii(r),
mw.bind(r)
);
}
function f6(e) {
return e && typeof e == "object" && "then" in e;
}
function ww(e, t, n) {
let r, o, s;
(arguments.length === 2 && typeof t == "object") ||
arguments.length === 1
? ((r = !0), (o = e), (s = t || {}))
: ((r = e), (o = t), (s = n || {}));
let c = null,
f = zu,
d = !1,
h = "initialValue" in s,
y = typeof r == "function" && De(r);
const m = new Set(),
[v, P] = (s.storage || dt)(s.initialValue),
[C, A] = dt(void 0),
[O, M] = dt(void 0, { equals: !1 }),
[T, N] = dt(h ? "ready" : "unresolved");
function l($, R, L, E) {
return (
c === $ &&
((c = null),
E !== void 0 && (h = !0),
($ === f || R === f) &&
s.onHydrated &&
queueMicrotask(() => s.onHydrated(E, { value: R })),
(f = zu),
w(R, L)),
R
);
}
function w($, R) {
Qr(() => {
R === void 0 && P(() => $),
N(R !== void 0 ? "errored" : h ? "ready" : "unresolved"),
A(R);
for (const L of m.keys()) L.decrement();
m.clear();
}, !1);
}
function p() {
const $ = h6,
R = v(),
L = C();
if (L !== void 0 && !c) throw L;
return (
et &&
!et.user &&
$ &&
Hr(() => {
O(), c && ($.resolved || m.has($) || ($.increment(), m.add($)));
}),
R
);
}
function _($ = !0) {
if ($ !== !1 && d) return;
d = !1;
const R = y ? y() : r;
if (R == null || R === !1) {
l(c, bn(v));
return;
}
const L =
f !== zu ? f : bn(() => o(R, { value: v(), refetching: $ }));
return f6(L)
? ((c = L),
"value" in L
? (L.status === "success"
? l(c, L.value, void 0, R)
: l(c, void 0, void 0, R),
L)
: ((d = !0),
queueMicrotask(() => (d = !1)),
Qr(() => {
N(h ? "refreshing" : "pending"), M();
}, !1),
L.then(
(E) => l(L, E, void 0, R),
(E) => l(L, void 0, _w(E), R)
)))
: (l(c, L, void 0, R), L);
}
return (
Object.defineProperties(p, {
state: { get: () => T() },
error: { get: () => C() },
loading: {
get() {
const $ = T();
return $ === "pending" || $ === "refreshing";
},
},
latest: {
get() {
if (!h) return p();
const $ = C();
if ($ && !c) throw $;
return v();
},
},
}),
y ? Hr(() => _(!1)) : _(!1),
[p, { refetch: _, mutate: P }]
);
}
function ui(e) {
return Qr(e, !1);
}
function bn(e) {
if (et === null) return e();
const t = et;
et = null;
try {
return e();
} finally {
et = t;
}
}
function jr(e, t, n) {
const r = Array.isArray(e);
let o,
s = n && n.defer;
return (c) => {
let f;
if (r) {
f = Array(e.length);
for (let h = 0; h < e.length; h++) f[h] = e[h]();
} else f = e();
if (s) {
s = !1;
return;
}
const d = bn(() => t(f, o, c));
return (o = f), d;
};
}
function li(e) {
return (
ht === null ||
(ht.cleanups === null ? (ht.cleanups = [e]) : ht.cleanups.push(e)),
e
);
}
function ki() {
return et;
}
let h6;
function mw() {
if (this.sources && this.state)
if (this.state === gr) Ii(this);
else {
const e = Ct;
(Ct = null), Qr(() => xa(this), !1), (Ct = e);
}
if (et) {
const e = this.observers ? this.observers.length : 0;
et.sources
? (et.sources.push(this), et.sourceSlots.push(e))
: ((et.sources = [this]), (et.sourceSlots = [e])),
this.observers
? (this.observers.push(et),
this.observerSlots.push(et.sources.length - 1))
: ((this.observers = [et]),
(this.observerSlots = [et.sources.length - 1]));
}
return this.value;
}
function bw(e, t, n) {
let r = e.value;
return (
(!e.comparator || !e.comparator(r, t)) &&
((e.value = t),
e.observers &&
e.observers.length &&
Qr(() => {
for (let o = 0; o < e.observers.length; o += 1) {
const s = e.observers[o],
c = Uu && Uu.running;
c && Uu.disposed.has(s),
(c ? !s.tState : !s.state) &&
(s.pure ? Ct.push(s) : sr.push(s), s.observers && vw(s)),
c || (s.state = gr);
}
if (Ct.length > 1e6) throw ((Ct = []), new Error());
}, !1)),
t
);
}
function Ii(e) {
if (!e.fn) return;
bc(e);
const t = ht,
n = et,
r = wc;
(et = ht = e), p6(e, e.value, r), (et = n), (ht = t);
}
function p6(e, t, n) {
let r;
try {
r = e.fn(t);
} catch (o) {
return (
e.pure &&
((e.state = gr),
e.owned && e.owned.forEach(bc),
(e.owned = null)),
(e.updatedAt = n + 1),
Ew(o)
);
}
(!e.updatedAt || e.updatedAt <= n) &&
(e.updatedAt != null && "observers" in e ? bw(e, r) : (e.value = r),
(e.updatedAt = n));
}
function mc(e, t, n, r = gr, o) {
const s = {
fn: e,
state: r,
updatedAt: null,
owned: null,
sources: null,
sourceSlots: null,
cleanups: null,
value: t,
owner: ht,
context: ht ? ht.context : null,
pure: n,
};
return (
ht === null ||
(ht !== gw && (ht.owned ? ht.owned.push(s) : (ht.owned = [s]))),
s
);
}
function $a(e) {
if (e.state === 0) return;
if (e.state === Sa) return xa(e);
if (e.suspense && bn(e.suspense.inFallback))
return e.suspense.effects.push(e);
const t = [e];
for (; (e = e.owner) && (!e.updatedAt || e.updatedAt < wc); )
e.state && t.push(e);
for (let n = t.length - 1; n >= 0; n--)
if (((e = t[n]), e.state === gr)) Ii(e);
else if (e.state === Sa) {
const r = Ct;
(Ct = null), Qr(() => xa(e, t[0]), !1), (Ct = r);
}
}
function Qr(e, t) {
if (Ct) return e();
let n = !1;
t || (Ct = []), sr ? (n = !0) : (sr = []), wc++;
try {
const r = e();
return g6(n), r;
} catch (r) {
n || (sr = null), (Ct = null), Ew(r);
}
}
function g6(e) {
if ((Ct && (yw(Ct), (Ct = null)), e)) return;
const t = sr;
(sr = null), t.length && Qr(() => pw(t), !1);
}
function yw(e) {
for (let t = 0; t < e.length; t++) $a(e[t]);
}
function w6(e) {
let t,
n = 0;
for (t = 0; t < e.length; t++) {
const r = e[t];
r.user ? (e[n++] = r) : $a(r);
}
for (t = 0; t < n; t++) $a(e[t]);
}
function xa(e, t) {
e.state = 0;
for (let n = 0; n < e.sources.length; n += 1) {
const r = e.sources[n];
if (r.sources) {
const o = r.state;
o === gr
? r !== t && (!r.updatedAt || r.updatedAt < wc) && $a(r)
: o === Sa && xa(r, t);
}
}
}
function vw(e) {
for (let t = 0; t < e.observers.length; t += 1) {
const n = e.observers[t];
n.state ||
((n.state = Sa),
n.pure ? Ct.push(n) : sr.push(n),
n.observers && vw(n));
}
}
function bc(e) {
let t;
if (e.sources)
for (; e.sources.length; ) {
const n = e.sources.pop(),
r = e.sourceSlots.pop(),
o = n.observers;
if (o && o.length) {
const s = o.pop(),
c = n.observerSlots.pop();
r < o.length &&
((s.sourceSlots[c] = r), (o[r] = s), (n.observerSlots[r] = c));
}
}
if (e.owned) {
for (t = e.owned.length - 1; t >= 0; t--) bc(e.owned[t]);
e.owned = null;
}
if (e.cleanups) {
for (t = e.cleanups.length - 1; t >= 0; t--) e.cleanups[t]();
e.cleanups = null;
}
e.state = 0;
}
function _w(e) {
return e instanceof Error
? e
: new Error(typeof e == "string" ? e : "Unknown error", { cause: e });
}
function Ew(e, t = ht) {
throw _w(e);
}
const Tp = Symbol("fallback");
function Pp(e) {
for (let t = 0; t < e.length; t++) e[t]();
}
function m6(e, t, n = {}) {
let r = [],
o = [],
s = [],
c = [],
f = 0,
d;
return (
li(() => Pp(s)),
() => {
const h = e() || [];
return (
h[fs],
bn(() => {
if (h.length === 0)
return (
f !== 0 &&
(Pp(s), (s = []), (r = []), (o = []), (f = 0), (c = [])),
n.fallback &&
((r = [Tp]),
(o[0] = Il((m) => ((s[0] = m), n.fallback()))),
(f = 1)),
o
);
for (
r[0] === Tp &&
(s[0](), (s = []), (r = []), (o = []), (f = 0)),
d = 0;
d < h.length;
d++
)
d < r.length && r[d] !== h[d]
? c[d](() => h[d])
: d >= r.length && (o[d] = Il(y));
for (; d < r.length; d++) s[d]();
return (
(f = c.length = s.length = h.length),
(r = h.slice(0)),
(o = o.slice(0, f))
);
})
);
function y(m) {
s[d] = m;
const [v, P] = dt(h[d]);
return (c[d] = P), t(v, d);
}
}
);
}
function mn(e, t) {
return bn(() => e(t || {}));
}
const b6 = (e) => `Stale read from <${e}>.`;
function y6(e) {
const t = "fallback" in e && { fallback: () => e.fallback };
return De(m6(() => e.each, e.children, t || void 0));
}
function Ta(e) {
const t = e.keyed,
n = De(() => e.when, void 0, {
equals: (r, o) => (t ? r === o : !r == !o),
});
return De(
() => {
const r = n();
if (r) {
const o = e.children;
return typeof o == "function" && o.length > 0
? bn(() =>
o(
t
? r
: () => {
if (!bn(n)) throw b6("Show");
return e.when;
}
)
)
: o;
}
return e.fallback;
},
void 0,
void 0
);
}
function v6(e, t, n) {
let r = n.length,
o = t.length,
s = r,
c = 0,
f = 0,
d = t[o - 1].nextSibling,
h = null;
for (; c < o || f < s; ) {
if (t[c] === n[f]) {
c++, f++;
continue;
}
for (; t[o - 1] === n[s - 1]; ) o--, s--;
if (o === c) {
const y = s < r ? (f ? n[f - 1].nextSibling : n[s - f]) : d;
for (; f < s; ) e.insertBefore(n[f++], y);
} else if (s === f)
for (; c < o; ) (!h || !h.has(t[c])) && t[c].remove(), c++;
else if (t[c] === n[s - 1] && n[f] === t[o - 1]) {
const y = t[--o].nextSibling;
e.insertBefore(n[f++], t[c++].nextSibling),
e.insertBefore(n[--s], y),
(t[o] = n[s]);
} else {
if (!h) {
h = new Map();
let m = f;
for (; m < s; ) h.set(n[m], m++);
}
const y = h.get(t[c]);
if (y != null)
if (f < y && y < s) {
let m = c,
v = 1,
P;
for (
;
++m < o &&
m < s &&
!((P = h.get(t[m])) == null || P !== y + v);
)
v++;
if (v > y - f) {
const C = t[c];
for (; f < y; ) e.insertBefore(n[f++], C);
} else e.replaceChild(n[f++], t[c++]);
} else c++;
else t[c++].remove();
}
}
}
const Lp = "_$DX_DELEGATE";
function He(e, t, n) {
let r;
const o = () => {
const c = document.createElement("template");
return (c.innerHTML = e), c.content.firstChild;
},
s = () => (r || (r = o())).cloneNode(!0);
return (s.cloneNode = s), s;
}
function zd(e, t = window.document) {
const n = t[Lp] || (t[Lp] = new Set());
for (let r = 0, o = e.length; r < o; r++) {
const s = e[r];
n.has(s) || (n.add(s), t.addEventListener(s, k6));
}
}
function Bt(e, t, n) {
n == null ? e.removeAttribute(t) : e.setAttribute(t, n);
}
function _6(e, t, n, r) {
Array.isArray(n)
? ((e[`$$${t}`] = n[0]), (e[`$$${t}Data`] = n[1]))
: (e[`$$${t}`] = n);
}
function E6(e, t, n) {
if (!t) return n ? Bt(e, "style") : t;
const r = e.style;
if (typeof t == "string") return (r.cssText = t);
typeof n == "string" && (r.cssText = n = void 0),
n || (n = {}),
t || (t = {});
let o, s;
for (s in n) t[s] == null && r.removeProperty(s), delete n[s];
for (s in t)
(o = t[s]), o !== n[s] && (r.setProperty(s, o), (n[s] = o));
return n;
}
function kw(e, t, n) {
return bn(() => e(t, n));
}
function xe(e, t, n, r) {
if ((n !== void 0 && !r && (r = []), typeof t != "function"))
return Pa(e, t, r, n);
cn((o) => Pa(e, t(), o, n), r);
}
function k6(e) {
const t = `$$${e.type}`;
let n = (e.composedPath && e.composedPath()[0]) || e.target;
for (
e.target !== n &&
Object.defineProperty(e, "target", { configurable: !0, value: n }),
Object.defineProperty(e, "currentTarget", {
configurable: !0,
get() {
return n || document;
},
});
n;
) {
const r = n[t];
if (r && !n.disabled) {
const o = n[`${t}Data`];
if ((o !== void 0 ? r.call(n, o, e) : r.call(n, e), e.cancelBubble))
return;
}
n = n._$host || n.parentNode || n.host;
}
}
function Pa(e, t, n, r, o) {
for (; typeof n == "function"; ) n = n();
if (t === n) return n;
const s = typeof t,
c = r !== void 0;
if (
((e = (c && n[0] && n[0].parentNode) || e),
s === "string" || s === "number")
)
if ((s === "number" && (t = t.toString()), c)) {
let f = n[0];
f && f.nodeType === 3
? (f.data = t)
: (f = document.createTextNode(t)),
(n = Yo(e, n, r, f));
} else
n !== "" && typeof n == "string"
? (n = e.firstChild.data = t)
: (n = e.textContent = t);
else if (t == null || s === "boolean") n = Yo(e, n, r);
else {
if (s === "function")
return (
cn(() => {
let f = t();
for (; typeof f == "function"; ) f = f();
n = Pa(e, f, n, r);
}),
() => n
);
if (Array.isArray(t)) {
const f = [],
d = n && Array.isArray(n);
if (Ol(f, t, n, o))
return cn(() => (n = Pa(e, f, n, r, !0))), () => n;
if (f.length === 0) {
if (((n = Yo(e, n, r)), c)) return n;
} else
d
? n.length === 0
? Bp(e, f, r)
: v6(e, n, f)
: (n && Yo(e), Bp(e, f));
n = f;
} else if (t.nodeType) {
if (Array.isArray(n)) {
if (c) return (n = Yo(e, n, r, t));
Yo(e, n, null, t);
} else
n == null || n === "" || !e.firstChild
? e.appendChild(t)
: e.replaceChild(t, e.firstChild);
n = t;
}
}
return n;
}
function Ol(e, t, n, r) {
let o = !1;
for (let s = 0, c = t.length; s < c; s++) {
let f = t[s],
d = n && n[s],
h;
if (!(f == null || f === !0 || f === !1))
if ((h = typeof f) == "object" && f.nodeType) e.push(f);
else if (Array.isArray(f)) o = Ol(e, f, d) || o;
else if (h === "function")
if (r) {
for (; typeof f == "function"; ) f = f();
o =
Ol(
e,
Array.isArray(f) ? f : [f],
Array.isArray(d) ? d : [d]
) || o;
} else e.push(f), (o = !0);
else {
const y = String(f);
d && d.nodeType === 3 && d.data === y
? e.push(d)
: e.push(document.createTextNode(y));
}
}
return o;
}
function Bp(e, t, n = null) {
for (let r = 0, o = t.length; r < o; r++) e.insertBefore(t[r], n);
}
function Yo(e, t, n, r) {
if (n === void 0) return (e.textContent = "");
const o = r || document.createTextNode("");
if (t.length) {
let s = !1;
for (let c = t.length - 1; c >= 0; c--) {
const f = t[c];
if (o !== f) {
const d = f.parentNode === e;
!s && !c
? d
? e.replaceChild(o, f)
: e.insertBefore(o, n)
: d && f.remove();
} else s = !0;
}
} else e.insertBefore(o, n);
return [o];
}
function A6(e) {
return Object.keys(e).reduce((n, r) => {
const o = e[r];
return (
(n[r] = Object.assign({}, o)),
Sw(o.value) &&
!P6(o.value) &&
!Array.isArray(o.value) &&
(n[r].value = Object.assign({}, o.value)),
Array.isArray(o.value) && (n[r].value = o.value.slice(0)),
n
);
}, {});
}
function S6(e) {
return e
? Object.keys(e).reduce((n, r) => {
const o = e[r];
return (
(n[r] = Sw(o) && "value" in o ? o : { value: o }),
n[r].attribute || (n[r].attribute = T6(r)),
(n[r].parse =
"parse" in n[r] ? n[r].parse : typeof n[r].value != "string"),
n
);
}, {})
: {};
}
function $6(e) {
return Object.keys(e).reduce((n, r) => ((n[r] = e[r].value), n), {});
}
function x6(e, t) {
const n = A6(t);
return (
Object.keys(t).forEach((o) => {
const s = n[o],
c = e.getAttribute(s.attribute),
f = e[o];
c && (s.value = s.parse ? Aw(c) : c),
f != null && (s.value = Array.isArray(f) ? f.slice(0) : f),
s.reflect && Cp(e, s.attribute, s.value),
Object.defineProperty(e, o, {
get() {
return s.value;
},
set(d) {
const h = s.value;
(s.value = d), s.reflect && Cp(this, s.attribute, s.value);
for (
let y = 0, m = this.__propertyChangedCallbacks.length;
y < m;
y++
)
this.__propertyChangedCallbacks[y](o, d, h);
},
enumerable: !0,
configurable: !0,
});
}),
n
);
}
function Aw(e) {
if (e)
try {
return JSON.parse(e);
} catch {
return e;
}
}
function Cp(e, t, n) {
if (n == null || n === !1) return e.removeAttribute(t);
let r = JSON.stringify(n);
(e.__updating[t] = !0),
r === "true" && (r = ""),
e.setAttribute(t, r),
Promise.resolve().then(() => delete e.__updating[t]);
}
function T6(e) {
return e
.replace(/\.?([A-Z]+)/g, (t, n) => "-" + n.toLowerCase())
.replace("_", "-")
.replace(/^-/, "");
}
function Sw(e) {
return e != null && (typeof e == "object" || typeof e == "function");
}
function P6(e) {
return Object.prototype.toString.call(e) === "[object Function]";
}
function L6(e) {
return typeof e == "function" && e.toString().indexOf("class") === 0;
}
let Mu;
function B6(e, t) {
const n = Object.keys(t);
return class extends e {
static get observedAttributes() {
return n.map((o) => t[o].attribute);
}
constructor() {
super(),
(this.__initialized = !1),
(this.__released = !1),
(this.__releaseCallbacks = []),
(this.__propertyChangedCallbacks = []),
(this.__updating = {}),
(this.props = {});
}
connectedCallback() {
if (this.__initialized) return;
(this.__releaseCallbacks = []),
(this.__propertyChangedCallbacks = []),
(this.__updating = {}),
(this.props = x6(this, t));
const o = $6(this.props),
s = this.Component,
c = Mu;
try {
(Mu = this),
(this.__initialized = !0),
L6(s) ? new s(o, { element: this }) : s(o, { element: this });
} finally {
Mu = c;
}
}
async disconnectedCallback() {
if ((await Promise.resolve(), this.isConnected)) return;
this.__propertyChangedCallbacks.length = 0;
let o = null;
for (; (o = this.__releaseCallbacks.pop()); ) o(this);
delete this.__initialized, (this.__released = !0);
}
attributeChangedCallback(o, s, c) {
if (
this.__initialized &&
!this.__updating[o] &&
((o = this.lookupProp(o)), o in t)
) {
if (c == null && !this[o]) return;
this[o] = t[o].parse ? Aw(c) : c;
}
}
lookupProp(o) {
if (t) return n.find((s) => o === s || o === t[s].attribute);
}
get renderRoot() {
return this.shadowRoot || this.attachShadow({ mode: "open" });
}
addReleaseCallback(o) {
this.__releaseCallbacks.push(o);
}
addPropertyChangedCallback(o) {
this.__propertyChangedCallbacks.push(o);
}
};
}
function C6(e, t = {}, n = {}) {
const { BaseElement: r = HTMLElement, extension: o } = n;
return (s) => {
let c = customElements.get(e);
return c
? ((c.prototype.Component = s), c)
: ((c = B6(r, S6(t))),
(c.prototype.Component = s),
(c.prototype.registeredTag = e),
customElements.define(e, c, o),
c);
};
}
function I6(e) {
const t = Object.keys(e),
n = {};
for (let r = 0; r < t.length; r++) {
const [o, s] = dt(e[t[r]]);
Object.defineProperty(n, t[r], {
get: o,
set(c) {
s(() => c);
},
});
}
return n;
}
function O6(e) {
if (e.assignedSlot && e.assignedSlot._$owner)
return e.assignedSlot._$owner;
let t = e.parentNode;
for (; t && !t._$owner && !(t.assignedSlot && t.assignedSlot._$owner); )
t = t.parentNode;
return t && t.assignedSlot ? t.assignedSlot._$owner : e._$owner;
}
function N6(e) {
return (t, n) => {
const { element: r } = n;
return Il((o) => {
const s = I6(t);
r.addPropertyChangedCallback((f, d) => (s[f] = d)),
r.addReleaseCallback(() => {
(r.renderRoot.textContent = ""), o();
});
const c = e(s, n);
return xe(r.renderRoot, c);
}, O6(r));
};
}
function R6(e, t, n) {
return arguments.length === 2 && ((n = t), (t = {})), C6(e, t)(N6(n));
}
const z6 = `#ztr-content,
#ztr-content img {
max-width: 100%;
}
#ztr-root {
display: flex;
flex-direction: column;
font-family: var(--ztr-font);
font-size: var(--ztr-font-size);
color: var(--ztr-text-color);
border: 1px solid transparent;
word-wrap: break-word;
/* removes margin collapse */
margin-top: 4em;
line-height: 1.2em;
}
#ztr-subtitle {
font-size: 1.2em;
color: #666;
}
a {
color: var(--ztr-link-color);
text-decoration: none;
}
/* Comment */
.ztr-comment {
position: relative;
margin: 0;
padding: 0;
}
.ztr-comment,
.ztr-reply-button {
background-color: var(--ztr-background-color, rgba(0, 0, 0, 0.03));
}
.ztr-comment-body {
padding: 1em;
}
.ztr-comment:first-child {
border-top-left-radius: 0.3em;
border-top-right-radius: 0.3em;
}
.ztr-comment:last-child {
border-bottom-left-radius: 0.3em;
border-bottom-right-radius: 0.3em;
}
.ztr-comment-info-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
}
.ztr-comment-info {
display: flex;
align-items: center;
}
.ztr-comment-info-picture {
width: 3.5em;
}
ul.ztr-comment-info-items {
display: flex;
align-items: center;
list-style: none;
margin: 0;
padding: 0;
font-size: 0.9em;
}
ul.ztr-comment-info-items li {
display: inline-block;
cursor: default;
padding-right: 0.5em;
}
ul.ztr-comment-info-items li a {
font-weight: 600;
}
.ztr-comment-info-author a {
font-size: 1.2em;
padding-right: 0.2em;
}
.ztr-comment-info-dots {
cursor: pointer;
}
.ztr-comment-info-separator {
width: 0.5em;
}
.ztr-comment-info-picture img {
width: 2em;
height: 2em;
border-radius: 50%;
padding: 0.5em;
position: relative;
display: block;
object-fit: cover;
}
.ztr-comment-text,
#ztr-content {
margin-bottom: 0.75em;
padding: 0 0.8em 0 3.5em;
line-height: 1.5em;
line-break: loose;
word-break: break-word;
overflow: hidden;
max-width: 750px;
}
.ztr-comment-text p {
margin: 0 0 0.5em 0;
}
.ztr-comment-text code {
font-size: 1.1em;
margin: 0 0.2em;
}
.ztr-comment-text pre,
.ztr-info-pane pre {
white-space: pre-wrap;
white-space: -moz-pre-wrap;
word-wrap: break-word;
}
.ztr-comment-text a:hover {
text-decoration: underline;
}
.ztr-comment-text img {
max-width: 100%;
}
.ztr-comment-text .warning {
margin-top: 0em;
font-size: 0.8em;
display: flex;
align-items: center;
}
.ztr-comment-text .warning svg {
height: 1.2em;
fill: #e4984d;
padding-right: 0.7em;
}
.ztr-comment-replies {
margin-left: 2em;
}
.highlight p {
background: #F6AD55;
color: #2B2B2B;
display: inline;
padding: 0.2em;
}
/* Styling the reply to comment form */
.ztr-comment-expand {
display: flex;
justify-content: center;
}
.ztr-comment-expand span {
margin: 1em 0 1em 0.35em;
cursor: pointer;
}
ul.ztr-comment-actions,
.ztr-comment-expand {
display: flex;
align-items: center;
list-style: none;
margin: 0;
padding: 0 0 0 3.5em;
font-weight: 600;
user-select: none;
}
ul.ztr-comment-actions li {
display: inline-flex;
align-items: center;
text-align: center;
padding: 0 2em 0 0;
cursor: pointer;
}
ul.ztr-comment-actions li span {
padding: 0.25em 0.25em 0 0.25em;
color: var(--ztr-icon-color, #3B3B3B);
}
svg {
fill: var(--ztr-icon-color, #3B3B3B);
width: 1.1em;
height: 1.1em;
}
.ztr-comment-action-reply:hover svg {
fill: #92379c;
}
.ztr-comment-action-reply:hover span {
color: #92379c;
}
.ztr-comment-action-zap:hover svg {
fill: #e4984d;
}
.ztr-comment-action-zap:hover span {
color: #e4984d;
}
.ztr-comment-action-like:hover svg {
fill: #e35428;
}
.ztr-comment-action-like:hover span {
color: #e35428;
}
.ztr-reply-form {
padding: 0 0.5em 0 3.5em;
}
.ztr-reply-form textarea {
font-family: var(--ztr-font);
font-size: 1.1em;
line-height: 1.4;
color: #2B2B2B;
background-color: #FDFDFD;
border: 1px solid #BBB;
outline: none;
width: calc(100% - 1.5em);
padding: 0.7em;
margin: 0.5em 0;
height: 4em;
border-radius: 0.2em;
min-height: 4em;
resize: vertical;
}
.ztr-reply-form:disabled {
opacity: 65%;
user-select: none;
}
.ztr-reply-controls {
display: flex;
align-items: center;
justify-content: flex-end;
}
.ztr-reply-controls span {
font-weight: bold;
font-size: 0.85em;
margin-right: 1em;
user-select: none;
cursor: default;
}
.ztr-reply-error {
color: rgb(202, 23, 23);
}
.ztr-reply-controls button {
font-family: var(--ztr-font);
appearance: none;
border: none;
padding: 0.5em 1em;
border-radius: 0.2em;
font-size: 0.85em;
font-weight: 600;
cursor: pointer;
}
.ztr-reply-login-button {
color: white;
background-color: var(--ztr-login-button-color, #2B2B2B);
margin-left: 1em;
}
.ztr-reply-button {
color: var(--ztr-text-color);
display: flex;
align-items: center;
}
.ztr-info-pane {
padding: 0 0.5em 1em 3.5em;
}
.ztr-info-pane pre {
font-size: 0.8em;
}
.ztr-spinner {
width: 1.2em;
height: 1.2em;
padding: 0.9em;
animation: rotate 4s linear infinite;
}
.ztr-reply-button:disabled {
opacity: 65%;
pointer-events: none;
cursor: pointer;
user-select: none;
}
.ztr-spinner .path {
stroke: var(--ztr-text-color, #2B2B2B);
stroke-linecap: round;
animation: dash 1.5s ease-in-out infinite;
}
@keyframes rotate {
100% {
transform: rotate(360deg);
}
}
@keyframes dash {
0% {
stroke-dasharray: 1, 150;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -35;
}
100% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -124;
}
}
/* new */
.ztr-comment-new .ztr-reply-form {
margin: 0.5em 0;
padding: 0;
}
.ztr-comment-new .ztr-comment-body {
padding: 0;
}
.ztr-comment-new .ztr-comment-actions {
font-size: 1.1em;
padding: 0;
}
/* Dark mode defaults */
@media (prefers-color-scheme: dark) {
.ztr-spinner .path {
stroke: var(--ztr-text-color, #DEDEDE);
}
.ztr-comment,
.ztr-reply-button {
background-color: var(--ztr-background-color, rgba(255, 255, 255, 0.06));
}
.ztr-reply-login-button {
color: #2B2B2B;
background-color: var(--ztr-login-button-color, #DEDEDE);
}
svg {
fill: var(--ztr-icon-color, #DEDEDE);
}
ul.ztr-comment-actions li span {
color: var(--ztr-icon-color);
}
.ztr-comment-action-reply:hover svg {
fill: #96609c;
}
.ztr-comment-action-reply:hover span {
color: #96609c;
}
}`;
function Ip(e) {
if (!Number.isSafeInteger(e) || e < 0)
throw new Error(`Wrong positive integer: ${e}`);
}
function $w(e, ...t) {
if (!(e instanceof Uint8Array)) throw new Error("Expected Uint8Array");
if (t.length > 0 && !t.includes(e.length))
throw new Error(
`Expected Uint8Array of length ${t}, not of length=${e.length}`
);
}
function U6(e) {
if (typeof e != "function" || typeof e.create != "function")
throw new Error("Hash should be wrapped by utils.wrapConstructor");
Ip(e.outputLen), Ip(e.blockLen);
}
function La(e, t = !0) {
if (e.destroyed) throw new Error("Hash instance has been destroyed");
if (t && e.finished)
throw new Error("Hash#digest() has already been called");
}
function M6(e, t) {
$w(e);
const n = t.outputLen;
if (e.length < n)
throw new Error(
`digestInto() expects output buffer of length at least ${n}`
);
}
const Hu =
typeof globalThis == "object" && "crypto" in globalThis
? globalThis.crypto
: void 0;
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const xw =
(e) => e instanceof Uint8Array,
ju = (e) => new DataView(e.buffer, e.byteOffset, e.byteLength),
Tn = (e, t) => (e << (32 - t)) | (e >>> t),
H6 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
if (!H6) throw new Error("Non little-endian hardware is not supported");
function j6(e) {
if (typeof e != "string")
throw new Error(`utf8ToBytes expected string, got ${typeof e}`);
return new Uint8Array(new TextEncoder().encode(e));
}
function Ud(e) {
if ((typeof e == "string" && (e = j6(e)), !xw(e)))
throw new Error(`expected Uint8Array, got ${typeof e}`);
return e;
}
function D6(...e) {
const t = new Uint8Array(e.reduce((r, o) => r + o.length, 0));
let n = 0;
return (
e.forEach((r) => {
if (!xw(r)) throw new Error("Uint8Array expected");
t.set(r, n), (n += r.length);
}),
t
);
}
let Tw = class {
clone() {
return this._cloneInto();
}
};
function q6(e) {
const t = (r) => e().update(Ud(r)).digest(),
n = e();
return (
(t.outputLen = n.outputLen),
(t.blockLen = n.blockLen),
(t.create = () => e()),
t
);
}
function Pw(e = 32) {
if (Hu && typeof Hu.getRandomValues == "function")
return Hu.getRandomValues(new Uint8Array(e));
throw new Error("crypto.getRandomValues must be defined");
}
function V6(e, t, n, r) {
if (typeof e.setBigUint64 == "function") return e.setBigUint64(t, n, r);
const o = BigInt(32),
s = BigInt(4294967295),
c = Number((n >> o) & s),
f = Number(n & s),
d = r ? 4 : 0,
h = r ? 0 : 4;
e.setUint32(t + d, c, r), e.setUint32(t + h, f, r);
}
let F6 = class extends Tw {
constructor(t, n, r, o) {
super(),
(this.blockLen = t),
(this.outputLen = n),
(this.padOffset = r),
(this.isLE = o),
(this.finished = !1),
(this.length = 0),
(this.pos = 0),
(this.destroyed = !1),
(this.buffer = new Uint8Array(t)),
(this.view = ju(this.buffer));
}
update(t) {
La(this);
const { view: n, buffer: r, blockLen: o } = this;
t = Ud(t);
const s = t.length;
for (let c = 0; c < s; ) {
const f = Math.min(o - this.pos, s - c);
if (f === o) {
const d = ju(t);
for (; o <= s - c; c += o) this.process(d, c);
continue;
}
r.set(t.subarray(c, c + f), this.pos),
(this.pos += f),
(c += f),
this.pos === o && (this.process(n, 0), (this.pos = 0));
}
return (this.length += t.length), this.roundClean(), this;
}
digestInto(t) {
La(this), M6(t, this), (this.finished = !0);
const { buffer: n, view: r, blockLen: o, isLE: s } = this;
let { pos: c } = this;
(n[c++] = 128),
this.buffer.subarray(c).fill(0),
this.padOffset > o - c && (this.process(r, 0), (c = 0));
for (let m = c; m < o; m++) n[m] = 0;
V6(r, o - 8, BigInt(this.length * 8), s), this.process(r, 0);
const f = ju(t),
d = this.outputLen;
if (d % 4)
throw new Error("_sha2: outputLen should be aligned to 32bit");
const h = d / 4,
y = this.get();
if (h > y.length)
throw new Error("_sha2: outputLen bigger than state");
for (let m = 0; m < h; m++) f.setUint32(4 * m, y[m], s);
}
digest() {
const { buffer: t, outputLen: n } = this;
this.digestInto(t);
const r = t.slice(0, n);
return this.destroy(), r;
}
_cloneInto(t) {
t || (t = new this.constructor()), t.set(...this.get());
const {
blockLen: n,
buffer: r,
length: o,
finished: s,
destroyed: c,
pos: f,
} = this;
return (
(t.length = o),
(t.pos = f),
(t.finished = s),
(t.destroyed = c),
o % n && t.buffer.set(r),
t
);
}
};
const K6 = (e, t, n) => (e & t) ^ (~e & n),
W6 = (e, t, n) => (e & t) ^ (e & n) ^ (t & n),
G6 = new Uint32Array([
1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993,
2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987,
1925078388, 2162078206, 2614888103, 3248222580, 3835390401,
4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692,
1996064986, 2554220882, 2821834349, 2952996808, 3210313671,
3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912,
1294757372, 1396182291, 1695183700, 1986661051, 2177026350,
2456956037, 2730485921, 2820302411, 3259730800, 3345764771,
3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616,
659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779,
1955562222, 2024104815, 2227730452, 2361852424, 2428436474,
2756734187, 3204031479, 3329325298,
]),
Nr = new Uint32Array([
1779033703, 3144134277, 1013904242, 2773480762, 1359893119,
2600822924, 528734635, 1541459225,
]),
Rr = new Uint32Array(64);
let Z6 = class extends F6 {
constructor() {
super(64, 32, 8, !1),
(this.A = Nr[0] | 0),
(this.B = Nr[1] | 0),
(this.C = Nr[2] | 0),
(this.D = Nr[3] | 0),
(this.E = Nr[4] | 0),
(this.F = Nr[5] | 0),
(this.G = Nr[6] | 0),
(this.H = Nr[7] | 0);
}
get() {
const { A: t, B: n, C: r, D: o, E: s, F: c, G: f, H: d } = this;
return [t, n, r, o, s, c, f, d];
}
set(t, n, r, o, s, c, f, d) {
(this.A = t | 0),
(this.B = n | 0),
(this.C = r | 0),
(this.D = o | 0),
(this.E = s | 0),
(this.F = c | 0),
(this.G = f | 0),
(this.H = d | 0);
}
process(t, n) {
for (let m = 0; m < 16; m++, n += 4) Rr[m] = t.getUint32(n, !1);
for (let m = 16; m < 64; m++) {
const v = Rr[m - 15],
P = Rr[m - 2],
C = Tn(v, 7) ^ Tn(v, 18) ^ (v >>> 3),
A = Tn(P, 17) ^ Tn(P, 19) ^ (P >>> 10);
Rr[m] = (A + Rr[m - 7] + C + Rr[m - 16]) | 0;
}
let { A: r, B: o, C: s, D: c, E: f, F: d, G: h, H: y } = this;
for (let m = 0; m < 64; m++) {
const v = Tn(f, 6) ^ Tn(f, 11) ^ Tn(f, 25),
P = (y + v + K6(f, d, h) + G6[m] + Rr[m]) | 0,
A = ((Tn(r, 2) ^ Tn(r, 13) ^ Tn(r, 22)) + W6(r, o, s)) | 0;
(y = h),
(h = d),
(d = f),
(f = (c + P) | 0),
(c = s),
(s = o),
(o = r),
(r = (P + A) | 0);
}
(r = (r + this.A) | 0),
(o = (o + this.B) | 0),
(s = (s + this.C) | 0),
(c = (c + this.D) | 0),
(f = (f + this.E) | 0),
(d = (d + this.F) | 0),
(h = (h + this.G) | 0),
(y = (y + this.H) | 0),
this.set(r, o, s, c, f, d, h, y);
}
roundClean() {
Rr.fill(0);
}
destroy() {
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
}
};
const Nl = q6(() => new Z6());
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const Lw =
BigInt(0),
yc = BigInt(1),
Y6 = BigInt(2),
vc = (e) => e instanceof Uint8Array,
J6 = Array.from({ length: 256 }, (e, t) =>
t.toString(16).padStart(2, "0")
);
function Ai(e) {
if (!vc(e)) throw new Error("Uint8Array expected");
let t = "";
for (let n = 0; n < e.length; n++) t += J6[e[n]];
return t;
}
function Bw(e) {
const t = e.toString(16);
return t.length & 1 ? `0${t}` : t;
}
function Md(e) {
if (typeof e != "string")
throw new Error("hex string expected, got " + typeof e);
return BigInt(e === "" ? "0" : `0x${e}`);
}
function Si(e) {
if (typeof e != "string")
throw new Error("hex string expected, got " + typeof e);
const t = e.length;
if (t % 2)
throw new Error(
"padded hex string expected, got unpadded hex of length " + t
);
const n = new Uint8Array(t / 2);
for (let r = 0; r < n.length; r++) {
const o = r * 2,
s = e.slice(o, o + 2),
c = Number.parseInt(s, 16);
if (Number.isNaN(c) || c < 0)
throw new Error("Invalid byte sequence");
n[r] = c;
}
return n;
}
function Kt(e) {
return Md(Ai(e));
}
function Hd(e) {
if (!vc(e)) throw new Error("Uint8Array expected");
return Md(Ai(Uint8Array.from(e).reverse()));
}
function eo(e, t) {
return Si(e.toString(16).padStart(t * 2, "0"));
}
function jd(e, t) {
return eo(e, t).reverse();
}
function X6(e) {
return Si(Bw(e));
}
function Pt(e, t, n) {
let r;
if (typeof t == "string")
try {
r = Si(t);
} catch (s) {
throw new Error(
`${e} must be valid hex string, got "${t}". Cause: ${s}`
);
}
else if (vc(t)) r = Uint8Array.from(t);
else throw new Error(`${e} must be hex string or Uint8Array`);
const o = r.length;
if (typeof n == "number" && o !== n)
throw new Error(`${e} expected ${n} bytes, got ${o}`);
return r;
}
function Ro(...e) {
const t = new Uint8Array(e.reduce((r, o) => r + o.length, 0));
let n = 0;
return (
e.forEach((r) => {
if (!vc(r)) throw new Error("Uint8Array expected");
t.set(r, n), (n += r.length);
}),
t
);
}
function Q6(e, t) {
if (e.length !== t.length) return !1;
for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
return !0;
}
function ek(e) {
if (typeof e != "string")
throw new Error(`utf8ToBytes expected string, got ${typeof e}`);
return new Uint8Array(new TextEncoder().encode(e));
}
function tk(e) {
let t;
for (t = 0; e > Lw; e >>= yc, t += 1);
return t;
}
function nk(e, t) {
return (e >> BigInt(t)) & yc;
}
const rk = (e, t, n) => e | ((n ? yc : Lw) << BigInt(t)),
Dd = (e) => (Y6 << BigInt(e - 1)) - yc,
Du = (e) => new Uint8Array(e),
Op = (e) => Uint8Array.from(e);
function Cw(e, t, n) {
if (typeof e != "number" || e < 2)
throw new Error("hashLen must be a number");
if (typeof t != "number" || t < 2)
throw new Error("qByteLen must be a number");
if (typeof n != "function")
throw new Error("hmacFn must be a function");
let r = Du(e),
o = Du(e),
s = 0;
const c = () => {
r.fill(1), o.fill(0), (s = 0);
},
f = (...m) => n(o, r, ...m),
d = (m = Du()) => {
(o = f(Op([0]), m)),
(r = f()),
m.length !== 0 && ((o = f(Op([1]), m)), (r = f()));
},
h = () => {
if (s++ >= 1e3) throw new Error("drbg: tried 1000 values");
let m = 0;
const v = [];
for (; m < t; ) {
r = f();
const P = r.slice();
v.push(P), (m += r.length);
}
return Ro(...v);
};
return (m, v) => {
c(), d(m);
let P;
for (; !(P = v(h())); ) d();
return c(), P;
};
}
const ok = {
bigint: (e) => typeof e == "bigint",
function: (e) => typeof e == "function",
boolean: (e) => typeof e == "boolean",
string: (e) => typeof e == "string",
stringOrUint8Array: (e) =>
typeof e == "string" || e instanceof Uint8Array,
isSafeInteger: (e) => Number.isSafeInteger(e),
array: (e) => Array.isArray(e),
field: (e, t) => t.Fp.isValid(e),
hash: (e) =>
typeof e == "function" && Number.isSafeInteger(e.outputLen),
};
function $s(e, t, n = {}) {
const r = (o, s, c) => {
const f = ok[s];
if (typeof f != "function")
throw new Error(`Invalid validator "${s}", expected function`);
const d = e[o];
if (!(c && d === void 0) && !f(d, e))
throw new Error(
`Invalid param ${String(o)}=${d} (${typeof d}), expected ${s}`
);
};
for (const [o, s] of Object.entries(t)) r(o, s, !1);
for (const [o, s] of Object.entries(n)) r(o, s, !0);
return e;
}
const ik = Object.freeze(
Object.defineProperty(
{
__proto__: null,
bitGet: nk,
bitLen: tk,
bitMask: Dd,
bitSet: rk,
bytesToHex: Ai,
bytesToNumberBE: Kt,
bytesToNumberLE: Hd,
concatBytes: Ro,
createHmacDrbg: Cw,
ensureBytes: Pt,
equalBytes: Q6,
hexToBytes: Si,
hexToNumber: Md,
numberToBytesBE: eo,
numberToBytesLE: jd,
numberToHexUnpadded: Bw,
numberToVarBytesBE: X6,
utf8ToBytes: ek,
validateObject: $s,
},
Symbol.toStringTag,
{ value: "Module" }
)
);
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const bt =
BigInt(0),
it = BigInt(1),
So = BigInt(2),
sk = BigInt(3),
Rl = BigInt(4),
Np = BigInt(5),
Rp = BigInt(8);
BigInt(9);
BigInt(16);
function kt(e, t) {
const n = e % t;
return n >= bt ? n : t + n;
}
function ak(e, t, n) {
if (n <= bt || t < bt) throw new Error("Expected power/modulo > 0");
if (n === it) return bt;
let r = it;
for (; t > bt; )
t & it && (r = (r * e) % n), (e = (e * e) % n), (t >>= it);
return r;
}
function nn(e, t, n) {
let r = e;
for (; t-- > bt; ) (r *= r), (r %= n);
return r;
}
function zl(e, t) {
if (e === bt || t <= bt)
throw new Error(
`invert: expected positive integers, got n=${e} mod=${t}`
);
let n = kt(e, t),
r = t,
o = bt,
s = it;
for (; n !== bt; ) {
const f = r / n,
d = r % n,
h = o - s * f;
(r = n), (n = d), (o = s), (s = h);
}
if (r !== it) throw new Error("invert: does not exist");
return kt(o, t);
}
function ck(e) {
const t = (e - it) / So;
let n, r, o;
for (n = e - it, r = 0; n % So === bt; n /= So, r++);
for (o = So; o < e && ak(o, t, e) !== e - it; o++);
if (r === 1) {
const c = (e + it) / Rl;
return function (d, h) {
const y = d.pow(h, c);
if (!d.eql(d.sqr(y), h)) throw new Error("Cannot find square root");
return y;
};
}
const s = (n + it) / So;
return function (f, d) {
if (f.pow(d, t) === f.neg(f.ONE))
throw new Error("Cannot find square root");
let h = r,
y = f.pow(f.mul(f.ONE, o), n),
m = f.pow(d, s),
v = f.pow(d, n);
for (; !f.eql(v, f.ONE); ) {
if (f.eql(v, f.ZERO)) return f.ZERO;
let P = 1;
for (let A = f.sqr(v); P < h && !f.eql(A, f.ONE); P++) A = f.sqr(A);
const C = f.pow(y, it << BigInt(h - P - 1));
(y = f.sqr(C)), (m = f.mul(m, C)), (v = f.mul(v, y)), (h = P);
}
return m;
};
}
function uk(e) {
if (e % Rl === sk) {
const t = (e + it) / Rl;
return function (r, o) {
const s = r.pow(o, t);
if (!r.eql(r.sqr(s), o)) throw new Error("Cannot find square root");
return s;
};
}
if (e % Rp === Np) {
const t = (e - Np) / Rp;
return function (r, o) {
const s = r.mul(o, So),
c = r.pow(s, t),
f = r.mul(o, c),
d = r.mul(r.mul(f, So), c),
h = r.mul(f, r.sub(d, r.ONE));
if (!r.eql(r.sqr(h), o)) throw new Error("Cannot find square root");
return h;
};
}
return ck(e);
}
const lk = [
"create",
"isValid",
"is0",
"neg",
"inv",
"sqrt",
"sqr",
"eql",
"add",
"sub",
"mul",
"pow",
"div",
"addN",
"subN",
"mulN",
"sqrN",
];
function dk(e) {
const t = {
ORDER: "bigint",
MASK: "bigint",
BYTES: "isSafeInteger",
BITS: "isSafeInteger",
},
n = lk.reduce((r, o) => ((r[o] = "function"), r), t);
return $s(e, n);
}
function fk(e, t, n) {
if (n < bt) throw new Error("Expected power > 0");
if (n === bt) return e.ONE;
if (n === it) return t;
let r = e.ONE,
o = t;
for (; n > bt; )
n & it && (r = e.mul(r, o)), (o = e.sqr(o)), (n >>= it);
return r;
}
function hk(e, t) {
const n = new Array(t.length),
r = t.reduce(
(s, c, f) => (e.is0(c) ? s : ((n[f] = s), e.mul(s, c))),
e.ONE
),
o = e.inv(r);
return (
t.reduceRight(
(s, c, f) =>
e.is0(c) ? s : ((n[f] = e.mul(s, n[f])), e.mul(s, c)),
o
),
n
);
}
function Iw(e, t) {
const n = t !== void 0 ? t : e.toString(2).length,
r = Math.ceil(n / 8);
return { nBitLength: n, nByteLength: r };
}
function pk(e, t, n = !1, r = {}) {
if (e <= bt) throw new Error(`Expected Field ORDER > 0, got ${e}`);
const { nBitLength: o, nByteLength: s } = Iw(e, t);
if (s > 2048)
throw new Error("Field lengths over 2048 bytes are not supported");
const c = uk(e),
f = Object.freeze({
ORDER: e,
BITS: o,
BYTES: s,
MASK: Dd(o),
ZERO: bt,
ONE: it,
create: (d) => kt(d, e),
isValid: (d) => {
if (typeof d != "bigint")
throw new Error(
`Invalid field element: expected bigint, got ${typeof d}`
);
return bt <= d && d < e;
},
is0: (d) => d === bt,
isOdd: (d) => (d & it) === it,
neg: (d) => kt(-d, e),
eql: (d, h) => d === h,
sqr: (d) => kt(d * d, e),
add: (d, h) => kt(d + h, e),
sub: (d, h) => kt(d - h, e),
mul: (d, h) => kt(d * h, e),
pow: (d, h) => fk(f, d, h),
div: (d, h) => kt(d * zl(h, e), e),
sqrN: (d) => d * d,
addN: (d, h) => d + h,
subN: (d, h) => d - h,
mulN: (d, h) => d * h,
inv: (d) => zl(d, e),
sqrt: r.sqrt || ((d) => c(f, d)),
invertBatch: (d) => hk(f, d),
cmov: (d, h, y) => (y ? h : d),
toBytes: (d) => (n ? jd(d, s) : eo(d, s)),
fromBytes: (d) => {
if (d.length !== s)
throw new Error(`Fp.fromBytes: expected ${s}, got ${d.length}`);
return n ? Hd(d) : Kt(d);
},
});
return Object.freeze(f);
}
function Ow(e) {
if (typeof e != "bigint") throw new Error("field order must be bigint");
const t = e.toString(2).length;
return Math.ceil(t / 8);
}
function Nw(e) {
const t = Ow(e);
return t + Math.ceil(t / 2);
}
function gk(e, t, n = !1) {
const r = e.length,
o = Ow(t),
s = Nw(t);
if (r < 16 || r < s || r > 1024)
throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);
const c = n ? Kt(e) : Hd(e),
f = kt(c, t - it) + it;
return n ? jd(f, o) : eo(f, o);
}
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const wk =
BigInt(0),
qu = BigInt(1);
function mk(e, t) {
const n = (o, s) => {
const c = s.negate();
return o ? c : s;
},
r = (o) => {
const s = Math.ceil(t / o) + 1,
c = 2 ** (o - 1);
return { windows: s, windowSize: c };
};
return {
constTimeNegate: n,
unsafeLadder(o, s) {
let c = e.ZERO,
f = o;
for (; s > wk; )
s & qu && (c = c.add(f)), (f = f.double()), (s >>= qu);
return c;
},
precomputeWindow(o, s) {
const { windows: c, windowSize: f } = r(s),
d = [];
let h = o,
y = h;
for (let m = 0; m < c; m++) {
(y = h), d.push(y);
for (let v = 1; v < f; v++) (y = y.add(h)), d.push(y);
h = y.double();
}
return d;
},
wNAF(o, s, c) {
const { windows: f, windowSize: d } = r(o);
let h = e.ZERO,
y = e.BASE;
const m = BigInt(2 ** o - 1),
v = 2 ** o,
P = BigInt(o);
for (let C = 0; C < f; C++) {
const A = C * d;
let O = Number(c & m);
(c >>= P), O > d && ((O -= v), (c += qu));
const M = A,
T = A + Math.abs(O) - 1,
N = C % 2 !== 0,
l = O < 0;
O === 0 ? (y = y.add(n(N, s[M]))) : (h = h.add(n(l, s[T])));
}
return { p: h, f: y };
},
wNAFCached(o, s, c, f) {
const d = o._WINDOW_SIZE || 1;
let h = s.get(o);
return (
h ||
((h = this.precomputeWindow(o, d)), d !== 1 && s.set(o, f(h))),
this.wNAF(d, h, c)
);
},
};
}
function Rw(e) {
return (
dk(e.Fp),
$s(
e,
{ n: "bigint", h: "bigint", Gx: "field", Gy: "field" },
{ nBitLength: "isSafeInteger", nByteLength: "isSafeInteger" }
),
Object.freeze({ ...Iw(e.n, e.nBitLength), ...e, p: e.Fp.ORDER })
);
}
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ function bk(
e
) {
const t = Rw(e);
$s(
t,
{ a: "field", b: "field" },
{
allowedPrivateKeyLengths: "array",
wrapPrivateKey: "boolean",
isTorsionFree: "function",
clearCofactor: "function",
allowInfinityPoint: "boolean",
fromBytes: "function",
toBytes: "function",
}
);
const { endo: n, Fp: r, a: o } = t;
if (n) {
if (!r.eql(o, r.ZERO))
throw new Error(
"Endomorphism can only be defined for Koblitz curves that have a=0"
);
if (
typeof n != "object" ||
typeof n.beta != "bigint" ||
typeof n.splitScalar != "function"
)
throw new Error(
"Expected endomorphism with beta: bigint and splitScalar: function"
);
}
return Object.freeze({ ...t });
}
const { bytesToNumberBE: yk, hexToBytes: vk } = ik,
Po = {
Err: class extends Error {
constructor(t = "") {
super(t);
}
},
_parseInt(e) {
const { Err: t } = Po;
if (e.length < 2 || e[0] !== 2)
throw new t("Invalid signature integer tag");
const n = e[1],
r = e.subarray(2, n + 2);
if (!n || r.length !== n)
throw new t("Invalid signature integer: wrong length");
if (r[0] & 128) throw new t("Invalid signature integer: negative");
if (r[0] === 0 && !(r[1] & 128))
throw new t(
"Invalid signature integer: unnecessary leading zero"
);
return { d: yk(r), l: e.subarray(n + 2) };
},
toSig(e) {
const { Err: t } = Po,
n = typeof e == "string" ? vk(e) : e;
if (!(n instanceof Uint8Array)) throw new Error("ui8a expected");
let r = n.length;
if (r < 2 || n[0] != 48) throw new t("Invalid signature tag");
if (n[1] !== r - 2)
throw new t("Invalid signature: incorrect length");
const { d: o, l: s } = Po._parseInt(n.subarray(2)),
{ d: c, l: f } = Po._parseInt(s);
if (f.length)
throw new t("Invalid signature: left bytes after parsing");
return { r: o, s: c };
},
hexFromSig(e) {
const t = (h) => (Number.parseInt(h[0], 16) & 8 ? "00" + h : h),
n = (h) => {
const y = h.toString(16);
return y.length & 1 ? `0${y}` : y;
},
r = t(n(e.s)),
o = t(n(e.r)),
s = r.length / 2,
c = o.length / 2,
f = n(s),
d = n(c);
return `30${n(c + s + 4)}02${d}${o}02${f}${r}`;
},
},
tr = BigInt(0),
on = BigInt(1);
BigInt(2);
const zp = BigInt(3);
BigInt(4);
function _k(e) {
const t = bk(e),
{ Fp: n } = t,
r =
t.toBytes ||
((C, A, O) => {
const M = A.toAffine();
return Ro(Uint8Array.from([4]), n.toBytes(M.x), n.toBytes(M.y));
}),
o =
t.fromBytes ||
((C) => {
const A = C.subarray(1),
O = n.fromBytes(A.subarray(0, n.BYTES)),
M = n.fromBytes(A.subarray(n.BYTES, 2 * n.BYTES));
return { x: O, y: M };
});
function s(C) {
const { a: A, b: O } = t,
M = n.sqr(C),
T = n.mul(M, C);
return n.add(n.add(T, n.mul(C, A)), O);
}
if (!n.eql(n.sqr(t.Gy), s(t.Gx)))
throw new Error("bad generator point: equation left != right");
function c(C) {
return typeof C == "bigint" && tr < C && C < t.n;
}
function f(C) {
if (!c(C))
throw new Error("Expected valid bigint: 0 < bigint < curve.n");
}
function d(C) {
const {
allowedPrivateKeyLengths: A,
nByteLength: O,
wrapPrivateKey: M,
n: T,
} = t;
if (A && typeof C != "bigint") {
if (
(C instanceof Uint8Array && (C = Ai(C)),
typeof C != "string" || !A.includes(C.length))
)
throw new Error("Invalid key");
C = C.padStart(O * 2, "0");
}
let N;
try {
N = typeof C == "bigint" ? C : Kt(Pt("private key", C, O));
} catch {
throw new Error(
`private key must be ${O} bytes, hex or bigint, not ${typeof C}`
);
}
return M && (N = kt(N, T)), f(N), N;
}
const h = new Map();
function y(C) {
if (!(C instanceof m)) throw new Error("ProjectivePoint expected");
}
class m {
constructor(A, O, M) {
if (
((this.px = A),
(this.py = O),
(this.pz = M),
A == null || !n.isValid(A))
)
throw new Error("x required");
if (O == null || !n.isValid(O)) throw new Error("y required");
if (M == null || !n.isValid(M)) throw new Error("z required");
}
static fromAffine(A) {
const { x: O, y: M } = A || {};
if (!A || !n.isValid(O) || !n.isValid(M))
throw new Error("invalid affine point");
if (A instanceof m) throw new Error("projective point not allowed");
const T = (N) => n.eql(N, n.ZERO);
return T(O) && T(M) ? m.ZERO : new m(O, M, n.ONE);
}
get x() {
return this.toAffine().x;
}
get y() {
return this.toAffine().y;
}
static normalizeZ(A) {
const O = n.invertBatch(A.map((M) => M.pz));
return A.map((M, T) => M.toAffine(O[T])).map(m.fromAffine);
}
static fromHex(A) {
const O = m.fromAffine(o(Pt("pointHex", A)));
return O.assertValidity(), O;
}
static fromPrivateKey(A) {
return m.BASE.multiply(d(A));
}
_setWindowSize(A) {
(this._WINDOW_SIZE = A), h.delete(this);
}
assertValidity() {
if (this.is0()) {
if (t.allowInfinityPoint && !n.is0(this.py)) return;
throw new Error("bad point: ZERO");
}
const { x: A, y: O } = this.toAffine();
if (!n.isValid(A) || !n.isValid(O))
throw new Error("bad point: x or y not FE");
const M = n.sqr(O),
T = s(A);
if (!n.eql(M, T))
throw new Error("bad point: equation left != right");
if (!this.isTorsionFree())
throw new Error("bad point: not in prime-order subgroup");
}
hasEvenY() {
const { y: A } = this.toAffine();
if (n.isOdd) return !n.isOdd(A);
throw new Error("Field doesn't support isOdd");
}
equals(A) {
y(A);
const { px: O, py: M, pz: T } = this,
{ px: N, py: l, pz: w } = A,
p = n.eql(n.mul(O, w), n.mul(N, T)),
_ = n.eql(n.mul(M, w), n.mul(l, T));
return p && _;
}
negate() {
return new m(this.px, n.neg(this.py), this.pz);
}
double() {
const { a: A, b: O } = t,
M = n.mul(O, zp),
{ px: T, py: N, pz: l } = this;
let w = n.ZERO,
p = n.ZERO,
_ = n.ZERO,
$ = n.mul(T, T),
R = n.mul(N, N),
L = n.mul(l, l),
E = n.mul(T, N);
return (
(E = n.add(E, E)),
(_ = n.mul(T, l)),
(_ = n.add(_, _)),
(w = n.mul(A, _)),
(p = n.mul(M, L)),
(p = n.add(w, p)),
(w = n.sub(R, p)),
(p = n.add(R, p)),
(p = n.mul(w, p)),
(w = n.mul(E, w)),
(_ = n.mul(M, _)),
(L = n.mul(A, L)),
(E = n.sub($, L)),
(E = n.mul(A, E)),
(E = n.add(E, _)),
(_ = n.add($, $)),
($ = n.add(_, $)),
($ = n.add($, L)),
($ = n.mul($, E)),
(p = n.add(p, $)),
(L = n.mul(N, l)),
(L = n.add(L, L)),
($ = n.mul(L, E)),
(w = n.sub(w, $)),
(_ = n.mul(L, R)),
(_ = n.add(_, _)),
(_ = n.add(_, _)),
new m(w, p, _)
);
}
add(A) {
y(A);
const { px: O, py: M, pz: T } = this,
{ px: N, py: l, pz: w } = A;
let p = n.ZERO,
_ = n.ZERO,
$ = n.ZERO;
const R = t.a,
L = n.mul(t.b, zp);
let E = n.mul(O, N),
x = n.mul(M, l),
z = n.mul(T, w),
q = n.add(O, M),
I = n.add(N, l);
(q = n.mul(q, I)),
(I = n.add(E, x)),
(q = n.sub(q, I)),
(I = n.add(O, T));
let S = n.add(N, w);
return (
(I = n.mul(I, S)),
(S = n.add(E, z)),
(I = n.sub(I, S)),
(S = n.add(M, T)),
(p = n.add(l, w)),
(S = n.mul(S, p)),
(p = n.add(x, z)),
(S = n.sub(S, p)),
($ = n.mul(R, I)),
(p = n.mul(L, z)),
($ = n.add(p, $)),
(p = n.sub(x, $)),
($ = n.add(x, $)),
(_ = n.mul(p, $)),
(x = n.add(E, E)),
(x = n.add(x, E)),
(z = n.mul(R, z)),
(I = n.mul(L, I)),
(x = n.add(x, z)),
(z = n.sub(E, z)),
(z = n.mul(R, z)),
(I = n.add(I, z)),
(E = n.mul(x, I)),
(_ = n.add(_, E)),
(E = n.mul(S, I)),
(p = n.mul(q, p)),
(p = n.sub(p, E)),
(E = n.mul(q, x)),
($ = n.mul(S, $)),
($ = n.add($, E)),
new m(p, _, $)
);
}
subtract(A) {
return this.add(A.negate());
}
is0() {
return this.equals(m.ZERO);
}
wNAF(A) {
return P.wNAFCached(this, h, A, (O) => {
const M = n.invertBatch(O.map((T) => T.pz));
return O.map((T, N) => T.toAffine(M[N])).map(m.fromAffine);
});
}
multiplyUnsafe(A) {
const O = m.ZERO;
if (A === tr) return O;
if ((f(A), A === on)) return this;
const { endo: M } = t;
if (!M) return P.unsafeLadder(this, A);
let { k1neg: T, k1: N, k2neg: l, k2: w } = M.splitScalar(A),
p = O,
_ = O,
$ = this;
for (; N > tr || w > tr; )
N & on && (p = p.add($)),
w & on && (_ = _.add($)),
($ = $.double()),
(N >>= on),
(w >>= on);
return (
T && (p = p.negate()),
l && (_ = _.negate()),
(_ = new m(n.mul(_.px, M.beta), _.py, _.pz)),
p.add(_)
);
}
multiply(A) {
f(A);
let O = A,
M,
T;
const { endo: N } = t;
if (N) {
const { k1neg: l, k1: w, k2neg: p, k2: _ } = N.splitScalar(O);
let { p: $, f: R } = this.wNAF(w),
{ p: L, f: E } = this.wNAF(_);
($ = P.constTimeNegate(l, $)),
(L = P.constTimeNegate(p, L)),
(L = new m(n.mul(L.px, N.beta), L.py, L.pz)),
(M = $.add(L)),
(T = R.add(E));
} else {
const { p: l, f: w } = this.wNAF(O);
(M = l), (T = w);
}
return m.normalizeZ([M, T])[0];
}
multiplyAndAddUnsafe(A, O, M) {
const T = m.BASE,
N = (w, p) =>
p === tr || p === on || !w.equals(T)
? w.multiplyUnsafe(p)
: w.multiply(p),
l = N(this, O).add(N(A, M));
return l.is0() ? void 0 : l;
}
toAffine(A) {
const { px: O, py: M, pz: T } = this,
N = this.is0();
A == null && (A = N ? n.ONE : n.inv(T));
const l = n.mul(O, A),
w = n.mul(M, A),
p = n.mul(T, A);
if (N) return { x: n.ZERO, y: n.ZERO };
if (!n.eql(p, n.ONE)) throw new Error("invZ was invalid");
return { x: l, y: w };
}
isTorsionFree() {
const { h: A, isTorsionFree: O } = t;
if (A === on) return !0;
if (O) return O(m, this);
throw new Error(
"isTorsionFree() has not been declared for the elliptic curve"
);
}
clearCofactor() {
const { h: A, clearCofactor: O } = t;
return A === on ? this : O ? O(m, this) : this.multiplyUnsafe(t.h);
}
toRawBytes(A = !0) {
return this.assertValidity(), r(m, this, A);
}
toHex(A = !0) {
return Ai(this.toRawBytes(A));
}
}
(m.BASE = new m(t.Gx, t.Gy, n.ONE)),
(m.ZERO = new m(n.ZERO, n.ONE, n.ZERO));
const v = t.nBitLength,
P = mk(m, t.endo ? Math.ceil(v / 2) : v);
return {
CURVE: t,
ProjectivePoint: m,
normPrivateKeyToScalar: d,
weierstrassEquation: s,
isWithinCurveOrder: c,
};
}
function Ek(e) {
const t = Rw(e);
return (
$s(
t,
{ hash: "hash", hmac: "function", randomBytes: "function" },
{ bits2int: "function", bits2int_modN: "function", lowS: "boolean" }
),
Object.freeze({ lowS: !0, ...t })
);
}
function kk(e) {
const t = Ek(e),
{ Fp: n, n: r } = t,
o = n.BYTES + 1,
s = 2 * n.BYTES + 1;
function c(I) {
return tr < I && I < n.ORDER;
}
function f(I) {
return kt(I, r);
}
function d(I) {
return zl(I, r);
}
const {
ProjectivePoint: h,
normPrivateKeyToScalar: y,
weierstrassEquation: m,
isWithinCurveOrder: v,
} = _k({
...t,
toBytes(I, S, D) {
const K = S.toAffine(),
W = n.toBytes(K.x),
Z = Ro;
return D
? Z(Uint8Array.from([S.hasEvenY() ? 2 : 3]), W)
: Z(Uint8Array.from([4]), W, n.toBytes(K.y));
},
fromBytes(I) {
const S = I.length,
D = I[0],
K = I.subarray(1);
if (S === o && (D === 2 || D === 3)) {
const W = Kt(K);
if (!c(W)) throw new Error("Point is not on curve");
const Z = m(W);
let G = n.sqrt(Z);
const oe = (G & on) === on;
return ((D & 1) === 1) !== oe && (G = n.neg(G)), { x: W, y: G };
} else if (S === s && D === 4) {
const W = n.fromBytes(K.subarray(0, n.BYTES)),
Z = n.fromBytes(K.subarray(n.BYTES, 2 * n.BYTES));
return { x: W, y: Z };
} else
throw new Error(
`Point of length ${S} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`
);
},
}),
P = (I) => Ai(eo(I, t.nByteLength));
function C(I) {
const S = r >> on;
return I > S;
}
function A(I) {
return C(I) ? f(-I) : I;
}
const O = (I, S, D) => Kt(I.slice(S, D));
class M {
constructor(S, D, K) {
(this.r = S),
(this.s = D),
(this.recovery = K),
this.assertValidity();
}
static fromCompact(S) {
const D = t.nByteLength;
return (
(S = Pt("compactSignature", S, D * 2)),
new M(O(S, 0, D), O(S, D, 2 * D))
);
}
static fromDER(S) {
const { r: D, s: K } = Po.toSig(Pt("DER", S));
return new M(D, K);
}
assertValidity() {
if (!v(this.r)) throw new Error("r must be 0 < r < CURVE.n");
if (!v(this.s)) throw new Error("s must be 0 < s < CURVE.n");
}
addRecoveryBit(S) {
return new M(this.r, this.s, S);
}
recoverPublicKey(S) {
const { r: D, s: K, recovery: W } = this,
Z = _(Pt("msgHash", S));
if (W == null || ![0, 1, 2, 3].includes(W))
throw new Error("recovery id invalid");
const G = W === 2 || W === 3 ? D + t.n : D;
if (G >= n.ORDER) throw new Error("recovery id 2 or 3 invalid");
const oe = W & 1 ? "03" : "02",
he = h.fromHex(oe + P(G)),
be = d(G),
Se = f(-Z * be),
re = f(K * be),
ye = h.BASE.multiplyAndAddUnsafe(he, Se, re);
if (!ye) throw new Error("point at infinify");
return ye.assertValidity(), ye;
}
hasHighS() {
return C(this.s);
}
normalizeS() {
return this.hasHighS()
? new M(this.r, f(-this.s), this.recovery)
: this;
}
toDERRawBytes() {
return Si(this.toDERHex());
}
toDERHex() {
return Po.hexFromSig({ r: this.r, s: this.s });
}
toCompactRawBytes() {
return Si(this.toCompactHex());
}
toCompactHex() {
return P(this.r) + P(this.s);
}
}
const T = {
isValidPrivateKey(I) {
try {
return y(I), !0;
} catch {
return !1;
}
},
normPrivateKeyToScalar: y,
randomPrivateKey: () => {
const I = Nw(t.n);
return gk(t.randomBytes(I), t.n);
},
precompute(I = 8, S = h.BASE) {
return S._setWindowSize(I), S.multiply(BigInt(3)), S;
},
};
function N(I, S = !0) {
return h.fromPrivateKey(I).toRawBytes(S);
}
function l(I) {
const S = I instanceof Uint8Array,
D = typeof I == "string",
K = (S || D) && I.length;
return S
? K === o || K === s
: D
? K === 2 * o || K === 2 * s
: I instanceof h;
}
function w(I, S, D = !0) {
if (l(I)) throw new Error("first arg must be private key");
if (!l(S)) throw new Error("second arg must be public key");
return h.fromHex(S).multiply(y(I)).toRawBytes(D);
}
const p =
t.bits2int ||
function (I) {
const S = Kt(I),
D = I.length * 8 - t.nBitLength;
return D > 0 ? S >> BigInt(D) : S;
},
_ =
t.bits2int_modN ||
function (I) {
return f(p(I));
},
$ = Dd(t.nBitLength);
function R(I) {
if (typeof I != "bigint") throw new Error("bigint expected");
if (!(tr <= I && I < $))
throw new Error(`bigint expected < 2^${t.nBitLength}`);
return eo(I, t.nByteLength);
}
function L(I, S, D = E) {
if (["recovered", "canonical"].some((Oe) => Oe in D))
throw new Error("sign() legacy options not supported");
const { hash: K, randomBytes: W } = t;
let { lowS: Z, prehash: G, extraEntropy: oe } = D;
Z == null && (Z = !0),
(I = Pt("msgHash", I)),
G && (I = Pt("prehashed msgHash", K(I)));
const he = _(I),
be = y(S),
Se = [R(be), R(he)];
if (oe != null) {
const Oe = oe === !0 ? W(n.BYTES) : oe;
Se.push(Pt("extraEntropy", Oe));
}
const re = Ro(...Se),
ye = he;
function Ce(Oe) {
const Me = p(Oe);
if (!v(Me)) return;
const pt = d(Me),
Ke = h.BASE.multiply(Me).toAffine(),
se = f(Ke.x);
if (se === tr) return;
const Re = f(pt * f(ye + se * be));
if (Re === tr) return;
let Te = (Ke.x === se ? 0 : 2) | Number(Ke.y & on),
Pe = Re;
return Z && C(Re) && ((Pe = A(Re)), (Te ^= 1)), new M(se, Pe, Te);
}
return { seed: re, k2sig: Ce };
}
const E = { lowS: t.lowS, prehash: !1 },
x = { lowS: t.lowS, prehash: !1 };
function z(I, S, D = E) {
const { seed: K, k2sig: W } = L(I, S, D),
Z = t;
return Cw(Z.hash.outputLen, Z.nByteLength, Z.hmac)(K, W);
}
h.BASE._setWindowSize(8);
function q(I, S, D, K = x) {
var W;
const Z = I;
if (((S = Pt("msgHash", S)), (D = Pt("publicKey", D)), "strict" in K))
throw new Error("options.strict was renamed to lowS");
const { lowS: G, prehash: oe } = K;
let he, be;
try {
if (typeof Z == "string" || Z instanceof Uint8Array)
try {
he = M.fromDER(Z);
} catch (se) {
if (!(se instanceof Po.Err)) throw se;
he = M.fromCompact(Z);
}
else if (
typeof Z == "object" &&
typeof Z.r == "bigint" &&
typeof Z.s == "bigint"
) {
const { r: se, s: Re } = Z;
he = new M(se, Re);
} else throw new Error("PARSE");
be = h.fromHex(D);
} catch (se) {
if (se.message === "PARSE")
throw new Error(
"signature must be Signature instance, Uint8Array or hex string"
);
return !1;
}
if (G && he.hasHighS()) return !1;
oe && (S = t.hash(S));
const { r: Se, s: re } = he,
ye = _(S),
Ce = d(re),
Oe = f(ye * Ce),
Me = f(Se * Ce),
pt =
(W = h.BASE.multiplyAndAddUnsafe(be, Oe, Me)) == null
? void 0
: W.toAffine();
return pt ? f(pt.x) === Se : !1;
}
return {
CURVE: t,
getPublicKey: N,
getSharedSecret: w,
sign: z,
verify: q,
ProjectivePoint: h,
Signature: M,
utils: T,
};
}
class zw extends Tw {
constructor(t, n) {
super(), (this.finished = !1), (this.destroyed = !1), U6(t);
const r = Ud(n);
if (
((this.iHash = t.create()), typeof this.iHash.update != "function")
)
throw new Error(
"Expected instance of class which extends utils.Hash"
);
(this.blockLen = this.iHash.blockLen),
(this.outputLen = this.iHash.outputLen);
const o = this.blockLen,
s = new Uint8Array(o);
s.set(r.length > o ? t.create().update(r).digest() : r);
for (let c = 0; c < s.length; c++) s[c] ^= 54;
this.iHash.update(s), (this.oHash = t.create());
for (let c = 0; c < s.length; c++) s[c] ^= 106;
this.oHash.update(s), s.fill(0);
}
update(t) {
return La(this), this.iHash.update(t), this;
}
digestInto(t) {
La(this),
$w(t, this.outputLen),
(this.finished = !0),
this.iHash.digestInto(t),
this.oHash.update(t),
this.oHash.digestInto(t),
this.destroy();
}
digest() {
const t = new Uint8Array(this.oHash.outputLen);
return this.digestInto(t), t;
}
_cloneInto(t) {
t || (t = Object.create(Object.getPrototypeOf(this), {}));
const {
oHash: n,
iHash: r,
finished: o,
destroyed: s,
blockLen: c,
outputLen: f,
} = this;
return (
(t = t),
(t.finished = o),
(t.destroyed = s),
(t.blockLen = c),
(t.outputLen = f),
(t.oHash = n._cloneInto(t.oHash)),
(t.iHash = r._cloneInto(t.iHash)),
t
);
}
destroy() {
(this.destroyed = !0), this.oHash.destroy(), this.iHash.destroy();
}
}
const Uw = (e, t, n) => new zw(e, t).update(n).digest();
Uw.create = (e, t) => new zw(e, t);
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ function Ak(
e
) {
return {
hash: e,
hmac: (t, ...n) => Uw(e, t, D6(...n)),
randomBytes: Pw,
};
}
function Sk(e, t) {
const n = (r) => kk({ ...e, ...Ak(r) });
return Object.freeze({ ...n(t), create: n });
}
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const _c =
BigInt(
"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"
),
Ba = BigInt(
"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"
),
Mw = BigInt(1),
Ca = BigInt(2),
Up = (e, t) => (e + t / Ca) / t;
function Hw(e) {
const t = _c,
n = BigInt(3),
r = BigInt(6),
o = BigInt(11),
s = BigInt(22),
c = BigInt(23),
f = BigInt(44),
d = BigInt(88),
h = (e * e * e) % t,
y = (h * h * e) % t,
m = (nn(y, n, t) * y) % t,
v = (nn(m, n, t) * y) % t,
P = (nn(v, Ca, t) * h) % t,
C = (nn(P, o, t) * P) % t,
A = (nn(C, s, t) * C) % t,
O = (nn(A, f, t) * A) % t,
M = (nn(O, d, t) * O) % t,
T = (nn(M, f, t) * A) % t,
N = (nn(T, n, t) * y) % t,
l = (nn(N, c, t) * C) % t,
w = (nn(l, r, t) * h) % t,
p = nn(w, Ca, t);
if (!Ul.eql(Ul.sqr(p), e)) throw new Error("Cannot find square root");
return p;
}
const Ul = pk(_c, void 0, void 0, { sqrt: Hw }),
qd = Sk(
{
a: BigInt(0),
b: BigInt(7),
Fp: Ul,
n: Ba,
Gx: BigInt(
"55066263022277343669578718895168534326250603453777594175500187360389116729240"
),
Gy: BigInt(
"32670510020758816978083085130507043184471273380659243275938904335757337482424"
),
h: BigInt(1),
lowS: !0,
endo: {
beta: BigInt(
"0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"
),
splitScalar: (e) => {
const t = Ba,
n = BigInt("0x3086d221a7d46bcde86c90e49284eb15"),
r = -Mw * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),
o = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),
s = n,
c = BigInt("0x100000000000000000000000000000000"),
f = Up(s * e, t),
d = Up(-r * e, t);
let h = kt(e - f * n - d * o, t),
y = kt(-f * r - d * s, t);
const m = h > c,
v = y > c;
if ((m && (h = t - h), v && (y = t - y), h > c || y > c))
throw new Error("splitScalar: Endomorphism failed, k=" + e);
return { k1neg: m, k1: h, k2neg: v, k2: y };
},
},
},
Nl
),
Ec = BigInt(0),
jw = (e) => typeof e == "bigint" && Ec < e && e < _c,
$k = (e) => typeof e == "bigint" && Ec < e && e < Ba,
Mp = {};
function Ia(e, ...t) {
let n = Mp[e];
if (n === void 0) {
const r = Nl(Uint8Array.from(e, (o) => o.charCodeAt(0)));
(n = Ro(r, r)), (Mp[e] = n);
}
return Nl(Ro(n, ...t));
}
const Vd = (e) => e.toRawBytes(!0).slice(1),
Ml = (e) => eo(e, 32),
Vu = (e) => kt(e, _c),
hs = (e) => kt(e, Ba),
Fd = qd.ProjectivePoint,
xk = (e, t, n) => Fd.BASE.multiplyAndAddUnsafe(e, t, n);
function Hl(e) {
let t = qd.utils.normPrivateKeyToScalar(e),
n = Fd.fromPrivateKey(t);
return { scalar: n.hasEvenY() ? t : hs(-t), bytes: Vd(n) };
}
function Dw(e) {
if (!jw(e)) throw new Error("bad x: need 0 < x < p");
const t = Vu(e * e),
n = Vu(t * e + BigInt(7));
let r = Hw(n);
r % Ca !== Ec && (r = Vu(-r));
const o = new Fd(e, r, Mw);
return o.assertValidity(), o;
}
function qw(...e) {
return hs(Kt(Ia("BIP0340/challenge", ...e)));
}
function Tk(e) {
return Hl(e).bytes;
}
function Pk(e, t, n = Pw(32)) {
const r = Pt("message", e),
{ bytes: o, scalar: s } = Hl(t),
c = Pt("auxRand", n, 32),
f = Ml(s ^ Kt(Ia("BIP0340/aux", c))),
d = Ia("BIP0340/nonce", f, o, r),
h = hs(Kt(d));
if (h === Ec) throw new Error("sign failed: k is zero");
const { bytes: y, scalar: m } = Hl(h),
v = qw(y, o, r),
P = new Uint8Array(64);
if ((P.set(y, 0), P.set(Ml(hs(m + v * s)), 32), !Vw(P, r, o)))
throw new Error("sign: Invalid signature produced");
return P;
}
function Vw(e, t, n) {
const r = Pt("signature", e, 64),
o = Pt("message", t),
s = Pt("publicKey", n, 32);
try {
const c = Dw(Kt(s)),
f = Kt(r.subarray(0, 32));
if (!jw(f)) return !1;
const d = Kt(r.subarray(32, 64));
if (!$k(d)) return !1;
const h = qw(Ml(f), Vd(c), o),
y = xk(c, d, hs(-h));
return !(!y || !y.hasEvenY() || y.toAffine().x !== f);
} catch {
return !1;
}
}
const Mt = {
getPublicKey: Tk,
sign: Pk,
verify: Vw,
utils: {
randomPrivateKey: qd.utils.randomPrivateKey,
lift_x: Dw,
pointToBytes: Vd,
numberToBytesBE: eo,
bytesToNumberBE: Kt,
taggedHash: Ia,
mod: kt,
},
};
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const Fw =
(e) => e instanceof Uint8Array,
Fu = (e) => new DataView(e.buffer, e.byteOffset, e.byteLength),
Pn = (e, t) => (e << (32 - t)) | (e >>> t),
Lk = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
if (!Lk) throw new Error("Non little-endian hardware is not supported");
const Bk = Array.from({ length: 256 }, (e, t) =>
t.toString(16).padStart(2, "0")
);
function Je(e) {
if (!Fw(e)) throw new Error("Uint8Array expected");
let t = "";
for (let n = 0; n < e.length; n++) t += Bk[e[n]];
return t;
}
function Kw(e) {
if (typeof e != "string")
throw new Error("hex string expected, got " + typeof e);
const t = e.length;
if (t % 2)
throw new Error(
"padded hex string expected, got unpadded hex of length " + t
);
const n = new Uint8Array(t / 2);
for (let r = 0; r < n.length; r++) {
const o = r * 2,
s = e.slice(o, o + 2),
c = Number.parseInt(s, 16);
if (Number.isNaN(c) || c < 0)
throw new Error("Invalid byte sequence");
n[r] = c;
}
return n;
}
function Ck(e) {
if (typeof e != "string")
throw new Error(`utf8ToBytes expected string, got ${typeof e}`);
return new Uint8Array(new TextEncoder().encode(e));
}
function Ww(e) {
if ((typeof e == "string" && (e = Ck(e)), !Fw(e)))
throw new Error(`expected Uint8Array, got ${typeof e}`);
return e;
}
class Ik {
clone() {
return this._cloneInto();
}
}
function Gw(e) {
const t = (r) => e().update(Ww(r)).digest(),
n = e();
return (
(t.outputLen = n.outputLen),
(t.blockLen = n.blockLen),
(t.create = () => e()),
t
);
}
function jl(e) {
if (!Number.isSafeInteger(e) || e < 0)
throw new Error(`Wrong positive integer: ${e}`);
}
function Ok(e) {
if (typeof e != "boolean")
throw new Error(`Expected boolean, not ${e}`);
}
function Zw(e, ...t) {
if (!(e instanceof Uint8Array)) throw new Error("Expected Uint8Array");
if (t.length > 0 && !t.includes(e.length))
throw new Error(
`Expected Uint8Array of length ${t}, not of length=${e.length}`
);
}
function Nk(e) {
if (typeof e != "function" || typeof e.create != "function")
throw new Error("Hash should be wrapped by utils.wrapConstructor");
jl(e.outputLen), jl(e.blockLen);
}
function Rk(e, t = !0) {
if (e.destroyed) throw new Error("Hash instance has been destroyed");
if (t && e.finished)
throw new Error("Hash#digest() has already been called");
}
function zk(e, t) {
Zw(e);
const n = t.outputLen;
if (e.length < n)
throw new Error(
`digestInto() expects output buffer of length at least ${n}`
);
}
const Ku = {
number: jl,
bool: Ok,
bytes: Zw,
hash: Nk,
exists: Rk,
output: zk,
};
function Uk(e, t, n, r) {
if (typeof e.setBigUint64 == "function") return e.setBigUint64(t, n, r);
const o = BigInt(32),
s = BigInt(4294967295),
c = Number((n >> o) & s),
f = Number(n & s),
d = r ? 4 : 0,
h = r ? 0 : 4;
e.setUint32(t + d, c, r), e.setUint32(t + h, f, r);
}
class Mk extends Ik {
constructor(t, n, r, o) {
super(),
(this.blockLen = t),
(this.outputLen = n),
(this.padOffset = r),
(this.isLE = o),
(this.finished = !1),
(this.length = 0),
(this.pos = 0),
(this.destroyed = !1),
(this.buffer = new Uint8Array(t)),
(this.view = Fu(this.buffer));
}
update(t) {
Ku.exists(this);
const { view: n, buffer: r, blockLen: o } = this;
t = Ww(t);
const s = t.length;
for (let c = 0; c < s; ) {
const f = Math.min(o - this.pos, s - c);
if (f === o) {
const d = Fu(t);
for (; o <= s - c; c += o) this.process(d, c);
continue;
}
r.set(t.subarray(c, c + f), this.pos),
(this.pos += f),
(c += f),
this.pos === o && (this.process(n, 0), (this.pos = 0));
}
return (this.length += t.length), this.roundClean(), this;
}
digestInto(t) {
Ku.exists(this), Ku.output(t, this), (this.finished = !0);
const { buffer: n, view: r, blockLen: o, isLE: s } = this;
let { pos: c } = this;
(n[c++] = 128),
this.buffer.subarray(c).fill(0),
this.padOffset > o - c && (this.process(r, 0), (c = 0));
for (let m = c; m < o; m++) n[m] = 0;
Uk(r, o - 8, BigInt(this.length * 8), s), this.process(r, 0);
const f = Fu(t),
d = this.outputLen;
if (d % 4)
throw new Error("_sha2: outputLen should be aligned to 32bit");
const h = d / 4,
y = this.get();
if (h > y.length)
throw new Error("_sha2: outputLen bigger than state");
for (let m = 0; m < h; m++) f.setUint32(4 * m, y[m], s);
}
digest() {
const { buffer: t, outputLen: n } = this;
this.digestInto(t);
const r = t.slice(0, n);
return this.destroy(), r;
}
_cloneInto(t) {
t || (t = new this.constructor()), t.set(...this.get());
const {
blockLen: n,
buffer: r,
length: o,
finished: s,
destroyed: c,
pos: f,
} = this;
return (
(t.length = o),
(t.pos = f),
(t.finished = s),
(t.destroyed = c),
o % n && t.buffer.set(r),
t
);
}
}
const Hk = (e, t, n) => (e & t) ^ (~e & n),
jk = (e, t, n) => (e & t) ^ (e & n) ^ (t & n),
Dk = new Uint32Array([
1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993,
2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987,
1925078388, 2162078206, 2614888103, 3248222580, 3835390401,
4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692,
1996064986, 2554220882, 2821834349, 2952996808, 3210313671,
3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912,
1294757372, 1396182291, 1695183700, 1986661051, 2177026350,
2456956037, 2730485921, 2820302411, 3259730800, 3345764771,
3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616,
659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779,
1955562222, 2024104815, 2227730452, 2361852424, 2428436474,
2756734187, 3204031479, 3329325298,
]),
zr = new Uint32Array([
1779033703, 3144134277, 1013904242, 2773480762, 1359893119,
2600822924, 528734635, 1541459225,
]),
Ur = new Uint32Array(64);
class Yw extends Mk {
constructor() {
super(64, 32, 8, !1),
(this.A = zr[0] | 0),
(this.B = zr[1] | 0),
(this.C = zr[2] | 0),
(this.D = zr[3] | 0),
(this.E = zr[4] | 0),
(this.F = zr[5] | 0),
(this.G = zr[6] | 0),
(this.H = zr[7] | 0);
}
get() {
const { A: t, B: n, C: r, D: o, E: s, F: c, G: f, H: d } = this;
return [t, n, r, o, s, c, f, d];
}
set(t, n, r, o, s, c, f, d) {
(this.A = t | 0),
(this.B = n | 0),
(this.C = r | 0),
(this.D = o | 0),
(this.E = s | 0),
(this.F = c | 0),
(this.G = f | 0),
(this.H = d | 0);
}
process(t, n) {
for (let m = 0; m < 16; m++, n += 4) Ur[m] = t.getUint32(n, !1);
for (let m = 16; m < 64; m++) {
const v = Ur[m - 15],
P = Ur[m - 2],
C = Pn(v, 7) ^ Pn(v, 18) ^ (v >>> 3),
A = Pn(P, 17) ^ Pn(P, 19) ^ (P >>> 10);
Ur[m] = (A + Ur[m - 7] + C + Ur[m - 16]) | 0;
}
let { A: r, B: o, C: s, D: c, E: f, F: d, G: h, H: y } = this;
for (let m = 0; m < 64; m++) {
const v = Pn(f, 6) ^ Pn(f, 11) ^ Pn(f, 25),
P = (y + v + Hk(f, d, h) + Dk[m] + Ur[m]) | 0,
A = ((Pn(r, 2) ^ Pn(r, 13) ^ Pn(r, 22)) + jk(r, o, s)) | 0;
(y = h),
(h = d),
(d = f),
(f = (c + P) | 0),
(c = s),
(s = o),
(o = r),
(r = (P + A) | 0);
}
(r = (r + this.A) | 0),
(o = (o + this.B) | 0),
(s = (s + this.C) | 0),
(c = (c + this.D) | 0),
(f = (f + this.E) | 0),
(d = (d + this.F) | 0),
(h = (h + this.G) | 0),
(y = (y + this.H) | 0),
this.set(r, o, s, c, f, d, h, y);
}
roundClean() {
Ur.fill(0);
}
destroy() {
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
}
}
class qk extends Yw {
constructor() {
super(),
(this.A = -1056596264),
(this.B = 914150663),
(this.C = 812702999),
(this.D = -150054599),
(this.E = -4191439),
(this.F = 1750603025),
(this.G = 1694076839),
(this.H = -1090891868),
(this.outputLen = 28);
}
}
const Kd = Gw(() => new Yw());
Gw(() => new qk());
var ko = Symbol("verified"),
Vk = (e) => e instanceof Object;
function Fk(e) {
if (
!Vk(e) ||
typeof e.kind != "number" ||
typeof e.content != "string" ||
typeof e.created_at != "number" ||
typeof e.pubkey != "string" ||
!e.pubkey.match(/^[a-f0-9]{64}$/) ||
!Array.isArray(e.tags)
)
return !1;
for (let t = 0; t < e.tags.length; t++) {
let n = e.tags[t];
if (!Array.isArray(n)) return !1;
for (let r = 0; r < n.length; r++)
if (typeof n[r] == "object") return !1;
}
return !0;
}
new TextDecoder("utf-8");
var Kk = new TextEncoder();
function Gi(e) {
e.indexOf("://") === -1 && (e = "wss://" + e);
let t = new URL(e);
return (
(t.pathname = t.pathname.replace(/\/+/g, "/")),
t.pathname.endsWith("/") && (t.pathname = t.pathname.slice(0, -1)),
((t.port === "80" && t.protocol === "ws:") ||
(t.port === "443" && t.protocol === "wss:")) &&
(t.port = ""),
t.searchParams.sort(),
(t.hash = ""),
t.toString()
);
}
var Wk = class {
constructor(t) {
pe(this, "value"),
pe(this, "next", null),
pe(this, "prev", null),
(this.value = t);
}
},
Gk = class {
constructor() {
pe(this, "first"),
pe(this, "last"),
(this.first = null),
(this.last = null);
}
enqueue(t) {
const n = new Wk(t);
return (
this.last
? this.last === this.first
? ((this.last = n),
(this.last.prev = this.first),
(this.first.next = n))
: ((n.prev = this.last),
(this.last.next = n),
(this.last = n))
: ((this.first = n), (this.last = n)),
!0
);
}
dequeue() {
if (!this.first) return null;
if (this.first === this.last) {
const n = this.first;
return (this.first = null), (this.last = null), n.value;
}
const t = this.first;
return (this.first = t.next), t.value;
}
},
Zk = class {
generateSecretKey() {
return Mt.utils.randomPrivateKey();
}
getPublicKey(t) {
return Je(Mt.getPublicKey(t));
}
finalizeEvent(t, n) {
const r = t;
return (
(r.pubkey = Je(Mt.getPublicKey(n))),
(r.id = Wu(r)),
(r.sig = Je(Mt.sign(Wu(r), n))),
(r[ko] = !0),
r
);
}
verifyEvent(t) {
if (typeof t[ko] == "boolean") return t[ko];
const n = Wu(t);
if (n !== t.id) return (t[ko] = !1), !1;
try {
const r = Mt.verify(t.sig, n, t.pubkey);
return (t[ko] = r), r;
} catch {
return (t[ko] = !1), !1;
}
}
};
function Yk(e) {
if (!Fk(e))
throw new Error(
"can't serialize event with wrong or missing properties"
);
return JSON.stringify([
0,
e.pubkey,
e.created_at,
e.kind,
e.tags,
e.content,
]);
}
function Wu(e) {
let t = Kd(Kk.encode(Yk(e)));
return Je(t);
}
var kc = new Zk();
kc.generateSecretKey;
kc.getPublicKey;
kc.finalizeEvent;
var Jk = kc.verifyEvent,
Xk = 22242;
function Qk(e, t) {
if (
(e.ids &&
e.ids.indexOf(t.id) === -1 &&
!e.ids.some((n) => t.id.startsWith(n))) ||
(e.kinds && e.kinds.indexOf(t.kind) === -1) ||
(e.authors &&
e.authors.indexOf(t.pubkey) === -1 &&
!e.authors.some((n) => t.pubkey.startsWith(n)))
)
return !1;
for (let n in e)
if (n[0] === "#") {
let r = n.slice(1),
o = e[`#${r}`];
if (
o &&
!t.tags.find(([s, c]) => s === n.slice(1) && o.indexOf(c) !== -1)
)
return !1;
}
return !(
(e.since && t.created_at < e.since) ||
(e.until && t.created_at > e.until)
);
}
function e5(e, t) {
for (let n = 0; n < e.length; n++) if (Qk(e[n], t)) return !0;
return !1;
}
function t5(e, t) {
let n = t.length + 3,
r = e.indexOf(`"${t}":`) + n,
o = e.slice(r).indexOf('"') + r + 1;
return e.slice(o, o + 64);
}
function n5(e) {
let t = e.slice(0, 22).indexOf('"EVENT"');
if (t === -1) return null;
let n = e.slice(t + 7 + 1).indexOf('"');
if (n === -1) return null;
let r = t + 7 + 1 + n,
o = e.slice(r + 1, 80).indexOf('"');
if (o === -1) return null;
let s = r + 1 + o;
return e.slice(r + 1, s);
}
function r5(e, t) {
return {
kind: Xk,
created_at: Math.floor(Date.now() / 1e3),
tags: [
["relay", e],
["challenge", t],
],
content: "",
};
}
async function o5() {
return new Promise((e) => {
const t = new MessageChannel(),
n = () => {
t.port1.removeEventListener("message", n), e();
};
t.port1.addEventListener("message", n),
t.port2.postMessage(0),
t.port1.start();
});
}
var i5 = (e) => ((e[ko] = !0), !0),
Jw;
try {
Jw = WebSocket;
} catch {}
var Xw = class {
constructor(t, n) {
pe(this, "url"),
pe(this, "_connected", !1),
pe(this, "onclose", null),
pe(this, "onnotice", (r) =>
console.debug(`NOTICE from ${this.url}: ${r}`)
),
pe(this, "_onauth", null),
pe(this, "baseEoseTimeout", 4400),
pe(this, "connectionTimeout", 4400),
pe(this, "openSubs", new Map()),
pe(this, "connectionTimeoutHandle"),
pe(this, "connectionPromise"),
pe(this, "openCountRequests", new Map()),
pe(this, "openEventPublishes", new Map()),
pe(this, "ws"),
pe(this, "incomingMessageQueue", new Gk()),
pe(this, "queueRunning", !1),
pe(this, "challenge"),
pe(this, "serial", 0),
pe(this, "verifyEvent"),
(this.url = Gi(t)),
(this.verifyEvent = n.verifyEvent);
}
static async connect(t, n) {
const r = new Xw(t, n);
return await r.connect(), r;
}
closeAllSubscriptions(t) {
for (let [n, r] of this.openSubs) r.close(t);
this.openSubs.clear();
for (let [n, r] of this.openEventPublishes) r.reject(new Error(t));
this.openEventPublishes.clear();
for (let [n, r] of this.openCountRequests) r.reject(new Error(t));
this.openCountRequests.clear();
}
get connected() {
return this._connected;
}
async connect() {
return this.connectionPromise
? this.connectionPromise
: ((this.challenge = void 0),
(this.connectionPromise = new Promise((t, n) => {
this.connectionTimeoutHandle = setTimeout(() => {
var r;
n("connection timed out"),
(this.connectionPromise = void 0),
(r = this.onclose) == null || r.call(this),
this.closeAllSubscriptions("relay connection timed out");
}, this.connectionTimeout);
try {
this.ws = new Jw(this.url);
} catch (r) {
n(r);
return;
}
(this.ws.onopen = () => {
clearTimeout(this.connectionTimeoutHandle),
(this._connected = !0),
t();
}),
(this.ws.onerror = (r) => {
var o;
n(r.message),
this._connected &&
((this._connected = !1),
(this.connectionPromise = void 0),
(o = this.onclose) == null || o.call(this),
this.closeAllSubscriptions(
"relay connection errored"
));
}),
(this.ws.onclose = async () => {
var r;
this._connected &&
((this._connected = !1),
(this.connectionPromise = void 0),
(r = this.onclose) == null || r.call(this),
this.closeAllSubscriptions("relay connection closed"));
}),
(this.ws.onmessage = this._onmessage.bind(this));
})),
this.connectionPromise);
}
async runQueue() {
for (this.queueRunning = !0; this.handleNext() !== !1; ) await o5();
this.queueRunning = !1;
}
handleNext() {
var t, n, r;
const o = this.incomingMessageQueue.dequeue();
if (!o) return !1;
const s = n5(o);
if (s) {
const c = this.openSubs.get(s);
if (!c) return;
const f = t5(o, "id"),
d = (t = c.alreadyHaveEvent) == null ? void 0 : t.call(c, f);
if (((n = c.receivedEvent) == null || n.call(c, this, f), d))
return;
}
try {
let c = JSON.parse(o);
switch (c[0]) {
case "EVENT": {
const f = this.openSubs.get(c[1]),
d = c[2];
this.verifyEvent(d) && e5(f.filters, d) && f.onevent(d);
return;
}
case "COUNT": {
const f = c[1],
d = c[2],
h = this.openCountRequests.get(f);
h && (h.resolve(d.count), this.openCountRequests.delete(f));
return;
}
case "EOSE": {
const f = this.openSubs.get(c[1]);
if (!f) return;
f.receivedEose();
return;
}
case "OK": {
const f = c[1],
d = c[2],
h = c[3],
y = this.openEventPublishes.get(f);
d ? y.resolve(h) : y.reject(new Error(h)),
this.openEventPublishes.delete(f);
return;
}
case "CLOSED": {
const f = c[1],
d = this.openSubs.get(f);
if (!d) return;
(d.closed = !0), d.close(c[2]);
return;
}
case "NOTICE":
this.onnotice(c[1]);
return;
case "AUTH": {
(this.challenge = c[1]),
(r = this._onauth) == null || r.call(this, c[1]);
return;
}
}
} catch {
return;
}
}
async send(t) {
if (!this.connectionPromise)
throw new Error("sending on closed connection");
this.connectionPromise.then(() => {
var n;
(n = this.ws) == null || n.send(t);
});
}
async auth(t) {
if (!this.challenge)
throw new Error("can't perform auth, no challenge was received");
const n = await t(r5(this.url, this.challenge)),
r = new Promise((o, s) => {
this.openEventPublishes.set(n.id, { resolve: o, reject: s });
});
return this.send('["AUTH",' + JSON.stringify(n) + "]"), r;
}
async publish(t) {
const n = new Promise((r, o) => {
this.openEventPublishes.set(t.id, { resolve: r, reject: o });
});
return this.send('["EVENT",' + JSON.stringify(t) + "]"), n;
}
async count(t, n) {
this.serial++;
const r = (n == null ? void 0 : n.id) || "count:" + this.serial,
o = new Promise((s, c) => {
this.openCountRequests.set(r, { resolve: s, reject: c });
});
return (
this.send('["COUNT","' + r + '",' + JSON.stringify(t) + "]"), o
);
}
subscribe(t, n) {
const r = this.prepareSubscription(t, n);
return r.fire(), r;
}
prepareSubscription(t, n) {
this.serial++;
const r = n.id || "sub:" + this.serial,
o = new s5(this, r, t, n);
return this.openSubs.set(r, o), o;
}
close() {
var t;
this.closeAllSubscriptions("relay connection closed by us"),
(this._connected = !1),
(t = this.ws) == null || t.close();
}
_onmessage(t) {
this.incomingMessageQueue.enqueue(t.data),
this.queueRunning || this.runQueue();
}
},
s5 = class {
constructor(t, n, r, o) {
pe(this, "relay"),
pe(this, "id"),
pe(this, "closed", !1),
pe(this, "eosed", !1),
pe(this, "filters"),
pe(this, "alreadyHaveEvent"),
pe(this, "receivedEvent"),
pe(this, "onevent"),
pe(this, "oneose"),
pe(this, "onclose"),
pe(this, "eoseTimeout"),
pe(this, "eoseTimeoutHandle"),
(this.relay = t),
(this.filters = r),
(this.id = n),
(this.alreadyHaveEvent = o.alreadyHaveEvent),
(this.receivedEvent = o.receivedEvent),
(this.eoseTimeout = o.eoseTimeout || t.baseEoseTimeout),
(this.oneose = o.oneose),
(this.onclose = o.onclose),
(this.onevent =
o.onevent ||
((s) => {
console.warn(
`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,
s
);
}));
}
fire() {
this.relay.send(
'["REQ","' +
this.id +
'",' +
JSON.stringify(this.filters).substring(1)
),
(this.eoseTimeoutHandle = setTimeout(
this.receivedEose.bind(this),
this.eoseTimeout
));
}
receivedEose() {
var t;
this.eosed ||
(clearTimeout(this.eoseTimeoutHandle),
(this.eosed = !0),
(t = this.oneose) == null || t.call(this));
}
close(t = "closed by caller") {
var n;
!this.closed &&
this.relay.connected &&
(this.relay.send('["CLOSE",' + JSON.stringify(this.id) + "]"),
(this.closed = !0)),
this.relay.openSubs.delete(this.id),
(n = this.onclose) == null || n.call(this, t);
}
},
a5 = class {
constructor(e) {
pe(this, "relays", new Map()),
pe(this, "seenOn", new Map()),
pe(this, "trackRelays", !1),
pe(this, "verifyEvent"),
pe(this, "trustedRelayURLs", new Set()),
(this.verifyEvent = e.verifyEvent);
}
async ensureRelay(e, t) {
e = Gi(e);
let n = this.relays.get(e);
return (
n ||
((n = new Xw(e, {
verifyEvent: this.trustedRelayURLs.has(e)
? i5
: this.verifyEvent,
})),
t != null &&
t.connectionTimeout &&
(n.connectionTimeout = t.connectionTimeout),
this.relays.set(e, n)),
await n.connect(),
n
);
}
close(e) {
e.map(Gi).forEach((t) => {
var n;
(n = this.relays.get(t)) == null || n.close();
});
}
subscribeMany(e, t, n) {
this.trackRelays &&
(n.receivedEvent = (m, v) => {
let P = this.seenOn.get(v);
P || ((P = new Set()), this.seenOn.set(v, P)), P.add(m);
});
const r = new Set(),
o = [],
s = [];
let c = (m) => {
var v;
(s[m] = !0),
s.filter((P) => P).length === e.length &&
((v = n.oneose) == null || v.call(n), (c = () => {}));
};
const f = [];
let d = (m, v) => {
var P;
c(m),
(f[m] = v),
f.filter((C) => C).length === e.length &&
((P = n.onclose) == null || P.call(n, f), (d = () => {}));
};
const h = (m) => {
var v;
if ((v = n.alreadyHaveEvent) != null && v.call(n, m)) return !0;
const P = r.has(m);
return r.add(m), P;
},
y = Promise.all(
e.map(Gi).map(async (m, v, P) => {
if (P.indexOf(m) !== v) {
d(v, "duplicate url");
return;
}
let C;
try {
C = await this.ensureRelay(m, {
connectionTimeout: n.maxWait
? Math.max(n.maxWait * 0.8, n.maxWait - 1e3)
: void 0,
});
} catch (O) {
d(v, (O == null ? void 0 : O.message) || String(O));
return;
}
let A = C.subscribe(t, {
...n,
oneose: () => c(v),
onclose: (O) => d(v, O),
alreadyHaveEvent: h,
eoseTimeout: n.maxWait,
});
o.push(A);
})
);
return {
async close() {
await y,
o.forEach((m) => {
m.close();
});
},
};
}
subscribeManyEose(e, t, n) {
const r = this.subscribeMany(e, t, {
...n,
oneose() {
r.close();
},
});
return r;
}
async querySync(e, t, n) {
return new Promise(async (r) => {
const o = [];
this.subscribeManyEose(e, [t], {
...n,
onevent(s) {
o.push(s);
},
onclose(s) {
r(o);
},
});
});
}
async get(e, t, n) {
t.limit = 1;
const r = await this.querySync(e, t, n);
return r.sort((o, s) => s.created_at - o.created_at), r[0] || null;
}
publish(e, t) {
return e
.map(Gi)
.map(async (n, r, o) =>
o.indexOf(n) !== r
? Promise.reject("duplicate url")
: (await this.ensureRelay(n)).publish(t)
);
}
},
c5 = class extends a5 {
constructor() {
super({ verifyEvent: Jk });
}
};
const ps = Symbol("store-raw"),
Nn = Symbol("store-node"),
an = Symbol("store-has"),
Qw = Symbol("store-self");
function em(e) {
let t = e[Ft];
if (
!t &&
(Object.defineProperty(e, Ft, { value: (t = new Proxy(e, l5)) }),
!Array.isArray(e))
) {
const n = Object.keys(e),
r = Object.getOwnPropertyDescriptors(e);
for (let o = 0, s = n.length; o < s; o++) {
const c = n[o];
r[c].get &&
Object.defineProperty(e, c, {
enumerable: r[c].enumerable,
get: r[c].get.bind(t),
});
}
}
return t;
}
function ur(e) {
let t;
return (
e != null &&
typeof e == "object" &&
(e[Ft] ||
!(t = Object.getPrototypeOf(e)) ||
t === Object.prototype ||
Array.isArray(e))
);
}
function lr(e, t = new Set()) {
let n, r, o, s;
if ((n = e != null && e[ps])) return n;
if (!ur(e) || t.has(e)) return e;
if (Array.isArray(e)) {
Object.isFrozen(e) ? (e = e.slice(0)) : t.add(e);
for (let c = 0, f = e.length; c < f; c++)
(o = e[c]), (r = lr(o, t)) !== o && (e[c] = r);
} else {
Object.isFrozen(e) ? (e = Object.assign({}, e)) : t.add(e);
const c = Object.keys(e),
f = Object.getOwnPropertyDescriptors(e);
for (let d = 0, h = c.length; d < h; d++)
(s = c[d]),
!f[s].get && ((o = e[s]), (r = lr(o, t)) !== o && (e[s] = r));
}
return e;
}
function $i(e, t) {
let n = e[t];
return (
n ||
Object.defineProperty(e, t, { value: (n = Object.create(null)) }),
n
);
}
function zo(e, t, n) {
if (e[t]) return e[t];
const [r, o] = dt(n, { equals: !1, internal: !0 });
return (r.$ = o), (e[t] = r);
}
function u5(e, t) {
const n = Reflect.getOwnPropertyDescriptor(e, t);
return (
!n ||
n.get ||
!n.configurable ||
t === Ft ||
t === Nn ||
(delete n.value, delete n.writable, (n.get = () => e[Ft][t])),
n
);
}
function Wd(e) {
ki() && zo($i(e, Nn), Qw)();
}
function tm(e) {
return Wd(e), Reflect.ownKeys(e);
}
const l5 = {
get(e, t, n) {
if (t === ps) return e;
if (t === Ft) return n;
if (t === fs) return Wd(e), n;
const r = $i(e, Nn),
o = r[t];
let s = o ? o() : e[t];
if (t === Nn || t === an || t === "__proto__") return s;
if (!o) {
const c = Object.getOwnPropertyDescriptor(e, t);
ki() &&
(typeof s != "function" || e.hasOwnProperty(t)) &&
!(c && c.get) &&
(s = zo(r, t, s)());
}
return ur(s) ? em(s) : s;
},
has(e, t) {
return t === ps ||
t === Ft ||
t === fs ||
t === Nn ||
t === an ||
t === "__proto__"
? !0
: (ki() && zo($i(e, an), t)(), t in e);
},
set() {
return !0;
},
deleteProperty() {
return !0;
},
ownKeys: tm,
getOwnPropertyDescriptor: u5,
};
function Dt(e, t, n, r = !1) {
if (!r && e[t] === n) return;
const o = e[t],
s = e.length;
n === void 0
? (delete e[t], e[an] && e[an][t] && o !== void 0 && e[an][t].$())
: ((e[t] = n), e[an] && e[an][t] && o === void 0 && e[an][t].$());
let c = $i(e, Nn),
f;
if (
((f = zo(c, t, o)) && f.$(() => n),
Array.isArray(e) && e.length !== s)
) {
for (let d = e.length; d < s; d++) (f = c[d]) && f.$();
(f = zo(c, "length", s)) && f.$(e.length);
}
(f = c[Qw]) && f.$();
}
function nm(e, t) {
const n = Object.keys(t);
for (let r = 0; r < n.length; r += 1) {
const o = n[r];
Dt(e, o, t[o]);
}
}
function d5(e, t) {
if (
(typeof t == "function" && (t = t(e)), (t = lr(t)), Array.isArray(t))
) {
if (e === t) return;
let n = 0,
r = t.length;
for (; n < r; n++) {
const o = t[n];
e[n] !== o && Dt(e, n, o);
}
Dt(e, "length", r);
} else nm(e, t);
}
function Zi(e, t, n = []) {
let r,
o = e;
if (t.length > 1) {
r = t.shift();
const c = typeof r,
f = Array.isArray(e);
if (Array.isArray(r)) {
for (let d = 0; d < r.length; d++) Zi(e, [r[d]].concat(t), n);
return;
} else if (f && c === "function") {
for (let d = 0; d < e.length; d++)
r(e[d], d) && Zi(e, [d].concat(t), n);
return;
} else if (f && c === "object") {
const { from: d = 0, to: h = e.length - 1, by: y = 1 } = r;
for (let m = d; m <= h; m += y) Zi(e, [m].concat(t), n);
return;
} else if (t.length > 1) {
Zi(e[r], t, [r].concat(n));
return;
}
(o = e[r]), (n = [r].concat(n));
}
let s = t[0];
(typeof s == "function" && ((s = s(o, n)), s === o)) ||
(r === void 0 && s == null) ||
((s = lr(s)),
r === void 0 || (ur(o) && ur(s) && !Array.isArray(s))
? nm(o, s)
: Dt(e, r, s));
}
function f5(...[e, t]) {
const n = lr(e || {}),
r = Array.isArray(n),
o = em(n);
function s(...c) {
ui(() => {
r && c.length === 1 ? d5(n, c[0]) : Zi(n, c);
});
}
return [o, s];
}
function h5(e, t) {
const n = Reflect.getOwnPropertyDescriptor(e, t);
return (
!n ||
n.get ||
n.set ||
!n.configurable ||
t === Ft ||
t === Nn ||
(delete n.value,
delete n.writable,
(n.get = () => e[Ft][t]),
(n.set = (r) => (e[Ft][t] = r))),
n
);
}
const p5 = {
get(e, t, n) {
if (t === ps) return e;
if (t === Ft) return n;
if (t === fs) return Wd(e), n;
const r = $i(e, Nn),
o = r[t];
let s = o ? o() : e[t];
if (t === Nn || t === an || t === "__proto__") return s;
if (!o) {
const c = Object.getOwnPropertyDescriptor(e, t),
f = typeof s == "function";
if (ki() && (!f || e.hasOwnProperty(t)) && !(c && c.get))
s = zo(r, t, s)();
else if (s != null && f && s === Array.prototype[t])
return (...d) => ui(() => Array.prototype[t].apply(n, d));
}
return ur(s) ? rm(s) : s;
},
has(e, t) {
return t === ps ||
t === Ft ||
t === fs ||
t === Nn ||
t === an ||
t === "__proto__"
? !0
: (ki() && zo($i(e, an), t)(), t in e);
},
set(e, t, n) {
return ui(() => Dt(e, t, lr(n))), !0;
},
deleteProperty(e, t) {
return ui(() => Dt(e, t, void 0, !0)), !0;
},
ownKeys: tm,
getOwnPropertyDescriptor: h5,
};
function rm(e) {
let t = e[Ft];
if (!t) {
Object.defineProperty(e, Ft, { value: (t = new Proxy(e, p5)) });
const n = Object.keys(e),
r = Object.getOwnPropertyDescriptors(e);
for (let o = 0, s = n.length; o < s; o++) {
const c = n[o];
if (r[c].get) {
const f = r[c].get.bind(t);
Object.defineProperty(e, c, { get: f });
}
if (r[c].set) {
const f = r[c].set;
Object.defineProperty(e, c, {
set: (h) => ui(() => f.call(t, h)),
});
}
}
}
return t;
}
function Gd(e, t) {
const n = lr(e || {});
return rm(n);
}
const Dl = Symbol("store-root");
function ni(e, t, n, r, o) {
const s = t[n];
if (e === s) return;
if (n !== Dl && (!ur(e) || !ur(s) || (o && e[o] !== s[o]))) {
Dt(t, n, e);
return;
}
if (Array.isArray(e)) {
if (e.length && s.length && (!r || (o && e[0] && e[0][o] != null))) {
let d, h, y, m, v, P, C, A;
for (
y = 0, m = Math.min(s.length, e.length);
y < m &&
(s[y] === e[y] || (o && s[y] && e[y] && s[y][o] === e[y][o]));
y++
)
ni(e[y], s, y, r, o);
const O = new Array(e.length),
M = new Map();
for (
m = s.length - 1, v = e.length - 1;
m >= y &&
v >= y &&
(s[m] === e[v] || (o && s[y] && e[y] && s[m][o] === e[v][o]));
m--, v--
)
O[v] = s[m];
if (y > v || y > m) {
for (h = y; h <= v; h++) Dt(s, h, e[h]);
for (; h < e.length; h++) Dt(s, h, O[h]), ni(e[h], s, h, r, o);
s.length > e.length && Dt(s, "length", e.length);
return;
}
for (C = new Array(v + 1), h = v; h >= y; h--)
(P = e[h]),
(A = o && P ? P[o] : P),
(d = M.get(A)),
(C[h] = d === void 0 ? -1 : d),
M.set(A, h);
for (d = y; d <= m; d++)
(P = s[d]),
(A = o && P ? P[o] : P),
(h = M.get(A)),
h !== void 0 &&
h !== -1 &&
((O[h] = s[d]), (h = C[h]), M.set(A, h));
for (h = y; h < e.length; h++)
h in O ? (Dt(s, h, O[h]), ni(e[h], s, h, r, o)) : Dt(s, h, e[h]);
} else for (let d = 0, h = e.length; d < h; d++) ni(e[d], s, d, r, o);
s.length > e.length && Dt(s, "length", e.length);
return;
}
const c = Object.keys(e);
for (let d = 0, h = c.length; d < h; d++) ni(e[c[d]], s, c[d], r, o);
const f = Object.keys(s);
for (let d = 0, h = f.length; d < h; d++)
e[f[d]] === void 0 && Dt(s, f[d], void 0);
}
function g5(e, t = {}) {
const { merge: n, key: r = "id" } = t,
o = lr(e);
return (s) => {
if (!ur(s) || !ur(o)) return o;
const c = ni(o, { [Dl]: s }, Dl, n, r);
return c === void 0 ? s : c;
};
}
const di = new c5(),
me = Gd({ rootEventIds: [], filter: {}, profiles: () => [] }),
Ut = Gd({}),
w5 = [
"reply",
"likes",
"zaps",
"publish",
"watch",
"replyAnonymously",
"hideContent",
],
m5 = (e) => w5.includes(e);
/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */ function Oi(
e
) {
if (!Number.isSafeInteger(e)) throw new Error(`Wrong integer: ${e}`);
}
function wr(...e) {
const t = (o, s) => (c) => o(s(c)),
n = Array.from(e)
.reverse()
.reduce((o, s) => (o ? t(o, s.encode) : s.encode), void 0),
r = e.reduce((o, s) => (o ? t(o, s.decode) : s.decode), void 0);
return { encode: n, decode: r };
}
function mr(e) {
return {
encode: (t) => {
if (!Array.isArray(t) || (t.length && typeof t[0] != "number"))
throw new Error(
"alphabet.encode input should be an array of numbers"
);
return t.map((n) => {
if ((Oi(n), n < 0 || n >= e.length))
throw new Error(
`Digit index outside alphabet: ${n} (alphabet: ${e.length})`
);
return e[n];
});
},
decode: (t) => {
if (!Array.isArray(t) || (t.length && typeof t[0] != "string"))
throw new Error(
"alphabet.decode input should be array of strings"
);
return t.map((n) => {
if (typeof n != "string")
throw new Error(`alphabet.decode: not string element=${n}`);
const r = e.indexOf(n);
if (r === -1)
throw new Error(`Unknown letter: "${n}". Allowed: ${e}`);
return r;
});
},
};
}
function br(e = "") {
if (typeof e != "string")
throw new Error("join separator should be string");
return {
encode: (t) => {
if (!Array.isArray(t) || (t.length && typeof t[0] != "string"))
throw new Error("join.encode input should be array of strings");
for (let n of t)
if (typeof n != "string")
throw new Error(`join.encode: non-string input=${n}`);
return t.join(e);
},
decode: (t) => {
if (typeof t != "string")
throw new Error("join.decode input should be string");
return t.split(e);
},
};
}
function Ac(e, t = "=") {
if ((Oi(e), typeof t != "string"))
throw new Error("padding chr should be string");
return {
encode(n) {
if (!Array.isArray(n) || (n.length && typeof n[0] != "string"))
throw new Error(
"padding.encode input should be array of strings"
);
for (let r of n)
if (typeof r != "string")
throw new Error(`padding.encode: non-string input=${r}`);
for (; (n.length * e) % 8; ) n.push(t);
return n;
},
decode(n) {
if (!Array.isArray(n) || (n.length && typeof n[0] != "string"))
throw new Error(
"padding.encode input should be array of strings"
);
for (let o of n)
if (typeof o != "string")
throw new Error(`padding.decode: non-string input=${o}`);
let r = n.length;
if ((r * e) % 8)
throw new Error(
"Invalid padding: string should have whole number of bytes"
);
for (; r > 0 && n[r - 1] === t; r--)
if (!(((r - 1) * e) % 8))
throw new Error("Invalid padding: string has too much padding");
return n.slice(0, r);
},
};
}
function om(e) {
if (typeof e != "function")
throw new Error("normalize fn should be function");
return { encode: (t) => t, decode: (t) => e(t) };
}
function Hp(e, t, n) {
if (t < 2)
throw new Error(
`convertRadix: wrong from=${t}, base cannot be less than 2`
);
if (n < 2)
throw new Error(
`convertRadix: wrong to=${n}, base cannot be less than 2`
);
if (!Array.isArray(e))
throw new Error("convertRadix: data should be array");
if (!e.length) return [];
let r = 0;
const o = [],
s = Array.from(e);
for (
s.forEach((c) => {
if ((Oi(c), c < 0 || c >= t))
throw new Error(`Wrong integer: ${c}`);
});
;
) {
let c = 0,
f = !0;
for (let d = r; d < s.length; d++) {
const h = s[d],
y = t * c + h;
if (
!Number.isSafeInteger(y) ||
(t * c) / t !== c ||
y - h !== t * c
)
throw new Error("convertRadix: carry overflow");
if (
((c = y % n),
(s[d] = Math.floor(y / n)),
!Number.isSafeInteger(s[d]) || s[d] * n + c !== y)
)
throw new Error("convertRadix: carry overflow");
if (f) s[d] ? (f = !1) : (r = d);
else continue;
}
if ((o.push(c), f)) break;
}
for (let c = 0; c < e.length - 1 && e[c] === 0; c++) o.push(0);
return o.reverse();
}
const im = (e, t) => (t ? im(t, e % t) : e),
Oa = (e, t) => e + (t - im(e, t));
function ql(e, t, n, r) {
if (!Array.isArray(e))
throw new Error("convertRadix2: data should be array");
if (t <= 0 || t > 32) throw new Error(`convertRadix2: wrong from=${t}`);
if (n <= 0 || n > 32) throw new Error(`convertRadix2: wrong to=${n}`);
if (Oa(t, n) > 32)
throw new Error(
`convertRadix2: carry overflow from=${t} to=${n} carryBits=${Oa(
t,
n
)}`
);
let o = 0,
s = 0;
const c = 2 ** n - 1,
f = [];
for (const d of e) {
if ((Oi(d), d >= 2 ** t))
throw new Error(`convertRadix2: invalid data word=${d} from=${t}`);
if (((o = (o << t) | d), s + t > 32))
throw new Error(`convertRadix2: carry overflow pos=${s} from=${t}`);
for (s += t; s >= n; s -= n) f.push(((o >> (s - n)) & c) >>> 0);
o &= 2 ** s - 1;
}
if (((o = (o << (n - s)) & c), !r && s >= t))
throw new Error("Excess padding");
if (!r && o) throw new Error(`Non-zero padding: ${o}`);
return r && s > 0 && f.push(o >>> 0), f;
}
function b5(e) {
return (
Oi(e),
{
encode: (t) => {
if (!(t instanceof Uint8Array))
throw new Error("radix.encode input should be Uint8Array");
return Hp(Array.from(t), 2 ** 8, e);
},
decode: (t) => {
if (!Array.isArray(t) || (t.length && typeof t[0] != "number"))
throw new Error(
"radix.decode input should be array of strings"
);
return Uint8Array.from(Hp(t, e, 2 ** 8));
},
}
);
}
function lo(e, t = !1) {
if ((Oi(e), e <= 0 || e > 32))
throw new Error("radix2: bits should be in (0..32]");
if (Oa(8, e) > 32 || Oa(e, 8) > 32)
throw new Error("radix2: carry overflow");
return {
encode: (n) => {
if (!(n instanceof Uint8Array))
throw new Error("radix2.encode input should be Uint8Array");
return ql(Array.from(n), 8, e, !t);
},
decode: (n) => {
if (!Array.isArray(n) || (n.length && typeof n[0] != "number"))
throw new Error("radix2.decode input should be array of strings");
return Uint8Array.from(ql(n, e, 8, t));
},
};
}
function jp(e) {
if (typeof e != "function")
throw new Error("unsafeWrapper fn should be function");
return function (...t) {
try {
return e.apply(null, t);
} catch {}
};
}
const y5 = wr(lo(4), mr("0123456789ABCDEF"), br("")),
v5 = wr(lo(5), mr("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), Ac(5), br(""));
wr(lo(5), mr("0123456789ABCDEFGHIJKLMNOPQRSTUV"), Ac(5), br(""));
wr(
lo(5),
mr("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),
br(""),
om((e) => e.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1"))
);
const _5 = wr(
lo(6),
mr(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
),
Ac(6),
br("")
),
E5 = wr(
lo(6),
mr(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
),
Ac(6),
br("")
),
Zd = (e) => wr(b5(58), mr(e), br("")),
Vl = Zd("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
Zd("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");
Zd("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");
const Dp = [0, 2, 3, 5, 6, 7, 9, 10, 11],
k5 = {
encode(e) {
let t = "";
for (let n = 0; n < e.length; n += 8) {
const r = e.subarray(n, n + 8);
t += Vl.encode(r).padStart(Dp[r.length], "1");
}
return t;
},
decode(e) {
let t = [];
for (let n = 0; n < e.length; n += 11) {
const r = e.slice(n, n + 11),
o = Dp.indexOf(r.length),
s = Vl.decode(r);
for (let c = 0; c < s.length - o; c++)
if (s[c] !== 0) throw new Error("base58xmr: wrong padding");
t = t.concat(Array.from(s.slice(s.length - o)));
}
return Uint8Array.from(t);
},
},
Fl = wr(mr("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), br("")),
qp = [996825010, 642813549, 513874426, 1027748829, 705979059];
function Vi(e) {
const t = e >> 25;
let n = (e & 33554431) << 5;
for (let r = 0; r < qp.length; r++)
((t >> r) & 1) === 1 && (n ^= qp[r]);
return n;
}
function Vp(e, t, n = 1) {
const r = e.length;
let o = 1;
for (let s = 0; s < r; s++) {
const c = e.charCodeAt(s);
if (c < 33 || c > 126) throw new Error(`Invalid prefix (${e})`);
o = Vi(o) ^ (c >> 5);
}
o = Vi(o);
for (let s = 0; s < r; s++) o = Vi(o) ^ (e.charCodeAt(s) & 31);
for (let s of t) o = Vi(o) ^ s;
for (let s = 0; s < 6; s++) o = Vi(o);
return (o ^= n), Fl.encode(ql([o % 2 ** 30], 30, 5, !1));
}
function sm(e) {
const t = e === "bech32" ? 1 : 734539939,
n = lo(5),
r = n.decode,
o = n.encode,
s = jp(r);
function c(y, m, v = 90) {
if (typeof y != "string")
throw new Error(
`bech32.encode prefix should be string, not ${typeof y}`
);
if (!Array.isArray(m) || (m.length && typeof m[0] != "number"))
throw new Error(
`bech32.encode words should be array of numbers, not ${typeof m}`
);
const P = y.length + 7 + m.length;
if (v !== !1 && P > v)
throw new TypeError(`Length ${P} exceeds limit ${v}`);
return (y = y.toLowerCase()), `${y}1${Fl.encode(m)}${Vp(y, m, t)}`;
}
function f(y, m = 90) {
if (typeof y != "string")
throw new Error(
`bech32.decode input should be string, not ${typeof y}`
);
if (y.length < 8 || (m !== !1 && y.length > m))
throw new TypeError(
`Wrong string length: ${y.length} (${y}). Expected (8..${m})`
);
const v = y.toLowerCase();
if (y !== v && y !== y.toUpperCase())
throw new Error("String must be lowercase or uppercase");
y = v;
const P = y.lastIndexOf("1");
if (P === 0 || P === -1)
throw new Error(
'Letter "1" must be present between prefix and data only'
);
const C = y.slice(0, P),
A = y.slice(P + 1);
if (A.length < 6)
throw new Error("Data must be at least 6 characters long");
const O = Fl.decode(A).slice(0, -6),
M = Vp(C, O, t);
if (!A.endsWith(M))
throw new Error(`Invalid checksum in ${y}: expected "${M}"`);
return { prefix: C, words: O };
}
const d = jp(f);
function h(y) {
const { prefix: m, words: v } = f(y, !1);
return { prefix: m, words: v, bytes: r(v) };
}
return {
encode: c,
decode: f,
decodeToBytes: h,
decodeUnsafe: d,
fromWords: r,
fromWordsUnsafe: s,
toWords: o,
};
}
const xi = sm("bech32");
sm("bech32m");
const A5 = {
encode: (e) => new TextDecoder().decode(e),
decode: (e) => new TextEncoder().encode(e),
},
S5 = wr(
lo(4),
mr("0123456789abcdef"),
br(""),
om((e) => {
if (typeof e != "string" || e.length % 2)
throw new TypeError(
`hex.decode: expected string, got ${typeof e} with length ${
e.length
}`
);
return e.toLowerCase();
})
),
$5 = {
utf8: A5,
hex: S5,
base16: y5,
base32: v5,
base64: _5,
base64url: E5,
base58: Vl,
base58xmr: k5,
};
`${Object.keys($5).join(", ")}`;
var Fi = new TextDecoder("utf-8");
new TextEncoder();
var am = 5e3;
function ia(e) {
var t, n, r, o, s, c, f, d;
let { prefix: h, words: y } = xi.decode(e, am),
m = new Uint8Array(xi.fromWords(y));
switch (h) {
case "nprofile": {
let v = Gs(m);
if (!((t = v[0]) != null && t[0]))
throw new Error("missing TLV 0 for nprofile");
if (v[0][0].length !== 32)
throw new Error("TLV 0 should be 32 bytes");
return {
type: "nprofile",
data: {
pubkey: Je(v[0][0]),
relays: v[1] ? v[1].map((P) => Fi.decode(P)) : [],
},
};
}
case "nevent": {
let v = Gs(m);
if (!((n = v[0]) != null && n[0]))
throw new Error("missing TLV 0 for nevent");
if (v[0][0].length !== 32)
throw new Error("TLV 0 should be 32 bytes");
if (v[2] && v[2][0].length !== 32)
throw new Error("TLV 2 should be 32 bytes");
if (v[3] && v[3][0].length !== 4)
throw new Error("TLV 3 should be 4 bytes");
return {
type: "nevent",
data: {
id: Je(v[0][0]),
relays: v[1] ? v[1].map((P) => Fi.decode(P)) : [],
author: (r = v[2]) != null && r[0] ? Je(v[2][0]) : void 0,
kind:
(o = v[3]) != null && o[0]
? parseInt(Je(v[3][0]), 16)
: void 0,
},
};
}
case "naddr": {
let v = Gs(m);
if (!((s = v[0]) != null && s[0]))
throw new Error("missing TLV 0 for naddr");
if (!((c = v[2]) != null && c[0]))
throw new Error("missing TLV 2 for naddr");
if (v[2][0].length !== 32)
throw new Error("TLV 2 should be 32 bytes");
if (!((f = v[3]) != null && f[0]))
throw new Error("missing TLV 3 for naddr");
if (v[3][0].length !== 4)
throw new Error("TLV 3 should be 4 bytes");
return {
type: "naddr",
data: {
identifier: Fi.decode(v[0][0]),
pubkey: Je(v[2][0]),
kind: parseInt(Je(v[3][0]), 16),
relays: v[1] ? v[1].map((P) => Fi.decode(P)) : [],
},
};
}
case "nrelay": {
let v = Gs(m);
if (!((d = v[0]) != null && d[0]))
throw new Error("missing TLV 0 for nrelay");
return { type: "nrelay", data: Fi.decode(v[0][0]) };
}
case "nsec":
return { type: h, data: m };
case "npub":
case "note":
return { type: h, data: Je(m) };
default:
throw new Error(`unknown prefix ${h}`);
}
}
function Gs(e) {
let t = {},
n = e;
for (; n.length > 0; ) {
let r = n[0],
o = n[1],
s = n.slice(2, 2 + o);
if (((n = n.slice(2 + o)), s.length < o))
throw new Error(`not enough data to read on TLV ${r}`);
(t[r] = t[r] || []), t[r].push(s);
}
return t;
}
function cm(e) {
return um("npub", Kw(e));
}
function Fp(e) {
return um("note", Kw(e));
}
function x5(e, t) {
let n = xi.toWords(t);
return xi.encode(e, n, am);
}
function um(e, t) {
return x5(e, t);
}
var Ki = new TextDecoder("utf-8");
new TextEncoder();
var T5 = 5e3,
P5 = /[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;
function lm(e) {
var t, n, r, o, s, c, f, d;
let { prefix: h, words: y } = xi.decode(e, T5),
m = new Uint8Array(xi.fromWords(y));
switch (h) {
case "nprofile": {
let v = Zs(m);
if (!((t = v[0]) != null && t[0]))
throw new Error("missing TLV 0 for nprofile");
if (v[0][0].length !== 32)
throw new Error("TLV 0 should be 32 bytes");
return {
type: "nprofile",
data: {
pubkey: Je(v[0][0]),
relays: v[1] ? v[1].map((P) => Ki.decode(P)) : [],
},
};
}
case "nevent": {
let v = Zs(m);
if (!((n = v[0]) != null && n[0]))
throw new Error("missing TLV 0 for nevent");
if (v[0][0].length !== 32)
throw new Error("TLV 0 should be 32 bytes");
if (v[2] && v[2][0].length !== 32)
throw new Error("TLV 2 should be 32 bytes");
if (v[3] && v[3][0].length !== 4)
throw new Error("TLV 3 should be 4 bytes");
return {
type: "nevent",
data: {
id: Je(v[0][0]),
relays: v[1] ? v[1].map((P) => Ki.decode(P)) : [],
author: (r = v[2]) != null && r[0] ? Je(v[2][0]) : void 0,
kind:
(o = v[3]) != null && o[0]
? parseInt(Je(v[3][0]), 16)
: void 0,
},
};
}
case "naddr": {
let v = Zs(m);
if (!((s = v[0]) != null && s[0]))
throw new Error("missing TLV 0 for naddr");
if (!((c = v[2]) != null && c[0]))
throw new Error("missing TLV 2 for naddr");
if (v[2][0].length !== 32)
throw new Error("TLV 2 should be 32 bytes");
if (!((f = v[3]) != null && f[0]))
throw new Error("missing TLV 3 for naddr");
if (v[3][0].length !== 4)
throw new Error("TLV 3 should be 4 bytes");
return {
type: "naddr",
data: {
identifier: Ki.decode(v[0][0]),
pubkey: Je(v[2][0]),
kind: parseInt(Je(v[3][0]), 16),
relays: v[1] ? v[1].map((P) => Ki.decode(P)) : [],
},
};
}
case "nrelay": {
let v = Zs(m);
if (!((d = v[0]) != null && d[0]))
throw new Error("missing TLV 0 for nrelay");
return { type: "nrelay", data: Ki.decode(v[0][0]) };
}
case "nsec":
return { type: h, data: m };
case "npub":
case "note":
return { type: h, data: Je(m) };
default:
throw new Error(`unknown prefix ${h}`);
}
}
function Zs(e) {
let t = {},
n = e;
for (; n.length > 0; ) {
let r = n[0],
o = n[1],
s = n.slice(2, 2 + o);
if (((n = n.slice(2 + o)), s.length < o))
throw new Error(`not enough data to read on TLV ${r}`);
(t[r] = t[r] || []), t[r].push(s);
}
return t;
}
var L5 = new RegExp(`nostr:(${P5.source})`),
dm = () => new RegExp(`\\b${L5.source}\\b`, "g");
function* B5(e) {
const t = e.matchAll(dm());
for (const n of t)
try {
const [r, o] = n;
yield {
uri: r,
value: o,
decoded: lm(o),
start: n.index,
end: n.index + r.length,
};
} catch {}
}
function C5(e, t) {
return e.replaceAll(dm(), (n, r) =>
t({ uri: n, value: r, decoded: lm(r) })
);
}
var I5 =
typeof globalThis < "u"
? globalThis
: typeof window < "u"
? window
: typeof global < "u"
? global
: typeof self < "u"
? self
: {};
function O5(e) {
return e &&
e.__esModule &&
Object.prototype.hasOwnProperty.call(e, "default")
? e.default
: e;
}
var fm = { exports: {} };
(function (e, t) {
(function (n, r) {
e.exports = r();
})(I5, function () {
function n(f) {
return f
.replace(/\\([(){}[\]#*+\-.!_\\])/g, function (d, h) {
return String.fromCharCode(1, o.indexOf(h) + s);
})
.replace(
/(\*\*|__|~~)(\S(?:[\s\S]*?\S)?)\1/g,
function (d, h, y) {
return h === "~~"
? "<del>" + y + "</del>"
: "<b>" + y + "</b>";
}
)
.replace(
/(\n|^|\W)([_\*])(\S(?:[\s\S]*?\S)?)\2(\W|$|\n)/g,
function (d, h, y, m, v) {
return h + "<i>" + m + "</i>" + v;
}
)
.replace(
/(!?)\[([^\]<>]+)\]\((\+?)([^ \)<>]+)(?: "([^\(\)\"]+)")?\)/g,
function (d, h, y, m, v, P) {
var C = P ? ' title="' + P + '"' : "";
return h
? '<img src="' + c.href(v) + '" alt="' + y + '"' + C + "/>"
: (m && (C += ' target="_blank"'),
'<a href="' + c.href(v) + '"' + C + ">" + y + "</a>");
}
);
}
function r(f) {
return f.replace(/\x01([\x0f-\x1c])/g, function (d, h) {
return o.charAt(h.charCodeAt(0) - s);
});
}
var o = "\\[!]#{()}*+-._",
s = 16,
c = function (f) {
return f.replace(/.+(?:\n.+)*/g, function (d) {
var h = /^\s{4}([^]*)$/.exec(d);
if (h)
return (
"<pre><code>" +
h[1].replace(
/\n /g,
`
`
) +
"</code></pre>"
);
for (
var y,
m = [],
v = n(d).split(`
`),
P = 0,
C = v.length;
C > P;
++P
) {
var A = v[P],
O = /^\s{0,3}(\#{1,6})\s+(.*?)\s*#*\s*$/.exec(A);
if (O) m.push((y = [O[2], "h", O[1].length]));
else {
var M = /^(\s*)(?:[-*]|(\d[.)])) (.+)$/.exec(A);
M
? m.push((y = [M[3], M[2] ? "ol" : "ul", M[1].length]))
: /^\s{0,3}([-])(\s*\1){2,}\s*$/.test(A)
? m.push((y = ["", "hr"]))
: y && y[1] !== "hr" && y[1] !== "h"
? (y[0] +=
`
` + A)
: m.push((y = [A, "p", ""]));
}
}
var T = "",
N = [];
for (P = 0, C = m.length; C > P; ++P) {
y = m[P];
var l = y[0],
w = y[1],
p = y[2];
if (w === "ul" || w === "ol")
!N.length || p > N[0][1]
? (N.unshift([w, p]), (T += "<" + N[0][0] + "><li>" + l))
: N.length > 1 && p <= N[1][1]
? ((T += "</li></" + N.shift()[0] + ">"), --P)
: (T += "</li><li>" + l);
else {
for (; N.length; ) T += "</li></" + N.shift()[0] + ">";
T +=
w === "hr"
? "<hr/>"
: "<" +
w +
p +
c.headAttrs(p, l) +
">" +
l +
"</" +
w +
p +
">";
}
}
for (; N.length; ) T += "</li></" + N.shift()[0] + ">";
return r(T);
});
};
return (
(c.href = function (f) {
return f;
}),
(c.headAttrs = function (f, d) {
return "";
}),
c
);
});
})(fm);
var N5 = fm.exports;
const R5 = O5(N5);
function z5(e) {
return async () =>
new Promise((t) => {
setTimeout(t, e);
});
}
function U5(e, { delay: t = void 0 } = {}) {
if (typeof t != "number" && t !== void 0)
throw new TypeError(
`Expected \`interval\` to be of type \`number\` but received type \`${typeof t}\``
);
const n = t === void 0 ? async () => {} : z5(t);
let r = [];
return (o) => {
r.push(o),
r.length === 1 && (async () => (await n(), e(r), (r = [])))();
};
}
const M5 = (e, t) => t.some((n) => e instanceof n);
let Kp, Wp;
function H5() {
return (
Kp ||
(Kp = [
IDBDatabase,
IDBObjectStore,
IDBIndex,
IDBCursor,
IDBTransaction,
])
);
}
function j5() {
return (
Wp ||
(Wp = [
IDBCursor.prototype.advance,
IDBCursor.prototype.continue,
IDBCursor.prototype.continuePrimaryKey,
])
);
}
const hm = new WeakMap(),
Kl = new WeakMap(),
pm = new WeakMap(),
Gu = new WeakMap(),
Yd = new WeakMap();
function D5(e) {
const t = new Promise((n, r) => {
const o = () => {
e.removeEventListener("success", s),
e.removeEventListener("error", c);
},
s = () => {
n(Fr(e.result)), o();
},
c = () => {
r(e.error), o();
};
e.addEventListener("success", s), e.addEventListener("error", c);
});
return (
t
.then((n) => {
n instanceof IDBCursor && hm.set(n, e);
})
.catch(() => {}),
Yd.set(t, e),
t
);
}
function q5(e) {
if (Kl.has(e)) return;
const t = new Promise((n, r) => {
const o = () => {
e.removeEventListener("complete", s),
e.removeEventListener("error", c),
e.removeEventListener("abort", c);
},
s = () => {
n(), o();
},
c = () => {
r(e.error || new DOMException("AbortError", "AbortError")), o();
};
e.addEventListener("complete", s),
e.addEventListener("error", c),
e.addEventListener("abort", c);
});
Kl.set(e, t);
}
let Wl = {
get(e, t, n) {
if (e instanceof IDBTransaction) {
if (t === "done") return Kl.get(e);
if (t === "objectStoreNames")
return e.objectStoreNames || pm.get(e);
if (t === "store")
return n.objectStoreNames[1]
? void 0
: n.objectStore(n.objectStoreNames[0]);
}
return Fr(e[t]);
},
set(e, t, n) {
return (e[t] = n), !0;
},
has(e, t) {
return e instanceof IDBTransaction && (t === "done" || t === "store")
? !0
: t in e;
},
};
function V5(e) {
Wl = e(Wl);
}
function F5(e) {
return e === IDBDatabase.prototype.transaction &&
!("objectStoreNames" in IDBTransaction.prototype)
? function (t, ...n) {
const r = e.call(Zu(this), t, ...n);
return pm.set(r, t.sort ? t.sort() : [t]), Fr(r);
}
: j5().includes(e)
? function (...t) {
return e.apply(Zu(this), t), Fr(hm.get(this));
}
: function (...t) {
return Fr(e.apply(Zu(this), t));
};
}
function K5(e) {
return typeof e == "function"
? F5(e)
: (e instanceof IDBTransaction && q5(e),
M5(e, H5()) ? new Proxy(e, Wl) : e);
}
function Fr(e) {
if (e instanceof IDBRequest) return D5(e);
if (Gu.has(e)) return Gu.get(e);
const t = K5(e);
return t !== e && (Gu.set(e, t), Yd.set(t, e)), t;
}
const Zu = (e) => Yd.get(e);
function W5(
e,
t,
{ blocked: n, upgrade: r, blocking: o, terminated: s } = {}
) {
const c = indexedDB.open(e, t),
f = Fr(c);
return (
r &&
c.addEventListener("upgradeneeded", (d) => {
r(Fr(c.result), d.oldVersion, d.newVersion, Fr(c.transaction), d);
}),
n &&
c.addEventListener("blocked", (d) =>
n(d.oldVersion, d.newVersion, d)
),
f
.then((d) => {
s && d.addEventListener("close", () => s()),
o &&
d.addEventListener("versionchange", (h) =>
o(h.oldVersion, h.newVersion, h)
);
})
.catch(() => {}),
f
);
}
const G5 = ["get", "getKey", "getAll", "getAllKeys", "count"],
Z5 = ["put", "add", "delete", "clear"],
Yu = new Map();
function Gp(e, t) {
if (!(e instanceof IDBDatabase && !(t in e) && typeof t == "string"))
return;
if (Yu.get(t)) return Yu.get(t);
const n = t.replace(/FromIndex$/, ""),
r = t !== n,
o = Z5.includes(n);
if (
!(n in (r ? IDBIndex : IDBObjectStore).prototype) ||
!(o || G5.includes(n))
)
return;
const s = async function (c, ...f) {
const d = this.transaction(c, o ? "readwrite" : "readonly");
let h = d.store;
return (
r && (h = h.index(f.shift())),
(await Promise.all([h[n](...f), o && d.done]))[0]
);
};
return Yu.set(t, s), s;
}
V5((e) => ({
...e,
get: (t, n, r) => Gp(t, n) || e.get(t, n, r),
has: (t, n) => !!Gp(t, n) || e.has(t, n),
}));
function Y5(e) {
const t = { reply: void 0, root: void 0, mentions: [], profiles: [] },
n = [];
for (const r of e.tags)
r[0] === "e" && r[1] && n.push(r),
r[0] === "p" &&
r[1] &&
t.profiles.push({ pubkey: r[1], relays: r[2] ? [r[2]] : [] });
for (let r = 0; r < n.length; r++) {
const o = n[r],
[s, c, f, d] = o,
h = { id: c, relays: f ? [f] : [] },
y = r === 0,
m = r === n.length - 1;
if (d === "root") {
t.root = h;
continue;
}
if (d === "reply") {
t.reply = h;
continue;
}
if (d === "mention") {
t.mentions.push(h);
continue;
}
if (y) {
t.root = h;
continue;
}
if (m) {
t.reply = h;
continue;
}
t.mentions.push(h);
}
return t;
}
const Yi = {
events: "id",
aggregates: ["eid", "k"],
profiles: ["pk"],
relays: ["n", "a"],
},
J5 = async (e, t) => {
if (t <= 1) {
const s = [...e.objectStoreNames];
await Promise.all(s.map((c) => e.deleteObjectStore(c)));
}
const n = e.createObjectStore("events", { keyPath: Yi.events });
n.createIndex("a", "a"),
n.createIndex("ro", "ro"),
n.createIndex("r", "r"),
n.createIndex("d", "d"),
n.createIndex("k", "k"),
e.createObjectStore("aggregates", { keyPath: Yi.aggregates }),
e
.createObjectStore("profiles", { keyPath: Yi.profiles })
.createIndex("l", "l"),
e
.createObjectStore("relays", { keyPath: Yi.relays })
.createIndex("a", "a");
},
Na = (e) => {
var t, n;
const r = Y5(e),
o = e.tags.find((A) => A[0] === "a"),
s = o && o[1],
c = o && o[3] === "mention",
f = e.tags.find((A) => A[0] === "r"),
d = f && f[1],
h = e.tags.filter((A) => A[0] === "t"),
y = [...new Set(h.map((A) => A[1]))],
m = e.tags.find((A) => A[0] === "d"),
v = m && m[1],
P = e.tags.find((A) => A[0] === "title"),
C = P && P[1];
return {
id: e.id ?? "",
k: e.kind,
c: e.content,
ts: e.created_at,
pk: e.pubkey,
ro: (t = r.root) == null ? void 0 : t.id,
re: (n = r.reply) == null ? void 0 : n.id,
me: r.mentions.map((A) => A.id),
p: r.profiles.map((A) => A.pubkey),
a: s,
am: c,
r: d,
t: y,
d: v,
tl: C,
};
},
X5 = () => ({});
let fi = X5(),
Zp = !0,
Yp;
const Sc = async () => {
if (Zp !== !1)
try {
return Yp || (Yp = await W5("zapthreads", 2, { upgrade: J5 }));
} catch {
Zp = !1;
}
},
Ys = (e) => {
const t = De(
jr(e, () => {
const [n, r, o] = e(),
s = () => Ti(n, r, o),
[c, { mutate: f }] = ww(() => es[n], s, {
initialValue: [],
storage: gm,
});
return Ti(n, r, o).then(f), c;
})
);
return () => t()();
},
Jp = (e) => {
const t = De(
jr(e, () => {
const [n, r, o] = e(),
s = () => hi(n, r, o),
[c, { mutate: f }] = ww(() => es[n], s, {
initialValue: void 0,
storage: gm,
});
return hi(n, r, o).then(f), c;
})
);
return () => t()();
},
Ti = async (e, t, n) => {
const r = await Sc();
if (!r) {
const o = fi[e];
if (o) {
if (n) {
const s = Array.isArray(t) ? t : [t];
return Object.values(o).filter((c) => s.includes(c[n.index]));
}
return Object.values(o);
}
return [];
}
if (t && n) {
if (Array.isArray(t)) {
const o = t.map((c) => r.getAllFromIndex(e, n.index, c));
return (await Promise.all(o)).flat();
}
return r.getAllFromIndex(e, n.index, t);
}
return r.getAll(e);
},
hi = async (e, t, n) => {
const r = await Sc();
if (!r) {
const o = fi[e];
if (o) {
if (n) return Object.values(o).find((c) => c[n.index] === t);
const s = (t.lower ? t.lower : t).toString();
return o[s];
}
return;
}
return n ? r.getFromIndex(e, n.index, t) : r.get(e, t);
},
Ju = {},
Xp = (e, t) => {
fi[e] ?? (fi[e] = {});
for (const n of t) {
let r = Yi[e];
r = Array.isArray(r) ? r : [r];
const o = r.map((s) => n[s]).join(",");
fi[e][o] = n;
}
},
un = async (e, t, n = { immediate: !1 }) => {
const r = await Sc();
if (n.immediate) {
r ? r.put(e, t) : Xp(e, [t]), (es[e] = +new Date());
return;
}
Ju[e] ||
(Ju[e] = U5(
async (o) => {
if (!r) {
Xp(e, o), (es[e] = +new Date());
return;
}
const s = r.transaction(e, "readwrite");
(await Promise.all([
...o.map((f) => s.store.put(f)),
s.done,
])) && (es[e] = +new Date());
},
{ delay: 96 }
)),
Ju[e](t);
},
Q5 = async () => {
const e = await Sc();
if (!e) {
fi = {};
return;
}
const t = [...e.objectStoreNames];
await Promise.all(t.map((n) => e.clear(n)));
},
es = Gd({});
function gm(e) {
const [t, n] = f5({ value: e });
return [
() => t.value,
(r) => {
const o = lr(t.value);
return (
typeof r == "function" && (r = r(o)), n("value", g5(r)), t.value
);
},
];
}
const wm = async (e, t, n) => {
const r = +new Date(),
o = 216e5,
s = [...new Set(e)]
.filter((f) => {
const d = n.find((h) => h.pk === f);
return !(d != null && d.l && d.l > r - o);
})
.filter((f) => !!f);
if (s.length === 0) return;
const c = await di.querySync(t, { kinds: [0], authors: s });
for (const f of s) {
const d = c.find((h) => h.pubkey === f);
if (d) {
const h = JSON.parse(d.content),
y = d.pubkey,
m = {
pk: y,
ts: d.created_at,
i: h.image || h.picture,
n: h.displayName || h.display_name || h.name,
},
v = n.find((P) => P.pk === y);
!v || !(v != null && v.n) || v.ts < m.ts
? un("profiles", { ...m, l: r })
: un("profiles", { ...v, l: r });
}
}
},
eA = async (e, t) => {
const r = (await Ti("relays", e.value, { index: "a" }))
.filter((o) => t.includes(o.n))
.map((o) => o.l);
return r.length > 0 ? Math.min(...r) + 1 : 0;
},
tA = async (e, t) => {
const n = {};
for (const o of t) {
const s = di.seenOn.get(o.id);
if (s)
for (const c of s) o.ts > (n[c.url] || 0) && (n[c.url] = o.ts);
}
const r = await Ti("relays", e.value, { index: "a" });
for (const o in n) {
const s = r.find((c) => c.n === o);
s
? n[o] > s.l && ((s.l = n[o]), un("relays", s))
: un("relays", { n: o, a: e.value, l: n[o] });
}
},
nA = new RegExp(
"(?<=^|\\s)https?:\\/\\/[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&\\/\\/=]*)",
"gi"
),
rA = /(\S*(?:png|jpg|jpeg|gif|webp))/gi,
oA = new RegExp(
"(?<=^|\\s)@?((naddr|npub|nevent|note)[a-z0-9]{20,})",
"g"
),
iA = /\`(.*?)\`/g,
sA = /\B\#([a-zA-Z0-9]+\b)(?!;)/g,
mm = (e, t, n = []) => {
let r = e.c;
const o = t.urlPrefixes,
s = t.profiles;
r = r.replace(nA, (f) =>
f.match(rA) ? `![image](${f})` : `[${f}](${f})`
);
const c = [...new Set(e.t)];
if (c.length > 0) {
const f = new RegExp(`(^|\\s)\\#(${c.join("|")})`, "gi");
r = r.replaceAll(f, `$1[#$2](${o.tag}$2)`);
}
return (
(r = r.replaceAll(oA, "nostr:$1")),
(r = C5(r, ({ decoded: f, value: d }) => {
switch (f.type) {
case "nprofile":
let h = s().find((A) => A.pk === f.data.pubkey);
return `[@${(h == null ? void 0 : h.n) || $o(d)}](${
o.nprofile
}${d})`;
case "npub":
let m = s().find((A) => A.pk === f.data);
return `[@${(m == null ? void 0 : m.n) || $o(d)}](${
o.npub
}${d})`;
case "note":
return `[@${$o(d)}](${o.note}${d})`;
case "naddr":
const P = f.data,
C = n.find(
(A) => A.pk === P.pubkey && A.d === P.identifier
);
return C && C.tl
? `[${C.tl}](${o.naddr}${d})`
: `[@${$o(d)}](${o.naddr}${d})`;
case "nevent":
return `[@${$o(d)}](${o.nevent}${d})`;
default:
return d;
}
})),
(r = r.replaceAll(iA, "<code>$1</code>")),
R5(r.trim())
);
},
aA = (e) => {
const t = [],
n = B5(e);
for (const s of n) {
if (
(s.decoded.type === "npub" && t.push(["p", s.decoded.data]),
s.decoded.type === "naddr")
) {
const c = s.decoded.data;
t.push([
"a",
`${c.kind}:${c.pubkey}:${c.identifier}`,
"",
"mention",
]);
}
s.decoded.type === "nevent" && t.push(["e", s.decoded.data.id]),
s.decoded.type === "note" && t.push(["e", s.decoded.data]);
}
const r = e.matchAll(sA),
o = new Set([...r].map((s) => s[1].toLowerCase()));
for (const s of o) t.push(["t", s]);
return t;
},
cA = (e = "") => {
const t = {
naddr: "https://nostr.com/",
npub: "https://nostr.com/",
nprofile: "https://nostr.com/",
nevent: "https://nostr.com/",
note: "https://nostr.com/",
tag: "https://snort.social/t/",
};
for (const n of e.split(",")) {
const [r, o] = n.split(":");
o && (t[r] = `https://${o}`);
}
return t;
},
$o = (e) => e.substring(0, 8) + "..." + e.substring(e.length - 4),
sa = (e) => e.sort((t, n) => ((t.ts || 0) >= (n.ts || 0) ? -1 : 1)),
yn = 20,
aa =
'data:image/svg+xml;utf-8,<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><circle cx="512" cy="512" r="512" fill="%23333" fill-rule="evenodd" /></svg>',
uA = (e) => {
const t = new Date(),
n = Math.floor((t.getTime() - e) / 1e3);
if (n < 60) return "now";
if (n < 3600) {
const r = Math.floor(n / 60);
return `${r} minute${r === 1 ? "" : "s"} ago`;
}
if (n <= 86400) {
const r = Math.floor(n / 3600);
return `${r} hour${r === 1 ? "" : "s"} ago`;
}
if (n <= 604800) {
const r = Math.floor(n / 86400);
return `${r} day${r === 1 ? "" : "s"} ago`;
}
if (n > 604800) {
const r = new Date(e),
o = r.toLocaleDateString("en-us", {
day: "numeric",
month: "long",
}),
s =
r.getFullYear() === t.getFullYear()
? ""
: " " + r.getFullYear();
return "on " + o + s;
}
return "";
},
lA = (e) =>
e < 1e4
? e.toString()
: e < 1e6
? Math.round(e / 1e3) + "k"
: Math.round(e / 1e6) + "M",
Jd = (e) => e.children.reduce((t, n) => t + Jd(n), e.children.length),
dA = /\/+$/,
fA = (e, t = !0) => {
const n = new URL(e);
return (
(n.hash = ""),
t && (n.pathname = n.pathname.replace(dA, "")),
n.toString()
);
},
bm = (e, t) => {
let n = e.map((o) => ({ ...o, children: [] }));
const r = new Set(
n.filter((o) => {
if (t) {
const s = t.id === (o.re || o.ro);
return s && (o.parent = t), s;
}
return !n.find((s) => s.id === (o.re || o.ro));
})
);
n = n.filter((o) => !r.has(o));
for (let o of r) o.children.push(...bm(n, o));
return [...r];
};
var Jo = Symbol("verified"),
hA = (e) => e instanceof Object;
function pA(e) {
if (
!hA(e) ||
typeof e.kind != "number" ||
typeof e.content != "string" ||
typeof e.created_at != "number" ||
typeof e.pubkey != "string" ||
!e.pubkey.match(/^[a-f0-9]{64}$/) ||
!Array.isArray(e.tags)
)
return !1;
for (let t = 0; t < e.tags.length; t++) {
let n = e.tags[t];
if (!Array.isArray(n)) return !1;
for (let r = 0; r < n.length; r++)
if (typeof n[r] == "object") return !1;
}
return !0;
}
new TextDecoder("utf-8");
var gA = new TextEncoder(),
wA = class {
generateSecretKey() {
return Mt.utils.randomPrivateKey();
}
getPublicKey(t) {
return Je(Mt.getPublicKey(t));
}
finalizeEvent(t, n) {
const r = t;
return (
(r.pubkey = Je(Mt.getPublicKey(n))),
(r.id = ts(r)),
(r.sig = Je(Mt.sign(ts(r), n))),
(r[Jo] = !0),
r
);
}
verifyEvent(t) {
if (typeof t[Jo] == "boolean") return t[Jo];
const n = ts(t);
if (n !== t.id) return (t[Jo] = !1), !1;
try {
const r = Mt.verify(t.sig, n, t.pubkey);
return (t[Jo] = r), r;
} catch {
return (t[Jo] = !1), !1;
}
}
};
function mA(e) {
if (!pA(e))
throw new Error(
"can't serialize event with wrong or missing properties"
);
return JSON.stringify([
0,
e.pubkey,
e.created_at,
e.kind,
e.tags,
e.content,
]);
}
function ts(e) {
let t = Kd(gA.encode(mA(e)));
return Je(t);
}
var $c = new wA(),
bA = $c.generateSecretKey,
ym = $c.getPublicKey,
vm = $c.finalizeEvent;
$c.verifyEvent;
var yA = (e) => {
Ei(() => {
const t = e();
t && setTimeout(() => t.focus());
});
},
Xo = Symbol("verified"),
vA = (e) => e instanceof Object;
function _A(e) {
if (
!vA(e) ||
typeof e.kind != "number" ||
typeof e.content != "string" ||
typeof e.created_at != "number" ||
typeof e.pubkey != "string" ||
!e.pubkey.match(/^[a-f0-9]{64}$/) ||
!Array.isArray(e.tags)
)
return !1;
for (let t = 0; t < e.tags.length; t++) {
let n = e.tags[t];
if (!Array.isArray(n)) return !1;
for (let r = 0; r < n.length; r++)
if (typeof n[r] == "object") return !1;
}
return !0;
}
new TextDecoder("utf-8");
var EA = new TextEncoder();
function kA(e) {
e.indexOf("://") === -1 && (e = "wss://" + e);
let t = new URL(e);
return (
(t.pathname = t.pathname.replace(/\/+/g, "/")),
t.pathname.endsWith("/") && (t.pathname = t.pathname.slice(0, -1)),
((t.port === "80" && t.protocol === "ws:") ||
(t.port === "443" && t.protocol === "wss:")) &&
(t.port = ""),
t.searchParams.sort(),
(t.hash = ""),
t.toString()
);
}
var AA = class {
constructor(e) {
pe(this, "value"),
pe(this, "next", null),
pe(this, "prev", null),
(this.value = e);
}
},
SA = class {
constructor() {
pe(this, "first"),
pe(this, "last"),
(this.first = null),
(this.last = null);
}
enqueue(e) {
const t = new AA(e);
return (
this.last
? this.last === this.first
? ((this.last = t),
(this.last.prev = this.first),
(this.first.next = t))
: ((t.prev = this.last),
(this.last.next = t),
(this.last = t))
: ((this.first = t), (this.last = t)),
!0
);
}
dequeue() {
if (!this.first) return null;
if (this.first === this.last) {
const t = this.first;
return (this.first = null), (this.last = null), t.value;
}
const e = this.first;
return (this.first = e.next), e.value;
}
},
$A = class {
generateSecretKey() {
return Mt.utils.randomPrivateKey();
}
getPublicKey(e) {
return Je(Mt.getPublicKey(e));
}
finalizeEvent(e, t) {
const n = e;
return (
(n.pubkey = Je(Mt.getPublicKey(t))),
(n.id = Xu(n)),
(n.sig = Je(Mt.sign(Xu(n), t))),
(n[Xo] = !0),
n
);
}
verifyEvent(e) {
if (typeof e[Xo] == "boolean") return e[Xo];
const t = Xu(e);
if (t !== e.id) return (e[Xo] = !1), !1;
try {
const n = Mt.verify(e.sig, t, e.pubkey);
return (e[Xo] = n), n;
} catch {
return (e[Xo] = !1), !1;
}
}
};
function xA(e) {
if (!_A(e))
throw new Error(
"can't serialize event with wrong or missing properties"
);
return JSON.stringify([
0,
e.pubkey,
e.created_at,
e.kind,
e.tags,
e.content,
]);
}
function Xu(e) {
let t = Kd(EA.encode(xA(e)));
return Je(t);
}
var xc = new $A();
xc.generateSecretKey;
xc.getPublicKey;
xc.finalizeEvent;
var TA = xc.verifyEvent,
PA = 22242;
function LA(e, t) {
if (
(e.ids &&
e.ids.indexOf(t.id) === -1 &&
!e.ids.some((n) => t.id.startsWith(n))) ||
(e.kinds && e.kinds.indexOf(t.kind) === -1) ||
(e.authors &&
e.authors.indexOf(t.pubkey) === -1 &&
!e.authors.some((n) => t.pubkey.startsWith(n)))
)
return !1;
for (let n in e)
if (n[0] === "#") {
let r = n.slice(1),
o = e[`#${r}`];
if (
o &&
!t.tags.find(([s, c]) => s === n.slice(1) && o.indexOf(c) !== -1)
)
return !1;
}
return !(
(e.since && t.created_at < e.since) ||
(e.until && t.created_at > e.until)
);
}
function BA(e, t) {
for (let n = 0; n < e.length; n++) if (LA(e[n], t)) return !0;
return !1;
}
function CA(e, t) {
let n = t.length + 3,
r = e.indexOf(`"${t}":`) + n,
o = e.slice(r).indexOf('"') + r + 1;
return e.slice(o, o + 64);
}
function IA(e) {
let t = e.slice(0, 22).indexOf('"EVENT"');
if (t === -1) return null;
let n = e.slice(t + 7 + 1).indexOf('"');
if (n === -1) return null;
let r = t + 7 + 1 + n,
o = e.slice(r + 1, 80).indexOf('"');
if (o === -1) return null;
let s = r + 1 + o;
return e.slice(r + 1, s);
}
function OA(e, t) {
return {
kind: PA,
created_at: Math.floor(Date.now() / 1e3),
tags: [
["relay", e],
["challenge", t],
],
content: "",
};
}
async function NA() {
return new Promise((e) => {
const t = new MessageChannel(),
n = () => {
t.port1.removeEventListener("message", n), e();
};
t.port1.addEventListener("message", n),
t.port2.postMessage(0),
t.port1.start();
});
}
var _m;
try {
_m = WebSocket;
} catch {}
var Em = class {
constructor(e, t) {
pe(this, "url"),
pe(this, "_connected", !1),
pe(this, "onclose", null),
pe(this, "onnotice", (n) =>
console.debug(`NOTICE from ${this.url}: ${n}`)
),
pe(this, "_onauth", null),
pe(this, "baseEoseTimeout", 4400),
pe(this, "connectionTimeout", 4400),
pe(this, "openSubs", new Map()),
pe(this, "connectionTimeoutHandle"),
pe(this, "connectionPromise"),
pe(this, "openCountRequests", new Map()),
pe(this, "openEventPublishes", new Map()),
pe(this, "ws"),
pe(this, "incomingMessageQueue", new SA()),
pe(this, "queueRunning", !1),
pe(this, "challenge"),
pe(this, "serial", 0),
pe(this, "verifyEvent"),
(this.url = kA(e)),
(this.verifyEvent = t.verifyEvent);
}
static async connect(e, t) {
const n = new Em(e, t);
return await n.connect(), n;
}
closeAllSubscriptions(e) {
for (let [t, n] of this.openSubs) n.close(e);
this.openSubs.clear();
for (let [t, n] of this.openEventPublishes) n.reject(new Error(e));
this.openEventPublishes.clear();
for (let [t, n] of this.openCountRequests) n.reject(new Error(e));
this.openCountRequests.clear();
}
get connected() {
return this._connected;
}
async connect() {
return this.connectionPromise
? this.connectionPromise
: ((this.challenge = void 0),
(this.connectionPromise = new Promise((e, t) => {
this.connectionTimeoutHandle = setTimeout(() => {
var n;
t("connection timed out"),
(this.connectionPromise = void 0),
(n = this.onclose) == null || n.call(this),
this.closeAllSubscriptions("relay connection timed out");
}, this.connectionTimeout);
try {
this.ws = new _m(this.url);
} catch (n) {
t(n);
return;
}
(this.ws.onopen = () => {
clearTimeout(this.connectionTimeoutHandle),
(this._connected = !0),
e();
}),
(this.ws.onerror = (n) => {
var r;
t(n.message),
this._connected &&
((this._connected = !1),
(this.connectionPromise = void 0),
(r = this.onclose) == null || r.call(this),
this.closeAllSubscriptions(
"relay connection errored"
));
}),
(this.ws.onclose = async () => {
var n;
this._connected &&
((this._connected = !1),
(this.connectionPromise = void 0),
(n = this.onclose) == null || n.call(this),
this.closeAllSubscriptions("relay connection closed"));
}),
(this.ws.onmessage = this._onmessage.bind(this));
})),
this.connectionPromise);
}
async runQueue() {
for (this.queueRunning = !0; this.handleNext() !== !1; ) await NA();
this.queueRunning = !1;
}
handleNext() {
var e, t, n;
const r = this.incomingMessageQueue.dequeue();
if (!r) return !1;
const o = IA(r);
if (o) {
const s = this.openSubs.get(o);
if (!s) return;
const c = CA(r, "id"),
f = (e = s.alreadyHaveEvent) == null ? void 0 : e.call(s, c);
if (((t = s.receivedEvent) == null || t.call(s, this, c), f))
return;
}
try {
let s = JSON.parse(r);
switch (s[0]) {
case "EVENT": {
const c = this.openSubs.get(s[1]),
f = s[2];
this.verifyEvent(f) && BA(c.filters, f) && c.onevent(f);
return;
}
case "COUNT": {
const c = s[1],
f = s[2],
d = this.openCountRequests.get(c);
d && (d.resolve(f.count), this.openCountRequests.delete(c));
return;
}
case "EOSE": {
const c = this.openSubs.get(s[1]);
if (!c) return;
c.receivedEose();
return;
}
case "OK": {
const c = s[1],
f = s[2],
d = s[3],
h = this.openEventPublishes.get(c);
f ? h.resolve(d) : h.reject(new Error(d)),
this.openEventPublishes.delete(c);
return;
}
case "CLOSED": {
const c = s[1],
f = this.openSubs.get(c);
if (!f) return;
(f.closed = !0), f.close(s[2]);
return;
}
case "NOTICE":
this.onnotice(s[1]);
return;
case "AUTH": {
(this.challenge = s[1]),
(n = this._onauth) == null || n.call(this, s[1]);
return;
}
}
} catch {
return;
}
}
async send(e) {
if (!this.connectionPromise)
throw new Error("sending on closed connection");
this.connectionPromise.then(() => {
var t;
(t = this.ws) == null || t.send(e);
});
}
async auth(e) {
if (!this.challenge)
throw new Error("can't perform auth, no challenge was received");
const t = await e(OA(this.url, this.challenge)),
n = new Promise((r, o) => {
this.openEventPublishes.set(t.id, { resolve: r, reject: o });
});
return this.send('["AUTH",' + JSON.stringify(t) + "]"), n;
}
async publish(e) {
const t = new Promise((n, r) => {
this.openEventPublishes.set(e.id, { resolve: n, reject: r });
});
return this.send('["EVENT",' + JSON.stringify(e) + "]"), t;
}
async count(e, t) {
this.serial++;
const n = (t == null ? void 0 : t.id) || "count:" + this.serial,
r = new Promise((o, s) => {
this.openCountRequests.set(n, { resolve: o, reject: s });
});
return (
this.send('["COUNT","' + n + '",' + JSON.stringify(e) + "]"), r
);
}
subscribe(e, t) {
const n = this.prepareSubscription(e, t);
return n.fire(), n;
}
prepareSubscription(e, t) {
this.serial++;
const n = t.id || "sub:" + this.serial,
r = new RA(this, n, e, t);
return this.openSubs.set(n, r), r;
}
close() {
var e;
this.closeAllSubscriptions("relay connection closed by us"),
(this._connected = !1),
(e = this.ws) == null || e.close();
}
_onmessage(e) {
this.incomingMessageQueue.enqueue(e.data),
this.queueRunning || this.runQueue();
}
},
RA = class {
constructor(e, t, n, r) {
pe(this, "relay"),
pe(this, "id"),
pe(this, "closed", !1),
pe(this, "eosed", !1),
pe(this, "filters"),
pe(this, "alreadyHaveEvent"),
pe(this, "receivedEvent"),
pe(this, "onevent"),
pe(this, "oneose"),
pe(this, "onclose"),
pe(this, "eoseTimeout"),
pe(this, "eoseTimeoutHandle"),
(this.relay = e),
(this.filters = n),
(this.id = t),
(this.alreadyHaveEvent = r.alreadyHaveEvent),
(this.receivedEvent = r.receivedEvent),
(this.eoseTimeout = r.eoseTimeout || e.baseEoseTimeout),
(this.oneose = r.oneose),
(this.onclose = r.onclose),
(this.onevent =
r.onevent ||
((o) => {
console.warn(
`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,
o
);
}));
}
fire() {
this.relay.send(
'["REQ","' +
this.id +
'",' +
JSON.stringify(this.filters).substring(1)
),
(this.eoseTimeoutHandle = setTimeout(
this.receivedEose.bind(this),
this.eoseTimeout
));
}
receivedEose() {
var e;
this.eosed ||
(clearTimeout(this.eoseTimeoutHandle),
(this.eosed = !0),
(e = this.oneose) == null || e.call(this));
}
close(e = "closed by caller") {
var t;
!this.closed &&
this.relay.connected &&
(this.relay.send('["CLOSE",' + JSON.stringify(this.id) + "]"),
(this.closed = !0)),
this.relay.openSubs.delete(this.id),
(t = this.onclose) == null || t.call(this, e);
}
},
km = class extends Em {
constructor(e) {
super(e, { verifyEvent: TA });
}
static async connect(e) {
const t = new km(e);
return await t.connect(), t;
}
};
new TextDecoder("utf-8");
new TextEncoder();
function zA(e) {
e.indexOf("://") === -1 && (e = "wss://" + e);
let t = new URL(e);
return (
(t.pathname = t.pathname.replace(/\/+/g, "/")),
t.pathname.endsWith("/") && (t.pathname = t.pathname.slice(0, -1)),
((t.port === "80" && t.protocol === "ws:") ||
(t.port === "443" && t.protocol === "wss:")) &&
(t.port = ""),
t.searchParams.sort(),
(t.hash = ""),
t.toString()
);
}
const UA = He("<div class=ztr-comment-info-picture><img>"),
MA = He(
"<div class=ztr-reply-form><textarea></textarea><div class=ztr-reply-controls>"
),
HA = He("<span>Publishing is disabled"),
jA = He("<span class=ztr-reply-error>Error: "),
DA = He(
'<svg class=ztr-spinner viewBox="0 0 50 50"><circle class=path cx=25 cy=25 r=20 fill=none stroke-width=5>'
),
qA = He("<button class=ztr-reply-button>Reply as "),
VA = He("<button class=ztr-reply-button>Reply anonymously"),
FA = He("<button class=ztr-reply-login-button>Log in"),
KA = He("<li class=ztr-comment-action-like><span> likes"),
WA = He("<li class=ztr-comment-action-zap><span> sats"),
GA = He(
"<div class=ztr-comment-new><div class=ztr-comment-body><ul class=ztr-comment-actions>"
),
Am = (e) => {
const [t, n] = dt(""),
[r, o] = dt(!1),
[s, c] = dt(),
[f, d] = dt(""),
h = () => me.anchor,
y = me.profiles,
m = () => me.relays,
v = async () => {
if (!window.nostr) {
C("Error: No NIP-07 extension!");
return;
}
const T = await window.nostr.getPublicKey();
(Ut.internal = {
pk: T,
signEvent: async (N) => window.nostr.signEvent(N),
}),
d(""),
(Ut.active = Ut.internal);
};
Ei(async () => {
if (Ut.active) {
const T = Ut.active.pk;
let N = y().find((l) => l.pk === T);
N || ((N = { pk: T, l: 0, ts: 0 }), await un("profiles", N)),
c(N),
wm([T], m(), y());
} else c();
});
const P = async (T, N) => {
var l;
o(!1),
n(""),
d(N ?? ""),
await un("events", Na(T), { immediate: !0 }),
(l = e.onDone) == null || l.call(globalThis);
},
C = (T) => {
o(!1), d(`Error: ${T}`);
},
A = async (T) => {
let N;
if (T) N = Ut.active;
else {
if (!Ut.anonymous) {
const R = bA();
Ut.anonymous = {
pk: ym(R),
signEvent: async (L) => ({ sig: vm(L, R).sig }),
};
}
N = Ut.anonymous;
}
if (!(N != null && N.signEvent)) {
C("Error: User has no signer!");
return;
}
const l = t().trim();
if (!l) return;
const w = {
kind: 1,
created_at: Math.round(Date.now() / 1e3),
content: l,
pubkey: N.pk,
tags: aA(l),
};
if (
(me.anchorAuthor !== w.pubkey &&
w.tags.push(["p", me.anchorAuthor]),
me.externalAuthor)
)
try {
const R = ia(me.externalAuthor).data;
w.tags.push(["p", R]);
} catch {}
if (e.replyTo) {
const R = await hi("events", IDBKeyRange.only(e.replyTo));
R &&
(w.tags.push(["e", R.ro, "", "root"]),
R.pk !== w.pubkey && w.tags.push(["p", R.pk])),
w.tags.push(["e", e.replyTo, "", "reply"]);
} else {
const R = me.version || me.rootEventIds[0];
if (R) w.tags.push(["e", R, "", "root"]);
else if (h().type === "http") {
const L = zA(h().value),
E = {
pubkey: N.pk,
created_at: Math.round(Date.now() / 1e3),
kind: 8812,
tags: [["r", L]],
content: `Comments on ${L}`,
},
x = { id: ts(E), ...E, ...(await N.signEvent(E)) };
un("events", Na(x)),
me.disableFeatures.includes("publish")
? console.log("Publishing root event disabled", x)
: di.publish(m(), x),
(me.filter = { "#e": [x.id] }),
w.tags.push(["e", x.id, "", "root"]);
}
}
h().type === "naddr" && w.tags.push(["a", h().value, "", "root"]);
const p = ts(w),
_ = await N.signEvent(w),
$ = { id: p, ...w, ..._ };
if (
(o(!0),
console.log(JSON.stringify($, null, 2)),
me.disableFeatures.includes("publish"))
)
setTimeout(() => P($), 1e3);
else {
const R = [];
for (const L of m())
try {
await (await km.connect(L)).publish($);
} catch (E) {
console.error(E), R.push(L);
}
if (R.length === m().length)
C("Error: Your comment was not published to any relay");
else {
const L = `Published to ${R.length}/${
m().length
} relays (see console for more info)`,
E = R.length > 0 ? L : void 0;
P($, E);
}
R.length = 0;
}
},
O = e.replyTo !== void 0;
let M;
return (
yA(() => O && M),
(() => {
const T = MA(),
N = T.firstChild,
l = N.nextSibling;
N.addEventListener("change", (p) => n(p.target.value));
const w = M;
return (
typeof w == "function" ? kw(w, N) : (M = N),
(N.autofocus = O),
xe(
l,
(() => {
const p = De(
() => !!me.disableFeatures.includes("publish")
);
return () => p() && HA();
})(),
null
),
xe(
l,
(() => {
const p = De(() => !!f());
return () =>
p() &&
(() => {
const _ = jA();
return _.firstChild, xe(_, f, null), _;
})();
})(),
null
),
xe(
l,
mn(Ta, {
get when() {
return !r();
},
get fallback() {
return DA();
},
get children() {
const p = UA(),
_ = p.firstChild;
return (
cn(() => {
var $;
return Bt(
_,
"src",
(($ = s()) == null ? void 0 : $.i) || aa
);
}),
p
);
},
}),
null
),
xe(
l,
(() => {
const p = De(() => !!s());
return () =>
p() &&
(() => {
const _ = qA();
return (
_.firstChild,
(_.$$click = () => A(s())),
xe(_, () => s().n || $o(cm(s().pk)), null),
cn(() => (_.disabled = r())),
_
);
})();
})(),
null
),
xe(
l,
(() => {
const p = De(
() =>
!s() && !me.disableFeatures.includes("replyAnonymously")
);
return () =>
p() &&
(() => {
const _ = VA();
return (
(_.$$click = () => A()),
cn(() => (_.disabled = r())),
_
);
})();
})(),
null
),
xe(
l,
(() => {
const p = De(() => !s());
return () =>
p() &&
(() => {
const _ = FA();
return (_.$$click = () => v()), _;
})();
})(),
null
),
cn(
(p) => {
const _ = r(),
$ = me.replyPlaceholder || "Add your comment...";
return (
_ !== p._v$ && (N.disabled = p._v$ = _),
$ !== p._v$2 && Bt(N, "placeholder", (p._v$2 = $)),
p
);
},
{ _v$: void 0, _v$2: void 0 }
),
cn(() => (N.value = t())),
T
);
})()
);
},
ZA = () => {
const e = () => me.anchor,
t = Jp(() => ["aggregates", IDBKeyRange.only([e().value, 9735])]),
n = Jp(() => ["aggregates", IDBKeyRange.only([e().value, 7])]),
r = () => {
var s;
return ((s = t()) == null ? void 0 : s.sum) ?? 0;
},
o = () => {
var s;
return ((s = n()) == null ? void 0 : s.ids.length) ?? 0;
};
return (() => {
const s = GA(),
c = s.firstChild,
f = c.firstChild;
return (
xe(
f,
mn(Ta, {
get when() {
return !me.disableFeatures.includes("likes");
},
get children() {
const d = KA(),
h = d.firstChild,
y = h.firstChild;
return xe(d, _S, h), xe(h, o, y), d;
},
}),
null
),
xe(
f,
mn(Ta, {
get when() {
return !me.disableFeatures.includes("zaps");
},
get children() {
const d = WA(),
h = d.firstChild,
y = h.firstChild;
return xe(d, vS, h), xe(h, () => lA(r()), y), d;
},
}),
null
),
xe(c, mn(Am, {}), null),
s
);
})();
};
zd(["click"]);
function YA(e) {
return e !== null && (typeof e == "object" || typeof e == "function");
}
function Qp(e, ...t) {
return typeof e == "function" ? e(...t) : e;
}
function JA(e) {
const t = { ...e },
n = { ...e },
r = {},
o = (c) => {
let f = r[c];
if (!f) {
if (!ki()) return t[c];
(r[c] = f = dt(t[c], { internal: !0 })), delete t[c];
}
return f[0]();
};
for (const c in e)
Object.defineProperty(n, c, { get: () => o(c), enumerable: !0 });
const s = (c, f) => {
const d = r[c];
if (d) return d[1](f);
c in t && (t[c] = Qp(f, [t[c]]));
};
return [
n,
(c, f) => {
if (YA(c)) {
const d = bn(() => Object.entries(Qp(c, n)));
ui(() => {
for (const [h, y] of d) s(h, () => y);
});
} else s(c, f);
return n;
},
];
}
var Sm = { width: null, height: null };
function Qu(e) {
if (!e) return { ...Sm };
const { width: t, height: n } = e.getBoundingClientRect();
return { width: t, height: n };
}
function XA(e) {
const t = typeof e == "function",
[n, r] = JA(t ? Sm : Qu(e)),
o = new ResizeObserver(([s]) => r(Qu(s.target)));
return (
li(() => o.disconnect()),
t
? Ei(() => {
const s = e();
s && (r(Qu(s)), o.observe(s), li(() => o.unobserve(s)));
})
: (o.observe(e), li(() => o.unobserve(e))),
n
);
}
const QA = He("<div class=ztr-thread>"),
eS = He("<li class=ztr-comment-action-reply><span>"),
tS = He(
"<div class=ztr-comment><div class=ztr-comment-body><div class=ztr-comment-info-wrapper><div class=ztr-comment-info><div class=ztr-comment-info-picture><img></div><ul class=ztr-comment-info-items><li class=ztr-comment-info-author><a target=_blank></a><span style=white-space:nowrap;><strong> <!>ed</strong> </span></li><li><a class=ztr-comment-info-dots></a></li></ul></div><ul class=ztr-comment-info-items></ul></div><div class=ztr-comment-text></div><div class=ztr-comment-text></div><ul class=ztr-comment-actions>"
),
nS = He("<li>●"),
rS = He("<li> repl"),
oS = He("<li><span>"),
iS = He("<div class=ztr-info-pane><a target=_blank><small>Event data"),
sS = He(
"<p class=warning><span>This is a <!> that referenced this article in <a>another thread"
),
aS = He(
"<p class=warning><span>Article contents may have changed since this <!> was made"
),
cS = He(
"<p class=warning><span>Article contents changed since this <!> was made"
),
uS = He("<div class=ztr-comment-expand><a></a><span>Show full comment"),
lS = He("<div class=ztr-comment-replies>"),
dS = He(
'<svg viewBox="0 -6 60 60"xmlns=http://www.w3.org/2000/svg><path d="M 12.6030 50.4905 C 13.3758 50.4905 13.9307 50.1140 14.8621 49.2421 L 20.6483 43.8720 C 19.5188 42.9803 18.6073 41.5733 18.6073 38.3433 L 18.6073 25.2052 C 18.6073 19.1217 22.3129 15.5152 28.3766 15.5152 L 42.2479 15.5152 L 42.2281 14.7622 C 41.9306 10.6999 39.2557 8.0643 34.7177 8.0643 L 7.5301 8.0643 C 2.9922 8.0643 0 10.7791 0 15.4954 L 0 34.9548 C 0 39.6710 2.9922 42.7028 7.5301 42.7028 L 10.8195 42.7028 L 10.8195 48.4693 C 10.8195 49.6979 11.4735 50.4905 12.6030 50.4905 Z M 44.6058 53.2450 C 45.7353 53.2450 46.3895 52.4325 46.3895 51.2237 L 46.3895 45.4374 L 48.4702 45.4374 C 53.0078 45.4374 56 42.4056 56 37.7092 L 56 25.6610 C 56 20.9250 53.0078 18.2300 48.4702 18.2300 L 28.8522 18.2300 C 24.1161 18.2300 21.3221 20.9250 21.3221 25.6610 L 21.3221 37.7092 C 21.3221 42.4056 24.1161 45.4374 28.8522 45.4374 L 35.1735 45.4374 L 42.3470 51.9767 C 43.2784 52.8487 43.8331 53.2450 44.6058 53.2450 Z">'
),
fS = He(
'<svg xmlns=http://www.w3.org/2000/svg viewBox="-120 -80 528 588"><path d="M349.4 44.6c5.9-13.7 1.5-29.7-10.6-38.5s-28.6-8-39.9 1.8l-256 224c-10 8.8-13.6 22.9-8.9 35.3S50.7 288 64 288H175.5L98.6 467.4c-5.9 13.7-1.5 29.7 10.6 38.5s28.6 8 39.9-1.8l256-224c10-8.8 13.6-22.9 8.9-35.3s-16.6-20.7-30-20.7H272.5L349.4 44.6z">'
),
hS = He(
'<svg viewBox="0 -16 180 180"xmlns=http://www.w3.org/2000/svg><path d="M60.732 29.7C41.107 29.7 22 39.7 22 67.41c0 27.29 45.274 67.29 74 94.89 28.744-27.6 74-67.6 74-94.89 0-27.71-19.092-37.71-38.695-37.71C116 29.7 104.325 41.575 96 54.066 87.638 41.516 76 29.7 60.732 29.7z">'
),
pS = He(
'<svg viewBox="0 0 576 512"><path d="M168 80c-13.3 0-24 10.7-24 24V408c0 8.4-1.4 16.5-4.1 24H440c13.3 0 24-10.7 24-24V104c0-13.3-10.7-24-24-24H168zM72 480c-39.8 0-72-32.2-72-72V112C0 98.7 10.7 88 24 88s24 10.7 24 24V408c0 13.3 10.7 24 24 24s24-10.7 24-24V104c0-39.8 32.2-72 72-72H440c39.8 0 72 32.2 72 72V408c0 39.8-32.2 72-72 72H72zM176 136c0-13.3 10.7-24 24-24h96c13.3 0 24 10.7 24 24v80c0 13.3-10.7 24-24 24H200c-13.3 0-24-10.7-24-24V136zm200-24h32c13.3 0 24 10.7 24 24s-10.7 24-24 24H376c-13.3 0-24-10.7-24-24s10.7-24 24-24zm0 80h32c13.3 0 24 10.7 24 24s-10.7 24-24 24H376c-13.3 0-24-10.7-24-24s10.7-24 24-24zM200 272H408c13.3 0 24 10.7 24 24s-10.7 24-24 24H200c-13.3 0-24-10.7-24-24s10.7-24 24-24zm0 80H408c13.3 0 24 10.7 24 24s-10.7 24-24 24H200c-13.3 0-24-10.7-24-24s10.7-24 24-24z">'
),
gS = He(
'<svg xmlns=http://www.w3.org/2000/svg viewBox="0 -200 560 640"><path d="M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z">'
),
wS = He(
'<svg xmlns=http://www.w3.org/2000/svg viewBox="0 -50 256 512"><path d="M246.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-128-128c-9.2-9.2-22.9-11.9-34.9-6.9s-19.8 16.6-19.8 29.6l0 256c0 12.9 7.8 24.6 19.8 29.6s25.7 2.2 34.9-6.9l128-128z">'
),
mS = He(
'<svg xmlns=http://www.w3.org/2000/svg viewBox="0 -50 320 512"><path d="M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z">'
),
bS = He(
'<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 512 512"><path d="M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z">'
),
$m = (e) => {
const t = () => me.anchor,
n = me.profiles;
return (() => {
const r = QA();
return (
xe(
r,
mn(y6, {
get each() {
return sa(e.nestedEvents());
},
children: (o) => {
const [s, c] = dt(!1),
[f, d] = dt(!1),
[h, y] = dt(!1),
[m, v] = dt(!1),
P = 500,
[C, A] = dt(),
O = XA(C),
[M, T] = dt(aa),
N = () => o().pk,
l = () => cm(N()),
w = () => n().find((S) => S.pk === N());
Ei(async () => {
var S;
T(((S = w()) == null ? void 0 : S.i) || aa);
});
let p;
const _ = () => uA(o().ts * 1e3),
[$, R] = dt();
Ei(() => {
R(_()),
(p = setInterval(() => {
R(_());
}, 60 * 1e3));
});
const L = () => o().a === t().value && o().am,
E = () =>
o().k === 9802
? "highlight"
: L()
? "mention"
: "comment",
x = De(() => Jd(o())),
z = () => !o().parent && !o().ro,
q = () =>
!o().parent &&
o().ro &&
!me.rootEventIds.includes(o().ro),
I = () =>
!o().parent &&
o().ro &&
me.rootEventIds.includes(o().ro) &&
me.version &&
me.version !== o().ro;
return (
li(() => clearInterval(p)),
(() => {
const S = tS(),
D = S.firstChild,
K = D.firstChild,
W = K.firstChild,
Z = W.firstChild,
G = Z.firstChild,
oe = Z.nextSibling,
he = oe.firstChild,
be = he.firstChild,
Se = be.nextSibling,
re = Se.firstChild,
ye = re.firstChild,
Ce = ye.nextSibling;
Ce.nextSibling, re.nextSibling;
const Oe = he.nextSibling,
Me = Oe.firstChild,
pt = W.nextSibling,
Ke = K.nextSibling,
se = Ke.nextSibling,
Re = se.nextSibling;
return (
G.addEventListener("error", () => T(aa)),
xe(be, () => {
var Te;
return (
((Te = w()) == null ? void 0 : Te.n) || $o(l())
);
}),
xe(re, E, Ce),
xe(Se, $, null),
xe(
oe,
(() => {
const Te = De(() => x() > 0 && O.width > 600);
return () =>
Te() && [
nS(),
(() => {
const Pe = rS(),
je = Pe.firstChild;
return (
xe(Pe, x, je),
xe(
Pe,
() => (x() > 1 ? "ies" : "y"),
null
),
xe(
Pe,
() => (h() ? " (hidden)" : ""),
null
),
Pe
);
})(),
];
})(),
Oe
),
(Me.$$click = () => v(!m())),
xe(Me, xm),
xe(
pt,
(() => {
const Te = De(() => x() > 0);
return () =>
Te() &&
(() => {
const Pe = oS(),
je = Pe.firstChild;
return (
(je.$$click = () => y(!h())),
xe(
je,
(() => {
const yt = De(() => !!h());
return () => (yt() ? kS() : AS());
})()
),
Pe
);
})();
})()
),
xe(
D,
(() => {
const Te = De(() => !!m());
return () =>
Te() &&
(() => {
const Pe = iS(),
je = Pe.firstChild;
return (
cn(() =>
Bt(
je,
"href",
me.urlPrefixes.note + Fp(o().id)
)
),
Pe
);
})();
})(),
Ke
),
xe(
Ke,
(() => {
const Te = De(() => !!q());
return () =>
Te() &&
(() => {
const Pe = sS(),
je = Pe.firstChild,
yt = je.firstChild,
Nt = yt.nextSibling,
St = Nt.nextSibling,
Yt = St.nextSibling;
return (
xe(Pe, el, je),
xe(je, E, Nt),
cn(() =>
Bt(
Yt,
"href",
me.urlPrefixes.note + Fp(o().ro)
)
),
Pe
);
})();
})(),
null
),
xe(
Ke,
(() => {
const Te = De(() => !!z());
return () =>
Te() &&
(() => {
const Pe = aS(),
je = Pe.firstChild,
yt = je.firstChild,
Nt = yt.nextSibling;
return (
Nt.nextSibling,
xe(Pe, el, je),
xe(je, E, Nt),
Pe
);
})();
})(),
null
),
xe(
Ke,
(() => {
const Te = De(() => !!I());
return () =>
Te() &&
(() => {
const Pe = cS(),
je = Pe.firstChild,
yt = je.firstChild,
Nt = yt.nextSibling;
return (
Nt.nextSibling,
xe(Pe, el, je),
xe(je, E, Nt),
Pe
);
})();
})(),
null
),
kw(A, se),
xe(
D,
(() => {
const Te = De(
() => !!(O.height && O.height >= P && !f())
);
return () =>
Te() &&
(() => {
const Pe = uS(),
je = Pe.firstChild,
yt = je.nextSibling;
return (
`${yn}px` != null
? je.style.setProperty(
"height",
`${yn}px`
)
: je.style.removeProperty("height"),
xe(je, ES),
(yt.$$click = () => d(!0)),
Pe
);
})();
})(),
Re
),
xe(
Re,
mn(Ta, {
get when() {
return !me.disableFeatures.includes("reply");
},
get children() {
const Te = eS(),
Pe = Te.firstChild;
return (
(Te.$$click = () => c(!s()) && v(!1)),
xe(Te, yS, Pe),
xe(Pe, () => (s() ? "Cancel" : "Reply")),
Te
);
},
})
),
xe(
D,
(() => {
const Te = De(() => !!s());
return () =>
Te() &&
mn(Am, {
get replyTo() {
return o().id;
},
onDone: () => c(!1),
});
})(),
null
),
xe(
S,
(() => {
const Te = De(() => !h());
return () =>
Te() &&
(() => {
const Pe = lS();
return (
xe(
Pe,
mn($m, {
nestedEvents: () => o().children,
get articles() {
return e.articles;
},
})
),
Pe
);
})();
})(),
null
),
cn(
(Te) => {
const Pe = M(),
je = me.urlPrefixes.npub + l(),
yt = o().k == 9802,
Nt = f() ? {} : { "max-height": `${P}px` },
St = mm(o(), me, e.articles());
return (
Pe !== Te._v$ && Bt(G, "src", (Te._v$ = Pe)),
je !== Te._v$2 &&
Bt(be, "href", (Te._v$2 = je)),
yt !== Te._v$3 &&
se.classList.toggle(
"highlight",
(Te._v$3 = yt)
),
(Te._v$4 = E6(se, Nt, Te._v$4)),
St !== Te._v$5 && (se.innerHTML = Te._v$5 = St),
Te
);
},
{
_v$: void 0,
_v$2: void 0,
_v$3: void 0,
_v$4: void 0,
_v$5: void 0,
}
),
S
);
})()
);
},
})
),
r
);
})();
},
yS = () =>
(() => {
const e = dS();
return Bt(e, "width", yn), Bt(e, "height", yn), e;
})(),
vS = () =>
(() => {
const e = fS();
return Bt(e, "width", yn), Bt(e, "height", yn), e;
})(),
_S = () =>
(() => {
const e = hS();
return Bt(e, "width", yn), Bt(e, "height", yn), e;
})(),
ES = () =>
(() => {
const e = pS();
return Bt(e, "width", yn), Bt(e, "height", yn), e;
})(),
xm = () => gS(),
kS = () => wS(),
AS = () => mS(),
el = () =>
(() => {
const e = bS();
return Bt(e, "height", yn), e;
})();
zd(["click"]);
var Tm = {};
(function (e) {
/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */ Object.defineProperty(
e,
"__esModule",
{ value: !0 }
),
(e.bytes =
e.stringToBytes =
e.str =
e.bytesToString =
e.hex =
e.utf8 =
e.bech32m =
e.bech32 =
e.base58check =
e.base58xmr =
e.base58xrp =
e.base58flickr =
e.base58 =
e.base64url =
e.base64 =
e.base32crockford =
e.base32hex =
e.base32 =
e.base16 =
e.utils =
e.assertNumber =
void 0);
function t(E) {
if (!Number.isSafeInteger(E)) throw new Error(`Wrong integer: ${E}`);
}
e.assertNumber = t;
function n(...E) {
const x = (I, S) => (D) => I(S(D)),
z = Array.from(E)
.reverse()
.reduce((I, S) => (I ? x(I, S.encode) : S.encode), void 0),
q = E.reduce((I, S) => (I ? x(I, S.decode) : S.decode), void 0);
return { encode: z, decode: q };
}
function r(E) {
return {
encode: (x) => {
if (!Array.isArray(x) || (x.length && typeof x[0] != "number"))
throw new Error(
"alphabet.encode input should be an array of numbers"
);
return x.map((z) => {
if ((t(z), z < 0 || z >= E.length))
throw new Error(
`Digit index outside alphabet: ${z} (alphabet: ${E.length})`
);
return E[z];
});
},
decode: (x) => {
if (!Array.isArray(x) || (x.length && typeof x[0] != "string"))
throw new Error(
"alphabet.decode input should be array of strings"
);
return x.map((z) => {
if (typeof z != "string")
throw new Error(`alphabet.decode: not string element=${z}`);
const q = E.indexOf(z);
if (q === -1)
throw new Error(`Unknown letter: "${z}". Allowed: ${E}`);
return q;
});
},
};
}
function o(E = "") {
if (typeof E != "string")
throw new Error("join separator should be string");
return {
encode: (x) => {
if (!Array.isArray(x) || (x.length && typeof x[0] != "string"))
throw new Error("join.encode input should be array of strings");
for (let z of x)
if (typeof z != "string")
throw new Error(`join.encode: non-string input=${z}`);
return x.join(E);
},
decode: (x) => {
if (typeof x != "string")
throw new Error("join.decode input should be string");
return x.split(E);
},
};
}
function s(E, x = "=") {
if ((t(E), typeof x != "string"))
throw new Error("padding chr should be string");
return {
encode(z) {
if (!Array.isArray(z) || (z.length && typeof z[0] != "string"))
throw new Error(
"padding.encode input should be array of strings"
);
for (let q of z)
if (typeof q != "string")
throw new Error(`padding.encode: non-string input=${q}`);
for (; (z.length * E) % 8; ) z.push(x);
return z;
},
decode(z) {
if (!Array.isArray(z) || (z.length && typeof z[0] != "string"))
throw new Error(
"padding.encode input should be array of strings"
);
for (let I of z)
if (typeof I != "string")
throw new Error(`padding.decode: non-string input=${I}`);
let q = z.length;
if ((q * E) % 8)
throw new Error(
"Invalid padding: string should have whole number of bytes"
);
for (; q > 0 && z[q - 1] === x; q--)
if (!(((q - 1) * E) % 8))
throw new Error(
"Invalid padding: string has too much padding"
);
return z.slice(0, q);
},
};
}
function c(E) {
if (typeof E != "function")
throw new Error("normalize fn should be function");
return { encode: (x) => x, decode: (x) => E(x) };
}
function f(E, x, z) {
if (x < 2)
throw new Error(
`convertRadix: wrong from=${x}, base cannot be less than 2`
);
if (z < 2)
throw new Error(
`convertRadix: wrong to=${z}, base cannot be less than 2`
);
if (!Array.isArray(E))
throw new Error("convertRadix: data should be array");
if (!E.length) return [];
let q = 0;
const I = [],
S = Array.from(E);
for (
S.forEach((D) => {
if ((t(D), D < 0 || D >= x))
throw new Error(`Wrong integer: ${D}`);
});
;
) {
let D = 0,
K = !0;
for (let W = q; W < S.length; W++) {
const Z = S[W],
G = x * D + Z;
if (
!Number.isSafeInteger(G) ||
(x * D) / x !== D ||
G - Z !== x * D
)
throw new Error("convertRadix: carry overflow");
if (
((D = G % z),
(S[W] = Math.floor(G / z)),
!Number.isSafeInteger(S[W]) || S[W] * z + D !== G)
)
throw new Error("convertRadix: carry overflow");
if (K) S[W] ? (K = !1) : (q = W);
else continue;
}
if ((I.push(D), K)) break;
}
for (let D = 0; D < E.length - 1 && E[D] === 0; D++) I.push(0);
return I.reverse();
}
const d = (E, x) => (x ? d(x, E % x) : E),
h = (E, x) => E + (x - d(E, x));
function y(E, x, z, q) {
if (!Array.isArray(E))
throw new Error("convertRadix2: data should be array");
if (x <= 0 || x > 32)
throw new Error(`convertRadix2: wrong from=${x}`);
if (z <= 0 || z > 32) throw new Error(`convertRadix2: wrong to=${z}`);
if (h(x, z) > 32)
throw new Error(
`convertRadix2: carry overflow from=${x} to=${z} carryBits=${h(
x,
z
)}`
);
let I = 0,
S = 0;
const D = 2 ** z - 1,
K = [];
for (const W of E) {
if ((t(W), W >= 2 ** x))
throw new Error(
`convertRadix2: invalid data word=${W} from=${x}`
);
if (((I = (I << x) | W), S + x > 32))
throw new Error(
`convertRadix2: carry overflow pos=${S} from=${x}`
);
for (S += x; S >= z; S -= z) K.push(((I >> (S - z)) & D) >>> 0);
I &= 2 ** S - 1;
}
if (((I = (I << (z - S)) & D), !q && S >= x))
throw new Error("Excess padding");
if (!q && I) throw new Error(`Non-zero padding: ${I}`);
return q && S > 0 && K.push(I >>> 0), K;
}
function m(E) {
return (
t(E),
{
encode: (x) => {
if (!(x instanceof Uint8Array))
throw new Error("radix.encode input should be Uint8Array");
return f(Array.from(x), 2 ** 8, E);
},
decode: (x) => {
if (!Array.isArray(x) || (x.length && typeof x[0] != "number"))
throw new Error(
"radix.decode input should be array of strings"
);
return Uint8Array.from(f(x, E, 2 ** 8));
},
}
);
}
function v(E, x = !1) {
if ((t(E), E <= 0 || E > 32))
throw new Error("radix2: bits should be in (0..32]");
if (h(8, E) > 32 || h(E, 8) > 32)
throw new Error("radix2: carry overflow");
return {
encode: (z) => {
if (!(z instanceof Uint8Array))
throw new Error("radix2.encode input should be Uint8Array");
return y(Array.from(z), 8, E, !x);
},
decode: (z) => {
if (!Array.isArray(z) || (z.length && typeof z[0] != "number"))
throw new Error(
"radix2.decode input should be array of strings"
);
return Uint8Array.from(y(z, E, 8, x));
},
};
}
function P(E) {
if (typeof E != "function")
throw new Error("unsafeWrapper fn should be function");
return function (...x) {
try {
return E.apply(null, x);
} catch {}
};
}
function C(E, x) {
if ((t(E), typeof x != "function"))
throw new Error("checksum fn should be function");
return {
encode(z) {
if (!(z instanceof Uint8Array))
throw new Error("checksum.encode: input should be Uint8Array");
const q = x(z).slice(0, E),
I = new Uint8Array(z.length + E);
return I.set(z), I.set(q, z.length), I;
},
decode(z) {
if (!(z instanceof Uint8Array))
throw new Error("checksum.decode: input should be Uint8Array");
const q = z.slice(0, -E),
I = x(q).slice(0, E),
S = z.slice(-E);
for (let D = 0; D < E; D++)
if (I[D] !== S[D]) throw new Error("Invalid checksum");
return q;
},
};
}
(e.utils = {
alphabet: r,
chain: n,
checksum: C,
radix: m,
radix2: v,
join: o,
padding: s,
}),
(e.base16 = n(v(4), r("0123456789ABCDEF"), o(""))),
(e.base32 = n(
v(5),
r("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),
s(5),
o("")
)),
(e.base32hex = n(
v(5),
r("0123456789ABCDEFGHIJKLMNOPQRSTUV"),
s(5),
o("")
)),
(e.base32crockford = n(
v(5),
r("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),
o(""),
c((E) => E.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1"))
)),
(e.base64 = n(
v(6),
r(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
),
s(6),
o("")
)),
(e.base64url = n(
v(6),
r(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
),
s(6),
o("")
));
const A = (E) => n(m(58), r(E), o(""));
(e.base58 = A(
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
)),
(e.base58flickr = A(
"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
)),
(e.base58xrp = A(
"rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"
));
const O = [0, 2, 3, 5, 6, 7, 9, 10, 11];
e.base58xmr = {
encode(E) {
let x = "";
for (let z = 0; z < E.length; z += 8) {
const q = E.subarray(z, z + 8);
x += e.base58.encode(q).padStart(O[q.length], "1");
}
return x;
},
decode(E) {
let x = [];
for (let z = 0; z < E.length; z += 11) {
const q = E.slice(z, z + 11),
I = O.indexOf(q.length),
S = e.base58.decode(q);
for (let D = 0; D < S.length - I; D++)
if (S[D] !== 0) throw new Error("base58xmr: wrong padding");
x = x.concat(Array.from(S.slice(S.length - I)));
}
return Uint8Array.from(x);
},
};
const M = (E) =>
n(
C(4, (x) => E(E(x))),
e.base58
);
e.base58check = M;
const T = n(r("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), o("")),
N = [996825010, 642813549, 513874426, 1027748829, 705979059];
function l(E) {
const x = E >> 25;
let z = (E & 33554431) << 5;
for (let q = 0; q < N.length; q++)
((x >> q) & 1) === 1 && (z ^= N[q]);
return z;
}
function w(E, x, z = 1) {
const q = E.length;
let I = 1;
for (let S = 0; S < q; S++) {
const D = E.charCodeAt(S);
if (D < 33 || D > 126) throw new Error(`Invalid prefix (${E})`);
I = l(I) ^ (D >> 5);
}
I = l(I);
for (let S = 0; S < q; S++) I = l(I) ^ (E.charCodeAt(S) & 31);
for (let S of x) I = l(I) ^ S;
for (let S = 0; S < 6; S++) I = l(I);
return (I ^= z), T.encode(y([I % 2 ** 30], 30, 5, !1));
}
function p(E) {
const x = E === "bech32" ? 1 : 734539939,
z = v(5),
q = z.decode,
I = z.encode,
S = P(q);
function D(G, oe, he = 90) {
if (typeof G != "string")
throw new Error(
`bech32.encode prefix should be string, not ${typeof G}`
);
if (!Array.isArray(oe) || (oe.length && typeof oe[0] != "number"))
throw new Error(
`bech32.encode words should be array of numbers, not ${typeof oe}`
);
const be = G.length + 7 + oe.length;
if (he !== !1 && be > he)
throw new TypeError(`Length ${be} exceeds limit ${he}`);
return (G = G.toLowerCase()), `${G}1${T.encode(oe)}${w(G, oe, x)}`;
}
function K(G, oe = 90) {
if (typeof G != "string")
throw new Error(
`bech32.decode input should be string, not ${typeof G}`
);
if (G.length < 8 || (oe !== !1 && G.length > oe))
throw new TypeError(
`Wrong string length: ${G.length} (${G}). Expected (8..${oe})`
);
const he = G.toLowerCase();
if (G !== he && G !== G.toUpperCase())
throw new Error("String must be lowercase or uppercase");
G = he;
const be = G.lastIndexOf("1");
if (be === 0 || be === -1)
throw new Error(
'Letter "1" must be present between prefix and data only'
);
const Se = G.slice(0, be),
re = G.slice(be + 1);
if (re.length < 6)
throw new Error("Data must be at least 6 characters long");
const ye = T.decode(re).slice(0, -6),
Ce = w(Se, ye, x);
if (!re.endsWith(Ce))
throw new Error(`Invalid checksum in ${G}: expected "${Ce}"`);
return { prefix: Se, words: ye };
}
const W = P(K);
function Z(G) {
const { prefix: oe, words: he } = K(G, !1);
return { prefix: oe, words: he, bytes: q(he) };
}
return {
encode: D,
decode: K,
decodeToBytes: Z,
decodeUnsafe: W,
fromWords: q,
fromWordsUnsafe: S,
toWords: I,
};
}
(e.bech32 = p("bech32")),
(e.bech32m = p("bech32m")),
(e.utf8 = {
encode: (E) => new TextDecoder().decode(E),
decode: (E) => new TextEncoder().encode(E),
}),
(e.hex = n(
v(4),
r("0123456789abcdef"),
o(""),
c((E) => {
if (typeof E != "string" || E.length % 2)
throw new TypeError(
`hex.decode: expected string, got ${typeof E} with length ${
E.length
}`
);
return E.toLowerCase();
})
));
const _ = {
utf8: e.utf8,
hex: e.hex,
base16: e.base16,
base32: e.base32,
base64: e.base64,
base64url: e.base64url,
base58: e.base58,
base58xmr: e.base58xmr,
},
$ = `Invalid encoding type. Available types: ${Object.keys(_).join(
", "
)}`,
R = (E, x) => {
if (typeof E != "string" || !_.hasOwnProperty(E))
throw new TypeError($);
if (!(x instanceof Uint8Array))
throw new TypeError("bytesToString() expects Uint8Array");
return _[E].encode(x);
};
(e.bytesToString = R), (e.str = e.bytesToString);
const L = (E, x) => {
if (!_.hasOwnProperty(E)) throw new TypeError($);
if (typeof x != "string")
throw new TypeError("stringToBytes() expects string");
return _[E].decode(x);
};
(e.stringToBytes = L), (e.bytes = e.stringToBytes);
})(Tm);
const { bech32: Bn, hex: gn, utf8: SS } = Tm,
eg = {
bech32: "bc",
pubKeyHash: 0,
scriptHash: 5,
validWitnessVersions: [0],
},
tg = {
bech32: "tb",
pubKeyHash: 111,
scriptHash: 196,
validWitnessVersions: [0],
},
ng = {
bech32: "bcrt",
pubKeyHash: 111,
scriptHash: 196,
validWitnessVersions: [0],
},
rg = {
bech32: "sb",
pubKeyHash: 63,
scriptHash: 123,
validWitnessVersions: [0],
},
Js = [
"option_data_loss_protect",
"initial_routing_sync",
"option_upfront_shutdown_script",
"gossip_queries",
"var_onion_optin",
"gossip_queries_ex",
"option_static_remotekey",
"payment_secret",
"basic_mpp",
"option_support_large_channel",
],
$S = {
m: BigInt(1e3),
u: BigInt(1e6),
n: BigInt(1e9),
p: BigInt(1e12),
},
xS = BigInt("2100000000000000000"),
og = BigInt(1e11),
Gl = {
payment_hash: 1,
payment_secret: 16,
description: 13,
payee: 19,
description_hash: 23,
expiry: 6,
min_final_cltv_expiry: 24,
fallback_address: 9,
route_hint: 3,
feature_bits: 5,
metadata: 27,
},
Pm = {};
for (let e = 0, t = Object.keys(Gl); e < t.length; e++) {
const n = t[e],
r = Gl[t[e]].toString();
Pm[r] = n;
}
const TS = {
1: (e) => gn.encode(Bn.fromWordsUnsafe(e)),
16: (e) => gn.encode(Bn.fromWordsUnsafe(e)),
13: (e) => SS.encode(Bn.fromWordsUnsafe(e)),
19: (e) => gn.encode(Bn.fromWordsUnsafe(e)),
23: (e) => gn.encode(Bn.fromWordsUnsafe(e)),
27: (e) => gn.encode(Bn.fromWordsUnsafe(e)),
6: Ra,
24: Ra,
3: LS,
5: BS,
};
function PS(e) {
return (t) => ({
tagCode: parseInt(e),
words: Bn.encode("unknown", t, Number.MAX_SAFE_INTEGER),
});
}
function Ra(e) {
return e.reverse().reduce((t, n, r) => t + n * Math.pow(32, r), 0);
}
function LS(e) {
const t = [];
let n,
r,
o,
s,
c,
f = Bn.fromWordsUnsafe(e);
for (; f.length > 0; )
(n = gn.encode(f.slice(0, 33))),
(r = gn.encode(f.slice(33, 41))),
(o = parseInt(gn.encode(f.slice(41, 45)), 16)),
(s = parseInt(gn.encode(f.slice(45, 49)), 16)),
(c = parseInt(gn.encode(f.slice(49, 51)), 16)),
(f = f.slice(51)),
t.push({
pubkey: n,
short_channel_id: r,
fee_base_msat: o,
fee_proportional_millionths: s,
cltv_expiry_delta: c,
});
return t;
}
function BS(e) {
const t = e
.slice()
.reverse()
.map((o) => [!!(o & 1), !!(o & 2), !!(o & 4), !!(o & 8), !!(o & 16)])
.reduce((o, s) => o.concat(s), []);
for (; t.length < Js.length * 2; ) t.push(!1);
const n = {};
Js.forEach((o, s) => {
let c;
t[s * 2]
? (c = "required")
: t[s * 2 + 1]
? (c = "supported")
: (c = "unsupported"),
(n[o] = c);
});
const r = t.slice(Js.length * 2);
return (
(n.extra_bits = {
start_bit: Js.length * 2,
bits: r,
has_required: r.reduce(
(o, s, c) => (c % 2 !== 0 ? o || !1 : o || s),
!1
),
}),
n
);
}
function Lm(e, t) {
let n, r;
if (e.slice(-1).match(/^[munp]$/))
(n = e.slice(-1)), (r = e.slice(0, -1));
else {
if (e.slice(-1).match(/^[^munp0-9]$/))
throw new Error("Not a valid multiplier for the amount");
r = e;
}
if (!r.match(/^\d+$/))
throw new Error("Not a valid human readable amount");
const o = BigInt(r),
s = n ? (o * og) / $S[n] : o * og;
if ((n === "p" && o % BigInt(10) !== BigInt(0)) || s > xS)
throw new Error("Amount is outside of valid range");
return t ? s.toString() : s;
}
function CS(e, t) {
if (typeof e != "string")
throw new Error("Lightning Payment Request must be string");
if (e.slice(0, 2).toLowerCase() !== "ln")
throw new Error("Not a proper lightning payment request");
const n = [],
r = Bn.decode(e, Number.MAX_SAFE_INTEGER);
e = e.toLowerCase();
const o = r.prefix;
let s = r.words,
c = e.slice(o.length + 1),
f = s.slice(-104);
s = s.slice(0, -104);
let d = o.match(/^ln(\S+?)(\d*)([a-zA-Z]?)$/);
if ((d && !d[2] && (d = o.match(/^ln(\S+)$/)), !d))
throw new Error("Not a proper lightning payment request");
n.push({ name: "lightning_network", letters: "ln" });
const h = d[1];
let y;
if (t) {
if (
t.bech32 === void 0 ||
t.pubKeyHash === void 0 ||
t.scriptHash === void 0 ||
!Array.isArray(t.validWitnessVersions)
)
throw new Error("Invalid network");
y = t;
} else
switch (h) {
case eg.bech32:
y = eg;
break;
case tg.bech32:
y = tg;
break;
case ng.bech32:
y = ng;
break;
case rg.bech32:
y = rg;
break;
}
if (!y || y.bech32 !== h) throw new Error("Unknown coin bech32 prefix");
n.push({ name: "coin_network", letters: h, value: y });
const m = d[2];
let v;
if (m) {
const l = d[3];
(v = Lm(m + l, !0)),
n.push({ name: "amount", letters: d[2] + d[3], value: v });
} else v = null;
n.push({ name: "separator", letters: "1" });
const P = Ra(s.slice(0, 7));
(s = s.slice(7)),
n.push({ name: "timestamp", letters: c.slice(0, 7), value: P }),
(c = c.slice(7));
let C, A, O, M;
for (; s.length > 0; ) {
const l = s[0].toString();
(C = Pm[l] || "unknown_tag"),
(A = TS[l] || PS(l)),
(s = s.slice(1)),
(O = Ra(s.slice(0, 2))),
(s = s.slice(2)),
(M = s.slice(0, O)),
(s = s.slice(O)),
n.push({
name: C,
tag: c[0],
letters: c.slice(0, 3 + O),
value: A(M),
}),
(c = c.slice(3 + O));
}
n.push({
name: "signature",
letters: c.slice(0, 104),
value: gn.encode(Bn.fromWordsUnsafe(f)),
}),
(c = c.slice(104)),
n.push({ name: "checksum", letters: c });
let T = {
paymentRequest: e,
sections: n,
get expiry() {
let l = n.find((w) => w.name === "expiry");
if (l) return N("timestamp") + l.value;
},
get route_hints() {
return n.filter((l) => l.name === "route_hint").map((l) => l.value);
},
};
for (let l in Gl)
l !== "route_hint" &&
Object.defineProperty(T, l, {
get() {
return N(l);
},
});
return T;
function N(l) {
let w = n.find((p) => p.name === l);
return w ? w.value : void 0;
}
}
var IS = { decode: CS, hrpToMillisat: Lm };
const OS = He(
"<div id=ztr-root><style></style><div style=float:right;opacity:0.2;>"
),
NS = He("<div id=ztr-content>"),
RS = He("<h1>Error!"),
zS = He(
"<div class=ztr-comment-text><pre></pre><p>Only properly formed NIP-19 naddr, note and nevent encoded entities and URLs are supported."
),
US = He("<h2 id=ztr-title>"),
MS = He(
"<p>Powered by <a href=https://github.com/fr4nzap/zapthreads>zapthreads"
),
HS = He("<button>Clear cache"),
jS = He("<p>Anchor version: "),
DS = (e) => {
Hr(() => {
me.anchor = (() => {
const N = e.anchor.trim();
try {
if (N.startsWith("http")) {
const w = !e.legacyUrl;
return { type: "http", value: fA(N, w) };
}
const l = ia(N);
switch (l.type) {
case "nevent":
return { type: "note", value: l.data.id };
case "note":
return { type: "note", value: l.data };
case "naddr":
const w = l.data;
return {
type: "naddr",
value: `${w.kind}:${w.pubkey}:${w.identifier}`,
};
}
} catch (l) {
return (
console.error(l),
{ type: "error", value: `Malformed anchor: ${N}` }
);
}
})();
const T = "wss://relay.damus.io,wss://nos.lol";
(me.relays = (e.relays || T)
.split(",")
.map((N) => new URL(N).toString())),
(e.author || "").startsWith("npub") &&
(me.externalAuthor = e.author),
(me.disableFeatures = e.disable
.split(",")
.map((N) => N.trim())
.filter(m5)),
(me.urlPrefixes = cA(e.urls)),
(me.replyPlaceholder = e.replyPlaceholder);
});
const t = () => me.anchor,
n = () => me.relays,
r = () => me.disableFeatures,
o = () => e.version;
me.profiles = Ys(() => ["profiles"]);
const s = () => r().includes("watch");
Hr(
jr([t], () => {
me.version = o();
})
),
Hr(
jr([t, n], async () => {
if (t().type === "error") return;
let T, N;
switch (t().type) {
case "http":
(N = await Ti("events", t().value, { index: "r" })),
(me.rootEventIds = sa(N).map((E) => E.id)),
(T = {
"#r": e.legacyUrl
? [t().value]
: [t().value, `${t().value}/`],
kinds: [1, 8812],
});
break;
case "note":
const _ = await hi("events", IDBKeyRange.only(t().value));
if (_) {
(N = [_]),
(me.rootEventIds = [_.id]),
(me.anchorAuthor = _.pk);
return;
} else {
(N = []), (T = { ids: [t().value] });
break;
}
case "naddr":
const [$, R, L] = t().value.split(":");
(N = (await Ti("events", L, { index: "d" })).filter(
(E) => E.pk === R
)),
N.length > 0 &&
((me.rootEventIds = sa(N).map((E) => E.id)),
(me.anchorAuthor = N[0].pk)),
(T = { authors: [R], kinds: [parseInt($)], "#d": [L] });
break;
default:
throw "error";
}
const w = (await di.querySync(n(), { ...T })).map(Na);
for (const p of w)
t().type == "http"
? ((p.k == 1 && p.c.includes("↴")) || p.k == 8812) &&
un("events", p)
: un("events", p);
switch (t().type) {
case "http":
case "naddr":
const p = [...N, ...w],
_ = sa([...p]).map(($) => $.id);
(_.length > 0 && _[0]) !== me.rootEventIds[0] &&
(me.rootEventIds = _);
break;
case "note":
me.rootEventIds = w.map(($) => $.id);
break;
}
w.length > 0 && (me.anchorAuthor = w[0].pk);
})
);
const c = () => me.rootEventIds;
Hr(
jr(
[c, o],
() => {
switch (t().type) {
case "http":
case "note":
(me.filter["#e"] ?? []).toString() !== c().toString() &&
(me.filter = { "#e": c() });
return;
case "naddr":
const T = me.filter["#a"] && me.filter["#a"][0];
t().value !== T && (me.filter = { "#a": [t().value] }),
(me.version = o() || c()[0]);
return;
}
},
{ defer: !0 }
)
);
const f = De(() => me.filter, { defer: !0 });
let d;
Ei(
jr(
[f],
async () => {
const T = f(),
N = n(),
l = t(),
w = P(),
p = me.profiles();
if (Object.entries(T).length === 0) return;
d == null || d.close(),
(d = null),
li(() => {
console.log(
"[zapthreads] unsubscribing and cleaning up",
l.value
),
d == null || d.close(),
(d = null);
});
const _ = [1, 9802, 7, 9735];
console.log("[zapthreads] subscribing to", l.value);
const $ = await eA(l, N),
R = new Set(),
L = {};
d = di.subscribeMany(N, [{ ...T, kinds: _, since: $ }], {
onevent(E) {
if (E.kind === 1 || E.kind === 9802)
E.content.trim() && un("events", Na(E));
else if (E.kind === 7) R.add(E.id);
else if (E.kind === 9735) {
const x = E.tags.find((z) => z[0] === "bolt11");
x && x[1] && (L[E.id] = x[1]);
}
},
oneose() {
(async () => {
const E = (await hi(
"aggregates",
IDBKeyRange.only([l.value, 7])
)) ?? { eid: l.value, ids: [], k: 7 };
(E.ids = [...new Set([...E.ids, ...R])]),
un("aggregates", E);
const x = (await hi(
"aggregates",
IDBKeyRange.only([l.value, 9735])
)) ?? { eid: l.value, ids: [], k: 9735, sum: 0 };
(x.sum = Object.entries(L).reduce((z, q) => {
if (x.ids.includes(q[0])) return z;
const S = IS.decode(q[1]).sections.find(
(K) => K.name === "amount"
),
D = Number(S.value) / 1e3;
return z + D;
}, x.sum ?? 0)),
(x.ids = [...new Set([...x.ids, ...Object.keys(L)])]),
un("aggregates", x);
})(),
setTimeout(async () => {
await wm([...w.map((E) => E.pk)], N, p),
tA(l, w),
s() && (d == null || d.close(), di.close(N));
}, 96);
},
});
},
{ defer: !0 }
)
);
const h = () => e.user;
Hr(
jr(h, (T) => {
if (T) {
let N, l;
T.startsWith("nsec")
? ((l = ia(T).data), (N = ym(l)))
: (N = ia(T).data),
(Ut.external = {
pk: N,
signEvent: async (w) => {
if (l) return { sig: vm(w, l).sig };
if (!window.nostr)
throw (
(alert(
"Please log in with a NIP-07 extension such as Alby or nos2x"
),
(Ut.active = void 0),
"No extension available")
);
const p = await window.nostr.getPublicKey(),
_ = N;
if (_ !== p) {
const $ = `ERROR: Event not signed. Supplied pubkey does not match extension pubkey. ${_} !== ${p}`;
throw ((Ut.active = void 0), alert($), $);
} else return window.nostr.signEvent(w);
},
}),
(Ut.active = Ut.external);
}
})
),
Hr(
jr(
h,
(T) => {
T || (Ut.active = void 0);
},
{ defer: !0 }
)
);
const y = Ys(() => ["events", 30023, { index: "k" }]),
m = De(() => {
if (
me.disableFeatures.includes("hideContent") &&
t().type === "naddr"
) {
const [T, N, l] = t().value.split(":"),
w = y().find((p) => p.d === l && p.pk === N);
if (w) {
const p = `# ${w.tl}
${w.c}`;
return mm({ ...w, c: p }, me, []);
}
}
}),
v = De(() => {
switch (t().type) {
case "http":
case "note":
return Ys(() => ["events", me.rootEventIds, { index: "ro" }]);
case "naddr":
return Ys(() => ["events", t().value, { index: "a" }]);
default:
return () => [];
}
}),
P = () => v()(),
C = De(() =>
me.rootEventIds && me.rootEventIds.length
? bm(P()).filter(
(N) => !(N.k === 9802 && N.children.length === 0)
)
: []
),
A = () => C().reduce((T, N) => T + Jd(N), C().length),
[O, M] = dt(!1);
return (() => {
const T = OS(),
N = T.firstChild,
l = N.nextSibling;
return (
xe(N, z6),
xe(
T,
(() => {
const w = De(() => !!m());
return () =>
w() &&
(() => {
const p = NS();
return cn(() => (p.innerHTML = m())), p;
})();
})(),
l
),
xe(
T,
(() => {
const w = De(() => t().type === "error");
return () =>
w() && [
RS(),
(() => {
const p = zS(),
_ = p.firstChild;
return xe(_, () => t().value), p;
})(),
];
})(),
l
),
xe(
T,
(() => {
const w = De(() => t().type !== "error");
return () =>
w() && [
De(
(() => {
const p = De(
() => !me.disableFeatures.includes("reply")
);
return () => p() && mn(ZA, {});
})()
),
(() => {
const p = US();
return (
xe(
p,
(() => {
const _ = De(() => A() > 0);
return () =>
_() && `${A()} comment${A() == 1 ? "" : "s"}`;
})()
),
p
);
})(),
mn($m, { nestedEvents: C, articles: y }),
];
})(),
l
),
(l.$$click = () => M(!O())),
xe(l, xm),
xe(
T,
(() => {
const w = De(() => !!O());
return () =>
w() && [
MS(),
De(
(() => {
const p = De(() => !!me.version);
return () =>
p() &&
(() => {
const _ = jS();
return (
_.firstChild, xe(_, () => me.version, null), _
);
})();
})()
),
(() => {
const p = HS();
return _6(p, "click", Q5), p;
})(),
];
})(),
null
),
T
);
})();
};
R6(
"zap-threads",
{
anchor: "",
version: "",
relays: "",
user: "",
author: "",
disable: "",
urls: "",
"reply-placeholder": "",
"legacy-url": "",
},
(e) =>
mn(DS, {
get anchor() {
return e.anchor ?? "";
},
get version() {
return e.version ?? "";
},
get relays() {
return e.relays ?? "";
},
get user() {
return e.user ?? "";
},
get author() {
return e.author ?? "";
},
get disable() {
return e.disable ?? "";
},
get urls() {
return e.urls ?? "";
},
get replyPlaceholder() {
return e["reply-placeholder"] ?? "";
},
get legacyUrl() {
return e["legacy-url"] ?? "";
},
})
);
zd(["click"]);
function qS(e) {
let t, n;
return (
(t = new fw({})),
{
c() {
dr(t.$$.fragment);
},
m(r, o) {
Dn(t, r, o), (n = !0);
},
p: At,
i(r) {
n || (Ve(t.$$.fragment, r), (n = !0));
},
o(r) {
Ze(t.$$.fragment, r), (n = !1);
},
d(r) {
qn(t, r);
},
}
);
}
function VS(e) {
let t,
n,
r = Yr(e[1].created_at, !0) + "",
o,
s,
c,
f = e[1].title + "",
d,
h,
y,
m,
v,
P,
C = e[1].image && ig(e),
A = e[3] && sg(e);
return {
c() {
(t = ke("div")),
(n = ke("div")),
(o = Xe(r)),
(s = Ge()),
(c = ke("h1")),
(d = Xe(f)),
(h = Ge()),
C && C.c(),
(y = Ge()),
(m = ke("div")),
(v = Ge()),
A && A.c(),
(P = Uo()),
Ee(n, "class", "date"),
Ee(m, "class", "content"),
Ee(t, "class", "note-wrapper");
},
m(O, M) {
Ne(O, t, M),
we(t, n),
we(n, o),
we(t, s),
we(t, c),
we(c, d),
we(t, h),
C && C.m(t, null),
we(t, y),
we(t, m),
(m.innerHTML = e[6]),
Ne(O, v, M),
A && A.m(O, M),
Ne(O, P, M);
},
p(O, M) {
M & 2 && r !== (r = Yr(O[1].created_at, !0) + "") && It(o, r),
M & 2 && f !== (f = O[1].title + "") && It(d, f),
O[1].image
? C
? C.p(O, M)
: ((C = ig(O)), C.c(), C.m(t, y))
: C && (C.d(1), (C = null)),
M & 64 && (m.innerHTML = O[6]),
O[3]
? A
? A.p(O, M)
: ((A = sg(O)), A.c(), A.m(P.parentNode, P))
: A && (A.d(1), (A = null));
},
i: At,
o: At,
d(O) {
O && (Ie(t), Ie(v), Ie(P)), C && C.d(), A && A.d(O);
},
};
}
function ig(e) {
let t, n;
return {
c() {
(t = ke("img")),
Ee(t, "class", "note-banner"),
Kr(t.src, (n = e[1].image)) || Ee(t, "src", n);
},
m(r, o) {
Ne(r, t, o);
},
p(r, o) {
o & 2 && !Kr(t.src, (n = r[1].image)) && Ee(t, "src", n);
},
d(r) {
r && Ie(t);
},
};
}
function sg(e) {
let t;
return {
c() {
(t = ke("zap-threads")),
Vs(t, "anchor", e[2]),
Vs(t, "relays", e[0]);
},
m(n, r) {
Ne(n, t, r);
},
p(n, r) {
r & 4 && Vs(t, "anchor", n[2]), r & 1 && Vs(t, "relays", n[0]);
},
d(n) {
n && Ie(t);
},
};
}
function FS(e) {
let t,
n,
r,
o,
s = e[2].slice(0, 9) + "..." + e[2].slice(-5),
c,
f,
d,
h,
y,
m,
v,
P,
C,
A,
O,
M,
T,
N,
l,
w,
p;
const _ = [VS, qS],
$ = [];
function R(L, E) {
return (
E & 2 && (T = null),
T == null && (T = Object.keys(L[1]).length > 0),
T ? 0 : 1
);
}
return (
(N = R(e, -1)),
(l = $[N] = _[N](e)),
{
c() {
(t = ke("div")),
(n = ke("div")),
(r = Xe("Note: ")),
(o = ke("a")),
(c = Xe(s)),
(d = Ge()),
(h = ke("a")),
(y = ke("div")),
(m = ke("img")),
(P = Ge()),
(C = ke("span")),
(A = Xe(e[4])),
(O = Xe(" homepage")),
(M = Ge()),
l.c(),
(w = Uo()),
Ee(o, "href", (f = "https://njump.me/" + e[2])),
Ee(n, "class", "external-link"),
Kr(m.src, (v = e[5])) || Ee(m, "src", v),
Ee(y, "class", "picture-container"),
Ee(h, "href", "#"),
Ee(t, "class", "header note");
},
m(L, E) {
Ne(L, t, E),
we(t, n),
we(n, r),
we(n, o),
we(o, c),
we(t, d),
we(t, h),
we(h, y),
we(y, m),
we(h, P),
we(h, C),
we(C, A),
we(C, O),
Ne(L, M, E),
$[N].m(L, E),
Ne(L, w, E),
(p = !0);
},
p(L, [E]) {
(!p || E & 4) &&
s !== (s = L[2].slice(0, 9) + "..." + L[2].slice(-5)) &&
It(c, s),
(!p || (E & 4 && f !== (f = "https://njump.me/" + L[2]))) &&
Ee(o, "href", f),
(!p || (E & 32 && !Kr(m.src, (v = L[5])))) && Ee(m, "src", v),
(!p || E & 16) && It(A, L[4]);
let x = N;
(N = R(L, E)),
N === x
? $[N].p(L, E)
: (to(),
Ze($[x], 1, 1, () => {
$[x] = null;
}),
no(),
(l = $[N]),
l ? l.p(L, E) : ((l = $[N] = _[N](L)), l.c()),
Ve(l, 1),
l.m(w.parentNode, w));
},
i(L) {
p || (Ve(l), (p = !0));
},
o(L) {
Ze(l), (p = !1);
},
d(L) {
L && (Ie(t), Ie(M), Ie(w)), $[N].d(L);
},
}
);
}
function KS(e, t, n) {
let r,
o,
s = {},
c = "",
f = "",
d = !1,
h = "",
y = "",
{ id: m } = t,
{ profile: v } = t;
return (
qa(async () => {
const { relays: P, comments: C } = Fa();
n(0, (o = P));
const A = JSON.parse(v.content);
n(4, (h = A.name || null)),
n(5, (y = A.picture || null)),
n(2, (f = Fv(m))),
n(3, (d = C));
let O = pa.subscribeMany(o, [{ authors: [v.pubkey], ids: [m] }], {
onevent: async (M) => {
console.log("Received event:", M),
n(1, (s = ea(M))),
ga.set(s.title),
n(9, (c = await U0(s)));
},
oneose() {
console.log("No subscribers left. Closing subscription."),
O.close();
},
});
}),
(e.$$set = (P) => {
"id" in P && n(7, (m = P.id)),
"profile" in P && n(8, (v = P.profile));
}),
(e.$$.update = () => {
e.$$.dirty & 512 && n(6, (r = c));
}),
ga.subscribe((P) => {
document.title = P;
}),
[o, s, f, d, h, y, r, m, v, c]
);
}
class WS extends oo {
constructor(t) {
super(), ro(this, t, KS, FS, jn, { id: 7, profile: 8 });
}
}
function GS(e) {
let t, n, r, o, s, c;
return {
c() {
(t = ke("div")),
(n = ke("input")),
(r = Ge()),
(o = ke("label")),
(n.checked = e[0]),
Ee(n, "type", "checkbox"),
Ee(n, "id", "theme-toggle"),
Ee(n, "class", "svelte-bxrhh"),
Ee(o, "for", "theme-toggle"),
Ee(o, "class", "svelte-bxrhh");
},
m(f, d) {
Ne(f, t, d),
we(t, n),
we(t, r),
we(t, o),
s || ((c = _v(n, "click", e[1])), (s = !0));
},
p(f, [d]) {
d & 1 && (n.checked = f[0]);
},
i: At,
o: At,
d(f) {
f && Ie(t), (s = !1), c();
},
};
}
// Theme default to light
function ZS(e, t, n) {
let r = false; // default to light mode
function o() {
n(0, (r = !r));
localStorage.setItem("theme", r ? "dark" : "light");
if (r) {
document.documentElement.classList.add("dark");
} else {
document.documentElement.classList.remove("dark");
}
}
if (typeof window !== "undefined") {
if (localStorage.theme === "dark") {
document.documentElement.classList.add("dark");
r = true;
} else {
document.documentElement.classList.remove("dark");
r = false;
}
}
return [r, o];
}
class YS extends oo {
constructor(t) {
super(), ro(this, t, ZS, GS, jn, {});
}
}
function ag(e) {
let t;
return {
c() {
(t = ke("div")),
(t.innerHTML = `<h1>Oracolo</h1> <h2>Missing config!</h2>
You need to set (at least) the <strong>author meta tag</strong> by updating this html file! Open it with an editor, look at the first lines and personalize them.`),
Ee(t, "class", "unfinished-setup");
},
m(n, r) {
Ne(n, t, r);
},
d(n) {
n && Ie(t);
},
};
}
function cg(e) {
let t = e[0],
n,
r,
o = ug(e);
return {
c() {
o.c(), (n = Uo());
},
m(s, c) {
o.m(s, c), Ne(s, n, c), (r = !0);
},
p(s, c) {
c & 1 && jn(t, (t = s[0]))
? (to(),
Ze(o, 1, 1, At),
no(),
(o = ug(s)),
o.c(),
Ve(o, 1),
o.m(n.parentNode, n))
: o.p(s, c);
},
i(s) {
r || (Ve(o), (r = !0));
},
o(s) {
Ze(o), (r = !1);
},
d(s) {
s && Ie(n), o.d(s);
},
};
}
function JS(e) {
let t, n;
return (
(t = new WS({ props: { id: e[0], profile: e[1] } })),
{
c() {
dr(t.$$.fragment);
},
m(r, o) {
Dn(t, r, o), (n = !0);
},
p(r, o) {
const s = {};
o & 1 && (s.id = r[0]), o & 2 && (s.profile = r[1]), t.$set(s);
},
i(r) {
n || (Ve(t.$$.fragment, r), (n = !0));
},
o(r) {
Ze(t.$$.fragment, r), (n = !1);
},
d(r) {
qn(t, r);
},
}
);
}
function XS(e) {
let t, n;
return (
(t = new hw({ props: { tag: e[0], profile: e[1] } })),
{
c() {
dr(t.$$.fragment);
},
m(r, o) {
Dn(t, r, o), (n = !0);
},
p(r, o) {
const s = {};
o & 1 && (s.tag = r[0]), o & 2 && (s.profile = r[1]), t.$set(s);
},
i(r) {
n || (Ve(t.$$.fragment, r), (n = !0));
},
o(r) {
Ze(t.$$.fragment, r), (n = !1);
},
d(r) {
qn(t, r);
},
}
);
}
function QS(e) {
let t, n;
return (
(t = new hw({ props: { tag: "", profile: e[1] } })),
{
c() {
dr(t.$$.fragment);
},
m(r, o) {
Dn(t, r, o), (n = !0);
},
p(r, o) {
const s = {};
o & 2 && (s.profile = r[1]), t.$set(s);
},
i(r) {
n || (Ve(t.$$.fragment, r), (n = !0));
},
o(r) {
Ze(t.$$.fragment, r), (n = !1);
},
d(r) {
qn(t, r);
},
}
);
}
function ug(e) {
let t, n, r, o, s;
const c = [QS, XS, JS],
f = [];
function d(h, y) {
return (
y & 1 && (t = null),
h[0] === ""
? 0
: (t == null && (t = !!h[0].startsWith("tags/")), t ? 1 : 2)
);
}
return (
(n = d(e, -1)),
(r = f[n] = c[n](e)),
{
c() {
r.c(), (o = Uo());
},
m(h, y) {
f[n].m(h, y), Ne(h, o, y), (s = !0);
},
p(h, y) {
let m = n;
(n = d(h, y)),
n === m
? f[n].p(h, y)
: (to(),
Ze(f[m], 1, 1, () => {
f[m] = null;
}),
no(),
(r = f[n]),
r ? r.p(h, y) : ((r = f[n] = c[n](h)), r.c()),
Ve(r, 1),
r.m(o.parentNode, o));
},
i(h) {
s || (Ve(r), (s = !0));
},
o(h) {
Ze(r), (s = !1);
},
d(h) {
h && Ie(o), f[n].d(h);
},
}
);
}
function lg(e) {
let t,
n = e[3].join(", ") + "",
r;
return {
c() {
(t = Xe(
"This page connects to some servers (Nostr relays) to retrieve data: "
)),
(r = Xe(n));
},
m(o, s) {
Ne(o, t, s), Ne(o, r, s);
},
p(o, s) {
s & 8 && n !== (n = o[3].join(", ") + "") && It(r, n);
},
d(o) {
o && (Ie(t), Ie(r));
},
};
}
function e$(e) {
let t,
n = e[1] && Object.keys(e[1]).length > 0,
r,
o,
s,
c,
f,
d,
h,
y,
m,
v,
P,
C,
A = e[2] && ag(),
O = n && cg(e),
M = e[3] && lg(e);
return (
(P = new YS({})),
{
c() {
A && A.c(),
(t = Ge()),
O && O.c(),
(r = Ge()),
(o = ke("div")),
(s = Xe("This blog is powered by ")),
(c = ke("a")),
(c.textContent = "Oracolo"),
(f = Xe(" and Nostr, ")),
(d = ke("a")),
(d.textContent = "read more"),
(h = ke("br")),
(y = ke("br")),
(m = Ge()),
M && M.c(),
(v = Ge()),
dr(P.$$.fragment),
Ee(c, "href", "https://github.com/dtonon/oracolo"),
Ee(d, "href", "https://njump.me"),
Ee(o, "class", "footer");
},
m(T, N) {
A && A.m(T, N),
Ne(T, t, N),
O && O.m(T, N),
Ne(T, r, N),
Ne(T, o, N),
we(o, s),
we(o, c),
we(o, f),
we(o, d),
we(o, h),
we(o, y),
we(o, m),
M && M.m(o, null),
Ne(T, v, N),
Dn(P, T, N),
(C = !0);
},
p(T, [N]) {
T[2]
? A || ((A = ag()), A.c(), A.m(t.parentNode, t))
: A && (A.d(1), (A = null)),
N & 2 && (n = T[1] && Object.keys(T[1]).length > 0),
n
? O
? (O.p(T, N), N & 2 && Ve(O, 1))
: ((O = cg(T)), O.c(), Ve(O, 1), O.m(r.parentNode, r))
: O &&
(to(),
Ze(O, 1, 1, () => {
O = null;
}),
no()),
T[3]
? M
? M.p(T, N)
: ((M = lg(T)), M.c(), M.m(o, null))
: M && (M.d(1), (M = null));
},
i(T) {
C || (Ve(O), Ve(P.$$.fragment, T), (C = !0));
},
o(T) {
Ze(O), Ze(P.$$.fragment, T), (C = !1);
},
d(T) {
T && (Ie(t), Ie(r), Ie(o), Ie(v)),
A && A.d(T),
O && O.d(T),
M && M.d(),
qn(P, T);
},
}
);
}
function t$(e, t, n) {
let r = "",
o,
s = !1,
c,
f = !1;
const d = () => {
const h = window.location.hash.substr(1);
h !== r && n(0, (r = h));
};
return (
qa(async () => {
const { npub: h, relays: y, comments: m } = Fa();
if ((n(3, (c = y)), (f = m), f))
try {
await yv(
() => Promise.resolve().then(() => i$),
void 0,
import.meta.url
),
console.log("window.nostr.js has been successfully loaded");
} catch (v) {
console.error("Failed to load window.nostr.js:", v);
}
if (
(d(),
window.addEventListener("hashchange", d),
n(1, (o = await N0(h))),
o)
) {
const v = JSON.parse(o.content);
v.name, v.picture;
} else n(2, (s = !0));
}),
$v(() => {
window.removeEventListener("hashchange", d);
}),
[r, o, s, c]
);
}
class n$ extends oo {
constructor(t) {
super(), ro(this, t, t$, e$, jn, {});
}
}
new n$({ target: document.getElementById("app") });
var dg = {},
r$ = Object.defineProperty,
o$ = (e, t, n) =>
t in e
? r$(e, t, {
enumerable: !0,
configurable: !0,
writable: !0,
value: n,
})
: (e[t] = n),
ae = (e, t, n) => (o$(e, typeof t != "symbol" ? t + "" : t, n), n);
(function () {
var e, t, n, r, o;
const s =
'*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.fixed{position:fixed}.absolute{position:absolute}.bottom-1{bottom:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.top-0{top:0}.m-auto{margin:auto}.mx-2{margin-left:.5rem;margin-right:.5rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.mr-2{margin-right:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.box-border{box-sizing:border-box}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.h-10{height:2.5rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.w-10{width:2.5rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-full{width:100%}.max-w-56{max-width:14rem}@keyframes moveIn{0%{transform:translateY(-10px)}to{transform:translateY(0)}}.animate-fadein{animation:fadeIn 1s ease-in-out,moveIn 1s ease-in-out}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.animate-show{animation:fadeIn .2s ease-in-out}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-grabbing{cursor:grabbing}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:.5rem}.overflow-hidden{overflow:hidden}.overflow-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-md{border-radius:.375rem}.border-0{border-width:0px}.border-2{border-width:2px}.border-solid{border-style:solid}.border-transparent{border-color:transparent}.bg-cyan-700{--tw-bg-opacity: 1;background-color:rgb(14 116 144 / var(--tw-bg-opacity))}.bg-cyan-800{--tw-bg-opacity: 1;background-color:rgb(21 94 117 / var(--tw-bg-opacity))}.bg-cyan-900{--tw-bg-opacity: 1;background-color:rgb(22 78 99 / var(--tw-bg-opacity))}.bg-cyan-950{--tw-bg-opacity: 1;background-color:rgb(8 51 68 / var(--tw-bg-opacity))}.bg-green-700{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity))}.bg-green-800{--tw-bg-opacity: 1;background-color:rgb(22 101 52 / var(--tw-bg-opacity))}.bg-green-900{--tw-bg-opacity: 1;background-color:rgb(20 83 45 / var(--tw-bg-opacity))}.bg-green-950{--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity))}.bg-neutral-700{--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity))}.bg-neutral-800{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.bg-neutral-900{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.bg-neutral-950{--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity))}.bg-orange-700{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity))}.bg-orange-800{--tw-bg-opacity: 1;background-color:rgb(154 52 18 / var(--tw-bg-opacity))}.bg-orange-900{--tw-bg-opacity: 1;background-color:rgb(124 45 18 / var(--tw-bg-opacity))}.bg-orange-950{--tw-bg-opacity: 1;background-color:rgb(67 20 7 / var(--tw-bg-opacity))}.bg-purple-700{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity))}.bg-purple-800{--tw-bg-opacity: 1;background-color:rgb(107 33 168 / var(--tw-bg-opacity))}.bg-purple-900{--tw-bg-opacity: 1;background-color:rgb(88 28 135 / var(--tw-bg-opacity))}.bg-purple-950{--tw-bg-opacity: 1;background-color:rgb(59 7 100 / var(--tw-bg-opacity))}.bg-red-700{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity))}.bg-red-800{--tw-bg-opacity: 1;background-color:rgb(153 27 27 / var(--tw-bg-opacity))}.bg-red-900{--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity))}.bg-red-950{--tw-bg-opacity: 1;background-color:rgb(69 10 10 / var(--tw-bg-opacity))}.bg-stone-700{--tw-bg-opacity: 1;background-color:rgb(68 64 60 / var(--tw-bg-opacity))}.bg-stone-800{--tw-bg-opacity: 1;background-color:rgb(41 37 36 / var(--tw-bg-opacity))}.bg-stone-900{--tw-bg-opacity: 1;background-color:rgb(28 25 23 / var(--tw-bg-opacity))}.bg-stone-950{--tw-bg-opacity: 1;background-color:rgb(12 10 9 / var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.from-cyan-900{--tw-gradient-from: #164e63 var(--tw-gradient-from-position);--tw-gradient-to: rgb(22 78 99 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-900{--tw-gradient-from: #14532d var(--tw-gradient-from-position);--tw-gradient-to: rgb(20 83 45 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-neutral-900{--tw-gradient-from: #171717 var(--tw-gradient-from-position);--tw-gradient-to: rgb(23 23 23 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-900{--tw-gradient-from: #7c2d12 var(--tw-gradient-from-position);--tw-gradient-to: rgb(124 45 18 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-900{--tw-gradient-from: #581c87 var(--tw-gradient-from-position);--tw-gradient-to: rgb(88 28 135 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-900{--tw-gradient-from: #7f1d1d var(--tw-gradient-from-position);--tw-gradient-to: rgb(127 29 29 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-stone-900{--tw-gradient-from: #1c1917 var(--tw-gradient-from-position);--tw-gradient-to: rgb(28 25 23 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-cyan-700{--tw-gradient-to: #0e7490 var(--tw-gradient-to-position)}.to-green-700{--tw-gradient-to: #15803d var(--tw-gradient-to-position)}.to-neutral-700{--tw-gradient-to: #404040 var(--tw-gradient-to-position)}.to-orange-700{--tw-gradient-to: #c2410c var(--tw-gradient-to-position)}.to-purple-700{--tw-gradient-to: #7e22ce var(--tw-gradient-to-position)}.to-red-700{--tw-gradient-to: #b91c1c var(--tw-gradient-to-position)}.to-stone-700{--tw-gradient-to: #44403c var(--tw-gradient-to-position)}.p-2{padding:.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.leading-3{line-height:.75rem}.leading-4{line-height:1rem}.leading-5{line-height:1.25rem}.text-cyan-600{--tw-text-opacity: 1;color:rgb(8 145 178 / var(--tw-text-opacity))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity))}.text-neutral-600{--tw-text-opacity: 1;color:rgb(82 82 82 / var(--tw-text-opacity))}.text-neutral-800{--tw-text-opacity: 1;color:rgb(38 38 38 / var(--tw-text-opacity))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity))}.text-stone-600{--tw-text-opacity: 1;color:rgb(87 83 78 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.no-underline{text-decoration-line:none}.decoration-2{text-decoration-thickness:2px}.underline-offset-4{text-underline-offset:4px}.opacity-25{opacity:.25}.opacity-75{opacity:.75}.shadow-\\[0_0px_10px_0px_rgba\\(0\\,0\\,0\\,0\\.3\\)\\]{--tw-shadow: 0 0px 10px 0px rgba(0,0,0,.3);--tw-shadow-colored: 0 0px 10px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_0px_30px_0px_rgba\\(0\\,0\\,0\\,0\\.6\\)\\]{--tw-shadow: 0 0px 30px 0px rgba(0,0,0,.6);--tw-shadow-colored: 0 0px 30px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline-dashed{outline-style:dashed}.outline-1{outline-width:1px}.outline-offset-4{outline-offset:4px}.outline-cyan-500{outline-color:#06b6d4}.outline-green-500{outline-color:#22c55e}.outline-neutral-500{outline-color:#737373}.outline-orange-500{outline-color:#f97316}.outline-purple-500{outline-color:#a855f7}.outline-red-500{outline-color:#ef4444}.outline-stone-500{outline-color:#78716c}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.hover\\:bg-cyan-700:hover{--tw-bg-opacity: 1;background-color:rgb(14 116 144 / var(--tw-bg-opacity))}.hover\\:bg-cyan-800:hover{--tw-bg-opacity: 1;background-color:rgb(21 94 117 / var(--tw-bg-opacity))}.hover\\:bg-cyan-900:hover{--tw-bg-opacity: 1;background-color:rgb(22 78 99 / var(--tw-bg-opacity))}.hover\\:bg-cyan-950:hover{--tw-bg-opacity: 1;background-color:rgb(8 51 68 / var(--tw-bg-opacity))}.hover\\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity))}.hover\\:bg-green-800:hover{--tw-bg-opacity: 1;background-color:rgb(22 101 52 / var(--tw-bg-opacity))}.hover\\:bg-green-900:hover{--tw-bg-opacity: 1;background-color:rgb(20 83 45 / var(--tw-bg-opacity))}.hover\\:bg-green-950:hover{--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity))}.hover\\:bg-neutral-700:hover{--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity))}.hover\\:bg-neutral-800:hover{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.hover\\:bg-neutral-900:hover{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.hover\\:bg-neutral-950:hover{--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity))}.hover\\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity))}.hover\\:bg-orange-800:hover{--tw-bg-opacity: 1;background-color:rgb(154 52 18 / var(--tw-bg-opacity))}.hover\\:bg-orange-900:hover{--tw-bg-opacity: 1;background-color:rgb(124 45 18 / var(--tw-bg-opacity))}.hover\\:bg-orange-950:hover{--tw-bg-opacity: 1;background-color:rgb(67 20 7 / var(--tw-bg-opacity))}.hover\\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity))}.hover\\:bg-purple-800:hover{--tw-bg-opacity: 1;background-color:rgb(107 33 168 / var(--tw-bg-opacity))}.hover\\:bg-purple-900:hover{--tw-bg-opacity: 1;background-color:rgb(88 28 135 / var(--tw-bg-opacity))}.hover\\:bg-purple-950:hover{--tw-bg-opacity: 1;background-color:rgb(59 7 100 / var(--tw-bg-opacity))}.hover\\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity))}.hover\\:bg-red-800:hover{--tw-bg-opacity: 1;background-color:rgb(153 27 27 / var(--tw-bg-opacity))}.hover\\:bg-red-900:hover{--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity))}.hover\\:bg-red-950:hover{--tw-bg-opacity: 1;background-color:rgb(69 10 10 / var(--tw-bg-opacity))}.hover\\:bg-stone-700:hover{--tw-bg-opacity: 1;background-color:rgb(68 64 60 / var(--tw-bg-opacity))}.hover\\:bg-stone-800:hover{--tw-bg-opacity: 1;background-color:rgb(41 37 36 / var(--tw-bg-opacity))}.hover\\:bg-stone-900:hover{--tw-bg-opacity: 1;background-color:rgb(28 25 23 / var(--tw-bg-opacity))}.hover\\:bg-stone-950:hover{--tw-bg-opacity: 1;background-color:rgb(12 10 9 / var(--tw-bg-opacity))}.disabled\\:cursor-default:disabled{cursor:default}.disabled\\:bg-neutral-400:disabled{--tw-bg-opacity: 1;background-color:rgb(163 163 163 / var(--tw-bg-opacity))}.disabled\\:text-neutral-200:disabled{--tw-text-opacity: 1;color:rgb(229 229 229 / var(--tw-text-opacity))}.group:hover .group-hover\\:underline{text-decoration-line:underline}@media (min-width: 640px){.sm\\:w-96{width:24rem}}';
function c() {}
function f(i) {
return i();
}
function d() {
return Object.create(null);
}
function h(i) {
i.forEach(f);
}
function y(i) {
return typeof i == "function";
}
function m(i, a) {
return i != i
? a == a
: i !== a || (i && typeof i == "object") || typeof i == "function";
}
let v;
function P(i, a) {
return i === a
? !0
: (v || (v = document.createElement("a")),
(v.href = a),
i === v.href);
}
function C(i) {
return Object.keys(i).length === 0;
}
function A(i, ...a) {
if (i == null) {
for (const g of a) g(void 0);
return c;
}
const u = i.subscribe(...a);
return u.unsubscribe ? () => u.unsubscribe() : u;
}
function O(i, a, u) {
i.$$.on_destroy.push(A(a, u));
}
const M =
typeof window < "u"
? window
: typeof globalThis < "u"
? globalThis
: I0;
function T(i, a) {
i.appendChild(a);
}
function N(i, a, u) {
i.insertBefore(a, u || null);
}
function l(i) {
i.parentNode && i.parentNode.removeChild(i);
}
function w(i, a) {
for (let u = 0; u < i.length; u += 1) i[u] && i[u].d(a);
}
function p(i) {
return document.createElement(i);
}
function _(i) {
return document.createElementNS("http://www.w3.org/2000/svg", i);
}
function $(i) {
return document.createTextNode(i);
}
function R() {
return $(" ");
}
function L() {
return $("");
}
function E(i, a, u, g) {
return (
i.addEventListener(a, u, g), () => i.removeEventListener(a, u, g)
);
}
function x(i, a, u) {
u == null
? i.removeAttribute(a)
: i.getAttribute(a) !== u && i.setAttribute(a, u);
}
function z(i) {
return Array.from(i.childNodes);
}
function q(i, a) {
(a = "" + a), i.data !== a && (i.data = a);
}
function I(i, a) {
i.value = a ?? "";
}
function S(i, a, u) {
for (let g = 0; g < i.options.length; g += 1) {
const b = i.options[g];
if (b.__value === a) {
b.selected = !0;
return;
}
}
(!u || a !== void 0) && (i.selectedIndex = -1);
}
function D(i) {
const a = i.querySelector(":checked");
return a && a.__value;
}
function K(i, a, u) {
i.classList.toggle(a, !!u);
}
let W;
function Z(i) {
W = i;
}
function G() {
if (!W)
throw new Error("Function called outside component initialization");
return W;
}
function oe(i) {
G().$$.on_mount.push(i);
}
const he = [],
be = [];
let Se = [];
const re = [],
ye = Promise.resolve();
let Ce = !1;
function Oe() {
Ce || ((Ce = !0), ye.then(se));
}
function Me(i) {
Se.push(i);
}
const pt = new Set();
let Ke = 0;
function se() {
if (Ke !== 0) return;
const i = W;
do {
try {
for (; Ke < he.length; ) {
const a = he[Ke];
Ke++, Z(a), Re(a.$$);
}
} catch (a) {
throw ((he.length = 0), (Ke = 0), a);
}
for (Z(null), he.length = 0, Ke = 0; be.length; ) be.pop()();
for (let a = 0; a < Se.length; a += 1) {
const u = Se[a];
pt.has(u) || (pt.add(u), u());
}
Se.length = 0;
} while (he.length);
for (; re.length; ) re.pop()();
(Ce = !1), pt.clear(), Z(i);
}
function Re(i) {
if (i.fragment !== null) {
i.update(), h(i.before_update);
const a = i.dirty;
(i.dirty = [-1]),
i.fragment && i.fragment.p(i.ctx, a),
i.after_update.forEach(Me);
}
}
function Te(i) {
const a = [],
u = [];
Se.forEach((g) => (i.indexOf(g) === -1 ? a.push(g) : u.push(g))),
u.forEach((g) => g()),
(Se = a);
}
const Pe = new Set();
let je;
function yt() {
je = { r: 0, c: [], p: je };
}
function Nt() {
je.r || h(je.c), (je = je.p);
}
function St(i, a) {
i && i.i && (Pe.delete(i), i.i(a));
}
function Yt(i, a, u, g) {
if (i && i.o) {
if (Pe.has(i)) return;
Pe.add(i),
je.c.push(() => {
Pe.delete(i), g && (u && i.d(1), g());
}),
i.o(a);
} else g && g();
}
function Xd(i) {
return (i == null ? void 0 : i.length) !== void 0 ? i : Array.from(i);
}
function Qd(i) {
i && i.c();
}
function Tc(i, a, u) {
const { fragment: g, after_update: b } = i.$$;
g && g.m(a, u),
Me(() => {
const k = i.$$.on_mount.map(f).filter(y);
i.$$.on_destroy ? i.$$.on_destroy.push(...k) : h(k),
(i.$$.on_mount = []);
}),
b.forEach(Me);
}
function Pc(i, a) {
const u = i.$$;
u.fragment !== null &&
(Te(u.after_update),
h(u.on_destroy),
u.fragment && u.fragment.d(a),
(u.on_destroy = u.fragment = null),
(u.ctx = []));
}
function Bm(i, a) {
i.$$.dirty[0] === -1 && (he.push(i), Oe(), i.$$.dirty.fill(0)),
(i.$$.dirty[(a / 31) | 0] |= 1 << a % 31);
}
function ef(i, a, u, g, b, k, B = null, H = [-1]) {
const U = W;
Z(i);
const j = (i.$$ = {
fragment: null,
ctx: [],
props: k,
update: c,
not_equal: b,
bound: d(),
on_mount: [],
on_destroy: [],
on_disconnect: [],
before_update: [],
after_update: [],
context: new Map(a.context || (U ? U.$$.context : [])),
callbacks: d(),
dirty: H,
skip_bound: !1,
root: a.target || U.$$.root,
});
B && B(j.root);
let F = !1;
if (
((j.ctx = u
? u(i, a.props || {}, (V, X, ...J) => {
const ee = J.length ? J[0] : X;
return (
j.ctx &&
b(j.ctx[V], (j.ctx[V] = ee)) &&
(!j.skip_bound && j.bound[V] && j.bound[V](ee),
F && Bm(i, V)),
X
);
})
: []),
j.update(),
(F = !0),
h(j.before_update),
(j.fragment = g ? g(j.ctx) : !1),
a.target)
) {
if (a.hydrate) {
const V = z(a.target);
j.fragment && j.fragment.l(V), V.forEach(l);
} else j.fragment && j.fragment.c();
a.intro && St(i.$$.fragment), Tc(i, a.target, a.anchor), se();
}
Z(U);
}
class tf {
constructor() {
ae(this, "$$"), ae(this, "$$set");
}
$destroy() {
Pc(this, 1), (this.$destroy = c);
}
$on(a, u) {
if (!y(u)) return c;
const g = this.$$.callbacks[a] || (this.$$.callbacks[a] = []);
return (
g.push(u),
() => {
const b = g.indexOf(u);
b !== -1 && g.splice(b, 1);
}
);
}
$set(a) {
this.$$set &&
!C(a) &&
((this.$$.skip_bound = !0),
this.$$set(a),
(this.$$.skip_bound = !1));
}
}
const Cm = "4";
typeof window < "u" &&
(window.__svelte || (window.__svelte = { v: new Set() })).v.add(Cm);
function Im(i) {
return i &&
i.__esModule &&
Object.prototype.hasOwnProperty.call(i, "default")
? i.default
: i;
}
var Lc = { exports: {} };
function nf(i, a = 100, u = {}) {
if (typeof i != "function")
throw new TypeError(
`Expected the first parameter to be a function, got \`${typeof i}\`.`
);
if (a < 0) throw new RangeError("`wait` must not be negative.");
const { immediate: g } = typeof u == "boolean" ? { immediate: u } : u;
let b, k, B, H, U;
function j() {
const V = Date.now() - H;
if (V < a && V >= 0) B = setTimeout(j, a - V);
else if (((B = void 0), !g)) {
const X = b,
J = k;
(b = void 0), (k = void 0), (U = i.apply(X, J));
}
}
const F = function (...V) {
if (b && this !== b)
throw new Error(
"Debounced method called with different contexts."
);
(b = this), (k = V), (H = Date.now());
const X = g && !B;
if ((B || (B = setTimeout(j, a)), X)) {
const J = b,
ee = k;
(b = void 0), (k = void 0), (U = i.apply(J, ee));
}
return U;
};
return (
(F.clear = () => {
B && (clearTimeout(B), (B = void 0));
}),
(F.flush = () => {
if (!B) return;
const V = b,
X = k;
(b = void 0),
(k = void 0),
(U = i.apply(V, X)),
clearTimeout(B),
(B = void 0);
}),
F
);
}
(Lc.exports.debounce = nf), (Lc.exports = nf);
var Om = Lc.exports;
const rf = Im(Om),
Bc =
typeof globalThis == "object" && "crypto" in globalThis
? globalThis.crypto
: void 0;
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const of =
(i) => i instanceof Uint8Array,
Cc = (i) => new DataView(i.buffer, i.byteOffset, i.byteLength),
_n = (i, a) => (i << (32 - a)) | (i >>> a);
if (new Uint8Array(new Uint32Array([287454020]).buffer)[0] !== 68)
throw new Error("Non little-endian hardware is not supported");
const Nm = Array.from({ length: 256 }, (i, a) =>
a.toString(16).padStart(2, "0")
);
function Rt(i) {
if (!of(i)) throw new Error("Uint8Array expected");
let a = "";
for (let u = 0; u < i.length; u++) a += Nm[i[u]];
return a;
}
function Ic(i) {
if (typeof i != "string")
throw new Error("hex string expected, got " + typeof i);
const a = i.length;
if (a % 2)
throw new Error(
"padded hex string expected, got unpadded hex of length " + a
);
const u = new Uint8Array(a / 2);
for (let g = 0; g < u.length; g++) {
const b = g * 2,
k = i.slice(b, b + 2),
B = Number.parseInt(k, 16);
if (Number.isNaN(B) || B < 0)
throw new Error("Invalid byte sequence");
u[g] = B;
}
return u;
}
function Rm(i) {
if (typeof i != "string")
throw new Error(`utf8ToBytes expected string, got ${typeof i}`);
return new Uint8Array(new TextEncoder().encode(i));
}
function sf(i) {
if ((typeof i == "string" && (i = Rm(i)), !of(i)))
throw new Error(`expected Uint8Array, got ${typeof i}`);
return i;
}
let zm = class {
clone() {
return this._cloneInto();
}
};
function af(i) {
const a = (g) => i().update(sf(g)).digest(),
u = i();
return (
(a.outputLen = u.outputLen),
(a.blockLen = u.blockLen),
(a.create = () => i()),
a
);
}
function Um(i = 32) {
if (Bc && typeof Bc.getRandomValues == "function")
return Bc.getRandomValues(new Uint8Array(i));
throw new Error("crypto.getRandomValues must be defined");
}
function cf(i) {
if (!Number.isSafeInteger(i) || i < 0)
throw new Error(`Wrong positive integer: ${i}`);
}
function uf(i, ...a) {
if (!(i instanceof Uint8Array))
throw new Error("Expected Uint8Array");
if (a.length > 0 && !a.includes(i.length))
throw new Error(
`Expected Uint8Array of length ${a}, not of length=${i.length}`
);
}
function Mm(i) {
if (typeof i != "function" || typeof i.create != "function")
throw new Error("Hash should be wrapped by utils.wrapConstructor");
cf(i.outputLen), cf(i.blockLen);
}
function xs(i, a = !0) {
if (i.destroyed) throw new Error("Hash instance has been destroyed");
if (a && i.finished)
throw new Error("Hash#digest() has already been called");
}
function Hm(i, a) {
uf(i);
const u = a.outputLen;
if (i.length < u)
throw new Error(
`digestInto() expects output buffer of length at least ${u}`
);
}
const Oc =
typeof globalThis == "object" && "crypto" in globalThis
? globalThis.crypto
: void 0;
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const lf =
(i) => i instanceof Uint8Array,
Nc = (i) => new DataView(i.buffer, i.byteOffset, i.byteLength),
En = (i, a) => (i << (32 - a)) | (i >>> a);
if (new Uint8Array(new Uint32Array([287454020]).buffer)[0] !== 68)
throw new Error("Non little-endian hardware is not supported");
function jm(i) {
if (typeof i != "string")
throw new Error(`utf8ToBytes expected string, got ${typeof i}`);
return new Uint8Array(new TextEncoder().encode(i));
}
function Rc(i) {
if ((typeof i == "string" && (i = jm(i)), !lf(i)))
throw new Error(`expected Uint8Array, got ${typeof i}`);
return i;
}
function Dm(...i) {
const a = new Uint8Array(i.reduce((g, b) => g + b.length, 0));
let u = 0;
return (
i.forEach((g) => {
if (!lf(g)) throw new Error("Uint8Array expected");
a.set(g, u), (u += g.length);
}),
a
);
}
class df {
clone() {
return this._cloneInto();
}
}
function qm(i) {
const a = (g) => i().update(Rc(g)).digest(),
u = i();
return (
(a.outputLen = u.outputLen),
(a.blockLen = u.blockLen),
(a.create = () => i()),
a
);
}
function ff(i = 32) {
if (Oc && typeof Oc.getRandomValues == "function")
return Oc.getRandomValues(new Uint8Array(i));
throw new Error("crypto.getRandomValues must be defined");
}
function Vm(i, a, u, g) {
if (typeof i.setBigUint64 == "function")
return i.setBigUint64(a, u, g);
const b = BigInt(32),
k = BigInt(4294967295),
B = Number((u >> b) & k),
H = Number(u & k),
U = g ? 4 : 0,
j = g ? 0 : 4;
i.setUint32(a + U, B, g), i.setUint32(a + j, H, g);
}
let Fm = class extends df {
constructor(i, a, u, g) {
super(),
(this.blockLen = i),
(this.outputLen = a),
(this.padOffset = u),
(this.isLE = g),
(this.finished = !1),
(this.length = 0),
(this.pos = 0),
(this.destroyed = !1),
(this.buffer = new Uint8Array(i)),
(this.view = Nc(this.buffer));
}
update(i) {
xs(this);
const { view: a, buffer: u, blockLen: g } = this;
i = Rc(i);
const b = i.length;
for (let k = 0; k < b; ) {
const B = Math.min(g - this.pos, b - k);
if (B === g) {
const H = Nc(i);
for (; g <= b - k; k += g) this.process(H, k);
continue;
}
u.set(i.subarray(k, k + B), this.pos),
(this.pos += B),
(k += B),
this.pos === g && (this.process(a, 0), (this.pos = 0));
}
return (this.length += i.length), this.roundClean(), this;
}
digestInto(i) {
xs(this), Hm(i, this), (this.finished = !0);
const { buffer: a, view: u, blockLen: g, isLE: b } = this;
let { pos: k } = this;
(a[k++] = 128),
this.buffer.subarray(k).fill(0),
this.padOffset > g - k && (this.process(u, 0), (k = 0));
for (let F = k; F < g; F++) a[F] = 0;
Vm(u, g - 8, BigInt(this.length * 8), b), this.process(u, 0);
const B = Nc(i),
H = this.outputLen;
if (H % 4)
throw new Error("_sha2: outputLen should be aligned to 32bit");
const U = H / 4,
j = this.get();
if (U > j.length)
throw new Error("_sha2: outputLen bigger than state");
for (let F = 0; F < U; F++) B.setUint32(4 * F, j[F], b);
}
digest() {
const { buffer: i, outputLen: a } = this;
this.digestInto(i);
const u = i.slice(0, a);
return this.destroy(), u;
}
_cloneInto(i) {
i || (i = new this.constructor()), i.set(...this.get());
const {
blockLen: a,
buffer: u,
length: g,
finished: b,
destroyed: k,
pos: B,
} = this;
return (
(i.length = g),
(i.pos = B),
(i.finished = b),
(i.destroyed = k),
g % a && i.buffer.set(u),
i
);
}
};
const Km = (i, a, u) => (i & a) ^ (~i & u),
Wm = (i, a, u) => (i & a) ^ (i & u) ^ (a & u),
Gm = new Uint32Array([
1116352408, 1899447441, 3049323471, 3921009573, 961987163,
1508970993, 2453635748, 2870763221, 3624381080, 310598401,
607225278, 1426881987, 1925078388, 2162078206, 2614888103,
3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983,
1249150122, 1555081692, 1996064986, 2554220882, 2821834349,
2952996808, 3210313671, 3336571891, 3584528711, 113926993,
338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700,
1986661051, 2177026350, 2456956037, 2730485921, 2820302411,
3259730800, 3345764771, 3516065817, 3600352804, 4094571909,
275423344, 430227734, 506948616, 659060556, 883997877, 958139571,
1322822218, 1537002063, 1747873779, 1955562222, 2024104815,
2227730452, 2361852424, 2428436474, 2756734187, 3204031479,
3329325298,
]),
yr = new Uint32Array([
1779033703, 3144134277, 1013904242, 2773480762, 1359893119,
2600822924, 528734635, 1541459225,
]),
vr = new Uint32Array(64);
let Zm = class extends Fm {
constructor() {
super(64, 32, 8, !1),
(this.A = yr[0] | 0),
(this.B = yr[1] | 0),
(this.C = yr[2] | 0),
(this.D = yr[3] | 0),
(this.E = yr[4] | 0),
(this.F = yr[5] | 0),
(this.G = yr[6] | 0),
(this.H = yr[7] | 0);
}
get() {
const { A: i, B: a, C: u, D: g, E: b, F: k, G: B, H } = this;
return [i, a, u, g, b, k, B, H];
}
set(i, a, u, g, b, k, B, H) {
(this.A = i | 0),
(this.B = a | 0),
(this.C = u | 0),
(this.D = g | 0),
(this.E = b | 0),
(this.F = k | 0),
(this.G = B | 0),
(this.H = H | 0);
}
process(i, a) {
for (let F = 0; F < 16; F++, a += 4) vr[F] = i.getUint32(a, !1);
for (let F = 16; F < 64; F++) {
const V = vr[F - 15],
X = vr[F - 2],
J = En(V, 7) ^ En(V, 18) ^ (V >>> 3),
ee = En(X, 17) ^ En(X, 19) ^ (X >>> 10);
vr[F] = (ee + vr[F - 7] + J + vr[F - 16]) | 0;
}
let { A: u, B: g, C: b, D: k, E: B, F: H, G: U, H: j } = this;
for (let F = 0; F < 64; F++) {
const V = En(B, 6) ^ En(B, 11) ^ En(B, 25),
X = (j + V + Km(B, H, U) + Gm[F] + vr[F]) | 0,
J = ((En(u, 2) ^ En(u, 13) ^ En(u, 22)) + Wm(u, g, b)) | 0;
(j = U),
(U = H),
(H = B),
(B = (k + X) | 0),
(k = b),
(b = g),
(g = u),
(u = (X + J) | 0);
}
(u = (u + this.A) | 0),
(g = (g + this.B) | 0),
(b = (b + this.C) | 0),
(k = (k + this.D) | 0),
(B = (B + this.E) | 0),
(H = (H + this.F) | 0),
(U = (U + this.G) | 0),
(j = (j + this.H) | 0),
this.set(u, g, b, k, B, H, U, j);
}
roundClean() {
vr.fill(0);
}
destroy() {
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
}
};
const zc = qm(() => new Zm());
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const hf =
BigInt(0),
Ts = BigInt(1),
Ym = BigInt(2),
Ps = (i) => i instanceof Uint8Array,
Jm = Array.from({ length: 256 }, (i, a) =>
a.toString(16).padStart(2, "0")
);
function Ho(i) {
if (!Ps(i)) throw new Error("Uint8Array expected");
let a = "";
for (let u = 0; u < i.length; u++) a += Jm[i[u]];
return a;
}
function pf(i) {
const a = i.toString(16);
return a.length & 1 ? `0${a}` : a;
}
function Uc(i) {
if (typeof i != "string")
throw new Error("hex string expected, got " + typeof i);
return BigInt(i === "" ? "0" : `0x${i}`);
}
function jo(i) {
if (typeof i != "string")
throw new Error("hex string expected, got " + typeof i);
const a = i.length;
if (a % 2)
throw new Error(
"padded hex string expected, got unpadded hex of length " + a
);
const u = new Uint8Array(a / 2);
for (let g = 0; g < u.length; g++) {
const b = g * 2,
k = i.slice(b, b + 2),
B = Number.parseInt(k, 16);
if (Number.isNaN(B) || B < 0)
throw new Error("Invalid byte sequence");
u[g] = B;
}
return u;
}
function Ht(i) {
return Uc(Ho(i));
}
function Mc(i) {
if (!Ps(i)) throw new Error("Uint8Array expected");
return Uc(Ho(Uint8Array.from(i).reverse()));
}
function _r(i, a) {
return jo(i.toString(16).padStart(a * 2, "0"));
}
function Hc(i, a) {
return _r(i, a).reverse();
}
function Xm(i) {
return jo(pf(i));
}
function $t(i, a, u) {
let g;
if (typeof a == "string")
try {
g = jo(a);
} catch (k) {
throw new Error(
`${i} must be valid hex string, got "${a}". Cause: ${k}`
);
}
else if (Ps(a)) g = Uint8Array.from(a);
else throw new Error(`${i} must be hex string or Uint8Array`);
const b = g.length;
if (typeof u == "number" && b !== u)
throw new Error(`${i} expected ${u} bytes, got ${b}`);
return g;
}
function fo(...i) {
const a = new Uint8Array(i.reduce((g, b) => g + b.length, 0));
let u = 0;
return (
i.forEach((g) => {
if (!Ps(g)) throw new Error("Uint8Array expected");
a.set(g, u), (u += g.length);
}),
a
);
}
function Qm(i, a) {
if (i.length !== a.length) return !1;
for (let u = 0; u < i.length; u++) if (i[u] !== a[u]) return !1;
return !0;
}
function eb(i) {
if (typeof i != "string")
throw new Error(`utf8ToBytes expected string, got ${typeof i}`);
return new Uint8Array(new TextEncoder().encode(i));
}
function tb(i) {
let a;
for (a = 0; i > hf; i >>= Ts, a += 1);
return a;
}
function nb(i, a) {
return (i >> BigInt(a)) & Ts;
}
const rb = (i, a, u) => i | ((u ? Ts : hf) << BigInt(a)),
jc = (i) => (Ym << BigInt(i - 1)) - Ts,
Dc = (i) => new Uint8Array(i),
gf = (i) => Uint8Array.from(i);
function wf(i, a, u) {
if (typeof i != "number" || i < 2)
throw new Error("hashLen must be a number");
if (typeof a != "number" || a < 2)
throw new Error("qByteLen must be a number");
if (typeof u != "function")
throw new Error("hmacFn must be a function");
let g = Dc(i),
b = Dc(i),
k = 0;
const B = () => {
g.fill(1), b.fill(0), (k = 0);
},
H = (...F) => u(b, g, ...F),
U = (F = Dc()) => {
(b = H(gf([0]), F)),
(g = H()),
F.length !== 0 && ((b = H(gf([1]), F)), (g = H()));
},
j = () => {
if (k++ >= 1e3) throw new Error("drbg: tried 1000 values");
let F = 0;
const V = [];
for (; F < a; ) {
g = H();
const X = g.slice();
V.push(X), (F += g.length);
}
return fo(...V);
};
return (F, V) => {
B(), U(F);
let X;
for (; !(X = V(j())); ) U();
return B(), X;
};
}
const ob = {
bigint: (i) => typeof i == "bigint",
function: (i) => typeof i == "function",
boolean: (i) => typeof i == "boolean",
string: (i) => typeof i == "string",
stringOrUint8Array: (i) =>
typeof i == "string" || i instanceof Uint8Array,
isSafeInteger: (i) => Number.isSafeInteger(i),
array: (i) => Array.isArray(i),
field: (i, a) => a.Fp.isValid(i),
hash: (i) =>
typeof i == "function" && Number.isSafeInteger(i.outputLen),
};
function Ni(i, a, u = {}) {
const g = (b, k, B) => {
const H = ob[k];
if (typeof H != "function")
throw new Error(`Invalid validator "${k}", expected function`);
const U = i[b];
if (!(B && U === void 0) && !H(U, i))
throw new Error(
`Invalid param ${String(b)}=${U} (${typeof U}), expected ${k}`
);
};
for (const [b, k] of Object.entries(a)) g(b, k, !1);
for (const [b, k] of Object.entries(u)) g(b, k, !0);
return i;
}
const ib = Object.freeze(
Object.defineProperty(
{
__proto__: null,
bitGet: nb,
bitLen: tb,
bitMask: jc,
bitSet: rb,
bytesToHex: Ho,
bytesToNumberBE: Ht,
bytesToNumberLE: Mc,
concatBytes: fo,
createHmacDrbg: wf,
ensureBytes: $t,
equalBytes: Qm,
hexToBytes: jo,
hexToNumber: Uc,
numberToBytesBE: _r,
numberToBytesLE: Hc,
numberToHexUnpadded: pf,
numberToVarBytesBE: Xm,
utf8ToBytes: eb,
validateObject: Ni,
},
Symbol.toStringTag,
{ value: "Module" }
)
);
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const gt =
BigInt(0),
nt = BigInt(1),
ho = BigInt(2),
sb = BigInt(3),
qc = BigInt(4),
mf = BigInt(5),
bf = BigInt(8);
BigInt(9), BigInt(16);
function vt(i, a) {
const u = i % a;
return u >= gt ? u : a + u;
}
function ab(i, a, u) {
if (u <= gt || a < gt) throw new Error("Expected power/modulo > 0");
if (u === nt) return gt;
let g = nt;
for (; a > gt; )
a & nt && (g = (g * i) % u), (i = (i * i) % u), (a >>= nt);
return g;
}
function Jt(i, a, u) {
let g = i;
for (; a-- > gt; ) (g *= g), (g %= u);
return g;
}
function Vc(i, a) {
if (i === gt || a <= gt)
throw new Error(
`invert: expected positive integers, got n=${i} mod=${a}`
);
let u = vt(i, a),
g = a,
b = gt,
k = nt;
for (; u !== gt; ) {
const B = g / u,
H = g % u,
U = b - k * B;
(g = u), (u = H), (b = k), (k = U);
}
if (g !== nt) throw new Error("invert: does not exist");
return vt(b, a);
}
function cb(i) {
const a = (i - nt) / ho;
let u, g, b;
for (u = i - nt, g = 0; u % ho === gt; u /= ho, g++);
for (b = ho; b < i && ab(b, a, i) !== i - nt; b++);
if (g === 1) {
const B = (i + nt) / qc;
return function (H, U) {
const j = H.pow(U, B);
if (!H.eql(H.sqr(j), U))
throw new Error("Cannot find square root");
return j;
};
}
const k = (u + nt) / ho;
return function (B, H) {
if (B.pow(H, a) === B.neg(B.ONE))
throw new Error("Cannot find square root");
let U = g,
j = B.pow(B.mul(B.ONE, b), u),
F = B.pow(H, k),
V = B.pow(H, u);
for (; !B.eql(V, B.ONE); ) {
if (B.eql(V, B.ZERO)) return B.ZERO;
let X = 1;
for (let ee = B.sqr(V); X < U && !B.eql(ee, B.ONE); X++)
ee = B.sqr(ee);
const J = B.pow(j, nt << BigInt(U - X - 1));
(j = B.sqr(J)), (F = B.mul(F, J)), (V = B.mul(V, j)), (U = X);
}
return F;
};
}
function ub(i) {
if (i % qc === sb) {
const a = (i + nt) / qc;
return function (u, g) {
const b = u.pow(g, a);
if (!u.eql(u.sqr(b), g))
throw new Error("Cannot find square root");
return b;
};
}
if (i % bf === mf) {
const a = (i - mf) / bf;
return function (u, g) {
const b = u.mul(g, ho),
k = u.pow(b, a),
B = u.mul(g, k),
H = u.mul(u.mul(B, ho), k),
U = u.mul(B, u.sub(H, u.ONE));
if (!u.eql(u.sqr(U), g))
throw new Error("Cannot find square root");
return U;
};
}
return cb(i);
}
const lb = [
"create",
"isValid",
"is0",
"neg",
"inv",
"sqrt",
"sqr",
"eql",
"add",
"sub",
"mul",
"pow",
"div",
"addN",
"subN",
"mulN",
"sqrN",
];
function db(i) {
const a = {
ORDER: "bigint",
MASK: "bigint",
BYTES: "isSafeInteger",
BITS: "isSafeInteger",
},
u = lb.reduce((g, b) => ((g[b] = "function"), g), a);
return Ni(i, u);
}
function fb(i, a, u) {
if (u < gt) throw new Error("Expected power > 0");
if (u === gt) return i.ONE;
if (u === nt) return a;
let g = i.ONE,
b = a;
for (; u > gt; )
u & nt && (g = i.mul(g, b)), (b = i.sqr(b)), (u >>= nt);
return g;
}
function hb(i, a) {
const u = new Array(a.length),
g = a.reduce(
(k, B, H) => (i.is0(B) ? k : ((u[H] = k), i.mul(k, B))),
i.ONE
),
b = i.inv(g);
return (
a.reduceRight(
(k, B, H) =>
i.is0(B) ? k : ((u[H] = i.mul(k, u[H])), i.mul(k, B)),
b
),
u
);
}
function yf(i, a) {
const u = a !== void 0 ? a : i.toString(2).length,
g = Math.ceil(u / 8);
return { nBitLength: u, nByteLength: g };
}
function pb(i, a, u = !1, g = {}) {
if (i <= gt) throw new Error(`Expected Field ORDER > 0, got ${i}`);
const { nBitLength: b, nByteLength: k } = yf(i, a);
if (k > 2048)
throw new Error("Field lengths over 2048 bytes are not supported");
const B = ub(i),
H = Object.freeze({
ORDER: i,
BITS: b,
BYTES: k,
MASK: jc(b),
ZERO: gt,
ONE: nt,
create: (U) => vt(U, i),
isValid: (U) => {
if (typeof U != "bigint")
throw new Error(
`Invalid field element: expected bigint, got ${typeof U}`
);
return gt <= U && U < i;
},
is0: (U) => U === gt,
isOdd: (U) => (U & nt) === nt,
neg: (U) => vt(-U, i),
eql: (U, j) => U === j,
sqr: (U) => vt(U * U, i),
add: (U, j) => vt(U + j, i),
sub: (U, j) => vt(U - j, i),
mul: (U, j) => vt(U * j, i),
pow: (U, j) => fb(H, U, j),
div: (U, j) => vt(U * Vc(j, i), i),
sqrN: (U) => U * U,
addN: (U, j) => U + j,
subN: (U, j) => U - j,
mulN: (U, j) => U * j,
inv: (U) => Vc(U, i),
sqrt: g.sqrt || ((U) => B(H, U)),
invertBatch: (U) => hb(H, U),
cmov: (U, j, F) => (F ? j : U),
toBytes: (U) => (u ? Hc(U, k) : _r(U, k)),
fromBytes: (U) => {
if (U.length !== k)
throw new Error(
`Fp.fromBytes: expected ${k}, got ${U.length}`
);
return u ? Mc(U) : Ht(U);
},
});
return Object.freeze(H);
}
function vf(i) {
if (typeof i != "bigint")
throw new Error("field order must be bigint");
const a = i.toString(2).length;
return Math.ceil(a / 8);
}
function _f(i) {
const a = vf(i);
return a + Math.ceil(a / 2);
}
function gb(i, a, u = !1) {
const g = i.length,
b = vf(a),
k = _f(a);
if (g < 16 || g < k || g > 1024)
throw new Error(`expected ${k}-1024 bytes of input, got ${g}`);
const B = u ? Ht(i) : Mc(i),
H = vt(B, a - nt) + nt;
return u ? Hc(H, b) : _r(H, b);
}
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const wb =
BigInt(0),
Fc = BigInt(1);
function mb(i, a) {
const u = (b, k) => {
const B = k.negate();
return b ? B : k;
},
g = (b) => {
const k = Math.ceil(a / b) + 1,
B = 2 ** (b - 1);
return { windows: k, windowSize: B };
};
return {
constTimeNegate: u,
unsafeLadder(b, k) {
let B = i.ZERO,
H = b;
for (; k > wb; )
k & Fc && (B = B.add(H)), (H = H.double()), (k >>= Fc);
return B;
},
precomputeWindow(b, k) {
const { windows: B, windowSize: H } = g(k),
U = [];
let j = b,
F = j;
for (let V = 0; V < B; V++) {
(F = j), U.push(F);
for (let X = 1; X < H; X++) (F = F.add(j)), U.push(F);
j = F.double();
}
return U;
},
wNAF(b, k, B) {
const { windows: H, windowSize: U } = g(b);
let j = i.ZERO,
F = i.BASE;
const V = BigInt(2 ** b - 1),
X = 2 ** b,
J = BigInt(b);
for (let ee = 0; ee < H; ee++) {
const Y = ee * U;
let te = Number(B & V);
(B >>= J), te > U && ((te -= X), (B += Fc));
const ne = Y,
Q = Y + Math.abs(te) - 1,
ue = ee % 2 !== 0,
_e = te < 0;
te === 0 ? (F = F.add(u(ue, k[ne]))) : (j = j.add(u(_e, k[Q])));
}
return { p: j, f: F };
},
wNAFCached(b, k, B, H) {
const U = b._WINDOW_SIZE || 1;
let j = k.get(b);
return (
j ||
((j = this.precomputeWindow(b, U)),
U !== 1 && k.set(b, H(j))),
this.wNAF(U, j, B)
);
},
};
}
function Ef(i) {
return (
db(i.Fp),
Ni(
i,
{ n: "bigint", h: "bigint", Gx: "field", Gy: "field" },
{ nBitLength: "isSafeInteger", nByteLength: "isSafeInteger" }
),
Object.freeze({ ...yf(i.n, i.nBitLength), ...i, p: i.Fp.ORDER })
);
}
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ function bb(
i
) {
const a = Ef(i);
Ni(
a,
{ a: "field", b: "field" },
{
allowedPrivateKeyLengths: "array",
wrapPrivateKey: "boolean",
isTorsionFree: "function",
clearCofactor: "function",
allowInfinityPoint: "boolean",
fromBytes: "function",
toBytes: "function",
}
);
const { endo: u, Fp: g, a: b } = a;
if (u) {
if (!g.eql(b, g.ZERO))
throw new Error(
"Endomorphism can only be defined for Koblitz curves that have a=0"
);
if (
typeof u != "object" ||
typeof u.beta != "bigint" ||
typeof u.splitScalar != "function"
)
throw new Error(
"Expected endomorphism with beta: bigint and splitScalar: function"
);
}
return Object.freeze({ ...a });
}
const { bytesToNumberBE: yb, hexToBytes: vb } = ib,
po = {
Err: class extends Error {
constructor(i = "") {
super(i);
}
},
_parseInt(i) {
const { Err: a } = po;
if (i.length < 2 || i[0] !== 2)
throw new a("Invalid signature integer tag");
const u = i[1],
g = i.subarray(2, u + 2);
if (!u || g.length !== u)
throw new a("Invalid signature integer: wrong length");
if (g[0] & 128)
throw new a("Invalid signature integer: negative");
if (g[0] === 0 && !(g[1] & 128))
throw new a(
"Invalid signature integer: unnecessary leading zero"
);
return { d: yb(g), l: i.subarray(u + 2) };
},
toSig(i) {
const { Err: a } = po,
u = typeof i == "string" ? vb(i) : i;
if (!(u instanceof Uint8Array)) throw new Error("ui8a expected");
let g = u.length;
if (g < 2 || u[0] != 48) throw new a("Invalid signature tag");
if (u[1] !== g - 2)
throw new a("Invalid signature: incorrect length");
const { d: b, l: k } = po._parseInt(u.subarray(2)),
{ d: B, l: H } = po._parseInt(k);
if (H.length)
throw new a("Invalid signature: left bytes after parsing");
return { r: b, s: B };
},
hexFromSig(i) {
const a = (j) => (Number.parseInt(j[0], 16) & 8 ? "00" + j : j),
u = (j) => {
const F = j.toString(16);
return F.length & 1 ? `0${F}` : F;
},
g = a(u(i.s)),
b = a(u(i.r)),
k = g.length / 2,
B = b.length / 2,
H = u(k),
U = u(B);
return `30${u(B + k + 4)}02${U}${b}02${H}${g}`;
},
},
Fn = BigInt(0),
Xt = BigInt(1);
BigInt(2);
const kf = BigInt(3);
BigInt(4);
function _b(i) {
const a = bb(i),
{ Fp: u } = a,
g =
a.toBytes ||
((ee, Y, te) => {
const ne = Y.toAffine();
return fo(
Uint8Array.from([4]),
u.toBytes(ne.x),
u.toBytes(ne.y)
);
}),
b =
a.fromBytes ||
((ee) => {
const Y = ee.subarray(1),
te = u.fromBytes(Y.subarray(0, u.BYTES)),
ne = u.fromBytes(Y.subarray(u.BYTES, 2 * u.BYTES));
return { x: te, y: ne };
});
function k(ee) {
const { a: Y, b: te } = a,
ne = u.sqr(ee),
Q = u.mul(ne, ee);
return u.add(u.add(Q, u.mul(ee, Y)), te);
}
if (!u.eql(u.sqr(a.Gy), k(a.Gx)))
throw new Error("bad generator point: equation left != right");
function B(ee) {
return typeof ee == "bigint" && Fn < ee && ee < a.n;
}
function H(ee) {
if (!B(ee))
throw new Error("Expected valid bigint: 0 < bigint < curve.n");
}
function U(ee) {
const {
allowedPrivateKeyLengths: Y,
nByteLength: te,
wrapPrivateKey: ne,
n: Q,
} = a;
if (Y && typeof ee != "bigint") {
if (
(ee instanceof Uint8Array && (ee = Ho(ee)),
typeof ee != "string" || !Y.includes(ee.length))
)
throw new Error("Invalid key");
ee = ee.padStart(te * 2, "0");
}
let ue;
try {
ue = typeof ee == "bigint" ? ee : Ht($t("private key", ee, te));
} catch {
throw new Error(
`private key must be ${te} bytes, hex or bigint, not ${typeof ee}`
);
}
return ne && (ue = vt(ue, Q)), H(ue), ue;
}
const j = new Map();
function F(ee) {
if (!(ee instanceof V)) throw new Error("ProjectivePoint expected");
}
class V {
constructor(Y, te, ne) {
if (
((this.px = Y),
(this.py = te),
(this.pz = ne),
Y == null || !u.isValid(Y))
)
throw new Error("x required");
if (te == null || !u.isValid(te)) throw new Error("y required");
if (ne == null || !u.isValid(ne)) throw new Error("z required");
}
static fromAffine(Y) {
const { x: te, y: ne } = Y || {};
if (!Y || !u.isValid(te) || !u.isValid(ne))
throw new Error("invalid affine point");
if (Y instanceof V)
throw new Error("projective point not allowed");
const Q = (ue) => u.eql(ue, u.ZERO);
return Q(te) && Q(ne) ? V.ZERO : new V(te, ne, u.ONE);
}
get x() {
return this.toAffine().x;
}
get y() {
return this.toAffine().y;
}
static normalizeZ(Y) {
const te = u.invertBatch(Y.map((ne) => ne.pz));
return Y.map((ne, Q) => ne.toAffine(te[Q])).map(V.fromAffine);
}
static fromHex(Y) {
const te = V.fromAffine(b($t("pointHex", Y)));
return te.assertValidity(), te;
}
static fromPrivateKey(Y) {
return V.BASE.multiply(U(Y));
}
_setWindowSize(Y) {
(this._WINDOW_SIZE = Y), j.delete(this);
}
assertValidity() {
if (this.is0()) {
if (a.allowInfinityPoint && !u.is0(this.py)) return;
throw new Error("bad point: ZERO");
}
const { x: Y, y: te } = this.toAffine();
if (!u.isValid(Y) || !u.isValid(te))
throw new Error("bad point: x or y not FE");
const ne = u.sqr(te),
Q = k(Y);
if (!u.eql(ne, Q))
throw new Error("bad point: equation left != right");
if (!this.isTorsionFree())
throw new Error("bad point: not in prime-order subgroup");
}
hasEvenY() {
const { y: Y } = this.toAffine();
if (u.isOdd) return !u.isOdd(Y);
throw new Error("Field doesn't support isOdd");
}
equals(Y) {
F(Y);
const { px: te, py: ne, pz: Q } = this,
{ px: ue, py: _e, pz: Ae } = Y,
le = u.eql(u.mul(te, Ae), u.mul(ue, Q)),
ce = u.eql(u.mul(ne, Ae), u.mul(_e, Q));
return le && ce;
}
negate() {
return new V(this.px, u.neg(this.py), this.pz);
}
double() {
const { a: Y, b: te } = a,
ne = u.mul(te, kf),
{ px: Q, py: ue, pz: _e } = this;
let Ae = u.ZERO,
le = u.ZERO,
ce = u.ZERO,
ie = u.mul(Q, Q),
fe = u.mul(ue, ue),
$e = u.mul(_e, _e),
Le = u.mul(Q, ue);
return (
(Le = u.add(Le, Le)),
(ce = u.mul(Q, _e)),
(ce = u.add(ce, ce)),
(Ae = u.mul(Y, ce)),
(le = u.mul(ne, $e)),
(le = u.add(Ae, le)),
(Ae = u.sub(fe, le)),
(le = u.add(fe, le)),
(le = u.mul(Ae, le)),
(Ae = u.mul(Le, Ae)),
(ce = u.mul(ne, ce)),
($e = u.mul(Y, $e)),
(Le = u.sub(ie, $e)),
(Le = u.mul(Y, Le)),
(Le = u.add(Le, ce)),
(ce = u.add(ie, ie)),
(ie = u.add(ce, ie)),
(ie = u.add(ie, $e)),
(ie = u.mul(ie, Le)),
(le = u.add(le, ie)),
($e = u.mul(ue, _e)),
($e = u.add($e, $e)),
(ie = u.mul($e, Le)),
(Ae = u.sub(Ae, ie)),
(ce = u.mul($e, fe)),
(ce = u.add(ce, ce)),
(ce = u.add(ce, ce)),
new V(Ae, le, ce)
);
}
add(Y) {
F(Y);
const { px: te, py: ne, pz: Q } = this,
{ px: ue, py: _e, pz: Ae } = Y;
let le = u.ZERO,
ce = u.ZERO,
ie = u.ZERO;
const fe = a.a,
$e = u.mul(a.b, kf);
let Le = u.mul(te, ue),
at = u.mul(ne, _e),
ct = u.mul(Q, Ae),
ut = u.add(te, ne),
de = u.add(ue, _e);
(ut = u.mul(ut, de)),
(de = u.add(Le, at)),
(ut = u.sub(ut, de)),
(de = u.add(te, Q));
let ve = u.add(ue, Ae);
return (
(de = u.mul(de, ve)),
(ve = u.add(Le, ct)),
(de = u.sub(de, ve)),
(ve = u.add(ne, Q)),
(le = u.add(_e, Ae)),
(ve = u.mul(ve, le)),
(le = u.add(at, ct)),
(ve = u.sub(ve, le)),
(ie = u.mul(fe, de)),
(le = u.mul($e, ct)),
(ie = u.add(le, ie)),
(le = u.sub(at, ie)),
(ie = u.add(at, ie)),
(ce = u.mul(le, ie)),
(at = u.add(Le, Le)),
(at = u.add(at, Le)),
(ct = u.mul(fe, ct)),
(de = u.mul($e, de)),
(at = u.add(at, ct)),
(ct = u.sub(Le, ct)),
(ct = u.mul(fe, ct)),
(de = u.add(de, ct)),
(Le = u.mul(at, de)),
(ce = u.add(ce, Le)),
(Le = u.mul(ve, de)),
(le = u.mul(ut, le)),
(le = u.sub(le, Le)),
(Le = u.mul(ut, at)),
(ie = u.mul(ve, ie)),
(ie = u.add(ie, Le)),
new V(le, ce, ie)
);
}
subtract(Y) {
return this.add(Y.negate());
}
is0() {
return this.equals(V.ZERO);
}
wNAF(Y) {
return J.wNAFCached(this, j, Y, (te) => {
const ne = u.invertBatch(te.map((Q) => Q.pz));
return te.map((Q, ue) => Q.toAffine(ne[ue])).map(V.fromAffine);
});
}
multiplyUnsafe(Y) {
const te = V.ZERO;
if (Y === Fn) return te;
if ((H(Y), Y === Xt)) return this;
const { endo: ne } = a;
if (!ne) return J.unsafeLadder(this, Y);
let { k1neg: Q, k1: ue, k2neg: _e, k2: Ae } = ne.splitScalar(Y),
le = te,
ce = te,
ie = this;
for (; ue > Fn || Ae > Fn; )
ue & Xt && (le = le.add(ie)),
Ae & Xt && (ce = ce.add(ie)),
(ie = ie.double()),
(ue >>= Xt),
(Ae >>= Xt);
return (
Q && (le = le.negate()),
_e && (ce = ce.negate()),
(ce = new V(u.mul(ce.px, ne.beta), ce.py, ce.pz)),
le.add(ce)
);
}
multiply(Y) {
H(Y);
let te = Y,
ne,
Q;
const { endo: ue } = a;
if (ue) {
const {
k1neg: _e,
k1: Ae,
k2neg: le,
k2: ce,
} = ue.splitScalar(te);
let { p: ie, f: fe } = this.wNAF(Ae),
{ p: $e, f: Le } = this.wNAF(ce);
(ie = J.constTimeNegate(_e, ie)),
($e = J.constTimeNegate(le, $e)),
($e = new V(u.mul($e.px, ue.beta), $e.py, $e.pz)),
(ne = ie.add($e)),
(Q = fe.add(Le));
} else {
const { p: _e, f: Ae } = this.wNAF(te);
(ne = _e), (Q = Ae);
}
return V.normalizeZ([ne, Q])[0];
}
multiplyAndAddUnsafe(Y, te, ne) {
const Q = V.BASE,
ue = (Ae, le) =>
le === Fn || le === Xt || !Ae.equals(Q)
? Ae.multiplyUnsafe(le)
: Ae.multiply(le),
_e = ue(this, te).add(ue(Y, ne));
return _e.is0() ? void 0 : _e;
}
toAffine(Y) {
const { px: te, py: ne, pz: Q } = this,
ue = this.is0();
Y == null && (Y = ue ? u.ONE : u.inv(Q));
const _e = u.mul(te, Y),
Ae = u.mul(ne, Y),
le = u.mul(Q, Y);
if (ue) return { x: u.ZERO, y: u.ZERO };
if (!u.eql(le, u.ONE)) throw new Error("invZ was invalid");
return { x: _e, y: Ae };
}
isTorsionFree() {
const { h: Y, isTorsionFree: te } = a;
if (Y === Xt) return !0;
if (te) return te(V, this);
throw new Error(
"isTorsionFree() has not been declared for the elliptic curve"
);
}
clearCofactor() {
const { h: Y, clearCofactor: te } = a;
return Y === Xt
? this
: te
? te(V, this)
: this.multiplyUnsafe(a.h);
}
toRawBytes(Y = !0) {
return this.assertValidity(), g(V, this, Y);
}
toHex(Y = !0) {
return Ho(this.toRawBytes(Y));
}
}
(V.BASE = new V(a.Gx, a.Gy, u.ONE)),
(V.ZERO = new V(u.ZERO, u.ONE, u.ZERO));
const X = a.nBitLength,
J = mb(V, a.endo ? Math.ceil(X / 2) : X);
return {
CURVE: a,
ProjectivePoint: V,
normPrivateKeyToScalar: U,
weierstrassEquation: k,
isWithinCurveOrder: B,
};
}
function Eb(i) {
const a = Ef(i);
return (
Ni(
a,
{ hash: "hash", hmac: "function", randomBytes: "function" },
{
bits2int: "function",
bits2int_modN: "function",
lowS: "boolean",
}
),
Object.freeze({ lowS: !0, ...a })
);
}
function kb(i) {
const a = Eb(i),
{ Fp: u, n: g } = a,
b = u.BYTES + 1,
k = 2 * u.BYTES + 1;
function B(de) {
return Fn < de && de < u.ORDER;
}
function H(de) {
return vt(de, g);
}
function U(de) {
return Vc(de, g);
}
const {
ProjectivePoint: j,
normPrivateKeyToScalar: F,
weierstrassEquation: V,
isWithinCurveOrder: X,
} = _b({
...a,
toBytes(de, ve, ze) {
const We = ve.toAffine(),
Ye = u.toBytes(We.x),
qe = fo;
return ze
? qe(Uint8Array.from([ve.hasEvenY() ? 2 : 3]), Ye)
: qe(Uint8Array.from([4]), Ye, u.toBytes(We.y));
},
fromBytes(de) {
const ve = de.length,
ze = de[0],
We = de.subarray(1);
if (ve === b && (ze === 2 || ze === 3)) {
const Ye = Ht(We);
if (!B(Ye)) throw new Error("Point is not on curve");
const qe = V(Ye);
let xt = u.sqrt(qe);
const _t = (xt & Xt) === Xt;
return (
((ze & 1) === 1) !== _t && (xt = u.neg(xt)),
{ x: Ye, y: xt }
);
} else if (ve === k && ze === 4) {
const Ye = u.fromBytes(We.subarray(0, u.BYTES)),
qe = u.fromBytes(We.subarray(u.BYTES, 2 * u.BYTES));
return { x: Ye, y: qe };
} else
throw new Error(
`Point of length ${ve} was invalid. Expected ${b} compressed bytes or ${k} uncompressed bytes`
);
},
}),
J = (de) => Ho(_r(de, a.nByteLength));
function ee(de) {
const ve = g >> Xt;
return de > ve;
}
function Y(de) {
return ee(de) ? H(-de) : de;
}
const te = (de, ve, ze) => Ht(de.slice(ve, ze));
class ne {
constructor(ve, ze, We) {
(this.r = ve),
(this.s = ze),
(this.recovery = We),
this.assertValidity();
}
static fromCompact(ve) {
const ze = a.nByteLength;
return (
(ve = $t("compactSignature", ve, ze * 2)),
new ne(te(ve, 0, ze), te(ve, ze, 2 * ze))
);
}
static fromDER(ve) {
const { r: ze, s: We } = po.toSig($t("DER", ve));
return new ne(ze, We);
}
assertValidity() {
if (!X(this.r)) throw new Error("r must be 0 < r < CURVE.n");
if (!X(this.s)) throw new Error("s must be 0 < s < CURVE.n");
}
addRecoveryBit(ve) {
return new ne(this.r, this.s, ve);
}
recoverPublicKey(ve) {
const { r: ze, s: We, recovery: Ye } = this,
qe = ce($t("msgHash", ve));
if (Ye == null || ![0, 1, 2, 3].includes(Ye))
throw new Error("recovery id invalid");
const xt = Ye === 2 || Ye === 3 ? ze + a.n : ze;
if (xt >= u.ORDER) throw new Error("recovery id 2 or 3 invalid");
const _t = Ye & 1 ? "03" : "02",
jt = j.fromHex(_t + J(xt)),
lt = U(xt),
en = H(-qe * lt),
fn = H(We * lt),
Sn = j.BASE.multiplyAndAddUnsafe(jt, en, fn);
if (!Sn) throw new Error("point at infinify");
return Sn.assertValidity(), Sn;
}
hasHighS() {
return ee(this.s);
}
normalizeS() {
return this.hasHighS()
? new ne(this.r, H(-this.s), this.recovery)
: this;
}
toDERRawBytes() {
return jo(this.toDERHex());
}
toDERHex() {
return po.hexFromSig({ r: this.r, s: this.s });
}
toCompactRawBytes() {
return jo(this.toCompactHex());
}
toCompactHex() {
return J(this.r) + J(this.s);
}
}
const Q = {
isValidPrivateKey(de) {
try {
return F(de), !0;
} catch {
return !1;
}
},
normPrivateKeyToScalar: F,
randomPrivateKey: () => {
const de = _f(a.n);
return gb(a.randomBytes(de), a.n);
},
precompute(de = 8, ve = j.BASE) {
return ve._setWindowSize(de), ve.multiply(BigInt(3)), ve;
},
};
function ue(de, ve = !0) {
return j.fromPrivateKey(de).toRawBytes(ve);
}
function _e(de) {
const ve = de instanceof Uint8Array,
ze = typeof de == "string",
We = (ve || ze) && de.length;
return ve
? We === b || We === k
: ze
? We === 2 * b || We === 2 * k
: de instanceof j;
}
function Ae(de, ve, ze = !0) {
if (_e(de)) throw new Error("first arg must be private key");
if (!_e(ve)) throw new Error("second arg must be public key");
return j.fromHex(ve).multiply(F(de)).toRawBytes(ze);
}
const le =
a.bits2int ||
function (de) {
const ve = Ht(de),
ze = de.length * 8 - a.nBitLength;
return ze > 0 ? ve >> BigInt(ze) : ve;
},
ce =
a.bits2int_modN ||
function (de) {
return H(le(de));
},
ie = jc(a.nBitLength);
function fe(de) {
if (typeof de != "bigint") throw new Error("bigint expected");
if (!(Fn <= de && de < ie))
throw new Error(`bigint expected < 2^${a.nBitLength}`);
return _r(de, a.nByteLength);
}
function $e(de, ve, ze = Le) {
if (["recovered", "canonical"].some((Gt) => Gt in ze))
throw new Error("sign() legacy options not supported");
const { hash: We, randomBytes: Ye } = a;
let { lowS: qe, prehash: xt, extraEntropy: _t } = ze;
qe == null && (qe = !0),
(de = $t("msgHash", de)),
xt && (de = $t("prehashed msgHash", We(de)));
const jt = ce(de),
lt = F(ve),
en = [fe(lt), fe(jt)];
if (_t != null) {
const Gt = _t === !0 ? Ye(u.BYTES) : _t;
en.push($t("extraEntropy", Gt));
}
const fn = fo(...en),
Sn = jt;
function Tr(Gt) {
const Pr = le(Gt);
if (!X(Pr)) return;
const bo = U(Pr),
Zt = j.BASE.multiply(Pr).toAffine(),
Yn = H(Zt.x);
if (Yn === Fn) return;
const yo = H(bo * H(Sn + Yn * lt));
if (yo === Fn) return;
let vo = (Zt.x === Yn ? 0 : 2) | Number(Zt.y & Xt),
Lr = yo;
return (
qe && ee(yo) && ((Lr = Y(yo)), (vo ^= 1)), new ne(Yn, Lr, vo)
);
}
return { seed: fn, k2sig: Tr };
}
const Le = { lowS: a.lowS, prehash: !1 },
at = { lowS: a.lowS, prehash: !1 };
function ct(de, ve, ze = Le) {
const { seed: We, k2sig: Ye } = $e(de, ve, ze),
qe = a;
return wf(qe.hash.outputLen, qe.nByteLength, qe.hmac)(We, Ye);
}
j.BASE._setWindowSize(8);
function ut(de, ve, ze, We = at) {
var Ye;
const qe = de;
if (
((ve = $t("msgHash", ve)),
(ze = $t("publicKey", ze)),
"strict" in We)
)
throw new Error("options.strict was renamed to lowS");
const { lowS: xt, prehash: _t } = We;
let jt, lt;
try {
if (typeof qe == "string" || qe instanceof Uint8Array)
try {
jt = ne.fromDER(qe);
} catch (Zt) {
if (!(Zt instanceof po.Err)) throw Zt;
jt = ne.fromCompact(qe);
}
else if (
typeof qe == "object" &&
typeof qe.r == "bigint" &&
typeof qe.s == "bigint"
) {
const { r: Zt, s: Yn } = qe;
jt = new ne(Zt, Yn);
} else throw new Error("PARSE");
lt = j.fromHex(ze);
} catch (Zt) {
if (Zt.message === "PARSE")
throw new Error(
"signature must be Signature instance, Uint8Array or hex string"
);
return !1;
}
if (xt && jt.hasHighS()) return !1;
_t && (ve = a.hash(ve));
const { r: en, s: fn } = jt,
Sn = ce(ve),
Tr = U(fn),
Gt = H(Sn * Tr),
Pr = H(en * Tr),
bo =
(Ye = j.BASE.multiplyAndAddUnsafe(lt, Gt, Pr)) == null
? void 0
: Ye.toAffine();
return bo ? H(bo.x) === en : !1;
}
return {
CURVE: a,
getPublicKey: ue,
getSharedSecret: Ae,
sign: ct,
verify: ut,
ProjectivePoint: j,
Signature: ne,
utils: Q,
};
}
class Af extends df {
constructor(a, u) {
super(), (this.finished = !1), (this.destroyed = !1), Mm(a);
const g = Rc(u);
if (
((this.iHash = a.create()),
typeof this.iHash.update != "function")
)
throw new Error(
"Expected instance of class which extends utils.Hash"
);
(this.blockLen = this.iHash.blockLen),
(this.outputLen = this.iHash.outputLen);
const b = this.blockLen,
k = new Uint8Array(b);
k.set(g.length > b ? a.create().update(g).digest() : g);
for (let B = 0; B < k.length; B++) k[B] ^= 54;
this.iHash.update(k), (this.oHash = a.create());
for (let B = 0; B < k.length; B++) k[B] ^= 106;
this.oHash.update(k), k.fill(0);
}
update(a) {
return xs(this), this.iHash.update(a), this;
}
digestInto(a) {
xs(this),
uf(a, this.outputLen),
(this.finished = !0),
this.iHash.digestInto(a),
this.oHash.update(a),
this.oHash.digestInto(a),
this.destroy();
}
digest() {
const a = new Uint8Array(this.oHash.outputLen);
return this.digestInto(a), a;
}
_cloneInto(a) {
a || (a = Object.create(Object.getPrototypeOf(this), {}));
const {
oHash: u,
iHash: g,
finished: b,
destroyed: k,
blockLen: B,
outputLen: H,
} = this;
return (
(a = a),
(a.finished = b),
(a.destroyed = k),
(a.blockLen = B),
(a.outputLen = H),
(a.oHash = u._cloneInto(a.oHash)),
(a.iHash = g._cloneInto(a.iHash)),
a
);
}
destroy() {
(this.destroyed = !0), this.oHash.destroy(), this.iHash.destroy();
}
}
const Sf = (i, a, u) => new Af(i, a).update(u).digest();
Sf.create = (i, a) => new Af(i, a);
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ function Ab(
i
) {
return {
hash: i,
hmac: (a, ...u) => Sf(i, a, Dm(...u)),
randomBytes: ff,
};
}
function Sb(i, a) {
const u = (g) => kb({ ...i, ...Ab(g) });
return Object.freeze({ ...u(a), create: u });
}
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const Ls =
BigInt(
"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"
),
Bs = BigInt(
"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"
),
$f = BigInt(1),
Cs = BigInt(2),
xf = (i, a) => (i + a / Cs) / a;
function Tf(i) {
const a = Ls,
u = BigInt(3),
g = BigInt(6),
b = BigInt(11),
k = BigInt(22),
B = BigInt(23),
H = BigInt(44),
U = BigInt(88),
j = (i * i * i) % a,
F = (j * j * i) % a,
V = (Jt(F, u, a) * F) % a,
X = (Jt(V, u, a) * F) % a,
J = (Jt(X, Cs, a) * j) % a,
ee = (Jt(J, b, a) * J) % a,
Y = (Jt(ee, k, a) * ee) % a,
te = (Jt(Y, H, a) * Y) % a,
ne = (Jt(te, U, a) * te) % a,
Q = (Jt(ne, H, a) * Y) % a,
ue = (Jt(Q, u, a) * F) % a,
_e = (Jt(ue, B, a) * ee) % a,
Ae = (Jt(_e, g, a) * j) % a,
le = Jt(Ae, Cs, a);
if (!Kc.eql(Kc.sqr(le), i))
throw new Error("Cannot find square root");
return le;
}
const Kc = pb(Ls, void 0, void 0, { sqrt: Tf }),
Ri = Sb(
{
a: BigInt(0),
b: BigInt(7),
Fp: Kc,
n: Bs,
Gx: BigInt(
"55066263022277343669578718895168534326250603453777594175500187360389116729240"
),
Gy: BigInt(
"32670510020758816978083085130507043184471273380659243275938904335757337482424"
),
h: BigInt(1),
lowS: !0,
endo: {
beta: BigInt(
"0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"
),
splitScalar: (i) => {
const a = Bs,
u = BigInt("0x3086d221a7d46bcde86c90e49284eb15"),
g = -$f * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),
b = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),
k = u,
B = BigInt("0x100000000000000000000000000000000"),
H = xf(k * i, a),
U = xf(-g * i, a);
let j = vt(i - H * u - U * b, a),
F = vt(-H * g - U * k, a);
const V = j > B,
X = F > B;
if ((V && (j = a - j), X && (F = a - F), j > B || F > B))
throw new Error("splitScalar: Endomorphism failed, k=" + i);
return { k1neg: V, k1: j, k2neg: X, k2: F };
},
},
},
zc
),
Is = BigInt(0),
Pf = (i) => typeof i == "bigint" && Is < i && i < Ls,
$b = (i) => typeof i == "bigint" && Is < i && i < Bs,
Lf = {};
function Os(i, ...a) {
let u = Lf[i];
if (u === void 0) {
const g = zc(Uint8Array.from(i, (b) => b.charCodeAt(0)));
(u = fo(g, g)), (Lf[i] = u);
}
return zc(fo(u, ...a));
}
const Wc = (i) => i.toRawBytes(!0).slice(1),
Gc = (i) => _r(i, 32),
Zc = (i) => vt(i, Ls),
zi = (i) => vt(i, Bs),
Yc = Ri.ProjectivePoint,
xb = (i, a, u) => Yc.BASE.multiplyAndAddUnsafe(i, a, u);
function Jc(i) {
let a = Ri.utils.normPrivateKeyToScalar(i),
u = Yc.fromPrivateKey(a);
return { scalar: u.hasEvenY() ? a : zi(-a), bytes: Wc(u) };
}
function Bf(i) {
if (!Pf(i)) throw new Error("bad x: need 0 < x < p");
const a = Zc(i * i),
u = Zc(a * i + BigInt(7));
let g = Tf(u);
g % Cs !== Is && (g = Zc(-g));
const b = new Yc(i, g, $f);
return b.assertValidity(), b;
}
function Cf(...i) {
return zi(Ht(Os("BIP0340/challenge", ...i)));
}
function Tb(i) {
return Jc(i).bytes;
}
function Pb(i, a, u = ff(32)) {
const g = $t("message", i),
{ bytes: b, scalar: k } = Jc(a),
B = $t("auxRand", u, 32),
H = Gc(k ^ Ht(Os("BIP0340/aux", B))),
U = Os("BIP0340/nonce", H, b, g),
j = zi(Ht(U));
if (j === Is) throw new Error("sign failed: k is zero");
const { bytes: F, scalar: V } = Jc(j),
X = Cf(F, b, g),
J = new Uint8Array(64);
if ((J.set(F, 0), J.set(Gc(zi(V + X * k)), 32), !If(J, g, b)))
throw new Error("sign: Invalid signature produced");
return J;
}
function If(i, a, u) {
const g = $t("signature", i, 64),
b = $t("message", a),
k = $t("publicKey", u, 32);
try {
const B = Bf(Ht(k)),
H = Ht(g.subarray(0, 32));
if (!Pf(H)) return !1;
const U = Ht(g.subarray(32, 64));
if (!$b(U)) return !1;
const j = Cf(Gc(H), Wc(B), b),
F = xb(B, U, zi(-j));
return !(!F || !F.hasEvenY() || F.toAffine().x !== H);
} catch {
return !1;
}
}
const zt = {
getPublicKey: Tb,
sign: Pb,
verify: If,
utils: {
randomPrivateKey: Ri.utils.randomPrivateKey,
lift_x: Bf,
pointToBytes: Wc,
numberToBytesBE: _r,
bytesToNumberBE: Ht,
taggedHash: Os,
mod: vt,
},
};
function Xc(i) {
if (!Number.isSafeInteger(i) || i < 0)
throw new Error(`Wrong positive integer: ${i}`);
}
function Lb(i) {
if (typeof i != "boolean")
throw new Error(`Expected boolean, not ${i}`);
}
function Of(i, ...a) {
if (!(i instanceof Uint8Array))
throw new Error("Expected Uint8Array");
if (a.length > 0 && !a.includes(i.length))
throw new Error(
`Expected Uint8Array of length ${a}, not of length=${i.length}`
);
}
function Bb(i) {
if (typeof i != "function" || typeof i.create != "function")
throw new Error("Hash should be wrapped by utils.wrapConstructor");
Xc(i.outputLen), Xc(i.blockLen);
}
function Cb(i, a = !0) {
if (i.destroyed) throw new Error("Hash instance has been destroyed");
if (a && i.finished)
throw new Error("Hash#digest() has already been called");
}
function Ib(i, a) {
Of(i);
const u = a.outputLen;
if (i.length < u)
throw new Error(
`digestInto() expects output buffer of length at least ${u}`
);
}
const Qc = {
number: Xc,
bool: Lb,
bytes: Of,
hash: Bb,
exists: Cb,
output: Ib,
};
function Ob(i, a, u, g) {
if (typeof i.setBigUint64 == "function")
return i.setBigUint64(a, u, g);
const b = BigInt(32),
k = BigInt(4294967295),
B = Number((u >> b) & k),
H = Number(u & k),
U = g ? 4 : 0,
j = g ? 0 : 4;
i.setUint32(a + U, B, g), i.setUint32(a + j, H, g);
}
class Nb extends zm {
constructor(a, u, g, b) {
super(),
(this.blockLen = a),
(this.outputLen = u),
(this.padOffset = g),
(this.isLE = b),
(this.finished = !1),
(this.length = 0),
(this.pos = 0),
(this.destroyed = !1),
(this.buffer = new Uint8Array(a)),
(this.view = Cc(this.buffer));
}
update(a) {
Qc.exists(this);
const { view: u, buffer: g, blockLen: b } = this;
a = sf(a);
const k = a.length;
for (let B = 0; B < k; ) {
const H = Math.min(b - this.pos, k - B);
if (H === b) {
const U = Cc(a);
for (; b <= k - B; B += b) this.process(U, B);
continue;
}
g.set(a.subarray(B, B + H), this.pos),
(this.pos += H),
(B += H),
this.pos === b && (this.process(u, 0), (this.pos = 0));
}
return (this.length += a.length), this.roundClean(), this;
}
digestInto(a) {
Qc.exists(this), Qc.output(a, this), (this.finished = !0);
const { buffer: u, view: g, blockLen: b, isLE: k } = this;
let { pos: B } = this;
(u[B++] = 128),
this.buffer.subarray(B).fill(0),
this.padOffset > b - B && (this.process(g, 0), (B = 0));
for (let V = B; V < b; V++) u[V] = 0;
Ob(g, b - 8, BigInt(this.length * 8), k), this.process(g, 0);
const H = Cc(a),
U = this.outputLen;
if (U % 4)
throw new Error("_sha2: outputLen should be aligned to 32bit");
const j = U / 4,
F = this.get();
if (j > F.length)
throw new Error("_sha2: outputLen bigger than state");
for (let V = 0; V < j; V++) H.setUint32(4 * V, F[V], k);
}
digest() {
const { buffer: a, outputLen: u } = this;
this.digestInto(a);
const g = a.slice(0, u);
return this.destroy(), g;
}
_cloneInto(a) {
a || (a = new this.constructor()), a.set(...this.get());
const {
blockLen: u,
buffer: g,
length: b,
finished: k,
destroyed: B,
pos: H,
} = this;
return (
(a.length = b),
(a.pos = H),
(a.finished = k),
(a.destroyed = B),
b % u && a.buffer.set(g),
a
);
}
}
const Rb = (i, a, u) => (i & a) ^ (~i & u),
zb = (i, a, u) => (i & a) ^ (i & u) ^ (a & u),
Ub = new Uint32Array([
1116352408, 1899447441, 3049323471, 3921009573, 961987163,
1508970993, 2453635748, 2870763221, 3624381080, 310598401,
607225278, 1426881987, 1925078388, 2162078206, 2614888103,
3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983,
1249150122, 1555081692, 1996064986, 2554220882, 2821834349,
2952996808, 3210313671, 3336571891, 3584528711, 113926993,
338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700,
1986661051, 2177026350, 2456956037, 2730485921, 2820302411,
3259730800, 3345764771, 3516065817, 3600352804, 4094571909,
275423344, 430227734, 506948616, 659060556, 883997877, 958139571,
1322822218, 1537002063, 1747873779, 1955562222, 2024104815,
2227730452, 2361852424, 2428436474, 2756734187, 3204031479,
3329325298,
]),
Er = new Uint32Array([
1779033703, 3144134277, 1013904242, 2773480762, 1359893119,
2600822924, 528734635, 1541459225,
]),
kr = new Uint32Array(64);
class Nf extends Nb {
constructor() {
super(64, 32, 8, !1),
(this.A = Er[0] | 0),
(this.B = Er[1] | 0),
(this.C = Er[2] | 0),
(this.D = Er[3] | 0),
(this.E = Er[4] | 0),
(this.F = Er[5] | 0),
(this.G = Er[6] | 0),
(this.H = Er[7] | 0);
}
get() {
const { A: a, B: u, C: g, D: b, E: k, F: B, G: H, H: U } = this;
return [a, u, g, b, k, B, H, U];
}
set(a, u, g, b, k, B, H, U) {
(this.A = a | 0),
(this.B = u | 0),
(this.C = g | 0),
(this.D = b | 0),
(this.E = k | 0),
(this.F = B | 0),
(this.G = H | 0),
(this.H = U | 0);
}
process(a, u) {
for (let V = 0; V < 16; V++, u += 4) kr[V] = a.getUint32(u, !1);
for (let V = 16; V < 64; V++) {
const X = kr[V - 15],
J = kr[V - 2],
ee = _n(X, 7) ^ _n(X, 18) ^ (X >>> 3),
Y = _n(J, 17) ^ _n(J, 19) ^ (J >>> 10);
kr[V] = (Y + kr[V - 7] + ee + kr[V - 16]) | 0;
}
let { A: g, B: b, C: k, D: B, E: H, F: U, G: j, H: F } = this;
for (let V = 0; V < 64; V++) {
const X = _n(H, 6) ^ _n(H, 11) ^ _n(H, 25),
J = (F + X + Rb(H, U, j) + Ub[V] + kr[V]) | 0,
ee = ((_n(g, 2) ^ _n(g, 13) ^ _n(g, 22)) + zb(g, b, k)) | 0;
(F = j),
(j = U),
(U = H),
(H = (B + J) | 0),
(B = k),
(k = b),
(b = g),
(g = (J + ee) | 0);
}
(g = (g + this.A) | 0),
(b = (b + this.B) | 0),
(k = (k + this.C) | 0),
(B = (B + this.D) | 0),
(H = (H + this.E) | 0),
(U = (U + this.F) | 0),
(j = (j + this.G) | 0),
(F = (F + this.H) | 0),
this.set(g, b, k, B, H, U, j, F);
}
roundClean() {
kr.fill(0);
}
destroy() {
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
}
}
class Mb extends Nf {
constructor() {
super(),
(this.A = -1056596264),
(this.B = 914150663),
(this.C = 812702999),
(this.D = -150054599),
(this.E = -4191439),
(this.F = 1750603025),
(this.G = 1694076839),
(this.H = -1090891868),
(this.outputLen = 28);
}
}
const eu = af(() => new Nf());
af(() => new Mb());
var Do = Symbol("verified"),
Hb = (i) => i instanceof Object;
function jb(i) {
if (
!Hb(i) ||
typeof i.kind != "number" ||
typeof i.content != "string" ||
typeof i.created_at != "number" ||
typeof i.pubkey != "string" ||
!i.pubkey.match(/^[a-f0-9]{64}$/) ||
!Array.isArray(i.tags)
)
return !1;
for (let a = 0; a < i.tags.length; a++) {
let u = i.tags[a];
if (!Array.isArray(u)) return !1;
for (let g = 0; g < u.length; g++)
if (typeof u[g] == "object") return !1;
}
return !0;
}
new TextDecoder("utf-8");
var Db = new TextEncoder(),
qb = class {
generateSecretKey() {
return zt.utils.randomPrivateKey();
}
getPublicKey(i) {
return Rt(zt.getPublicKey(i));
}
finalizeEvent(i, a) {
const u = i;
return (
(u.pubkey = Rt(zt.getPublicKey(a))),
(u.id = tu(u)),
(u.sig = Rt(zt.sign(tu(u), a))),
(u[Do] = !0),
u
);
}
verifyEvent(i) {
if (typeof i[Do] == "boolean") return i[Do];
const a = tu(i);
if (a !== i.id) return (i[Do] = !1), !1;
try {
const u = zt.verify(i.sig, a, i.pubkey);
return (i[Do] = u), u;
} catch {
return (i[Do] = !1), !1;
}
}
};
function Vb(i) {
if (!jb(i))
throw new Error(
"can't serialize event with wrong or missing properties"
);
return JSON.stringify([
0,
i.pubkey,
i.created_at,
i.kind,
i.tags,
i.content,
]);
}
function tu(i) {
let a = eu(Db.encode(Vb(i)));
return Rt(a);
}
var Ns = new qb(),
Fb = Ns.generateSecretKey,
Rf = Ns.getPublicKey;
Ns.finalizeEvent, Ns.verifyEvent;
var go = Symbol("verified"),
Kb = (i) => i instanceof Object;
function Wb(i) {
if (
!Kb(i) ||
typeof i.kind != "number" ||
typeof i.content != "string" ||
typeof i.created_at != "number" ||
typeof i.pubkey != "string" ||
!i.pubkey.match(/^[a-f0-9]{64}$/) ||
!Array.isArray(i.tags)
)
return !1;
for (let a = 0; a < i.tags.length; a++) {
let u = i.tags[a];
if (!Array.isArray(u)) return !1;
for (let g = 0; g < u.length; g++)
if (typeof u[g] == "object") return !1;
}
return !0;
}
new TextDecoder("utf-8");
var Gb = new TextEncoder();
function Ui(i) {
i.indexOf("://") === -1 && (i = "wss://" + i);
let a = new URL(i);
return (
(a.pathname = a.pathname.replace(/\/+/g, "/")),
a.pathname.endsWith("/") && (a.pathname = a.pathname.slice(0, -1)),
((a.port === "80" && a.protocol === "ws:") ||
(a.port === "443" && a.protocol === "wss:")) &&
(a.port = ""),
a.searchParams.sort(),
(a.hash = ""),
a.toString()
);
}
var Zb = class {
constructor(i) {
ae(this, "value"),
ae(this, "next", null),
ae(this, "prev", null),
(this.value = i);
}
},
Yb = class {
constructor() {
ae(this, "first"),
ae(this, "last"),
(this.first = null),
(this.last = null);
}
enqueue(i) {
const a = new Zb(i);
return (
this.last
? this.last === this.first
? ((this.last = a),
(this.last.prev = this.first),
(this.first.next = a))
: ((a.prev = this.last),
(this.last.next = a),
(this.last = a))
: ((this.first = a), (this.last = a)),
!0
);
}
dequeue() {
if (!this.first) return null;
if (this.first === this.last) {
const a = this.first;
return (this.first = null), (this.last = null), a.value;
}
const i = this.first;
return (this.first = i.next), i.value;
}
},
Jb = class {
generateSecretKey() {
return zt.utils.randomPrivateKey();
}
getPublicKey(i) {
return Rt(zt.getPublicKey(i));
}
finalizeEvent(i, a) {
const u = i;
return (
(u.pubkey = Rt(zt.getPublicKey(a))),
(u.id = nu(u)),
(u.sig = Rt(zt.sign(nu(u), a))),
(u[go] = !0),
u
);
}
verifyEvent(i) {
if (typeof i[go] == "boolean") return i[go];
const a = nu(i);
if (a !== i.id) return (i[go] = !1), !1;
try {
const u = zt.verify(i.sig, a, i.pubkey);
return (i[go] = u), u;
} catch {
return (i[go] = !1), !1;
}
}
};
function Xb(i) {
if (!Wb(i))
throw new Error(
"can't serialize event with wrong or missing properties"
);
return JSON.stringify([
0,
i.pubkey,
i.created_at,
i.kind,
i.tags,
i.content,
]);
}
function nu(i) {
let a = eu(Gb.encode(Xb(i)));
return Rt(a);
}
var Rs = new Jb();
Rs.generateSecretKey, Rs.getPublicKey, Rs.finalizeEvent;
var Qb = Rs.verifyEvent,
ey = 22242;
function ty(i, a) {
if (
(i.ids &&
i.ids.indexOf(a.id) === -1 &&
!i.ids.some((u) => a.id.startsWith(u))) ||
(i.kinds && i.kinds.indexOf(a.kind) === -1) ||
(i.authors &&
i.authors.indexOf(a.pubkey) === -1 &&
!i.authors.some((u) => a.pubkey.startsWith(u)))
)
return !1;
for (let u in i)
if (u[0] === "#") {
let g = u.slice(1),
b = i[`#${g}`];
if (
b &&
!a.tags.find(
([k, B]) => k === u.slice(1) && b.indexOf(B) !== -1
)
)
return !1;
}
return !(
(i.since && a.created_at < i.since) ||
(i.until && a.created_at > i.until)
);
}
function ny(i, a) {
for (let u = 0; u < i.length; u++) if (ty(i[u], a)) return !0;
return !1;
}
function ry(i, a) {
let u = a.length + 3,
g = i.indexOf(`"${a}":`) + u,
b = i.slice(g).indexOf('"') + g + 1;
return i.slice(b, b + 64);
}
function oy(i) {
let a = i.slice(0, 22).indexOf('"EVENT"');
if (a === -1) return null;
let u = i.slice(a + 7 + 1).indexOf('"');
if (u === -1) return null;
let g = a + 7 + 1 + u,
b = i.slice(g + 1, 80).indexOf('"');
if (b === -1) return null;
let k = g + 1 + b;
return i.slice(g + 1, k);
}
function iy(i, a) {
return {
kind: ey,
created_at: Math.floor(Date.now() / 1e3),
tags: [
["relay", i],
["challenge", a],
],
content: "",
};
}
async function sy() {
return new Promise((i) => {
const a = new MessageChannel(),
u = () => {
a.port1.removeEventListener("message", u), i();
};
a.port1.addEventListener("message", u),
a.port2.postMessage(0),
a.port1.start();
});
}
var ay = (i) => ((i[go] = !0), !0),
zf;
try {
zf = WebSocket;
} catch {}
var Uf = class {
constructor(i, a) {
ae(this, "url"),
ae(this, "_connected", !1),
ae(this, "onclose", null),
ae(this, "onnotice", (u) =>
console.debug(`NOTICE from ${this.url}: ${u}`)
),
ae(this, "_onauth", null),
ae(this, "baseEoseTimeout", 4400),
ae(this, "connectionTimeout", 4400),
ae(this, "openSubs", new Map()),
ae(this, "connectionTimeoutHandle"),
ae(this, "connectionPromise"),
ae(this, "openCountRequests", new Map()),
ae(this, "openEventPublishes", new Map()),
ae(this, "ws"),
ae(this, "incomingMessageQueue", new Yb()),
ae(this, "queueRunning", !1),
ae(this, "challenge"),
ae(this, "serial", 0),
ae(this, "verifyEvent"),
(this.url = Ui(i)),
(this.verifyEvent = a.verifyEvent);
}
static async connect(i, a) {
const u = new Uf(i, a);
return await u.connect(), u;
}
closeAllSubscriptions(i) {
for (let [a, u] of this.openSubs) u.close(i);
this.openSubs.clear();
for (let [a, u] of this.openEventPublishes)
u.reject(new Error(i));
this.openEventPublishes.clear();
for (let [a, u] of this.openCountRequests) u.reject(new Error(i));
this.openCountRequests.clear();
}
get connected() {
return this._connected;
}
async connect() {
return this.connectionPromise
? this.connectionPromise
: ((this.challenge = void 0),
(this.connectionPromise = new Promise((i, a) => {
this.connectionTimeoutHandle = setTimeout(() => {
var u;
a("connection timed out"),
(this.connectionPromise = void 0),
(u = this.onclose) == null || u.call(this),
this.closeAllSubscriptions(
"relay connection timed out"
);
}, this.connectionTimeout);
try {
this.ws = new zf(this.url);
} catch (u) {
a(u);
return;
}
(this.ws.onopen = () => {
clearTimeout(this.connectionTimeoutHandle),
(this._connected = !0),
i();
}),
(this.ws.onerror = (u) => {
var g;
a(u.message),
this._connected &&
((this._connected = !1),
(this.connectionPromise = void 0),
(g = this.onclose) == null || g.call(this),
this.closeAllSubscriptions(
"relay connection errored"
));
}),
(this.ws.onclose = async () => {
var u;
this._connected &&
((this._connected = !1),
(this.connectionPromise = void 0),
(u = this.onclose) == null || u.call(this),
this.closeAllSubscriptions(
"relay connection closed"
));
}),
(this.ws.onmessage = this._onmessage.bind(this));
})),
this.connectionPromise);
}
async runQueue() {
for (this.queueRunning = !0; this.handleNext() !== !1; )
await sy();
this.queueRunning = !1;
}
handleNext() {
var i, a, u;
const g = this.incomingMessageQueue.dequeue();
if (!g) return !1;
const b = oy(g);
if (b) {
const k = this.openSubs.get(b);
if (!k) return;
const B = ry(g, "id"),
H = (i = k.alreadyHaveEvent) == null ? void 0 : i.call(k, B);
if (((a = k.receivedEvent) == null || a.call(k, this, B), H))
return;
}
try {
let k = JSON.parse(g);
switch (k[0]) {
case "EVENT": {
const B = this.openSubs.get(k[1]),
H = k[2];
this.verifyEvent(H) && ny(B.filters, H) && B.onevent(H);
return;
}
case "COUNT": {
const B = k[1],
H = k[2],
U = this.openCountRequests.get(B);
U && (U.resolve(H.count), this.openCountRequests.delete(B));
return;
}
case "EOSE": {
const B = this.openSubs.get(k[1]);
if (!B) return;
B.receivedEose();
return;
}
case "OK": {
const B = k[1],
H = k[2],
U = k[3],
j = this.openEventPublishes.get(B);
H ? j.resolve(U) : j.reject(new Error(U)),
this.openEventPublishes.delete(B);
return;
}
case "CLOSED": {
const B = k[1],
H = this.openSubs.get(B);
if (!H) return;
(H.closed = !0), H.close(k[2]);
return;
}
case "NOTICE":
this.onnotice(k[1]);
return;
case "AUTH": {
(this.challenge = k[1]),
(u = this._onauth) == null || u.call(this, k[1]);
return;
}
}
} catch {
return;
}
}
async send(i) {
if (!this.connectionPromise)
throw new Error("sending on closed connection");
this.connectionPromise.then(() => {
var a;
(a = this.ws) == null || a.send(i);
});
}
async auth(i) {
if (!this.challenge)
throw new Error(
"can't perform auth, no challenge was received"
);
const a = await i(iy(this.url, this.challenge)),
u = new Promise((g, b) => {
this.openEventPublishes.set(a.id, { resolve: g, reject: b });
});
return this.send('["AUTH",' + JSON.stringify(a) + "]"), u;
}
async publish(i) {
const a = new Promise((u, g) => {
this.openEventPublishes.set(i.id, { resolve: u, reject: g });
});
return this.send('["EVENT",' + JSON.stringify(i) + "]"), a;
}
async count(i, a) {
this.serial++;
const u = (a == null ? void 0 : a.id) || "count:" + this.serial,
g = new Promise((b, k) => {
this.openCountRequests.set(u, { resolve: b, reject: k });
});
return (
this.send('["COUNT","' + u + '",' + JSON.stringify(i) + "]"), g
);
}
subscribe(i, a) {
const u = this.prepareSubscription(i, a);
return u.fire(), u;
}
prepareSubscription(i, a) {
this.serial++;
const u = a.id || "sub:" + this.serial,
g = new cy(this, u, i, a);
return this.openSubs.set(u, g), g;
}
close() {
var i;
this.closeAllSubscriptions("relay connection closed by us"),
(this._connected = !1),
(i = this.ws) == null || i.close();
}
_onmessage(i) {
this.incomingMessageQueue.enqueue(i.data),
this.queueRunning || this.runQueue();
}
},
cy = class {
constructor(i, a, u, g) {
ae(this, "relay"),
ae(this, "id"),
ae(this, "closed", !1),
ae(this, "eosed", !1),
ae(this, "filters"),
ae(this, "alreadyHaveEvent"),
ae(this, "receivedEvent"),
ae(this, "onevent"),
ae(this, "oneose"),
ae(this, "onclose"),
ae(this, "eoseTimeout"),
ae(this, "eoseTimeoutHandle"),
(this.relay = i),
(this.filters = u),
(this.id = a),
(this.alreadyHaveEvent = g.alreadyHaveEvent),
(this.receivedEvent = g.receivedEvent),
(this.eoseTimeout = g.eoseTimeout || i.baseEoseTimeout),
(this.oneose = g.oneose),
(this.onclose = g.onclose),
(this.onevent =
g.onevent ||
((b) => {
console.warn(
`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,
b
);
}));
}
fire() {
this.relay.send(
'["REQ","' +
this.id +
'",' +
JSON.stringify(this.filters).substring(1)
),
(this.eoseTimeoutHandle = setTimeout(
this.receivedEose.bind(this),
this.eoseTimeout
));
}
receivedEose() {
var i;
this.eosed ||
(clearTimeout(this.eoseTimeoutHandle),
(this.eosed = !0),
(i = this.oneose) == null || i.call(this));
}
close(i = "closed by caller") {
var a;
!this.closed &&
this.relay.connected &&
(this.relay.send('["CLOSE",' + JSON.stringify(this.id) + "]"),
(this.closed = !0)),
this.relay.openSubs.delete(this.id),
(a = this.onclose) == null || a.call(this, i);
}
},
uy = class {
constructor(i) {
ae(this, "relays", new Map()),
ae(this, "seenOn", new Map()),
ae(this, "trackRelays", !1),
ae(this, "verifyEvent"),
ae(this, "trustedRelayURLs", new Set()),
(this.verifyEvent = i.verifyEvent);
}
async ensureRelay(i, a) {
i = Ui(i);
let u = this.relays.get(i);
return (
u ||
((u = new Uf(i, {
verifyEvent: this.trustedRelayURLs.has(i)
? ay
: this.verifyEvent,
})),
a != null &&
a.connectionTimeout &&
(u.connectionTimeout = a.connectionTimeout),
this.relays.set(i, u)),
await u.connect(),
u
);
}
close(i) {
i.map(Ui).forEach((a) => {
var u;
(u = this.relays.get(a)) == null || u.close();
});
}
subscribeMany(i, a, u) {
return this.subscribeManyMap(
Object.fromEntries(i.map((g) => [g, a])),
u
);
}
subscribeManyMap(i, a) {
this.trackRelays &&
(a.receivedEvent = (V, X) => {
let J = this.seenOn.get(X);
J || ((J = new Set()), this.seenOn.set(X, J)), J.add(V);
});
const u = new Set(),
g = [],
b = Object.keys(i).length,
k = [];
let B = (V) => {
var X;
(k[V] = !0),
k.filter((J) => J).length === b &&
((X = a.oneose) == null || X.call(a), (B = () => {}));
};
const H = [];
let U = (V, X) => {
var J;
B(V),
(H[V] = X),
H.filter((ee) => ee).length === b &&
((J = a.onclose) == null || J.call(a, H), (U = () => {}));
};
const j = (V) => {
var X;
if ((X = a.alreadyHaveEvent) != null && X.call(a, V))
return !0;
const J = u.has(V);
return u.add(V), J;
},
F = Promise.all(
Object.entries(i).map(async (V, X, J) => {
if (J.indexOf(V) !== X) {
U(X, "duplicate url");
return;
}
let [ee, Y] = V;
ee = Ui(ee);
let te;
try {
te = await this.ensureRelay(ee, {
connectionTimeout: a.maxWait
? Math.max(a.maxWait * 0.8, a.maxWait - 1e3)
: void 0,
});
} catch (Q) {
U(X, (Q == null ? void 0 : Q.message) || String(Q));
return;
}
let ne = te.subscribe(Y, {
...a,
oneose: () => B(X),
onclose: (Q) => U(X, Q),
alreadyHaveEvent: j,
eoseTimeout: a.maxWait,
});
g.push(ne);
})
);
return {
async close() {
await F,
g.forEach((V) => {
V.close();
});
},
};
}
subscribeManyEose(i, a, u) {
const g = this.subscribeMany(i, a, {
...u,
oneose() {
g.close();
},
});
return g;
}
async querySync(i, a, u) {
return new Promise(async (g) => {
const b = [];
this.subscribeManyEose(i, [a], {
...u,
onevent(k) {
b.push(k);
},
onclose(k) {
g(b);
},
});
});
}
async get(i, a, u) {
a.limit = 1;
const g = await this.querySync(i, a, u);
return (
g.sort((b, k) => k.created_at - b.created_at), g[0] || null
);
}
publish(i, a) {
return i
.map(Ui)
.map(async (u, g, b) =>
b.indexOf(u) !== g
? Promise.reject("duplicate url")
: (await this.ensureRelay(u)).publish(a)
);
}
},
ly = class extends uy {
constructor() {
super({ verifyEvent: Qb });
}
};
function Mf(i) {
return (
i instanceof Uint8Array ||
(i != null &&
typeof i == "object" &&
i.constructor.name === "Uint8Array")
);
}
function wo(i, ...a) {
if (!Mf(i)) throw new Error("Uint8Array expected");
if (a.length > 0 && !a.includes(i.length))
throw new Error(
`Uint8Array expected of length ${a}, not of length=${i.length}`
);
}
function zs(i, a = !0) {
if (i.destroyed) throw new Error("Hash instance has been destroyed");
if (a && i.finished)
throw new Error("Hash#digest() has already been called");
}
function Hf(i, a) {
wo(i);
const u = a.outputLen;
if (i.length < u)
throw new Error(
`digestInto() expects output buffer of length at least ${u}`
);
}
/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */ const Wt =
(i) =>
new Uint32Array(
i.buffer,
i.byteOffset,
Math.floor(i.byteLength / 4)
),
dy = (i) => new DataView(i.buffer, i.byteOffset, i.byteLength);
if (new Uint8Array(new Uint32Array([287454020]).buffer)[0] !== 68)
throw new Error("Non little-endian hardware is not supported");
function fy(i) {
if (typeof i != "string")
throw new Error(`string expected, got ${typeof i}`);
return new Uint8Array(new TextEncoder().encode(i));
}
function Mi(i) {
if (typeof i == "string") i = fy(i);
else if (Mf(i)) i = i.slice();
else throw new Error(`Uint8Array expected, got ${typeof i}`);
return i;
}
const hy = (i, a) => (Object.assign(a, i), a),
Kn = 16,
ru = new Uint8Array(16),
kn = Wt(ru),
py = 225,
gy = (i, a, u, g) => {
const b = g & 1;
return {
s3: (u << 31) | (g >>> 1),
s2: (a << 31) | (u >>> 1),
s1: (i << 31) | (a >>> 1),
s0: (i >>> 1) ^ ((py << 24) & -(b & 1)),
};
},
Qt = (i) =>
(((i >>> 0) & 255) << 24) |
(((i >>> 8) & 255) << 16) |
(((i >>> 16) & 255) << 8) |
((i >>> 24) & 255) |
0;
function wy(i) {
i.reverse();
const a = i[15] & 1;
let u = 0;
for (let g = 0; g < i.length; g++) {
const b = i[g];
(i[g] = (b >>> 1) | u), (u = (b & 1) << 7);
}
return (i[0] ^= -a & 225), i;
}
const my = (i) => (i > 64 * 1024 ? 8 : i > 1024 ? 4 : 2);
class jf {
constructor(a, u) {
(this.blockLen = Kn),
(this.outputLen = Kn),
(this.s0 = 0),
(this.s1 = 0),
(this.s2 = 0),
(this.s3 = 0),
(this.finished = !1),
(a = Mi(a)),
wo(a, 16);
const g = dy(a);
let b = g.getUint32(0, !1),
k = g.getUint32(4, !1),
B = g.getUint32(8, !1),
H = g.getUint32(12, !1);
const U = [];
for (let J = 0; J < 128; J++)
U.push({ s0: Qt(b), s1: Qt(k), s2: Qt(B), s3: Qt(H) }),
({ s0: b, s1: k, s2: B, s3: H } = gy(b, k, B, H));
const j = my(u || 1024);
if (![1, 2, 4, 8].includes(j))
throw new Error(
`ghash: wrong window size=${j}, should be 2, 4 or 8`
);
this.W = j;
const F = 128 / j,
V = (this.windowSize = 2 ** j),
X = [];
for (let J = 0; J < F; J++)
for (let ee = 0; ee < V; ee++) {
let Y = 0,
te = 0,
ne = 0,
Q = 0;
for (let ue = 0; ue < j; ue++) {
if (!((ee >>> (j - ue - 1)) & 1)) continue;
const { s0: _e, s1: Ae, s2: le, s3: ce } = U[j * J + ue];
(Y ^= _e), (te ^= Ae), (ne ^= le), (Q ^= ce);
}
X.push({ s0: Y, s1: te, s2: ne, s3: Q });
}
this.t = X;
}
_updateBlock(a, u, g, b) {
(a ^= this.s0), (u ^= this.s1), (g ^= this.s2), (b ^= this.s3);
const { W: k, t: B, windowSize: H } = this;
let U = 0,
j = 0,
F = 0,
V = 0;
const X = (1 << k) - 1;
let J = 0;
for (const ee of [a, u, g, b])
for (let Y = 0; Y < 4; Y++) {
const te = (ee >>> (8 * Y)) & 255;
for (let ne = 8 / k - 1; ne >= 0; ne--) {
const Q = (te >>> (k * ne)) & X,
{ s0: ue, s1: _e, s2: Ae, s3: le } = B[J * H + Q];
(U ^= ue), (j ^= _e), (F ^= Ae), (V ^= le), (J += 1);
}
}
(this.s0 = U), (this.s1 = j), (this.s2 = F), (this.s3 = V);
}
update(a) {
(a = Mi(a)), zs(this);
const u = Wt(a),
g = Math.floor(a.length / Kn),
b = a.length % Kn;
for (let k = 0; k < g; k++)
this._updateBlock(
u[k * 4 + 0],
u[k * 4 + 1],
u[k * 4 + 2],
u[k * 4 + 3]
);
return (
b &&
(ru.set(a.subarray(g * Kn)),
this._updateBlock(kn[0], kn[1], kn[2], kn[3]),
kn.fill(0)),
this
);
}
destroy() {
const { t: a } = this;
for (const u of a) (u.s0 = 0), (u.s1 = 0), (u.s2 = 0), (u.s3 = 0);
}
digestInto(a) {
zs(this), Hf(a, this), (this.finished = !0);
const { s0: u, s1: g, s2: b, s3: k } = this,
B = Wt(a);
return (B[0] = u), (B[1] = g), (B[2] = b), (B[3] = k), a;
}
digest() {
const a = new Uint8Array(Kn);
return this.digestInto(a), this.destroy(), a;
}
}
class by extends jf {
constructor(a, u) {
a = Mi(a);
const g = wy(a.slice());
super(g, u), g.fill(0);
}
update(a) {
(a = Mi(a)), zs(this);
const u = Wt(a),
g = a.length % Kn,
b = Math.floor(a.length / Kn);
for (let k = 0; k < b; k++)
this._updateBlock(
Qt(u[k * 4 + 3]),
Qt(u[k * 4 + 2]),
Qt(u[k * 4 + 1]),
Qt(u[k * 4 + 0])
);
return (
g &&
(ru.set(a.subarray(b * Kn)),
this._updateBlock(Qt(kn[3]), Qt(kn[2]), Qt(kn[1]), Qt(kn[0])),
kn.fill(0)),
this
);
}
digestInto(a) {
zs(this), Hf(a, this), (this.finished = !0);
const { s0: u, s1: g, s2: b, s3: k } = this,
B = Wt(a);
return (B[0] = u), (B[1] = g), (B[2] = b), (B[3] = k), a.reverse();
}
}
function Df(i) {
const a = (g, b) => i(b, g.length).update(Mi(g)).digest(),
u = i(new Uint8Array(16), 0);
return (
(a.outputLen = u.outputLen),
(a.blockLen = u.blockLen),
(a.create = (g, b) => i(g, b)),
a
);
}
Df((i, a) => new jf(i, a)), Df((i, a) => new by(i, a));
const Ar = 16,
yy = 283;
function ou(i) {
return (i << 1) ^ (yy & -(i >> 7));
}
function qo(i, a) {
let u = 0;
for (; a > 0; a >>= 1) (u ^= i & -(a & 1)), (i = ou(i));
return u;
}
const iu = (() => {
let i = new Uint8Array(256);
for (let u = 0, g = 1; u < 256; u++, g ^= ou(g)) i[u] = g;
const a = new Uint8Array(256);
a[0] = 99;
for (let u = 0; u < 255; u++) {
let g = i[255 - u];
(g |= g << 8),
(a[i[u]] =
(g ^ (g >> 4) ^ (g >> 5) ^ (g >> 6) ^ (g >> 7) ^ 99) & 255);
}
return a;
})(),
vy = iu.map((i, a) => iu.indexOf(a)),
_y = (i) => (i << 24) | (i >>> 8),
su = (i) => (i << 8) | (i >>> 24);
function qf(i, a) {
if (i.length !== 256) throw new Error("Wrong sbox length");
const u = new Uint32Array(256).map((j, F) => a(i[F])),
g = u.map(su),
b = g.map(su),
k = b.map(su),
B = new Uint32Array(256 * 256),
H = new Uint32Array(256 * 256),
U = new Uint16Array(256 * 256);
for (let j = 0; j < 256; j++)
for (let F = 0; F < 256; F++) {
const V = j * 256 + F;
(B[V] = u[j] ^ g[F]),
(H[V] = b[j] ^ k[F]),
(U[V] = (i[j] << 8) | i[F]);
}
return {
sbox: i,
sbox2: U,
T0: u,
T1: g,
T2: b,
T3: k,
T01: B,
T23: H,
};
}
const au = qf(
iu,
(i) => (qo(i, 3) << 24) | (i << 16) | (i << 8) | qo(i, 2)
),
Vf = qf(
vy,
(i) =>
(qo(i, 11) << 24) |
(qo(i, 13) << 16) |
(qo(i, 9) << 8) |
qo(i, 14)
),
Ey = (() => {
const i = new Uint8Array(16);
for (let a = 0, u = 1; a < 16; a++, u = ou(u)) i[a] = u;
return i;
})();
function Ff(i) {
wo(i);
const a = i.length;
if (![16, 24, 32].includes(a))
throw new Error(
`aes: wrong key size: should be 16, 24 or 32, got: ${a}`
);
const { sbox2: u } = au,
g = Wt(i),
b = g.length,
k = (H) => An(u, H, H, H, H),
B = new Uint32Array(a + 28);
B.set(g);
for (let H = b; H < B.length; H++) {
let U = B[H - 1];
H % b === 0
? (U = k(_y(U)) ^ Ey[H / b - 1])
: b > 6 && H % b === 4 && (U = k(U)),
(B[H] = B[H - b] ^ U);
}
return B;
}
function ky(i) {
const a = Ff(i),
u = a.slice(),
g = a.length,
{ sbox2: b } = au,
{ T0: k, T1: B, T2: H, T3: U } = Vf;
for (let j = 0; j < g; j += 4)
for (let F = 0; F < 4; F++) u[j + F] = a[g - j - 4 + F];
a.fill(0);
for (let j = 4; j < g - 4; j++) {
const F = u[j],
V = An(b, F, F, F, F);
u[j] =
k[V & 255] ^
B[(V >>> 8) & 255] ^
H[(V >>> 16) & 255] ^
U[V >>> 24];
}
return u;
}
function Sr(i, a, u, g, b, k) {
return (
i[((u << 8) & 65280) | ((g >>> 8) & 255)] ^
a[((b >>> 8) & 65280) | ((k >>> 24) & 255)]
);
}
function An(i, a, u, g, b) {
return (
i[(a & 255) | (u & 65280)] |
(i[((g >>> 16) & 255) | ((b >>> 16) & 65280)] << 16)
);
}
function Kf(i, a, u, g, b) {
const { sbox2: k, T01: B, T23: H } = au;
let U = 0;
(a ^= i[U++]), (u ^= i[U++]), (g ^= i[U++]), (b ^= i[U++]);
const j = i.length / 4 - 2;
for (let ee = 0; ee < j; ee++) {
const Y = i[U++] ^ Sr(B, H, a, u, g, b),
te = i[U++] ^ Sr(B, H, u, g, b, a),
ne = i[U++] ^ Sr(B, H, g, b, a, u),
Q = i[U++] ^ Sr(B, H, b, a, u, g);
(a = Y), (u = te), (g = ne), (b = Q);
}
const F = i[U++] ^ An(k, a, u, g, b),
V = i[U++] ^ An(k, u, g, b, a),
X = i[U++] ^ An(k, g, b, a, u),
J = i[U++] ^ An(k, b, a, u, g);
return { s0: F, s1: V, s2: X, s3: J };
}
function Ay(i, a, u, g, b) {
const { sbox2: k, T01: B, T23: H } = Vf;
let U = 0;
(a ^= i[U++]), (u ^= i[U++]), (g ^= i[U++]), (b ^= i[U++]);
const j = i.length / 4 - 2;
for (let ee = 0; ee < j; ee++) {
const Y = i[U++] ^ Sr(B, H, a, b, g, u),
te = i[U++] ^ Sr(B, H, u, a, b, g),
ne = i[U++] ^ Sr(B, H, g, u, a, b),
Q = i[U++] ^ Sr(B, H, b, g, u, a);
(a = Y), (u = te), (g = ne), (b = Q);
}
const F = i[U++] ^ An(k, a, b, g, u),
V = i[U++] ^ An(k, u, a, b, g),
X = i[U++] ^ An(k, g, u, a, b),
J = i[U++] ^ An(k, b, g, u, a);
return { s0: F, s1: V, s2: X, s3: J };
}
function Wf(i, a) {
if (!a) return new Uint8Array(i);
if ((wo(a), a.length < i))
throw new Error(
`aes: wrong destination length, expected at least ${i}, got: ${a.length}`
);
return a;
}
function Sy(i) {
if ((wo(i), i.length % Ar !== 0))
throw new Error(
`aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size ${Ar}`
);
}
function $y(i, a, u) {
let g = i.length;
const b = g % Ar;
if (!a && b !== 0)
throw new Error(
"aec/(cbc-ecb): unpadded plaintext with disabled padding"
);
const k = Wt(i);
if (a) {
let U = Ar - b;
U || (U = Ar), (g = g + U);
}
const B = Wf(g, u),
H = Wt(B);
return { b: k, o: H, out: B };
}
function xy(i, a) {
if (!a) return i;
const u = i.length;
if (!u) throw new Error("aes/pcks5: empty ciphertext not allowed");
const g = i[u - 1];
if (g <= 0 || g > 16)
throw new Error(`aes/pcks5: wrong padding byte: ${g}`);
const b = i.subarray(0, -g);
for (let k = 0; k < g; k++)
if (i[u - k - 1] !== g) throw new Error("aes/pcks5: wrong padding");
return b;
}
function Ty(i) {
const a = new Uint8Array(16),
u = Wt(a);
a.set(i);
const g = Ar - i.length;
for (let b = Ar - g; b < Ar; b++) a[b] = g;
return u;
}
const Gf = hy(
{ blockSize: 16, nonceLength: 16 },
function (i, a, u = {}) {
wo(i), wo(a, 16);
const g = !u.disablePadding;
return {
encrypt: (b, k) => {
const B = Ff(i),
{ b: H, o: U, out: j } = $y(b, g, k),
F = Wt(a);
let V = F[0],
X = F[1],
J = F[2],
ee = F[3],
Y = 0;
for (; Y + 4 <= H.length; )
(V ^= H[Y + 0]),
(X ^= H[Y + 1]),
(J ^= H[Y + 2]),
(ee ^= H[Y + 3]),
({ s0: V, s1: X, s2: J, s3: ee } = Kf(B, V, X, J, ee)),
(U[Y++] = V),
(U[Y++] = X),
(U[Y++] = J),
(U[Y++] = ee);
if (g) {
const te = Ty(b.subarray(Y * 4));
(V ^= te[0]),
(X ^= te[1]),
(J ^= te[2]),
(ee ^= te[3]),
({ s0: V, s1: X, s2: J, s3: ee } = Kf(B, V, X, J, ee)),
(U[Y++] = V),
(U[Y++] = X),
(U[Y++] = J),
(U[Y++] = ee);
}
return B.fill(0), j;
},
decrypt: (b, k) => {
Sy(b);
const B = ky(i),
H = Wt(a),
U = Wf(b.length, k),
j = Wt(b),
F = Wt(U);
let V = H[0],
X = H[1],
J = H[2],
ee = H[3];
for (let Y = 0; Y + 4 <= j.length; ) {
const te = V,
ne = X,
Q = J,
ue = ee;
(V = j[Y + 0]),
(X = j[Y + 1]),
(J = j[Y + 2]),
(ee = j[Y + 3]);
const { s0: _e, s1: Ae, s2: le, s3: ce } = Ay(B, V, X, J, ee);
(F[Y++] = _e ^ te),
(F[Y++] = Ae ^ ne),
(F[Y++] = le ^ Q),
(F[Y++] = ce ^ ue);
}
return B.fill(0), xy(U, g);
},
};
}
);
/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */ function Vo(
i
) {
if (!Number.isSafeInteger(i)) throw new Error(`Wrong integer: ${i}`);
}
function Wn(...i) {
const a = (b, k) => (B) => b(k(B)),
u = Array.from(i)
.reverse()
.reduce((b, k) => (b ? a(b, k.encode) : k.encode), void 0),
g = i.reduce((b, k) => (b ? a(b, k.decode) : k.decode), void 0);
return { encode: u, decode: g };
}
function Gn(i) {
return {
encode: (a) => {
if (!Array.isArray(a) || (a.length && typeof a[0] != "number"))
throw new Error(
"alphabet.encode input should be an array of numbers"
);
return a.map((u) => {
if ((Vo(u), u < 0 || u >= i.length))
throw new Error(
`Digit index outside alphabet: ${u} (alphabet: ${i.length})`
);
return i[u];
});
},
decode: (a) => {
if (!Array.isArray(a) || (a.length && typeof a[0] != "string"))
throw new Error(
"alphabet.decode input should be array of strings"
);
return a.map((u) => {
if (typeof u != "string")
throw new Error(`alphabet.decode: not string element=${u}`);
const g = i.indexOf(u);
if (g === -1)
throw new Error(`Unknown letter: "${u}". Allowed: ${i}`);
return g;
});
},
};
}
function Zn(i = "") {
if (typeof i != "string")
throw new Error("join separator should be string");
return {
encode: (a) => {
if (!Array.isArray(a) || (a.length && typeof a[0] != "string"))
throw new Error("join.encode input should be array of strings");
for (let u of a)
if (typeof u != "string")
throw new Error(`join.encode: non-string input=${u}`);
return a.join(i);
},
decode: (a) => {
if (typeof a != "string")
throw new Error("join.decode input should be string");
return a.split(i);
},
};
}
function Us(i, a = "=") {
if ((Vo(i), typeof a != "string"))
throw new Error("padding chr should be string");
return {
encode(u) {
if (!Array.isArray(u) || (u.length && typeof u[0] != "string"))
throw new Error(
"padding.encode input should be array of strings"
);
for (let g of u)
if (typeof g != "string")
throw new Error(`padding.encode: non-string input=${g}`);
for (; (u.length * i) % 8; ) u.push(a);
return u;
},
decode(u) {
if (!Array.isArray(u) || (u.length && typeof u[0] != "string"))
throw new Error(
"padding.encode input should be array of strings"
);
for (let b of u)
if (typeof b != "string")
throw new Error(`padding.decode: non-string input=${b}`);
let g = u.length;
if ((g * i) % 8)
throw new Error(
"Invalid padding: string should have whole number of bytes"
);
for (; g > 0 && u[g - 1] === a; g--)
if (!(((g - 1) * i) % 8))
throw new Error(
"Invalid padding: string has too much padding"
);
return u.slice(0, g);
},
};
}
function Zf(i) {
if (typeof i != "function")
throw new Error("normalize fn should be function");
return { encode: (a) => a, decode: (a) => i(a) };
}
function Yf(i, a, u) {
if (a < 2)
throw new Error(
`convertRadix: wrong from=${a}, base cannot be less than 2`
);
if (u < 2)
throw new Error(
`convertRadix: wrong to=${u}, base cannot be less than 2`
);
if (!Array.isArray(i))
throw new Error("convertRadix: data should be array");
if (!i.length) return [];
let g = 0;
const b = [],
k = Array.from(i);
for (
k.forEach((B) => {
if ((Vo(B), B < 0 || B >= a))
throw new Error(`Wrong integer: ${B}`);
});
;
) {
let B = 0,
H = !0;
for (let U = g; U < k.length; U++) {
const j = k[U],
F = a * B + j;
if (
!Number.isSafeInteger(F) ||
(a * B) / a !== B ||
F - j !== a * B
)
throw new Error("convertRadix: carry overflow");
if (
((B = F % u),
(k[U] = Math.floor(F / u)),
!Number.isSafeInteger(k[U]) || k[U] * u + B !== F)
)
throw new Error("convertRadix: carry overflow");
if (H) k[U] ? (H = !1) : (g = U);
else continue;
}
if ((b.push(B), H)) break;
}
for (let B = 0; B < i.length - 1 && i[B] === 0; B++) b.push(0);
return b.reverse();
}
const Jf = (i, a) => (a ? Jf(a, i % a) : i),
Ms = (i, a) => i + (a - Jf(i, a));
function cu(i, a, u, g) {
if (!Array.isArray(i))
throw new Error("convertRadix2: data should be array");
if (a <= 0 || a > 32)
throw new Error(`convertRadix2: wrong from=${a}`);
if (u <= 0 || u > 32) throw new Error(`convertRadix2: wrong to=${u}`);
if (Ms(a, u) > 32)
throw new Error(
`convertRadix2: carry overflow from=${a} to=${u} carryBits=${Ms(
a,
u
)}`
);
let b = 0,
k = 0;
const B = 2 ** u - 1,
H = [];
for (const U of i) {
if ((Vo(U), U >= 2 ** a))
throw new Error(
`convertRadix2: invalid data word=${U} from=${a}`
);
if (((b = (b << a) | U), k + a > 32))
throw new Error(
`convertRadix2: carry overflow pos=${k} from=${a}`
);
for (k += a; k >= u; k -= u) H.push(((b >> (k - u)) & B) >>> 0);
b &= 2 ** k - 1;
}
if (((b = (b << (u - k)) & B), !g && k >= a))
throw new Error("Excess padding");
if (!g && b) throw new Error(`Non-zero padding: ${b}`);
return g && k > 0 && H.push(b >>> 0), H;
}
function Py(i) {
return (
Vo(i),
{
encode: (a) => {
if (!(a instanceof Uint8Array))
throw new Error("radix.encode input should be Uint8Array");
return Yf(Array.from(a), 2 ** 8, i);
},
decode: (a) => {
if (!Array.isArray(a) || (a.length && typeof a[0] != "number"))
throw new Error(
"radix.decode input should be array of strings"
);
return Uint8Array.from(Yf(a, i, 2 ** 8));
},
}
);
}
function $r(i, a = !1) {
if ((Vo(i), i <= 0 || i > 32))
throw new Error("radix2: bits should be in (0..32]");
if (Ms(8, i) > 32 || Ms(i, 8) > 32)
throw new Error("radix2: carry overflow");
return {
encode: (u) => {
if (!(u instanceof Uint8Array))
throw new Error("radix2.encode input should be Uint8Array");
return cu(Array.from(u), 8, i, !a);
},
decode: (u) => {
if (!Array.isArray(u) || (u.length && typeof u[0] != "number"))
throw new Error(
"radix2.decode input should be array of strings"
);
return Uint8Array.from(cu(u, i, 8, a));
},
};
}
function Xf(i) {
if (typeof i != "function")
throw new Error("unsafeWrapper fn should be function");
return function (...a) {
try {
return i.apply(null, a);
} catch {}
};
}
const Ly = Wn($r(4), Gn("0123456789ABCDEF"), Zn("")),
By = Wn($r(5), Gn("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), Us(5), Zn(""));
Wn($r(5), Gn("0123456789ABCDEFGHIJKLMNOPQRSTUV"), Us(5), Zn("")),
Wn(
$r(5),
Gn("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),
Zn(""),
Zf((i) => i.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1"))
);
const Hi = Wn(
$r(6),
Gn(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
),
Us(6),
Zn("")
),
Cy = Wn(
$r(6),
Gn(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
),
Us(6),
Zn("")
),
uu = (i) => Wn(Py(58), Gn(i), Zn("")),
lu = uu("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
uu("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),
uu("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");
const Qf = [0, 2, 3, 5, 6, 7, 9, 10, 11],
Iy = {
encode(i) {
let a = "";
for (let u = 0; u < i.length; u += 8) {
const g = i.subarray(u, u + 8);
a += lu.encode(g).padStart(Qf[g.length], "1");
}
return a;
},
decode(i) {
let a = [];
for (let u = 0; u < i.length; u += 11) {
const g = i.slice(u, u + 11),
b = Qf.indexOf(g.length),
k = lu.decode(g);
for (let B = 0; B < k.length - b; B++)
if (k[B] !== 0) throw new Error("base58xmr: wrong padding");
a = a.concat(Array.from(k.slice(k.length - b)));
}
return Uint8Array.from(a);
},
},
du = Wn(Gn("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), Zn("")),
eh = [996825010, 642813549, 513874426, 1027748829, 705979059];
function ji(i) {
const a = i >> 25;
let u = (i & 33554431) << 5;
for (let g = 0; g < eh.length; g++)
((a >> g) & 1) === 1 && (u ^= eh[g]);
return u;
}
function th(i, a, u = 1) {
const g = i.length;
let b = 1;
for (let k = 0; k < g; k++) {
const B = i.charCodeAt(k);
if (B < 33 || B > 126) throw new Error(`Invalid prefix (${i})`);
b = ji(b) ^ (B >> 5);
}
b = ji(b);
for (let k = 0; k < g; k++) b = ji(b) ^ (i.charCodeAt(k) & 31);
for (let k of a) b = ji(b) ^ k;
for (let k = 0; k < 6; k++) b = ji(b);
return (b ^= u), du.encode(cu([b % 2 ** 30], 30, 5, !1));
}
function nh(i) {
const a = i === "bech32" ? 1 : 734539939,
u = $r(5),
g = u.decode,
b = u.encode,
k = Xf(g);
function B(F, V, X = 90) {
if (typeof F != "string")
throw new Error(
`bech32.encode prefix should be string, not ${typeof F}`
);
if (!Array.isArray(V) || (V.length && typeof V[0] != "number"))
throw new Error(
`bech32.encode words should be array of numbers, not ${typeof V}`
);
const J = F.length + 7 + V.length;
if (X !== !1 && J > X)
throw new TypeError(`Length ${J} exceeds limit ${X}`);
return (F = F.toLowerCase()), `${F}1${du.encode(V)}${th(F, V, a)}`;
}
function H(F, V = 90) {
if (typeof F != "string")
throw new Error(
`bech32.decode input should be string, not ${typeof F}`
);
if (F.length < 8 || (V !== !1 && F.length > V))
throw new TypeError(
`Wrong string length: ${F.length} (${F}). Expected (8..${V})`
);
const X = F.toLowerCase();
if (F !== X && F !== F.toUpperCase())
throw new Error("String must be lowercase or uppercase");
F = X;
const J = F.lastIndexOf("1");
if (J === 0 || J === -1)
throw new Error(
'Letter "1" must be present between prefix and data only'
);
const ee = F.slice(0, J),
Y = F.slice(J + 1);
if (Y.length < 6)
throw new Error("Data must be at least 6 characters long");
const te = du.decode(Y).slice(0, -6),
ne = th(ee, te, a);
if (!Y.endsWith(ne))
throw new Error(`Invalid checksum in ${F}: expected "${ne}"`);
return { prefix: ee, words: te };
}
const U = Xf(H);
function j(F) {
const { prefix: V, words: X } = H(F, !1);
return { prefix: V, words: X, bytes: g(X) };
}
return {
encode: B,
decode: H,
decodeToBytes: j,
decodeUnsafe: U,
fromWords: g,
fromWordsUnsafe: k,
toWords: b,
};
}
const rh = nh("bech32");
nh("bech32m");
const Oy = {
encode: (i) => new TextDecoder().decode(i),
decode: (i) => new TextEncoder().encode(i),
},
Ny = Wn(
$r(4),
Gn("0123456789abcdef"),
Zn(""),
Zf((i) => {
if (typeof i != "string" || i.length % 2)
throw new TypeError(
`hex.decode: expected string, got ${typeof i} with length ${
i.length
}`
);
return i.toLowerCase();
})
);
`${Object.keys({
utf8: Oy,
hex: Ny,
base16: Ly,
base32: By,
base64: Hi,
base64url: Cy,
base58: lu,
base58xmr: Iy,
}).join(", ")}`;
var mo = Symbol("verified"),
Ry = (i) => i instanceof Object;
function zy(i) {
if (
!Ry(i) ||
typeof i.kind != "number" ||
typeof i.content != "string" ||
typeof i.created_at != "number" ||
typeof i.pubkey != "string" ||
!i.pubkey.match(/^[a-f0-9]{64}$/) ||
!Array.isArray(i.tags)
)
return !1;
for (let a = 0; a < i.tags.length; a++) {
let u = i.tags[a];
if (!Array.isArray(u)) return !1;
for (let g = 0; g < u.length; g++)
if (typeof u[g] == "object") return !1;
}
return !0;
}
var Uy = new TextDecoder("utf-8"),
oh = new TextEncoder();
function Di(i) {
i.indexOf("://") === -1 && (i = "wss://" + i);
let a = new URL(i);
return (
(a.pathname = a.pathname.replace(/\/+/g, "/")),
a.pathname.endsWith("/") && (a.pathname = a.pathname.slice(0, -1)),
((a.port === "80" && a.protocol === "ws:") ||
(a.port === "443" && a.protocol === "wss:")) &&
(a.port = ""),
a.searchParams.sort(),
(a.hash = ""),
a.toString()
);
}
var My = class {
constructor(i) {
ae(this, "value"),
ae(this, "next", null),
ae(this, "prev", null),
(this.value = i);
}
},
Hy = class {
constructor() {
ae(this, "first"),
ae(this, "last"),
(this.first = null),
(this.last = null);
}
enqueue(i) {
const a = new My(i);
return (
this.last
? this.last === this.first
? ((this.last = a),
(this.last.prev = this.first),
(this.first.next = a))
: ((a.prev = this.last),
(this.last.next = a),
(this.last = a))
: ((this.first = a), (this.last = a)),
!0
);
}
dequeue() {
if (!this.first) return null;
if (this.first === this.last) {
const a = this.first;
return (this.first = null), (this.last = null), a.value;
}
const i = this.first;
return (this.first = i.next), i.value;
}
},
jy = class {
generateSecretKey() {
return zt.utils.randomPrivateKey();
}
getPublicKey(i) {
return Rt(zt.getPublicKey(i));
}
finalizeEvent(i, a) {
const u = i;
return (
(u.pubkey = Rt(zt.getPublicKey(a))),
(u.id = fu(u)),
(u.sig = Rt(zt.sign(fu(u), a))),
(u[mo] = !0),
u
);
}
verifyEvent(i) {
if (typeof i[mo] == "boolean") return i[mo];
const a = fu(i);
if (a !== i.id) return (i[mo] = !1), !1;
try {
const u = zt.verify(i.sig, a, i.pubkey);
return (i[mo] = u), u;
} catch {
return (i[mo] = !1), !1;
}
}
};
function Dy(i) {
if (!zy(i))
throw new Error(
"can't serialize event with wrong or missing properties"
);
return JSON.stringify([
0,
i.pubkey,
i.created_at,
i.kind,
i.tags,
i.content,
]);
}
function fu(i) {
let a = eu(oh.encode(Dy(i)));
return Rt(a);
}
var Hs = new jy(),
qy = Hs.generateSecretKey,
Vy = Hs.getPublicKey,
Fy = Hs.finalizeEvent,
ih = Hs.verifyEvent;
async function Ky(i, a, u) {
const g = i instanceof Uint8Array ? Rt(i) : i,
b = Ri.getSharedSecret(g, "02" + a),
k = sh(b);
let B = Uint8Array.from(Um(16)),
H = oh.encode(u),
U = Gf(k, B).encrypt(H),
j = Hi.encode(new Uint8Array(U)),
F = Hi.encode(new Uint8Array(B.buffer));
return `${j}?iv=${F}`;
}
async function Wy(i, a, u) {
const g = i instanceof Uint8Array ? Rt(i) : i;
let [b, k] = u.split("?iv="),
B = Ri.getSharedSecret(g, "02" + a),
H = sh(B),
U = Hi.decode(k),
j = Hi.decode(b),
F = Gf(H, U).decrypt(j);
return Uy.decode(F);
}
function sh(i) {
return i.slice(1, 33);
}
var Gy = /^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,
Zy;
try {
Zy = fetch;
} catch {}
var Yy = 22242,
hu = 24133,
Jy = 31990;
function Xy(i, a) {
if (
(i.ids &&
i.ids.indexOf(a.id) === -1 &&
!i.ids.some((u) => a.id.startsWith(u))) ||
(i.kinds && i.kinds.indexOf(a.kind) === -1) ||
(i.authors &&
i.authors.indexOf(a.pubkey) === -1 &&
!i.authors.some((u) => a.pubkey.startsWith(u)))
)
return !1;
for (let u in i)
if (u[0] === "#") {
let g = u.slice(1),
b = i[`#${g}`];
if (
b &&
!a.tags.find(
([k, B]) => k === u.slice(1) && b.indexOf(B) !== -1
)
)
return !1;
}
return !(
(i.since && a.created_at < i.since) ||
(i.until && a.created_at > i.until)
);
}
function Qy(i, a) {
for (let u = 0; u < i.length; u++) if (Xy(i[u], a)) return !0;
return !1;
}
function e1(i, a) {
let u = a.length + 3,
g = i.indexOf(`"${a}":`) + u,
b = i.slice(g).indexOf('"') + g + 1;
return i.slice(b, b + 64);
}
function t1(i) {
let a = i.slice(0, 22).indexOf('"EVENT"');
if (a === -1) return null;
let u = i.slice(a + 7 + 1).indexOf('"');
if (u === -1) return null;
let g = a + 7 + 1 + u,
b = i.slice(g + 1, 80).indexOf('"');
if (b === -1) return null;
let k = g + 1 + b;
return i.slice(g + 1, k);
}
function n1(i, a) {
return {
kind: Yy,
created_at: Math.floor(Date.now() / 1e3),
tags: [
["relay", i],
["challenge", a],
],
content: "",
};
}
async function r1() {
return new Promise((i) => {
const a = new MessageChannel(),
u = () => {
a.port1.removeEventListener("message", u), i();
};
a.port1.addEventListener("message", u),
a.port2.postMessage(0),
a.port1.start();
});
}
var o1 = (i) => ((i[mo] = !0), !0),
ah;
try {
ah = WebSocket;
} catch {}
var ch = class {
constructor(i, a) {
ae(this, "url"),
ae(this, "_connected", !1),
ae(this, "onclose", null),
ae(this, "onnotice", (u) =>
console.debug(`NOTICE from ${this.url}: ${u}`)
),
ae(this, "_onauth", null),
ae(this, "baseEoseTimeout", 4400),
ae(this, "connectionTimeout", 4400),
ae(this, "openSubs", new Map()),
ae(this, "connectionTimeoutHandle"),
ae(this, "connectionPromise"),
ae(this, "openCountRequests", new Map()),
ae(this, "openEventPublishes", new Map()),
ae(this, "ws"),
ae(this, "incomingMessageQueue", new Hy()),
ae(this, "queueRunning", !1),
ae(this, "challenge"),
ae(this, "serial", 0),
ae(this, "verifyEvent"),
(this.url = Di(i)),
(this.verifyEvent = a.verifyEvent);
}
static async connect(i, a) {
const u = new ch(i, a);
return await u.connect(), u;
}
closeAllSubscriptions(i) {
for (let [a, u] of this.openSubs) u.close(i);
this.openSubs.clear();
for (let [a, u] of this.openEventPublishes)
u.reject(new Error(i));
this.openEventPublishes.clear();
for (let [a, u] of this.openCountRequests) u.reject(new Error(i));
this.openCountRequests.clear();
}
get connected() {
return this._connected;
}
async connect() {
return this.connectionPromise
? this.connectionPromise
: ((this.challenge = void 0),
(this.connectionPromise = new Promise((i, a) => {
this.connectionTimeoutHandle = setTimeout(() => {
var u;
a("connection timed out"),
(this.connectionPromise = void 0),
(u = this.onclose) == null || u.call(this),
this.closeAllSubscriptions(
"relay connection timed out"
);
}, this.connectionTimeout);
try {
this.ws = new ah(this.url);
} catch (u) {
a(u);
return;
}
(this.ws.onopen = () => {
clearTimeout(this.connectionTimeoutHandle),
(this._connected = !0),
i();
}),
(this.ws.onerror = (u) => {
var g;
a(u.message),
this._connected &&
((this._connected = !1),
(this.connectionPromise = void 0),
(g = this.onclose) == null || g.call(this),
this.closeAllSubscriptions(
"relay connection errored"
));
}),
(this.ws.onclose = async () => {
var u;
this._connected &&
((this._connected = !1),
(this.connectionPromise = void 0),
(u = this.onclose) == null || u.call(this),
this.closeAllSubscriptions(
"relay connection closed"
));
}),
(this.ws.onmessage = this._onmessage.bind(this));
})),
this.connectionPromise);
}
async runQueue() {
for (this.queueRunning = !0; this.handleNext() !== !1; )
await r1();
this.queueRunning = !1;
}
handleNext() {
var i, a, u;
const g = this.incomingMessageQueue.dequeue();
if (!g) return !1;
const b = t1(g);
if (b) {
const k = this.openSubs.get(b);
if (!k) return;
const B = e1(g, "id"),
H = (i = k.alreadyHaveEvent) == null ? void 0 : i.call(k, B);
if (((a = k.receivedEvent) == null || a.call(k, this, B), H))
return;
}
try {
let k = JSON.parse(g);
switch (k[0]) {
case "EVENT": {
const B = this.openSubs.get(k[1]),
H = k[2];
this.verifyEvent(H) && Qy(B.filters, H) && B.onevent(H);
return;
}
case "COUNT": {
const B = k[1],
H = k[2],
U = this.openCountRequests.get(B);
U && (U.resolve(H.count), this.openCountRequests.delete(B));
return;
}
case "EOSE": {
const B = this.openSubs.get(k[1]);
if (!B) return;
B.receivedEose();
return;
}
case "OK": {
const B = k[1],
H = k[2],
U = k[3],
j = this.openEventPublishes.get(B);
H ? j.resolve(U) : j.reject(new Error(U)),
this.openEventPublishes.delete(B);
return;
}
case "CLOSED": {
const B = k[1],
H = this.openSubs.get(B);
if (!H) return;
(H.closed = !0), H.close(k[2]);
return;
}
case "NOTICE":
this.onnotice(k[1]);
return;
case "AUTH": {
(this.challenge = k[1]),
(u = this._onauth) == null || u.call(this, k[1]);
return;
}
}
} catch {
return;
}
}
async send(i) {
if (!this.connectionPromise)
throw new Error("sending on closed connection");
this.connectionPromise.then(() => {
var a;
(a = this.ws) == null || a.send(i);
});
}
async auth(i) {
if (!this.challenge)
throw new Error(
"can't perform auth, no challenge was received"
);
const a = await i(n1(this.url, this.challenge)),
u = new Promise((g, b) => {
this.openEventPublishes.set(a.id, { resolve: g, reject: b });
});
return this.send('["AUTH",' + JSON.stringify(a) + "]"), u;
}
async publish(i) {
const a = new Promise((u, g) => {
this.openEventPublishes.set(i.id, { resolve: u, reject: g });
});
return this.send('["EVENT",' + JSON.stringify(i) + "]"), a;
}
async count(i, a) {
this.serial++;
const u = (a == null ? void 0 : a.id) || "count:" + this.serial,
g = new Promise((b, k) => {
this.openCountRequests.set(u, { resolve: b, reject: k });
});
return (
this.send('["COUNT","' + u + '",' + JSON.stringify(i) + "]"), g
);
}
subscribe(i, a) {
const u = this.prepareSubscription(i, a);
return u.fire(), u;
}
prepareSubscription(i, a) {
this.serial++;
const u = a.id || "sub:" + this.serial,
g = new i1(this, u, i, a);
return this.openSubs.set(u, g), g;
}
close() {
var i;
this.closeAllSubscriptions("relay connection closed by us"),
(this._connected = !1),
(i = this.ws) == null || i.close();
}
_onmessage(i) {
this.incomingMessageQueue.enqueue(i.data),
this.queueRunning || this.runQueue();
}
},
i1 = class {
constructor(i, a, u, g) {
ae(this, "relay"),
ae(this, "id"),
ae(this, "closed", !1),
ae(this, "eosed", !1),
ae(this, "filters"),
ae(this, "alreadyHaveEvent"),
ae(this, "receivedEvent"),
ae(this, "onevent"),
ae(this, "oneose"),
ae(this, "onclose"),
ae(this, "eoseTimeout"),
ae(this, "eoseTimeoutHandle"),
(this.relay = i),
(this.filters = u),
(this.id = a),
(this.alreadyHaveEvent = g.alreadyHaveEvent),
(this.receivedEvent = g.receivedEvent),
(this.eoseTimeout = g.eoseTimeout || i.baseEoseTimeout),
(this.oneose = g.oneose),
(this.onclose = g.onclose),
(this.onevent =
g.onevent ||
((b) => {
console.warn(
`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,
b
);
}));
}
fire() {
this.relay.send(
'["REQ","' +
this.id +
'",' +
JSON.stringify(this.filters).substring(1)
),
(this.eoseTimeoutHandle = setTimeout(
this.receivedEose.bind(this),
this.eoseTimeout
));
}
receivedEose() {
var i;
this.eosed ||
(clearTimeout(this.eoseTimeoutHandle),
(this.eosed = !0),
(i = this.oneose) == null || i.call(this));
}
close(i = "closed by caller") {
var a;
!this.closed &&
this.relay.connected &&
(this.relay.send('["CLOSE",' + JSON.stringify(this.id) + "]"),
(this.closed = !0)),
this.relay.openSubs.delete(this.id),
(a = this.onclose) == null || a.call(this, i);
}
},
s1 = class {
constructor(i) {
ae(this, "relays", new Map()),
ae(this, "seenOn", new Map()),
ae(this, "trackRelays", !1),
ae(this, "verifyEvent"),
ae(this, "trustedRelayURLs", new Set()),
(this.verifyEvent = i.verifyEvent);
}
async ensureRelay(i, a) {
i = Di(i);
let u = this.relays.get(i);
return (
u ||
((u = new ch(i, {
verifyEvent: this.trustedRelayURLs.has(i)
? o1
: this.verifyEvent,
})),
a != null &&
a.connectionTimeout &&
(u.connectionTimeout = a.connectionTimeout),
this.relays.set(i, u)),
await u.connect(),
u
);
}
close(i) {
i.map(Di).forEach((a) => {
var u;
(u = this.relays.get(a)) == null || u.close();
});
}
subscribeMany(i, a, u) {
return this.subscribeManyMap(
Object.fromEntries(i.map((g) => [g, a])),
u
);
}
subscribeManyMap(i, a) {
this.trackRelays &&
(a.receivedEvent = (V, X) => {
let J = this.seenOn.get(X);
J || ((J = new Set()), this.seenOn.set(X, J)), J.add(V);
});
const u = new Set(),
g = [],
b = Object.keys(i).length,
k = [];
let B = (V) => {
var X;
(k[V] = !0),
k.filter((J) => J).length === b &&
((X = a.oneose) == null || X.call(a), (B = () => {}));
};
const H = [];
let U = (V, X) => {
var J;
B(V),
(H[V] = X),
H.filter((ee) => ee).length === b &&
((J = a.onclose) == null || J.call(a, H), (U = () => {}));
};
const j = (V) => {
var X;
if ((X = a.alreadyHaveEvent) != null && X.call(a, V))
return !0;
const J = u.has(V);
return u.add(V), J;
},
F = Promise.all(
Object.entries(i).map(async (V, X, J) => {
if (J.indexOf(V) !== X) {
U(X, "duplicate url");
return;
}
let [ee, Y] = V;
ee = Di(ee);
let te;
try {
te = await this.ensureRelay(ee, {
connectionTimeout: a.maxWait
? Math.max(a.maxWait * 0.8, a.maxWait - 1e3)
: void 0,
});
} catch (Q) {
U(X, (Q == null ? void 0 : Q.message) || String(Q));
return;
}
let ne = te.subscribe(Y, {
...a,
oneose: () => B(X),
onclose: (Q) => U(X, Q),
alreadyHaveEvent: j,
eoseTimeout: a.maxWait,
});
g.push(ne);
})
);
return {
async close() {
await F,
g.forEach((V) => {
V.close();
});
},
};
}
subscribeManyEose(i, a, u) {
const g = this.subscribeMany(i, a, {
...u,
oneose() {
g.close();
},
});
return g;
}
async querySync(i, a, u) {
return new Promise(async (g) => {
const b = [];
this.subscribeManyEose(i, [a], {
...u,
onevent(k) {
b.push(k);
},
onclose(k) {
g(b);
},
});
});
}
async get(i, a, u) {
a.limit = 1;
const g = await this.querySync(i, a, u);
return (
g.sort((b, k) => k.created_at - b.created_at), g[0] || null
);
}
publish(i, a) {
return i
.map(Di)
.map(async (u, g, b) =>
b.indexOf(u) !== g
? Promise.reject("duplicate url")
: (await this.ensureRelay(u)).publish(a)
);
}
},
a1 = class extends s1 {
constructor() {
super({ verifyEvent: ih });
}
},
uh;
try {
uh = fetch;
} catch {}
var js = /^bunker:\/\/([0-9a-f]{64})\??([?\/\w:.=&%]*)$/;
async function c1(i) {
let a = i.match(js);
if (a)
try {
const u = a[1],
g = new URLSearchParams(a[2]);
return {
pubkey: u,
relays: g.getAll("relay"),
secret: g.get("secret"),
};
} catch {}
return lh(i);
}
async function lh(i) {
const a = i.match(Gy);
if (!a) return null;
const [u, g = "_", b] = a;
try {
const k = `https://${b}/.well-known/nostr.json?name=${g}`,
B = await (await uh(k, { redirect: "error" })).json();
let H = B.names[g],
U = B.nip46[H] || [];
return { pubkey: H, relays: U, secret: null };
} catch {
return null;
}
}
var dh = class {
constructor(i, a, u = {}) {
if (
(ae(this, "pool"),
ae(this, "subCloser"),
ae(this, "isOpen"),
ae(this, "serial"),
ae(this, "idPrefix"),
ae(this, "listeners"),
ae(this, "waitingForAuth"),
ae(this, "secretKey"),
ae(this, "bp"),
a.relays.length === 0)
)
throw new Error("no relays are specified for this bunker");
(this.pool = u.pool || new a1()),
(this.secretKey = i),
(this.bp = a),
(this.isOpen = !1),
(this.idPrefix = Math.random().toString(36).substring(7)),
(this.serial = 0),
(this.listeners = {}),
(this.waitingForAuth = {});
const g = this.listeners,
b = this.waitingForAuth;
(this.subCloser = this.pool.subscribeMany(
this.bp.relays,
[{ kinds: [hu], "#p": [Vy(this.secretKey)] }],
{
async onevent(k) {
const {
id: B,
result: H,
error: U,
} = JSON.parse(await Wy(i, k.pubkey, k.content));
if (H === "auth_url" && b[B]) {
delete b[B],
u.onauth
? u.onauth(U)
: console.warn(
`nostr-tools/nip46: remote signer ${a.pubkey} tried to send an "auth_url"='${U}' but there was no onauth() callback configured.`
);
return;
}
let j = g[B];
j && (U ? j.reject(U) : H && j.resolve(H), delete g[B]);
},
}
)),
(this.isOpen = !0);
}
async close() {
(this.isOpen = !1), this.subCloser.close();
}
async sendRequest(i, a) {
return new Promise(async (u, g) => {
try {
if (!this.isOpen)
throw new Error(
"this signer is not open anymore, create a new one"
);
this.serial++;
const b = `${this.idPrefix}-${this.serial}`,
k = await Ky(
this.secretKey,
this.bp.pubkey,
JSON.stringify({ id: b, method: i, params: a })
),
B = Fy(
{
kind: hu,
tags: [["p", this.bp.pubkey]],
content: k,
created_at: Math.floor(Date.now() / 1e3),
},
this.secretKey
);
(this.listeners[b] = { resolve: u, reject: g }),
(this.waitingForAuth[b] = !0),
await Promise.any(this.pool.publish(this.bp.relays, B));
} catch (b) {
g(b);
}
});
}
async ping() {
let i = await this.sendRequest("ping", []);
if (i !== "pong") throw new Error(`result is not pong: ${i}`);
}
async connect() {
await this.sendRequest("connect", [
this.bp.pubkey,
this.bp.secret || "",
]);
}
async getPublicKey() {
return this.bp.pubkey;
}
async getRelays() {
return JSON.parse(await this.sendRequest("get_relays", []));
}
async signEvent(i) {
let a = await this.sendRequest("sign_event", [JSON.stringify(i)]),
u = JSON.parse(a);
if (u.pubkey === this.bp.pubkey && ih(u)) return u;
throw new Error(
`event returned from bunker is improperly signed: ${JSON.stringify(
u
)}`
);
}
async nip04Encrypt(i, a) {
return await this.sendRequest("nip04_encrypt", [i, a]);
}
async nip04Decrypt(i, a) {
return await this.sendRequest("nip04_decrypt", [i, a]);
}
async nip44GetKey(i) {
let a = await this.sendRequest("nip44_get_key", [i]);
return Ic(a);
}
async nip44Encrypt(i, a) {
return await this.sendRequest("nip44_encrypt", [i, a]);
}
async nip44Decrypt(i, a) {
return await this.sendRequest("nip44_encrypt", [i, a]);
}
};
async function u1(i, a, u, g, b) {
let k = qy(),
B = new dh(k, i.bunkerPointer, a),
H = await B.sendRequest("create_account", [u, g, ""]);
return (B.bp.pubkey = H), await B.connect(), B;
}
async function l1(i, a) {
const u = await i.querySync(a, {
kinds: [Jy],
"#k": [hu.toString()],
});
return (
u.sort((g, b) => b.created_at - g.created_at),
(
await Promise.all(
u.map(async (g, b) => {
try {
const k = JSON.parse(g.content);
try {
if (
u.findIndex(
(H) => JSON.parse(H.content).nip05 === k.nip05
) !== b
)
return;
} catch {}
const B = await lh(k.nip05);
if (B && B.pubkey === g.pubkey && B.relays.length)
return {
bunkerPointer: B,
nip05: k.nip05,
domain: k.nip05.split("@")[1],
name: k.name || k.display_name,
picture: k.picture,
about: k.about,
website: k.website,
local: !1,
};
} catch {
return;
}
})
)
).filter((g) => g !== void 0)
);
}
var fh = /^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,
hh;
try {
hh = fetch;
} catch {}
async function d1(i) {
var a;
const u = i.match(fh);
if (!u) return null;
const [g, b = "_", k] = u;
try {
const B = `https://${k}/.well-known/nostr.json?name=${b}`,
H = await (await hh(B, { redirect: "error" })).json();
let U = H.names[b];
return U
? { pubkey: U, relays: (a = H.relays) == null ? void 0 : a[U] }
: null;
} catch {
return null;
}
}
new TextDecoder("utf-8"), new TextEncoder();
var f1 = 5e3;
function h1(i) {
return g1("npub", Ic(i));
}
function p1(i, a) {
let u = rh.toWords(a);
return rh.encode(i, u, f1);
}
function g1(i, a) {
return p1(i, a);
}
const Fo = [];
function w1(i, a = c) {
let u;
const g = new Set();
function b(H) {
if (m(i, H) && ((i = H), u)) {
const U = !Fo.length;
for (const j of g) j[1](), Fo.push(j, i);
if (U) {
for (let j = 0; j < Fo.length; j += 2) Fo[j][0](Fo[j + 1]);
Fo.length = 0;
}
}
}
function k(H) {
b(H(i));
}
function B(H, U = c) {
const j = [H, U];
return (
g.add(j),
g.size === 1 && (u = a(b, k) || c),
H(i),
() => {
g.delete(j), g.size === 0 && u && (u(), (u = null));
}
);
}
return { set: b, update: k, subscribe: B };
}
const m1 = (i) => {
const { subscribe: a, set: u } = w1(void 0, () => {
let g = window.matchMedia(i);
u(g.matches);
const b = () => u(g.matches);
return (
"addEventListener" in g
? g.addEventListener("change", b)
: g.addListener(b),
() => {
"removeEventListener" in g
? g.removeEventListener("change", b)
: g.removeListener(b);
}
);
});
return { subscribe: a };
};
function b1(i) {
let a, u, g;
return {
c() {
(a = _("svg")),
(u = _("circle")),
(g = _("path")),
x(u, "class", "opacity-25"),
x(u, "cx", "12"),
x(u, "cy", "12"),
x(u, "r", "10"),
x(u, "stroke", "currentColor"),
x(u, "stroke-width", "4"),
x(g, "class", "opacity-75"),
x(g, "fill", "currentColor"),
x(
g,
"d",
"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
),
x(a, "class", "ml-2 h-5 w-5 animate-spin text-white"),
x(a, "xmlns", "http://www.w3.org/2000/svg"),
x(a, "fill", "none"),
x(a, "viewBox", "0 0 24 24");
},
m(b, k) {
N(b, a, k), T(a, u), T(a, g);
},
p: c,
i: c,
o: c,
d(b) {
b && l(a);
},
};
}
class ph extends tf {
constructor(a) {
super(), ef(this, a, null, b1, m, {});
}
}
const { window: pu } = M;
function gh(i, a, u) {
const g = i.slice();
return (g[78] = a[u]), g;
}
function y1(i) {
let a,
u,
g,
b,
k,
B,
H,
U,
j,
F,
V,
X,
J = !i[20] && !i[13] && !i[14] && !i[15] && wh(i);
const ee = [T1, x1, $1, S1, A1, k1, E1],
Y = [];
function te(ne, Q) {
return ne[13]
? 0
: ne[14]
? 1
: ne[15]
? 2
: ne[20]
? 3
: ne[17]
? 4
: ne[21]
? 6
: 5;
}
return (
(H = te(i)),
(U = Y[H] = ee[H](i)),
{
c() {
(a = p("div")),
(u = p("button")),
(g = $("")),
(k = R()),
J && J.c(),
(B = R()),
U.c(),
x(
u,
"class",
(b =
"absolute right-2 top-0 cursor-pointer bg-transparent text-3xl text-" +
i[0] +
"-600")
),
x(
a,
"class",
(j =
"animate-show rounded-md bg-gradient-to-b px-8 py-8 shadow-[0_0px_30px_0px_rgba(0,0,0,0.6)] transition-all sm:w-96 from-" +
i[0] +
"-900 to-" +
i[0] +
"-700 " +
i[27])
);
},
m(ne, Q) {
N(ne, a, Q),
T(a, u),
T(u, g),
T(a, k),
J && J.m(a, null),
T(a, B),
Y[H].m(a, null),
(F = !0),
V ||
((X = E(u, "click", function () {
y(i[20] ? i[32] : i[30]) &&
(i[20] ? i[32] : i[30]).apply(this, arguments);
})),
(V = !0));
},
p(ne, Q) {
(i = ne),
(!F ||
(Q[0] & 1 &&
b !==
(b =
"absolute right-2 top-0 cursor-pointer bg-transparent text-3xl text-" +
i[0] +
"-600"))) &&
x(u, "class", b),
!i[20] && !i[13] && !i[14] && !i[15]
? J
? J.p(i, Q)
: ((J = wh(i)), J.c(), J.m(a, B))
: J && (J.d(1), (J = null));
let ue = H;
(H = te(i)),
H === ue
? Y[H].p(i, Q)
: (yt(),
Yt(Y[ue], 1, 1, () => {
Y[ue] = null;
}),
Nt(),
(U = Y[H]),
U ? U.p(i, Q) : ((U = Y[H] = ee[H](i)), U.c()),
St(U, 1),
U.m(a, null)),
(!F ||
(Q[0] & 134217729 &&
j !==
(j =
"animate-show rounded-md bg-gradient-to-b px-8 py-8 shadow-[0_0px_30px_0px_rgba(0,0,0,0.6)] transition-all sm:w-96 from-" +
i[0] +
"-900 to-" +
i[0] +
"-700 " +
i[27]))) &&
x(a, "class", j);
},
i(ne) {
F || (St(U), (F = !0));
},
o(ne) {
Yt(U), (F = !1);
},
d(ne) {
ne && l(a), J && J.d(), Y[H].d(), (V = !1), X();
},
}
);
}
function v1(i) {
let a, u, g, b, k;
const B = [N1, O1, I1, C1, B1],
H = [];
function U(j, F) {
return j[12]
? 0
: !j[21] && !j[2]
? 1
: !j[21] && j[2]
? 2
: j[2]
? 4
: 3;
}
return (
(u = U(i)),
(g = H[u] = B[u](i)),
{
c() {
(a = p("div")),
g.c(),
x(
a,
"class",
(b =
"rounded px-2 py-2 shadow-[0_0px_10px_0px_rgba(0,0,0,0.3)] transition-all duration-200 bg-" +
i[0] +
"-700 hover:bg-" +
i[0] +
"-800 " +
i[27])
);
},
m(j, F) {
N(j, a, F), H[u].m(a, null), (k = !0);
},
p(j, F) {
let V = u;
(u = U(j)),
u === V
? H[u].p(j, F)
: (yt(),
Yt(H[V], 1, 1, () => {
H[V] = null;
}),
Nt(),
(g = H[u]),
g ? g.p(j, F) : ((g = H[u] = B[u](j)), g.c()),
St(g, 1),
g.m(a, null)),
(!k ||
(F[0] & 134217729 &&
b !==
(b =
"rounded px-2 py-2 shadow-[0_0px_10px_0px_rgba(0,0,0,0.3)] transition-all duration-200 bg-" +
j[0] +
"-700 hover:bg-" +
j[0] +
"-800 " +
j[27]))) &&
x(a, "class", b);
},
i(j) {
k || (St(g), (k = !0));
},
o(j) {
Yt(g), (k = !1);
},
d(j) {
j && l(a), H[u].d();
},
}
);
}
function _1(i) {
return { c, m: c, p: c, i: c, o: c, d: c };
}
function wh(i) {
let a, u, g, b, k;
return {
c() {
(a = p("button")),
(u = $("?")),
x(
a,
"class",
(g =
"absolute bottom-1 right-3 cursor-pointer bg-transparent text-xl text-" +
i[0] +
"-600")
);
},
m(B, H) {
N(B, a, H), T(a, u), b || ((k = E(a, "click", i[31])), (b = !0));
},
p(B, H) {
H[0] & 1 &&
g !==
(g =
"absolute bottom-1 right-3 cursor-pointer bg-transparent text-xl text-" +
B[0] +
"-600") &&
x(a, "class", g);
},
d(B) {
B && l(a), (b = !1), k();
},
};
}
function E1(i) {
let a,
u,
g,
b,
k,
B,
H = i[21].npub + "",
U,
j,
F,
V,
X,
J,
ee,
Y,
te,
ne,
Q,
ue = Rf(i[11]) + "",
_e,
Ae,
le,
ce = (i[21].picture || i[21].name) && mh(i);
return {
c() {
(a = p("div")),
(u = p("div")),
(u.textContent = "You are connected to Nostr as"),
(g = R()),
(b = p("a")),
ce && ce.c(),
(k = R()),
(B = p("div")),
(U = $(H)),
(F = R()),
(V = p("button")),
(X = $("Disconnect")),
(ee = R()),
(Y = p("div")),
(te = $("This webpage is using the public key:")),
(ne = p("br")),
(Q = R()),
(_e = $(ue)),
x(u, "class", "mb-4 text-sm"),
x(B, "class", "block break-all"),
x(b, "target", "_blank"),
x(b, "href", (j = "https://nosta.me/" + i[21].npub)),
x(b, "class", "group text-white no-underline"),
x(a, "class", "text-center"),
x(
V,
"class",
(J =
"my-2 mt-6 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white bg-" +
i[0] +
"-900 hover:bg-" +
i[0] +
"-950")
),
x(Y, "class", "mt-6 block break-all text-center text-sm");
},
m(ie, fe) {
N(ie, a, fe),
T(a, u),
T(a, g),
T(a, b),
ce && ce.m(b, null),
T(b, k),
T(b, B),
T(B, U),
N(ie, F, fe),
N(ie, V, fe),
T(V, X),
N(ie, ee, fe),
N(ie, Y, fe),
T(Y, te),
T(Y, ne),
T(Y, Q),
T(Y, _e),
Ae || ((le = E(V, "click", i[34])), (Ae = !0));
},
p(ie, fe) {
ie[21].picture || ie[21].name
? ce
? ce.p(ie, fe)
: ((ce = mh(ie)), ce.c(), ce.m(b, k))
: ce && (ce.d(1), (ce = null)),
fe[0] & 2097152 && H !== (H = ie[21].npub + "") && q(U, H),
fe[0] & 2097152 &&
j !== (j = "https://nosta.me/" + ie[21].npub) &&
x(b, "href", j),
fe[0] & 1 &&
J !==
(J =
"my-2 mt-6 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white bg-" +
ie[0] +
"-900 hover:bg-" +
ie[0] +
"-950") &&
x(V, "class", J),
fe[0] & 2048 && ue !== (ue = Rf(ie[11]) + "") && q(_e, ue);
},
i: c,
o: c,
d(ie) {
ie && (l(a), l(F), l(V), l(ee), l(Y)),
ce && ce.d(),
(Ae = !1),
le();
},
};
}
function k1(i) {
let a,
u,
g,
b,
k,
B,
H,
U,
j,
F,
V,
X,
J,
ee,
Y,
te,
ne,
Q = i[19] && vh(i);
const ue = [L1, P1],
_e = [];
function Ae(ie, fe) {
return ie[12] ? 0 : 1;
}
(U = Ae(i)), (j = _e[U] = ue[U](i));
let le = i[12] && i[16] && _h(i),
ce = !i[12] && Eh(i);
return {
c() {
(a = p("div")),
(a.textContent = "How do you want to connect to Nostr?"),
(u = R()),
(g = p("form")),
(b = p("input")),
(k = R()),
Q && Q.c(),
(B = R()),
(H = p("button")),
j.c(),
(X = R()),
le && le.c(),
(J = R()),
ce && ce.c(),
(ee = L()),
x(a, "class", "text-center text-lg"),
x(
b,
"class",
"box-border w-full rounded px-2 py-1 text-lg text-neutral-800 outline-none"
),
x(b, "placeholder", "user@provider or bunker://..."),
(b.autofocus = !0),
(b.disabled = i[12]),
x(b, "autocapitalize", "none"),
x(
H,
"class",
(F =
"mt-4 flex w-full cursor-pointer items-center justify-center rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-" +
i[0] +
"-900 hover:bg-" +
i[0] +
"-950")
),
(H.disabled = V = !i[26] || i[12]),
x(g, "class", "mb-1 mt-4 flex flex-col");
},
m(ie, fe) {
N(ie, a, fe),
N(ie, u, fe),
N(ie, g, fe),
T(g, b),
i[52](b),
I(b, i[4]),
T(g, k),
Q && Q.m(g, null),
T(g, B),
T(g, H),
_e[U].m(H, null),
T(g, X),
le && le.m(g, null),
N(ie, J, fe),
ce && ce.m(ie, fe),
N(ie, ee, fe),
(Y = !0),
b.focus(),
te ||
((ne = [E(b, "input", i[53]), E(g, "submit", i[33])]),
(te = !0));
},
p(ie, fe) {
(!Y || fe[0] & 4096) && (b.disabled = ie[12]),
fe[0] & 16 && b.value !== ie[4] && I(b, ie[4]),
ie[19]
? Q
? Q.p(ie, fe)
: ((Q = vh(ie)), Q.c(), Q.m(g, B))
: Q && (Q.d(1), (Q = null));
let $e = U;
(U = Ae(ie)),
U !== $e &&
(yt(),
Yt(_e[$e], 1, 1, () => {
_e[$e] = null;
}),
Nt(),
(j = _e[U]),
j || ((j = _e[U] = ue[U](ie)), j.c()),
St(j, 1),
j.m(H, null)),
(!Y ||
(fe[0] & 1 &&
F !==
(F =
"mt-4 flex w-full cursor-pointer items-center justify-center rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-" +
ie[0] +
"-900 hover:bg-" +
ie[0] +
"-950"))) &&
x(H, "class", F),
(!Y || (fe[0] & 67112960 && V !== (V = !ie[26] || ie[12]))) &&
(H.disabled = V),
ie[12] && ie[16]
? le
? le.p(ie, fe)
: ((le = _h(ie)), le.c(), le.m(g, null))
: le && (le.d(1), (le = null)),
ie[12]
? ce && (ce.d(1), (ce = null))
: ce
? ce.p(ie, fe)
: ((ce = Eh(ie)), ce.c(), ce.m(ee.parentNode, ee));
},
i(ie) {
Y || (St(j), (Y = !0));
},
o(ie) {
Yt(j), (Y = !1);
},
d(ie) {
ie && (l(a), l(u), l(g), l(J), l(ee)),
i[52](null),
Q && Q.d(),
_e[U].d(),
le && le.d(),
ce && ce.d(ie),
(te = !1),
h(ne);
},
};
}
function A1(i) {
let a,
u,
g,
b,
k,
B,
H,
U,
j,
F,
V,
X,
J,
ee,
Y,
te,
ne,
Q,
ue,
_e,
Ae,
le,
ce = Xd(i[22]),
ie = [];
for (let fe = 0; fe < ce.length; fe += 1) ie[fe] = kh(gh(i, ce, fe));
return {
c() {
(a = p("div")),
(a.textContent = "Create a Nostr account"),
(u = R()),
(g = p("form")),
(b = p("div")),
(k = p("input")),
(B = R()),
(H = p("div")),
(H.textContent = "@"),
(U = R()),
(j = p("select"));
for (let fe = 0; fe < ie.length; fe += 1) ie[fe].c();
(F = R()),
(V = p("button")),
(X = $("Continue »")),
(Y = R()),
(te = p("div")),
(ne = $("Do you already have a Nostr address?")),
(Q = p("br")),
(ue = R()),
(_e = p("button")),
(_e.textContent = "Login now"),
x(a, "class", "text-center text-lg"),
x(
k,
"class",
"box-border w-40 rounded px-2 py-1 text-lg text-neutral-800 outline-none"
),
x(k, "placeholder", "bob"),
(k.autofocus = !0),
x(k, "autocapitalize", "none"),
x(H, "class", "mx-2 text-2xl"),
x(
j,
"class",
"box-border w-full rounded px-2 py-1 text-lg text-neutral-800 outline-none"
),
i[10] === void 0 && Me(() => i[51].call(j)),
x(b, "class", "flex flex-row"),
x(
V,
"class",
(J =
"mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-" +
i[0] +
"-900 hover:bg-" +
i[0] +
"-950")
),
(V.disabled = ee = !i[10] || !i[9] || i[18]),
x(g, "class", "mb-1 mt-4"),
x(
_e,
"class",
"cursor-pointer border-0 bg-transparent text-sm text-white underline"
),
x(te, "class", "mt-6 text-center text-sm leading-3");
},
m(fe, $e) {
N(fe, a, $e),
N(fe, u, $e),
N(fe, g, $e),
T(g, b),
T(b, k),
i[49](k),
I(k, i[9]),
T(b, B),
T(b, H),
T(b, U),
T(b, j);
for (let Le = 0; Le < ie.length; Le += 1)
ie[Le] && ie[Le].m(j, null);
S(j, i[10], !0),
T(g, F),
T(g, V),
T(V, X),
N(fe, Y, $e),
N(fe, te, $e),
T(te, ne),
T(te, Q),
T(te, ue),
T(te, _e),
k.focus(),
Ae ||
((le = [
E(k, "input", i[50]),
E(k, "input", i[38]),
E(j, "change", i[51]),
E(g, "submit", i[37]),
E(_e, "click", i[36]),
]),
(Ae = !0));
},
p(fe, $e) {
if (
($e[0] & 512 && k.value !== fe[9] && I(k, fe[9]),
$e[0] & 4194304)
) {
ce = Xd(fe[22]);
let Le;
for (Le = 0; Le < ce.length; Le += 1) {
const at = gh(fe, ce, Le);
ie[Le]
? ie[Le].p(at, $e)
: ((ie[Le] = kh(at)), ie[Le].c(), ie[Le].m(j, null));
}
for (; Le < ie.length; Le += 1) ie[Le].d(1);
ie.length = ce.length;
}
$e[0] & 4195328 && S(j, fe[10]),
$e[0] & 1 &&
J !==
(J =
"mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-" +
fe[0] +
"-900 hover:bg-" +
fe[0] +
"-950") &&
x(V, "class", J),
$e[0] & 4457984 &&
ee !== (ee = !fe[10] || !fe[9] || fe[18]) &&
(V.disabled = ee);
},
i: c,
o: c,
d(fe) {
fe && (l(a), l(u), l(g), l(Y), l(te)),
i[49](null),
w(ie, fe),
(Ae = !1),
h(le);
},
};
}
function S1(i) {
let a, u, g;
return {
c() {
(a = p("div")),
(a.textContent = "What is that?"),
(u = R()),
(g = p("div")),
(g.innerHTML = `<p class="mb mt-4">This widget is created with <i>window.nostr.js</i>, a small script
you can drop in any page that already uses NIP-07 and make it also
work with NIP-46 automatically when the user doesn&#39;t have an
extension installed.
<br/>
It adds a small floating button on the side of the window that users
can use to create Nostr accuonts or connect to their NIP-46 bunkers.</p> <p class="mt-4">This tool is opensource, get the code from the <a target="_blank" class="underline" href="https://github.com/fiatjaf/window.nostr.js">project&#39;s page</a>.</p> <p class="mt-4">You don&#39;t know what Nostr is?
<a target="_blank" class="underline" href="https://www.nostr.com">Learn more</a>.</p>`),
x(a, "class", "text-center text-lg"),
x(g, "class", "text-base leading-5");
},
m(b, k) {
N(b, a, k), N(b, u, k), N(b, g, k);
},
p: c,
i: c,
o: c,
d(b) {
b && (l(a), l(u), l(g));
},
};
}
function $1(i) {
let a,
u,
g,
b,
k,
B,
H = new URL(i[15]).host + "",
U,
j,
F,
V,
X,
J,
ee,
Y,
te,
ne;
return {
c() {
(a = p("div")),
(u = p("div")),
(u.textContent = "An action requires your confirmation"),
(g = R()),
(b = p("div")),
(k = $("Now you a new window will bring you to ")),
(B = p("strong")),
(U = $(H)),
(j = $(
" where you can approve the current action. If nothing happens check that if your browser is blocking popups, pleaase."
)),
(F = p("br")),
(V = $(`
After that you will be returned to this page.`)),
(X = R()),
(J = p("button")),
(ee = $("Confirm action »")),
x(u, "class", "text-center text-lg"),
x(b, "class", "mt-4 text-center text-sm leading-4"),
x(
J,
"class",
(Y =
"mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-" +
i[0] +
"-900 hover:bg-" +
i[0] +
"-950")
),
x(a, "class", "m-auto w-full");
},
m(Q, ue) {
N(Q, a, ue),
T(a, u),
T(a, g),
T(a, b),
T(b, k),
T(b, B),
T(B, U),
T(b, j),
T(b, F),
T(b, V),
T(a, X),
T(a, J),
T(J, ee),
te || ((ne = E(J, "click", i[48])), (te = !0));
},
p(Q, ue) {
ue[0] & 32768 && H !== (H = new URL(Q[15]).host + "") && q(U, H),
ue[0] & 1 &&
Y !==
(Y =
"mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-" +
Q[0] +
"-900 hover:bg-" +
Q[0] +
"-950") &&
x(J, "class", Y);
},
i: c,
o: c,
d(Q) {
Q && l(a), (te = !1), ne();
},
};
}
function x1(i) {
let a,
u,
g,
b,
k,
B,
H = new URL(i[14]).host + "",
U,
j,
F,
V,
X,
J,
ee,
Y,
te,
ne;
return {
c() {
(a = p("div")),
(u = p("div")),
(u.textContent = "Login into a Nostr account"),
(g = R()),
(b = p("div")),
(k = $("Now you a new window will bring you to ")),
(B = p("strong")),
(U = $(H)),
(j = $(
" where you can login and approve the permissions. If nothing happens check that if your browser is blocking popups, pleaase."
)),
(F = p("br")),
(V = $(`
After that you will be returned to this page.`)),
(X = R()),
(J = p("button")),
(ee = $("Login now »")),
x(u, "class", "text-center text-lg"),
x(b, "class", "mt-4 text-center text-sm leading-4"),
x(
J,
"class",
(Y =
"mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-" +
i[0] +
"-900 hover:bg-" +
i[0] +
"-950")
),
x(a, "class", "m-auto w-full");
},
m(Q, ue) {
N(Q, a, ue),
T(a, u),
T(a, g),
T(a, b),
T(b, k),
T(b, B),
T(B, U),
T(b, j),
T(b, F),
T(b, V),
T(a, X),
T(a, J),
T(J, ee),
te || ((ne = E(J, "click", i[47])), (te = !0));
},
p(Q, ue) {
ue[0] & 16384 && H !== (H = new URL(Q[14]).host + "") && q(U, H),
ue[0] & 1 &&
Y !==
(Y =
"mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-" +
Q[0] +
"-900 hover:bg-" +
Q[0] +
"-950") &&
x(J, "class", Y);
},
i: c,
o: c,
d(Q) {
Q && l(a), (te = !1), ne();
},
};
}
function T1(i) {
let a,
u,
g,
b,
k,
B,
H = new URL(i[13]).host + "",
U,
j,
F,
V,
X,
J,
ee,
Y,
te,
ne;
return {
c() {
(a = p("div")),
(u = p("div")),
(u.textContent = "Create a Nostr account"),
(g = R()),
(b = p("div")),
(k = $("Now you a new window will bring you to ")),
(B = p("strong")),
(U = $(H)),
(j = $(
" where the account creation will take place. If nothing happens check that if your browser is blocking popups, pleaase."
)),
(F = p("br")),
(V = $(`
After that you will be returned to this page.`)),
(X = R()),
(J = p("button")),
(ee = $("Start account creation »")),
x(u, "class", "text-center text-lg"),
x(b, "class", "mt-4 text-center text-sm leading-4"),
x(
J,
"class",
(Y =
"mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-" +
i[0] +
"-900 hover:bg-" +
i[0] +
"-950")
),
x(a, "class", "m-auto w-full");
},
m(Q, ue) {
N(Q, a, ue),
T(a, u),
T(a, g),
T(a, b),
T(b, k),
T(b, B),
T(B, U),
T(b, j),
T(b, F),
T(b, V),
T(a, X),
T(a, J),
T(J, ee),
te || ((ne = E(J, "click", i[46])), (te = !0));
},
p(Q, ue) {
ue[0] & 8192 && H !== (H = new URL(Q[13]).host + "") && q(U, H),
ue[0] & 1 &&
Y !==
(Y =
"mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-" +
Q[0] +
"-900 hover:bg-" +
Q[0] +
"-950") &&
x(J, "class", Y);
},
i: c,
o: c,
d(Q) {
Q && l(a), (te = !1), ne();
},
};
}
function mh(i) {
let a,
u,
g = i[21].picture && bh(i),
b = i[21].name && yh(i);
return {
c() {
(a = p("div")),
g && g.c(),
(u = R()),
b && b.c(),
x(a, "class", "mb-2 flex items-center justify-center gap-2");
},
m(k, B) {
N(k, a, B), g && g.m(a, null), T(a, u), b && b.m(a, null);
},
p(k, B) {
k[21].picture
? g
? g.p(k, B)
: ((g = bh(k)), g.c(), g.m(a, u))
: g && (g.d(1), (g = null)),
k[21].name
? b
? b.p(k, B)
: ((b = yh(k)), b.c(), b.m(a, null))
: b && (b.d(1), (b = null));
},
d(k) {
k && l(a), g && g.d(), b && b.d();
},
};
}
function bh(i) {
let a, u, g;
return {
c() {
(a = p("img")),
P(a.src, (u = i[21].picture)) || x(a, "src", u),
x(a, "alt", ""),
x(
a,
"class",
(g =
"h-10 w-10 rounded-full border-2 border-solid border-transparent group-hover:border-" +
i[0] +
"-100")
);
},
m(b, k) {
N(b, a, k);
},
p(b, k) {
k[0] & 2097152 &&
!P(a.src, (u = b[21].picture)) &&
x(a, "src", u),
k[0] & 1 &&
g !==
(g =
"h-10 w-10 rounded-full border-2 border-solid border-transparent group-hover:border-" +
b[0] +
"-100") &&
x(a, "class", g);
},
d(b) {
b && l(a);
},
};
}
function yh(i) {
let a,
u = i[21].name + "",
g;
return {
c() {
(a = p("div")),
(g = $(u)),
x(
a,
"class",
"text-3xl decoration-2 underline-offset-4 group-hover:underline"
);
},
m(b, k) {
N(b, a, k), T(a, g);
},
p(b, k) {
k[0] & 2097152 && u !== (u = b[21].name + "") && q(g, u);
},
d(b) {
b && l(a);
},
};
}
function vh(i) {
let a, u;
return {
c() {
(a = p("div")),
(u = $(i[19])),
x(
a,
"class",
"my-2 rounded bg-yellow-100 p-2 text-center text-sm leading-4 text-red-400"
);
},
m(g, b) {
N(g, a, b), T(a, u);
},
p(g, b) {
b[0] & 524288 && q(u, g[19]);
},
d(g) {
g && l(a);
},
};
}
function P1(i) {
let a;
return {
c() {
a = $("Connect »");
},
m(u, g) {
N(u, a, g);
},
i: c,
o: c,
d(u) {
u && l(a);
},
};
}
function L1(i) {
let a, u, g;
return (
(u = new ph({})),
{
c() {
(a = $(`Connecting to bunker
`)),
Qd(u.$$.fragment);
},
m(b, k) {
N(b, a, k), Tc(u, b, k), (g = !0);
},
i(b) {
g || (St(u.$$.fragment, b), (g = !0));
},
o(b) {
Yt(u.$$.fragment, b), (g = !1);
},
d(b) {
b && l(a), Pc(u, b);
},
}
);
}
function _h(i) {
let a, u, g, b, k;
return {
c() {
(a = p("div")),
(u = $(`Waiting too much?
`)),
(g = p("button")),
(g.textContent = "Cancel the connection"),
x(
g,
"class",
"cursor-pointer border-0 bg-transparent text-sm text-white underline"
),
x(a, "class", "mt-6 text-center text-sm leading-3");
},
m(B, H) {
N(B, a, H),
T(a, u),
T(a, g),
b || ((k = E(g, "click", i[39])), (b = !0));
},
p: c,
d(B) {
B && l(a), (b = !1), k();
},
};
}
function Eh(i) {
let a, u, g, b, k, B, H;
return {
c() {
(a = p("div")),
(u = $("Do you need a Nostr account?")),
(g = p("br")),
(b = R()),
(k = p("button")),
(k.textContent = "Sign up now"),
x(
k,
"class",
"cursor-pointer border-0 bg-transparent text-sm text-white underline"
),
x(a, "class", "mt-6 text-center text-sm leading-3");
},
m(U, j) {
N(U, a, j),
T(a, u),
T(a, g),
T(a, b),
T(a, k),
B || ((H = E(k, "click", i[35])), (B = !0));
},
p: c,
d(U) {
U && l(a), (B = !1), H();
},
};
}
function kh(i) {
let a, u, g;
return {
c() {
(a = p("option")),
x(a, "label", (u = i[78].domain)),
(a.__value = g = i[78]),
I(a, a.__value),
x(a, "class", "px-2 py-1 text-lg");
},
m(b, k) {
N(b, a, k);
},
p(b, k) {
k[0] & 4194304 && u !== (u = b[78].domain) && x(a, "label", u),
k[0] & 4194304 &&
g !== (g = b[78]) &&
((a.__value = g), I(a, a.__value));
},
d(b) {
b && l(a);
},
};
}
function B1(i) {
let a, u;
return {
c() {
(a = p("img")),
P(a.src, (u = i[21].picture)) || x(a, "src", u),
x(a, "alt", ""),
x(a, "class", "h-6 w-6 rounded-full");
},
m(g, b) {
N(g, a, b);
},
p(g, b) {
b[0] & 2097152 &&
!P(a.src, (u = g[21].picture)) &&
x(a, "src", u);
},
i: c,
o: c,
d(g) {
g && l(a);
},
};
}
function C1(i) {
let a,
u,
g,
b =
(i[21].name ||
i[21].npub.slice(0, 7) + "…" + i[21].npub.slice(-4)) + "",
k;
function B(j, F) {
return j[21].picture ? z1 : R1;
}
let H = B(i),
U = H(i);
return {
c() {
(a = p("div")),
U.c(),
(u = R()),
(g = p("div")),
(k = $(b)),
x(
g,
"class",
"max-w-56 overflow-hidden whitespace-nowrap overflow-ellipsis inline-block"
),
x(a, "class", "flex px-2 items-center");
},
m(j, F) {
N(j, a, F), U.m(a, null), T(a, u), T(a, g), T(g, k);
},
p(j, F) {
H === (H = B(j)) && U
? U.p(j, F)
: (U.d(1), (U = H(j)), U && (U.c(), U.m(a, u))),
F[0] & 2097152 &&
b !==
(b =
(j[21].name ||
j[21].npub.slice(0, 7) + "…" + j[21].npub.slice(-4)) +
"") &&
q(k, b);
},
i: c,
o: c,
d(j) {
j && l(a), U.d();
},
};
}
function I1(i) {
let a;
return {
c() {
(a = p("div")),
(a.textContent = "N"),
x(a, "class", "w-6 text-center");
},
m(u, g) {
N(u, a, g);
},
p: c,
i: c,
o: c,
d(u) {
u && l(a);
},
};
}
function O1(i) {
let a;
return {
c() {
(a = p("div")),
(a.textContent = "Connect with Nostr"),
x(a, "class", "flex px-2 items-center");
},
m(u, g) {
N(u, a, g);
},
p: c,
i: c,
o: c,
d(u) {
u && l(a);
},
};
}
function N1(i) {
let a, u, g, b;
return (
(g = new ph({})),
{
c() {
(a = p("div")),
(u = $(`Connecting to bunker
`)),
Qd(g.$$.fragment),
x(a, "class", "flex px-2 items-center");
},
m(k, B) {
N(k, a, B), T(a, u), Tc(g, a, null), (b = !0);
},
p: c,
i(k) {
b || (St(g.$$.fragment, k), (b = !0));
},
o(k) {
Yt(g.$$.fragment, k), (b = !1);
},
d(k) {
k && l(a), Pc(g);
},
}
);
}
function R1(i) {
let a;
return {
c() {
a = $("☉");
},
m(u, g) {
N(u, a, g);
},
p: c,
d(u) {
u && l(a);
},
};
}
function z1(i) {
let a, u;
return {
c() {
(a = p("img")),
P(a.src, (u = i[21].picture)) || x(a, "src", u),
x(a, "alt", ""),
x(a, "class", "mr-2 h-5 w-5 rounded-full");
},
m(g, b) {
N(g, a, b);
},
p(g, b) {
b[0] & 2097152 &&
!P(a.src, (u = g[21].picture)) &&
x(a, "src", u);
},
d(g) {
g && l(a);
},
};
}
function U1(i) {
let a, u, g, b, k, B, H;
const U = [_1, v1, y1],
j = [];
function F(V, X) {
return !V[25] && !V[21] && V[1] ? 0 : V[25] ? 2 : 1;
}
return (
(u = F(i)),
(g = j[u] = U[u](i)),
{
c() {
(a = p("div")),
g.c(),
x(
a,
"class",
"draggable animate-fadein font-sans text-white"
),
x(
a,
"style",
(b =
"position: fixed; " +
(i[25] && i[5] ? "width: 100vw;" : "") +
"; right: " +
(i[25] && i[5] ? "0" : i[3]) +
"px; user-select: none; " +
(i[25] && i[5]
? "bottom: 0px"
: i[24] + ":" + i[23] + "px"))
),
K(a, "cursor-pointer", !i[21] && !i[25]);
},
m(V, X) {
N(V, a, X),
j[u].m(a, null),
i[54](a),
(k = !0),
B ||
((H = [
E(pu, "click", i[29]),
E(pu, "mouseup", i[42]),
E(pu, "mousemove", i[41]),
E(a, "mousedown", i[40]),
]),
(B = !0));
},
p(V, X) {
let J = u;
(u = F(V)),
u === J
? j[u].p(V, X)
: (yt(),
Yt(j[J], 1, 1, () => {
j[J] = null;
}),
Nt(),
(g = j[u]),
g ? g.p(V, X) : ((g = j[u] = U[u](V)), g.c()),
St(g, 1),
g.m(a, null)),
(!k ||
(X[0] & 58720296 &&
b !==
(b =
"position: fixed; " +
(V[25] && V[5] ? "width: 100vw;" : "") +
"; right: " +
(V[25] && V[5] ? "0" : V[3]) +
"px; user-select: none; " +
(V[25] && V[5]
? "bottom: 0px"
: V[24] + ":" + V[23] + "px")))) &&
x(a, "style", b),
(!k || X[0] & 35651584) &&
K(a, "cursor-pointer", !V[21] && !V[25]);
},
i(V) {
k || (St(g), (k = !0));
},
o(V) {
Yt(g), (k = !1);
},
d(V) {
V && l(a), j[u].d(), i[54](null), (B = !1), h(H);
},
}
);
}
const Ah =
"We could not connect to a NIP-46 bunker with that url, are you sure it is set up correctly?",
Sh =
"We were not able to connect using this address. For it to work it has to come from a NIP-46 provider.",
xr = 20;
function gu(i) {
return window.open(
i,
"window.nostr",
"width=600,height=800,popup=yes"
);
}
function M1(i, a, u) {
let g, b, k, B, H, U;
const j = m1("only screen and (max-width: 640px)");
O(i, j, (ge) => u(5, (U = ge)));
const F = {
ORIGIN: "wnj:origin",
CLIENT_SECRET: "wnj:clientSecret",
Y_POS: "wnj:ypos",
CALLBACK_TOKEN: "wnj:callbackToken",
BUNKER_POINTER: "wnj:bunkerPointer",
};
let V,
{ accent: X } = a,
{ position: J = "top" } = a,
{ startHidden: ee } = a,
{ compactMode: Y } = a;
const te = window,
ne = new ly();
let Q, ue, _e, Ae, le, ce;
const ie = localStorage.getItem(F.CLIENT_SECRET);
ie
? (ce = Ic(ie))
: ((ce = Fb()), localStorage.setItem(F.CLIENT_SECRET, Rt(ce)));
let fe = "closed",
$e,
Le,
at,
ct,
ut,
de,
ve = null,
ze = null,
We = null,
Ye = !1,
qe,
xt,
_t,
jt = !1,
lt,
en,
fn = [],
{ right: Sn = 20 } = a,
Tr = !1,
Gt = !1,
Pr,
bo,
Zt;
const Yn = {
pool: ne,
onauth(ge) {
qe
? u(13, (ve = ge))
: lt
? (u(15, (We = ge)), u(25, (k = !0)))
: u(14, (ze = ge));
},
},
yo = rf(() => {
switch (fe) {
case "justopened":
u(44, (fe = "opened"));
break;
case "justclosed":
u(44, (fe = "closed"));
break;
}
}, 500);
function vo() {
u(44, (fe = "justopened")), yo();
}
function Lr() {
u(44, (fe = "justclosed")), yo();
}
function Ds() {
if ($e && !de) {
yu();
return;
}
vo();
}
bu();
let Ph = {
isWnj: !0,
async getPublicKey() {
return $e
? $e.pubkey
: (!ut && !de && vo(), (await ct).bp.pubkey);
},
async signEvent(ge) {
try {
return !ut && !de && Ds(), await (await ct).signEvent(ge);
} finally {
u(15, (We = null)), Lr();
}
},
async getRelays() {
return !ut && !de && Ds(), (await ct).getRelays();
},
nip04: {
async encrypt(ge, rt) {
return !ut && !de && Ds(), (await ct).nip04Encrypt(ge, rt);
},
async decrypt(ge, rt) {
return !ut && !de && Ds(), (await ct).nip04Decrypt(ge, rt);
},
},
};
function bu() {
Lr(),
($e = null),
(ct = new Promise((ge, rt) => {
(Le = ge), (at = rt);
})),
u(21, (lt = null)),
u(12, (ut = !1)),
u(16, (Ye = !1)),
u(17, (qe = !1)),
(de = !1),
(en = null),
u(19, (_t = ""));
}
oe(() => {
if (!$e) {
let ge = localStorage.getItem(F.BUNKER_POINTER);
ge && (($e = JSON.parse(ge)), vu());
}
if (te.nostr && !te.nostr.isWnj) {
te.destroyWnj();
return;
} else
Object.defineProperty(window, "nostr", {
get() {
return Ph;
},
set(ge) {
(Ph = ge), ge.isWnj || te.destroyWnj();
},
configurable: !0,
});
return () => {
en && en.close();
};
});
function q1(ge) {
Math.abs(b - bo) > 6 ||
Date.now() - Zt > 600 ||
fe === "justopened" ||
fe === "justclosed" ||
(ge.composedPath().find((rt) => rt.id === "wnj") ? vo() : Lr());
}
function V1(ge) {
Lr(),
u(17, (qe = !1)),
u(13, (ve = null)),
u(14, (ze = null)),
u(15, (We = null)),
ge.stopPropagation();
}
function F1(ge) {
u(20, (jt = !0)), ge.stopPropagation();
}
function K1(ge) {
u(20, (jt = !1)), ge.stopPropagation();
}
async function W1(ge) {
ge.preventDefault();
try {
if ((($e = await c1(Q.value)), !$e)) {
Q.value.match(js) ? u(19, (_t = Ah)) : u(19, (_t = Sh));
return;
}
Q.setCustomValidity(""), u(19, (_t = "")), await yu(), vu();
} catch {
Q.value.match(js) ? u(19, (_t = Ah)) : u(19, (_t = Sh)),
u(12, (ut = !1));
}
}
async function G1(ge) {
ge.preventDefault(),
localStorage.removeItem(F.BUNKER_POINTER),
bu();
}
async function Z1(ge) {
ge.preventDefault(),
u(17, (qe = !0)),
fn.length === 0 &&
(u(
22,
(fn = await l1(ne, [
"wss://relay.nostr.band",
"wss://nos.lol",
"wss://nostr-pub.wellorder.net",
]))
),
u(10, (le = fn[0])));
}
function Y1(ge) {
u(17, (qe = !1));
}
async function J1(ge) {
if ((ge.preventDefault(), !le)) return;
u(18, (xt = !0));
let rt = await u1(le, Yn, _e.value, le.domain);
u(18, (xt = !1)),
vo(),
u(17, (qe = !1)),
($e = rt.bp),
vu(),
yu(rt);
}
const X1 = rf(async () => {
le &&
_e.value.length > 0 &&
((await d1(_e.value + "@" + le.domain))
? _e.setCustomValidity(`'${_e.value}' is already taken.`)
: _e.setCustomValidity(""));
}, 500);
function Q1() {
u(16, (Ye = !1)), u(12, (ut = !1)), at("connection aborted"), bu();
}
async function yu(ge = void 0) {
(ge = ge || new dh(ce, $e, Yn)), u(12, (ut = !0));
let rt = setTimeout(() => {
u(16, (Ye = !0)), u(25, (k = !0));
}, 5e3);
try {
await ge.connect(),
(de = !0),
localStorage.setItem(F.BUNKER_POINTER, JSON.stringify($e)),
Lr(),
Le(ge);
} catch (Jn) {
at((Jn == null ? void 0 : Jn.message) || String(Jn));
} finally {
clearTimeout(rt),
u(12, (ut = !1)),
u(16, (Ye = !1)),
u(13, (ve = null)),
u(14, (ze = null)),
u(15, (We = null));
}
}
function vu(ge = null) {
let rt = $e.pubkey;
u(21, (lt = { pubkey: rt, npub: h1(rt), event: null })),
(en = ne.subscribeMany(
[
"wss://purplepag.es",
"wss://relay.snort.social",
"wss://relay.nos.social",
],
[{ kinds: [0], authors: [rt] }],
{
onevent(Jn) {
var Lh;
if (
!(
(((Lh = lt.event) == null ? void 0 : Lh.created_at) ||
0) >= Jn.created_at
)
)
try {
let { name: fv, picture: hv } = JSON.parse(Jn.content);
u(21, (lt.event = Jn), lt),
u(21, (lt.name = fv), lt),
u(21, (lt.picture = hv), lt),
ge == null || ge(),
(ge = null);
} catch {}
},
}
));
}
function ev(ge) {
if (k) return;
Tr = !0;
const rt = V.getBoundingClientRect();
(Pr = ge.clientY - rt.top), (bo = b), (Zt = Date.now());
}
function tv(ge) {
Tr &&
(g === "top"
? u(23, (b = ge.clientY))
: u(23, (b = window.innerHeight - ge.clientY)),
u(23, (b -= Pr)),
u(45, (Gt = !0)),
b < xr && u(23, (b = xr)),
b > window.innerHeight - xr &&
u(23, (b = window.innerHeight - xr)));
}
function nv() {
if (
((Tr = !1),
setTimeout(() => {
u(45, (Gt = !1));
}, 10),
Gt)
) {
const ge = V.getBoundingClientRect(),
rt = window.innerHeight,
Jn = rt / 2;
ge.top < Jn
? (u(24, (g = "top")), u(23, (b = ge.top)))
: (u(24, (g = "bottom")), u(23, (b = rt - ge.bottom))),
b < xr && u(23, (b = xr)),
localStorage.setItem(F.ORIGIN, g),
localStorage.setItem(F.Y_POS, b.toString());
}
}
const rv = () => gu(ve),
ov = () => gu(ze),
iv = () => {
gu(We);
};
function sv(ge) {
be[ge ? "unshift" : "push"](() => {
(_e = ge), u(8, _e);
});
}
function av() {
(Ae = this.value), u(9, Ae);
}
function cv() {
(le = D(this)), u(10, le), u(22, fn);
}
function uv(ge) {
be[ge ? "unshift" : "push"](() => {
(Q = ge), u(7, Q);
});
}
function lv() {
(ue = this.value), u(4, ue);
}
function dv(ge) {
be[ge ? "unshift" : "push"](() => {
(V = ge), u(6, V);
});
}
return (
(i.$$set = (ge) => {
"accent" in ge && u(0, (X = ge.accent)),
"position" in ge && u(43, (J = ge.position)),
"startHidden" in ge && u(1, (ee = ge.startHidden)),
"compactMode" in ge && u(2, (Y = ge.compactMode)),
"right" in ge && u(3, (Sn = ge.right));
}),
(i.$$.update = () => {
(i.$$.dirty[0] & 32) | (i.$$.dirty[1] & 4096) &&
u(24, (g = U ? "bottom" : localStorage.getItem(F.ORIGIN) || J)),
i.$$.dirty[0] & 32 &&
u(
23,
(b = U
? xr
: parseInt(localStorage.getItem(F.Y_POS) || "0") || xr)
),
i.$$.dirty[1] & 8192 &&
u(25, (k = fe === "justopened" || fe === "opened")),
(i.$$.dirty[0] & 1) | (i.$$.dirty[1] & 16384) &&
u(
27,
(B = Gt
? "cursor-grabbing outline-dashed outline-" +
X +
"-500 outline-1 outline-offset-4"
: "outline-none")
),
i.$$.dirty[0] & 16 &&
u(26, (H = ue && (ue.match(js) || ue.match(fh))));
}),
[
X,
ee,
Y,
Sn,
ue,
U,
V,
Q,
_e,
Ae,
le,
ce,
ut,
ve,
ze,
We,
Ye,
qe,
xt,
_t,
jt,
lt,
fn,
b,
g,
k,
H,
B,
j,
q1,
V1,
F1,
K1,
W1,
G1,
Z1,
Y1,
J1,
X1,
Q1,
ev,
tv,
nv,
J,
fe,
Gt,
rv,
ov,
iv,
sv,
av,
cv,
uv,
lv,
dv,
]
);
}
class H1 extends tf {
constructor(a) {
super(),
ef(
this,
a,
M1,
U1,
m,
{
accent: 0,
position: 43,
startHidden: 1,
compactMode: 2,
right: 3,
},
null,
[-1, -1, -1]
);
}
}
const Ko = window;
Ko.destroyWnj = () => {
setTimeout(() => {
j1.$destroy();
}, 1);
};
const wu = document.createElement("div");
(wu.style.zIndex = "90000"), document.body.appendChild(wu);
const mu = document.createElement("div");
mu.id = "wnj";
const $h = document.createElement("style");
$h.innerHTML = s;
const xh = wu.attachShadow({ mode: "open" });
xh.appendChild(mu), xh.appendChild($h);
const j1 = new H1({
target: mu,
props: {
accent: ((e = Ko.wnjParams) == null ? void 0 : e.accent) || "cyan",
position:
((t = Ko.wnjParams) == null ? void 0 : t.position) === "bottom"
? "bottom"
: "top",
startHidden: !!((n = Ko.wnjParams) != null && n.startHidden),
compactMode: !!((r = Ko.wnjParams) != null && r.compactMode),
},
});
if (!((o = Ko.wnjParams) != null && o.disableOverflowFix)) {
var Th = document.createElement("style"),
D1 = `
html, body {
overflow: auto;
height: 100%;
}
`;
(Th.innerHTML = D1), document.head.appendChild(Th);
}
})();
const i$ = wv({ __proto__: null, default: dg }, [dg]);
</script>
<style rel="stylesheet" crossorigin>
html {
font-size: 20px;
}
@media only screen and (max-width: 768px) {
html {
font-size: 18px;
}
}
body {
margin: 0;
padding: 0;
}
html.dark body {
background-color: #0f172a;
color: #cbcbcb;
}
#app {
box-sizing: border-box;
width: 80%;
max-width: 760px;
margin: 2rem auto;
font-family: Arial, Helvetica, sans-serif;
color: #0f172a;
}
@media only screen and (max-width: 768px) {
#app {
width: 100%;
padding: 0 1rem;
max-width: unset;
}
}
html.dark #app {
background-color: #0f172a;
color: #ebebeb;
}
a,
a:visited {
color: #0f172a;
}
html.dark a,
html.dark a:visited {
color: #f5f5f5;
}
ol,
ul {
padding-left: 1rem;
margin: 0;
}
ol li,
ul li {
margin-bottom: 1rem;
}
blockquote {
margin: 0;
padding-left: 1rem;
border-left: 8px solid #ebebeb;
}
code {
font-size: 0.9rem;
background-color: #f6f6f6;
}
pre code {
overflow: scroll;
display: block;
padding: 1rem 0.5rem;
}
.unfinished-setup {
width: 80%;
margin: 0 auto;
text-align: center;
}
.header.home h1 {
font-size: 3rem;
}
.header .external-link {
text-align: right;
margin-top: -1rem;
font-size: 0.8em;
color: #cbcbcb;
}
@media only screen and (max-width: 768px) {
.header .external-link {
margin-bottom: 1rem;
margin-right: 2.5rem;
}
}
.header .external-link a {
text-decoration: underline;
color: #cbcbcb;
}
.header .picture-container {
position: relative;
display: inline-block;
width: 2.5rem;
height: 2.5rem;
overflow: hidden;
border-radius: 50%;
margin-bottom: -0.25rem;
}
.header .picture-container img {
position: absolute;
top: 50%;
left: 50%;
width: 100%;
height: 100%;
object-fit: cover;
transform: translate(-50%, -50%);
clip-path: circle(50%);
}
.header.note .picture-container {
width: 1.5rem;
height: 1.5rem;
margin-bottom: -0.4rem;
}
.header a {
text-decoration: none;
}
.header a span {
text-decoration: underline;
}
html.dark .header a:visited {
color: #cbcbcb;
}
html.dark .header .external-link,
html.dark .header .external-link a {
color: #747474;
}
.topic-wrapper {
margin-bottom: 1.5rem;
display: flex;
flex-direction: row;
flex-wrap: wrap;
row-gap: 1rem;
}
.topic-wrapper div {
display: inline-grid;
margin-right: 1rem;
}
.topic-wrapper div a {
padding: 0.4rem 1rem;
background-color: #e0e0e0;
text-decoration: none;
border-radius: 4px;
}
.topic-wrapper div a:hover {
background-color: #ebebeb;
}
.topic-wrapper div a.selected {
background-color: #0f172a;
color: #f5f5f5;
}
html.dark .topic-wrapper div a {
background-color: #747474;
color: #0f172a;
}
html.dark .topic-wrapper div a:hover {
background-color: #f5f5f5;
}
html.dark .topic-wrapper div a.selected {
background-color: #cbcbcb;
}
.externalLink {
display: block;
text-align: right;
margin-top: -1rem;
font-size: 0.8em;
color: #cbcbcb;
}
.externalLink a {
color: #cbcbcb;
}
.about {
margin-bottom: 2rem;
padding-bottom: 1rem;
border-bottom: 8px solid #ebebeb;
}
html.dark .about {
border-bottom: 8px solid #1e293b;
}
.separator {
margin-bottom: 2rem;
border-bottom: 8px solid #ebebeb;
}
html.dark .separator {
border-bottom: 8px solid #1e293b;
}
.top-notes {
display: flex;
color: #747474;
flex-wrap: wrap;
justify-content: space-between;
gap: 2rem;
width: 100%;
margin-bottom: 1rem;
padding-bottom: 2rem;
border-bottom: 8px solid #f5f5f5;
}
@media only screen and (max-width: 768px) {
.top-notes {
display: block;
}
}
@media only screen and (max-width: 768px) {
.top-notes {
padding-bottom: 0rem;
}
}
.top-notes .note {
flex: 1 1 calc(50% - 2rem);
box-sizing: border-box;
}
@media only screen and (max-width: 768px) {
.top-notes .note {
margin-bottom: 2rem;
}
}
.top-notes .note a {
text-decoration: none;
}
.top-notes .note img {
width: 100%;
height: 200px;
object-fit: cover;
margin-bottom: 0.5rem;
border-radius: 4px;
}
.top-notes .note .title {
display: block;
margin-bottom: 0.4rem;
font-size: 1.1rem;
font-weight: bolder;
}
.top-notes .note .summary {
margin-bottom: 0.4rem;
font-size: 0.9rem;
}
.top-notes .note .date {
font-size: 0.8rem;
color: #a9a9a9;
}
html.dark .top-notes {
color: #cbcbcb;
border-bottom: 8px solid #1e293b;
}
.short-notes {
border-bottom: 8px solid #f5f5f5;
padding-bottom: 1rem;
margin-bottom: 2rem;
}
.short-notes .splide__slide {
font-size: 0.9rem;
overflow-wrap: break-word;
}
.short-notes .splide__slide a {
text-decoration: none;
}
.short-notes .splide__slide .date {
font-size: 0.8rem;
color: #a9a9a9;
margin-bottom: 0.3rem;
}
.short-notes .splide__arrow--prev {
left: -3em;
}
.short-notes .splide__arrow--next {
right: -3em;
}
@media only screen and (max-width: 768px) {
.short-notes .splide__arrow--prev,
.short-notes .splide__arrow--next {
display: none;
}
}
.short-notes .splide__arrow {
background: none;
}
.short-notes .splide__arrow svg {
fill: #a9a9a9;
}
html.dark .short-notes {
border-bottom: 8px solid #1e293b;
}
html.dark .short-notes a {
color: #cbcbcb;
}
.listing-notes {
margin-top: 1rem;
color: #747474;
}
.listing-notes.short-feed-full li {
margin-bottom: 2rem;
}
.listing-notes.short-feed-full .summary {
color: #0f172a;
}
.listing-notes ul {
list-style-type: none;
padding: 0;
margin: 0;
}
.listing-notes ul li {
margin-bottom: 1rem;
}
.listing-notes ul li h2 {
font-size: 1.1rem;
margin-bottom: 0.5rem;
}
.listing-notes ul li h2 a {
display: block;
font-size: 1.1rem;
}
.listing-notes ul li .summary {
margin-bottom: 0.4rem;
overflow-wrap: break-word;
}
.listing-notes ul li .summary p {
margin: 0;
}
.listing-notes ul li .summary img {
display: block;
margin: 2rem auto;
max-width: 100%;
border-radius: 4px;
}
.listing-notes ul li .summary video {
width: 100%;
margin: 2rem auto;
}
.listing-notes ul li .summary audio {
width: 100%;
margin: 2rem auto;
}
.listing-notes ul li .date {
font-size: 0.8rem;
color: #a9a9a9;
}
html.dark .listing-notes {
color: #cbcbcb;
}
html.dark .listing-notes.short-feed-full .summary {
color: #fff;
}
h1 {
font-size: 2rem;
line-height: 0.9;
margin-top: 0;
}
@media only screen and (max-width: 768px) {
h1 {
font-size: 1.6rem;
}
}
.note-wrapper {
position: relative;
margin-top: 2rem;
overflow-wrap: break-word;
}
.note-wrapper h1,
.note-wrapper h2,
.note-wrapper h3 {
margin-top: 1.4rem;
margin-bottom: 0.6rem;
}
.note-wrapper h1:first-of-type {
margin-top: 0rem;
}
.note-wrapper .content {
margin-top: 1.5rem;
}
.note-wrapper p {
line-height: 1.3rem;
margin-top: 0rem;
}
.note-wrapper .date {
display: block;
margin-bottom: 0.5rem;
font-size: 0.8rem;
color: #a9a9a9;
}
.note-wrapper img {
display: block;
margin: 2rem auto;
max-width: 100%;
border-radius: 4px;
}
.note-wrapper img.note-banner {
margin: 2.5rem auto 3.5rem;
transform: scale(1.1);
}
.note-wrapper video {
width: 100%;
margin: 2rem auto;
}
.note-wrapper audio {
width: 100%;
margin: 2rem auto;
}
.footer {
margin-top: 4rem;
padding-top: 2rem;
margin-bottom: 2rem;
border-top: 8px solid #ebebeb;
font-size: 0.8rem;
text-align: center;
color: #cbcbcb;
}
.footer a {
color: #cbcbcb;
}
html.dark .footer {
border-top: 8px solid #1e293b;
color: #747474;
}
html.dark .footer a,
html.dark .footer a:visited {
color: #747474;
}
zap-threads {
font-size: 0.9rem;
}
.splide__container {
box-sizing: border-box;
position: relative;
}
.splide__list {
backface-visibility: hidden;
display: -ms-flexbox;
display: flex;
height: 100%;
margin: 0 !important;
padding: 0 !important;
}
.splide.is-initialized:not(.is-active) .splide__list {
display: block;
}
.splide__pagination {
-ms-flex-align: center;
align-items: center;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-ms-flex-pack: center;
justify-content: center;
margin: 0;
pointer-events: none;
}
.splide__pagination li {
display: inline-block;
line-height: 1;
list-style-type: none;
margin: 0;
pointer-events: auto;
}
.splide:not(.is-overflow) .splide__pagination {
display: none;
}
.splide__progress__bar {
width: 0;
}
.splide {
position: relative;
visibility: hidden;
}
.splide.is-initialized,
.splide.is-rendered {
visibility: visible;
}
.splide__slide {
backface-visibility: hidden;
box-sizing: border-box;
-ms-flex-negative: 0;
flex-shrink: 0;
list-style-type: none !important;
margin: 0;
position: relative;
}
.splide__slide img {
vertical-align: bottom;
}
.splide__spinner {
animation: splide-loading 1s linear infinite;
border: 2px solid #999;
border-left-color: transparent;
border-radius: 50%;
bottom: 0;
contain: strict;
display: inline-block;
height: 20px;
left: 0;
margin: auto;
position: absolute;
right: 0;
top: 0;
width: 20px;
}
.splide__sr {
clip: rect(0 0 0 0);
border: 0;
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.splide__toggle.is-active .splide__toggle__play,
.splide__toggle__pause {
display: none;
}
.splide__toggle.is-active .splide__toggle__pause {
display: inline;
}
.splide__track {
overflow: hidden;
position: relative;
z-index: 0;
}
@keyframes splide-loading {
0% {
transform: rotate(0);
}
to {
transform: rotate(1turn);
}
}
.splide__track--draggable {
-webkit-touch-callout: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
.splide__track--fade > .splide__list > .splide__slide {
margin: 0 !important;
opacity: 0;
z-index: 0;
}
.splide__track--fade > .splide__list > .splide__slide.is-active {
opacity: 1;
z-index: 1;
}
.splide--rtl {
direction: rtl;
}
.splide__track--ttb > .splide__list {
display: block;
}
.splide__arrow {
-ms-flex-align: center;
align-items: center;
background: #ccc;
border: 0;
border-radius: 50%;
cursor: pointer;
display: -ms-flexbox;
display: flex;
height: 2em;
-ms-flex-pack: center;
justify-content: center;
opacity: 0.7;
padding: 0;
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 2em;
z-index: 1;
}
.splide__arrow svg {
fill: #000;
height: 1.2em;
width: 1.2em;
}
.splide__arrow:hover:not(:disabled) {
opacity: 0.9;
}
.splide__arrow:disabled {
opacity: 0.3;
}
.splide__arrow:focus-visible {
outline: 3px solid #0bf;
outline-offset: 3px;
}
.splide__arrow--prev {
left: 1em;
}
.splide__arrow--prev svg {
transform: scaleX(-1);
}
.splide__arrow--next {
right: 1em;
}
.splide.is-focus-in .splide__arrow:focus {
outline: 3px solid #0bf;
outline-offset: 3px;
}
.splide__pagination {
bottom: 0.5em;
left: 0;
padding: 0 1em;
position: absolute;
right: 0;
z-index: 1;
}
.splide__pagination__page {
background: #ccc;
border: 0;
border-radius: 50%;
display: inline-block;
height: 8px;
margin: 3px;
opacity: 0.7;
padding: 0;
position: relative;
transition: transform 0.2s linear;
width: 8px;
}
.splide__pagination__page.is-active {
background: #fff;
transform: scale(1.4);
z-index: 1;
}
.splide__pagination__page:hover {
cursor: pointer;
opacity: 0.9;
}
.splide__pagination__page:focus-visible {
outline: 3px solid #0bf;
outline-offset: 3px;
}
.splide.is-focus-in .splide__pagination__page:focus {
outline: 3px solid #0bf;
outline-offset: 3px;
}
.splide__progress__bar {
background: #ccc;
height: 3px;
}
.splide__slide {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.splide__slide:focus {
outline: 0;
}
@supports (outline-offset: -3px) {
.splide__slide:focus-visible {
outline: 3px solid #0bf;
outline-offset: -3px;
}
}
@media screen and (-ms-high-contrast: none) {
.splide__slide:focus-visible {
border: 3px solid #0bf;
}
}
@supports (outline-offset: -3px) {
.splide.is-focus-in .splide__slide:focus {
outline: 3px solid #0bf;
outline-offset: -3px;
}
}
@media screen and (-ms-high-contrast: none) {
.splide.is-focus-in .splide__slide:focus {
border: 3px solid #0bf;
}
.splide.is-focus-in
.splide__track
> .splide__list
> .splide__slide:focus {
border-color: #0bf;
}
}
.splide__toggle {
cursor: pointer;
}
.splide__toggle:focus-visible {
outline: 3px solid #0bf;
outline-offset: 3px;
}
.splide.is-focus-in .splide__toggle:focus {
outline: 3px solid #0bf;
outline-offset: 3px;
}
.splide__track--nav > .splide__list > .splide__slide {
border: 3px solid transparent;
cursor: pointer;
}
.splide__track--nav > .splide__list > .splide__slide.is-active {
border: 3px solid #000;
}
.splide__arrows--rtl .splide__arrow--prev {
left: auto;
right: 1em;
}
.splide__arrows--rtl .splide__arrow--prev svg {
transform: scaleX(1);
}
.splide__arrows--rtl .splide__arrow--next {
left: 1em;
right: auto;
}
.splide__arrows--rtl .splide__arrow--next svg {
transform: scaleX(-1);
}
.splide__arrows--ttb .splide__arrow {
left: 50%;
transform: translate(-50%);
}
.splide__arrows--ttb .splide__arrow--prev {
top: 1em;
}
.splide__arrows--ttb .splide__arrow--prev svg {
transform: rotate(-90deg);
}
.splide__arrows--ttb .splide__arrow--next {
bottom: 1em;
top: auto;
}
.splide__arrows--ttb .splide__arrow--next svg {
transform: rotate(90deg);
}
.splide__pagination--ttb {
bottom: 0;
display: -ms-flexbox;
display: flex;
-ms-flex-direction: column;
flex-direction: column;
left: auto;
padding: 1em 0;
right: 0.5em;
top: 0;
}
.loader-container.svelte-181fgen {
display: flex;
align-items: center;
justify-content: center;
}
.loader.svelte-181fgen {
display: inline-block;
width: 92px;
height: 92px;
opacity: 0;
animation: svelte-181fgen-fade-in 0.5s 0.4s forwards,
svelte-181fgen-loader-animation 2s linear infinite 0.4s;
}
.loader.svelte-181fgen:after {
content: " ";
display: block;
width: 64px;
height: 64px;
margin: 8px;
border-radius: 50%;
border: 6px solid #a9a9a9;
border-color: #a9a9a9 transparent #a9a9a9 transparent;
animation: svelte-181fgen-loader-animation 2s linear infinite;
}
@keyframes svelte-181fgen-loader-animation {
0% {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}
@keyframes svelte-181fgen-fade-in {
to {
opacity: 1;
}
}
html.dark .loader.svelte-181fgen:after {
border: 6px solid #1e293b;
border-color: #1e293b transparent #1e293b transparent;
}
#theme-toggle.svelte-bxrhh.svelte-bxrhh {
display: none;
}
#theme-toggle.svelte-bxrhh + label.svelte-bxrhh {
display: inline-block;
cursor: pointer;
height: 1rem;
width: 1rem;
position: absolute;
top: 1rem;
right: 3rem;
border-radius: 9px;
transition-duration: 0.3s;
content: "";
}
@media only screen and (max-width: 768px) {
#theme-toggle.svelte-bxrhh + label.svelte-bxrhh {
right: 1rem;
}
}
#theme-toggle.svelte-bxrhh:not(:checked) + label.svelte-bxrhh {
background-color: #e9e9e9;
}
#theme-toggle.svelte-bxrhh:checked + label.svelte-bxrhh {
background-color: transparent;
box-shadow: inset -6px -6px 1px 1px #1e293b;
}
</style>
</head>
<body>
<div id="app"></div>
<script>
window.wnjParams = {
position: "bottom",
accent: "neutral",
startHidden: true,
compactMode: true,
};
</script>
</body>
</html>