nostr-comments 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -17
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useSigner.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/nostr-comments.cjs +21 -21
- package/dist/nostr-comments.js +562 -540
- package/dist/nostr-comments.umd.js +20 -20
- package/dist/types/index.d.ts +3 -0
- package/package.json +1 -1
package/dist/nostr-comments.js
CHANGED
|
@@ -298,7 +298,7 @@ function Xe(t, e) {
|
|
|
298
298
|
function Vr(t, e) {
|
|
299
299
|
return Xe(t, e).reverse();
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function ne(t, e, n) {
|
|
302
302
|
let r;
|
|
303
303
|
if (typeof e == "string")
|
|
304
304
|
try {
|
|
@@ -391,7 +391,7 @@ const Xc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
391
391
|
bytesToNumberLE: qr,
|
|
392
392
|
concatBytes: lt,
|
|
393
393
|
createHmacDrbg: Qi,
|
|
394
|
-
ensureBytes:
|
|
394
|
+
ensureBytes: ne,
|
|
395
395
|
hexToBytes: Ot,
|
|
396
396
|
hexToNumber: zr,
|
|
397
397
|
numberToBytesBE: Xe,
|
|
@@ -399,45 +399,45 @@ const Xc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
399
399
|
validateObject: zt
|
|
400
400
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
401
401
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
402
|
-
const
|
|
402
|
+
const ee = BigInt(0), J = BigInt(1), ot = BigInt(2), Qc = BigInt(3), yr = BigInt(4), zo = BigInt(5), qo = BigInt(8);
|
|
403
403
|
BigInt(9);
|
|
404
404
|
BigInt(16);
|
|
405
|
-
function
|
|
405
|
+
function te(t, e) {
|
|
406
406
|
const n = t % e;
|
|
407
|
-
return n >=
|
|
407
|
+
return n >= ee ? n : e + n;
|
|
408
408
|
}
|
|
409
409
|
function el(t, e, n) {
|
|
410
|
-
if (n <=
|
|
410
|
+
if (n <= ee || e < ee)
|
|
411
411
|
throw new Error("Expected power/modulo > 0");
|
|
412
412
|
if (n === J)
|
|
413
|
-
return
|
|
413
|
+
return ee;
|
|
414
414
|
let r = J;
|
|
415
|
-
for (; e >
|
|
415
|
+
for (; e > ee; )
|
|
416
416
|
e & J && (r = r * t % n), t = t * t % n, e >>= J;
|
|
417
417
|
return r;
|
|
418
418
|
}
|
|
419
419
|
function he(t, e, n) {
|
|
420
420
|
let r = t;
|
|
421
|
-
for (; e-- >
|
|
421
|
+
for (; e-- > ee; )
|
|
422
422
|
r *= r, r %= n;
|
|
423
423
|
return r;
|
|
424
424
|
}
|
|
425
425
|
function br(t, e) {
|
|
426
|
-
if (t ===
|
|
426
|
+
if (t === ee || e <= ee)
|
|
427
427
|
throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);
|
|
428
|
-
let n =
|
|
429
|
-
for (; n !==
|
|
428
|
+
let n = te(t, e), r = e, o = ee, i = J;
|
|
429
|
+
for (; n !== ee; ) {
|
|
430
430
|
const a = r / n, c = r % n, l = o - i * a;
|
|
431
431
|
r = n, n = c, o = i, i = l;
|
|
432
432
|
}
|
|
433
433
|
if (r !== J)
|
|
434
434
|
throw new Error("invert: does not exist");
|
|
435
|
-
return
|
|
435
|
+
return te(o, e);
|
|
436
436
|
}
|
|
437
437
|
function tl(t) {
|
|
438
438
|
const e = (t - J) / ot;
|
|
439
439
|
let n, r, o;
|
|
440
|
-
for (n = t - J, r = 0; n % ot ===
|
|
440
|
+
for (n = t - J, r = 0; n % ot === ee; n /= ot, r++)
|
|
441
441
|
;
|
|
442
442
|
for (o = ot; o < t && el(o, e, t) !== t - J; o++)
|
|
443
443
|
;
|
|
@@ -517,14 +517,14 @@ function ol(t) {
|
|
|
517
517
|
return zt(t, n);
|
|
518
518
|
}
|
|
519
519
|
function il(t, e, n) {
|
|
520
|
-
if (n <
|
|
520
|
+
if (n < ee)
|
|
521
521
|
throw new Error("Expected power > 0");
|
|
522
|
-
if (n ===
|
|
522
|
+
if (n === ee)
|
|
523
523
|
return t.ONE;
|
|
524
524
|
if (n === J)
|
|
525
525
|
return e;
|
|
526
526
|
let r = t.ONE, o = e;
|
|
527
|
-
for (; n >
|
|
527
|
+
for (; n > ee; )
|
|
528
528
|
n & J && (r = t.mul(r, o)), o = t.sqr(o), n >>= J;
|
|
529
529
|
return r;
|
|
530
530
|
}
|
|
@@ -537,7 +537,7 @@ function es(t, e) {
|
|
|
537
537
|
return { nBitLength: n, nByteLength: r };
|
|
538
538
|
}
|
|
539
539
|
function al(t, e, n = !1, r = {}) {
|
|
540
|
-
if (t <=
|
|
540
|
+
if (t <= ee)
|
|
541
541
|
throw new Error(`Expected Field ORDER > 0, got ${t}`);
|
|
542
542
|
const { nBitLength: o, nByteLength: i } = es(t, e);
|
|
543
543
|
if (i > 2048)
|
|
@@ -547,24 +547,24 @@ function al(t, e, n = !1, r = {}) {
|
|
|
547
547
|
BITS: o,
|
|
548
548
|
BYTES: i,
|
|
549
549
|
MASK: jr(o),
|
|
550
|
-
ZERO:
|
|
550
|
+
ZERO: ee,
|
|
551
551
|
ONE: J,
|
|
552
|
-
create: (c) =>
|
|
552
|
+
create: (c) => te(c, t),
|
|
553
553
|
isValid: (c) => {
|
|
554
554
|
if (typeof c != "bigint")
|
|
555
555
|
throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);
|
|
556
|
-
return
|
|
556
|
+
return ee <= c && c < t;
|
|
557
557
|
},
|
|
558
|
-
is0: (c) => c ===
|
|
558
|
+
is0: (c) => c === ee,
|
|
559
559
|
isOdd: (c) => (c & J) === J,
|
|
560
|
-
neg: (c) =>
|
|
560
|
+
neg: (c) => te(-c, t),
|
|
561
561
|
eql: (c, l) => c === l,
|
|
562
|
-
sqr: (c) =>
|
|
563
|
-
add: (c, l) =>
|
|
564
|
-
sub: (c, l) =>
|
|
565
|
-
mul: (c, l) =>
|
|
562
|
+
sqr: (c) => te(c * c, t),
|
|
563
|
+
add: (c, l) => te(c + l, t),
|
|
564
|
+
sub: (c, l) => te(c - l, t),
|
|
565
|
+
mul: (c, l) => te(c * l, t),
|
|
566
566
|
pow: (c, l) => il(a, c, l),
|
|
567
|
-
div: (c, l) =>
|
|
567
|
+
div: (c, l) => te(c * br(l, t), t),
|
|
568
568
|
// Same as above, but doesn't normalize
|
|
569
569
|
sqrN: (c) => c * c,
|
|
570
570
|
addN: (c, l) => c + l,
|
|
@@ -599,7 +599,7 @@ function cl(t, e, n = !1) {
|
|
|
599
599
|
const r = t.length, o = ts(e), i = ns(e);
|
|
600
600
|
if (r < 16 || r < i || r > 1024)
|
|
601
601
|
throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);
|
|
602
|
-
const s = n ? le(t) : qr(t), a =
|
|
602
|
+
const s = n ? le(t) : qr(t), a = te(s, e - J) + J;
|
|
603
603
|
return n ? Vr(a, o) : Xe(a, o);
|
|
604
604
|
}
|
|
605
605
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
@@ -657,8 +657,8 @@ function ul(t, e) {
|
|
|
657
657
|
const h = p * c;
|
|
658
658
|
let y = Number(s & u);
|
|
659
659
|
s >>= f, y > c && (y -= m, s += qn);
|
|
660
|
-
const w = h, E = h + Math.abs(y) - 1, S = p % 2 !== 0,
|
|
661
|
-
y === 0 ? d = d.add(n(S, i[w])) : l = l.add(n(
|
|
660
|
+
const w = h, E = h + Math.abs(y) - 1, S = p % 2 !== 0, O = y < 0;
|
|
661
|
+
y === 0 ? d = d.add(n(S, i[w])) : l = l.add(n(O, i[E]));
|
|
662
662
|
}
|
|
663
663
|
return { p: l, f: d };
|
|
664
664
|
},
|
|
@@ -783,11 +783,11 @@ function ml(t) {
|
|
|
783
783
|
}
|
|
784
784
|
let S;
|
|
785
785
|
try {
|
|
786
|
-
S = typeof p == "bigint" ? p : le(
|
|
786
|
+
S = typeof p == "bigint" ? p : le(ne("private key", p, y));
|
|
787
787
|
} catch {
|
|
788
788
|
throw new Error(`private key must be ${y} bytes, hex or bigint, not ${typeof p}`);
|
|
789
789
|
}
|
|
790
|
-
return w && (S =
|
|
790
|
+
return w && (S = te(S, E)), a(S), S;
|
|
791
791
|
}
|
|
792
792
|
const l = /* @__PURE__ */ new Map();
|
|
793
793
|
function d(p) {
|
|
@@ -835,7 +835,7 @@ function ml(t) {
|
|
|
835
835
|
* @param hex short/long ECDSA hex
|
|
836
836
|
*/
|
|
837
837
|
static fromHex(h) {
|
|
838
|
-
const y = u.fromAffine(o(
|
|
838
|
+
const y = u.fromAffine(o(ne("pointHex", h)));
|
|
839
839
|
return y.assertValidity(), y;
|
|
840
840
|
}
|
|
841
841
|
// Multiplies generator point by privateKey.
|
|
@@ -873,7 +873,7 @@ function ml(t) {
|
|
|
873
873
|
*/
|
|
874
874
|
equals(h) {
|
|
875
875
|
d(h);
|
|
876
|
-
const { px: y, py: w, pz: E } = this, { px: S, py:
|
|
876
|
+
const { px: y, py: w, pz: E } = this, { px: S, py: O, pz: M } = h, _ = n.eql(n.mul(y, M), n.mul(S, E)), N = n.eql(n.mul(w, M), n.mul(O, E));
|
|
877
877
|
return _ && N;
|
|
878
878
|
}
|
|
879
879
|
/**
|
|
@@ -887,9 +887,9 @@ function ml(t) {
|
|
|
887
887
|
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
888
888
|
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
889
889
|
double() {
|
|
890
|
-
const { a: h, b: y } = e, w = n.mul(y, Vo), { px: E, py: S, pz:
|
|
891
|
-
let
|
|
892
|
-
return
|
|
890
|
+
const { a: h, b: y } = e, w = n.mul(y, Vo), { px: E, py: S, pz: O } = this;
|
|
891
|
+
let M = n.ZERO, _ = n.ZERO, N = n.ZERO, L = n.mul(E, E), K = n.mul(S, S), T = n.mul(O, O), P = n.mul(E, S);
|
|
892
|
+
return P = n.add(P, P), N = n.mul(E, O), N = n.add(N, N), M = n.mul(h, N), _ = n.mul(w, T), _ = n.add(M, _), M = n.sub(K, _), _ = n.add(K, _), _ = n.mul(M, _), M = n.mul(P, M), N = n.mul(w, N), T = n.mul(h, T), P = n.sub(L, T), P = n.mul(h, P), P = n.add(P, N), N = n.add(L, L), L = n.add(N, L), L = n.add(L, T), L = n.mul(L, P), _ = n.add(_, L), T = n.mul(S, O), T = n.add(T, T), L = n.mul(T, P), M = n.sub(M, L), N = n.mul(T, K), N = n.add(N, N), N = n.add(N, N), new u(M, _, N);
|
|
893
893
|
}
|
|
894
894
|
// Renes-Costello-Batina exception-free addition formula.
|
|
895
895
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
@@ -897,13 +897,13 @@ function ml(t) {
|
|
|
897
897
|
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
898
898
|
add(h) {
|
|
899
899
|
d(h);
|
|
900
|
-
const { px: y, py: w, pz: E } = this, { px: S, py:
|
|
900
|
+
const { px: y, py: w, pz: E } = this, { px: S, py: O, pz: M } = h;
|
|
901
901
|
let _ = n.ZERO, N = n.ZERO, L = n.ZERO;
|
|
902
|
-
const K = e.a,
|
|
903
|
-
let
|
|
904
|
-
k = n.mul(k, b), b = n.add(
|
|
905
|
-
let v = n.add(S,
|
|
906
|
-
return b = n.mul(b, v), v = n.add(
|
|
902
|
+
const K = e.a, T = n.mul(e.b, Vo);
|
|
903
|
+
let P = n.mul(y, S), D = n.mul(w, O), U = n.mul(E, M), k = n.add(y, w), b = n.add(S, O);
|
|
904
|
+
k = n.mul(k, b), b = n.add(P, D), k = n.sub(k, b), b = n.add(y, E);
|
|
905
|
+
let v = n.add(S, M);
|
|
906
|
+
return b = n.mul(b, v), v = n.add(P, U), b = n.sub(b, v), v = n.add(w, E), _ = n.add(O, M), v = n.mul(v, _), _ = n.add(D, U), v = n.sub(v, _), L = n.mul(K, b), _ = n.mul(T, U), L = n.add(_, L), _ = n.sub(D, L), L = n.add(D, L), N = n.mul(_, L), D = n.add(P, P), D = n.add(D, P), U = n.mul(K, U), b = n.mul(T, b), D = n.add(D, U), U = n.sub(P, U), U = n.mul(K, U), b = n.add(b, U), P = n.mul(D, b), N = n.add(N, P), P = n.mul(v, b), _ = n.mul(k, _), _ = n.sub(_, P), P = n.mul(k, D), L = n.mul(v, L), L = n.add(L, P), new u(_, N, L);
|
|
907
907
|
}
|
|
908
908
|
subtract(h) {
|
|
909
909
|
return this.add(h.negate());
|
|
@@ -931,10 +931,10 @@ function ml(t) {
|
|
|
931
931
|
const { endo: w } = e;
|
|
932
932
|
if (!w)
|
|
933
933
|
return f.unsafeLadder(this, h);
|
|
934
|
-
let { k1neg: E, k1: S, k2neg:
|
|
935
|
-
for (; S > Re ||
|
|
936
|
-
S & me && (_ = _.add(L)),
|
|
937
|
-
return E && (_ = _.negate()),
|
|
934
|
+
let { k1neg: E, k1: S, k2neg: O, k2: M } = w.splitScalar(h), _ = y, N = y, L = this;
|
|
935
|
+
for (; S > Re || M > Re; )
|
|
936
|
+
S & me && (_ = _.add(L)), M & me && (N = N.add(L)), L = L.double(), S >>= me, M >>= me;
|
|
937
|
+
return E && (_ = _.negate()), O && (N = N.negate()), N = new u(n.mul(N.px, w.beta), N.py, N.pz), _.add(N);
|
|
938
938
|
}
|
|
939
939
|
/**
|
|
940
940
|
* Constant time multiplication.
|
|
@@ -950,12 +950,12 @@ function ml(t) {
|
|
|
950
950
|
let y = h, w, E;
|
|
951
951
|
const { endo: S } = e;
|
|
952
952
|
if (S) {
|
|
953
|
-
const { k1neg:
|
|
954
|
-
let { p: L, f: K } = this.wNAF(
|
|
955
|
-
L = f.constTimeNegate(
|
|
953
|
+
const { k1neg: O, k1: M, k2neg: _, k2: N } = S.splitScalar(y);
|
|
954
|
+
let { p: L, f: K } = this.wNAF(M), { p: T, f: P } = this.wNAF(N);
|
|
955
|
+
L = f.constTimeNegate(O, L), T = f.constTimeNegate(_, T), T = new u(n.mul(T.px, S.beta), T.py, T.pz), w = L.add(T), E = K.add(P);
|
|
956
956
|
} else {
|
|
957
|
-
const { p:
|
|
958
|
-
w =
|
|
957
|
+
const { p: O, f: M } = this.wNAF(y);
|
|
958
|
+
w = O, E = M;
|
|
959
959
|
}
|
|
960
960
|
return u.normalizeZ([w, E])[0];
|
|
961
961
|
}
|
|
@@ -966,8 +966,8 @@ function ml(t) {
|
|
|
966
966
|
* @returns non-zero affine point
|
|
967
967
|
*/
|
|
968
968
|
multiplyAndAddUnsafe(h, y, w) {
|
|
969
|
-
const E = u.BASE, S = (
|
|
970
|
-
return
|
|
969
|
+
const E = u.BASE, S = (M, _) => _ === Re || _ === me || !M.equals(E) ? M.multiplyUnsafe(_) : M.multiply(_), O = S(this, y).add(S(h, w));
|
|
970
|
+
return O.is0() ? void 0 : O;
|
|
971
971
|
}
|
|
972
972
|
// Converts Projective point to affine (x, y) coordinates.
|
|
973
973
|
// Can accept precomputed Z^-1 - for example, from invertBatch.
|
|
@@ -975,12 +975,12 @@ function ml(t) {
|
|
|
975
975
|
toAffine(h) {
|
|
976
976
|
const { px: y, py: w, pz: E } = this, S = this.is0();
|
|
977
977
|
h == null && (h = S ? n.ONE : n.inv(E));
|
|
978
|
-
const
|
|
978
|
+
const O = n.mul(y, h), M = n.mul(w, h), _ = n.mul(E, h);
|
|
979
979
|
if (S)
|
|
980
980
|
return { x: n.ZERO, y: n.ZERO };
|
|
981
981
|
if (!n.eql(_, n.ONE))
|
|
982
982
|
throw new Error("invZ was invalid");
|
|
983
|
-
return { x:
|
|
983
|
+
return { x: O, y: M };
|
|
984
984
|
}
|
|
985
985
|
isTorsionFree() {
|
|
986
986
|
const { h, isTorsionFree: y } = e;
|
|
@@ -1029,7 +1029,7 @@ function gl(t) {
|
|
|
1029
1029
|
return Re < b && b < n.ORDER;
|
|
1030
1030
|
}
|
|
1031
1031
|
function a(b) {
|
|
1032
|
-
return
|
|
1032
|
+
return te(b, r);
|
|
1033
1033
|
}
|
|
1034
1034
|
function c(b) {
|
|
1035
1035
|
return br(b, r);
|
|
@@ -1048,8 +1048,8 @@ function gl(t) {
|
|
|
1048
1048
|
throw new Error("Point is not on curve");
|
|
1049
1049
|
const $ = u(C);
|
|
1050
1050
|
let B = n.sqrt($);
|
|
1051
|
-
const
|
|
1052
|
-
return (A & 1) === 1 !==
|
|
1051
|
+
const R = (B & me) === me;
|
|
1052
|
+
return (A & 1) === 1 !== R && (B = n.neg(B)), { x: C, y: B };
|
|
1053
1053
|
} else if (v === i && A === 4) {
|
|
1054
1054
|
const C = n.fromBytes(I.subarray(0, n.BYTES)), $ = n.fromBytes(I.subarray(n.BYTES, 2 * n.BYTES));
|
|
1055
1055
|
return { x: C, y: $ };
|
|
@@ -1072,12 +1072,12 @@ function gl(t) {
|
|
|
1072
1072
|
// pair (bytes of r, bytes of s)
|
|
1073
1073
|
static fromCompact(v) {
|
|
1074
1074
|
const A = e.nByteLength;
|
|
1075
|
-
return v =
|
|
1075
|
+
return v = ne("compactSignature", v, A * 2), new w(y(v, 0, A), y(v, A, 2 * A));
|
|
1076
1076
|
}
|
|
1077
1077
|
// DER encoded ECDSA signature
|
|
1078
1078
|
// https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
|
|
1079
1079
|
static fromDER(v) {
|
|
1080
|
-
const { r: A, s: I } = it.toSig(
|
|
1080
|
+
const { r: A, s: I } = it.toSig(ne("DER", v));
|
|
1081
1081
|
return new w(A, I);
|
|
1082
1082
|
}
|
|
1083
1083
|
assertValidity() {
|
|
@@ -1090,13 +1090,13 @@ function gl(t) {
|
|
|
1090
1090
|
return new w(this.r, this.s, v);
|
|
1091
1091
|
}
|
|
1092
1092
|
recoverPublicKey(v) {
|
|
1093
|
-
const { r: A, s: I, recovery: C } = this, $ = N(
|
|
1093
|
+
const { r: A, s: I, recovery: C } = this, $ = N(ne("msgHash", v));
|
|
1094
1094
|
if (C == null || ![0, 1, 2, 3].includes(C))
|
|
1095
1095
|
throw new Error("recovery id invalid");
|
|
1096
1096
|
const B = C === 2 || C === 3 ? A + e.n : A;
|
|
1097
1097
|
if (B >= n.ORDER)
|
|
1098
1098
|
throw new Error("recovery id 2 or 3 invalid");
|
|
1099
|
-
const
|
|
1099
|
+
const R = (C & 1) === 0 ? "02" : "03", z = l.fromHex(R + f(B)), q = c(B), F = a(-$ * q), V = a(I * q), G = l.BASE.multiplyAndAddUnsafe(z, F, V);
|
|
1100
1100
|
if (!G)
|
|
1101
1101
|
throw new Error("point at infinify");
|
|
1102
1102
|
return G.assertValidity(), G;
|
|
@@ -1155,14 +1155,14 @@ function gl(t) {
|
|
|
1155
1155
|
function S(b, v = !0) {
|
|
1156
1156
|
return l.fromPrivateKey(b).toRawBytes(v);
|
|
1157
1157
|
}
|
|
1158
|
-
function
|
|
1158
|
+
function O(b) {
|
|
1159
1159
|
const v = b instanceof Uint8Array, A = typeof b == "string", I = (v || A) && b.length;
|
|
1160
1160
|
return v ? I === o || I === i : A ? I === 2 * o || I === 2 * i : b instanceof l;
|
|
1161
1161
|
}
|
|
1162
|
-
function
|
|
1163
|
-
if (
|
|
1162
|
+
function M(b, v, A = !0) {
|
|
1163
|
+
if (O(b))
|
|
1164
1164
|
throw new Error("first arg must be private key");
|
|
1165
|
-
if (!
|
|
1165
|
+
if (!O(v))
|
|
1166
1166
|
throw new Error("second arg must be public key");
|
|
1167
1167
|
return l.fromHex(v).multiply(d(b)).toRawBytes(A);
|
|
1168
1168
|
}
|
|
@@ -1179,19 +1179,19 @@ function gl(t) {
|
|
|
1179
1179
|
throw new Error(`bigint expected < 2^${e.nBitLength}`);
|
|
1180
1180
|
return Xe(b, e.nByteLength);
|
|
1181
1181
|
}
|
|
1182
|
-
function
|
|
1182
|
+
function T(b, v, A = P) {
|
|
1183
1183
|
if (["recovered", "canonical"].some((se) => se in A))
|
|
1184
1184
|
throw new Error("sign() legacy options not supported");
|
|
1185
1185
|
const { hash: I, randomBytes: C } = e;
|
|
1186
|
-
let { lowS: $, prehash: B, extraEntropy:
|
|
1187
|
-
$ == null && ($ = !0), b =
|
|
1186
|
+
let { lowS: $, prehash: B, extraEntropy: R } = A;
|
|
1187
|
+
$ == null && ($ = !0), b = ne("msgHash", b), B && (b = ne("prehashed msgHash", I(b)));
|
|
1188
1188
|
const z = N(b), q = d(v), F = [K(q), K(z)];
|
|
1189
|
-
if (
|
|
1190
|
-
const se =
|
|
1191
|
-
F.push(
|
|
1189
|
+
if (R != null) {
|
|
1190
|
+
const se = R === !0 ? C(n.BYTES) : R;
|
|
1191
|
+
F.push(ne("extraEntropy", se));
|
|
1192
1192
|
}
|
|
1193
1193
|
const V = lt(...F), G = z;
|
|
1194
|
-
function
|
|
1194
|
+
function oe(se) {
|
|
1195
1195
|
const Z = _(se);
|
|
1196
1196
|
if (!m(Z))
|
|
1197
1197
|
return;
|
|
@@ -1204,33 +1204,33 @@ function gl(t) {
|
|
|
1204
1204
|
let Oo = (mt.x === pe ? 0 : 2) | Number(mt.y & me), Mo = pt;
|
|
1205
1205
|
return $ && p(pt) && (Mo = h(pt), Oo ^= 1), new w(pe, Mo, Oo);
|
|
1206
1206
|
}
|
|
1207
|
-
return { seed: V, k2sig:
|
|
1207
|
+
return { seed: V, k2sig: oe };
|
|
1208
1208
|
}
|
|
1209
|
-
const
|
|
1210
|
-
function
|
|
1211
|
-
const { seed: I, k2sig: C } =
|
|
1209
|
+
const P = { lowS: e.lowS, prehash: !1 }, D = { lowS: e.lowS, prehash: !1 };
|
|
1210
|
+
function U(b, v, A = P) {
|
|
1211
|
+
const { seed: I, k2sig: C } = T(b, v, A), $ = e;
|
|
1212
1212
|
return Qi($.hash.outputLen, $.nByteLength, $.hmac)(I, C);
|
|
1213
1213
|
}
|
|
1214
1214
|
l.BASE._setWindowSize(8);
|
|
1215
|
-
function k(b, v, A, I =
|
|
1215
|
+
function k(b, v, A, I = D) {
|
|
1216
1216
|
var mt;
|
|
1217
1217
|
const C = b;
|
|
1218
|
-
if (v =
|
|
1218
|
+
if (v = ne("msgHash", v), A = ne("publicKey", A), "strict" in I)
|
|
1219
1219
|
throw new Error("options.strict was renamed to lowS");
|
|
1220
1220
|
const { lowS: $, prehash: B } = I;
|
|
1221
|
-
let
|
|
1221
|
+
let R, z;
|
|
1222
1222
|
try {
|
|
1223
1223
|
if (typeof C == "string" || C instanceof Uint8Array)
|
|
1224
1224
|
try {
|
|
1225
|
-
|
|
1225
|
+
R = w.fromDER(C);
|
|
1226
1226
|
} catch (pe) {
|
|
1227
1227
|
if (!(pe instanceof it.Err))
|
|
1228
1228
|
throw pe;
|
|
1229
|
-
|
|
1229
|
+
R = w.fromCompact(C);
|
|
1230
1230
|
}
|
|
1231
1231
|
else if (typeof C == "object" && typeof C.r == "bigint" && typeof C.s == "bigint") {
|
|
1232
1232
|
const { r: pe, s: pt } = C;
|
|
1233
|
-
|
|
1233
|
+
R = new w(pe, pt);
|
|
1234
1234
|
} else
|
|
1235
1235
|
throw new Error("PARSE");
|
|
1236
1236
|
z = l.fromHex(A);
|
|
@@ -1239,17 +1239,17 @@ function gl(t) {
|
|
|
1239
1239
|
throw new Error("signature must be Signature instance, Uint8Array or hex string");
|
|
1240
1240
|
return !1;
|
|
1241
1241
|
}
|
|
1242
|
-
if ($ &&
|
|
1242
|
+
if ($ && R.hasHighS())
|
|
1243
1243
|
return !1;
|
|
1244
1244
|
B && (v = e.hash(v));
|
|
1245
|
-
const { r: q, s: F } =
|
|
1245
|
+
const { r: q, s: F } = R, V = N(v), G = c(F), oe = a(V * G), se = a(q * G), Z = (mt = l.BASE.multiplyAndAddUnsafe(z, oe, se)) == null ? void 0 : mt.toAffine();
|
|
1246
1246
|
return Z ? a(Z.x) === q : !1;
|
|
1247
1247
|
}
|
|
1248
1248
|
return {
|
|
1249
1249
|
CURVE: e,
|
|
1250
1250
|
getPublicKey: S,
|
|
1251
|
-
getSharedSecret:
|
|
1252
|
-
sign:
|
|
1251
|
+
getSharedSecret: M,
|
|
1252
|
+
sign: U,
|
|
1253
1253
|
verify: k,
|
|
1254
1254
|
ProjectivePoint: l,
|
|
1255
1255
|
Signature: w,
|
|
@@ -1308,7 +1308,7 @@ function bl(t, e) {
|
|
|
1308
1308
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1309
1309
|
const _n = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), ln = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), ss = BigInt(1), un = BigInt(2), jo = (t, e) => (t + e / un) / e;
|
|
1310
1310
|
function as(t) {
|
|
1311
|
-
const e = _n, n = BigInt(3), r = BigInt(6), o = BigInt(11), i = BigInt(22), s = BigInt(23), a = BigInt(44), c = BigInt(88), l = t * t * t % e, d = l * l * t % e, u = he(d, n, e) * d % e, m = he(u, n, e) * d % e, f = he(m, un, e) * l % e, p = he(f, o, e) * f % e, h = he(p, i, e) * p % e, y = he(h, a, e) * h % e, w = he(y, c, e) * y % e, E = he(w, a, e) * h % e, S = he(E, n, e) * d % e,
|
|
1311
|
+
const e = _n, n = BigInt(3), r = BigInt(6), o = BigInt(11), i = BigInt(22), s = BigInt(23), a = BigInt(44), c = BigInt(88), l = t * t * t % e, d = l * l * t % e, u = he(d, n, e) * d % e, m = he(u, n, e) * d % e, f = he(m, un, e) * l % e, p = he(f, o, e) * f % e, h = he(p, i, e) * p % e, y = he(h, a, e) * h % e, w = he(y, c, e) * y % e, E = he(w, a, e) * h % e, S = he(E, n, e) * d % e, O = he(S, s, e) * p % e, M = he(O, r, e) * l % e, _ = he(M, un, e);
|
|
1312
1312
|
if (!wr.eql(wr.sqr(_), t))
|
|
1313
1313
|
throw new Error("Cannot find square root");
|
|
1314
1314
|
return _;
|
|
@@ -1333,7 +1333,7 @@ const wr = al(_n, void 0, void 0, { sqrt: as }), dt = bl({
|
|
|
1333
1333
|
beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
|
|
1334
1334
|
splitScalar: (t) => {
|
|
1335
1335
|
const e = ln, n = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), r = -ss * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), o = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), i = n, s = BigInt("0x100000000000000000000000000000000"), a = jo(i * t, e), c = jo(-r * t, e);
|
|
1336
|
-
let l =
|
|
1336
|
+
let l = te(t - a * n - c * o, e), d = te(-a * r - c * i, e);
|
|
1337
1337
|
const u = l > s, m = d > s;
|
|
1338
1338
|
if (u && (l = e - l), m && (d = e - d), l > s || d > s)
|
|
1339
1339
|
throw new Error("splitScalar: Endomorphism failed, k=" + t);
|
|
@@ -1349,7 +1349,7 @@ function dn(t, ...e) {
|
|
|
1349
1349
|
}
|
|
1350
1350
|
return gr(lt(n, ...e));
|
|
1351
1351
|
}
|
|
1352
|
-
const Fr = (t) => t.toRawBytes(!0).slice(1), vr = (t) => Xe(t, 32), Vn = (t) =>
|
|
1352
|
+
const Fr = (t) => t.toRawBytes(!0).slice(1), vr = (t) => Xe(t, 32), Vn = (t) => te(t, _n), Mt = (t) => te(t, ln), Wr = dt.ProjectivePoint, vl = (t, e, n) => Wr.BASE.multiplyAndAddUnsafe(t, e, n);
|
|
1353
1353
|
function xr(t) {
|
|
1354
1354
|
let e = dt.utils.normPrivateKeyToScalar(t), n = Wr.fromPrivateKey(e);
|
|
1355
1355
|
return { scalar: n.hasEvenY() ? e : Mt(-e), bytes: Fr(n) };
|
|
@@ -1370,7 +1370,7 @@ function xl(t) {
|
|
|
1370
1370
|
return xr(t).bytes;
|
|
1371
1371
|
}
|
|
1372
1372
|
function El(t, e, n = Xi(32)) {
|
|
1373
|
-
const r =
|
|
1373
|
+
const r = ne("message", t), { bytes: o, scalar: i } = xr(e), s = ne("auxRand", n, 32), a = vr(i ^ le(dn("BIP0340/aux", s))), c = dn("BIP0340/nonce", a, o, r), l = Mt(le(c));
|
|
1374
1374
|
if (l === An)
|
|
1375
1375
|
throw new Error("sign failed: k is zero");
|
|
1376
1376
|
const { bytes: d, scalar: u } = xr(l), m = us(d, o, r), f = new Uint8Array(64);
|
|
@@ -1379,7 +1379,7 @@ function El(t, e, n = Xi(32)) {
|
|
|
1379
1379
|
return f;
|
|
1380
1380
|
}
|
|
1381
1381
|
function ds(t, e, n) {
|
|
1382
|
-
const r =
|
|
1382
|
+
const r = ne("signature", t, 64), o = ne("message", e), i = ne("publicKey", n, 32);
|
|
1383
1383
|
try {
|
|
1384
1384
|
const s = ls(le(i)), a = le(r.subarray(0, 32));
|
|
1385
1385
|
if (!cs(a))
|
|
@@ -1404,7 +1404,7 @@ const Ae = {
|
|
|
1404
1404
|
numberToBytesBE: Xe,
|
|
1405
1405
|
bytesToNumberBE: le,
|
|
1406
1406
|
taggedHash: dn,
|
|
1407
|
-
mod:
|
|
1407
|
+
mod: te
|
|
1408
1408
|
}
|
|
1409
1409
|
}, jn = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
|
|
1410
1410
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
@@ -1998,7 +1998,7 @@ function Ne(t, ...e) {
|
|
|
1998
1998
|
throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`);
|
|
1999
1999
|
}
|
|
2000
2000
|
/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
|
|
2001
|
-
const
|
|
2001
|
+
const re = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), jl = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
2002
2002
|
if (!jl)
|
|
2003
2003
|
throw new Error("Non little-endian hardware is not supported");
|
|
2004
2004
|
const Fl = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
@@ -2092,7 +2092,7 @@ function ks(t) {
|
|
|
2092
2092
|
const e = t.length;
|
|
2093
2093
|
if (![16, 24, 32].includes(e))
|
|
2094
2094
|
throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${e}`);
|
|
2095
|
-
const { sbox2: n } = Xr, r =
|
|
2095
|
+
const { sbox2: n } = Xr, r = re(t), o = r.length, i = (a) => Ce(n, a, a, a, a), s = new Uint32Array(e + 28);
|
|
2096
2096
|
s.set(r);
|
|
2097
2097
|
for (let a = o; a < s.length; a++) {
|
|
2098
2098
|
let c = s[a - 1];
|
|
@@ -2158,12 +2158,12 @@ function nu(t, e, n) {
|
|
|
2158
2158
|
const o = r % Ye;
|
|
2159
2159
|
if (!e && o !== 0)
|
|
2160
2160
|
throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");
|
|
2161
|
-
const i =
|
|
2161
|
+
const i = re(t);
|
|
2162
2162
|
if (e) {
|
|
2163
2163
|
let c = Ye - o;
|
|
2164
2164
|
c || (c = Ye), r = r + c;
|
|
2165
2165
|
}
|
|
2166
|
-
const s = _s(r, n), a =
|
|
2166
|
+
const s = _s(r, n), a = re(s);
|
|
2167
2167
|
return { b: i, o: a, out: s };
|
|
2168
2168
|
}
|
|
2169
2169
|
function ru(t, e) {
|
|
@@ -2182,7 +2182,7 @@ function ru(t, e) {
|
|
|
2182
2182
|
return o;
|
|
2183
2183
|
}
|
|
2184
2184
|
function ou(t) {
|
|
2185
|
-
const e = new Uint8Array(16), n =
|
|
2185
|
+
const e = new Uint8Array(16), n = re(e);
|
|
2186
2186
|
e.set(t);
|
|
2187
2187
|
const r = Ye - t.length;
|
|
2188
2188
|
for (let o = Ye - r; o < Ye; o++)
|
|
@@ -2194,7 +2194,7 @@ const As = /* @__PURE__ */ Zl({ blockSize: 16, nonceLength: 16 }, function(e, n,
|
|
|
2194
2194
|
const o = !r.disablePadding;
|
|
2195
2195
|
return {
|
|
2196
2196
|
encrypt: (i, s) => {
|
|
2197
|
-
const a = ks(e), { b: c, o: l, out: d } = nu(i, o, s), u =
|
|
2197
|
+
const a = ks(e), { b: c, o: l, out: d } = nu(i, o, s), u = re(n);
|
|
2198
2198
|
let m = u[0], f = u[1], p = u[2], h = u[3], y = 0;
|
|
2199
2199
|
for (; y + 4 <= c.length; )
|
|
2200
2200
|
m ^= c[y + 0], f ^= c[y + 1], p ^= c[y + 2], h ^= c[y + 3], { s0: m, s1: f, s2: p, s3: h } = ei(a, m, f, p, h), l[y++] = m, l[y++] = f, l[y++] = p, l[y++] = h;
|
|
@@ -2206,18 +2206,18 @@ const As = /* @__PURE__ */ Zl({ blockSize: 16, nonceLength: 16 }, function(e, n,
|
|
|
2206
2206
|
},
|
|
2207
2207
|
decrypt: (i, s) => {
|
|
2208
2208
|
tu(i);
|
|
2209
|
-
const a = Ql(e), c =
|
|
2209
|
+
const a = Ql(e), c = re(n), l = _s(i.length, s), d = re(i), u = re(l);
|
|
2210
2210
|
let m = c[0], f = c[1], p = c[2], h = c[3];
|
|
2211
2211
|
for (let y = 0; y + 4 <= d.length; ) {
|
|
2212
|
-
const w = m, E = f, S = p,
|
|
2212
|
+
const w = m, E = f, S = p, O = h;
|
|
2213
2213
|
m = d[y + 0], f = d[y + 1], p = d[y + 2], h = d[y + 3];
|
|
2214
|
-
const { s0:
|
|
2215
|
-
u[y++] =
|
|
2214
|
+
const { s0: M, s1: _, s2: N, s3: L } = eu(a, m, f, p, h);
|
|
2215
|
+
u[y++] = M ^ w, u[y++] = _ ^ E, u[y++] = N ^ S, u[y++] = L ^ O;
|
|
2216
2216
|
}
|
|
2217
2217
|
return a.fill(0), ru(l, o);
|
|
2218
2218
|
}
|
|
2219
2219
|
};
|
|
2220
|
-
}), Ss = (t) => Uint8Array.from(t.split("").map((e) => e.charCodeAt(0))), iu = Ss("expand 16-byte k"), su = Ss("expand 32-byte k"), au =
|
|
2220
|
+
}), Ss = (t) => Uint8Array.from(t.split("").map((e) => e.charCodeAt(0))), iu = Ss("expand 16-byte k"), su = Ss("expand 32-byte k"), au = re(iu), Ns = re(su);
|
|
2221
2221
|
Ns.slice();
|
|
2222
2222
|
function j(t, e) {
|
|
2223
2223
|
return t << e | t >>> 32 - e;
|
|
@@ -2227,7 +2227,7 @@ function Nr(t) {
|
|
|
2227
2227
|
}
|
|
2228
2228
|
const Wt = 64, cu = 16, Cs = 2 ** 32 - 1, ti = new Uint32Array();
|
|
2229
2229
|
function lu(t, e, n, r, o, i, s, a) {
|
|
2230
|
-
const c = o.length, l = new Uint8Array(Wt), d =
|
|
2230
|
+
const c = o.length, l = new Uint8Array(Wt), d = re(l), u = Nr(o) && Nr(i), m = u ? re(o) : ti, f = u ? re(i) : ti;
|
|
2231
2231
|
for (let p = 0; p < c; s++) {
|
|
2232
2232
|
if (t(e, n, r, d, s, a), s >= Cs)
|
|
2233
2233
|
throw new Error("arx: counter overflow");
|
|
@@ -2266,31 +2266,31 @@ function uu(t, e) {
|
|
|
2266
2266
|
else
|
|
2267
2267
|
throw new Error(`arx: invalid 32-byte key, got length=${p}`);
|
|
2268
2268
|
Nr(c) || (c = c.slice(), f.push(c));
|
|
2269
|
-
const w =
|
|
2269
|
+
const w = re(h);
|
|
2270
2270
|
if (r) {
|
|
2271
2271
|
if (c.length !== 24)
|
|
2272
2272
|
throw new Error("arx: extended nonce must be 24 bytes");
|
|
2273
|
-
r(y, w,
|
|
2273
|
+
r(y, w, re(c.subarray(0, 16)), w), c = c.subarray(16);
|
|
2274
2274
|
}
|
|
2275
2275
|
const E = 16 - o;
|
|
2276
2276
|
if (E !== c.length)
|
|
2277
2277
|
throw new Error(`arx: nonce must be ${E} or 16 bytes`);
|
|
2278
2278
|
if (E !== 12) {
|
|
2279
|
-
const
|
|
2280
|
-
|
|
2279
|
+
const O = new Uint8Array(12);
|
|
2280
|
+
O.set(c, i ? 0 : 12 - c.length), c = O, f.push(c);
|
|
2281
2281
|
}
|
|
2282
|
-
const S =
|
|
2282
|
+
const S = re(c);
|
|
2283
2283
|
for (lu(t, y, w, S, l, d, u, s); f.length > 0; )
|
|
2284
2284
|
f.pop().fill(0);
|
|
2285
2285
|
return d;
|
|
2286
2286
|
};
|
|
2287
2287
|
}
|
|
2288
2288
|
function du(t, e, n, r, o, i = 20) {
|
|
2289
|
-
let s = t[0], a = t[1], c = t[2], l = t[3], d = e[0], u = e[1], m = e[2], f = e[3], p = e[4], h = e[5], y = e[6], w = e[7], E = o, S = n[0],
|
|
2289
|
+
let s = t[0], a = t[1], c = t[2], l = t[3], d = e[0], u = e[1], m = e[2], f = e[3], p = e[4], h = e[5], y = e[6], w = e[7], E = o, S = n[0], O = n[1], M = n[2], _ = s, N = a, L = c, K = l, T = d, P = u, D = m, U = f, k = p, b = h, v = y, A = w, I = E, C = S, $ = O, B = M;
|
|
2290
2290
|
for (let z = 0; z < i; z += 2)
|
|
2291
|
-
_ = _ +
|
|
2292
|
-
let
|
|
2293
|
-
r[
|
|
2291
|
+
_ = _ + T | 0, I = j(I ^ _, 16), k = k + I | 0, T = j(T ^ k, 12), _ = _ + T | 0, I = j(I ^ _, 8), k = k + I | 0, T = j(T ^ k, 7), N = N + P | 0, C = j(C ^ N, 16), b = b + C | 0, P = j(P ^ b, 12), N = N + P | 0, C = j(C ^ N, 8), b = b + C | 0, P = j(P ^ b, 7), L = L + D | 0, $ = j($ ^ L, 16), v = v + $ | 0, D = j(D ^ v, 12), L = L + D | 0, $ = j($ ^ L, 8), v = v + $ | 0, D = j(D ^ v, 7), K = K + U | 0, B = j(B ^ K, 16), A = A + B | 0, U = j(U ^ A, 12), K = K + U | 0, B = j(B ^ K, 8), A = A + B | 0, U = j(U ^ A, 7), _ = _ + P | 0, B = j(B ^ _, 16), v = v + B | 0, P = j(P ^ v, 12), _ = _ + P | 0, B = j(B ^ _, 8), v = v + B | 0, P = j(P ^ v, 7), N = N + D | 0, I = j(I ^ N, 16), A = A + I | 0, D = j(D ^ A, 12), N = N + D | 0, I = j(I ^ N, 8), A = A + I | 0, D = j(D ^ A, 7), L = L + U | 0, C = j(C ^ L, 16), k = k + C | 0, U = j(U ^ k, 12), L = L + U | 0, C = j(C ^ L, 8), k = k + C | 0, U = j(U ^ k, 7), K = K + T | 0, $ = j($ ^ K, 16), b = b + $ | 0, T = j(T ^ b, 12), K = K + T | 0, $ = j($ ^ K, 8), b = b + $ | 0, T = j(T ^ b, 7);
|
|
2292
|
+
let R = 0;
|
|
2293
|
+
r[R++] = s + _ | 0, r[R++] = a + N | 0, r[R++] = c + L | 0, r[R++] = l + K | 0, r[R++] = d + T | 0, r[R++] = u + P | 0, r[R++] = m + D | 0, r[R++] = f + U | 0, r[R++] = p + k | 0, r[R++] = h + b | 0, r[R++] = y + v | 0, r[R++] = w + A | 0, r[R++] = E + I | 0, r[R++] = S + C | 0, r[R++] = O + $ | 0, r[R++] = M + B | 0;
|
|
2294
2294
|
}
|
|
2295
2295
|
const Nn = /* @__PURE__ */ uu(du, {
|
|
2296
2296
|
counterRight: !1,
|
|
@@ -3896,8 +3896,8 @@ var _f = class {
|
|
|
3896
3896
|
}
|
|
3897
3897
|
if (l = !0, this.storage.iterate(p, h, (E) => {
|
|
3898
3898
|
let S = E.id;
|
|
3899
|
-
const
|
|
3900
|
-
return w[
|
|
3899
|
+
const O = gt(S);
|
|
3900
|
+
return w[O] ? delete w[gt(S)] : e == null || e(O), !0;
|
|
3901
3901
|
}), n)
|
|
3902
3902
|
for (let E of Object.values(w))
|
|
3903
3903
|
n(gt(E));
|
|
@@ -5103,7 +5103,7 @@ let Pe = {
|
|
|
5103
5103
|
error: null
|
|
5104
5104
|
};
|
|
5105
5105
|
const Br = /* @__PURE__ */ new Set();
|
|
5106
|
-
function
|
|
5106
|
+
function Q(t) {
|
|
5107
5107
|
Pe = { ...Pe, ...t }, Br.forEach((e) => e());
|
|
5108
5108
|
}
|
|
5109
5109
|
function im(t) {
|
|
@@ -5112,9 +5112,27 @@ function im(t) {
|
|
|
5112
5112
|
function ci() {
|
|
5113
5113
|
return Pe;
|
|
5114
5114
|
}
|
|
5115
|
-
function
|
|
5115
|
+
function Fg() {
|
|
5116
5116
|
return Pe.signer !== null;
|
|
5117
5117
|
}
|
|
5118
|
+
async function sm(t) {
|
|
5119
|
+
Q({ loading: !0, error: null });
|
|
5120
|
+
try {
|
|
5121
|
+
const e = await t.getPublicKey();
|
|
5122
|
+
return Q({
|
|
5123
|
+
signer: t,
|
|
5124
|
+
signerInfo: { type: "nip07", pubkey: e },
|
|
5125
|
+
// Use nip07 as default type for external signers
|
|
5126
|
+
loading: !1,
|
|
5127
|
+
error: null
|
|
5128
|
+
}), !0;
|
|
5129
|
+
} catch (e) {
|
|
5130
|
+
return Q({
|
|
5131
|
+
loading: !1,
|
|
5132
|
+
error: e instanceof Error ? e.message : "Failed to get public key"
|
|
5133
|
+
}), !1;
|
|
5134
|
+
}
|
|
5135
|
+
}
|
|
5118
5136
|
function Vt() {
|
|
5119
5137
|
const { signer: t, signerInfo: e, loading: n, error: r } = $c(
|
|
5120
5138
|
im,
|
|
@@ -5122,79 +5140,79 @@ function Vt() {
|
|
|
5122
5140
|
ci
|
|
5123
5141
|
), o = _e(async () => {
|
|
5124
5142
|
if (!Dn.isAvailable()) {
|
|
5125
|
-
|
|
5143
|
+
Q({ error: "NIP-07 extension not found" });
|
|
5126
5144
|
return;
|
|
5127
5145
|
}
|
|
5128
|
-
|
|
5146
|
+
Q({ loading: !0, error: null });
|
|
5129
5147
|
try {
|
|
5130
5148
|
const u = new Dn(), m = await u.getPublicKey();
|
|
5131
|
-
|
|
5149
|
+
Q({
|
|
5132
5150
|
signer: u,
|
|
5133
5151
|
signerInfo: { type: "nip07", pubkey: m },
|
|
5134
5152
|
loading: !1
|
|
5135
5153
|
});
|
|
5136
5154
|
} catch (u) {
|
|
5137
|
-
|
|
5155
|
+
Q({
|
|
5138
5156
|
error: u instanceof Error ? u.message : "Login failed",
|
|
5139
5157
|
loading: !1
|
|
5140
5158
|
});
|
|
5141
5159
|
}
|
|
5142
5160
|
}, []), i = _e(async () => {
|
|
5143
|
-
|
|
5161
|
+
Q({ loading: !0, error: null });
|
|
5144
5162
|
try {
|
|
5145
5163
|
const u = new Kt(), m = await u.getPublicKey();
|
|
5146
|
-
|
|
5164
|
+
Q({
|
|
5147
5165
|
signer: u,
|
|
5148
5166
|
signerInfo: { type: "temp", pubkey: m },
|
|
5149
5167
|
loading: !1
|
|
5150
5168
|
});
|
|
5151
5169
|
} catch (u) {
|
|
5152
|
-
|
|
5170
|
+
Q({
|
|
5153
5171
|
error: u instanceof Error ? u.message : "Login failed",
|
|
5154
5172
|
loading: !1
|
|
5155
5173
|
});
|
|
5156
5174
|
}
|
|
5157
5175
|
}, []), s = _e(async (u) => {
|
|
5158
|
-
|
|
5176
|
+
Q({ loading: !0, error: null });
|
|
5159
5177
|
try {
|
|
5160
5178
|
const m = Kt.fromNsec(u.trim()), f = await m.getPublicKey();
|
|
5161
|
-
|
|
5179
|
+
Q({
|
|
5162
5180
|
signer: m,
|
|
5163
5181
|
signerInfo: { type: "temp", pubkey: f },
|
|
5164
5182
|
loading: !1
|
|
5165
5183
|
});
|
|
5166
5184
|
} catch (m) {
|
|
5167
|
-
throw
|
|
5185
|
+
throw Q({
|
|
5168
5186
|
error: m instanceof Error ? m.message : "Invalid nsec",
|
|
5169
5187
|
loading: !1
|
|
5170
5188
|
}), m;
|
|
5171
5189
|
}
|
|
5172
5190
|
}, []), a = _e(async (u) => {
|
|
5173
|
-
|
|
5191
|
+
Q({ loading: !0, error: null });
|
|
5174
5192
|
try {
|
|
5175
5193
|
const m = await _o.create(u);
|
|
5176
5194
|
await m.connect();
|
|
5177
5195
|
const f = await m.getPublicKey();
|
|
5178
|
-
|
|
5196
|
+
Q({
|
|
5179
5197
|
signer: m,
|
|
5180
5198
|
signerInfo: { type: "bunker", pubkey: f },
|
|
5181
5199
|
loading: !1
|
|
5182
5200
|
});
|
|
5183
5201
|
} catch (m) {
|
|
5184
|
-
|
|
5202
|
+
Q({
|
|
5185
5203
|
error: m instanceof Error ? m.message : "Login failed",
|
|
5186
5204
|
loading: !1
|
|
5187
5205
|
});
|
|
5188
5206
|
}
|
|
5189
5207
|
}, []), c = _e(() => {
|
|
5190
5208
|
var u;
|
|
5191
|
-
((u = Pe.signerInfo) == null ? void 0 : u.type) === "bunker" && Pe.signer && Pe.signer.close(),
|
|
5209
|
+
((u = Pe.signerInfo) == null ? void 0 : u.type) === "bunker" && Pe.signer && Pe.signer.close(), Q({
|
|
5192
5210
|
signer: null,
|
|
5193
5211
|
signerInfo: null,
|
|
5194
5212
|
error: null
|
|
5195
5213
|
});
|
|
5196
5214
|
}, []), l = _e(() => {
|
|
5197
|
-
|
|
5215
|
+
Q({ error: null });
|
|
5198
5216
|
}, []), d = _e(() => {
|
|
5199
5217
|
var u;
|
|
5200
5218
|
return ((u = Pe.signerInfo) == null ? void 0 : u.type) === "temp" ? Pe.signer : null;
|
|
@@ -5216,7 +5234,7 @@ function Vt() {
|
|
|
5216
5234
|
};
|
|
5217
5235
|
}
|
|
5218
5236
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5219
|
-
function
|
|
5237
|
+
function am(t) {
|
|
5220
5238
|
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
5221
5239
|
}
|
|
5222
5240
|
function Ao(t, e = "") {
|
|
@@ -5226,7 +5244,7 @@ function Ao(t, e = "") {
|
|
|
5226
5244
|
}
|
|
5227
5245
|
}
|
|
5228
5246
|
function ue(t, e, n = "") {
|
|
5229
|
-
const r =
|
|
5247
|
+
const r = am(t), o = t == null ? void 0 : t.length, i = e !== void 0;
|
|
5230
5248
|
if (!r || i && o !== e) {
|
|
5231
5249
|
const s = n && `"${n}" `, a = i ? ` of length ${e}` : "", c = r ? `length=${o}` : `type=${typeof t}`;
|
|
5232
5250
|
throw new Error(s + "expected Uint8Array" + a + ", got " + c);
|
|
@@ -5237,7 +5255,7 @@ function li(t, e = !0) {
|
|
|
5237
5255
|
if (t.destroyed) throw new Error("Hash instance has been destroyed");
|
|
5238
5256
|
if (e && t.finished) throw new Error("Hash#digest() has already been called");
|
|
5239
5257
|
}
|
|
5240
|
-
function
|
|
5258
|
+
function cm(t, e) {
|
|
5241
5259
|
ue(t, void 0, "digestInto() output");
|
|
5242
5260
|
const n = e.outputLen;
|
|
5243
5261
|
if (t.length < n)
|
|
@@ -5253,14 +5271,14 @@ function nr(t) {
|
|
|
5253
5271
|
function ke(t, e) {
|
|
5254
5272
|
return t << 32 - e | t >>> e;
|
|
5255
5273
|
}
|
|
5256
|
-
const Oa = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function",
|
|
5274
|
+
const Oa = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", lm = /* @__PURE__ */ Array.from({
|
|
5257
5275
|
length: 256
|
|
5258
5276
|
}, (t, e) => e.toString(16).padStart(2, "0"));
|
|
5259
5277
|
function ae(t) {
|
|
5260
5278
|
if (ue(t), Oa) return t.toHex();
|
|
5261
5279
|
let e = "";
|
|
5262
5280
|
for (let n = 0; n < t.length; n++)
|
|
5263
|
-
e +=
|
|
5281
|
+
e += lm[t[n]];
|
|
5264
5282
|
return e;
|
|
5265
5283
|
}
|
|
5266
5284
|
const Ie = {
|
|
@@ -5305,7 +5323,7 @@ function mn(...t) {
|
|
|
5305
5323
|
}
|
|
5306
5324
|
return n;
|
|
5307
5325
|
}
|
|
5308
|
-
function
|
|
5326
|
+
function um(t, e = {}) {
|
|
5309
5327
|
const n = (o, i) => t(i).update(o).digest(), r = t(void 0);
|
|
5310
5328
|
return n.outputLen = r.outputLen, n.blockLen = r.blockLen, n.create = (o) => t(o), Object.assign(n, e), Object.freeze(n);
|
|
5311
5329
|
}
|
|
@@ -5314,7 +5332,7 @@ function Ma(t = 32) {
|
|
|
5314
5332
|
if (typeof (e == null ? void 0 : e.getRandomValues) != "function") throw new Error("crypto.getRandomValues must be defined");
|
|
5315
5333
|
return e.getRandomValues(new Uint8Array(t));
|
|
5316
5334
|
}
|
|
5317
|
-
const
|
|
5335
|
+
const dm = (t) => ({
|
|
5318
5336
|
oid: Uint8Array.from([
|
|
5319
5337
|
6,
|
|
5320
5338
|
9,
|
|
@@ -5329,13 +5347,13 @@ const um = (t) => ({
|
|
|
5329
5347
|
t
|
|
5330
5348
|
])
|
|
5331
5349
|
});
|
|
5332
|
-
function
|
|
5350
|
+
function hm(t, e, n) {
|
|
5333
5351
|
return t & e ^ ~t & n;
|
|
5334
5352
|
}
|
|
5335
|
-
function
|
|
5353
|
+
function fm(t, e, n) {
|
|
5336
5354
|
return t & e ^ t & n ^ e & n;
|
|
5337
5355
|
}
|
|
5338
|
-
class
|
|
5356
|
+
class mm {
|
|
5339
5357
|
constructor(e, n, r, o) {
|
|
5340
5358
|
g(this, "blockLen");
|
|
5341
5359
|
g(this, "outputLen");
|
|
@@ -5365,7 +5383,7 @@ class fm {
|
|
|
5365
5383
|
return this.length += e.length, this.roundClean(), this;
|
|
5366
5384
|
}
|
|
5367
5385
|
digestInto(e) {
|
|
5368
|
-
li(this),
|
|
5386
|
+
li(this), cm(e, this), this.finished = !0;
|
|
5369
5387
|
const { buffer: n, view: r, blockLen: o, isLE: i } = this;
|
|
5370
5388
|
let { pos: s } = this;
|
|
5371
5389
|
n[s++] = 128, Lr(this.buffer.subarray(s)), this.padOffset > o - s && (this.process(r, 0), s = 0);
|
|
@@ -5401,7 +5419,7 @@ const Fe = /* @__PURE__ */ Uint32Array.from([
|
|
|
5401
5419
|
2600822924,
|
|
5402
5420
|
528734635,
|
|
5403
5421
|
1541459225
|
|
5404
|
-
]),
|
|
5422
|
+
]), pm = /* @__PURE__ */ Uint32Array.from([
|
|
5405
5423
|
1116352408,
|
|
5406
5424
|
1899447441,
|
|
5407
5425
|
3049323471,
|
|
@@ -5467,7 +5485,7 @@ const Fe = /* @__PURE__ */ Uint32Array.from([
|
|
|
5467
5485
|
3204031479,
|
|
5468
5486
|
3329325298
|
|
5469
5487
|
]), We = /* @__PURE__ */ new Uint32Array(64);
|
|
5470
|
-
class
|
|
5488
|
+
class gm extends mm {
|
|
5471
5489
|
constructor(e) {
|
|
5472
5490
|
super(64, e, 8, !1);
|
|
5473
5491
|
}
|
|
@@ -5496,7 +5514,7 @@ class pm extends fm {
|
|
|
5496
5514
|
}
|
|
5497
5515
|
let { A: r, B: o, C: i, D: s, E: a, F: c, G: l, H: d } = this;
|
|
5498
5516
|
for (let u = 0; u < 64; u++) {
|
|
5499
|
-
const m = ke(a, 6) ^ ke(a, 11) ^ ke(a, 25), f = d + m +
|
|
5517
|
+
const m = ke(a, 6) ^ ke(a, 11) ^ ke(a, 25), f = d + m + hm(a, c, l) + pm[u] + We[u] | 0, h = (ke(r, 2) ^ ke(r, 13) ^ ke(r, 22)) + fm(r, o, i) | 0;
|
|
5500
5518
|
d = l, l = c, c = a, a = s + f | 0, s = i, i = o, o = r, r = f + h | 0;
|
|
5501
5519
|
}
|
|
5502
5520
|
r = r + this.A | 0, o = o + this.B | 0, i = i + this.C | 0, s = s + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, d = d + this.H | 0, this.set(r, o, i, s, a, c, l, d);
|
|
@@ -5508,7 +5526,7 @@ class pm extends fm {
|
|
|
5508
5526
|
this.set(0, 0, 0, 0, 0, 0, 0, 0), Lr(this.buffer);
|
|
5509
5527
|
}
|
|
5510
5528
|
}
|
|
5511
|
-
class
|
|
5529
|
+
class ym extends gm {
|
|
5512
5530
|
constructor() {
|
|
5513
5531
|
super(32);
|
|
5514
5532
|
// We cannot use array here since array allows indexing by variable
|
|
@@ -5523,7 +5541,7 @@ class gm extends pm {
|
|
|
5523
5541
|
g(this, "H", Fe[7] | 0);
|
|
5524
5542
|
}
|
|
5525
5543
|
}
|
|
5526
|
-
const Ir = /* @__PURE__ */
|
|
5544
|
+
const Ir = /* @__PURE__ */ um(() => new ym(), /* @__PURE__ */ dm(1)), So = /* @__PURE__ */ BigInt(0), $r = /* @__PURE__ */ BigInt(1);
|
|
5527
5545
|
function di(t, e = "") {
|
|
5528
5546
|
if (typeof t != "boolean") {
|
|
5529
5547
|
const n = e && `"${e}" `;
|
|
@@ -5531,9 +5549,9 @@ function di(t, e = "") {
|
|
|
5531
5549
|
}
|
|
5532
5550
|
return t;
|
|
5533
5551
|
}
|
|
5534
|
-
function
|
|
5552
|
+
function bm(t) {
|
|
5535
5553
|
if (typeof t == "bigint") {
|
|
5536
|
-
if (!
|
|
5554
|
+
if (!vm(t)) throw new Error("positive bigint expected, got " + t);
|
|
5537
5555
|
} else Ao(t);
|
|
5538
5556
|
return t;
|
|
5539
5557
|
}
|
|
@@ -5545,10 +5563,10 @@ function No(t) {
|
|
|
5545
5563
|
return Da(ae(t));
|
|
5546
5564
|
}
|
|
5547
5565
|
function Ka(t) {
|
|
5548
|
-
return Da(ae(
|
|
5566
|
+
return Da(ae(wm(ue(t)).reverse()));
|
|
5549
5567
|
}
|
|
5550
5568
|
function Co(t, e) {
|
|
5551
|
-
Ao(e), t =
|
|
5569
|
+
Ao(e), t = bm(t);
|
|
5552
5570
|
const n = st(t.toString(16).padStart(e * 2, "0"));
|
|
5553
5571
|
if (n.length !== e) throw new Error("number too large");
|
|
5554
5572
|
return n;
|
|
@@ -5556,7 +5574,7 @@ function Co(t, e) {
|
|
|
5556
5574
|
function Ha(t, e) {
|
|
5557
5575
|
return Co(t, e).reverse();
|
|
5558
5576
|
}
|
|
5559
|
-
function
|
|
5577
|
+
function wm(t) {
|
|
5560
5578
|
return Uint8Array.from(t);
|
|
5561
5579
|
}
|
|
5562
5580
|
function za(t) {
|
|
@@ -5567,8 +5585,8 @@ function za(t) {
|
|
|
5567
5585
|
return r;
|
|
5568
5586
|
});
|
|
5569
5587
|
}
|
|
5570
|
-
const
|
|
5571
|
-
function
|
|
5588
|
+
const vm = (t) => typeof t == "bigint" && So <= t;
|
|
5589
|
+
function xm(t) {
|
|
5572
5590
|
let e;
|
|
5573
5591
|
for (e = 0; t > So; t >>= $r, e += 1) ;
|
|
5574
5592
|
return e;
|
|
@@ -5594,7 +5612,7 @@ function hi(t) {
|
|
|
5594
5612
|
return e.set(n, i), i;
|
|
5595
5613
|
};
|
|
5596
5614
|
}
|
|
5597
|
-
const ce = /* @__PURE__ */ BigInt(0), ie = /* @__PURE__ */ BigInt(1), at = /* @__PURE__ */ BigInt(2), ja = /* @__PURE__ */ BigInt(3), Fa = /* @__PURE__ */ BigInt(4), Wa = /* @__PURE__ */ BigInt(5),
|
|
5615
|
+
const ce = /* @__PURE__ */ BigInt(0), ie = /* @__PURE__ */ BigInt(1), at = /* @__PURE__ */ BigInt(2), ja = /* @__PURE__ */ BigInt(3), Fa = /* @__PURE__ */ BigInt(4), Wa = /* @__PURE__ */ BigInt(5), Em = /* @__PURE__ */ BigInt(7), Za = /* @__PURE__ */ BigInt(8), km = /* @__PURE__ */ BigInt(9), Ja = /* @__PURE__ */ BigInt(16);
|
|
5598
5616
|
function ge(t, e) {
|
|
5599
5617
|
const n = t % e;
|
|
5600
5618
|
return n >= ce ? n : e + n;
|
|
@@ -5623,12 +5641,12 @@ function Ga(t, e) {
|
|
|
5623
5641
|
const n = (t.ORDER + ie) / Fa, r = t.pow(e, n);
|
|
5624
5642
|
return Bo(t, r, e), r;
|
|
5625
5643
|
}
|
|
5626
|
-
function
|
|
5644
|
+
function _m(t, e) {
|
|
5627
5645
|
const n = (t.ORDER - Wa) / Za, r = t.mul(e, at), o = t.pow(r, n), i = t.mul(e, o), s = t.mul(t.mul(i, at), o), a = t.mul(i, t.sub(s, t.ONE));
|
|
5628
5646
|
return Bo(t, a, e), a;
|
|
5629
5647
|
}
|
|
5630
|
-
function
|
|
5631
|
-
const e = Pn(t), n = Ya(t), r = n(e, e.neg(e.ONE)), o = n(e, r), i = n(e, e.neg(r)), s = (t +
|
|
5648
|
+
function Am(t) {
|
|
5649
|
+
const e = Pn(t), n = Ya(t), r = n(e, e.neg(e.ONE)), o = n(e, r), i = n(e, e.neg(r)), s = (t + Em) / Ja;
|
|
5632
5650
|
return (a, c) => {
|
|
5633
5651
|
let l = a.pow(c, s), d = a.mul(l, r);
|
|
5634
5652
|
const u = a.mul(l, o), m = a.mul(l, i), f = a.eql(a.sqr(d), c), p = a.eql(a.sqr(u), c);
|
|
@@ -5664,10 +5682,10 @@ function Ya(t) {
|
|
|
5664
5682
|
return f;
|
|
5665
5683
|
};
|
|
5666
5684
|
}
|
|
5667
|
-
function
|
|
5668
|
-
return t % Fa === ja ? Ga : t % Za === Wa ?
|
|
5685
|
+
function Sm(t) {
|
|
5686
|
+
return t % Fa === ja ? Ga : t % Za === Wa ? _m : t % Ja === km ? Am(t) : Ya(t);
|
|
5669
5687
|
}
|
|
5670
|
-
const
|
|
5688
|
+
const Nm = [
|
|
5671
5689
|
"create",
|
|
5672
5690
|
"isValid",
|
|
5673
5691
|
"is0",
|
|
@@ -5686,15 +5704,15 @@ const Sm = [
|
|
|
5686
5704
|
"mulN",
|
|
5687
5705
|
"sqrN"
|
|
5688
5706
|
];
|
|
5689
|
-
function
|
|
5707
|
+
function Cm(t) {
|
|
5690
5708
|
const e = {
|
|
5691
5709
|
ORDER: "bigint",
|
|
5692
5710
|
BYTES: "number",
|
|
5693
5711
|
BITS: "number"
|
|
5694
|
-
}, n =
|
|
5712
|
+
}, n = Nm.reduce((r, o) => (r[o] = "function", r), e);
|
|
5695
5713
|
return Va(t, n), t;
|
|
5696
5714
|
}
|
|
5697
|
-
function
|
|
5715
|
+
function Bm(t, e, n) {
|
|
5698
5716
|
if (n < ce) throw new Error("invalid exponent, negatives unsupported");
|
|
5699
5717
|
if (n === ce) return t.ONE;
|
|
5700
5718
|
if (n === ie) return e;
|
|
@@ -5712,7 +5730,7 @@ function mi(t, e) {
|
|
|
5712
5730
|
if (!o && !i && !s) throw new Error("invalid Legendre symbol result");
|
|
5713
5731
|
return o ? 1 : i ? 0 : -1;
|
|
5714
5732
|
}
|
|
5715
|
-
function
|
|
5733
|
+
function Lm(t, e) {
|
|
5716
5734
|
e !== void 0 && Ao(e);
|
|
5717
5735
|
const n = e !== void 0 ? e : t.toString(2).length, r = Math.ceil(n / 8);
|
|
5718
5736
|
return {
|
|
@@ -5720,7 +5738,7 @@ function Bm(t, e) {
|
|
|
5720
5738
|
nByteLength: r
|
|
5721
5739
|
};
|
|
5722
5740
|
}
|
|
5723
|
-
class
|
|
5741
|
+
class Im {
|
|
5724
5742
|
constructor(e, n = {}) {
|
|
5725
5743
|
g(this, "ORDER");
|
|
5726
5744
|
g(this, "BITS");
|
|
@@ -5735,7 +5753,7 @@ class Lm {
|
|
|
5735
5753
|
if (e <= ce) throw new Error("invalid field: expected ORDER > 0, got " + e);
|
|
5736
5754
|
let r;
|
|
5737
5755
|
this.isLE = !1, n != null && typeof n == "object" && (typeof n.BITS == "number" && (r = n.BITS), typeof n.sqrt == "function" && (this.sqrt = n.sqrt), typeof n.isLE == "boolean" && (this.isLE = n.isLE), n.allowedLengths && (this._lengths = (s = n.allowedLengths) == null ? void 0 : s.slice()), typeof n.modFromBytes == "boolean" && (this._mod = n.modFromBytes));
|
|
5738
|
-
const { nBitLength: o, nByteLength: i } =
|
|
5756
|
+
const { nBitLength: o, nByteLength: i } = Lm(e, r);
|
|
5739
5757
|
if (i > 2048) throw new Error("invalid field: expected ORDER of <= 2048 bytes");
|
|
5740
5758
|
this.ORDER = e, this.BITS = o, this.BYTES = i, this._sqrt = void 0, Object.preventExtensions(this);
|
|
5741
5759
|
}
|
|
@@ -5775,7 +5793,7 @@ class Lm {
|
|
|
5775
5793
|
return ge(e * n, this.ORDER);
|
|
5776
5794
|
}
|
|
5777
5795
|
pow(e, n) {
|
|
5778
|
-
return
|
|
5796
|
+
return Bm(this, e, n);
|
|
5779
5797
|
}
|
|
5780
5798
|
div(e, n) {
|
|
5781
5799
|
return ge(e * fi(n, this.ORDER), this.ORDER);
|
|
@@ -5797,7 +5815,7 @@ class Lm {
|
|
|
5797
5815
|
return fi(e, this.ORDER);
|
|
5798
5816
|
}
|
|
5799
5817
|
sqrt(e) {
|
|
5800
|
-
return this._sqrt || (this._sqrt =
|
|
5818
|
+
return this._sqrt || (this._sqrt = Sm(this.ORDER)), this._sqrt(this, e);
|
|
5801
5819
|
}
|
|
5802
5820
|
toBytes(e) {
|
|
5803
5821
|
return this.isLE ? Ha(e, this.BYTES) : Co(e, this.BYTES);
|
|
@@ -5828,20 +5846,20 @@ class Lm {
|
|
|
5828
5846
|
}
|
|
5829
5847
|
}
|
|
5830
5848
|
function Pn(t, e = {}) {
|
|
5831
|
-
return new
|
|
5849
|
+
return new Im(t, e);
|
|
5832
5850
|
}
|
|
5833
5851
|
function Qa(t) {
|
|
5834
5852
|
if (typeof t != "bigint") throw new Error("field order must be bigint");
|
|
5835
5853
|
const e = t.toString(2).length;
|
|
5836
5854
|
return Math.ceil(e / 8);
|
|
5837
5855
|
}
|
|
5838
|
-
function
|
|
5856
|
+
function $m(t) {
|
|
5839
5857
|
const e = Qa(t);
|
|
5840
5858
|
return e + Math.ceil(e / 2);
|
|
5841
5859
|
}
|
|
5842
|
-
function
|
|
5860
|
+
function Rm(t, e, n = !1) {
|
|
5843
5861
|
ue(t);
|
|
5844
|
-
const r = t.length, o = Qa(e), i =
|
|
5862
|
+
const r = t.length, o = Qa(e), i = $m(e);
|
|
5845
5863
|
if (r < 16 || r < i || r > 1024) throw new Error("expected " + i + "-1024 bytes of input, got " + r);
|
|
5846
5864
|
const s = n ? Ka(t) : No(t), a = ge(s, e - ie) + ie;
|
|
5847
5865
|
return n ? Ha(a, o) : Co(a, o);
|
|
@@ -5890,7 +5908,7 @@ function ir(t) {
|
|
|
5890
5908
|
function yi(t) {
|
|
5891
5909
|
if (t !== St) throw new Error("invalid wNAF");
|
|
5892
5910
|
}
|
|
5893
|
-
class
|
|
5911
|
+
class Tm {
|
|
5894
5912
|
// Parametrized with a given Point class (not individual point)
|
|
5895
5913
|
constructor(e, n) {
|
|
5896
5914
|
g(this, "BASE");
|
|
@@ -5986,7 +6004,7 @@ class Rm {
|
|
|
5986
6004
|
return ir(e) !== 1;
|
|
5987
6005
|
}
|
|
5988
6006
|
}
|
|
5989
|
-
function
|
|
6007
|
+
function Pm(t, e, n, r) {
|
|
5990
6008
|
let o = e, i = t.ZERO, s = t.ZERO;
|
|
5991
6009
|
for (; n > St || r > St; )
|
|
5992
6010
|
n & ct && (i = i.add(o)), r & ct && (s = s.add(o)), o = o.double(), n >>= ct, r >>= ct;
|
|
@@ -5998,13 +6016,13 @@ function Tm(t, e, n, r) {
|
|
|
5998
6016
|
function bi(t, e, n) {
|
|
5999
6017
|
if (e) {
|
|
6000
6018
|
if (e.ORDER !== t) throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
|
|
6001
|
-
return
|
|
6019
|
+
return Cm(e), e;
|
|
6002
6020
|
} else
|
|
6003
6021
|
return Pn(t, {
|
|
6004
6022
|
isLE: n
|
|
6005
6023
|
});
|
|
6006
6024
|
}
|
|
6007
|
-
function
|
|
6025
|
+
function Um(t, e, n = {}, r) {
|
|
6008
6026
|
if (r === void 0 && (r = t === "edwards"), !e || typeof e != "object") throw new Error(`expected valid ${t} CURVE object`);
|
|
6009
6027
|
for (const c of [
|
|
6010
6028
|
"p",
|
|
@@ -6028,7 +6046,7 @@ function Pm(t, e, n = {}, r) {
|
|
|
6028
6046
|
Fn: i
|
|
6029
6047
|
};
|
|
6030
6048
|
}
|
|
6031
|
-
function
|
|
6049
|
+
function Om(t, e) {
|
|
6032
6050
|
return function(r) {
|
|
6033
6051
|
const o = t(r);
|
|
6034
6052
|
return {
|
|
@@ -6038,13 +6056,13 @@ function Um(t, e) {
|
|
|
6038
6056
|
};
|
|
6039
6057
|
}
|
|
6040
6058
|
za("HashToScalar-");
|
|
6041
|
-
const wi = (t, e) => (t + (t >= 0 ? e : -e) /
|
|
6042
|
-
function
|
|
6059
|
+
const wi = (t, e) => (t + (t >= 0 ? e : -e) / Dm) / e;
|
|
6060
|
+
function Mm(t, e, n) {
|
|
6043
6061
|
const [[r, o], [i, s]] = e, a = wi(s * t, n), c = wi(-o * t, n);
|
|
6044
6062
|
let l = t - a * r - c * i, d = -a * o - c * s;
|
|
6045
6063
|
const u = l < Pt, m = d < Pt;
|
|
6046
6064
|
u && (l = -l), m && (d = -d);
|
|
6047
|
-
const f = qa(Math.ceil(
|
|
6065
|
+
const f = qa(Math.ceil(xm(n) / 2)) + on;
|
|
6048
6066
|
if (l < Pt || l >= f || d < Pt || d >= f)
|
|
6049
6067
|
throw new Error("splitScalar (endomorphism): failed, k=" + t);
|
|
6050
6068
|
return {
|
|
@@ -6054,9 +6072,9 @@ function Om(t, e, n) {
|
|
|
6054
6072
|
k2: d
|
|
6055
6073
|
};
|
|
6056
6074
|
}
|
|
6057
|
-
const Pt = BigInt(0), on = BigInt(1),
|
|
6058
|
-
function
|
|
6059
|
-
const n =
|
|
6075
|
+
const Pt = BigInt(0), on = BigInt(1), Dm = BigInt(2), Jt = BigInt(3), Km = BigInt(4);
|
|
6076
|
+
function Hm(t, e = {}) {
|
|
6077
|
+
const n = Um("weierstrass", t, e), { Fp: r, Fn: o } = n;
|
|
6060
6078
|
let i = n.CURVE;
|
|
6061
6079
|
const { h: s, n: a } = i;
|
|
6062
6080
|
Va(e, {}, {
|
|
@@ -6070,22 +6088,22 @@ function Km(t, e = {}) {
|
|
|
6070
6088
|
const { endo: c } = e;
|
|
6071
6089
|
if (c && (!r.is0(i.a) || typeof c.beta != "bigint" || !Array.isArray(c.basises)))
|
|
6072
6090
|
throw new Error('invalid endo: expected "beta": bigint and "basises": array');
|
|
6073
|
-
const l =
|
|
6091
|
+
const l = qm(r, o);
|
|
6074
6092
|
function d() {
|
|
6075
6093
|
if (!r.isOdd) throw new Error("compression is not supported: Field does not have .isOdd()");
|
|
6076
6094
|
}
|
|
6077
|
-
function u(
|
|
6095
|
+
function u(U, k, b) {
|
|
6078
6096
|
const { x: v, y: A } = k.toAffine(), I = r.toBytes(v);
|
|
6079
6097
|
if (di(b, "isCompressed"), b) {
|
|
6080
6098
|
d();
|
|
6081
6099
|
const C = !r.isOdd(A);
|
|
6082
|
-
return mn(
|
|
6100
|
+
return mn(zm(C), I);
|
|
6083
6101
|
} else
|
|
6084
6102
|
return mn(Uint8Array.of(4), I, r.toBytes(A));
|
|
6085
6103
|
}
|
|
6086
|
-
function m(
|
|
6087
|
-
ue(
|
|
6088
|
-
const { publicKey: k, publicKeyUncompressed: b } = l, v =
|
|
6104
|
+
function m(U) {
|
|
6105
|
+
ue(U, void 0, "Point");
|
|
6106
|
+
const { publicKey: k, publicKeyUncompressed: b } = l, v = U.length, A = U[0], I = U.subarray(1);
|
|
6089
6107
|
if (v === k && (A === 2 || A === 3)) {
|
|
6090
6108
|
const C = r.fromBytes(I);
|
|
6091
6109
|
if (!r.isValid(C)) throw new Error("bad point: is not on curve, wrong x");
|
|
@@ -6098,8 +6116,8 @@ function Km(t, e = {}) {
|
|
|
6098
6116
|
throw new Error("bad point: is not on curve, sqrt error" + F);
|
|
6099
6117
|
}
|
|
6100
6118
|
d();
|
|
6101
|
-
const
|
|
6102
|
-
return (A & 1) === 1 !==
|
|
6119
|
+
const R = r.isOdd(B);
|
|
6120
|
+
return (A & 1) === 1 !== R && (B = r.neg(B)), {
|
|
6103
6121
|
x: C,
|
|
6104
6122
|
y: B
|
|
6105
6123
|
};
|
|
@@ -6114,35 +6132,35 @@ function Km(t, e = {}) {
|
|
|
6114
6132
|
throw new Error(`bad point: got length ${v}, expected compressed=${k} or uncompressed=${b}`);
|
|
6115
6133
|
}
|
|
6116
6134
|
const f = e.toBytes || u, p = e.fromBytes || m;
|
|
6117
|
-
function h(
|
|
6118
|
-
const k = r.sqr(
|
|
6119
|
-
return r.add(r.add(b, r.mul(
|
|
6135
|
+
function h(U) {
|
|
6136
|
+
const k = r.sqr(U), b = r.mul(k, U);
|
|
6137
|
+
return r.add(r.add(b, r.mul(U, i.a)), i.b);
|
|
6120
6138
|
}
|
|
6121
|
-
function y(
|
|
6122
|
-
const b = r.sqr(k), v = h(
|
|
6139
|
+
function y(U, k) {
|
|
6140
|
+
const b = r.sqr(k), v = h(U);
|
|
6123
6141
|
return r.eql(b, v);
|
|
6124
6142
|
}
|
|
6125
6143
|
if (!y(i.Gx, i.Gy)) throw new Error("bad curve params: generator point");
|
|
6126
|
-
const w = r.mul(r.pow(i.a, Jt),
|
|
6144
|
+
const w = r.mul(r.pow(i.a, Jt), Km), E = r.mul(r.sqr(i.b), BigInt(27));
|
|
6127
6145
|
if (r.is0(r.add(w, E))) throw new Error("bad curve params: a or b");
|
|
6128
|
-
function S(
|
|
6129
|
-
if (!r.isValid(k) || b && r.is0(k)) throw new Error(`bad point coordinate ${
|
|
6146
|
+
function S(U, k, b = !1) {
|
|
6147
|
+
if (!r.isValid(k) || b && r.is0(k)) throw new Error(`bad point coordinate ${U}`);
|
|
6130
6148
|
return k;
|
|
6131
6149
|
}
|
|
6132
|
-
function
|
|
6133
|
-
if (!(
|
|
6150
|
+
function O(U) {
|
|
6151
|
+
if (!(U instanceof K)) throw new Error("Weierstrass Point expected");
|
|
6134
6152
|
}
|
|
6135
|
-
function
|
|
6153
|
+
function M(U) {
|
|
6136
6154
|
if (!c || !c.basises) throw new Error("no endo");
|
|
6137
|
-
return
|
|
6155
|
+
return Mm(U, c.basises, o.ORDER);
|
|
6138
6156
|
}
|
|
6139
|
-
const _ = hi((
|
|
6140
|
-
const { X: b, Y: v, Z: A } =
|
|
6157
|
+
const _ = hi((U, k) => {
|
|
6158
|
+
const { X: b, Y: v, Z: A } = U;
|
|
6141
6159
|
if (r.eql(A, r.ONE)) return {
|
|
6142
6160
|
x: b,
|
|
6143
6161
|
y: v
|
|
6144
6162
|
};
|
|
6145
|
-
const I =
|
|
6163
|
+
const I = U.is0();
|
|
6146
6164
|
k == null && (k = I ? r.ONE : r.inv(A));
|
|
6147
6165
|
const C = r.mul(b, k), $ = r.mul(v, k), B = r.mul(A, k);
|
|
6148
6166
|
if (I) return {
|
|
@@ -6154,21 +6172,21 @@ function Km(t, e = {}) {
|
|
|
6154
6172
|
x: C,
|
|
6155
6173
|
y: $
|
|
6156
6174
|
};
|
|
6157
|
-
}), N = hi((
|
|
6158
|
-
if (
|
|
6159
|
-
if (e.allowInfinityPoint && !r.is0(
|
|
6175
|
+
}), N = hi((U) => {
|
|
6176
|
+
if (U.is0()) {
|
|
6177
|
+
if (e.allowInfinityPoint && !r.is0(U.Y)) return;
|
|
6160
6178
|
throw new Error("bad point: ZERO");
|
|
6161
6179
|
}
|
|
6162
|
-
const { x: k, y: b } =
|
|
6180
|
+
const { x: k, y: b } = U.toAffine();
|
|
6163
6181
|
if (!r.isValid(k) || !r.isValid(b)) throw new Error("bad point: x or y not field elements");
|
|
6164
6182
|
if (!y(k, b)) throw new Error("bad point: equation left != right");
|
|
6165
|
-
if (!
|
|
6183
|
+
if (!U.isTorsionFree()) throw new Error("bad point: not in prime-order subgroup");
|
|
6166
6184
|
return !0;
|
|
6167
6185
|
});
|
|
6168
|
-
function L(
|
|
6169
|
-
return b = new K(r.mul(b.X,
|
|
6186
|
+
function L(U, k, b, v, A) {
|
|
6187
|
+
return b = new K(r.mul(b.X, U), b.Y, b.Z), k = pn(v, k), b = pn(A, b), k.add(b);
|
|
6170
6188
|
}
|
|
6171
|
-
const
|
|
6189
|
+
const D = class D {
|
|
6172
6190
|
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
6173
6191
|
constructor(k, b, v) {
|
|
6174
6192
|
g(this, "X");
|
|
@@ -6183,15 +6201,15 @@ function Km(t, e = {}) {
|
|
|
6183
6201
|
static fromAffine(k) {
|
|
6184
6202
|
const { x: b, y: v } = k || {};
|
|
6185
6203
|
if (!k || !r.isValid(b) || !r.isValid(v)) throw new Error("invalid affine point");
|
|
6186
|
-
if (k instanceof
|
|
6187
|
-
return r.is0(b) && r.is0(v) ?
|
|
6204
|
+
if (k instanceof D) throw new Error("projective point not allowed");
|
|
6205
|
+
return r.is0(b) && r.is0(v) ? D.ZERO : new D(b, v, r.ONE);
|
|
6188
6206
|
}
|
|
6189
6207
|
static fromBytes(k) {
|
|
6190
|
-
const b =
|
|
6208
|
+
const b = D.fromAffine(p(ue(k, void 0, "point")));
|
|
6191
6209
|
return b.assertValidity(), b;
|
|
6192
6210
|
}
|
|
6193
6211
|
static fromHex(k) {
|
|
6194
|
-
return
|
|
6212
|
+
return D.fromBytes(st(k));
|
|
6195
6213
|
}
|
|
6196
6214
|
get x() {
|
|
6197
6215
|
return this.toAffine().x;
|
|
@@ -6206,7 +6224,7 @@ function Km(t, e = {}) {
|
|
|
6206
6224
|
* @returns
|
|
6207
6225
|
*/
|
|
6208
6226
|
precompute(k = 8, b = !0) {
|
|
6209
|
-
return
|
|
6227
|
+
return P.createCache(this, k), b || this.multiply(Jt), this;
|
|
6210
6228
|
}
|
|
6211
6229
|
// TODO: return `this`
|
|
6212
6230
|
/** A point on curve is valid if it conforms to equation. */
|
|
@@ -6220,13 +6238,13 @@ function Km(t, e = {}) {
|
|
|
6220
6238
|
}
|
|
6221
6239
|
/** Compare one point to another. */
|
|
6222
6240
|
equals(k) {
|
|
6223
|
-
|
|
6224
|
-
const { X: b, Y: v, Z: A } = this, { X: I, Y: C, Z: $ } = k, B = r.eql(r.mul(b, $), r.mul(I, A)),
|
|
6225
|
-
return B &&
|
|
6241
|
+
O(k);
|
|
6242
|
+
const { X: b, Y: v, Z: A } = this, { X: I, Y: C, Z: $ } = k, B = r.eql(r.mul(b, $), r.mul(I, A)), R = r.eql(r.mul(v, $), r.mul(C, A));
|
|
6243
|
+
return B && R;
|
|
6226
6244
|
}
|
|
6227
6245
|
/** Flips point to one corresponding to (x, -y) in Affine coordinates. */
|
|
6228
6246
|
negate() {
|
|
6229
|
-
return new
|
|
6247
|
+
return new D(this.X, r.neg(this.Y), this.Z);
|
|
6230
6248
|
}
|
|
6231
6249
|
// Renes-Costello-Batina exception-free doubling formula.
|
|
6232
6250
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
@@ -6234,28 +6252,28 @@ function Km(t, e = {}) {
|
|
|
6234
6252
|
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
6235
6253
|
double() {
|
|
6236
6254
|
const { a: k, b } = i, v = r.mul(b, Jt), { X: A, Y: I, Z: C } = this;
|
|
6237
|
-
let $ = r.ZERO, B = r.ZERO,
|
|
6238
|
-
return V = r.add(V, V),
|
|
6255
|
+
let $ = r.ZERO, B = r.ZERO, R = r.ZERO, z = r.mul(A, A), q = r.mul(I, I), F = r.mul(C, C), V = r.mul(A, I);
|
|
6256
|
+
return V = r.add(V, V), R = r.mul(A, C), R = r.add(R, R), $ = r.mul(k, R), B = r.mul(v, F), B = r.add($, B), $ = r.sub(q, B), B = r.add(q, B), B = r.mul($, B), $ = r.mul(V, $), R = r.mul(v, R), F = r.mul(k, F), V = r.sub(z, F), V = r.mul(k, V), V = r.add(V, R), R = r.add(z, z), z = r.add(R, z), z = r.add(z, F), z = r.mul(z, V), B = r.add(B, z), F = r.mul(I, C), F = r.add(F, F), z = r.mul(F, V), $ = r.sub($, z), R = r.mul(F, q), R = r.add(R, R), R = r.add(R, R), new D($, B, R);
|
|
6239
6257
|
}
|
|
6240
6258
|
// Renes-Costello-Batina exception-free addition formula.
|
|
6241
6259
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
6242
6260
|
// https://eprint.iacr.org/2015/1060, algorithm 1
|
|
6243
6261
|
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
6244
6262
|
add(k) {
|
|
6245
|
-
|
|
6263
|
+
O(k);
|
|
6246
6264
|
const { X: b, Y: v, Z: A } = this, { X: I, Y: C, Z: $ } = k;
|
|
6247
|
-
let B = r.ZERO,
|
|
6265
|
+
let B = r.ZERO, R = r.ZERO, z = r.ZERO;
|
|
6248
6266
|
const q = i.a, F = r.mul(i.b, Jt);
|
|
6249
|
-
let V = r.mul(b, I), G = r.mul(v, C),
|
|
6267
|
+
let V = r.mul(b, I), G = r.mul(v, C), oe = r.mul(A, $), se = r.add(b, v), Z = r.add(I, C);
|
|
6250
6268
|
se = r.mul(se, Z), Z = r.add(V, G), se = r.sub(se, Z), Z = r.add(b, A);
|
|
6251
6269
|
let de = r.add(I, $);
|
|
6252
|
-
return Z = r.mul(Z, de), de = r.add(V,
|
|
6270
|
+
return Z = r.mul(Z, de), de = r.add(V, oe), Z = r.sub(Z, de), de = r.add(v, A), B = r.add(C, $), de = r.mul(de, B), B = r.add(G, oe), de = r.sub(de, B), z = r.mul(q, Z), B = r.mul(F, oe), z = r.add(B, z), B = r.sub(G, z), z = r.add(G, z), R = r.mul(B, z), G = r.add(V, V), G = r.add(G, V), oe = r.mul(q, oe), Z = r.mul(F, Z), G = r.add(G, oe), oe = r.sub(V, oe), oe = r.mul(q, oe), Z = r.add(Z, oe), V = r.mul(G, Z), R = r.add(R, V), V = r.mul(de, Z), B = r.mul(se, B), B = r.sub(B, V), V = r.mul(se, G), z = r.mul(de, z), z = r.add(z, V), new D(B, R, z);
|
|
6253
6271
|
}
|
|
6254
6272
|
subtract(k) {
|
|
6255
6273
|
return this.add(k.negate());
|
|
6256
6274
|
}
|
|
6257
6275
|
is0() {
|
|
6258
|
-
return this.equals(
|
|
6276
|
+
return this.equals(D.ZERO);
|
|
6259
6277
|
}
|
|
6260
6278
|
/**
|
|
6261
6279
|
* Constant time multiplication.
|
|
@@ -6270,15 +6288,15 @@ function Km(t, e = {}) {
|
|
|
6270
6288
|
const { endo: b } = e;
|
|
6271
6289
|
if (!o.isValidNot0(k)) throw new Error("invalid scalar: out of range");
|
|
6272
6290
|
let v, A;
|
|
6273
|
-
const I = (C) =>
|
|
6291
|
+
const I = (C) => P.cached(this, C, ($) => pi(D, $));
|
|
6274
6292
|
if (b) {
|
|
6275
|
-
const { k1neg: C, k1: $, k2neg: B, k2:
|
|
6293
|
+
const { k1neg: C, k1: $, k2neg: B, k2: R } = M(k), { p: z, f: q } = I($), { p: F, f: V } = I(R);
|
|
6276
6294
|
A = q.add(V), v = L(b.beta, z, F, C, B);
|
|
6277
6295
|
} else {
|
|
6278
6296
|
const { p: C, f: $ } = I(k);
|
|
6279
6297
|
v = C, A = $;
|
|
6280
6298
|
}
|
|
6281
|
-
return pi(
|
|
6299
|
+
return pi(D, [
|
|
6282
6300
|
v,
|
|
6283
6301
|
A
|
|
6284
6302
|
])[0];
|
|
@@ -6291,14 +6309,14 @@ function Km(t, e = {}) {
|
|
|
6291
6309
|
multiplyUnsafe(k) {
|
|
6292
6310
|
const { endo: b } = e, v = this;
|
|
6293
6311
|
if (!o.isValid(k)) throw new Error("invalid scalar: out of range");
|
|
6294
|
-
if (k === Pt || v.is0()) return
|
|
6312
|
+
if (k === Pt || v.is0()) return D.ZERO;
|
|
6295
6313
|
if (k === on) return v;
|
|
6296
|
-
if (
|
|
6314
|
+
if (P.hasCache(this)) return this.multiply(k);
|
|
6297
6315
|
if (b) {
|
|
6298
|
-
const { k1neg: A, k1: I, k2neg: C, k2: $ } =
|
|
6299
|
-
return L(b.beta, B,
|
|
6316
|
+
const { k1neg: A, k1: I, k2neg: C, k2: $ } = M(k), { p1: B, p2: R } = Pm(D, v, I, $);
|
|
6317
|
+
return L(b.beta, B, R, A, C);
|
|
6300
6318
|
} else
|
|
6301
|
-
return
|
|
6319
|
+
return P.unsafe(v, k);
|
|
6302
6320
|
}
|
|
6303
6321
|
/**
|
|
6304
6322
|
* Converts Projective point to affine (x, y) coordinates.
|
|
@@ -6313,17 +6331,17 @@ function Km(t, e = {}) {
|
|
|
6313
6331
|
*/
|
|
6314
6332
|
isTorsionFree() {
|
|
6315
6333
|
const { isTorsionFree: k } = e;
|
|
6316
|
-
return s === on ? !0 : k ? k(
|
|
6334
|
+
return s === on ? !0 : k ? k(D, this) : P.unsafe(this, a).is0();
|
|
6317
6335
|
}
|
|
6318
6336
|
clearCofactor() {
|
|
6319
6337
|
const { clearCofactor: k } = e;
|
|
6320
|
-
return s === on ? this : k ? k(
|
|
6338
|
+
return s === on ? this : k ? k(D, this) : this.multiplyUnsafe(s);
|
|
6321
6339
|
}
|
|
6322
6340
|
isSmallOrder() {
|
|
6323
6341
|
return this.multiplyUnsafe(s).is0();
|
|
6324
6342
|
}
|
|
6325
6343
|
toBytes(k = !0) {
|
|
6326
|
-
return di(k, "isCompressed"), this.assertValidity(), f(
|
|
6344
|
+
return di(k, "isCompressed"), this.assertValidity(), f(D, this, k);
|
|
6327
6345
|
}
|
|
6328
6346
|
toHex(k = !0) {
|
|
6329
6347
|
return ae(this.toBytes(k));
|
|
@@ -6333,18 +6351,18 @@ function Km(t, e = {}) {
|
|
|
6333
6351
|
}
|
|
6334
6352
|
};
|
|
6335
6353
|
// base / generator point
|
|
6336
|
-
g(
|
|
6337
|
-
g(
|
|
6338
|
-
g(
|
|
6339
|
-
g(
|
|
6340
|
-
let K =
|
|
6341
|
-
const
|
|
6354
|
+
g(D, "BASE", new D(i.Gx, i.Gy, r.ONE)), // zero / infinity / identity point
|
|
6355
|
+
g(D, "ZERO", new D(r.ZERO, r.ONE, r.ZERO)), // math field
|
|
6356
|
+
g(D, "Fp", r), // scalar field
|
|
6357
|
+
g(D, "Fn", o);
|
|
6358
|
+
let K = D;
|
|
6359
|
+
const T = o.BITS, P = new Tm(K, e.endo ? Math.ceil(T / 2) : T);
|
|
6342
6360
|
return K.BASE.precompute(8), K;
|
|
6343
6361
|
}
|
|
6344
|
-
function
|
|
6362
|
+
function zm(t) {
|
|
6345
6363
|
return Uint8Array.of(t ? 2 : 3);
|
|
6346
6364
|
}
|
|
6347
|
-
function
|
|
6365
|
+
function qm(t, e) {
|
|
6348
6366
|
return {
|
|
6349
6367
|
secretKey: e.BYTES,
|
|
6350
6368
|
publicKey: 1 + t.BYTES,
|
|
@@ -6361,7 +6379,7 @@ const Un = {
|
|
|
6361
6379
|
b: BigInt(7),
|
|
6362
6380
|
Gx: BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
|
|
6363
6381
|
Gy: BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")
|
|
6364
|
-
},
|
|
6382
|
+
}, Vm = {
|
|
6365
6383
|
beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
|
|
6366
6384
|
basises: [
|
|
6367
6385
|
[
|
|
@@ -6373,17 +6391,17 @@ const Un = {
|
|
|
6373
6391
|
BigInt("0x3086d221a7d46bcde86c90e49284eb15")
|
|
6374
6392
|
]
|
|
6375
6393
|
]
|
|
6376
|
-
},
|
|
6377
|
-
function
|
|
6378
|
-
const e = Un.p, n = BigInt(3), r = BigInt(6), o = BigInt(11), i = BigInt(22), s = BigInt(23), a = BigInt(44), c = BigInt(88), l = t * t * t % e, d = l * l * t % e, u = fe(d, n, e) * d % e, m = fe(u, n, e) * d % e, f = fe(m, Rr, e) * l % e, p = fe(f, o, e) * f % e, h = fe(p, i, e) * p % e, y = fe(h, a, e) * h % e, w = fe(y, c, e) * y % e, E = fe(w, a, e) * h % e, S = fe(E, n, e) * d % e,
|
|
6394
|
+
}, jm = /* @__PURE__ */ BigInt(0), Rr = /* @__PURE__ */ BigInt(2);
|
|
6395
|
+
function Fm(t) {
|
|
6396
|
+
const e = Un.p, n = BigInt(3), r = BigInt(6), o = BigInt(11), i = BigInt(22), s = BigInt(23), a = BigInt(44), c = BigInt(88), l = t * t * t % e, d = l * l * t % e, u = fe(d, n, e) * d % e, m = fe(u, n, e) * d % e, f = fe(m, Rr, e) * l % e, p = fe(f, o, e) * f % e, h = fe(p, i, e) * p % e, y = fe(h, a, e) * h % e, w = fe(y, c, e) * y % e, E = fe(w, a, e) * h % e, S = fe(E, n, e) * d % e, O = fe(S, s, e) * p % e, M = fe(O, r, e) * l % e, _ = fe(M, Rr, e);
|
|
6379
6397
|
if (!gn.eql(gn.sqr(_), t)) throw new Error("Cannot find square root");
|
|
6380
6398
|
return _;
|
|
6381
6399
|
}
|
|
6382
6400
|
const gn = Pn(Un.p, {
|
|
6383
|
-
sqrt:
|
|
6384
|
-
}), Bt = /* @__PURE__ */
|
|
6401
|
+
sqrt: Fm
|
|
6402
|
+
}), Bt = /* @__PURE__ */ Hm(Un, {
|
|
6385
6403
|
Fp: gn,
|
|
6386
|
-
endo:
|
|
6404
|
+
endo: Vm
|
|
6387
6405
|
}), vi = {};
|
|
6388
6406
|
function yn(t, ...e) {
|
|
6389
6407
|
let n = vi[t];
|
|
@@ -6393,7 +6411,7 @@ function yn(t, ...e) {
|
|
|
6393
6411
|
}
|
|
6394
6412
|
return Ir(mn(n, ...e));
|
|
6395
6413
|
}
|
|
6396
|
-
const Lo = (t) => t.toBytes(!0).slice(1), Io = (t) => t % Rr ===
|
|
6414
|
+
const Lo = (t) => t.toBytes(!0).slice(1), Io = (t) => t % Rr === jm;
|
|
6397
6415
|
function Tr(t) {
|
|
6398
6416
|
const { Fn: e, BASE: n } = Bt, r = e.fromBytes(t), o = n.multiply(r);
|
|
6399
6417
|
return {
|
|
@@ -6420,7 +6438,7 @@ function rc(...t) {
|
|
|
6420
6438
|
function xi(t) {
|
|
6421
6439
|
return Tr(t).bytes;
|
|
6422
6440
|
}
|
|
6423
|
-
function
|
|
6441
|
+
function Wm(t, e, n = Ma(32)) {
|
|
6424
6442
|
const { Fn: r } = Bt, o = ue(t, void 0, "message"), { bytes: i, scalar: s } = Tr(e), a = ue(n, 32, "auxRand"), c = r.toBytes(s ^ Ut(yn("BIP0340/aux", a))), l = yn("BIP0340/nonce", c, i, o), { bytes: d, scalar: u } = Tr(l), m = rc(d, i, o), f = new Uint8Array(64);
|
|
6425
6443
|
if (f.set(d, 0), f.set(r.toBytes(r.create(u + m * s)), 32), !oc(f, o, i)) throw new Error("sign: Invalid signature produced");
|
|
6426
6444
|
return f;
|
|
@@ -6439,11 +6457,11 @@ function oc(t, e, n) {
|
|
|
6439
6457
|
}
|
|
6440
6458
|
}
|
|
6441
6459
|
const It = /* @__PURE__ */ (() => {
|
|
6442
|
-
const n = (r = Ma(48)) =>
|
|
6460
|
+
const n = (r = Ma(48)) => Rm(r, Un.n);
|
|
6443
6461
|
return {
|
|
6444
|
-
keygen:
|
|
6462
|
+
keygen: Om(n, xi),
|
|
6445
6463
|
getPublicKey: xi,
|
|
6446
|
-
sign:
|
|
6464
|
+
sign: Wm,
|
|
6447
6465
|
verify: oc,
|
|
6448
6466
|
Point: Bt,
|
|
6449
6467
|
utils: {
|
|
@@ -6460,9 +6478,9 @@ const It = /* @__PURE__ */ (() => {
|
|
|
6460
6478
|
seed: 48
|
|
6461
6479
|
}
|
|
6462
6480
|
};
|
|
6463
|
-
})(), rt = Symbol("verified"),
|
|
6464
|
-
function
|
|
6465
|
-
if (!
|
|
6481
|
+
})(), rt = Symbol("verified"), Zm = (t) => t instanceof Object;
|
|
6482
|
+
function Jm(t) {
|
|
6483
|
+
if (!Zm(t) || typeof t.kind != "number" || typeof t.content != "string" || typeof t.created_at != "number" || typeof t.pubkey != "string" || !t.pubkey.match(/^[a-f0-9]{64}$/) || !Array.isArray(t.tags)) return !1;
|
|
6466
6484
|
for (let e = 0; e < t.tags.length; e++) {
|
|
6467
6485
|
let n = t.tags[e];
|
|
6468
6486
|
if (!Array.isArray(n)) return !1;
|
|
@@ -6471,7 +6489,7 @@ function Zm(t) {
|
|
|
6471
6489
|
}
|
|
6472
6490
|
return !0;
|
|
6473
6491
|
}
|
|
6474
|
-
const Gt = new TextDecoder("utf-8"),
|
|
6492
|
+
const Gt = new TextDecoder("utf-8"), Gm = new TextEncoder();
|
|
6475
6493
|
function Je(t) {
|
|
6476
6494
|
try {
|
|
6477
6495
|
t.indexOf("://") === -1 && (t = "wss://" + t);
|
|
@@ -6481,7 +6499,7 @@ function Je(t) {
|
|
|
6481
6499
|
throw new Error(`Invalid URL: ${t}`);
|
|
6482
6500
|
}
|
|
6483
6501
|
}
|
|
6484
|
-
class
|
|
6502
|
+
class Ym {
|
|
6485
6503
|
constructor(e) {
|
|
6486
6504
|
g(this, "value");
|
|
6487
6505
|
g(this, "next", null);
|
|
@@ -6489,14 +6507,14 @@ class Gm {
|
|
|
6489
6507
|
this.value = e;
|
|
6490
6508
|
}
|
|
6491
6509
|
}
|
|
6492
|
-
class
|
|
6510
|
+
class Xm {
|
|
6493
6511
|
constructor() {
|
|
6494
6512
|
g(this, "first");
|
|
6495
6513
|
g(this, "last");
|
|
6496
6514
|
this.first = null, this.last = null;
|
|
6497
6515
|
}
|
|
6498
6516
|
enqueue(e) {
|
|
6499
|
-
const n = new
|
|
6517
|
+
const n = new Ym(e);
|
|
6500
6518
|
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;
|
|
6501
6519
|
}
|
|
6502
6520
|
dequeue() {
|
|
@@ -6509,7 +6527,7 @@ class Ym {
|
|
|
6509
6527
|
return this.first = e.next, this.first && (this.first.prev = null), e.value;
|
|
6510
6528
|
}
|
|
6511
6529
|
}
|
|
6512
|
-
class
|
|
6530
|
+
class Qm {
|
|
6513
6531
|
generateSecretKey() {
|
|
6514
6532
|
return It.utils.randomSecretKey();
|
|
6515
6533
|
}
|
|
@@ -6533,8 +6551,8 @@ class Xm {
|
|
|
6533
6551
|
}
|
|
6534
6552
|
}
|
|
6535
6553
|
}
|
|
6536
|
-
function
|
|
6537
|
-
if (!
|
|
6554
|
+
function ep(t) {
|
|
6555
|
+
if (!Jm(t)) throw new Error("can't serialize event with wrong or missing properties");
|
|
6538
6556
|
return JSON.stringify([
|
|
6539
6557
|
0,
|
|
6540
6558
|
t.pubkey,
|
|
@@ -6545,15 +6563,15 @@ function Qm(t) {
|
|
|
6545
6563
|
]);
|
|
6546
6564
|
}
|
|
6547
6565
|
function sr(t) {
|
|
6548
|
-
let e = Ir(
|
|
6566
|
+
let e = Ir(Gm.encode(ep(t)));
|
|
6549
6567
|
return ae(e);
|
|
6550
6568
|
}
|
|
6551
|
-
const On = new
|
|
6569
|
+
const On = new Qm();
|
|
6552
6570
|
On.generateSecretKey;
|
|
6553
6571
|
On.getPublicKey;
|
|
6554
6572
|
On.finalizeEvent;
|
|
6555
|
-
const
|
|
6556
|
-
function
|
|
6573
|
+
const tp = On.verifyEvent, np = 22242;
|
|
6574
|
+
function rp(t, e) {
|
|
6557
6575
|
if (t.ids && t.ids.indexOf(e.id) === -1 || t.kinds && t.kinds.indexOf(e.kind) === -1 || t.authors && t.authors.indexOf(e.pubkey) === -1)
|
|
6558
6576
|
return !1;
|
|
6559
6577
|
for (let n in t)
|
|
@@ -6563,17 +6581,17 @@ function np(t, e) {
|
|
|
6563
6581
|
}
|
|
6564
6582
|
return !(t.since && e.created_at < t.since || t.until && e.created_at > t.until);
|
|
6565
6583
|
}
|
|
6566
|
-
function
|
|
6584
|
+
function op(t, e) {
|
|
6567
6585
|
for (let n = 0; n < t.length; n++)
|
|
6568
|
-
if (
|
|
6586
|
+
if (rp(t[n], e))
|
|
6569
6587
|
return !0;
|
|
6570
6588
|
return !1;
|
|
6571
6589
|
}
|
|
6572
|
-
function
|
|
6590
|
+
function ip(t, e) {
|
|
6573
6591
|
let n = e.length + 3, r = t.indexOf(`"${e}":`) + n, o = t.slice(r).indexOf('"') + r + 1;
|
|
6574
6592
|
return t.slice(o, o + 64);
|
|
6575
6593
|
}
|
|
6576
|
-
function
|
|
6594
|
+
function sp(t) {
|
|
6577
6595
|
let e = t.slice(0, 22).indexOf('"EVENT"');
|
|
6578
6596
|
if (e === -1) return null;
|
|
6579
6597
|
let n = t.slice(e + 7 + 1).indexOf('"');
|
|
@@ -6583,9 +6601,9 @@ function ip(t) {
|
|
|
6583
6601
|
let i = r + 1 + o;
|
|
6584
6602
|
return t.slice(r + 1, i);
|
|
6585
6603
|
}
|
|
6586
|
-
function
|
|
6604
|
+
function ap(t, e) {
|
|
6587
6605
|
return {
|
|
6588
|
-
kind:
|
|
6606
|
+
kind: np,
|
|
6589
6607
|
created_at: Math.floor(Date.now() / 1e3),
|
|
6590
6608
|
tags: [
|
|
6591
6609
|
[
|
|
@@ -6600,7 +6618,7 @@ function sp(t, e) {
|
|
|
6600
6618
|
content: ""
|
|
6601
6619
|
};
|
|
6602
6620
|
}
|
|
6603
|
-
async function
|
|
6621
|
+
async function cp() {
|
|
6604
6622
|
return new Promise((t, e) => {
|
|
6605
6623
|
try {
|
|
6606
6624
|
if (typeof MessageChannel < "u") {
|
|
@@ -6615,7 +6633,7 @@ async function ap() {
|
|
|
6615
6633
|
}
|
|
6616
6634
|
});
|
|
6617
6635
|
}
|
|
6618
|
-
const
|
|
6636
|
+
const lp = (t) => (t[rt] = !0, !0);
|
|
6619
6637
|
class ic extends Error {
|
|
6620
6638
|
constructor(e, n) {
|
|
6621
6639
|
super(`Tried to send message '${e} on a closed connection to ${n}.`), this.name = "SendingOnClosedConnection";
|
|
@@ -6652,7 +6670,7 @@ class $o {
|
|
|
6652
6670
|
g(this, "openCountRequests", /* @__PURE__ */ new Map());
|
|
6653
6671
|
g(this, "openEventPublishes", /* @__PURE__ */ new Map());
|
|
6654
6672
|
g(this, "ws");
|
|
6655
|
-
g(this, "incomingMessageQueue", new
|
|
6673
|
+
g(this, "incomingMessageQueue", new Xm());
|
|
6656
6674
|
g(this, "queueRunning", !1);
|
|
6657
6675
|
g(this, "challenge");
|
|
6658
6676
|
g(this, "authPromise");
|
|
@@ -6768,7 +6786,7 @@ class $o {
|
|
|
6768
6786
|
}
|
|
6769
6787
|
async runQueue() {
|
|
6770
6788
|
for (this.queueRunning = !0; this.handleNext() !== !1; )
|
|
6771
|
-
await
|
|
6789
|
+
await cp();
|
|
6772
6790
|
this.queueRunning = !1;
|
|
6773
6791
|
}
|
|
6774
6792
|
handleNext() {
|
|
@@ -6776,12 +6794,12 @@ class $o {
|
|
|
6776
6794
|
const e = this.incomingMessageQueue.dequeue();
|
|
6777
6795
|
if (!e)
|
|
6778
6796
|
return !1;
|
|
6779
|
-
const n =
|
|
6797
|
+
const n = sp(e);
|
|
6780
6798
|
if (n) {
|
|
6781
6799
|
const s = this.openSubs.get(n);
|
|
6782
6800
|
if (!s)
|
|
6783
6801
|
return;
|
|
6784
|
-
const a =
|
|
6802
|
+
const a = ip(e, "id"), c = (r = s.alreadyHaveEvent) == null ? void 0 : r.call(s, a);
|
|
6785
6803
|
if ((o = s.receivedEvent) == null || o.call(s, this, a), c)
|
|
6786
6804
|
return;
|
|
6787
6805
|
}
|
|
@@ -6790,7 +6808,7 @@ class $o {
|
|
|
6790
6808
|
switch (s[0]) {
|
|
6791
6809
|
case "EVENT": {
|
|
6792
6810
|
const a = this.openSubs.get(s[1]), c = s[2];
|
|
6793
|
-
this.verifyEvent(c) &&
|
|
6811
|
+
this.verifyEvent(c) && op(a.filters, c) && a.onevent(c), (!a.lastEmitted || a.lastEmitted < c.created_at) && (a.lastEmitted = c.created_at);
|
|
6794
6812
|
return;
|
|
6795
6813
|
}
|
|
6796
6814
|
case "COUNT": {
|
|
@@ -6845,7 +6863,7 @@ class $o {
|
|
|
6845
6863
|
if (!n) throw new Error("can't perform auth, no challenge was received");
|
|
6846
6864
|
return this.authPromise ? this.authPromise : (this.authPromise = new Promise(async (r, o) => {
|
|
6847
6865
|
try {
|
|
6848
|
-
let i = await e(
|
|
6866
|
+
let i = await e(ap(this.url, n)), s = setTimeout(() => {
|
|
6849
6867
|
let a = this.openEventPublishes.get(i.id);
|
|
6850
6868
|
a && (a.reject(new Error("auth timed out")), this.openEventPublishes.delete(i.id));
|
|
6851
6869
|
}, this.publishTimeout);
|
|
@@ -6889,7 +6907,7 @@ class $o {
|
|
|
6889
6907
|
}
|
|
6890
6908
|
prepareSubscription(e, n) {
|
|
6891
6909
|
this.serial++;
|
|
6892
|
-
const r = n.id || (n.label ? n.label + ":" : "sub:") + this.serial, o = new
|
|
6910
|
+
const r = n.id || (n.label ? n.label + ":" : "sub:") + this.serial, o = new up(this, r, e, n);
|
|
6893
6911
|
return this.openSubs.set(r, o), o;
|
|
6894
6912
|
}
|
|
6895
6913
|
close() {
|
|
@@ -6902,7 +6920,7 @@ class $o {
|
|
|
6902
6920
|
this.incomingMessageQueue.enqueue(e.data), this.queueRunning || this.runQueue();
|
|
6903
6921
|
}
|
|
6904
6922
|
}
|
|
6905
|
-
class
|
|
6923
|
+
class up {
|
|
6906
6924
|
constructor(e, n, r, o) {
|
|
6907
6925
|
g(this, "relay");
|
|
6908
6926
|
g(this, "id");
|
|
@@ -6944,7 +6962,7 @@ class lp {
|
|
|
6944
6962
|
this.relay.openSubs.delete(this.id), (n = this.onclose) == null || n.call(this, e);
|
|
6945
6963
|
}
|
|
6946
6964
|
}
|
|
6947
|
-
class
|
|
6965
|
+
class dp {
|
|
6948
6966
|
constructor(e) {
|
|
6949
6967
|
g(this, "relays", /* @__PURE__ */ new Map());
|
|
6950
6968
|
g(this, "seenOn", /* @__PURE__ */ new Map());
|
|
@@ -6961,7 +6979,7 @@ class up {
|
|
|
6961
6979
|
e = Je(e);
|
|
6962
6980
|
let r = this.relays.get(e);
|
|
6963
6981
|
if (r || (r = new $o(e, {
|
|
6964
|
-
verifyEvent: this.trustedRelayURLs.has(e) ?
|
|
6982
|
+
verifyEvent: this.trustedRelayURLs.has(e) ? lp : this.verifyEvent,
|
|
6965
6983
|
websocketImplementation: this._WebSocket,
|
|
6966
6984
|
enablePing: this.enablePing,
|
|
6967
6985
|
enableReconnect: this.enableReconnect
|
|
@@ -7148,23 +7166,23 @@ try {
|
|
|
7148
7166
|
sc = WebSocket;
|
|
7149
7167
|
} catch {
|
|
7150
7168
|
}
|
|
7151
|
-
class
|
|
7169
|
+
class hp extends dp {
|
|
7152
7170
|
constructor(e) {
|
|
7153
7171
|
super({
|
|
7154
|
-
verifyEvent:
|
|
7172
|
+
verifyEvent: tp,
|
|
7155
7173
|
websocketImplementation: sc,
|
|
7156
7174
|
...e
|
|
7157
7175
|
});
|
|
7158
7176
|
}
|
|
7159
7177
|
}
|
|
7160
|
-
var
|
|
7161
|
-
const
|
|
7178
|
+
var fp = Math.pow(2, 8) - 1, mp = Math.pow(2, 16) - 1, pp = Math.pow(2, 32) - 1;
|
|
7179
|
+
const gp = function(t) {
|
|
7162
7180
|
var e = t - 1;
|
|
7163
|
-
if (e <= hp)
|
|
7164
|
-
return Uint8Array;
|
|
7165
7181
|
if (e <= fp)
|
|
7166
|
-
return
|
|
7182
|
+
return Uint8Array;
|
|
7167
7183
|
if (e <= mp)
|
|
7184
|
+
return Uint16Array;
|
|
7185
|
+
if (e <= pp)
|
|
7168
7186
|
return Uint32Array;
|
|
7169
7187
|
throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.");
|
|
7170
7188
|
};
|
|
@@ -7173,7 +7191,7 @@ function et(t) {
|
|
|
7173
7191
|
throw new Error("mnemonist/lru-cache: capacity should be positive number.");
|
|
7174
7192
|
if (!isFinite(this.capacity) || Math.floor(this.capacity) !== this.capacity)
|
|
7175
7193
|
throw new Error("mnemonist/lru-cache: capacity should be a finite positive integer.");
|
|
7176
|
-
var e =
|
|
7194
|
+
var e = gp(t);
|
|
7177
7195
|
this.forward = new e(t), this.backward = new e(t), this.K = new Array(t), this.V = new Array(t), this.size = 0, this.head = 0, this.tail = 0, this.items = {};
|
|
7178
7196
|
}
|
|
7179
7197
|
et.prototype.clear = function() {
|
|
@@ -7245,7 +7263,7 @@ class ac {
|
|
|
7245
7263
|
load(e) {
|
|
7246
7264
|
if (e == null)
|
|
7247
7265
|
throw new TypeError(`The loader.load() function must be called with a value, but got: ${String(e)}.`);
|
|
7248
|
-
const n =
|
|
7266
|
+
const n = yp(this), r = this._cacheKeyFn(e), o = this._cacheMap.get(r);
|
|
7249
7267
|
if (o) {
|
|
7250
7268
|
const s = n.cacheHits || (n.cacheHits = []);
|
|
7251
7269
|
return new Promise((a) => {
|
|
@@ -7276,7 +7294,7 @@ class ac {
|
|
|
7276
7294
|
return this;
|
|
7277
7295
|
}
|
|
7278
7296
|
}
|
|
7279
|
-
function
|
|
7297
|
+
function yp(t) {
|
|
7280
7298
|
const e = t._batch;
|
|
7281
7299
|
if (e !== null && !e.hasDispatched && e.keys.length < t._maxBatchSize)
|
|
7282
7300
|
return e;
|
|
@@ -7286,10 +7304,10 @@ function gp(t) {
|
|
|
7286
7304
|
callbacks: []
|
|
7287
7305
|
};
|
|
7288
7306
|
return t._batch = n, setTimeout(() => {
|
|
7289
|
-
|
|
7307
|
+
bp(t, n);
|
|
7290
7308
|
}), n;
|
|
7291
7309
|
}
|
|
7292
|
-
function
|
|
7310
|
+
function bp(t, e) {
|
|
7293
7311
|
if (e.hasDispatched = !0, e.keys.length === 0) {
|
|
7294
7312
|
Pr(e);
|
|
7295
7313
|
return;
|
|
@@ -7368,7 +7386,7 @@ const Ur = [
|
|
|
7368
7386
|
"wss://purplepag.es",
|
|
7369
7387
|
"wss://relay.nos.social",
|
|
7370
7388
|
"wss://relay.primal.net"
|
|
7371
|
-
],
|
|
7389
|
+
], wp = [
|
|
7372
7390
|
"wss://purplepag.es",
|
|
7373
7391
|
"wss://relay.nos.social",
|
|
7374
7392
|
"wss://indexer.coracle.social"
|
|
@@ -7381,10 +7399,10 @@ function Nt(t) {
|
|
|
7381
7399
|
}
|
|
7382
7400
|
return !0;
|
|
7383
7401
|
}
|
|
7384
|
-
function
|
|
7402
|
+
function vp(t) {
|
|
7385
7403
|
return !!t;
|
|
7386
7404
|
}
|
|
7387
|
-
let
|
|
7405
|
+
let xp = 0;
|
|
7388
7406
|
const Ze = Symbol("event was just downloaded or force-updated, not loaded from cache");
|
|
7389
7407
|
Be(3, Ur, Ke((t) => {
|
|
7390
7408
|
if (t.length >= 2 && t[0] === "p" && Nt(t[1]))
|
|
@@ -7415,7 +7433,7 @@ Be(10012, [], Ke((t) => {
|
|
|
7415
7433
|
};
|
|
7416
7434
|
}
|
|
7417
7435
|
}));
|
|
7418
|
-
const To = Be(10002,
|
|
7436
|
+
const To = Be(10002, wp, Ke((t) => {
|
|
7419
7437
|
if (t.length === 2)
|
|
7420
7438
|
return {
|
|
7421
7439
|
url: t[1],
|
|
@@ -7499,7 +7517,7 @@ Be(10001, [], Ke((t) => {
|
|
|
7499
7517
|
return t[1];
|
|
7500
7518
|
}));
|
|
7501
7519
|
function Ke(t) {
|
|
7502
|
-
return (e) => e ? e.tags.map(t).filter(
|
|
7520
|
+
return (e) => e ? e.tags.map(t).filter(vp) : [];
|
|
7503
7521
|
}
|
|
7504
7522
|
function Be(t, e, n) {
|
|
7505
7523
|
const r = Ro(`@nostr/gadgets/list:${t}`, "cache"), o = new ac((i) => new Promise(async (s) => {
|
|
@@ -7536,7 +7554,7 @@ function Be(t, e, n) {
|
|
|
7536
7554
|
for (let m = 0; m < a.length; m++) {
|
|
7537
7555
|
const f = a[m], p = f.relays.slice(0, Math.min(4, f.relays.length));
|
|
7538
7556
|
do
|
|
7539
|
-
p.push(
|
|
7557
|
+
p.push(Ep(e));
|
|
7540
7558
|
while (p.length < 3);
|
|
7541
7559
|
for (let h = 0; h < p.length; h++) {
|
|
7542
7560
|
const y = p[h];
|
|
@@ -7622,13 +7640,13 @@ function Be(t, e, n) {
|
|
|
7622
7640
|
}
|
|
7623
7641
|
};
|
|
7624
7642
|
}
|
|
7625
|
-
function
|
|
7626
|
-
return t[
|
|
7643
|
+
function Ep(t) {
|
|
7644
|
+
return t[xp++ % t.length];
|
|
7627
7645
|
}
|
|
7628
|
-
let Ft = new
|
|
7646
|
+
let Ft = new hp();
|
|
7629
7647
|
new TextDecoder("utf-8");
|
|
7630
7648
|
new TextEncoder();
|
|
7631
|
-
function
|
|
7649
|
+
function kp(t) {
|
|
7632
7650
|
try {
|
|
7633
7651
|
t.indexOf("://") === -1 && (t = "wss://" + t);
|
|
7634
7652
|
let e = new URL(t);
|
|
@@ -7637,17 +7655,17 @@ function Ep(t) {
|
|
|
7637
7655
|
throw new Error(`Invalid URL: ${t}`);
|
|
7638
7656
|
}
|
|
7639
7657
|
}
|
|
7640
|
-
const
|
|
7658
|
+
const _p = /^[0-9a-f]{64}$/i;
|
|
7641
7659
|
function hc(t) {
|
|
7642
|
-
return
|
|
7660
|
+
return _p.test(t);
|
|
7643
7661
|
}
|
|
7644
|
-
const
|
|
7662
|
+
const Ap = [
|
|
7645
7663
|
"wss://relay.damus.io/",
|
|
7646
7664
|
"wss://nos.lol/",
|
|
7647
7665
|
"wss://nostr.mom/"
|
|
7648
7666
|
];
|
|
7649
|
-
function
|
|
7650
|
-
return [...
|
|
7667
|
+
function Sp() {
|
|
7668
|
+
return [...Ap];
|
|
7651
7669
|
}
|
|
7652
7670
|
async function fc(t, e) {
|
|
7653
7671
|
return Ft.querySync(t, e);
|
|
@@ -7664,22 +7682,22 @@ async function pc(t, e) {
|
|
|
7664
7682
|
}
|
|
7665
7683
|
async function Or(t, e) {
|
|
7666
7684
|
const n = /* @__PURE__ */ new Set();
|
|
7667
|
-
return t && t.length > 0 && t.forEach((r) => n.add(
|
|
7685
|
+
return t && t.length > 0 && t.forEach((r) => n.add(kp(r))), e && hc(e) && (await To(e)).items.forEach((o) => {
|
|
7668
7686
|
o.read && n.add(o.url);
|
|
7669
|
-
}), n.size === 0 &&
|
|
7687
|
+
}), n.size === 0 && Sp().forEach((r) => n.add(r)), Array.from(n);
|
|
7670
7688
|
}
|
|
7671
|
-
const
|
|
7672
|
-
function
|
|
7673
|
-
return t[
|
|
7689
|
+
const Np = Symbol("relays where this event was seen before stored");
|
|
7690
|
+
function Cp(t) {
|
|
7691
|
+
return t[Np] || [];
|
|
7674
7692
|
}
|
|
7675
|
-
const
|
|
7676
|
-
function
|
|
7693
|
+
const Bp = 1111;
|
|
7694
|
+
function Lp(t) {
|
|
7677
7695
|
const { url: e, content: n, parentEvent: r } = t, o = t.mention && hc(t.mention) ? t.mention : void 0, i = [
|
|
7678
7696
|
["I", e],
|
|
7679
7697
|
["K", "web"]
|
|
7680
7698
|
];
|
|
7681
7699
|
if (o && i.push(["P", o]), r) {
|
|
7682
|
-
const s =
|
|
7700
|
+
const s = Cp(r);
|
|
7683
7701
|
i.push([
|
|
7684
7702
|
"e",
|
|
7685
7703
|
r.id,
|
|
@@ -7689,24 +7707,24 @@ function Bp(t) {
|
|
|
7689
7707
|
} else
|
|
7690
7708
|
i.push(["i", e]), i.push(["k", "web"]), o && i.push(["p", o]);
|
|
7691
7709
|
return {
|
|
7692
|
-
kind:
|
|
7710
|
+
kind: Bp,
|
|
7693
7711
|
content: n,
|
|
7694
7712
|
tags: i,
|
|
7695
7713
|
created_at: Math.floor(Date.now() / 1e3)
|
|
7696
7714
|
};
|
|
7697
7715
|
}
|
|
7698
|
-
function
|
|
7716
|
+
function Wg(t) {
|
|
7699
7717
|
return t.tags.some((e) => e[0] === "e");
|
|
7700
7718
|
}
|
|
7701
7719
|
function Yt(t) {
|
|
7702
7720
|
const e = t.tags.find((n) => n[0] === "e");
|
|
7703
7721
|
return e ? e[1] : null;
|
|
7704
7722
|
}
|
|
7705
|
-
function
|
|
7723
|
+
function Zg(t) {
|
|
7706
7724
|
const e = t.tags.find((n) => n[0] === "I");
|
|
7707
7725
|
return e ? e[1] : null;
|
|
7708
7726
|
}
|
|
7709
|
-
const
|
|
7727
|
+
const Ip = `
|
|
7710
7728
|
const utf8Encoder = new TextEncoder();
|
|
7711
7729
|
|
|
7712
7730
|
async function sha256Hex(message) {
|
|
@@ -7766,23 +7784,23 @@ self.onmessage = async (e) => {
|
|
|
7766
7784
|
};
|
|
7767
7785
|
`;
|
|
7768
7786
|
let lr = null;
|
|
7769
|
-
function
|
|
7787
|
+
function $p() {
|
|
7770
7788
|
if (!lr) {
|
|
7771
|
-
const t = new Blob([
|
|
7789
|
+
const t = new Blob([Ip], { type: "application/javascript" }), e = URL.createObjectURL(t);
|
|
7772
7790
|
lr = new Worker(e);
|
|
7773
7791
|
}
|
|
7774
7792
|
return lr;
|
|
7775
7793
|
}
|
|
7776
|
-
function
|
|
7794
|
+
function Rp(t, e) {
|
|
7777
7795
|
return new Promise((n, r) => {
|
|
7778
|
-
const o =
|
|
7796
|
+
const o = $p(), i = (s) => {
|
|
7779
7797
|
o.removeEventListener("message", i), s.data.success ? n(s.data.result) : r(new Error(s.data.error));
|
|
7780
7798
|
};
|
|
7781
7799
|
o.addEventListener("message", i), o.postMessage({ unsigned: t, difficulty: e });
|
|
7782
7800
|
});
|
|
7783
7801
|
}
|
|
7784
7802
|
const gc = 1111;
|
|
7785
|
-
function
|
|
7803
|
+
function Tp(t) {
|
|
7786
7804
|
const { url: e, relays: n, limit: r = 50, onEvent: o, onEose: i } = t, s = [e];
|
|
7787
7805
|
return e.endsWith("/") ? s.push(e.slice(0, -1)) : s.push(e + "/"), mc(
|
|
7788
7806
|
n,
|
|
@@ -7795,7 +7813,7 @@ function Rp(t) {
|
|
|
7795
7813
|
i
|
|
7796
7814
|
);
|
|
7797
7815
|
}
|
|
7798
|
-
async function
|
|
7816
|
+
async function Pp(t) {
|
|
7799
7817
|
const { url: e, relays: n, limit: r = 50, until: o } = t, i = [e];
|
|
7800
7818
|
return e.endsWith("/") ? i.push(e.slice(0, -1)) : i.push(e + "/"), fc(n, {
|
|
7801
7819
|
kinds: [gc],
|
|
@@ -7804,16 +7822,16 @@ async function Tp(t) {
|
|
|
7804
7822
|
...o ? { until: o } : {}
|
|
7805
7823
|
});
|
|
7806
7824
|
}
|
|
7807
|
-
async function
|
|
7808
|
-
let n =
|
|
7825
|
+
async function Up(t, e) {
|
|
7826
|
+
let n = Lp(e);
|
|
7809
7827
|
if (e.pow && e.pow > 0) {
|
|
7810
|
-
const o = await t.getPublicKey(), i = { ...n, pubkey: o }, s = await
|
|
7828
|
+
const o = await t.getPublicKey(), i = { ...n, pubkey: o }, s = await Rp(i, e.pow);
|
|
7811
7829
|
n = { ...n, tags: s.tags, created_at: s.created_at };
|
|
7812
7830
|
}
|
|
7813
7831
|
const r = await t.signEvent(n);
|
|
7814
7832
|
return await pc(await Or(e.relays, e.mention), r), r;
|
|
7815
7833
|
}
|
|
7816
|
-
function
|
|
7834
|
+
function Op(t) {
|
|
7817
7835
|
const e = /* @__PURE__ */ new Map();
|
|
7818
7836
|
t.forEach((s) => e.set(s.id, s));
|
|
7819
7837
|
const n = (s) => {
|
|
@@ -8836,7 +8854,7 @@ function bc(t, e) {
|
|
|
8836
8854
|
return e ? { ...r, ...e } : r;
|
|
8837
8855
|
}
|
|
8838
8856
|
const wc = Rc(null);
|
|
8839
|
-
function
|
|
8857
|
+
function Mp({
|
|
8840
8858
|
locale: t,
|
|
8841
8859
|
translations: e,
|
|
8842
8860
|
children: n
|
|
@@ -8863,7 +8881,7 @@ function vc(t) {
|
|
|
8863
8881
|
function xc(t, e) {
|
|
8864
8882
|
return Array.isArray(e) ? e.length === 0 ? !0 : t ? e.every((n) => typeof n == "string") : e.every((n) => Number.isSafeInteger(n)) : !1;
|
|
8865
8883
|
}
|
|
8866
|
-
function
|
|
8884
|
+
function Dp(t) {
|
|
8867
8885
|
if (typeof t != "function") throw new Error("function expected");
|
|
8868
8886
|
return !0;
|
|
8869
8887
|
}
|
|
@@ -8884,7 +8902,7 @@ function _c(t, e) {
|
|
|
8884
8902
|
if (!xc(!1, e)) throw new Error(`${t}: array of numbers expected`);
|
|
8885
8903
|
}
|
|
8886
8904
|
// @__NO_SIDE_EFFECTS__
|
|
8887
|
-
function
|
|
8905
|
+
function Kp(...t) {
|
|
8888
8906
|
const e = (i) => i, n = (i, s) => (a) => i(s(a)), r = t.map((i) => i.encode).reduceRight(n, e), o = t.map((i) => i.decode).reduce(n, e);
|
|
8889
8907
|
return {
|
|
8890
8908
|
encode: r,
|
|
@@ -8892,7 +8910,7 @@ function Dp(...t) {
|
|
|
8892
8910
|
};
|
|
8893
8911
|
}
|
|
8894
8912
|
// @__NO_SIDE_EFFECTS__
|
|
8895
|
-
function
|
|
8913
|
+
function Hp(t) {
|
|
8896
8914
|
const e = typeof t == "string" ? t.split("") : t, n = e.length;
|
|
8897
8915
|
kc("alphabet", e);
|
|
8898
8916
|
const r = new Map(e.map((o, i) => [
|
|
@@ -8913,7 +8931,7 @@ function Kp(t) {
|
|
|
8913
8931
|
};
|
|
8914
8932
|
}
|
|
8915
8933
|
// @__NO_SIDE_EFFECTS__
|
|
8916
|
-
function
|
|
8934
|
+
function zp(t = "") {
|
|
8917
8935
|
return Ht("join", t), {
|
|
8918
8936
|
encode: (e) => (kc("join.decode", e), e.join(t)),
|
|
8919
8937
|
decode: (e) => (Ht("join.decode", e), e.split(t))
|
|
@@ -8944,7 +8962,7 @@ function Dr(t, e, n, r) {
|
|
|
8944
8962
|
return r && i > 0 && c.push(o >>> 0), c;
|
|
8945
8963
|
}
|
|
8946
8964
|
// @__NO_SIDE_EFFECTS__
|
|
8947
|
-
function
|
|
8965
|
+
function qp(t, e = !1) {
|
|
8948
8966
|
if (Ec(t), t <= 0 || t > 32) throw new Error("radix2: bits should be in (0..32]");
|
|
8949
8967
|
if (/* @__PURE__ */ wn(8, t) > 32 || /* @__PURE__ */ wn(t, 8) > 32) throw new Error("radix2: carry overflow");
|
|
8950
8968
|
return {
|
|
@@ -8956,14 +8974,14 @@ function zp(t, e = !1) {
|
|
|
8956
8974
|
};
|
|
8957
8975
|
}
|
|
8958
8976
|
function Ri(t) {
|
|
8959
|
-
return
|
|
8977
|
+
return Dp(t), function(...e) {
|
|
8960
8978
|
try {
|
|
8961
8979
|
return t.apply(null, e);
|
|
8962
8980
|
} catch {
|
|
8963
8981
|
}
|
|
8964
8982
|
};
|
|
8965
8983
|
}
|
|
8966
|
-
const Kr = /* @__PURE__ */
|
|
8984
|
+
const Kr = /* @__PURE__ */ Kp(/* @__PURE__ */ Hp("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), /* @__PURE__ */ zp("")), Ti = [
|
|
8967
8985
|
996825010,
|
|
8968
8986
|
642813549,
|
|
8969
8987
|
513874426,
|
|
@@ -8994,8 +9012,8 @@ function Pi(t, e, n = 1) {
|
|
|
8994
9012
|
], 30, 5, !1));
|
|
8995
9013
|
}
|
|
8996
9014
|
// @__NO_SIDE_EFFECTS__
|
|
8997
|
-
function
|
|
8998
|
-
const e = t === "bech32" ? 1 : 734539939, n = /* @__PURE__ */
|
|
9015
|
+
function Vp(t) {
|
|
9016
|
+
const e = t === "bech32" ? 1 : 734539939, n = /* @__PURE__ */ qp(5), r = n.decode, o = n.encode, i = Ri(r);
|
|
8999
9017
|
function s(u, m, f = 90) {
|
|
9000
9018
|
Ht("bech32.encode prefix", u), vc(m) && (m = Array.from(m)), _c("bech32.encode", m);
|
|
9001
9019
|
const p = u.length;
|
|
@@ -9045,7 +9063,7 @@ function qp(t) {
|
|
|
9045
9063
|
toWords: o
|
|
9046
9064
|
};
|
|
9047
9065
|
}
|
|
9048
|
-
const vn = /* @__PURE__ */
|
|
9066
|
+
const vn = /* @__PURE__ */ Vp("bech32"), Sc = 5e3;
|
|
9049
9067
|
function Ui(t) {
|
|
9050
9068
|
var o, i, s, a, c, l, d;
|
|
9051
9069
|
let { prefix: e, words: n } = vn.decode(t, Sc), r = new Uint8Array(vn.fromWords(n));
|
|
@@ -9120,14 +9138,14 @@ function mr(t) {
|
|
|
9120
9138
|
return e;
|
|
9121
9139
|
}
|
|
9122
9140
|
function Oi(t) {
|
|
9123
|
-
return
|
|
9141
|
+
return Fp("npub", st(t));
|
|
9124
9142
|
}
|
|
9125
|
-
function
|
|
9143
|
+
function jp(t, e) {
|
|
9126
9144
|
let n = vn.toWords(e);
|
|
9127
9145
|
return vn.encode(t, n, Sc);
|
|
9128
9146
|
}
|
|
9129
|
-
function
|
|
9130
|
-
return
|
|
9147
|
+
function Fp(t, e) {
|
|
9148
|
+
return jp(t, e);
|
|
9131
9149
|
}
|
|
9132
9150
|
let Mi = 0;
|
|
9133
9151
|
function xn(t) {
|
|
@@ -9149,7 +9167,7 @@ function xn(t) {
|
|
|
9149
9167
|
};
|
|
9150
9168
|
}
|
|
9151
9169
|
const an = Ro("@nostr/gadgets/metadata", "cache");
|
|
9152
|
-
async function
|
|
9170
|
+
async function Wp(t) {
|
|
9153
9171
|
return typeof t == "string" ? en.load({
|
|
9154
9172
|
pubkey: t
|
|
9155
9173
|
}) : t.refreshStyle === null ? (await dc(t.pubkey, an), en._cacheMap.delete(t.pubkey), xn(t.pubkey)) : (t.refreshStyle && en.clear(
|
|
@@ -9254,7 +9272,7 @@ function Di(t, e) {
|
|
|
9254
9272
|
function Nc(t) {
|
|
9255
9273
|
const [e, n] = X(() => xn(t));
|
|
9256
9274
|
return xt(() => {
|
|
9257
|
-
|
|
9275
|
+
Wp(t).then(n);
|
|
9258
9276
|
}, [t]), { profile: e };
|
|
9259
9277
|
}
|
|
9260
9278
|
const Ki = [
|
|
@@ -9275,21 +9293,21 @@ const Ki = [
|
|
|
9275
9293
|
"#ff5722",
|
|
9276
9294
|
"#795548"
|
|
9277
9295
|
];
|
|
9278
|
-
function
|
|
9296
|
+
function Zp(t) {
|
|
9279
9297
|
let e = 0;
|
|
9280
9298
|
for (let n = 0; n < t.length; n++)
|
|
9281
9299
|
e = t.charCodeAt(n) + ((e << 5) - e), e = e & e;
|
|
9282
9300
|
return Ki[Math.abs(e) % Ki.length];
|
|
9283
9301
|
}
|
|
9284
|
-
function
|
|
9285
|
-
const n =
|
|
9302
|
+
function Jp(t, e = 40) {
|
|
9303
|
+
const n = Zp(t), r = t.slice(0, 2).toUpperCase();
|
|
9286
9304
|
return `<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${e}" viewBox="0 0 ${e} ${e}">
|
|
9287
9305
|
<rect width="${e}" height="${e}" fill="${n}" rx="${e / 5}"/>
|
|
9288
9306
|
<text x="50%" y="50%" fill="white" font-family="system-ui, sans-serif" font-size="${e * 0.4}" font-weight="600" text-anchor="middle" dominant-baseline="central">${r}</text>
|
|
9289
9307
|
</svg>`;
|
|
9290
9308
|
}
|
|
9291
9309
|
function Hi(t, e = 40) {
|
|
9292
|
-
const n =
|
|
9310
|
+
const n = Jp(t, e);
|
|
9293
9311
|
return `data:image/svg+xml,${encodeURIComponent(n)}`;
|
|
9294
9312
|
}
|
|
9295
9313
|
function Po({ pubkey: t, size: e = 32, className: n = "" }) {
|
|
@@ -9335,7 +9353,7 @@ function En({ pubkey: t, className: e = "" }) {
|
|
|
9335
9353
|
}
|
|
9336
9354
|
);
|
|
9337
9355
|
}
|
|
9338
|
-
function
|
|
9356
|
+
function Gp({
|
|
9339
9357
|
url: t,
|
|
9340
9358
|
relays: e,
|
|
9341
9359
|
mention: n,
|
|
@@ -9347,15 +9365,15 @@ function Jp({
|
|
|
9347
9365
|
onError: c,
|
|
9348
9366
|
className: l = ""
|
|
9349
9367
|
}) {
|
|
9350
|
-
const { signer: d, signerInfo: u, isLoggedIn: m } = Vt(), { t: f } = ft(), [p, h] = X(""), [y, w] = X(!1), E = async (
|
|
9351
|
-
if (
|
|
9368
|
+
const { signer: d, signerInfo: u, isLoggedIn: m } = Vt(), { t: f } = ft(), [p, h] = X(""), [y, w] = X(!1), E = async (O) => {
|
|
9369
|
+
if (O.preventDefault(), !!p.trim()) {
|
|
9352
9370
|
if (!m || !d) {
|
|
9353
9371
|
a();
|
|
9354
9372
|
return;
|
|
9355
9373
|
}
|
|
9356
9374
|
w(!0);
|
|
9357
9375
|
try {
|
|
9358
|
-
const
|
|
9376
|
+
const M = await Up(d, {
|
|
9359
9377
|
url: t,
|
|
9360
9378
|
content: p.trim(),
|
|
9361
9379
|
parentEvent: o,
|
|
@@ -9363,9 +9381,9 @@ function Jp({
|
|
|
9363
9381
|
mention: n,
|
|
9364
9382
|
pow: r
|
|
9365
9383
|
});
|
|
9366
|
-
h(""), i == null || i(), s == null || s(
|
|
9367
|
-
} catch (
|
|
9368
|
-
c == null || c(
|
|
9384
|
+
h(""), i == null || i(), s == null || s(M);
|
|
9385
|
+
} catch (M) {
|
|
9386
|
+
c == null || c(M instanceof Error ? M : new Error("Failed to publish"));
|
|
9369
9387
|
} finally {
|
|
9370
9388
|
w(!1);
|
|
9371
9389
|
}
|
|
@@ -9401,7 +9419,7 @@ function Jp({
|
|
|
9401
9419
|
"textarea",
|
|
9402
9420
|
{
|
|
9403
9421
|
value: p,
|
|
9404
|
-
onInput: (
|
|
9422
|
+
onInput: (O) => h(O.target.value),
|
|
9405
9423
|
onFocus: S,
|
|
9406
9424
|
placeholder: f("writeComment"),
|
|
9407
9425
|
className: "nc-editor__textarea",
|
|
@@ -9422,7 +9440,7 @@ function Jp({
|
|
|
9422
9440
|
] })
|
|
9423
9441
|
] });
|
|
9424
9442
|
}
|
|
9425
|
-
function
|
|
9443
|
+
function Yp(t, e, n) {
|
|
9426
9444
|
const r = new Date(t * 1e3), i = (/* @__PURE__ */ new Date()).getTime() - r.getTime(), s = Math.floor(i / 6e4), a = Math.floor(i / 36e5), c = Math.floor(i / 864e5);
|
|
9427
9445
|
return s < 1 ? e("timeJustNow") : s < 60 ? e("timeMinutesAgo").replace("{{n}}", String(s)) : a < 24 ? e("timeHoursAgo").replace("{{n}}", String(a)) : c < 30 ? e("timeDaysAgo").replace("{{n}}", String(c)) : r.toLocaleDateString(n, {
|
|
9428
9446
|
year: "numeric",
|
|
@@ -9457,7 +9475,7 @@ function Cc({
|
|
|
9457
9475
|
] }),
|
|
9458
9476
|
/* @__PURE__ */ x("p", { className: "nc-comment__text", children: a.content }),
|
|
9459
9477
|
/* @__PURE__ */ H("div", { className: "nc-comment__actions", children: [
|
|
9460
|
-
/* @__PURE__ */ x("span", { className: "nc-comment__time", children:
|
|
9478
|
+
/* @__PURE__ */ x("span", { className: "nc-comment__time", children: Yp(a.created_at, d, u) }),
|
|
9461
9479
|
/* @__PURE__ */ x(
|
|
9462
9480
|
"button",
|
|
9463
9481
|
{
|
|
@@ -9495,7 +9513,7 @@ function Cc({
|
|
|
9495
9513
|
)) })
|
|
9496
9514
|
] });
|
|
9497
9515
|
}
|
|
9498
|
-
function
|
|
9516
|
+
function Xp({
|
|
9499
9517
|
comments: t,
|
|
9500
9518
|
loading: e,
|
|
9501
9519
|
loadingMore: n,
|
|
@@ -9557,14 +9575,14 @@ const Bc = (...t) => t.filter((e, n, r) => !!e && e.trim() !== "" && r.indexOf(e
|
|
|
9557
9575
|
* This source code is licensed under the ISC license.
|
|
9558
9576
|
* See the LICENSE file in the root directory of this source tree.
|
|
9559
9577
|
*/
|
|
9560
|
-
const
|
|
9578
|
+
const Qp = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
9561
9579
|
/**
|
|
9562
9580
|
* @license lucide-react v0.563.0 - ISC
|
|
9563
9581
|
*
|
|
9564
9582
|
* This source code is licensed under the ISC license.
|
|
9565
9583
|
* See the LICENSE file in the root directory of this source tree.
|
|
9566
9584
|
*/
|
|
9567
|
-
const
|
|
9585
|
+
const eg = (t) => t.replace(
|
|
9568
9586
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
9569
9587
|
(e, n, r) => r ? r.toUpperCase() : n.toLowerCase()
|
|
9570
9588
|
);
|
|
@@ -9575,7 +9593,7 @@ const Qp = (t) => t.replace(
|
|
|
9575
9593
|
* See the LICENSE file in the root directory of this source tree.
|
|
9576
9594
|
*/
|
|
9577
9595
|
const zi = (t) => {
|
|
9578
|
-
const e =
|
|
9596
|
+
const e = eg(t);
|
|
9579
9597
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
9580
9598
|
};
|
|
9581
9599
|
/**
|
|
@@ -9584,7 +9602,7 @@ const zi = (t) => {
|
|
|
9584
9602
|
* This source code is licensed under the ISC license.
|
|
9585
9603
|
* See the LICENSE file in the root directory of this source tree.
|
|
9586
9604
|
*/
|
|
9587
|
-
var
|
|
9605
|
+
var tg = {
|
|
9588
9606
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9589
9607
|
width: 24,
|
|
9590
9608
|
height: 24,
|
|
@@ -9601,7 +9619,7 @@ var eg = {
|
|
|
9601
9619
|
* This source code is licensed under the ISC license.
|
|
9602
9620
|
* See the LICENSE file in the root directory of this source tree.
|
|
9603
9621
|
*/
|
|
9604
|
-
const
|
|
9622
|
+
const ng = (t) => {
|
|
9605
9623
|
for (const e in t)
|
|
9606
9624
|
if (e.startsWith("aria-") || e === "role" || e === "title")
|
|
9607
9625
|
return !0;
|
|
@@ -9613,7 +9631,7 @@ const tg = (t) => {
|
|
|
9613
9631
|
* This source code is licensed under the ISC license.
|
|
9614
9632
|
* See the LICENSE file in the root directory of this source tree.
|
|
9615
9633
|
*/
|
|
9616
|
-
const
|
|
9634
|
+
const rg = Zi(
|
|
9617
9635
|
({
|
|
9618
9636
|
color: t = "currentColor",
|
|
9619
9637
|
size: e = 24,
|
|
@@ -9627,13 +9645,13 @@ const ng = Zi(
|
|
|
9627
9645
|
"svg",
|
|
9628
9646
|
{
|
|
9629
9647
|
ref: c,
|
|
9630
|
-
...
|
|
9648
|
+
...tg,
|
|
9631
9649
|
width: e,
|
|
9632
9650
|
height: e,
|
|
9633
9651
|
stroke: t,
|
|
9634
9652
|
strokeWidth: r ? Number(n) * 24 / Number(e) : n,
|
|
9635
9653
|
className: Bc("lucide", o),
|
|
9636
|
-
...!i && !
|
|
9654
|
+
...!i && !ng(a) && { "aria-hidden": "true" },
|
|
9637
9655
|
...a
|
|
9638
9656
|
},
|
|
9639
9657
|
[
|
|
@@ -9650,11 +9668,11 @@ const ng = Zi(
|
|
|
9650
9668
|
*/
|
|
9651
9669
|
const He = (t, e) => {
|
|
9652
9670
|
const n = Zi(
|
|
9653
|
-
({ className: r, ...o }, i) => pr(
|
|
9671
|
+
({ className: r, ...o }, i) => pr(rg, {
|
|
9654
9672
|
ref: i,
|
|
9655
9673
|
iconNode: e,
|
|
9656
9674
|
className: Bc(
|
|
9657
|
-
`lucide-${
|
|
9675
|
+
`lucide-${Qp(zi(t))}`,
|
|
9658
9676
|
`lucide-${t}`,
|
|
9659
9677
|
r
|
|
9660
9678
|
),
|
|
@@ -9669,88 +9687,88 @@ const He = (t, e) => {
|
|
|
9669
9687
|
* This source code is licensed under the ISC license.
|
|
9670
9688
|
* See the LICENSE file in the root directory of this source tree.
|
|
9671
9689
|
*/
|
|
9672
|
-
const
|
|
9690
|
+
const og = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], tn = He("check", og);
|
|
9673
9691
|
/**
|
|
9674
9692
|
* @license lucide-react v0.563.0 - ISC
|
|
9675
9693
|
*
|
|
9676
9694
|
* This source code is licensed under the ISC license.
|
|
9677
9695
|
* See the LICENSE file in the root directory of this source tree.
|
|
9678
9696
|
*/
|
|
9679
|
-
const
|
|
9697
|
+
const ig = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], sg = He("chevron-left", ig);
|
|
9680
9698
|
/**
|
|
9681
9699
|
* @license lucide-react v0.563.0 - ISC
|
|
9682
9700
|
*
|
|
9683
9701
|
* This source code is licensed under the ISC license.
|
|
9684
9702
|
* See the LICENSE file in the root directory of this source tree.
|
|
9685
9703
|
*/
|
|
9686
|
-
const
|
|
9704
|
+
const ag = [
|
|
9687
9705
|
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
9688
9706
|
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
|
9689
|
-
], qi = He("copy",
|
|
9707
|
+
], qi = He("copy", ag);
|
|
9690
9708
|
/**
|
|
9691
9709
|
* @license lucide-react v0.563.0 - ISC
|
|
9692
9710
|
*
|
|
9693
9711
|
* This source code is licensed under the ISC license.
|
|
9694
9712
|
* See the LICENSE file in the root directory of this source tree.
|
|
9695
9713
|
*/
|
|
9696
|
-
const
|
|
9714
|
+
const cg = [
|
|
9697
9715
|
["path", { d: "M12 15V3", key: "m9g1x1" }],
|
|
9698
9716
|
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
9699
9717
|
["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
|
|
9700
|
-
], Vi = He("download",
|
|
9718
|
+
], Vi = He("download", cg);
|
|
9701
9719
|
/**
|
|
9702
9720
|
* @license lucide-react v0.563.0 - ISC
|
|
9703
9721
|
*
|
|
9704
9722
|
* This source code is licensed under the ISC license.
|
|
9705
9723
|
* See the LICENSE file in the root directory of this source tree.
|
|
9706
9724
|
*/
|
|
9707
|
-
const
|
|
9725
|
+
const lg = [
|
|
9708
9726
|
["path", { d: "m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4", key: "g0fldk" }],
|
|
9709
9727
|
["path", { d: "m21 2-9.6 9.6", key: "1j0ho8" }],
|
|
9710
9728
|
["circle", { cx: "7.5", cy: "15.5", r: "5.5", key: "yqb3hr" }]
|
|
9711
|
-
],
|
|
9729
|
+
], ug = He("key", lg);
|
|
9712
9730
|
/**
|
|
9713
9731
|
* @license lucide-react v0.563.0 - ISC
|
|
9714
9732
|
*
|
|
9715
9733
|
* This source code is licensed under the ISC license.
|
|
9716
9734
|
* See the LICENSE file in the root directory of this source tree.
|
|
9717
9735
|
*/
|
|
9718
|
-
const
|
|
9736
|
+
const dg = [
|
|
9719
9737
|
["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
|
|
9720
9738
|
["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
|
|
9721
|
-
], ji = He("lock",
|
|
9739
|
+
], ji = He("lock", dg);
|
|
9722
9740
|
/**
|
|
9723
9741
|
* @license lucide-react v0.563.0 - ISC
|
|
9724
9742
|
*
|
|
9725
9743
|
* This source code is licensed under the ISC license.
|
|
9726
9744
|
* See the LICENSE file in the root directory of this source tree.
|
|
9727
9745
|
*/
|
|
9728
|
-
const
|
|
9746
|
+
const hg = [
|
|
9729
9747
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
9730
9748
|
["path", { d: "M12 5v14", key: "s699le" }]
|
|
9731
|
-
],
|
|
9749
|
+
], fg = He("plus", hg);
|
|
9732
9750
|
/**
|
|
9733
9751
|
* @license lucide-react v0.563.0 - ISC
|
|
9734
9752
|
*
|
|
9735
9753
|
* This source code is licensed under the ISC license.
|
|
9736
9754
|
* See the LICENSE file in the root directory of this source tree.
|
|
9737
9755
|
*/
|
|
9738
|
-
const
|
|
9756
|
+
const mg = [
|
|
9739
9757
|
["path", { d: "M12 3v12", key: "1x0j5s" }],
|
|
9740
9758
|
["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
|
|
9741
9759
|
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
|
|
9742
|
-
], Fi = He("upload",
|
|
9760
|
+
], Fi = He("upload", mg);
|
|
9743
9761
|
/**
|
|
9744
9762
|
* @license lucide-react v0.563.0 - ISC
|
|
9745
9763
|
*
|
|
9746
9764
|
* This source code is licensed under the ISC license.
|
|
9747
9765
|
* See the LICENSE file in the root directory of this source tree.
|
|
9748
9766
|
*/
|
|
9749
|
-
const
|
|
9767
|
+
const pg = [
|
|
9750
9768
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
9751
9769
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
9752
|
-
],
|
|
9753
|
-
function
|
|
9770
|
+
], gg = He("x", pg);
|
|
9771
|
+
function yg({ onSuccess: t }) {
|
|
9754
9772
|
const { loginWithNip07: e, loading: n, error: r, isNip07Available: o } = Vt(), { t: i } = ft(), s = async () => {
|
|
9755
9773
|
await e(), t();
|
|
9756
9774
|
};
|
|
@@ -9779,12 +9797,12 @@ function gg({ onSuccess: t }) {
|
|
|
9779
9797
|
] })
|
|
9780
9798
|
] });
|
|
9781
9799
|
}
|
|
9782
|
-
function
|
|
9800
|
+
function bg({ onSuccess: t }) {
|
|
9783
9801
|
const { loginWithBunker: e, loading: n, error: r } = Vt(), { t: o } = ft(), [i, s] = X(""), a = async (c) => {
|
|
9784
9802
|
c.preventDefault(), i.trim() && (await e(i.trim()), r || t());
|
|
9785
9803
|
};
|
|
9786
9804
|
return /* @__PURE__ */ H("div", { className: "nc-login-option nc-login-option--bunker", children: [
|
|
9787
|
-
/* @__PURE__ */ x("div", { className: "nc-login-option__icon", children: /* @__PURE__ */ x(
|
|
9805
|
+
/* @__PURE__ */ x("div", { className: "nc-login-option__icon", children: /* @__PURE__ */ x(ug, { size: 24 }) }),
|
|
9788
9806
|
/* @__PURE__ */ H("div", { className: "nc-login-option__content", children: [
|
|
9789
9807
|
/* @__PURE__ */ x("h4", { children: o("bunkerLogin") }),
|
|
9790
9808
|
/* @__PURE__ */ x("p", { children: o("bunkerLoginDesc") }),
|
|
@@ -9813,47 +9831,47 @@ function yg({ onSuccess: t }) {
|
|
|
9813
9831
|
] })
|
|
9814
9832
|
] });
|
|
9815
9833
|
}
|
|
9816
|
-
function
|
|
9834
|
+
function wg({
|
|
9817
9835
|
isOpen: t,
|
|
9818
9836
|
onClose: e,
|
|
9819
9837
|
enabledSigners: n = ["nip07", "bunker", "temp"],
|
|
9820
9838
|
className: r = ""
|
|
9821
9839
|
}) {
|
|
9822
|
-
const { isLoggedIn: o, signerInfo: i, logout: s, loginWithNsec: a, loading: c, getTempSigner: l } = Vt(), { t: d } = ft(), [u, m] = X(!1), [f, p] = X("list"), [h, y] = X(null), [w, E] = X(!1), [S,
|
|
9840
|
+
const { isLoggedIn: o, signerInfo: i, logout: s, loginWithNsec: a, loading: c, getTempSigner: l } = Vt(), { t: d } = ft(), [u, m] = X(!1), [f, p] = X("list"), [h, y] = X(null), [w, E] = X(!1), [S, O] = X(!1), [M, _] = X(""), [N, L] = X(null);
|
|
9823
9841
|
if (xt(() => {
|
|
9824
|
-
t || (p("list"), y(null), E(!1),
|
|
9842
|
+
t || (p("list"), y(null), E(!1), O(!1), _(""), L(null));
|
|
9825
9843
|
}, [t]), xt(() => (t ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
9826
9844
|
document.body.style.overflow = "";
|
|
9827
9845
|
}), [t]), xt(() => {
|
|
9828
9846
|
const q = (F) => {
|
|
9829
|
-
F.key === "Escape" && (f !== "list" ?
|
|
9847
|
+
F.key === "Escape" && (f !== "list" ? T() : e());
|
|
9830
9848
|
};
|
|
9831
9849
|
return t && window.addEventListener("keydown", q), () => window.removeEventListener("keydown", q);
|
|
9832
9850
|
}, [t, f, e]), !t) return null;
|
|
9833
9851
|
const K = () => {
|
|
9834
9852
|
e();
|
|
9835
|
-
},
|
|
9836
|
-
p("list"), y(null), E(!1),
|
|
9837
|
-
},
|
|
9853
|
+
}, T = () => {
|
|
9854
|
+
p("list"), y(null), E(!1), O(!1), _(""), L(null);
|
|
9855
|
+
}, P = async () => {
|
|
9838
9856
|
const q = l();
|
|
9839
9857
|
q && (await q.copyNsec(), m(!0), setTimeout(() => m(!1), 3e3));
|
|
9840
|
-
},
|
|
9858
|
+
}, D = () => {
|
|
9841
9859
|
const q = l();
|
|
9842
9860
|
q && q.downloadKeyFile();
|
|
9843
|
-
},
|
|
9861
|
+
}, U = async () => {
|
|
9844
9862
|
h && (await h.copyNsec(), E(!0), setTimeout(() => E(!1), 3e3));
|
|
9845
9863
|
}, k = () => {
|
|
9846
|
-
h && (h.downloadKeyFile(),
|
|
9864
|
+
h && (h.downloadKeyFile(), O(!0));
|
|
9847
9865
|
}, b = async () => {
|
|
9848
9866
|
if (h) {
|
|
9849
9867
|
const q = h.getNsec();
|
|
9850
9868
|
await a(q), K();
|
|
9851
9869
|
}
|
|
9852
9870
|
}, v = async (q) => {
|
|
9853
|
-
if (q.preventDefault(), !!
|
|
9871
|
+
if (q.preventDefault(), !!M.trim()) {
|
|
9854
9872
|
L(null);
|
|
9855
9873
|
try {
|
|
9856
|
-
await a(
|
|
9874
|
+
await a(M), K();
|
|
9857
9875
|
} catch {
|
|
9858
9876
|
L(d("importKeyError"));
|
|
9859
9877
|
}
|
|
@@ -9862,12 +9880,12 @@ function bg({
|
|
|
9862
9880
|
"button",
|
|
9863
9881
|
{
|
|
9864
9882
|
type: "button",
|
|
9865
|
-
onClick:
|
|
9883
|
+
onClick: T,
|
|
9866
9884
|
className: "nc-modal__back",
|
|
9867
9885
|
"aria-label": "Back",
|
|
9868
|
-
children: /* @__PURE__ */ x(
|
|
9886
|
+
children: /* @__PURE__ */ x(sg, { size: 20 })
|
|
9869
9887
|
}
|
|
9870
|
-
),
|
|
9888
|
+
), R = () => {
|
|
9871
9889
|
if (!h) return null;
|
|
9872
9890
|
const q = h.getNsec();
|
|
9873
9891
|
return /* @__PURE__ */ H("div", { className: "nc-temp-view nc-temp-view--created", children: [
|
|
@@ -9883,7 +9901,7 @@ function bg({
|
|
|
9883
9901
|
"button",
|
|
9884
9902
|
{
|
|
9885
9903
|
type: "button",
|
|
9886
|
-
onClick:
|
|
9904
|
+
onClick: U,
|
|
9887
9905
|
className: `nc-temp-view__key-btn ${w ? "nc-temp-view__key-btn--success" : ""}`,
|
|
9888
9906
|
title: d("copyKey"),
|
|
9889
9907
|
children: w ? /* @__PURE__ */ x(tn, { size: 16 }) : /* @__PURE__ */ x(qi, { size: 16 })
|
|
@@ -9922,7 +9940,7 @@ function bg({
|
|
|
9922
9940
|
"input",
|
|
9923
9941
|
{
|
|
9924
9942
|
type: "password",
|
|
9925
|
-
value:
|
|
9943
|
+
value: M,
|
|
9926
9944
|
onInput: (q) => {
|
|
9927
9945
|
_(q.target.value), L(null);
|
|
9928
9946
|
},
|
|
@@ -9936,7 +9954,7 @@ function bg({
|
|
|
9936
9954
|
"button",
|
|
9937
9955
|
{
|
|
9938
9956
|
type: "submit",
|
|
9939
|
-
disabled: c || !
|
|
9957
|
+
disabled: c || !M.trim(),
|
|
9940
9958
|
className: "nc-temp-view__submit",
|
|
9941
9959
|
children: d("login")
|
|
9942
9960
|
}
|
|
@@ -9954,7 +9972,7 @@ function bg({
|
|
|
9954
9972
|
onClick: e,
|
|
9955
9973
|
className: "nc-modal__close",
|
|
9956
9974
|
"aria-label": "Close",
|
|
9957
|
-
children: /* @__PURE__ */ x(
|
|
9975
|
+
children: /* @__PURE__ */ x(gg, { size: 20 })
|
|
9958
9976
|
}
|
|
9959
9977
|
)
|
|
9960
9978
|
] }),
|
|
@@ -9978,7 +9996,7 @@ function bg({
|
|
|
9978
9996
|
"button",
|
|
9979
9997
|
{
|
|
9980
9998
|
type: "button",
|
|
9981
|
-
onClick:
|
|
9999
|
+
onClick: P,
|
|
9982
10000
|
className: `nc-temp-actions__btn ${u ? "nc-temp-actions__btn--success" : ""}`,
|
|
9983
10001
|
children: [
|
|
9984
10002
|
u ? /* @__PURE__ */ x(tn, { size: 16 }) : /* @__PURE__ */ x(qi, { size: 16 }),
|
|
@@ -9990,7 +10008,7 @@ function bg({
|
|
|
9990
10008
|
"button",
|
|
9991
10009
|
{
|
|
9992
10010
|
type: "button",
|
|
9993
|
-
onClick:
|
|
10011
|
+
onClick: D,
|
|
9994
10012
|
className: "nc-temp-actions__btn",
|
|
9995
10013
|
children: [
|
|
9996
10014
|
/* @__PURE__ */ x(Vi, { size: 16 }),
|
|
@@ -10011,11 +10029,11 @@ function bg({
|
|
|
10011
10029
|
children: d("logout")
|
|
10012
10030
|
}
|
|
10013
10031
|
)
|
|
10014
|
-
] }) : f === "create" ?
|
|
10032
|
+
] }) : f === "create" ? R() : f === "import" ? z() : /* @__PURE__ */ H(Do, { children: [
|
|
10015
10033
|
/* @__PURE__ */ x("p", { className: "nc-modal__description", children: d("loginDescription") }),
|
|
10016
10034
|
/* @__PURE__ */ H("div", { className: "nc-login-options", children: [
|
|
10017
|
-
n.includes("nip07") && /* @__PURE__ */ x(
|
|
10018
|
-
n.includes("bunker") && /* @__PURE__ */ x(
|
|
10035
|
+
n.includes("nip07") && /* @__PURE__ */ x(yg, { onSuccess: K }),
|
|
10036
|
+
n.includes("bunker") && /* @__PURE__ */ x(bg, { onSuccess: K }),
|
|
10019
10037
|
n.includes("temp") && /* @__PURE__ */ H(Do, { children: [
|
|
10020
10038
|
/* @__PURE__ */ H(
|
|
10021
10039
|
"button",
|
|
@@ -10027,7 +10045,7 @@ function bg({
|
|
|
10027
10045
|
},
|
|
10028
10046
|
className: "nc-login-option",
|
|
10029
10047
|
children: [
|
|
10030
|
-
/* @__PURE__ */ x("div", { className: "nc-login-option__icon", children: /* @__PURE__ */ x(
|
|
10048
|
+
/* @__PURE__ */ x("div", { className: "nc-login-option__icon", children: /* @__PURE__ */ x(fg, { size: 24 }) }),
|
|
10031
10049
|
/* @__PURE__ */ H("div", { className: "nc-login-option__content", children: [
|
|
10032
10050
|
/* @__PURE__ */ x("h4", { children: d("createAccount") }),
|
|
10033
10051
|
/* @__PURE__ */ x("p", { children: d("tempAccountDesc") })
|
|
@@ -10057,7 +10075,7 @@ function bg({
|
|
|
10057
10075
|
}
|
|
10058
10076
|
new TextDecoder("utf-8");
|
|
10059
10077
|
new TextEncoder();
|
|
10060
|
-
function
|
|
10078
|
+
function vg(t) {
|
|
10061
10079
|
let e = 0;
|
|
10062
10080
|
for (let n = 0; n < 64; n += 8) {
|
|
10063
10081
|
const r = parseInt(t.substring(n, n + 8), 16);
|
|
@@ -10070,23 +10088,23 @@ function wg(t) {
|
|
|
10070
10088
|
}
|
|
10071
10089
|
return e;
|
|
10072
10090
|
}
|
|
10073
|
-
function
|
|
10091
|
+
function xg(t) {
|
|
10074
10092
|
const { url: e, relays: n, mention: r, pageSize: o = 50, pow: i = 18 } = t, [s, a] = X([]), [c, l] = X(!0), [d, u] = X(!1), [m, f] = X(null), [p, h] = X(), y = JSON.stringify(n), w = _e(async () => {
|
|
10075
10093
|
l(!0), f(null), a([]);
|
|
10076
10094
|
const _ = [];
|
|
10077
10095
|
let N = !1;
|
|
10078
|
-
return
|
|
10096
|
+
return Tp({
|
|
10079
10097
|
url: e,
|
|
10080
10098
|
relays: await Or(n, r),
|
|
10081
10099
|
limit: o,
|
|
10082
10100
|
onEvent: (K) => {
|
|
10083
|
-
N ? a((
|
|
10101
|
+
N ? a((T) => T.some((P) => P.id === K.id) ? T : [K, ...T]) : _.push(K);
|
|
10084
10102
|
},
|
|
10085
10103
|
onEose: () => {
|
|
10086
10104
|
N = !0;
|
|
10087
|
-
const
|
|
10088
|
-
a(
|
|
10089
|
-
|
|
10105
|
+
const T = _.sort((P, D) => D.created_at - P.created_at).slice(0, o);
|
|
10106
|
+
a(T), h(
|
|
10107
|
+
T.length >= o ? T[T.length - 1].created_at - 1 : void 0
|
|
10090
10108
|
), l(!1);
|
|
10091
10109
|
}
|
|
10092
10110
|
});
|
|
@@ -10094,7 +10112,7 @@ function vg(t) {
|
|
|
10094
10112
|
if (!(c || d || p === void 0)) {
|
|
10095
10113
|
u(!0);
|
|
10096
10114
|
try {
|
|
10097
|
-
const _ = await
|
|
10115
|
+
const _ = await Pp({
|
|
10098
10116
|
url: e,
|
|
10099
10117
|
relays: await Or(n, r),
|
|
10100
10118
|
limit: o,
|
|
@@ -10106,7 +10124,7 @@ function vg(t) {
|
|
|
10106
10124
|
}
|
|
10107
10125
|
a((N) => {
|
|
10108
10126
|
const L = _.filter(
|
|
10109
|
-
(K) => !N.some((
|
|
10127
|
+
(K) => !N.some((T) => T.id === K.id)
|
|
10110
10128
|
);
|
|
10111
10129
|
return [...N, ...L];
|
|
10112
10130
|
}), h(_[_.length - 1].created_at - 1);
|
|
@@ -10125,19 +10143,19 @@ function vg(t) {
|
|
|
10125
10143
|
}, [w]);
|
|
10126
10144
|
const S = _e((_) => {
|
|
10127
10145
|
a((N) => N.some((L) => L.id === _.id) ? N : [_, ...N]);
|
|
10128
|
-
}, []), { comments:
|
|
10129
|
-
const _ = i && i > 0 ? s.filter((
|
|
10146
|
+
}, []), { comments: O, commentCount: M } = Pc(() => {
|
|
10147
|
+
const _ = i && i > 0 ? s.filter((T) => vg(T.id) >= i) : s, N = Op(_);
|
|
10130
10148
|
let L = 0;
|
|
10131
|
-
const K = (
|
|
10132
|
-
|
|
10133
|
-
L++, K(
|
|
10149
|
+
const K = (T) => {
|
|
10150
|
+
T.forEach((P) => {
|
|
10151
|
+
L++, K(P.children);
|
|
10134
10152
|
});
|
|
10135
10153
|
};
|
|
10136
10154
|
return K(N), { comments: N, commentCount: L };
|
|
10137
10155
|
}, [s, i]);
|
|
10138
10156
|
return {
|
|
10139
|
-
comments:
|
|
10140
|
-
commentCount:
|
|
10157
|
+
comments: O,
|
|
10158
|
+
commentCount: M,
|
|
10141
10159
|
events: s,
|
|
10142
10160
|
loading: c,
|
|
10143
10161
|
loadingMore: d,
|
|
@@ -10148,98 +10166,101 @@ function vg(t) {
|
|
|
10148
10166
|
addEvent: S
|
|
10149
10167
|
};
|
|
10150
10168
|
}
|
|
10151
|
-
const xg = ':where(.nostr-comments){--nc-bg: #ffffff;--nc-text: #1f2937;--nc-primary: #319cfc;--nc-error: #dc2626;--nc-success: #16a34a;--nc-bg-secondary: color-mix(in srgb, var(--nc-text) 4%, var(--nc-bg));--nc-bg-hover: color-mix(in srgb, var(--nc-text) 6%, var(--nc-bg));--nc-border: color-mix(in srgb, var(--nc-text) 18%, var(--nc-bg));--nc-text-secondary: color-mix(in srgb, var(--nc-text) 60%, var(--nc-bg));--nc-text-muted: color-mix(in srgb, var(--nc-text) 40%, var(--nc-bg));--nc-primary-hover: color-mix(in srgb, var(--nc-primary) 85%, black);--nc-primary-light: color-mix(in srgb, var(--nc-primary) 8%, var(--nc-bg));--nc-error-light: color-mix(in srgb, var(--nc-error) 6%, var(--nc-bg));--nc-success-light: color-mix(in srgb, var(--nc-success) 12%, var(--nc-bg));--nc-space-xs: 3px;--nc-space-sm: 6px;--nc-space-md: 10px;--nc-space-lg: 14px;--nc-space-xl: 20px;--nc-radius-sm: 6px;--nc-radius-md: 8px;--nc-radius-lg: 10px;--nc-radius-xl: 16px;--nc-radius-full: 9999px;--nc-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;--nc-font-size-xs: 11px;--nc-font-size-sm: 12px;--nc-font-size-md: 13px;--nc-font-size-lg: 15px;--nc-avatar-radius: 50%;--nc-shadow-sm: 0 1px 3px rgba(0, 0, 0, .04);--nc-shadow-md: 0 4px 12px rgba(0, 0, 0, .06);--nc-shadow-lg: 0 12px 32px rgba(0, 0, 0, .12);--nc-transition: .2s ease-out}:where(.nostr-comments[data-theme=dark]){--nc-bg: #0d1117;--nc-text: #e6edf3;--nc-primary: #58a6ff;--nc-primary-hover: color-mix(in srgb, var(--nc-primary) 85%, white);--nc-error: #f85149;--nc-success: #3fb950;--nc-border: #30363d;--nc-bg-secondary: #161b22;--nc-bg-hover: #21262d;--nc-primary-light: rgba(88, 166, 255, .15);--nc-error-light: rgba(248, 81, 73, .15);--nc-success-light: rgba(63, 185, 80, .15)}@media(prefers-color-scheme:dark){:where(.nostr-comments[data-theme=auto]){--nc-bg: #0d1117;--nc-text: #e6edf3;--nc-primary: #58a6ff;--nc-primary-hover: color-mix(in srgb, var(--nc-primary) 85%, white);--nc-error: #f85149;--nc-success: #3fb950;--nc-border: #30363d;--nc-bg-secondary: #161b22;--nc-bg-hover: #21262d;--nc-primary-light: rgba(88, 166, 255, .15);--nc-error-light: rgba(248, 81, 73, .15);--nc-success-light: rgba(63, 185, 80, .15)}}.nostr-comments:not([data-headless=true]){font-family:var(--nc-font-family);font-size:var(--nc-font-size-md);color:var(--nc-text);line-height:1.5}.nostr-comments:not([data-headless=true]) *{box-sizing:border-box}.nostr-comments:not([data-headless=true]) .nc-header{margin-bottom:var(--nc-space-lg)}.nostr-comments:not([data-headless=true]) .nc-title{font-size:var(--nc-font-size-lg);font-weight:600;margin:0;display:flex;align-items:center;gap:var(--nc-space-sm)}.nostr-comments:not([data-headless=true]) .nc-count{font-weight:400;color:var(--nc-text-secondary)}.nostr-comments:not([data-headless=true]) .nc-editor{margin-bottom:var(--nc-space-xl)}.nostr-comments:not([data-headless=true]) .nc-editor__reply-to{display:flex;align-items:center;gap:var(--nc-space-sm);padding:var(--nc-space-sm) var(--nc-space-md);background:var(--nc-primary-light);border-radius:var(--nc-radius-md);margin-bottom:var(--nc-space-md);font-size:var(--nc-font-size-sm);color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-editor__reply-to-label{font-weight:500;flex-shrink:0}.nostr-comments:not([data-headless=true]) .nc-editor__reply-to-author{color:var(--nc-primary);font-weight:500;flex-shrink:0}.nostr-comments:not([data-headless=true]) .nc-editor__reply-to-author:after{content:":"}.nostr-comments:not([data-headless=true]) .nc-editor__reply-to-content{color:var(--nc-text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nostr-comments:not([data-headless=true]) .nc-editor__cancel-reply{margin-left:auto;background:none;border:none;color:var(--nc-text-secondary);cursor:pointer;padding:var(--nc-space-xs) var(--nc-space-sm);border-radius:var(--nc-radius-sm);transition:background var(--nc-transition);flex-shrink:0}.nostr-comments:not([data-headless=true]) .nc-editor__cancel-reply:hover{color:var(--nc-text)}.nostr-comments:not([data-headless=true]) .nc-editor__main{display:flex;gap:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-editor__input-wrapper{flex:1}.nostr-comments:not([data-headless=true]) .nc-editor__textarea{width:100%;padding:var(--nc-space-md);border:1px solid var(--nc-border);border-radius:var(--nc-radius-md);background:color-mix(in srgb,var(--nc-bg) 60%,transparent);color:var(--nc-text);font-family:inherit;font-size:var(--nc-font-size-md);resize:vertical;min-height:96px;transition:border-color var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-editor__textarea:focus{outline:none;border-color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-editor__textarea::placeholder{color:var(--nc-text-muted)}.nostr-comments:not([data-headless=true]) .nc-editor__actions{display:flex;justify-content:flex-end;margin-top:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-editor__submit{padding:var(--nc-space-sm) var(--nc-space-xl);background:var(--nc-primary);color:#fff;border:none;border-radius:var(--nc-radius-md);font-weight:500;cursor:pointer;transition:background var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-editor__submit:hover:not(:disabled){background:var(--nc-primary-hover)}.nostr-comments:not([data-headless=true]) .nc-editor__submit:disabled{opacity:.6;cursor:not-allowed}.nostr-comments:not([data-headless=true]) .nc-list{display:flex;flex-direction:column}.nostr-comments:not([data-headless=true]) .nc-loading,.nostr-comments:not([data-headless=true]) .nc-empty,.nostr-comments:not([data-headless=true]) .nc-error{text-align:center;padding:var(--nc-space-xl);color:var(--nc-text-secondary)}.nostr-comments:not([data-headless=true]) .nc-loading{display:flex;align-items:center;justify-content:center;gap:var(--nc-space-sm)}.nostr-comments:not([data-headless=true]) .nc-loading__spinner{width:16px;height:16px;border:1.5px solid var(--nc-border);border-top-color:var(--nc-primary);border-radius:50%;animation:nc-spin .8s linear infinite}@keyframes nc-spin{to{transform:rotate(360deg)}}.nostr-comments:not([data-headless=true]) .nc-error__retry{margin-top:var(--nc-space-md);padding:var(--nc-space-sm) var(--nc-space-lg);background:var(--nc-bg-secondary);border:1px solid var(--nc-border);border-radius:var(--nc-radius-md);cursor:pointer;color:var(--nc-text);transition:background var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-error__retry:hover{background:var(--nc-bg-hover)}.nostr-comments:not([data-headless=true]) .nc-comment{padding-top:var(--nc-space-lg)}.nostr-comments:not([data-headless=true]) .nc-comment:first-child{padding-top:0}.nostr-comments:not([data-headless=true]) .nc-comment__main{display:flex;align-items:flex-start;gap:var(--nc-space-md);position:relative}.nostr-comments:not([data-headless=true]) .nc-comment__vline{position:absolute;left:20px;top:48px;bottom:0;border-left:1.5px solid var(--nc-border)}.nostr-comments:not([data-headless=true]) .nc-comment__content{flex:1;min-width:0;padding-top:2px}.nostr-comments:not([data-headless=true]) .nc-comment__header{margin-bottom:var(--nc-space-xs);display:flex}.nostr-comments:not([data-headless=true]) .nc-comment__author{font-weight:500;color:var(--nc-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nostr-comments:not([data-headless=true]) .nc-comment__text{margin:0;color:var(--nc-text);white-space:pre-wrap;word-wrap:break-word}.nostr-comments:not([data-headless=true]) .nc-comment__actions{display:flex;align-items:center;gap:var(--nc-space-md);margin-top:var(--nc-space-xs);font-size:var(--nc-font-size-sm)}.nostr-comments:not([data-headless=true]) .nc-comment__time{color:var(--nc-text-muted)}.nostr-comments:not([data-headless=true]) .nc-comment__reply-btn{background:none;border:none;color:var(--nc-text-secondary);cursor:pointer;padding:0;font-size:var(--nc-font-size-sm);transition:color var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-comment__reply-btn:hover{color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-comment__child-wrapper{position:relative;padding-left:50px}.nostr-comments:not([data-headless=true]) .nc-comment__connector{position:absolute;left:20px;top:0;width:26px;height:32px;border-left:1.5px solid var(--nc-border);border-bottom:1.5px solid var(--nc-border);border-bottom-left-radius:var(--nc-radius-xl)}.nostr-comments:not([data-headless=true]) .nc-comment__connector-line{position:absolute;left:20px;top:0;bottom:0;border-left:1.5px solid var(--nc-border)}.nostr-comments:not([data-headless=true]) .nc-comment__reply-preview{display:flex;align-items:center;gap:var(--nc-space-xs);padding:var(--nc-space-xs) var(--nc-space-sm);margin-bottom:var(--nc-space-xs);background:var(--nc-bg-secondary);border-radius:var(--nc-radius-sm);border-left:2px solid var(--nc-primary);font-size:var(--nc-font-size-sm);color:var(--nc-text-muted);overflow:hidden;width:fit-content;max-width:100%}.nostr-comments:not([data-headless=true]) .nc-comment__reply-preview-author{color:var(--nc-primary);font-weight:500;flex-shrink:0}.nostr-comments:not([data-headless=true]) .nc-comment__reply-preview-author:after{content:":"}.nostr-comments:not([data-headless=true]) .nc-comment__reply-preview-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--nc-text-secondary)}.nostr-comments:not([data-headless=true]) .nc-load-more{display:block;width:100%;padding:var(--nc-space-md);margin-top:var(--nc-space-lg);background:transparent;border:none;color:var(--nc-text-muted);font-size:var(--nc-font-size-sm);cursor:pointer;transition:color var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-load-more:hover:not(:disabled){color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-load-more:disabled{cursor:wait}.nostr-comments:not([data-headless=true]) .nc-avatar-link{flex-shrink:0;text-decoration:none;margin-top:4px}.nostr-comments:not([data-headless=true]) .nc-avatar-link:hover{opacity:.8}.nostr-comments:not([data-headless=true]) .nc-avatar{flex-shrink:0;border-radius:var(--nc-avatar-radius, 50%);object-fit:cover;aspect-ratio:1 / 1}.nostr-comments:not([data-headless=true]) .nc-username{color:inherit;text-decoration:none}.nostr-comments:not([data-headless=true]) .nc-username:hover{text-decoration:underline}.nostr-comments:not([data-headless=true]) .nc-modal-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:9999;padding:var(--nc-space-lg)}.nostr-comments:not([data-headless=true]) .nc-modal{background:var(--nc-bg);border-radius:var(--nc-radius-xl);width:100%;max-width:400px;max-height:90vh;overflow-y:auto;box-shadow:var(--nc-shadow-lg)}.nostr-comments:not([data-headless=true]) .nc-modal__header{display:flex;align-items:center;padding:var(--nc-space-lg);border-bottom:1px solid var(--nc-border)}.nostr-comments:not([data-headless=true]) .nc-modal__header h3{margin:0;font-size:var(--nc-font-size-lg);font-weight:600;flex:1}.nostr-comments:not([data-headless=true]) .nc-modal__back{background:none;border:none;color:var(--nc-text-secondary);cursor:pointer;padding:var(--nc-space-xs);border-radius:50%;display:flex;transition:background var(--nc-transition);margin-right:var(--nc-space-sm)}.nostr-comments:not([data-headless=true]) .nc-modal__back:hover{background:var(--nc-bg-hover)}.nostr-comments:not([data-headless=true]) .nc-modal__close{background:none;border:none;color:var(--nc-text-secondary);cursor:pointer;padding:var(--nc-space-xs);border-radius:50%;display:flex;margin-left:auto;transition:background var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-modal__close:hover{background:var(--nc-bg-hover)}.nostr-comments:not([data-headless=true]) .nc-modal__body{padding:var(--nc-space-lg)}.nostr-comments:not([data-headless=true]) .nc-modal__description{margin:0 0 var(--nc-space-lg);color:var(--nc-text-secondary)}.nostr-comments:not([data-headless=true]) .nc-login-options{display:flex;flex-direction:column;gap:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-login-option{display:flex;gap:var(--nc-space-md);padding:var(--nc-space-lg);background:var(--nc-bg-secondary);border:1px solid var(--nc-border);border-radius:var(--nc-radius-md);text-align:left;cursor:pointer;transition:border-color var(--nc-transition),background var(--nc-transition);width:100%}.nostr-comments:not([data-headless=true]) .nc-login-option:hover:not(:disabled):not(.nc-login-option--disabled){border-color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-login-option--disabled{opacity:.6;cursor:not-allowed}.nostr-comments:not([data-headless=true]) .nc-login-option--bunker{cursor:default;flex-direction:column}.nostr-comments:not([data-headless=true]) .nc-login-option--bunker .nc-login-option__icon{display:none}.nostr-comments:not([data-headless=true]) .nc-login-option__icon{flex-shrink:0;width:36px;height:36px;display:flex;align-items:center;justify-content:center;background:var(--nc-primary-light);color:var(--nc-primary);border-radius:50%}.nostr-comments:not([data-headless=true]) .nc-login-option__icon--success{background:var(--nc-success-light);color:var(--nc-success)}.nostr-comments:not([data-headless=true]) .nc-login-option__content h4{margin:0 0 var(--nc-space-xs);font-size:var(--nc-font-size-md);font-weight:500;color:var(--nc-text)}.nostr-comments:not([data-headless=true]) .nc-login-option__content p{margin:0;font-size:var(--nc-font-size-sm);color:var(--nc-text-secondary)}.nostr-comments:not([data-headless=true]) .nc-login-option__hint{margin-top:var(--nc-space-sm)!important;color:var(--nc-text-muted)!important;font-style:italic}.nostr-comments:not([data-headless=true]) .nc-login-option__error{margin-top:var(--nc-space-sm)!important;color:var(--nc-error)!important}.nostr-comments:not([data-headless=true]) .nc-login-option__warning{margin-top:var(--nc-space-sm)!important;padding:var(--nc-space-sm);background:var(--nc-error-light);border-radius:var(--nc-radius-sm);color:var(--nc-error)!important;font-size:var(--nc-font-size-sm)!important}.nostr-comments:not([data-headless=true]) .nc-bunker-form{display:flex;gap:var(--nc-space-sm);margin-top:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-bunker-form__input{flex:1;padding:var(--nc-space-sm) var(--nc-space-md);border:1px solid var(--nc-border);border-radius:var(--nc-radius-sm);background:var(--nc-bg);color:var(--nc-text);font-size:var(--nc-font-size-sm)}.nostr-comments:not([data-headless=true]) .nc-bunker-form__input:focus{outline:none;border-color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-bunker-form__submit{padding:var(--nc-space-sm) var(--nc-space-lg);background:var(--nc-primary);color:#fff;border:none;border-radius:var(--nc-radius-md);cursor:pointer;white-space:nowrap;transition:background var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-bunker-form__submit:hover:not(:disabled){background:var(--nc-primary-hover)}.nostr-comments:not([data-headless=true]) .nc-bunker-form__submit:disabled{opacity:.6;cursor:not-allowed}.nostr-comments:not([data-headless=true]) .nc-temp-nsec{margin-top:var(--nc-space-md);padding:var(--nc-space-md);background:var(--nc-bg);border:1px solid var(--nc-border);border-radius:var(--nc-radius-sm);overflow:hidden}.nostr-comments:not([data-headless=true]) .nc-temp-nsec__code{display:block;font-family:monospace;font-size:var(--nc-font-size-xs);color:var(--nc-text);word-break:break-all;-webkit-user-select:all;user-select:all}.nostr-comments:not([data-headless=true]) .nc-login-option__compatibility{margin-top:var(--nc-space-sm)!important;padding:var(--nc-space-sm);background:var(--nc-primary-light);border-radius:var(--nc-radius-sm);color:var(--nc-primary)!important;font-size:var(--nc-font-size-sm)!important}.nostr-comments:not([data-headless=true]) .nc-temp-actions{display:flex;gap:var(--nc-space-sm);margin-top:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-temp-actions__btn{flex:1;display:flex;align-items:center;justify-content:center;gap:var(--nc-space-xs);padding:var(--nc-space-sm) var(--nc-space-md);background:var(--nc-bg);border:1px solid var(--nc-border);border-radius:var(--nc-radius-md);color:var(--nc-text);cursor:pointer;font-size:var(--nc-font-size-sm);transition:background var(--nc-transition),border-color var(--nc-transition),color var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-temp-actions__btn:hover{background:var(--nc-bg-hover)}.nostr-comments:not([data-headless=true]) .nc-temp-actions__btn--success{background:var(--nc-success-light);border-color:var(--nc-success);color:var(--nc-success)}.nostr-comments:not([data-headless=true]) .nc-temp-actions__btn--success:hover{background:var(--nc-success-light)}.nostr-comments:not([data-headless=true]) .nc-temp-actions__continue{width:100%;margin-top:var(--nc-space-md);padding:var(--nc-space-sm) var(--nc-space-md);background:var(--nc-primary);border:none;border-radius:var(--nc-radius-md);color:#fff;cursor:pointer;font-weight:500;transition:background var(--nc-transition),opacity var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-temp-actions__continue:hover{background:var(--nc-primary-hover)}.nostr-comments:not([data-headless=true]) .nc-temp-actions__continue--muted{opacity:.6}.nostr-comments:not([data-headless=true]) .nc-import-form{display:flex;gap:var(--nc-space-sm);margin-top:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-import-form__input{flex:1;padding:var(--nc-space-sm) var(--nc-space-md);border:1px solid var(--nc-border);border-radius:var(--nc-radius-sm);background:var(--nc-bg);color:var(--nc-text);font-family:monospace;font-size:var(--nc-font-size-sm)}.nostr-comments:not([data-headless=true]) .nc-import-form__input:focus{outline:none;border-color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-import-form__submit{padding:var(--nc-space-sm) var(--nc-space-md);background:var(--nc-primary);color:#fff;border:none;border-radius:var(--nc-radius-sm);cursor:pointer;white-space:nowrap;transition:background var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-import-form__submit:hover:not(:disabled){background:var(--nc-primary-hover)}.nostr-comments:not([data-headless=true]) .nc-import-form__submit:disabled{opacity:.6;cursor:not-allowed}.nostr-comments:not([data-headless=true]) .nc-import-form__back{margin-top:var(--nc-space-md);padding:var(--nc-space-sm);background:none;border:none;color:var(--nc-text-secondary);cursor:pointer;font-size:var(--nc-font-size-sm);transition:color var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-import-form__back:hover{color:var(--nc-text)}.nostr-comments:not([data-headless=true]) .nc-temp-view{display:flex;flex-direction:column;align-items:center;text-align:center;padding:var(--nc-space-xl) 0}.nostr-comments:not([data-headless=true]) .nc-temp-view__icon{width:52px;height:52px;display:flex;align-items:center;justify-content:center;background:var(--nc-primary-light);color:var(--nc-primary);border-radius:50%;margin-bottom:var(--nc-space-lg)}.nostr-comments:not([data-headless=true]) .nc-temp-view__icon--success{width:36px;height:36px;background:var(--nc-success-light);color:var(--nc-success);margin-bottom:0}.nostr-comments:not([data-headless=true]) .nc-temp-view__title{margin:0 0 var(--nc-space-sm);font-size:var(--nc-font-size-lg);font-weight:600;color:var(--nc-text)}.nostr-comments:not([data-headless=true]) .nc-temp-view__desc{margin:0 0 var(--nc-space-xl);color:var(--nc-text-secondary);max-width:320px}.nostr-comments:not([data-headless=true]) .nc-temp-view--created{padding:var(--nc-space-lg) 0}.nostr-comments:not([data-headless=true]) .nc-temp-view__header{display:flex;align-items:center;gap:var(--nc-space-md);margin-bottom:var(--nc-space-lg)}.nostr-comments:not([data-headless=true]) .nc-temp-view__header .nc-temp-view__title{margin:0}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-section{width:100%;margin-bottom:var(--nc-space-lg)}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-box{display:flex;align-items:center;gap:var(--nc-space-sm);padding:var(--nc-space-md);background:var(--nc-bg-secondary);border:1px solid var(--nc-border);border-radius:var(--nc-radius-md)}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-code{flex:1;font-family:monospace;font-size:var(--nc-font-size-xs);color:var(--nc-text);word-break:break-all;text-align:left;-webkit-user-select:all;user-select:all}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-actions{display:flex;gap:var(--nc-space-xs);flex-shrink:0}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-btn{display:flex;align-items:center;justify-content:center;width:28px;height:28px;background:var(--nc-bg);border:1px solid var(--nc-border);border-radius:50%;color:var(--nc-text-secondary);cursor:pointer;transition:all var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-btn:hover{border-color:var(--nc-primary);color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-btn--success{background:var(--nc-success-light);border-color:var(--nc-success);color:var(--nc-success)}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-hint{margin:var(--nc-space-sm) 0 0;font-size:var(--nc-font-size-sm);color:var(--nc-text-muted);text-align:left}.nostr-comments:not([data-headless=true]) .nc-temp-view__form{width:100%;max-width:320px;display:flex;flex-direction:column;gap:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-temp-view__input{width:100%;padding:var(--nc-space-md);border:1px solid var(--nc-border);border-radius:var(--nc-radius-md);background:var(--nc-bg);color:var(--nc-text);font-family:monospace;font-size:var(--nc-font-size-sm);text-align:center}.nostr-comments:not([data-headless=true]) .nc-temp-view__input:focus{outline:none;border-color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-temp-view__input::placeholder{font-family:var(--nc-font-family)}.nostr-comments:not([data-headless=true]) .nc-temp-view__error{margin:0;color:var(--nc-error);font-size:var(--nc-font-size-sm)}.nostr-comments:not([data-headless=true]) .nc-temp-view__submit{width:100%;padding:var(--nc-space-md);background:var(--nc-primary);color:#fff;border:none;border-radius:var(--nc-radius-md);font-weight:500;font-size:var(--nc-font-size-md);cursor:pointer;transition:background var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-temp-view__submit:hover:not(:disabled){background:var(--nc-primary-hover)}.nostr-comments:not([data-headless=true]) .nc-temp-view__submit:disabled{opacity:.6;cursor:not-allowed}.nostr-comments:not([data-headless=true]) .nc-logged-in{display:flex;flex-direction:column;gap:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-logged-in__user{display:flex;align-items:center;gap:var(--nc-space-md);padding:var(--nc-space-md);background:var(--nc-bg-secondary);border-radius:var(--nc-radius-md)}.nostr-comments:not([data-headless=true]) .nc-logged-in__info{display:flex;flex-direction:column;gap:var(--nc-space-xs)}.nostr-comments:not([data-headless=true]) .nc-logged-in__name{font-weight:500;color:var(--nc-text)}.nostr-comments:not([data-headless=true]) .nc-logged-in__type{font-size:var(--nc-font-size-sm);color:var(--nc-text-muted)}.nostr-comments:not([data-headless=true]) .nc-logged-in__temp-backup{display:flex;flex-direction:column;gap:var(--nc-space-sm)}.nostr-comments:not([data-headless=true]) .nc-logged-in__logout{margin-top:var(--nc-space-sm);padding:var(--nc-space-sm) var(--nc-space-lg);background:var(--nc-error-light);border:1px solid var(--nc-error);border-radius:var(--nc-radius-md);color:var(--nc-error);cursor:pointer;transition:background var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-logged-in__logout:hover{background:var(--nc-error);color:#fff}', Wi = "nostr-comments-styles";
|
|
10152
|
-
function
|
|
10169
|
+
const Eg = ':where(.nostr-comments){--nc-bg: #ffffff;--nc-text: #1f2937;--nc-primary: #319cfc;--nc-error: #dc2626;--nc-success: #16a34a;--nc-bg-secondary: color-mix(in srgb, var(--nc-text) 4%, var(--nc-bg));--nc-bg-hover: color-mix(in srgb, var(--nc-text) 6%, var(--nc-bg));--nc-border: color-mix(in srgb, var(--nc-text) 18%, var(--nc-bg));--nc-text-secondary: color-mix(in srgb, var(--nc-text) 60%, var(--nc-bg));--nc-text-muted: color-mix(in srgb, var(--nc-text) 40%, var(--nc-bg));--nc-primary-hover: color-mix(in srgb, var(--nc-primary) 85%, black);--nc-primary-light: color-mix(in srgb, var(--nc-primary) 8%, var(--nc-bg));--nc-error-light: color-mix(in srgb, var(--nc-error) 6%, var(--nc-bg));--nc-success-light: color-mix(in srgb, var(--nc-success) 12%, var(--nc-bg));--nc-space-xs: 3px;--nc-space-sm: 6px;--nc-space-md: 10px;--nc-space-lg: 14px;--nc-space-xl: 20px;--nc-radius-sm: 6px;--nc-radius-md: 8px;--nc-radius-lg: 10px;--nc-radius-xl: 16px;--nc-radius-full: 9999px;--nc-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;--nc-font-size-xs: 11px;--nc-font-size-sm: 12px;--nc-font-size-md: 13px;--nc-font-size-lg: 15px;--nc-avatar-radius: 50%;--nc-shadow-sm: 0 1px 3px rgba(0, 0, 0, .04);--nc-shadow-md: 0 4px 12px rgba(0, 0, 0, .06);--nc-shadow-lg: 0 12px 32px rgba(0, 0, 0, .12);--nc-transition: .2s ease-out}:where(.nostr-comments[data-theme=dark]){--nc-bg: #0d1117;--nc-text: #e6edf3;--nc-primary: #58a6ff;--nc-primary-hover: color-mix(in srgb, var(--nc-primary) 85%, white);--nc-error: #f85149;--nc-success: #3fb950;--nc-border: #30363d;--nc-bg-secondary: #161b22;--nc-bg-hover: #21262d;--nc-primary-light: rgba(88, 166, 255, .15);--nc-error-light: rgba(248, 81, 73, .15);--nc-success-light: rgba(63, 185, 80, .15)}@media(prefers-color-scheme:dark){:where(.nostr-comments[data-theme=auto]){--nc-bg: #0d1117;--nc-text: #e6edf3;--nc-primary: #58a6ff;--nc-primary-hover: color-mix(in srgb, var(--nc-primary) 85%, white);--nc-error: #f85149;--nc-success: #3fb950;--nc-border: #30363d;--nc-bg-secondary: #161b22;--nc-bg-hover: #21262d;--nc-primary-light: rgba(88, 166, 255, .15);--nc-error-light: rgba(248, 81, 73, .15);--nc-success-light: rgba(63, 185, 80, .15)}}.nostr-comments:not([data-headless=true]){font-family:var(--nc-font-family);font-size:var(--nc-font-size-md);color:var(--nc-text);line-height:1.5}.nostr-comments:not([data-headless=true]) *{box-sizing:border-box}.nostr-comments:not([data-headless=true]) .nc-header{margin-bottom:var(--nc-space-lg)}.nostr-comments:not([data-headless=true]) .nc-title{font-size:var(--nc-font-size-lg);font-weight:600;margin:0;display:flex;align-items:center;gap:var(--nc-space-sm)}.nostr-comments:not([data-headless=true]) .nc-count{font-weight:400;color:var(--nc-text-secondary)}.nostr-comments:not([data-headless=true]) .nc-editor{margin-bottom:var(--nc-space-xl)}.nostr-comments:not([data-headless=true]) .nc-editor__reply-to{display:flex;align-items:center;gap:var(--nc-space-sm);padding:var(--nc-space-sm) var(--nc-space-md);background:var(--nc-primary-light);border-radius:var(--nc-radius-md);margin-bottom:var(--nc-space-md);font-size:var(--nc-font-size-sm);color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-editor__reply-to-label{font-weight:500;flex-shrink:0}.nostr-comments:not([data-headless=true]) .nc-editor__reply-to-author{color:var(--nc-primary);font-weight:500;flex-shrink:0}.nostr-comments:not([data-headless=true]) .nc-editor__reply-to-author:after{content:":"}.nostr-comments:not([data-headless=true]) .nc-editor__reply-to-content{color:var(--nc-text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nostr-comments:not([data-headless=true]) .nc-editor__cancel-reply{margin-left:auto;background:none;border:none;color:var(--nc-text-secondary);cursor:pointer;padding:var(--nc-space-xs) var(--nc-space-sm);border-radius:var(--nc-radius-sm);transition:background var(--nc-transition);flex-shrink:0}.nostr-comments:not([data-headless=true]) .nc-editor__cancel-reply:hover{color:var(--nc-text)}.nostr-comments:not([data-headless=true]) .nc-editor__main{display:flex;gap:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-editor__input-wrapper{flex:1}.nostr-comments:not([data-headless=true]) .nc-editor__textarea{width:100%;padding:var(--nc-space-md);border:1px solid var(--nc-border);border-radius:var(--nc-radius-md);background:color-mix(in srgb,var(--nc-bg) 60%,transparent);color:var(--nc-text);font-family:inherit;font-size:var(--nc-font-size-md);resize:vertical;min-height:96px;transition:border-color var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-editor__textarea:focus{outline:none;border-color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-editor__textarea::placeholder{color:var(--nc-text-muted)}.nostr-comments:not([data-headless=true]) .nc-editor__actions{display:flex;justify-content:flex-end;margin-top:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-editor__submit{padding:var(--nc-space-sm) var(--nc-space-xl);background:var(--nc-primary);color:#fff;border:none;border-radius:var(--nc-radius-md);font-weight:500;cursor:pointer;transition:background var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-editor__submit:hover:not(:disabled){background:var(--nc-primary-hover)}.nostr-comments:not([data-headless=true]) .nc-editor__submit:disabled{opacity:.6;cursor:not-allowed}.nostr-comments:not([data-headless=true]) .nc-list{display:flex;flex-direction:column}.nostr-comments:not([data-headless=true]) .nc-loading,.nostr-comments:not([data-headless=true]) .nc-empty,.nostr-comments:not([data-headless=true]) .nc-error{text-align:center;padding:var(--nc-space-xl);color:var(--nc-text-secondary)}.nostr-comments:not([data-headless=true]) .nc-loading{display:flex;align-items:center;justify-content:center;gap:var(--nc-space-sm)}.nostr-comments:not([data-headless=true]) .nc-loading__spinner{width:16px;height:16px;border:1.5px solid var(--nc-border);border-top-color:var(--nc-primary);border-radius:50%;animation:nc-spin .8s linear infinite}@keyframes nc-spin{to{transform:rotate(360deg)}}.nostr-comments:not([data-headless=true]) .nc-error__retry{margin-top:var(--nc-space-md);padding:var(--nc-space-sm) var(--nc-space-lg);background:var(--nc-bg-secondary);border:1px solid var(--nc-border);border-radius:var(--nc-radius-md);cursor:pointer;color:var(--nc-text);transition:background var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-error__retry:hover{background:var(--nc-bg-hover)}.nostr-comments:not([data-headless=true]) .nc-comment{padding-top:var(--nc-space-lg)}.nostr-comments:not([data-headless=true]) .nc-comment:first-child{padding-top:0}.nostr-comments:not([data-headless=true]) .nc-comment__main{display:flex;align-items:flex-start;gap:var(--nc-space-md);position:relative}.nostr-comments:not([data-headless=true]) .nc-comment__vline{position:absolute;left:20px;top:48px;bottom:0;border-left:1.5px solid var(--nc-border)}.nostr-comments:not([data-headless=true]) .nc-comment__content{flex:1;min-width:0;padding-top:2px}.nostr-comments:not([data-headless=true]) .nc-comment__header{margin-bottom:var(--nc-space-xs);display:flex}.nostr-comments:not([data-headless=true]) .nc-comment__author{font-weight:500;color:var(--nc-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nostr-comments:not([data-headless=true]) .nc-comment__text{margin:0;color:var(--nc-text);white-space:pre-wrap;word-wrap:break-word}.nostr-comments:not([data-headless=true]) .nc-comment__actions{display:flex;align-items:center;gap:var(--nc-space-md);margin-top:var(--nc-space-xs);font-size:var(--nc-font-size-sm)}.nostr-comments:not([data-headless=true]) .nc-comment__time{color:var(--nc-text-muted)}.nostr-comments:not([data-headless=true]) .nc-comment__reply-btn{background:none;border:none;color:var(--nc-text-secondary);cursor:pointer;padding:0;font-size:var(--nc-font-size-sm);transition:color var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-comment__reply-btn:hover{color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-comment__child-wrapper{position:relative;padding-left:50px}.nostr-comments:not([data-headless=true]) .nc-comment__connector{position:absolute;left:20px;top:0;width:26px;height:32px;border-left:1.5px solid var(--nc-border);border-bottom:1.5px solid var(--nc-border);border-bottom-left-radius:var(--nc-radius-xl)}.nostr-comments:not([data-headless=true]) .nc-comment__connector-line{position:absolute;left:20px;top:0;bottom:0;border-left:1.5px solid var(--nc-border)}.nostr-comments:not([data-headless=true]) .nc-comment__reply-preview{display:flex;align-items:center;gap:var(--nc-space-xs);padding:var(--nc-space-xs) var(--nc-space-sm);margin-bottom:var(--nc-space-xs);background:var(--nc-bg-secondary);border-radius:var(--nc-radius-sm);border-left:2px solid var(--nc-primary);font-size:var(--nc-font-size-sm);color:var(--nc-text-muted);overflow:hidden;width:fit-content;max-width:100%}.nostr-comments:not([data-headless=true]) .nc-comment__reply-preview-author{color:var(--nc-primary);font-weight:500;flex-shrink:0}.nostr-comments:not([data-headless=true]) .nc-comment__reply-preview-author:after{content:":"}.nostr-comments:not([data-headless=true]) .nc-comment__reply-preview-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--nc-text-secondary)}.nostr-comments:not([data-headless=true]) .nc-load-more{display:block;width:100%;padding:var(--nc-space-md);margin-top:var(--nc-space-lg);background:transparent;border:none;color:var(--nc-text-muted);font-size:var(--nc-font-size-sm);cursor:pointer;transition:color var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-load-more:hover:not(:disabled){color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-load-more:disabled{cursor:wait}.nostr-comments:not([data-headless=true]) .nc-avatar-link{flex-shrink:0;text-decoration:none;margin-top:4px}.nostr-comments:not([data-headless=true]) .nc-avatar-link:hover{opacity:.8}.nostr-comments:not([data-headless=true]) .nc-avatar{flex-shrink:0;border-radius:var(--nc-avatar-radius, 50%);object-fit:cover;aspect-ratio:1 / 1}.nostr-comments:not([data-headless=true]) .nc-username{color:inherit;text-decoration:none}.nostr-comments:not([data-headless=true]) .nc-username:hover{text-decoration:underline}.nostr-comments:not([data-headless=true]) .nc-modal-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:9999;padding:var(--nc-space-lg)}.nostr-comments:not([data-headless=true]) .nc-modal{background:var(--nc-bg);border-radius:var(--nc-radius-xl);width:100%;max-width:400px;max-height:90vh;overflow-y:auto;box-shadow:var(--nc-shadow-lg)}.nostr-comments:not([data-headless=true]) .nc-modal__header{display:flex;align-items:center;padding:var(--nc-space-lg);border-bottom:1px solid var(--nc-border)}.nostr-comments:not([data-headless=true]) .nc-modal__header h3{margin:0;font-size:var(--nc-font-size-lg);font-weight:600;flex:1}.nostr-comments:not([data-headless=true]) .nc-modal__back{background:none;border:none;color:var(--nc-text-secondary);cursor:pointer;padding:var(--nc-space-xs);border-radius:50%;display:flex;transition:background var(--nc-transition);margin-right:var(--nc-space-sm)}.nostr-comments:not([data-headless=true]) .nc-modal__back:hover{background:var(--nc-bg-hover)}.nostr-comments:not([data-headless=true]) .nc-modal__close{background:none;border:none;color:var(--nc-text-secondary);cursor:pointer;padding:var(--nc-space-xs);border-radius:50%;display:flex;margin-left:auto;transition:background var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-modal__close:hover{background:var(--nc-bg-hover)}.nostr-comments:not([data-headless=true]) .nc-modal__body{padding:var(--nc-space-lg)}.nostr-comments:not([data-headless=true]) .nc-modal__description{margin:0 0 var(--nc-space-lg);color:var(--nc-text-secondary)}.nostr-comments:not([data-headless=true]) .nc-login-options{display:flex;flex-direction:column;gap:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-login-option{display:flex;gap:var(--nc-space-md);padding:var(--nc-space-lg);background:var(--nc-bg-secondary);border:1px solid var(--nc-border);border-radius:var(--nc-radius-md);text-align:left;cursor:pointer;transition:border-color var(--nc-transition),background var(--nc-transition);width:100%}.nostr-comments:not([data-headless=true]) .nc-login-option:hover:not(:disabled):not(.nc-login-option--disabled){border-color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-login-option--disabled{opacity:.6;cursor:not-allowed}.nostr-comments:not([data-headless=true]) .nc-login-option--bunker{cursor:default;flex-direction:column}.nostr-comments:not([data-headless=true]) .nc-login-option--bunker .nc-login-option__icon{display:none}.nostr-comments:not([data-headless=true]) .nc-login-option__icon{flex-shrink:0;width:36px;height:36px;display:flex;align-items:center;justify-content:center;background:var(--nc-primary-light);color:var(--nc-primary);border-radius:50%}.nostr-comments:not([data-headless=true]) .nc-login-option__icon--success{background:var(--nc-success-light);color:var(--nc-success)}.nostr-comments:not([data-headless=true]) .nc-login-option__content h4{margin:0 0 var(--nc-space-xs);font-size:var(--nc-font-size-md);font-weight:500;color:var(--nc-text)}.nostr-comments:not([data-headless=true]) .nc-login-option__content p{margin:0;font-size:var(--nc-font-size-sm);color:var(--nc-text-secondary)}.nostr-comments:not([data-headless=true]) .nc-login-option__hint{margin-top:var(--nc-space-sm)!important;color:var(--nc-text-muted)!important;font-style:italic}.nostr-comments:not([data-headless=true]) .nc-login-option__error{margin-top:var(--nc-space-sm)!important;color:var(--nc-error)!important}.nostr-comments:not([data-headless=true]) .nc-login-option__warning{margin-top:var(--nc-space-sm)!important;padding:var(--nc-space-sm);background:var(--nc-error-light);border-radius:var(--nc-radius-sm);color:var(--nc-error)!important;font-size:var(--nc-font-size-sm)!important}.nostr-comments:not([data-headless=true]) .nc-bunker-form{display:flex;gap:var(--nc-space-sm);margin-top:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-bunker-form__input{flex:1;padding:var(--nc-space-sm) var(--nc-space-md);border:1px solid var(--nc-border);border-radius:var(--nc-radius-sm);background:var(--nc-bg);color:var(--nc-text);font-size:var(--nc-font-size-sm)}.nostr-comments:not([data-headless=true]) .nc-bunker-form__input:focus{outline:none;border-color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-bunker-form__submit{padding:var(--nc-space-sm) var(--nc-space-lg);background:var(--nc-primary);color:#fff;border:none;border-radius:var(--nc-radius-md);cursor:pointer;white-space:nowrap;transition:background var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-bunker-form__submit:hover:not(:disabled){background:var(--nc-primary-hover)}.nostr-comments:not([data-headless=true]) .nc-bunker-form__submit:disabled{opacity:.6;cursor:not-allowed}.nostr-comments:not([data-headless=true]) .nc-temp-nsec{margin-top:var(--nc-space-md);padding:var(--nc-space-md);background:var(--nc-bg);border:1px solid var(--nc-border);border-radius:var(--nc-radius-sm);overflow:hidden}.nostr-comments:not([data-headless=true]) .nc-temp-nsec__code{display:block;font-family:monospace;font-size:var(--nc-font-size-xs);color:var(--nc-text);word-break:break-all;-webkit-user-select:all;user-select:all}.nostr-comments:not([data-headless=true]) .nc-login-option__compatibility{margin-top:var(--nc-space-sm)!important;padding:var(--nc-space-sm);background:var(--nc-primary-light);border-radius:var(--nc-radius-sm);color:var(--nc-primary)!important;font-size:var(--nc-font-size-sm)!important}.nostr-comments:not([data-headless=true]) .nc-temp-actions{display:flex;gap:var(--nc-space-sm);margin-top:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-temp-actions__btn{flex:1;display:flex;align-items:center;justify-content:center;gap:var(--nc-space-xs);padding:var(--nc-space-sm) var(--nc-space-md);background:var(--nc-bg);border:1px solid var(--nc-border);border-radius:var(--nc-radius-md);color:var(--nc-text);cursor:pointer;font-size:var(--nc-font-size-sm);transition:background var(--nc-transition),border-color var(--nc-transition),color var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-temp-actions__btn:hover{background:var(--nc-bg-hover)}.nostr-comments:not([data-headless=true]) .nc-temp-actions__btn--success{background:var(--nc-success-light);border-color:var(--nc-success);color:var(--nc-success)}.nostr-comments:not([data-headless=true]) .nc-temp-actions__btn--success:hover{background:var(--nc-success-light)}.nostr-comments:not([data-headless=true]) .nc-temp-actions__continue{width:100%;margin-top:var(--nc-space-md);padding:var(--nc-space-sm) var(--nc-space-md);background:var(--nc-primary);border:none;border-radius:var(--nc-radius-md);color:#fff;cursor:pointer;font-weight:500;transition:background var(--nc-transition),opacity var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-temp-actions__continue:hover{background:var(--nc-primary-hover)}.nostr-comments:not([data-headless=true]) .nc-temp-actions__continue--muted{opacity:.6}.nostr-comments:not([data-headless=true]) .nc-import-form{display:flex;gap:var(--nc-space-sm);margin-top:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-import-form__input{flex:1;padding:var(--nc-space-sm) var(--nc-space-md);border:1px solid var(--nc-border);border-radius:var(--nc-radius-sm);background:var(--nc-bg);color:var(--nc-text);font-family:monospace;font-size:var(--nc-font-size-sm)}.nostr-comments:not([data-headless=true]) .nc-import-form__input:focus{outline:none;border-color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-import-form__submit{padding:var(--nc-space-sm) var(--nc-space-md);background:var(--nc-primary);color:#fff;border:none;border-radius:var(--nc-radius-sm);cursor:pointer;white-space:nowrap;transition:background var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-import-form__submit:hover:not(:disabled){background:var(--nc-primary-hover)}.nostr-comments:not([data-headless=true]) .nc-import-form__submit:disabled{opacity:.6;cursor:not-allowed}.nostr-comments:not([data-headless=true]) .nc-import-form__back{margin-top:var(--nc-space-md);padding:var(--nc-space-sm);background:none;border:none;color:var(--nc-text-secondary);cursor:pointer;font-size:var(--nc-font-size-sm);transition:color var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-import-form__back:hover{color:var(--nc-text)}.nostr-comments:not([data-headless=true]) .nc-temp-view{display:flex;flex-direction:column;align-items:center;text-align:center;padding:var(--nc-space-xl) 0}.nostr-comments:not([data-headless=true]) .nc-temp-view__icon{width:52px;height:52px;display:flex;align-items:center;justify-content:center;background:var(--nc-primary-light);color:var(--nc-primary);border-radius:50%;margin-bottom:var(--nc-space-lg)}.nostr-comments:not([data-headless=true]) .nc-temp-view__icon--success{width:36px;height:36px;background:var(--nc-success-light);color:var(--nc-success);margin-bottom:0}.nostr-comments:not([data-headless=true]) .nc-temp-view__title{margin:0 0 var(--nc-space-sm);font-size:var(--nc-font-size-lg);font-weight:600;color:var(--nc-text)}.nostr-comments:not([data-headless=true]) .nc-temp-view__desc{margin:0 0 var(--nc-space-xl);color:var(--nc-text-secondary);max-width:320px}.nostr-comments:not([data-headless=true]) .nc-temp-view--created{padding:var(--nc-space-lg) 0}.nostr-comments:not([data-headless=true]) .nc-temp-view__header{display:flex;align-items:center;gap:var(--nc-space-md);margin-bottom:var(--nc-space-lg)}.nostr-comments:not([data-headless=true]) .nc-temp-view__header .nc-temp-view__title{margin:0}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-section{width:100%;margin-bottom:var(--nc-space-lg)}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-box{display:flex;align-items:center;gap:var(--nc-space-sm);padding:var(--nc-space-md);background:var(--nc-bg-secondary);border:1px solid var(--nc-border);border-radius:var(--nc-radius-md)}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-code{flex:1;font-family:monospace;font-size:var(--nc-font-size-xs);color:var(--nc-text);word-break:break-all;text-align:left;-webkit-user-select:all;user-select:all}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-actions{display:flex;gap:var(--nc-space-xs);flex-shrink:0}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-btn{display:flex;align-items:center;justify-content:center;width:28px;height:28px;background:var(--nc-bg);border:1px solid var(--nc-border);border-radius:50%;color:var(--nc-text-secondary);cursor:pointer;transition:all var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-btn:hover{border-color:var(--nc-primary);color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-btn--success{background:var(--nc-success-light);border-color:var(--nc-success);color:var(--nc-success)}.nostr-comments:not([data-headless=true]) .nc-temp-view__key-hint{margin:var(--nc-space-sm) 0 0;font-size:var(--nc-font-size-sm);color:var(--nc-text-muted);text-align:left}.nostr-comments:not([data-headless=true]) .nc-temp-view__form{width:100%;max-width:320px;display:flex;flex-direction:column;gap:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-temp-view__input{width:100%;padding:var(--nc-space-md);border:1px solid var(--nc-border);border-radius:var(--nc-radius-md);background:var(--nc-bg);color:var(--nc-text);font-family:monospace;font-size:var(--nc-font-size-sm);text-align:center}.nostr-comments:not([data-headless=true]) .nc-temp-view__input:focus{outline:none;border-color:var(--nc-primary)}.nostr-comments:not([data-headless=true]) .nc-temp-view__input::placeholder{font-family:var(--nc-font-family)}.nostr-comments:not([data-headless=true]) .nc-temp-view__error{margin:0;color:var(--nc-error);font-size:var(--nc-font-size-sm)}.nostr-comments:not([data-headless=true]) .nc-temp-view__submit{width:100%;padding:var(--nc-space-md);background:var(--nc-primary);color:#fff;border:none;border-radius:var(--nc-radius-md);font-weight:500;font-size:var(--nc-font-size-md);cursor:pointer;transition:background var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-temp-view__submit:hover:not(:disabled){background:var(--nc-primary-hover)}.nostr-comments:not([data-headless=true]) .nc-temp-view__submit:disabled{opacity:.6;cursor:not-allowed}.nostr-comments:not([data-headless=true]) .nc-logged-in{display:flex;flex-direction:column;gap:var(--nc-space-md)}.nostr-comments:not([data-headless=true]) .nc-logged-in__user{display:flex;align-items:center;gap:var(--nc-space-md);padding:var(--nc-space-md);background:var(--nc-bg-secondary);border-radius:var(--nc-radius-md)}.nostr-comments:not([data-headless=true]) .nc-logged-in__info{display:flex;flex-direction:column;gap:var(--nc-space-xs)}.nostr-comments:not([data-headless=true]) .nc-logged-in__name{font-weight:500;color:var(--nc-text)}.nostr-comments:not([data-headless=true]) .nc-logged-in__type{font-size:var(--nc-font-size-sm);color:var(--nc-text-muted)}.nostr-comments:not([data-headless=true]) .nc-logged-in__temp-backup{display:flex;flex-direction:column;gap:var(--nc-space-sm)}.nostr-comments:not([data-headless=true]) .nc-logged-in__logout{margin-top:var(--nc-space-sm);padding:var(--nc-space-sm) var(--nc-space-lg);background:var(--nc-error-light);border:1px solid var(--nc-error);border-radius:var(--nc-radius-md);color:var(--nc-error);cursor:pointer;transition:background var(--nc-transition)}.nostr-comments:not([data-headless=true]) .nc-logged-in__logout:hover{background:var(--nc-error);color:#fff}', Wi = "nostr-comments-styles";
|
|
10170
|
+
function kg() {
|
|
10153
10171
|
if (document.getElementById(Wi) || document.querySelector(
|
|
10154
10172
|
'style[data-vite-dev-id*="base.css"]'
|
|
10155
10173
|
))
|
|
10156
10174
|
return;
|
|
10157
10175
|
const e = document.createElement("style");
|
|
10158
|
-
e.id = Wi, e.textContent =
|
|
10176
|
+
e.id = Wi, e.textContent = Eg, document.head.appendChild(e);
|
|
10159
10177
|
}
|
|
10160
|
-
function
|
|
10178
|
+
function _g({
|
|
10161
10179
|
url: t,
|
|
10162
10180
|
mention: e,
|
|
10163
10181
|
relays: n,
|
|
10164
10182
|
pageSize: r = 50,
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10183
|
+
signer: o,
|
|
10184
|
+
enabledSigners: i = ["nip07", "bunker", "temp"],
|
|
10185
|
+
pow: s = 18,
|
|
10186
|
+
classNames: a = {},
|
|
10187
|
+
onCommentPublished: c,
|
|
10188
|
+
onError: l
|
|
10170
10189
|
}) {
|
|
10171
|
-
const { t:
|
|
10172
|
-
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
|
|
10183
|
-
},
|
|
10184
|
-
c == null || c(
|
|
10185
|
-
},
|
|
10186
|
-
|
|
10187
|
-
|
|
10188
|
-
|
|
10190
|
+
const { t: d } = ft(), { signerInfo: u } = Vt(), [m, f] = X(!1), [p, h] = X(!1), [y, w] = X(null), E = async () => {
|
|
10191
|
+
o && !p ? await sm(o) || (h(!0), f(!0)) : f(!0);
|
|
10192
|
+
}, {
|
|
10193
|
+
comments: S,
|
|
10194
|
+
commentCount: O,
|
|
10195
|
+
loading: M,
|
|
10196
|
+
loadingMore: _,
|
|
10197
|
+
error: N,
|
|
10198
|
+
hasMore: L,
|
|
10199
|
+
reload: K,
|
|
10200
|
+
loadMore: T,
|
|
10201
|
+
addEvent: P
|
|
10202
|
+
} = xg({ url: t, relays: n, mention: e, pageSize: r, pow: s }), D = (b) => {
|
|
10203
|
+
P(b), c == null || c(b);
|
|
10204
|
+
}, U = (b) => {
|
|
10205
|
+
l == null || l(b);
|
|
10206
|
+
}, k = (b) => {
|
|
10207
|
+
w(b);
|
|
10208
|
+
const v = document.querySelector(".nc-editor");
|
|
10209
|
+
v && v.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
10189
10210
|
};
|
|
10190
|
-
return /* @__PURE__ */ H("div", { className: `nc-root ${
|
|
10211
|
+
return /* @__PURE__ */ H("div", { className: `nc-root ${a.root || ""}`, children: [
|
|
10191
10212
|
/* @__PURE__ */ x("div", { className: "nc-header", children: /* @__PURE__ */ H("h3", { className: "nc-title", children: [
|
|
10192
|
-
|
|
10193
|
-
|
|
10213
|
+
d("comments"),
|
|
10214
|
+
O > 0 && /* @__PURE__ */ H("span", { className: "nc-count", children: [
|
|
10194
10215
|
"(",
|
|
10195
|
-
|
|
10216
|
+
O,
|
|
10196
10217
|
")"
|
|
10197
10218
|
] })
|
|
10198
10219
|
] }) }),
|
|
10199
10220
|
/* @__PURE__ */ x(
|
|
10200
|
-
|
|
10221
|
+
Gp,
|
|
10201
10222
|
{
|
|
10202
10223
|
url: t,
|
|
10203
10224
|
relays: n,
|
|
10204
10225
|
mention: e,
|
|
10205
|
-
pow:
|
|
10206
|
-
parentEvent:
|
|
10207
|
-
onClearParent: () =>
|
|
10208
|
-
onPublished:
|
|
10209
|
-
onLoginRequired:
|
|
10210
|
-
onError:
|
|
10211
|
-
className:
|
|
10226
|
+
pow: s,
|
|
10227
|
+
parentEvent: y,
|
|
10228
|
+
onClearParent: () => w(null),
|
|
10229
|
+
onPublished: D,
|
|
10230
|
+
onLoginRequired: E,
|
|
10231
|
+
onError: U,
|
|
10232
|
+
className: a.editor
|
|
10212
10233
|
}
|
|
10213
10234
|
),
|
|
10214
10235
|
/* @__PURE__ */ x(
|
|
10215
|
-
|
|
10236
|
+
Xp,
|
|
10216
10237
|
{
|
|
10217
|
-
comments:
|
|
10218
|
-
loading:
|
|
10219
|
-
loadingMore:
|
|
10220
|
-
hasMore:
|
|
10221
|
-
error:
|
|
10238
|
+
comments: S,
|
|
10239
|
+
loading: M,
|
|
10240
|
+
loadingMore: _,
|
|
10241
|
+
hasMore: L,
|
|
10242
|
+
error: N,
|
|
10222
10243
|
relays: n,
|
|
10223
|
-
onReply:
|
|
10224
|
-
onLoginRequired:
|
|
10225
|
-
onLoadMore:
|
|
10226
|
-
onRetry:
|
|
10227
|
-
currentPubkey:
|
|
10228
|
-
className:
|
|
10244
|
+
onReply: k,
|
|
10245
|
+
onLoginRequired: E,
|
|
10246
|
+
onLoadMore: T,
|
|
10247
|
+
onRetry: K,
|
|
10248
|
+
currentPubkey: u == null ? void 0 : u.pubkey,
|
|
10249
|
+
className: a.list
|
|
10229
10250
|
}
|
|
10230
10251
|
),
|
|
10231
|
-
/* @__PURE__ */ x(
|
|
10232
|
-
|
|
10252
|
+
(!o || p) && /* @__PURE__ */ x(
|
|
10253
|
+
wg,
|
|
10233
10254
|
{
|
|
10234
|
-
isOpen:
|
|
10235
|
-
onClose: () =>
|
|
10236
|
-
enabledSigners:
|
|
10237
|
-
className:
|
|
10255
|
+
isOpen: m,
|
|
10256
|
+
onClose: () => f(!1),
|
|
10257
|
+
enabledSigners: i,
|
|
10258
|
+
className: a.loginModal
|
|
10238
10259
|
}
|
|
10239
10260
|
)
|
|
10240
10261
|
] });
|
|
10241
10262
|
}
|
|
10242
|
-
function
|
|
10263
|
+
function Jg({
|
|
10243
10264
|
locale: t,
|
|
10244
10265
|
translations: e,
|
|
10245
10266
|
theme: n = "auto",
|
|
@@ -10247,19 +10268,19 @@ function Zg({
|
|
|
10247
10268
|
...o
|
|
10248
10269
|
}) {
|
|
10249
10270
|
return xt(() => {
|
|
10250
|
-
r ||
|
|
10251
|
-
}, [r]), /* @__PURE__ */ x(
|
|
10271
|
+
r || kg();
|
|
10272
|
+
}, [r]), /* @__PURE__ */ x(Mp, { locale: t, translations: e, children: /* @__PURE__ */ x(
|
|
10252
10273
|
"div",
|
|
10253
10274
|
{
|
|
10254
10275
|
className: "nostr-comments",
|
|
10255
10276
|
"data-theme": n,
|
|
10256
10277
|
"data-headless": r ? "true" : void 0,
|
|
10257
|
-
children: /* @__PURE__ */ x(
|
|
10278
|
+
children: /* @__PURE__ */ x(_g, { ...o })
|
|
10258
10279
|
}
|
|
10259
10280
|
) });
|
|
10260
10281
|
}
|
|
10261
10282
|
const Uo = 7;
|
|
10262
|
-
function
|
|
10283
|
+
function Gg(t) {
|
|
10263
10284
|
const { eventIds: e, relays: n, onEvent: r, onEose: o } = t;
|
|
10264
10285
|
return e.length === 0 ? (o == null || o(), () => {
|
|
10265
10286
|
}) : mc(
|
|
@@ -10272,14 +10293,14 @@ function Jg(t) {
|
|
|
10272
10293
|
o
|
|
10273
10294
|
);
|
|
10274
10295
|
}
|
|
10275
|
-
async function
|
|
10296
|
+
async function Yg(t) {
|
|
10276
10297
|
const { eventIds: e, relays: n } = t;
|
|
10277
10298
|
return e.length === 0 ? [] : fc(n, {
|
|
10278
10299
|
kinds: [Uo],
|
|
10279
10300
|
"#e": e
|
|
10280
10301
|
});
|
|
10281
10302
|
}
|
|
10282
|
-
function
|
|
10303
|
+
function Ag(t, e = "+") {
|
|
10283
10304
|
return {
|
|
10284
10305
|
kind: Uo,
|
|
10285
10306
|
content: e,
|
|
@@ -10290,17 +10311,17 @@ function _g(t, e = "+") {
|
|
|
10290
10311
|
created_at: Math.floor(Date.now() / 1e3)
|
|
10291
10312
|
};
|
|
10292
10313
|
}
|
|
10293
|
-
async function
|
|
10294
|
-
const o =
|
|
10314
|
+
async function Xg(t, e, n, r = "+") {
|
|
10315
|
+
const o = Ag(n, r), i = await t.signEvent(o);
|
|
10295
10316
|
return await pc(e, i), i;
|
|
10296
10317
|
}
|
|
10297
|
-
function
|
|
10318
|
+
function Qg(t, e) {
|
|
10298
10319
|
return t.filter((n) => {
|
|
10299
10320
|
const r = n.tags.find((o) => o[0] === "e");
|
|
10300
10321
|
return r && r[1] === e && (n.content === "+" || n.content === "");
|
|
10301
10322
|
}).length;
|
|
10302
10323
|
}
|
|
10303
|
-
function
|
|
10324
|
+
function ey(t, e, n) {
|
|
10304
10325
|
return t.some((r) => {
|
|
10305
10326
|
const o = r.tags.find((i) => i[0] === "e");
|
|
10306
10327
|
return o && o[1] === e && r.pubkey === n && (r.content === "+" || r.content === "");
|
|
@@ -10309,40 +10330,41 @@ function Qg(t, e, n) {
|
|
|
10309
10330
|
export {
|
|
10310
10331
|
Po as Avatar,
|
|
10311
10332
|
_o as BunkerSigner,
|
|
10312
|
-
|
|
10333
|
+
Gp as CommentEditor,
|
|
10313
10334
|
Cc as CommentItem,
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10335
|
+
Xp as CommentList,
|
|
10336
|
+
Mp as I18nProvider,
|
|
10337
|
+
wg as LoginModal,
|
|
10317
10338
|
Dn as Nip07Signer,
|
|
10318
|
-
|
|
10339
|
+
Jg as NostrComments,
|
|
10319
10340
|
Kt as TempSigner,
|
|
10320
10341
|
En as Username,
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10342
|
+
Op as buildCommentTree,
|
|
10343
|
+
Ag as buildReactionEvent,
|
|
10344
|
+
Lp as buildWebComment,
|
|
10345
|
+
Qg as countLikes,
|
|
10325
10346
|
$t as en,
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10347
|
+
Pp as fetchComments,
|
|
10348
|
+
Yg as fetchReactions,
|
|
10349
|
+
Jp as generateAvatarSvg,
|
|
10329
10350
|
Hi as getAvatarDataUrl,
|
|
10330
|
-
|
|
10331
|
-
|
|
10351
|
+
Zp as getColorFromPubkey,
|
|
10352
|
+
Sp as getDefaultRelays,
|
|
10332
10353
|
Yt as getParentId,
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10354
|
+
Zg as getRootUrl,
|
|
10355
|
+
ey as hasLiked,
|
|
10356
|
+
Fg as isLoggedIn,
|
|
10357
|
+
Wg as isReply,
|
|
10337
10358
|
hc as isValidPubkey,
|
|
10338
|
-
|
|
10359
|
+
Up as publishComment,
|
|
10339
10360
|
pc as publishEvent,
|
|
10340
|
-
|
|
10361
|
+
Xg as publishReaction,
|
|
10341
10362
|
fc as queryEvents,
|
|
10342
|
-
|
|
10363
|
+
sm as setExternalSigner,
|
|
10364
|
+
Tp as subscribeComments,
|
|
10343
10365
|
mc as subscribeEvents,
|
|
10344
|
-
|
|
10345
|
-
|
|
10366
|
+
Gg as subscribeReactions,
|
|
10367
|
+
xg as useComments,
|
|
10346
10368
|
ft as useI18n,
|
|
10347
10369
|
Nc as useProfile,
|
|
10348
10370
|
Vt as useSigner,
|