nostr-double-ratchet 0.0.10 → 0.0.11

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.
@@ -30,7 +30,7 @@ function ci(e, t) {
30
30
  }
31
31
  const St = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
32
32
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
33
- const Pn = (e) => e instanceof Uint8Array, At = (e) => new DataView(e.buffer, e.byteOffset, e.byteLength), ne = (e, t) => e << 32 - t | e >>> t, li = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
33
+ const Mn = (e) => e instanceof Uint8Array, At = (e) => new DataView(e.buffer, e.byteOffset, e.byteLength), ne = (e, t) => e << 32 - t | e >>> t, li = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
34
34
  if (!li)
35
35
  throw new Error("Non little-endian hardware is not supported");
36
36
  function ui(e) {
@@ -39,7 +39,7 @@ function ui(e) {
39
39
  return new Uint8Array(new TextEncoder().encode(e));
40
40
  }
41
41
  function Zt(e) {
42
- if (typeof e == "string" && (e = ui(e)), !Pn(e))
42
+ if (typeof e == "string" && (e = ui(e)), !Mn(e))
43
43
  throw new Error(`expected Uint8Array, got ${typeof e}`);
44
44
  return e;
45
45
  }
@@ -47,12 +47,12 @@ function fi(...e) {
47
47
  const t = new Uint8Array(e.reduce((r, i) => r + i.length, 0));
48
48
  let n = 0;
49
49
  return e.forEach((r) => {
50
- if (!Pn(r))
50
+ if (!Mn(r))
51
51
  throw new Error("Uint8Array expected");
52
52
  t.set(r, n), n += r.length;
53
53
  }), t;
54
54
  }
55
- let Mn = class {
55
+ let Pn = class {
56
56
  // Safe version that clones internal state
57
57
  clone() {
58
58
  return this._cloneInto();
@@ -70,10 +70,10 @@ function Hn(e = 32) {
70
70
  function di(e, t, n, r) {
71
71
  if (typeof e.setBigUint64 == "function")
72
72
  return e.setBigUint64(t, n, r);
73
- const i = BigInt(32), s = BigInt(4294967295), o = Number(n >> i & s), a = Number(n & s), c = r ? 4 : 0, l = r ? 0 : 4;
74
- e.setUint32(t + c, o, r), e.setUint32(t + l, a, r);
73
+ const i = BigInt(32), s = BigInt(4294967295), o = Number(n >> i & s), c = Number(n & s), a = r ? 4 : 0, l = r ? 0 : 4;
74
+ e.setUint32(t + a, o, r), e.setUint32(t + l, c, r);
75
75
  }
76
- let yi = class extends Mn {
76
+ let yi = class extends Pn {
77
77
  constructor(t, n, r, i) {
78
78
  super(), this.blockLen = t, this.outputLen = n, this.padOffset = r, this.isLE = i, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(t), this.view = At(this.buffer);
79
79
  }
@@ -83,14 +83,14 @@ let yi = class extends Mn {
83
83
  t = Zt(t);
84
84
  const s = t.length;
85
85
  for (let o = 0; o < s; ) {
86
- const a = Math.min(i - this.pos, s - o);
87
- if (a === i) {
88
- const c = At(t);
86
+ const c = Math.min(i - this.pos, s - o);
87
+ if (c === i) {
88
+ const a = At(t);
89
89
  for (; i <= s - o; o += i)
90
- this.process(c, o);
90
+ this.process(a, o);
91
91
  continue;
92
92
  }
93
- r.set(t.subarray(o, o + a), this.pos), this.pos += a, o += a, this.pos === i && (this.process(n, 0), this.pos = 0);
93
+ r.set(t.subarray(o, o + c), this.pos), this.pos += c, o += c, this.pos === i && (this.process(n, 0), this.pos = 0);
94
94
  }
95
95
  return this.length += t.length, this.roundClean(), this;
96
96
  }
@@ -102,14 +102,14 @@ let yi = class extends Mn {
102
102
  for (let u = o; u < i; u++)
103
103
  n[u] = 0;
104
104
  di(r, i - 8, BigInt(this.length * 8), s), this.process(r, 0);
105
- const a = At(t), c = this.outputLen;
106
- if (c % 4)
105
+ const c = At(t), a = this.outputLen;
106
+ if (a % 4)
107
107
  throw new Error("_sha2: outputLen should be aligned to 32bit");
108
- const l = c / 4, f = this.get();
108
+ const l = a / 4, f = this.get();
109
109
  if (l > f.length)
110
110
  throw new Error("_sha2: outputLen bigger than state");
111
111
  for (let u = 0; u < l; u++)
112
- a.setUint32(4 * u, f[u], s);
112
+ c.setUint32(4 * u, f[u], s);
113
113
  }
114
114
  digest() {
115
115
  const { buffer: t, outputLen: n } = this;
@@ -119,8 +119,8 @@ let yi = class extends Mn {
119
119
  }
120
120
  _cloneInto(t) {
121
121
  t || (t = new this.constructor()), t.set(...this.get());
122
- const { blockLen: n, buffer: r, length: i, finished: s, destroyed: o, pos: a } = this;
123
- return t.length = i, t.pos = a, t.finished = s, t.destroyed = o, i % n && t.buffer.set(r), t;
122
+ const { blockLen: n, buffer: r, length: i, finished: s, destroyed: o, pos: c } = this;
123
+ return t.length = i, t.pos = c, t.finished = s, t.destroyed = o, i % n && t.buffer.set(r), t;
124
124
  }
125
125
  };
126
126
  const pi = (e, t, n) => e & t ^ ~e & n, gi = (e, t, n) => e & t ^ e & n ^ t & n, wi = /* @__PURE__ */ new Uint32Array([
@@ -203,12 +203,12 @@ let bi = class extends yi {
203
203
  super(64, 32, 8, !1), this.A = ge[0] | 0, this.B = ge[1] | 0, this.C = ge[2] | 0, this.D = ge[3] | 0, this.E = ge[4] | 0, this.F = ge[5] | 0, this.G = ge[6] | 0, this.H = ge[7] | 0;
204
204
  }
205
205
  get() {
206
- const { A: t, B: n, C: r, D: i, E: s, F: o, G: a, H: c } = this;
207
- return [t, n, r, i, s, o, a, c];
206
+ const { A: t, B: n, C: r, D: i, E: s, F: o, G: c, H: a } = this;
207
+ return [t, n, r, i, s, o, c, a];
208
208
  }
209
209
  // prettier-ignore
210
- set(t, n, r, i, s, o, a, c) {
211
- this.A = t | 0, this.B = n | 0, this.C = r | 0, this.D = i | 0, this.E = s | 0, this.F = o | 0, this.G = a | 0, this.H = c | 0;
210
+ set(t, n, r, i, s, o, c, a) {
211
+ this.A = t | 0, this.B = n | 0, this.C = r | 0, this.D = i | 0, this.E = s | 0, this.F = o | 0, this.G = c | 0, this.H = a | 0;
212
212
  }
213
213
  process(t, n) {
214
214
  for (let u = 0; u < 16; u++, n += 4)
@@ -217,12 +217,12 @@ let bi = class extends yi {
217
217
  const d = we[u - 15], p = we[u - 2], g = ne(d, 7) ^ ne(d, 18) ^ d >>> 3, h = ne(p, 17) ^ ne(p, 19) ^ p >>> 10;
218
218
  we[u] = h + we[u - 7] + g + we[u - 16] | 0;
219
219
  }
220
- let { A: r, B: i, C: s, D: o, E: a, F: c, G: l, H: f } = this;
220
+ let { A: r, B: i, C: s, D: o, E: c, F: a, G: l, H: f } = this;
221
221
  for (let u = 0; u < 64; u++) {
222
- const d = ne(a, 6) ^ ne(a, 11) ^ ne(a, 25), p = f + d + pi(a, c, l) + wi[u] + we[u] | 0, h = (ne(r, 2) ^ ne(r, 13) ^ ne(r, 22)) + gi(r, i, s) | 0;
223
- f = l, l = c, c = a, a = o + p | 0, o = s, s = i, i = r, r = p + h | 0;
222
+ const d = ne(c, 6) ^ ne(c, 11) ^ ne(c, 25), p = f + d + pi(c, a, l) + wi[u] + we[u] | 0, h = (ne(r, 2) ^ ne(r, 13) ^ ne(r, 22)) + gi(r, i, s) | 0;
223
+ f = l, l = a, a = c, c = o + p | 0, o = s, s = i, i = r, r = p + h | 0;
224
224
  }
225
- r = r + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, f = f + this.H | 0, this.set(r, i, s, o, a, c, l, f);
225
+ r = r + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, c = c + this.E | 0, a = a + this.F | 0, l = l + this.G | 0, f = f + this.H | 0, this.set(r, i, s, o, c, a, l, f);
226
226
  }
227
227
  roundClean() {
228
228
  we.fill(0);
@@ -231,7 +231,7 @@ let bi = class extends yi {
231
231
  this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
232
232
  }
233
233
  };
234
- const Tt = /* @__PURE__ */ hi(() => new bi());
234
+ const $t = /* @__PURE__ */ hi(() => new bi());
235
235
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
236
236
  const qn = BigInt(0), ct = BigInt(1), vi = BigInt(2), lt = (e) => e instanceof Uint8Array, mi = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
237
237
  function qe(e) {
@@ -342,25 +342,25 @@ function jn(e, t, n) {
342
342
  let r = Kt(e), i = Kt(e), s = 0;
343
343
  const o = () => {
344
344
  r.fill(1), i.fill(0), s = 0;
345
- }, a = (...u) => n(i, r, ...u), c = (u = Kt()) => {
346
- i = a(En([0]), u), r = a(), u.length !== 0 && (i = a(En([1]), u), r = a());
345
+ }, c = (...u) => n(i, r, ...u), a = (u = Kt()) => {
346
+ i = c(En([0]), u), r = c(), u.length !== 0 && (i = c(En([1]), u), r = c());
347
347
  }, l = () => {
348
348
  if (s++ >= 1e3)
349
349
  throw new Error("drbg: tried 1000 values");
350
350
  let u = 0;
351
351
  const d = [];
352
352
  for (; u < t; ) {
353
- r = a();
353
+ r = c();
354
354
  const p = r.slice();
355
355
  d.push(p), u += r.length;
356
356
  }
357
357
  return ke(...d);
358
358
  };
359
359
  return (u, d) => {
360
- o(), c(u);
360
+ o(), a(u);
361
361
  let p;
362
362
  for (; !(p = d(l())); )
363
- c();
363
+ a();
364
364
  return o(), p;
365
365
  };
366
366
  }
@@ -377,12 +377,12 @@ const Bi = {
377
377
  };
378
378
  function Je(e, t, n = {}) {
379
379
  const r = (i, s, o) => {
380
- const a = Bi[s];
381
- if (typeof a != "function")
380
+ const c = Bi[s];
381
+ if (typeof c != "function")
382
382
  throw new Error(`Invalid validator "${s}", expected function`);
383
- const c = e[i];
384
- if (!(o && c === void 0) && !a(c, e))
385
- throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${s}`);
383
+ const a = e[i];
384
+ if (!(o && a === void 0) && !c(a, e))
385
+ throw new Error(`Invalid param ${String(i)}=${a} (${typeof a}), expected ${s}`);
386
386
  };
387
387
  for (const [i, s] of Object.entries(t))
388
388
  r(i, s, !1);
@@ -413,7 +413,7 @@ const Ci = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
413
413
  validateObject: Je
414
414
  }, Symbol.toStringTag, { value: "Module" }));
415
415
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
416
- const V = BigInt(0), q = BigInt(1), Ne = BigInt(2), ki = BigInt(3), $t = BigInt(4), xn = BigInt(5), Sn = BigInt(8);
416
+ const V = BigInt(0), q = BigInt(1), Ne = BigInt(2), ki = BigInt(3), Tt = BigInt(4), xn = BigInt(5), Sn = BigInt(8);
417
417
  BigInt(9);
418
418
  BigInt(16);
419
419
  function z(e, t) {
@@ -441,8 +441,8 @@ function Rt(e, t) {
441
441
  throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);
442
442
  let n = z(e, t), r = t, i = V, s = q;
443
443
  for (; n !== V; ) {
444
- const a = r / n, c = r % n, l = i - s * a;
445
- r = n, n = c, i = s, s = l;
444
+ const c = r / n, a = r % n, l = i - s * c;
445
+ r = n, n = a, i = s, s = l;
446
446
  }
447
447
  if (r !== q)
448
448
  throw new Error("invert: does not exist");
@@ -456,34 +456,34 @@ function Ii(e) {
456
456
  for (i = Ne; i < e && Ui(i, t, e) !== e - q; i++)
457
457
  ;
458
458
  if (r === 1) {
459
- const o = (e + q) / $t;
460
- return function(c, l) {
461
- const f = c.pow(l, o);
462
- if (!c.eql(c.sqr(f), l))
459
+ const o = (e + q) / Tt;
460
+ return function(a, l) {
461
+ const f = a.pow(l, o);
462
+ if (!a.eql(a.sqr(f), l))
463
463
  throw new Error("Cannot find square root");
464
464
  return f;
465
465
  };
466
466
  }
467
467
  const s = (n + q) / Ne;
468
- return function(a, c) {
469
- if (a.pow(c, t) === a.neg(a.ONE))
468
+ return function(c, a) {
469
+ if (c.pow(a, t) === c.neg(c.ONE))
470
470
  throw new Error("Cannot find square root");
471
- let l = r, f = a.pow(a.mul(a.ONE, i), n), u = a.pow(c, s), d = a.pow(c, n);
472
- for (; !a.eql(d, a.ONE); ) {
473
- if (a.eql(d, a.ZERO))
474
- return a.ZERO;
471
+ let l = r, f = c.pow(c.mul(c.ONE, i), n), u = c.pow(a, s), d = c.pow(a, n);
472
+ for (; !c.eql(d, c.ONE); ) {
473
+ if (c.eql(d, c.ZERO))
474
+ return c.ZERO;
475
475
  let p = 1;
476
- for (let h = a.sqr(d); p < l && !a.eql(h, a.ONE); p++)
477
- h = a.sqr(h);
478
- const g = a.pow(f, q << BigInt(l - p - 1));
479
- f = a.sqr(g), u = a.mul(u, g), d = a.mul(d, f), l = p;
476
+ for (let h = c.sqr(d); p < l && !c.eql(h, c.ONE); p++)
477
+ h = c.sqr(h);
478
+ const g = c.pow(f, q << BigInt(l - p - 1));
479
+ f = c.sqr(g), u = c.mul(u, g), d = c.mul(d, f), l = p;
480
480
  }
481
481
  return u;
482
482
  };
483
483
  }
484
484
  function _i(e) {
485
- if (e % $t === ki) {
486
- const t = (e + q) / $t;
485
+ if (e % Tt === ki) {
486
+ const t = (e + q) / Tt;
487
487
  return function(r, i) {
488
488
  const s = r.pow(i, t);
489
489
  if (!r.eql(r.sqr(s), i))
@@ -494,7 +494,7 @@ function _i(e) {
494
494
  if (e % Sn === xn) {
495
495
  const t = (e - xn) / Sn;
496
496
  return function(r, i) {
497
- const s = r.mul(i, Ne), o = r.pow(s, t), a = r.mul(i, o), c = r.mul(r.mul(a, Ne), o), l = r.mul(a, r.sub(c, r.ONE));
497
+ const s = r.mul(i, Ne), o = r.pow(s, t), c = r.mul(i, o), a = r.mul(r.mul(c, Ne), o), l = r.mul(c, r.sub(a, r.ONE));
498
498
  if (!r.eql(r.sqr(l), i))
499
499
  throw new Error("Cannot find square root");
500
500
  return l;
@@ -521,7 +521,7 @@ const Li = [
521
521
  "mulN",
522
522
  "sqrN"
523
523
  ];
524
- function Ti(e) {
524
+ function $i(e) {
525
525
  const t = {
526
526
  ORDER: "bigint",
527
527
  MASK: "bigint",
@@ -530,7 +530,7 @@ function Ti(e) {
530
530
  }, n = Li.reduce((r, i) => (r[i] = "function", r), t);
531
531
  return Je(e, n);
532
532
  }
533
- function $i(e, t, n) {
533
+ function Ti(e, t, n) {
534
534
  if (n < V)
535
535
  throw new Error("Expected power > 0");
536
536
  if (n === V)
@@ -543,8 +543,8 @@ function $i(e, t, n) {
543
543
  return r;
544
544
  }
545
545
  function Ri(e, t) {
546
- const n = new Array(t.length), r = t.reduce((s, o, a) => e.is0(o) ? s : (n[a] = s, e.mul(s, o)), e.ONE), i = e.inv(r);
547
- return t.reduceRight((s, o, a) => e.is0(o) ? s : (n[a] = e.mul(s, n[a]), e.mul(s, o)), i), n;
546
+ const n = new Array(t.length), r = t.reduce((s, o, c) => e.is0(o) ? s : (n[c] = s, e.mul(s, o)), e.ONE), i = e.inv(r);
547
+ return t.reduceRight((s, o, c) => e.is0(o) ? s : (n[c] = e.mul(s, n[c]), e.mul(s, o)), i), n;
548
548
  }
549
549
  function Vn(e, t) {
550
550
  const n = t !== void 0 ? t : e.toString(2).length, r = Math.ceil(n / 8);
@@ -556,48 +556,48 @@ function Oi(e, t, n = !1, r = {}) {
556
556
  const { nBitLength: i, nByteLength: s } = Vn(e, t);
557
557
  if (s > 2048)
558
558
  throw new Error("Field lengths over 2048 bytes are not supported");
559
- const o = _i(e), a = Object.freeze({
559
+ const o = _i(e), c = Object.freeze({
560
560
  ORDER: e,
561
561
  BITS: i,
562
562
  BYTES: s,
563
563
  MASK: Jt(i),
564
564
  ZERO: V,
565
565
  ONE: q,
566
- create: (c) => z(c, e),
567
- isValid: (c) => {
568
- if (typeof c != "bigint")
569
- throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);
570
- return V <= c && c < e;
566
+ create: (a) => z(a, e),
567
+ isValid: (a) => {
568
+ if (typeof a != "bigint")
569
+ throw new Error(`Invalid field element: expected bigint, got ${typeof a}`);
570
+ return V <= a && a < e;
571
571
  },
572
- is0: (c) => c === V,
573
- isOdd: (c) => (c & q) === q,
574
- neg: (c) => z(-c, e),
575
- eql: (c, l) => c === l,
576
- sqr: (c) => z(c * c, e),
577
- add: (c, l) => z(c + l, e),
578
- sub: (c, l) => z(c - l, e),
579
- mul: (c, l) => z(c * l, e),
580
- pow: (c, l) => $i(a, c, l),
581
- div: (c, l) => z(c * Rt(l, e), e),
572
+ is0: (a) => a === V,
573
+ isOdd: (a) => (a & q) === q,
574
+ neg: (a) => z(-a, e),
575
+ eql: (a, l) => a === l,
576
+ sqr: (a) => z(a * a, e),
577
+ add: (a, l) => z(a + l, e),
578
+ sub: (a, l) => z(a - l, e),
579
+ mul: (a, l) => z(a * l, e),
580
+ pow: (a, l) => Ti(c, a, l),
581
+ div: (a, l) => z(a * Rt(l, e), e),
582
582
  // Same as above, but doesn't normalize
583
- sqrN: (c) => c * c,
584
- addN: (c, l) => c + l,
585
- subN: (c, l) => c - l,
586
- mulN: (c, l) => c * l,
587
- inv: (c) => Rt(c, e),
588
- sqrt: r.sqrt || ((c) => o(a, c)),
589
- invertBatch: (c) => Ri(a, c),
583
+ sqrN: (a) => a * a,
584
+ addN: (a, l) => a + l,
585
+ subN: (a, l) => a - l,
586
+ mulN: (a, l) => a * l,
587
+ inv: (a) => Rt(a, e),
588
+ sqrt: r.sqrt || ((a) => o(c, a)),
589
+ invertBatch: (a) => Ri(c, a),
590
590
  // TODO: do we really need constant cmov?
591
591
  // We don't have const-time bigints anyway, so probably will be not very useful
592
- cmov: (c, l, f) => f ? l : c,
593
- toBytes: (c) => n ? Gt(c, s) : xe(c, s),
594
- fromBytes: (c) => {
595
- if (c.length !== s)
596
- throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);
597
- return n ? Wt(c) : G(c);
592
+ cmov: (a, l, f) => f ? l : a,
593
+ toBytes: (a) => n ? Gt(a, s) : xe(a, s),
594
+ fromBytes: (a) => {
595
+ if (a.length !== s)
596
+ throw new Error(`Fp.fromBytes: expected ${s}, got ${a.length}`);
597
+ return n ? Wt(a) : G(a);
598
598
  }
599
599
  });
600
- return Object.freeze(a);
600
+ return Object.freeze(c);
601
601
  }
602
602
  function zn(e) {
603
603
  if (typeof e != "bigint")
@@ -609,15 +609,15 @@ function Zn(e) {
609
609
  const t = zn(e);
610
610
  return t + Math.ceil(t / 2);
611
611
  }
612
- function Pi(e, t, n = !1) {
612
+ function Mi(e, t, n = !1) {
613
613
  const r = e.length, i = zn(t), s = Zn(t);
614
614
  if (r < 16 || r < s || r > 1024)
615
615
  throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);
616
- const o = n ? G(e) : Wt(e), a = z(o, t - q) + q;
617
- return n ? Gt(a, i) : xe(a, i);
616
+ const o = n ? G(e) : Wt(e), c = z(o, t - q) + q;
617
+ return n ? Gt(c, i) : xe(c, i);
618
618
  }
619
619
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
620
- const Mi = BigInt(0), Nt = BigInt(1);
620
+ const Pi = BigInt(0), Nt = BigInt(1);
621
621
  function Hi(e, t) {
622
622
  const n = (i, s) => {
623
623
  const o = s.negate();
@@ -630,9 +630,9 @@ function Hi(e, t) {
630
630
  constTimeNegate: n,
631
631
  // non-const time multiplication ladder
632
632
  unsafeLadder(i, s) {
633
- let o = e.ZERO, a = i;
634
- for (; s > Mi; )
635
- s & Nt && (o = o.add(a)), a = a.double(), s >>= Nt;
633
+ let o = e.ZERO, c = i;
634
+ for (; s > Pi; )
635
+ s & Nt && (o = o.add(c)), c = c.double(), s >>= Nt;
636
636
  return o;
637
637
  },
638
638
  /**
@@ -646,15 +646,15 @@ function Hi(e, t) {
646
646
  * @returns precomputed point tables flattened to a single array
647
647
  */
648
648
  precomputeWindow(i, s) {
649
- const { windows: o, windowSize: a } = r(s), c = [];
649
+ const { windows: o, windowSize: c } = r(s), a = [];
650
650
  let l = i, f = l;
651
651
  for (let u = 0; u < o; u++) {
652
- f = l, c.push(f);
653
- for (let d = 1; d < a; d++)
654
- f = f.add(l), c.push(f);
652
+ f = l, a.push(f);
653
+ for (let d = 1; d < c; d++)
654
+ f = f.add(l), a.push(f);
655
655
  l = f.double();
656
656
  }
657
- return c;
657
+ return a;
658
658
  },
659
659
  /**
660
660
  * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.
@@ -664,27 +664,27 @@ function Hi(e, t) {
664
664
  * @returns real and fake (for const-time) points
665
665
  */
666
666
  wNAF(i, s, o) {
667
- const { windows: a, windowSize: c } = r(i);
667
+ const { windows: c, windowSize: a } = r(i);
668
668
  let l = e.ZERO, f = e.BASE;
669
669
  const u = BigInt(2 ** i - 1), d = 2 ** i, p = BigInt(i);
670
- for (let g = 0; g < a; g++) {
671
- const h = g * c;
670
+ for (let g = 0; g < c; g++) {
671
+ const h = g * a;
672
672
  let y = Number(o & u);
673
- o >>= p, y > c && (y -= d, o += Nt);
673
+ o >>= p, y > a && (y -= d, o += Nt);
674
674
  const w = h, E = h + Math.abs(y) - 1, K = g % 2 !== 0, I = y < 0;
675
675
  y === 0 ? f = f.add(n(K, s[w])) : l = l.add(n(I, s[E]));
676
676
  }
677
677
  return { p: l, f };
678
678
  },
679
- wNAFCached(i, s, o, a) {
680
- const c = i._WINDOW_SIZE || 1;
679
+ wNAFCached(i, s, o, c) {
680
+ const a = i._WINDOW_SIZE || 1;
681
681
  let l = s.get(i);
682
- return l || (l = this.precomputeWindow(i, c), c !== 1 && s.set(i, a(l))), this.wNAF(c, l, o);
682
+ return l || (l = this.precomputeWindow(i, a), a !== 1 && s.set(i, c(l))), this.wNAF(a, l, o);
683
683
  }
684
684
  };
685
685
  }
686
686
  function Fn(e) {
687
- return Ti(e.Fp), Je(e, {
687
+ return $i(e.Fp), Je(e, {
688
688
  n: "bigint",
689
689
  h: "bigint",
690
690
  Gx: "field",
@@ -751,8 +751,8 @@ const { bytesToNumberBE: Di, hexToBytes: ji } = Ci, Be = {
751
751
  throw new t("Invalid signature tag");
752
752
  if (n[1] !== r - 2)
753
753
  throw new t("Invalid signature: incorrect length");
754
- const { d: i, l: s } = Be._parseInt(n.subarray(2)), { d: o, l: a } = Be._parseInt(s);
755
- if (a.length)
754
+ const { d: i, l: s } = Be._parseInt(n.subarray(2)), { d: o, l: c } = Be._parseInt(s);
755
+ if (c.length)
756
756
  throw new t("Invalid signature: left bytes after parsing");
757
757
  return { r: i, s: o };
758
758
  },
@@ -760,8 +760,8 @@ const { bytesToNumberBE: Di, hexToBytes: ji } = Ci, Be = {
760
760
  const t = (l) => Number.parseInt(l[0], 16) & 8 ? "00" + l : l, n = (l) => {
761
761
  const f = l.toString(16);
762
762
  return f.length & 1 ? `0${f}` : f;
763
- }, r = t(n(e.s)), i = t(n(e.r)), s = r.length / 2, o = i.length / 2, a = n(s), c = n(o);
764
- return `30${n(o + s + 4)}02${c}${i}02${a}${r}`;
763
+ }, r = t(n(e.s)), i = t(n(e.r)), s = r.length / 2, o = i.length / 2, c = n(s), a = n(o);
764
+ return `30${n(o + s + 4)}02${a}${i}02${c}${r}`;
765
765
  }
766
766
  }, ce = BigInt(0), Y = BigInt(1);
767
767
  BigInt(2);
@@ -784,11 +784,11 @@ function Vi(e) {
784
784
  function o(g) {
785
785
  return typeof g == "bigint" && ce < g && g < t.n;
786
786
  }
787
- function a(g) {
787
+ function c(g) {
788
788
  if (!o(g))
789
789
  throw new Error("Expected valid bigint: 0 < bigint < curve.n");
790
790
  }
791
- function c(g) {
791
+ function a(g) {
792
792
  const { allowedPrivateKeyLengths: h, nByteLength: y, wrapPrivateKey: w, n: E } = t;
793
793
  if (h && typeof g != "bigint") {
794
794
  if (g instanceof Uint8Array && (g = qe(g)), typeof g != "string" || !h.includes(g.length))
@@ -801,7 +801,7 @@ function Vi(e) {
801
801
  } catch {
802
802
  throw new Error(`private key must be ${y} bytes, hex or bigint, not ${typeof g}`);
803
803
  }
804
- return w && (K = z(K, E)), a(K), K;
804
+ return w && (K = z(K, E)), c(K), K;
805
805
  }
806
806
  const l = /* @__PURE__ */ new Map();
807
807
  function f(g) {
@@ -854,7 +854,7 @@ function Vi(e) {
854
854
  }
855
855
  // Multiplies generator point by privateKey.
856
856
  static fromPrivateKey(h) {
857
- return u.BASE.multiply(c(h));
857
+ return u.BASE.multiply(a(h));
858
858
  }
859
859
  // "Private method", don't use it directly
860
860
  _setWindowSize(h) {
@@ -902,8 +902,8 @@ function Vi(e) {
902
902
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
903
903
  double() {
904
904
  const { a: h, b: y } = t, w = n.mul(y, An), { px: E, py: K, pz: I } = this;
905
- let C = n.ZERO, m = n.ZERO, x = n.ZERO, S = n.mul(E, E), P = n.mul(K, K), U = n.mul(I, I), N = n.mul(E, K);
906
- return N = n.add(N, N), x = n.mul(E, I), x = n.add(x, x), C = n.mul(h, x), m = n.mul(w, U), m = n.add(C, m), C = n.sub(P, m), m = n.add(P, m), m = n.mul(C, m), C = n.mul(N, C), x = n.mul(w, x), U = n.mul(h, U), N = n.sub(S, U), N = n.mul(h, N), N = n.add(N, x), x = n.add(S, S), S = n.add(x, S), S = n.add(S, U), S = n.mul(S, N), m = n.add(m, S), U = n.mul(K, I), U = n.add(U, U), S = n.mul(U, N), C = n.sub(C, S), x = n.mul(U, P), x = n.add(x, x), x = n.add(x, x), new u(C, m, x);
905
+ let C = n.ZERO, m = n.ZERO, x = n.ZERO, S = n.mul(E, E), M = n.mul(K, K), U = n.mul(I, I), N = n.mul(E, K);
906
+ return N = n.add(N, N), x = n.mul(E, I), x = n.add(x, x), C = n.mul(h, x), m = n.mul(w, U), m = n.add(C, m), C = n.sub(M, m), m = n.add(M, m), m = n.mul(C, m), C = n.mul(N, C), x = n.mul(w, x), U = n.mul(h, U), N = n.sub(S, U), N = n.mul(h, N), N = n.add(N, x), x = n.add(S, S), S = n.add(x, S), S = n.add(S, U), S = n.mul(S, N), m = n.add(m, S), U = n.mul(K, I), U = n.add(U, U), S = n.mul(U, N), C = n.sub(C, S), x = n.mul(U, M), x = n.add(x, x), x = n.add(x, x), new u(C, m, x);
907
907
  }
908
908
  // Renes-Costello-Batina exception-free addition formula.
909
909
  // There is 30% faster Jacobian formula, but it is not complete.
@@ -913,11 +913,11 @@ function Vi(e) {
913
913
  f(h);
914
914
  const { px: y, py: w, pz: E } = this, { px: K, py: I, pz: C } = h;
915
915
  let m = n.ZERO, x = n.ZERO, S = n.ZERO;
916
- const P = t.a, U = n.mul(t.b, An);
917
- let N = n.mul(y, K), $ = n.mul(w, I), R = n.mul(E, C), H = n.add(y, w), b = n.add(K, I);
918
- H = n.mul(H, b), b = n.add(N, $), H = n.sub(H, b), b = n.add(y, E);
916
+ const M = t.a, U = n.mul(t.b, An);
917
+ let N = n.mul(y, K), T = n.mul(w, I), R = n.mul(E, C), H = n.add(y, w), b = n.add(K, I);
918
+ H = n.mul(H, b), b = n.add(N, T), H = n.sub(H, b), b = n.add(y, E);
919
919
  let v = n.add(K, C);
920
- return b = n.mul(b, v), v = n.add(N, R), b = n.sub(b, v), v = n.add(w, E), m = n.add(I, C), v = n.mul(v, m), m = n.add($, R), v = n.sub(v, m), S = n.mul(P, b), m = n.mul(U, R), S = n.add(m, S), m = n.sub($, S), S = n.add($, S), x = n.mul(m, S), $ = n.add(N, N), $ = n.add($, N), R = n.mul(P, R), b = n.mul(U, b), $ = n.add($, R), R = n.sub(N, R), R = n.mul(P, R), b = n.add(b, R), N = n.mul($, b), x = n.add(x, N), N = n.mul(v, b), m = n.mul(H, m), m = n.sub(m, N), N = n.mul(H, $), S = n.mul(v, S), S = n.add(S, N), new u(m, x, S);
920
+ return b = n.mul(b, v), v = n.add(N, R), b = n.sub(b, v), v = n.add(w, E), m = n.add(I, C), v = n.mul(v, m), m = n.add(T, R), v = n.sub(v, m), S = n.mul(M, b), m = n.mul(U, R), S = n.add(m, S), m = n.sub(T, S), S = n.add(T, S), x = n.mul(m, S), T = n.add(N, N), T = n.add(T, N), R = n.mul(M, R), b = n.mul(U, b), T = n.add(T, R), R = n.sub(N, R), R = n.mul(M, R), b = n.add(b, R), N = n.mul(T, b), x = n.add(x, N), N = n.mul(v, b), m = n.mul(H, m), m = n.sub(m, N), N = n.mul(H, T), S = n.mul(v, S), S = n.add(S, N), new u(m, x, S);
921
921
  }
922
922
  subtract(h) {
923
923
  return this.add(h.negate());
@@ -940,7 +940,7 @@ function Vi(e) {
940
940
  const y = u.ZERO;
941
941
  if (h === ce)
942
942
  return y;
943
- if (a(h), h === Y)
943
+ if (c(h), h === Y)
944
944
  return this;
945
945
  const { endo: w } = t;
946
946
  if (!w)
@@ -960,13 +960,13 @@ function Vi(e) {
960
960
  * @returns New point
961
961
  */
962
962
  multiply(h) {
963
- a(h);
963
+ c(h);
964
964
  let y = h, w, E;
965
965
  const { endo: K } = t;
966
966
  if (K) {
967
967
  const { k1neg: I, k1: C, k2neg: m, k2: x } = K.splitScalar(y);
968
- let { p: S, f: P } = this.wNAF(C), { p: U, f: N } = this.wNAF(x);
969
- S = p.constTimeNegate(I, S), U = p.constTimeNegate(m, U), U = new u(n.mul(U.px, K.beta), U.py, U.pz), w = S.add(U), E = P.add(N);
968
+ let { p: S, f: M } = this.wNAF(C), { p: U, f: N } = this.wNAF(x);
969
+ S = p.constTimeNegate(I, S), U = p.constTimeNegate(m, U), U = new u(n.mul(U.px, K.beta), U.py, U.pz), w = S.add(U), E = M.add(N);
970
970
  } else {
971
971
  const { p: I, f: C } = this.wNAF(y);
972
972
  w = I, E = C;
@@ -1020,7 +1020,7 @@ function Vi(e) {
1020
1020
  return {
1021
1021
  CURVE: t,
1022
1022
  ProjectivePoint: u,
1023
- normPrivateKeyToScalar: c,
1023
+ normPrivateKeyToScalar: a,
1024
1024
  weierstrassEquation: s,
1025
1025
  isWithinCurveOrder: o
1026
1026
  };
@@ -1042,10 +1042,10 @@ function Zi(e) {
1042
1042
  function o(b) {
1043
1043
  return ce < b && b < n.ORDER;
1044
1044
  }
1045
- function a(b) {
1045
+ function c(b) {
1046
1046
  return z(b, r);
1047
1047
  }
1048
- function c(b) {
1048
+ function a(b) {
1049
1049
  return Rt(b, r);
1050
1050
  }
1051
1051
  const { ProjectivePoint: l, normPrivateKeyToScalar: f, weierstrassEquation: u, isWithinCurveOrder: d } = Vi({
@@ -1062,8 +1062,8 @@ function Zi(e) {
1062
1062
  throw new Error("Point is not on curve");
1063
1063
  const _ = u(B);
1064
1064
  let O = n.sqrt(_);
1065
- const T = (O & Y) === Y;
1066
- return (A & 1) === 1 !== T && (O = n.neg(O)), { x: B, y: O };
1065
+ const $ = (O & Y) === Y;
1066
+ return (A & 1) === 1 !== $ && (O = n.neg(O)), { x: B, y: O };
1067
1067
  } else if (v === s && A === 4) {
1068
1068
  const B = n.fromBytes(k.subarray(0, n.BYTES)), _ = n.fromBytes(k.subarray(n.BYTES, 2 * n.BYTES));
1069
1069
  return { x: B, y: _ };
@@ -1076,7 +1076,7 @@ function Zi(e) {
1076
1076
  return b > v;
1077
1077
  }
1078
1078
  function h(b) {
1079
- return g(b) ? a(-b) : b;
1079
+ return g(b) ? c(-b) : b;
1080
1080
  }
1081
1081
  const y = (b, v, A) => G(b.slice(v, A));
1082
1082
  class w {
@@ -1110,7 +1110,7 @@ function Zi(e) {
1110
1110
  const O = B === 2 || B === 3 ? A + t.n : A;
1111
1111
  if (O >= n.ORDER)
1112
1112
  throw new Error("recovery id 2 or 3 invalid");
1113
- const T = B & 1 ? "03" : "02", X = l.fromHex(T + p(O)), ye = c(O), Ie = a(-_ * ye), ze = a(k * ye), pe = l.BASE.multiplyAndAddUnsafe(X, Ie, ze);
1113
+ const $ = B & 1 ? "03" : "02", X = l.fromHex($ + p(O)), ye = a(O), Ie = c(-_ * ye), ze = c(k * ye), pe = l.BASE.multiplyAndAddUnsafe(X, Ie, ze);
1114
1114
  if (!pe)
1115
1115
  throw new Error("point at infinify");
1116
1116
  return pe.assertValidity(), pe;
@@ -1120,7 +1120,7 @@ function Zi(e) {
1120
1120
  return g(this.s);
1121
1121
  }
1122
1122
  normalizeS() {
1123
- return this.hasHighS() ? new w(this.r, a(-this.s), this.recovery) : this;
1123
+ return this.hasHighS() ? new w(this.r, c(-this.s), this.recovery) : this;
1124
1124
  }
1125
1125
  // DER-encoded
1126
1126
  toDERRawBytes() {
@@ -1152,7 +1152,7 @@ function Zi(e) {
1152
1152
  */
1153
1153
  randomPrivateKey: () => {
1154
1154
  const b = Zn(t.n);
1155
- return Pi(t.randomBytes(b), t.n);
1155
+ return Mi(t.randomBytes(b), t.n);
1156
1156
  },
1157
1157
  /**
1158
1158
  * Creates precompute table for an arbitrary EC point. Makes point "cached".
@@ -1184,9 +1184,9 @@ function Zi(e) {
1184
1184
  const v = G(b), A = b.length * 8 - t.nBitLength;
1185
1185
  return A > 0 ? v >> BigInt(A) : v;
1186
1186
  }, x = t.bits2int_modN || function(b) {
1187
- return a(m(b));
1187
+ return c(m(b));
1188
1188
  }, S = Jt(t.nBitLength);
1189
- function P(b) {
1189
+ function M(b) {
1190
1190
  if (typeof b != "bigint")
1191
1191
  throw new Error("bigint expected");
1192
1192
  if (!(ce <= b && b < S))
@@ -1197,11 +1197,11 @@ function Zi(e) {
1197
1197
  if (["recovered", "canonical"].some((Ke) => Ke in A))
1198
1198
  throw new Error("sign() legacy options not supported");
1199
1199
  const { hash: k, randomBytes: B } = t;
1200
- let { lowS: _, prehash: O, extraEntropy: T } = A;
1200
+ let { lowS: _, prehash: O, extraEntropy: $ } = A;
1201
1201
  _ == null && (_ = !0), b = Z("msgHash", b), O && (b = Z("prehashed msgHash", k(b)));
1202
- const X = x(b), ye = f(v), Ie = [P(ye), P(X)];
1203
- if (T != null) {
1204
- const Ke = T === !0 ? B(n.BYTES) : T;
1202
+ const X = x(b), ye = f(v), Ie = [M(ye), M(X)];
1203
+ if ($ != null) {
1204
+ const Ke = $ === !0 ? B(n.BYTES) : $;
1205
1205
  Ie.push(Z("extraEntropy", Ke));
1206
1206
  }
1207
1207
  const ze = ke(...Ie), pe = X;
@@ -1209,42 +1209,42 @@ function Zi(e) {
1209
1209
  const _e = m(Ke);
1210
1210
  if (!d(_e))
1211
1211
  return;
1212
- const wn = c(_e), Le = l.BASE.multiply(_e).toAffine(), Q = a(Le.x);
1212
+ const wn = a(_e), Le = l.BASE.multiply(_e).toAffine(), Q = c(Le.x);
1213
1213
  if (Q === ce)
1214
1214
  return;
1215
- const Te = a(wn * a(pe + Q * ye));
1216
- if (Te === ce)
1215
+ const $e = c(wn * c(pe + Q * ye));
1216
+ if ($e === ce)
1217
1217
  return;
1218
- let bn = (Le.x === Q ? 0 : 2) | Number(Le.y & Y), vn = Te;
1219
- return _ && g(Te) && (vn = h(Te), bn ^= 1), new w(Q, vn, bn);
1218
+ let bn = (Le.x === Q ? 0 : 2) | Number(Le.y & Y), vn = $e;
1219
+ return _ && g($e) && (vn = h($e), bn ^= 1), new w(Q, vn, bn);
1220
1220
  }
1221
1221
  return { seed: ze, k2sig: xt };
1222
1222
  }
1223
- const N = { lowS: t.lowS, prehash: !1 }, $ = { lowS: t.lowS, prehash: !1 };
1223
+ const N = { lowS: t.lowS, prehash: !1 }, T = { lowS: t.lowS, prehash: !1 };
1224
1224
  function R(b, v, A = N) {
1225
1225
  const { seed: k, k2sig: B } = U(b, v, A), _ = t;
1226
1226
  return jn(_.hash.outputLen, _.nByteLength, _.hmac)(k, B);
1227
1227
  }
1228
1228
  l.BASE._setWindowSize(8);
1229
- function H(b, v, A, k = $) {
1229
+ function H(b, v, A, k = T) {
1230
1230
  var Le;
1231
1231
  const B = b;
1232
1232
  if (v = Z("msgHash", v), A = Z("publicKey", A), "strict" in k)
1233
1233
  throw new Error("options.strict was renamed to lowS");
1234
1234
  const { lowS: _, prehash: O } = k;
1235
- let T, X;
1235
+ let $, X;
1236
1236
  try {
1237
1237
  if (typeof B == "string" || B instanceof Uint8Array)
1238
1238
  try {
1239
- T = w.fromDER(B);
1239
+ $ = w.fromDER(B);
1240
1240
  } catch (Q) {
1241
1241
  if (!(Q instanceof Be.Err))
1242
1242
  throw Q;
1243
- T = w.fromCompact(B);
1243
+ $ = w.fromCompact(B);
1244
1244
  }
1245
1245
  else if (typeof B == "object" && typeof B.r == "bigint" && typeof B.s == "bigint") {
1246
- const { r: Q, s: Te } = B;
1247
- T = new w(Q, Te);
1246
+ const { r: Q, s: $e } = B;
1247
+ $ = new w(Q, $e);
1248
1248
  } else
1249
1249
  throw new Error("PARSE");
1250
1250
  X = l.fromHex(A);
@@ -1253,11 +1253,11 @@ function Zi(e) {
1253
1253
  throw new Error("signature must be Signature instance, Uint8Array or hex string");
1254
1254
  return !1;
1255
1255
  }
1256
- if (_ && T.hasHighS())
1256
+ if (_ && $.hasHighS())
1257
1257
  return !1;
1258
1258
  O && (v = t.hash(v));
1259
- const { r: ye, s: Ie } = T, ze = x(v), pe = c(Ie), xt = a(ze * pe), Ke = a(ye * pe), _e = (Le = l.BASE.multiplyAndAddUnsafe(X, xt, Ke)) == null ? void 0 : Le.toAffine();
1260
- return _e ? a(_e.x) === ye : !1;
1259
+ const { r: ye, s: Ie } = $, ze = x(v), pe = a(Ie), xt = c(ze * pe), Ke = c(ye * pe), _e = (Le = l.BASE.multiplyAndAddUnsafe(X, xt, Ke)) == null ? void 0 : Le.toAffine();
1260
+ return _e ? c(_e.x) === ye : !1;
1261
1261
  }
1262
1262
  return {
1263
1263
  CURVE: t,
@@ -1270,7 +1270,7 @@ function Zi(e) {
1270
1270
  utils: E
1271
1271
  };
1272
1272
  }
1273
- let Wn = class extends Mn {
1273
+ let Wn = class extends Pn {
1274
1274
  constructor(t, n) {
1275
1275
  super(), this.finished = !1, this.destroyed = !1, ai(t);
1276
1276
  const r = Zt(n);
@@ -1298,8 +1298,8 @@ let Wn = class extends Mn {
1298
1298
  }
1299
1299
  _cloneInto(t) {
1300
1300
  t || (t = Object.create(Object.getPrototypeOf(this), {}));
1301
- const { oHash: n, iHash: r, finished: i, destroyed: s, blockLen: o, outputLen: a } = this;
1302
- return t = t, t.finished = i, t.destroyed = s, t.blockLen = o, t.outputLen = a, t.oHash = n._cloneInto(t.oHash), t.iHash = r._cloneInto(t.iHash), t;
1301
+ const { oHash: n, iHash: r, finished: i, destroyed: s, blockLen: o, outputLen: c } = this;
1302
+ return t = t, t.finished = i, t.destroyed = s, t.blockLen = o, t.outputLen = c, t.oHash = n._cloneInto(t.oHash), t.iHash = r._cloneInto(t.iHash), t;
1303
1303
  }
1304
1304
  destroy() {
1305
1305
  this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
@@ -1322,7 +1322,7 @@ function Wi(e, t) {
1322
1322
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1323
1323
  const ut = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), rt = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), Jn = BigInt(1), it = BigInt(2), Kn = (e, t) => (e + t / it) / t;
1324
1324
  function Yn(e) {
1325
- const t = ut, n = BigInt(3), r = BigInt(6), i = BigInt(11), s = BigInt(22), o = BigInt(23), a = BigInt(44), c = BigInt(88), l = e * e * e % t, f = l * l * e % t, u = J(f, n, t) * f % t, d = J(u, n, t) * f % t, p = J(d, it, t) * l % t, g = J(p, i, t) * p % t, h = J(g, s, t) * g % t, y = J(h, a, t) * h % t, w = J(y, c, t) * y % t, E = J(w, a, t) * h % t, K = J(E, n, t) * f % t, I = J(K, o, t) * g % t, C = J(I, r, t) * l % t, m = J(C, it, t);
1325
+ const t = ut, n = BigInt(3), r = BigInt(6), i = BigInt(11), s = BigInt(22), o = BigInt(23), c = BigInt(44), a = BigInt(88), l = e * e * e % t, f = l * l * e % t, u = J(f, n, t) * f % t, d = J(u, n, t) * f % t, p = J(d, it, t) * l % t, g = J(p, i, t) * p % t, h = J(g, s, t) * g % t, y = J(h, c, t) * h % t, w = J(y, a, t) * y % t, E = J(w, c, t) * h % t, K = J(E, n, t) * f % t, I = J(K, o, t) * g % t, C = J(I, r, t) * l % t, m = J(C, it, t);
1326
1326
  if (!Ot.eql(Ot.sqr(m), e))
1327
1327
  throw new Error("Cannot find square root");
1328
1328
  return m;
@@ -1346,25 +1346,25 @@ const Ot = Oi(ut, void 0, void 0, { sqrt: Yn }), Ue = Wi({
1346
1346
  endo: {
1347
1347
  beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
1348
1348
  splitScalar: (e) => {
1349
- const t = rt, n = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), r = -Jn * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), i = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), s = n, o = BigInt("0x100000000000000000000000000000000"), a = Kn(s * e, t), c = Kn(-r * e, t);
1350
- let l = z(e - a * n - c * i, t), f = z(-a * r - c * s, t);
1349
+ const t = rt, n = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), r = -Jn * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), i = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), s = n, o = BigInt("0x100000000000000000000000000000000"), c = Kn(s * e, t), a = Kn(-r * e, t);
1350
+ let l = z(e - c * n - a * i, t), f = z(-c * r - a * s, t);
1351
1351
  const u = l > o, d = f > o;
1352
1352
  if (u && (l = t - l), d && (f = t - f), l > o || f > o)
1353
1353
  throw new Error("splitScalar: Endomorphism failed, k=" + e);
1354
1354
  return { k1neg: u, k1: l, k2neg: d, k2: f };
1355
1355
  }
1356
1356
  }
1357
- }, Tt), ft = BigInt(0), Xn = (e) => typeof e == "bigint" && ft < e && e < ut, Gi = (e) => typeof e == "bigint" && ft < e && e < rt, Nn = {};
1357
+ }, $t), ft = BigInt(0), Xn = (e) => typeof e == "bigint" && ft < e && e < ut, Gi = (e) => typeof e == "bigint" && ft < e && e < rt, Nn = {};
1358
1358
  function st(e, ...t) {
1359
1359
  let n = Nn[e];
1360
1360
  if (n === void 0) {
1361
- const r = Tt(Uint8Array.from(e, (i) => i.charCodeAt(0)));
1361
+ const r = $t(Uint8Array.from(e, (i) => i.charCodeAt(0)));
1362
1362
  n = ke(r, r), Nn[e] = n;
1363
1363
  }
1364
- return Tt(ke(n, ...t));
1364
+ return $t(ke(n, ...t));
1365
1365
  }
1366
- const Yt = (e) => e.toRawBytes(!0).slice(1), Pt = (e) => xe(e, 32), Bt = (e) => z(e, ut), We = (e) => z(e, rt), Xt = Ue.ProjectivePoint, Ji = (e, t, n) => Xt.BASE.multiplyAndAddUnsafe(e, t, n);
1367
- function Mt(e) {
1366
+ const Yt = (e) => e.toRawBytes(!0).slice(1), Mt = (e) => xe(e, 32), Bt = (e) => z(e, ut), We = (e) => z(e, rt), Xt = Ue.ProjectivePoint, Ji = (e, t, n) => Xt.BASE.multiplyAndAddUnsafe(e, t, n);
1367
+ function Pt(e) {
1368
1368
  let t = Ue.utils.normPrivateKeyToScalar(e), n = Xt.fromPrivateKey(t);
1369
1369
  return { scalar: n.hasEvenY() ? t : We(-t), bytes: Yt(n) };
1370
1370
  }
@@ -1381,28 +1381,28 @@ function er(...e) {
1381
1381
  return We(G(st("BIP0340/challenge", ...e)));
1382
1382
  }
1383
1383
  function Yi(e) {
1384
- return Mt(e).bytes;
1384
+ return Pt(e).bytes;
1385
1385
  }
1386
1386
  function Xi(e, t, n = Hn(32)) {
1387
- const r = Z("message", e), { bytes: i, scalar: s } = Mt(t), o = Z("auxRand", n, 32), a = Pt(s ^ G(st("BIP0340/aux", o))), c = st("BIP0340/nonce", a, i, r), l = We(G(c));
1387
+ const r = Z("message", e), { bytes: i, scalar: s } = Pt(t), o = Z("auxRand", n, 32), c = Mt(s ^ G(st("BIP0340/aux", o))), a = st("BIP0340/nonce", c, i, r), l = We(G(a));
1388
1388
  if (l === ft)
1389
1389
  throw new Error("sign failed: k is zero");
1390
- const { bytes: f, scalar: u } = Mt(l), d = er(f, i, r), p = new Uint8Array(64);
1391
- if (p.set(f, 0), p.set(Pt(We(u + d * s)), 32), !tr(p, r, i))
1390
+ const { bytes: f, scalar: u } = Pt(l), d = er(f, i, r), p = new Uint8Array(64);
1391
+ if (p.set(f, 0), p.set(Mt(We(u + d * s)), 32), !tr(p, r, i))
1392
1392
  throw new Error("sign: Invalid signature produced");
1393
1393
  return p;
1394
1394
  }
1395
1395
  function tr(e, t, n) {
1396
1396
  const r = Z("signature", e, 64), i = Z("message", t), s = Z("publicKey", n, 32);
1397
1397
  try {
1398
- const o = Qn(G(s)), a = G(r.subarray(0, 32));
1399
- if (!Xn(a))
1398
+ const o = Qn(G(s)), c = G(r.subarray(0, 32));
1399
+ if (!Xn(c))
1400
1400
  return !1;
1401
- const c = G(r.subarray(32, 64));
1402
- if (!Gi(c))
1401
+ const a = G(r.subarray(32, 64));
1402
+ if (!Gi(a))
1403
1403
  return !1;
1404
- const l = er(Pt(a), Yt(o), i), f = Ji(o, c, We(-l));
1405
- return !(!f || !f.hasEvenY() || f.toAffine().x !== a);
1404
+ const l = er(Mt(c), Yt(o), i), f = Ji(o, a, We(-l));
1405
+ return !(!f || !f.hasEvenY() || f.toAffine().x !== c);
1406
1406
  } catch {
1407
1407
  return !1;
1408
1408
  }
@@ -1426,7 +1426,7 @@ const Qt = (e) => e instanceof Uint8Array, kt = (e) => new DataView(e.buffer, e.
1426
1426
  if (!Qi)
1427
1427
  throw new Error("Non little-endian hardware is not supported");
1428
1428
  const es = Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
1429
- function M(e) {
1429
+ function P(e) {
1430
1430
  if (!Qt(e))
1431
1431
  throw new Error("Uint8Array expected");
1432
1432
  let t = "";
@@ -1525,8 +1525,8 @@ const se = {
1525
1525
  function os(e, t, n, r) {
1526
1526
  if (typeof e.setBigUint64 == "function")
1527
1527
  return e.setBigUint64(t, n, r);
1528
- const i = BigInt(32), s = BigInt(4294967295), o = Number(n >> i & s), a = Number(n & s), c = r ? 4 : 0, l = r ? 0 : 4;
1529
- e.setUint32(t + c, o, r), e.setUint32(t + l, a, r);
1528
+ const i = BigInt(32), s = BigInt(4294967295), o = Number(n >> i & s), c = Number(n & s), a = r ? 4 : 0, l = r ? 0 : 4;
1529
+ e.setUint32(t + a, o, r), e.setUint32(t + l, c, r);
1530
1530
  }
1531
1531
  class as extends nr {
1532
1532
  constructor(t, n, r, i) {
@@ -1538,14 +1538,14 @@ class as extends nr {
1538
1538
  t = Ge(t);
1539
1539
  const s = t.length;
1540
1540
  for (let o = 0; o < s; ) {
1541
- const a = Math.min(i - this.pos, s - o);
1542
- if (a === i) {
1543
- const c = kt(t);
1541
+ const c = Math.min(i - this.pos, s - o);
1542
+ if (c === i) {
1543
+ const a = kt(t);
1544
1544
  for (; i <= s - o; o += i)
1545
- this.process(c, o);
1545
+ this.process(a, o);
1546
1546
  continue;
1547
1547
  }
1548
- r.set(t.subarray(o, o + a), this.pos), this.pos += a, o += a, this.pos === i && (this.process(n, 0), this.pos = 0);
1548
+ r.set(t.subarray(o, o + c), this.pos), this.pos += c, o += c, this.pos === i && (this.process(n, 0), this.pos = 0);
1549
1549
  }
1550
1550
  return this.length += t.length, this.roundClean(), this;
1551
1551
  }
@@ -1557,14 +1557,14 @@ class as extends nr {
1557
1557
  for (let u = o; u < i; u++)
1558
1558
  n[u] = 0;
1559
1559
  os(r, i - 8, BigInt(this.length * 8), s), this.process(r, 0);
1560
- const a = kt(t), c = this.outputLen;
1561
- if (c % 4)
1560
+ const c = kt(t), a = this.outputLen;
1561
+ if (a % 4)
1562
1562
  throw new Error("_sha2: outputLen should be aligned to 32bit");
1563
- const l = c / 4, f = this.get();
1563
+ const l = a / 4, f = this.get();
1564
1564
  if (l > f.length)
1565
1565
  throw new Error("_sha2: outputLen bigger than state");
1566
1566
  for (let u = 0; u < l; u++)
1567
- a.setUint32(4 * u, f[u], s);
1567
+ c.setUint32(4 * u, f[u], s);
1568
1568
  }
1569
1569
  digest() {
1570
1570
  const { buffer: t, outputLen: n } = this;
@@ -1574,8 +1574,8 @@ class as extends nr {
1574
1574
  }
1575
1575
  _cloneInto(t) {
1576
1576
  t || (t = new this.constructor()), t.set(...this.get());
1577
- const { blockLen: n, buffer: r, length: i, finished: s, destroyed: o, pos: a } = this;
1578
- return t.length = i, t.pos = a, t.finished = s, t.destroyed = o, i % n && t.buffer.set(r), t;
1577
+ const { blockLen: n, buffer: r, length: i, finished: s, destroyed: o, pos: c } = this;
1578
+ return t.length = i, t.pos = c, t.finished = s, t.destroyed = o, i % n && t.buffer.set(r), t;
1579
1579
  }
1580
1580
  }
1581
1581
  const cs = (e, t, n) => e & t ^ ~e & n, ls = (e, t, n) => e & t ^ e & n ^ t & n, us = new Uint32Array([
@@ -1658,12 +1658,12 @@ class or extends as {
1658
1658
  super(64, 32, 8, !1), this.A = be[0] | 0, this.B = be[1] | 0, this.C = be[2] | 0, this.D = be[3] | 0, this.E = be[4] | 0, this.F = be[5] | 0, this.G = be[6] | 0, this.H = be[7] | 0;
1659
1659
  }
1660
1660
  get() {
1661
- const { A: t, B: n, C: r, D: i, E: s, F: o, G: a, H: c } = this;
1662
- return [t, n, r, i, s, o, a, c];
1661
+ const { A: t, B: n, C: r, D: i, E: s, F: o, G: c, H: a } = this;
1662
+ return [t, n, r, i, s, o, c, a];
1663
1663
  }
1664
1664
  // prettier-ignore
1665
- set(t, n, r, i, s, o, a, c) {
1666
- this.A = t | 0, this.B = n | 0, this.C = r | 0, this.D = i | 0, this.E = s | 0, this.F = o | 0, this.G = a | 0, this.H = c | 0;
1665
+ set(t, n, r, i, s, o, c, a) {
1666
+ this.A = t | 0, this.B = n | 0, this.C = r | 0, this.D = i | 0, this.E = s | 0, this.F = o | 0, this.G = c | 0, this.H = a | 0;
1667
1667
  }
1668
1668
  process(t, n) {
1669
1669
  for (let u = 0; u < 16; u++, n += 4)
@@ -1672,12 +1672,12 @@ class or extends as {
1672
1672
  const d = ve[u - 15], p = ve[u - 2], g = re(d, 7) ^ re(d, 18) ^ d >>> 3, h = re(p, 17) ^ re(p, 19) ^ p >>> 10;
1673
1673
  ve[u] = h + ve[u - 7] + g + ve[u - 16] | 0;
1674
1674
  }
1675
- let { A: r, B: i, C: s, D: o, E: a, F: c, G: l, H: f } = this;
1675
+ let { A: r, B: i, C: s, D: o, E: c, F: a, G: l, H: f } = this;
1676
1676
  for (let u = 0; u < 64; u++) {
1677
- const d = re(a, 6) ^ re(a, 11) ^ re(a, 25), p = f + d + cs(a, c, l) + us[u] + ve[u] | 0, h = (re(r, 2) ^ re(r, 13) ^ re(r, 22)) + ls(r, i, s) | 0;
1678
- f = l, l = c, c = a, a = o + p | 0, o = s, s = i, i = r, r = p + h | 0;
1677
+ const d = re(c, 6) ^ re(c, 11) ^ re(c, 25), p = f + d + cs(c, a, l) + us[u] + ve[u] | 0, h = (re(r, 2) ^ re(r, 13) ^ re(r, 22)) + ls(r, i, s) | 0;
1678
+ f = l, l = a, a = c, c = o + p | 0, o = s, s = i, i = r, r = p + h | 0;
1679
1679
  }
1680
- r = r + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, f = f + this.H | 0, this.set(r, i, s, o, a, c, l, f);
1680
+ r = r + this.A | 0, i = i + this.B | 0, s = s + this.C | 0, o = o + this.D | 0, c = c + this.E | 0, a = a + this.F | 0, l = l + this.G | 0, f = f + this.H | 0, this.set(r, i, s, o, c, a, l, f);
1681
1681
  }
1682
1682
  roundClean() {
1683
1683
  ve.fill(0);
@@ -1796,18 +1796,18 @@ function Bn(e, t, n) {
1796
1796
  if (Ve(o), o < 0 || o >= t)
1797
1797
  throw new Error(`Wrong integer: ${o}`);
1798
1798
  }); ; ) {
1799
- let o = 0, a = !0;
1800
- for (let c = r; c < s.length; c++) {
1801
- const l = s[c], f = t * o + l;
1799
+ let o = 0, c = !0;
1800
+ for (let a = r; a < s.length; a++) {
1801
+ const l = s[a], f = t * o + l;
1802
1802
  if (!Number.isSafeInteger(f) || t * o / t !== o || f - l !== t * o)
1803
1803
  throw new Error("convertRadix: carry overflow");
1804
- if (o = f % n, s[c] = Math.floor(f / n), !Number.isSafeInteger(s[c]) || s[c] * n + o !== f)
1804
+ if (o = f % n, s[a] = Math.floor(f / n), !Number.isSafeInteger(s[a]) || s[a] * n + o !== f)
1805
1805
  throw new Error("convertRadix: carry overflow");
1806
- if (a)
1807
- s[c] ? a = !1 : r = c;
1806
+ if (c)
1807
+ s[a] ? c = !1 : r = a;
1808
1808
  else continue;
1809
1809
  }
1810
- if (i.push(o), a)
1810
+ if (i.push(o), c)
1811
1811
  break;
1812
1812
  }
1813
1813
  for (let o = 0; o < e.length - 1 && e[o] === 0; o++)
@@ -1825,21 +1825,21 @@ function qt(e, t, n, r) {
1825
1825
  if (ot(t, n) > 32)
1826
1826
  throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${ot(t, n)}`);
1827
1827
  let i = 0, s = 0;
1828
- const o = 2 ** n - 1, a = [];
1829
- for (const c of e) {
1830
- if (Ve(c), c >= 2 ** t)
1831
- throw new Error(`convertRadix2: invalid data word=${c} from=${t}`);
1832
- if (i = i << t | c, s + t > 32)
1828
+ const o = 2 ** n - 1, c = [];
1829
+ for (const a of e) {
1830
+ if (Ve(a), a >= 2 ** t)
1831
+ throw new Error(`convertRadix2: invalid data word=${a} from=${t}`);
1832
+ if (i = i << t | a, s + t > 32)
1833
1833
  throw new Error(`convertRadix2: carry overflow pos=${s} from=${t}`);
1834
1834
  for (s += t; s >= n; s -= n)
1835
- a.push((i >> s - n & o) >>> 0);
1835
+ c.push((i >> s - n & o) >>> 0);
1836
1836
  i &= 2 ** s - 1;
1837
1837
  }
1838
1838
  if (i = i << n - s & o, !r && s >= t)
1839
1839
  throw new Error("Excess padding");
1840
1840
  if (!r && i)
1841
1841
  throw new Error(`Non-zero padding: ${i}`);
1842
- return r && s > 0 && a.push(i >>> 0), a;
1842
+ return r && s > 0 && c.push(i >>> 0), c;
1843
1843
  }
1844
1844
  function hs(e) {
1845
1845
  return Ve(e), {
@@ -1947,7 +1947,7 @@ function lr(e) {
1947
1947
  throw new TypeError(`Length ${p} exceeds limit ${d}`);
1948
1948
  return f = f.toLowerCase(), `${f}1${jt.encode(u)}${In(f, u, t)}`;
1949
1949
  }
1950
- function a(f, u = 90) {
1950
+ function c(f, u = 90) {
1951
1951
  if (typeof f != "string")
1952
1952
  throw new Error(`bech32.decode input should be string, not ${typeof f}`);
1953
1953
  if (f.length < 8 || u !== !1 && f.length > u)
@@ -1967,12 +1967,12 @@ function lr(e) {
1967
1967
  throw new Error(`Invalid checksum in ${f}: expected "${w}"`);
1968
1968
  return { prefix: g, words: y };
1969
1969
  }
1970
- const c = Cn(a);
1970
+ const a = Cn(c);
1971
1971
  function l(f) {
1972
- const { prefix: u, words: d } = a(f, !1);
1972
+ const { prefix: u, words: d } = c(f, !1);
1973
1973
  return { prefix: u, words: d, bytes: r(d) };
1974
1974
  }
1975
- return { encode: o, decode: a, decodeToBytes: l, decodeUnsafe: c, fromWords: r, fromWordsUnsafe: s, toWords: i };
1975
+ return { encode: o, decode: c, decodeToBytes: l, decodeUnsafe: a, fromWords: r, fromWordsUnsafe: s, toWords: i };
1976
1976
  }
1977
1977
  const je = lr("bech32");
1978
1978
  lr("bech32m");
@@ -2032,7 +2032,7 @@ const As = /* @__NO_SIDE_EFFECTS__ */ (e, t) => (Object.assign(t, e), t), Ee = 1
2032
2032
  function tn(e) {
2033
2033
  return e << 1 ^ Ks & -(e >> 7);
2034
2034
  }
2035
- function Pe(e, t) {
2035
+ function Me(e, t) {
2036
2036
  let n = 0;
2037
2037
  for (; t > 0; t >>= 1)
2038
2038
  n ^= e & -(t & 1), e = tn(e);
@@ -2053,15 +2053,15 @@ const Vt = /* @__PURE__ */ (() => {
2053
2053
  function ur(e, t) {
2054
2054
  if (e.length !== 256)
2055
2055
  throw new Error("Wrong sbox length");
2056
- const n = new Uint32Array(256).map((l, f) => t(e[f])), r = n.map(It), i = r.map(It), s = i.map(It), o = new Uint32Array(256 * 256), a = new Uint32Array(256 * 256), c = new Uint16Array(256 * 256);
2056
+ const n = new Uint32Array(256).map((l, f) => t(e[f])), r = n.map(It), i = r.map(It), s = i.map(It), o = new Uint32Array(256 * 256), c = new Uint32Array(256 * 256), a = new Uint16Array(256 * 256);
2057
2057
  for (let l = 0; l < 256; l++)
2058
2058
  for (let f = 0; f < 256; f++) {
2059
2059
  const u = l * 256 + f;
2060
- o[u] = n[l] ^ r[f], a[u] = i[l] ^ s[f], c[u] = e[l] << 8 | e[f];
2060
+ o[u] = n[l] ^ r[f], c[u] = i[l] ^ s[f], a[u] = e[l] << 8 | e[f];
2061
2061
  }
2062
- return { sbox: e, sbox2: c, T0: n, T1: r, T2: i, T3: s, T01: o, T23: a };
2062
+ return { sbox: e, sbox2: a, T0: n, T1: r, T2: i, T3: s, T01: o, T23: c };
2063
2063
  }
2064
- const nn = /* @__PURE__ */ ur(Vt, (e) => Pe(e, 3) << 24 | e << 16 | e << 8 | Pe(e, 2)), fr = /* @__PURE__ */ ur(Ns, (e) => Pe(e, 11) << 24 | Pe(e, 13) << 16 | Pe(e, 9) << 8 | Pe(e, 14)), Cs = /* @__PURE__ */ (() => {
2064
+ const nn = /* @__PURE__ */ ur(Vt, (e) => Me(e, 3) << 24 | e << 16 | e << 8 | Me(e, 2)), fr = /* @__PURE__ */ ur(Ns, (e) => Me(e, 11) << 24 | Me(e, 13) << 16 | Me(e, 9) << 8 | Me(e, 14)), Cs = /* @__PURE__ */ (() => {
2065
2065
  const e = new Uint8Array(16);
2066
2066
  for (let t = 0, n = 1; t < 16; t++, n = tn(n))
2067
2067
  e[t] = n;
@@ -2072,23 +2072,23 @@ function hr(e) {
2072
2072
  const t = e.length;
2073
2073
  if (![16, 24, 32].includes(t))
2074
2074
  throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${t}`);
2075
- const { sbox2: n } = nn, r = F(e), i = r.length, s = (a) => oe(n, a, a, a, a), o = new Uint32Array(t + 28);
2075
+ const { sbox2: n } = nn, r = F(e), i = r.length, s = (c) => oe(n, c, c, c, c), o = new Uint32Array(t + 28);
2076
2076
  o.set(r);
2077
- for (let a = i; a < o.length; a++) {
2078
- let c = o[a - 1];
2079
- a % i === 0 ? c = s(Bs(c)) ^ Cs[a / i - 1] : i > 6 && a % i === 4 && (c = s(c)), o[a] = o[a - i] ^ c;
2077
+ for (let c = i; c < o.length; c++) {
2078
+ let a = o[c - 1];
2079
+ c % i === 0 ? a = s(Bs(a)) ^ Cs[c / i - 1] : i > 6 && c % i === 4 && (a = s(a)), o[c] = o[c - i] ^ a;
2080
2080
  }
2081
2081
  return o;
2082
2082
  }
2083
2083
  function ks(e) {
2084
- const t = hr(e), n = t.slice(), r = t.length, { sbox2: i } = nn, { T0: s, T1: o, T2: a, T3: c } = fr;
2084
+ const t = hr(e), n = t.slice(), r = t.length, { sbox2: i } = nn, { T0: s, T1: o, T2: c, T3: a } = fr;
2085
2085
  for (let l = 0; l < r; l += 4)
2086
2086
  for (let f = 0; f < 4; f++)
2087
2087
  n[l + f] = t[r - l - 4 + f];
2088
2088
  t.fill(0);
2089
2089
  for (let l = 4; l < r - 4; l++) {
2090
2090
  const f = n[l], u = oe(i, f, f, f, f);
2091
- n[l] = s[u & 255] ^ o[u >>> 8 & 255] ^ a[u >>> 16 & 255] ^ c[u >>> 24];
2091
+ n[l] = s[u & 255] ^ o[u >>> 8 & 255] ^ c[u >>> 16 & 255] ^ a[u >>> 24];
2092
2092
  }
2093
2093
  return n;
2094
2094
  }
@@ -2099,27 +2099,27 @@ function oe(e, t, n, r, i) {
2099
2099
  return e[t & 255 | n & 65280] | e[r >>> 16 & 255 | i >>> 16 & 65280] << 16;
2100
2100
  }
2101
2101
  function Ln(e, t, n, r, i) {
2102
- const { sbox2: s, T01: o, T23: a } = nn;
2103
- let c = 0;
2104
- t ^= e[c++], n ^= e[c++], r ^= e[c++], i ^= e[c++];
2102
+ const { sbox2: s, T01: o, T23: c } = nn;
2103
+ let a = 0;
2104
+ t ^= e[a++], n ^= e[a++], r ^= e[a++], i ^= e[a++];
2105
2105
  const l = e.length / 4 - 2;
2106
2106
  for (let g = 0; g < l; g++) {
2107
- const h = e[c++] ^ me(o, a, t, n, r, i), y = e[c++] ^ me(o, a, n, r, i, t), w = e[c++] ^ me(o, a, r, i, t, n), E = e[c++] ^ me(o, a, i, t, n, r);
2107
+ const h = e[a++] ^ me(o, c, t, n, r, i), y = e[a++] ^ me(o, c, n, r, i, t), w = e[a++] ^ me(o, c, r, i, t, n), E = e[a++] ^ me(o, c, i, t, n, r);
2108
2108
  t = h, n = y, r = w, i = E;
2109
2109
  }
2110
- const f = e[c++] ^ oe(s, t, n, r, i), u = e[c++] ^ oe(s, n, r, i, t), d = e[c++] ^ oe(s, r, i, t, n), p = e[c++] ^ oe(s, i, t, n, r);
2110
+ const f = e[a++] ^ oe(s, t, n, r, i), u = e[a++] ^ oe(s, n, r, i, t), d = e[a++] ^ oe(s, r, i, t, n), p = e[a++] ^ oe(s, i, t, n, r);
2111
2111
  return { s0: f, s1: u, s2: d, s3: p };
2112
2112
  }
2113
2113
  function Us(e, t, n, r, i) {
2114
- const { sbox2: s, T01: o, T23: a } = fr;
2115
- let c = 0;
2116
- t ^= e[c++], n ^= e[c++], r ^= e[c++], i ^= e[c++];
2114
+ const { sbox2: s, T01: o, T23: c } = fr;
2115
+ let a = 0;
2116
+ t ^= e[a++], n ^= e[a++], r ^= e[a++], i ^= e[a++];
2117
2117
  const l = e.length / 4 - 2;
2118
2118
  for (let g = 0; g < l; g++) {
2119
- const h = e[c++] ^ me(o, a, t, i, r, n), y = e[c++] ^ me(o, a, n, t, i, r), w = e[c++] ^ me(o, a, r, n, t, i), E = e[c++] ^ me(o, a, i, r, n, t);
2119
+ const h = e[a++] ^ me(o, c, t, i, r, n), y = e[a++] ^ me(o, c, n, t, i, r), w = e[a++] ^ me(o, c, r, n, t, i), E = e[a++] ^ me(o, c, i, r, n, t);
2120
2120
  t = h, n = y, r = w, i = E;
2121
2121
  }
2122
- const f = e[c++] ^ oe(s, t, i, r, n), u = e[c++] ^ oe(s, n, t, i, r), d = e[c++] ^ oe(s, r, n, t, i), p = e[c++] ^ oe(s, i, r, n, t);
2122
+ const f = e[a++] ^ oe(s, t, i, r, n), u = e[a++] ^ oe(s, n, t, i, r), d = e[a++] ^ oe(s, r, n, t, i), p = e[a++] ^ oe(s, i, r, n, t);
2123
2123
  return { s0: f, s1: u, s2: d, s3: p };
2124
2124
  }
2125
2125
  function dr(e, t) {
@@ -2140,11 +2140,11 @@ function _s(e, t, n) {
2140
2140
  throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");
2141
2141
  const s = F(e);
2142
2142
  if (t) {
2143
- let c = Ee - i;
2144
- c || (c = Ee), r = r + c;
2143
+ let a = Ee - i;
2144
+ a || (a = Ee), r = r + a;
2145
2145
  }
2146
- const o = dr(r, n), a = F(o);
2147
- return { b: s, o: a, out: o };
2146
+ const o = dr(r, n), c = F(o);
2147
+ return { b: s, o: c, out: o };
2148
2148
  }
2149
2149
  function Ls(e, t) {
2150
2150
  if (!t)
@@ -2161,7 +2161,7 @@ function Ls(e, t) {
2161
2161
  throw new Error("aes/pcks5: wrong padding");
2162
2162
  return i;
2163
2163
  }
2164
- function Ts(e) {
2164
+ function $s(e) {
2165
2165
  const t = new Uint8Array(16), n = F(t);
2166
2166
  t.set(e);
2167
2167
  const r = Ee - e.length;
@@ -2174,30 +2174,30 @@ const yr = /* @__PURE__ */ As({ blockSize: 16, nonceLength: 16 }, function(t, n,
2174
2174
  const i = !r.disablePadding;
2175
2175
  return {
2176
2176
  encrypt: (s, o) => {
2177
- const a = hr(t), { b: c, o: l, out: f } = _s(s, i, o), u = F(n);
2177
+ const c = hr(t), { b: a, o: l, out: f } = _s(s, i, o), u = F(n);
2178
2178
  let d = u[0], p = u[1], g = u[2], h = u[3], y = 0;
2179
- for (; y + 4 <= c.length; )
2180
- d ^= c[y + 0], p ^= c[y + 1], g ^= c[y + 2], h ^= c[y + 3], { s0: d, s1: p, s2: g, s3: h } = Ln(a, d, p, g, h), l[y++] = d, l[y++] = p, l[y++] = g, l[y++] = h;
2179
+ for (; y + 4 <= a.length; )
2180
+ d ^= a[y + 0], p ^= a[y + 1], g ^= a[y + 2], h ^= a[y + 3], { s0: d, s1: p, s2: g, s3: h } = Ln(c, d, p, g, h), l[y++] = d, l[y++] = p, l[y++] = g, l[y++] = h;
2181
2181
  if (i) {
2182
- const w = Ts(s.subarray(y * 4));
2183
- d ^= w[0], p ^= w[1], g ^= w[2], h ^= w[3], { s0: d, s1: p, s2: g, s3: h } = Ln(a, d, p, g, h), l[y++] = d, l[y++] = p, l[y++] = g, l[y++] = h;
2182
+ const w = $s(s.subarray(y * 4));
2183
+ d ^= w[0], p ^= w[1], g ^= w[2], h ^= w[3], { s0: d, s1: p, s2: g, s3: h } = Ln(c, d, p, g, h), l[y++] = d, l[y++] = p, l[y++] = g, l[y++] = h;
2184
2184
  }
2185
- return a.fill(0), f;
2185
+ return c.fill(0), f;
2186
2186
  },
2187
2187
  decrypt: (s, o) => {
2188
2188
  Is(s);
2189
- const a = ks(t), c = F(n), l = dr(s.length, o), f = F(s), u = F(l);
2190
- let d = c[0], p = c[1], g = c[2], h = c[3];
2189
+ const c = ks(t), a = F(n), l = dr(s.length, o), f = F(s), u = F(l);
2190
+ let d = a[0], p = a[1], g = a[2], h = a[3];
2191
2191
  for (let y = 0; y + 4 <= f.length; ) {
2192
2192
  const w = d, E = p, K = g, I = h;
2193
2193
  d = f[y + 0], p = f[y + 1], g = f[y + 2], h = f[y + 3];
2194
- const { s0: C, s1: m, s2: x, s3: S } = Us(a, d, p, g, h);
2194
+ const { s0: C, s1: m, s2: x, s3: S } = Us(c, d, p, g, h);
2195
2195
  u[y++] = C ^ w, u[y++] = m ^ E, u[y++] = x ^ K, u[y++] = S ^ I;
2196
2196
  }
2197
- return a.fill(0), Ls(l, i);
2197
+ return c.fill(0), Ls(l, i);
2198
2198
  }
2199
2199
  };
2200
- }), pr = (e) => Uint8Array.from(e.split("").map((t) => t.charCodeAt(0))), $s = pr("expand 16-byte k"), Rs = pr("expand 32-byte k"), Os = F($s), gr = F(Rs);
2200
+ }), pr = (e) => Uint8Array.from(e.split("").map((t) => t.charCodeAt(0))), Ts = pr("expand 16-byte k"), Rs = pr("expand 32-byte k"), Os = F(Ts), gr = F(Rs);
2201
2201
  gr.slice();
2202
2202
  function L(e, t) {
2203
2203
  return e << t | e >>> 32 - t;
@@ -2205,18 +2205,18 @@ function L(e, t) {
2205
2205
  function zt(e) {
2206
2206
  return e.byteOffset % 4 === 0;
2207
2207
  }
2208
- const Xe = 64, Ps = 16, wr = 2 ** 32 - 1, Tn = new Uint32Array();
2209
- function Ms(e, t, n, r, i, s, o, a) {
2210
- const c = i.length, l = new Uint8Array(Xe), f = F(l), u = zt(i) && zt(s), d = u ? F(i) : Tn, p = u ? F(s) : Tn;
2211
- for (let g = 0; g < c; o++) {
2212
- if (e(t, n, r, f, o, a), o >= wr)
2208
+ const Xe = 64, Ms = 16, wr = 2 ** 32 - 1, $n = new Uint32Array();
2209
+ function Ps(e, t, n, r, i, s, o, c) {
2210
+ const a = i.length, l = new Uint8Array(Xe), f = F(l), u = zt(i) && zt(s), d = u ? F(i) : $n, p = u ? F(s) : $n;
2211
+ for (let g = 0; g < a; o++) {
2212
+ if (e(t, n, r, f, o, c), o >= wr)
2213
2213
  throw new Error("arx: counter overflow");
2214
- const h = Math.min(Xe, c - g);
2214
+ const h = Math.min(Xe, a - g);
2215
2215
  if (u && h === Xe) {
2216
2216
  const y = g / 4;
2217
2217
  if (g % 4 !== 0)
2218
2218
  throw new Error("arx: invalid block position");
2219
- for (let w = 0, E; w < Ps; w++)
2219
+ for (let w = 0, E; w < Ms; w++)
2220
2220
  E = y + w, p[E] = d[E] ^ f[w];
2221
2221
  g += Xe;
2222
2222
  continue;
@@ -2230,47 +2230,47 @@ function Hs(e, t) {
2230
2230
  const { allowShortKeys: n, extendNonceFn: r, counterLength: i, counterRight: s, rounds: o } = xs({ allowShortKeys: !1, counterLength: 8, counterRight: !1, rounds: 20 }, t);
2231
2231
  if (typeof e != "function")
2232
2232
  throw new Error("core must be a function");
2233
- return Ut(i), Ut(o), _n(s), _n(n), (a, c, l, f, u = 0) => {
2234
- le(a), le(c), le(l);
2233
+ return Ut(i), Ut(o), _n(s), _n(n), (c, a, l, f, u = 0) => {
2234
+ le(c), le(a), le(l);
2235
2235
  const d = l.length;
2236
2236
  if (f || (f = new Uint8Array(d)), le(f), Ut(u), u < 0 || u >= wr)
2237
2237
  throw new Error("arx: counter overflow");
2238
2238
  if (f.length < d)
2239
2239
  throw new Error(`arx: output (${f.length}) is shorter than data (${d})`);
2240
2240
  const p = [];
2241
- let g = a.length, h, y;
2241
+ let g = c.length, h, y;
2242
2242
  if (g === 32)
2243
- h = a.slice(), p.push(h), y = gr;
2243
+ h = c.slice(), p.push(h), y = gr;
2244
2244
  else if (g === 16 && n)
2245
- h = new Uint8Array(32), h.set(a), h.set(a, 16), y = Os, p.push(h);
2245
+ h = new Uint8Array(32), h.set(c), h.set(c, 16), y = Os, p.push(h);
2246
2246
  else
2247
2247
  throw new Error(`arx: invalid 32-byte key, got length=${g}`);
2248
- zt(c) || (c = c.slice(), p.push(c));
2248
+ zt(a) || (a = a.slice(), p.push(a));
2249
2249
  const w = F(h);
2250
2250
  if (r) {
2251
- if (c.length !== 24)
2251
+ if (a.length !== 24)
2252
2252
  throw new Error("arx: extended nonce must be 24 bytes");
2253
- r(y, w, F(c.subarray(0, 16)), w), c = c.subarray(16);
2253
+ r(y, w, F(a.subarray(0, 16)), w), a = a.subarray(16);
2254
2254
  }
2255
2255
  const E = 16 - i;
2256
- if (E !== c.length)
2256
+ if (E !== a.length)
2257
2257
  throw new Error(`arx: nonce must be ${E} or 16 bytes`);
2258
2258
  if (E !== 12) {
2259
2259
  const I = new Uint8Array(12);
2260
- I.set(c, s ? 0 : 12 - c.length), c = I, p.push(c);
2260
+ I.set(a, s ? 0 : 12 - a.length), a = I, p.push(a);
2261
2261
  }
2262
- const K = F(c);
2263
- for (Ms(e, y, w, K, l, f, u, o); p.length > 0; )
2262
+ const K = F(a);
2263
+ for (Ps(e, y, w, K, l, f, u, o); p.length > 0; )
2264
2264
  p.pop().fill(0);
2265
2265
  return f;
2266
2266
  };
2267
2267
  }
2268
2268
  function qs(e, t, n, r, i, s = 20) {
2269
- let o = e[0], a = e[1], c = e[2], l = e[3], f = t[0], u = t[1], d = t[2], p = t[3], g = t[4], h = t[5], y = t[6], w = t[7], E = i, K = n[0], I = n[1], C = n[2], m = o, x = a, S = c, P = l, U = f, N = u, $ = d, R = p, H = g, b = h, v = y, A = w, k = E, B = K, _ = I, O = C;
2269
+ let o = e[0], c = e[1], a = e[2], l = e[3], f = t[0], u = t[1], d = t[2], p = t[3], g = t[4], h = t[5], y = t[6], w = t[7], E = i, K = n[0], I = n[1], C = n[2], m = o, x = c, S = a, M = l, U = f, N = u, T = d, R = p, H = g, b = h, v = y, A = w, k = E, B = K, _ = I, O = C;
2270
2270
  for (let X = 0; X < s; X += 2)
2271
- m = m + U | 0, k = L(k ^ m, 16), H = H + k | 0, U = L(U ^ H, 12), m = m + U | 0, k = L(k ^ m, 8), H = H + k | 0, U = L(U ^ H, 7), x = x + N | 0, B = L(B ^ x, 16), b = b + B | 0, N = L(N ^ b, 12), x = x + N | 0, B = L(B ^ x, 8), b = b + B | 0, N = L(N ^ b, 7), S = S + $ | 0, _ = L(_ ^ S, 16), v = v + _ | 0, $ = L($ ^ v, 12), S = S + $ | 0, _ = L(_ ^ S, 8), v = v + _ | 0, $ = L($ ^ v, 7), P = P + R | 0, O = L(O ^ P, 16), A = A + O | 0, R = L(R ^ A, 12), P = P + R | 0, O = L(O ^ P, 8), A = A + O | 0, R = L(R ^ A, 7), m = m + N | 0, O = L(O ^ m, 16), v = v + O | 0, N = L(N ^ v, 12), m = m + N | 0, O = L(O ^ m, 8), v = v + O | 0, N = L(N ^ v, 7), x = x + $ | 0, k = L(k ^ x, 16), A = A + k | 0, $ = L($ ^ A, 12), x = x + $ | 0, k = L(k ^ x, 8), A = A + k | 0, $ = L($ ^ A, 7), S = S + R | 0, B = L(B ^ S, 16), H = H + B | 0, R = L(R ^ H, 12), S = S + R | 0, B = L(B ^ S, 8), H = H + B | 0, R = L(R ^ H, 7), P = P + U | 0, _ = L(_ ^ P, 16), b = b + _ | 0, U = L(U ^ b, 12), P = P + U | 0, _ = L(_ ^ P, 8), b = b + _ | 0, U = L(U ^ b, 7);
2272
- let T = 0;
2273
- r[T++] = o + m | 0, r[T++] = a + x | 0, r[T++] = c + S | 0, r[T++] = l + P | 0, r[T++] = f + U | 0, r[T++] = u + N | 0, r[T++] = d + $ | 0, r[T++] = p + R | 0, r[T++] = g + H | 0, r[T++] = h + b | 0, r[T++] = y + v | 0, r[T++] = w + A | 0, r[T++] = E + k | 0, r[T++] = K + B | 0, r[T++] = I + _ | 0, r[T++] = C + O | 0;
2271
+ m = m + U | 0, k = L(k ^ m, 16), H = H + k | 0, U = L(U ^ H, 12), m = m + U | 0, k = L(k ^ m, 8), H = H + k | 0, U = L(U ^ H, 7), x = x + N | 0, B = L(B ^ x, 16), b = b + B | 0, N = L(N ^ b, 12), x = x + N | 0, B = L(B ^ x, 8), b = b + B | 0, N = L(N ^ b, 7), S = S + T | 0, _ = L(_ ^ S, 16), v = v + _ | 0, T = L(T ^ v, 12), S = S + T | 0, _ = L(_ ^ S, 8), v = v + _ | 0, T = L(T ^ v, 7), M = M + R | 0, O = L(O ^ M, 16), A = A + O | 0, R = L(R ^ A, 12), M = M + R | 0, O = L(O ^ M, 8), A = A + O | 0, R = L(R ^ A, 7), m = m + N | 0, O = L(O ^ m, 16), v = v + O | 0, N = L(N ^ v, 12), m = m + N | 0, O = L(O ^ m, 8), v = v + O | 0, N = L(N ^ v, 7), x = x + T | 0, k = L(k ^ x, 16), A = A + k | 0, T = L(T ^ A, 12), x = x + T | 0, k = L(k ^ x, 8), A = A + k | 0, T = L(T ^ A, 7), S = S + R | 0, B = L(B ^ S, 16), H = H + B | 0, R = L(R ^ H, 12), S = S + R | 0, B = L(B ^ S, 8), H = H + B | 0, R = L(R ^ H, 7), M = M + U | 0, _ = L(_ ^ M, 16), b = b + _ | 0, U = L(U ^ b, 12), M = M + U | 0, _ = L(_ ^ M, 8), b = b + _ | 0, U = L(U ^ b, 7);
2272
+ let $ = 0;
2273
+ r[$++] = o + m | 0, r[$++] = c + x | 0, r[$++] = a + S | 0, r[$++] = l + M | 0, r[$++] = f + U | 0, r[$++] = u + N | 0, r[$++] = d + T | 0, r[$++] = p + R | 0, r[$++] = g + H | 0, r[$++] = h + b | 0, r[$++] = y + v | 0, r[$++] = w + A | 0, r[$++] = E + k | 0, r[$++] = K + B | 0, r[$++] = I + _ | 0, r[$++] = C + O | 0;
2274
2274
  }
2275
2275
  const br = /* @__PURE__ */ Hs(qs, {
2276
2276
  counterRight: !1,
@@ -2305,8 +2305,8 @@ class vr extends nr {
2305
2305
  }
2306
2306
  _cloneInto(t) {
2307
2307
  t || (t = Object.create(Object.getPrototypeOf(this), {}));
2308
- const { oHash: n, iHash: r, finished: i, destroyed: s, blockLen: o, outputLen: a } = this;
2309
- return t = t, t.finished = i, t.destroyed = s, t.blockLen = o, t.outputLen = a, t.oHash = n._cloneInto(t.oHash), t.iHash = r._cloneInto(t.iHash), t;
2308
+ const { oHash: n, iHash: r, finished: i, destroyed: s, blockLen: o, outputLen: c } = this;
2309
+ return t = t, t.finished = i, t.destroyed = s, t.blockLen = o, t.outputLen = c, t.oHash = n._cloneInto(t.oHash), t.iHash = r._cloneInto(t.iHash), t;
2310
2310
  }
2311
2311
  destroy() {
2312
2312
  this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
@@ -2317,21 +2317,21 @@ yt.create = (e, t) => new vr(e, t);
2317
2317
  function rn(e, t, n) {
2318
2318
  return se.hash(e), n === void 0 && (n = new Uint8Array(e.outputLen)), yt(e, Ge(n), Ge(t));
2319
2319
  }
2320
- const _t = new Uint8Array([0]), $n = new Uint8Array();
2320
+ const _t = new Uint8Array([0]), Tn = new Uint8Array();
2321
2321
  function mr(e, t, n, r = 32) {
2322
2322
  if (se.hash(e), se.number(r), r > 255 * e.outputLen)
2323
2323
  throw new Error("Length should be <= 255*HashLen");
2324
2324
  const i = Math.ceil(r / e.outputLen);
2325
- n === void 0 && (n = $n);
2326
- const s = new Uint8Array(i * e.outputLen), o = yt.create(e, t), a = o._cloneInto(), c = new Uint8Array(o.outputLen);
2325
+ n === void 0 && (n = Tn);
2326
+ const s = new Uint8Array(i * e.outputLen), o = yt.create(e, t), c = o._cloneInto(), a = new Uint8Array(o.outputLen);
2327
2327
  for (let l = 0; l < i; l++)
2328
- _t[0] = l + 1, a.update(l === 0 ? $n : c).update(n).update(_t).digestInto(c), s.set(c, e.outputLen * l), o._cloneInto(a);
2329
- return o.destroy(), a.destroy(), c.fill(0), _t.fill(0), s.slice(0, r);
2328
+ _t[0] = l + 1, c.update(l === 0 ? Tn : a).update(n).update(_t).digestInto(a), s.set(a, e.outputLen * l), o._cloneInto(c);
2329
+ return o.destroy(), c.destroy(), a.fill(0), _t.fill(0), s.slice(0, r);
2330
2330
  }
2331
2331
  var Ds = Object.defineProperty, D = (e, t) => {
2332
2332
  for (var n in t)
2333
2333
  Ds(e, n, { get: t[n], enumerable: !0 });
2334
- }, $e = Symbol("verified"), js = (e) => e instanceof Object;
2334
+ }, Te = Symbol("verified"), js = (e) => e instanceof Object;
2335
2335
  function Er(e) {
2336
2336
  if (!js(e) || typeof e.kind != "number" || typeof e.content != "string" || typeof e.created_at != "number" || typeof e.pubkey != "string" || !e.pubkey.match(/^[a-f0-9]{64}$/) || !Array.isArray(e.tags))
2337
2337
  return !1;
@@ -2412,23 +2412,23 @@ var xr = class {
2412
2412
  return Ze.utils.randomPrivateKey();
2413
2413
  }
2414
2414
  getPublicKey(e) {
2415
- return M(Ze.getPublicKey(e));
2415
+ return P(Ze.getPublicKey(e));
2416
2416
  }
2417
2417
  finalizeEvent(e, t) {
2418
2418
  const n = e;
2419
- return n.pubkey = M(Ze.getPublicKey(t)), n.id = tt(n), n.sig = M(Ze.sign(tt(n), t)), n[$e] = !0, n;
2419
+ return n.pubkey = P(Ze.getPublicKey(t)), n.id = tt(n), n.sig = P(Ze.sign(tt(n), t)), n[Te] = !0, n;
2420
2420
  }
2421
2421
  verifyEvent(e) {
2422
- if (typeof e[$e] == "boolean")
2423
- return e[$e];
2422
+ if (typeof e[Te] == "boolean")
2423
+ return e[Te];
2424
2424
  const t = tt(e);
2425
2425
  if (t !== e.id)
2426
- return e[$e] = !1, !1;
2426
+ return e[Te] = !1, !1;
2427
2427
  try {
2428
2428
  const n = Ze.verify(e.sig, t, e.pubkey);
2429
- return e[$e] = n, n;
2429
+ return e[Te] = n, n;
2430
2430
  } catch {
2431
- return e[$e] = !1, !1;
2431
+ return e[Te] = !1, !1;
2432
2432
  }
2433
2433
  }
2434
2434
  };
@@ -2439,9 +2439,9 @@ function Js(e) {
2439
2439
  }
2440
2440
  function tt(e) {
2441
2441
  let t = Se(te.encode(Js(e)));
2442
- return M(t);
2442
+ return P(t);
2443
2443
  }
2444
- var pt = new Gs(), Me = pt.generateSecretKey, Ce = pt.getPublicKey, ae = pt.finalizeEvent, gt = pt.verifyEvent, Ys = {};
2444
+ var pt = new Gs(), Pe = pt.generateSecretKey, Ce = pt.getPublicKey, ae = pt.finalizeEvent, gt = pt.verifyEvent, Ys = {};
2445
2445
  D(Ys, {
2446
2446
  Application: () => Xo,
2447
2447
  BadgeAward: () => oo,
@@ -2473,8 +2473,8 @@ D(Ys, {
2473
2473
  EncryptedDirectMessages: () => io,
2474
2474
  EventDeletion: () => so,
2475
2475
  FileMetadata: () => lo,
2476
- FileServerPreference: () => To,
2477
- Followsets: () => Mo,
2476
+ FileServerPreference: () => $o,
2477
+ Followsets: () => Po,
2478
2478
  GenericRepost: () => ao,
2479
2479
  Genericlists: () => Ho,
2480
2480
  HTTPAuth: () => cn,
@@ -2493,10 +2493,10 @@ D(Ys, {
2493
2493
  LongFormArticle: () => Go,
2494
2494
  Metadata: () => Qs,
2495
2495
  Mutelist: () => Ao,
2496
- NWCWalletInfo: () => $o,
2496
+ NWCWalletInfo: () => To,
2497
2497
  NWCWalletRequest: () => Lr,
2498
2498
  NWCWalletResponse: () => Oo,
2499
- NostrConnect: () => Po,
2499
+ NostrConnect: () => Mo,
2500
2500
  OpenTimestamps: () => co,
2501
2501
  Pinlist: () => Ko,
2502
2502
  ProblemTracker: () => fo,
@@ -2538,10 +2538,10 @@ function Nr(e) {
2538
2538
  function Xs(e) {
2539
2539
  return Sr(e) ? "regular" : Ar(e) ? "replaceable" : Kr(e) ? "ephemeral" : Nr(e) ? "parameterized" : "unknown";
2540
2540
  }
2541
- var Qs = 0, eo = 1, to = 2, no = 3, ro = 4, io = 4, so = 5, on = 6, an = 7, oo = 8, ao = 16, Br = 40, Cr = 41, kr = 42, Ur = 43, Ir = 44, co = 1040, lo = 1063, uo = 1311, fo = 1971, ho = 1984, yo = 1984, po = 1985, go = 4550, wo = 5999, bo = 6999, vo = 7e3, mo = 9041, Eo = 9734, xo = 9735, So = 9802, Ao = 1e4, Ko = 10001, No = 10002, Bo = 10003, Co = 10004, ko = 10005, Uo = 10006, Io = 10007, _o = 10015, Lo = 10030, To = 10096, $o = 13194, Ro = 21e3, _r = 22242, Lr = 23194, Oo = 23195, Po = 24133, cn = 27235, Mo = 3e4, Ho = 30001, qo = 30002, Do = 30003, jo = 30004, Vo = 30008, zo = 30009, Zo = 30015, Fo = 30017, Wo = 30018, Go = 30023, Jo = 30024, Yo = 30030, Xo = 30078, Qo = 30311, ea = 30315, ta = 30402, na = 30403, ra = 31922, ia = 31923, sa = 31924, oa = 31925, aa = 31989, ca = 31990, la = 34550, ua = {};
2541
+ var Qs = 0, eo = 1, to = 2, no = 3, ro = 4, io = 4, so = 5, on = 6, an = 7, oo = 8, ao = 16, Br = 40, Cr = 41, kr = 42, Ur = 43, Ir = 44, co = 1040, lo = 1063, uo = 1311, fo = 1971, ho = 1984, yo = 1984, po = 1985, go = 4550, wo = 5999, bo = 6999, vo = 7e3, mo = 9041, Eo = 9734, xo = 9735, So = 9802, Ao = 1e4, Ko = 10001, No = 10002, Bo = 10003, Co = 10004, ko = 10005, Uo = 10006, Io = 10007, _o = 10015, Lo = 10030, $o = 10096, To = 13194, Ro = 21e3, _r = 22242, Lr = 23194, Oo = 23195, Mo = 24133, cn = 27235, Po = 3e4, Ho = 30001, qo = 30002, Do = 30003, jo = 30004, Vo = 30008, zo = 30009, Zo = 30015, Fo = 30017, Wo = 30018, Go = 30023, Jo = 30024, Yo = 30030, Xo = 30078, Qo = 30311, ea = 30315, ta = 30402, na = 30403, ra = 31922, ia = 31923, sa = 31924, oa = 31925, aa = 31989, ca = 31990, la = 34550, ua = {};
2542
2542
  D(ua, {
2543
2543
  getHex64: () => ln,
2544
- getInt: () => Tr,
2544
+ getInt: () => $r,
2545
2545
  getSubscriptionId: () => fa,
2546
2546
  matchEventId: () => ha,
2547
2547
  matchEventKind: () => ya,
@@ -2551,7 +2551,7 @@ function ln(e, t) {
2551
2551
  let n = t.length + 3, r = e.indexOf(`"${t}":`) + n, i = e.slice(r).indexOf('"') + r + 1;
2552
2552
  return e.slice(i, i + 64);
2553
2553
  }
2554
- function Tr(e, t) {
2554
+ function $r(e, t) {
2555
2555
  let n = t.length, r = e.indexOf(`"${t}":`) + n + 3, i = e.slice(r), s = Math.min(i.indexOf(","), i.indexOf("}"));
2556
2556
  return parseInt(i.slice(0, s), 10);
2557
2557
  }
@@ -2575,7 +2575,7 @@ function da(e, t) {
2575
2575
  return t === ln(e, "pubkey");
2576
2576
  }
2577
2577
  function ya(e, t) {
2578
- return t === Tr(e, "kind");
2578
+ return t === $r(e, "kind");
2579
2579
  }
2580
2580
  var pa = {};
2581
2581
  D(pa, {
@@ -2604,7 +2604,7 @@ try {
2604
2604
  }
2605
2605
  var va = {};
2606
2606
  D(va, {
2607
- BECH32_REGEX: () => $r,
2607
+ BECH32_REGEX: () => Tr,
2608
2608
  Bech32MaxSize: () => un,
2609
2609
  decode: () => wt,
2610
2610
  encodeBytes: () => bt,
@@ -2616,13 +2616,13 @@ D(va, {
2616
2616
  nrelayEncode: () => Ba,
2617
2617
  nsecEncode: () => Ea
2618
2618
  });
2619
- var un = 5e3, $r = /[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;
2619
+ var un = 5e3, Tr = /[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;
2620
2620
  function ma(e) {
2621
2621
  const t = new Uint8Array(4);
2622
2622
  return t[0] = e >> 24 & 255, t[1] = e >> 16 & 255, t[2] = e >> 8 & 255, t[3] = e & 255, t;
2623
2623
  }
2624
2624
  function wt(e) {
2625
- var i, s, o, a, c, l, f, u;
2625
+ var i, s, o, c, a, l, f, u;
2626
2626
  let { prefix: t, words: n } = je.decode(e, un), r = new Uint8Array(je.fromWords(n));
2627
2627
  switch (t) {
2628
2628
  case "nprofile": {
@@ -2634,7 +2634,7 @@ function wt(e) {
2634
2634
  return {
2635
2635
  type: "nprofile",
2636
2636
  data: {
2637
- pubkey: M(d[0][0]),
2637
+ pubkey: P(d[0][0]),
2638
2638
  relays: d[1] ? d[1].map((p) => ie.decode(p)) : []
2639
2639
  }
2640
2640
  };
@@ -2652,16 +2652,16 @@ function wt(e) {
2652
2652
  return {
2653
2653
  type: "nevent",
2654
2654
  data: {
2655
- id: M(d[0][0]),
2655
+ id: P(d[0][0]),
2656
2656
  relays: d[1] ? d[1].map((p) => ie.decode(p)) : [],
2657
- author: (o = d[2]) != null && o[0] ? M(d[2][0]) : void 0,
2658
- kind: (a = d[3]) != null && a[0] ? parseInt(M(d[3][0]), 16) : void 0
2657
+ author: (o = d[2]) != null && o[0] ? P(d[2][0]) : void 0,
2658
+ kind: (c = d[3]) != null && c[0] ? parseInt(P(d[3][0]), 16) : void 0
2659
2659
  }
2660
2660
  };
2661
2661
  }
2662
2662
  case "naddr": {
2663
2663
  let d = Qe(r);
2664
- if (!((c = d[0]) != null && c[0]))
2664
+ if (!((a = d[0]) != null && a[0]))
2665
2665
  throw new Error("missing TLV 0 for naddr");
2666
2666
  if (!((l = d[2]) != null && l[0]))
2667
2667
  throw new Error("missing TLV 2 for naddr");
@@ -2675,8 +2675,8 @@ function wt(e) {
2675
2675
  type: "naddr",
2676
2676
  data: {
2677
2677
  identifier: ie.decode(d[0][0]),
2678
- pubkey: M(d[2][0]),
2679
- kind: parseInt(M(d[3][0]), 16),
2678
+ pubkey: P(d[2][0]),
2679
+ kind: parseInt(P(d[3][0]), 16),
2680
2680
  relays: d[1] ? d[1].map((p) => ie.decode(p)) : []
2681
2681
  }
2682
2682
  };
@@ -2694,7 +2694,7 @@ function wt(e) {
2694
2694
  return { type: t, data: r };
2695
2695
  case "npub":
2696
2696
  case "note":
2697
- return { type: t, data: M(r) };
2697
+ return { type: t, data: P(r) };
2698
2698
  default:
2699
2699
  throw new Error(`unknown prefix ${t}`);
2700
2700
  }
@@ -2775,13 +2775,13 @@ D(Ca, {
2775
2775
  encrypt: () => Rr
2776
2776
  });
2777
2777
  async function Rr(e, t, n) {
2778
- const r = e instanceof Uint8Array ? M(e) : e, i = Ue.getSharedSecret(r, "02" + t), s = Or(i);
2779
- let o = Uint8Array.from(ir(16)), a = te.encode(n), c = yr(s, o).encrypt(a), l = ue.encode(new Uint8Array(c)), f = ue.encode(new Uint8Array(o.buffer));
2778
+ const r = e instanceof Uint8Array ? P(e) : e, i = Ue.getSharedSecret(r, "02" + t), s = Or(i);
2779
+ let o = Uint8Array.from(ir(16)), c = te.encode(n), a = yr(s, o).encrypt(c), l = ue.encode(new Uint8Array(a)), f = ue.encode(new Uint8Array(o.buffer));
2780
2780
  return `${l}?iv=${f}`;
2781
2781
  }
2782
2782
  async function ka(e, t, n) {
2783
- const r = e instanceof Uint8Array ? M(e) : e;
2784
- let [i, s] = n.split("?iv="), o = Ue.getSharedSecret(r, "02" + t), a = Or(o), c = ue.decode(s), l = ue.decode(i), f = yr(a, c).decrypt(l);
2783
+ const r = e instanceof Uint8Array ? P(e) : e;
2784
+ let [i, s] = n.split("?iv="), o = Ue.getSharedSecret(r, "02" + t), c = Or(o), a = ue.decode(s), l = ue.decode(i), f = yr(c, a).decrypt(l);
2785
2785
  return ie.decode(f);
2786
2786
  }
2787
2787
  function Or(e) {
@@ -2789,13 +2789,13 @@ function Or(e) {
2789
2789
  }
2790
2790
  var Ua = {};
2791
2791
  D(Ua, {
2792
- NIP05_REGEX: () => Pr,
2792
+ NIP05_REGEX: () => Mr,
2793
2793
  isValid: () => La,
2794
- queryProfile: () => Mr,
2794
+ queryProfile: () => Pr,
2795
2795
  searchDomain: () => _a,
2796
2796
  useFetchImplementation: () => Ia
2797
2797
  });
2798
- var Pr = /^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/, mt;
2798
+ var Mr = /^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/, mt;
2799
2799
  try {
2800
2800
  mt = fetch;
2801
2801
  } catch {
@@ -2811,29 +2811,29 @@ async function _a(e, t = "") {
2811
2811
  return {};
2812
2812
  }
2813
2813
  }
2814
- async function Mr(e) {
2814
+ async function Pr(e) {
2815
2815
  var s;
2816
- const t = e.match(Pr);
2816
+ const t = e.match(Mr);
2817
2817
  if (!t)
2818
2818
  return null;
2819
2819
  const [n, r = "_", i] = t;
2820
2820
  try {
2821
- const o = `https://${i}/.well-known/nostr.json?name=${r}`, a = await (await mt(o, { redirect: "error" })).json();
2822
- let c = a.names[r];
2823
- return c ? { pubkey: c, relays: (s = a.relays) == null ? void 0 : s[c] } : null;
2821
+ const o = `https://${i}/.well-known/nostr.json?name=${r}`, c = await (await mt(o, { redirect: "error" })).json();
2822
+ let a = c.names[r];
2823
+ return a ? { pubkey: a, relays: (s = c.relays) == null ? void 0 : s[a] } : null;
2824
2824
  } catch {
2825
2825
  return null;
2826
2826
  }
2827
2827
  }
2828
2828
  async function La(e, t) {
2829
- let n = await Mr(t);
2829
+ let n = await Pr(t);
2830
2830
  return n ? n.pubkey === e : !1;
2831
2831
  }
2832
- var Ta = {};
2833
- D(Ta, {
2834
- parse: () => $a
2832
+ var $a = {};
2833
+ D($a, {
2834
+ parse: () => Ta
2835
2835
  });
2836
- function $a(e) {
2836
+ function Ta(e) {
2837
2837
  const t = {
2838
2838
  reply: void 0,
2839
2839
  root: void 0,
@@ -2846,19 +2846,19 @@ function $a(e) {
2846
2846
  relays: r[2] ? [r[2]] : []
2847
2847
  });
2848
2848
  for (let r = 0; r < n.length; r++) {
2849
- const i = n[r], [s, o, a, c] = i, l = {
2849
+ const i = n[r], [s, o, c, a] = i, l = {
2850
2850
  id: o,
2851
- relays: a ? [a] : []
2851
+ relays: c ? [c] : []
2852
2852
  }, f = r === 0, u = r === n.length - 1;
2853
- if (c === "root") {
2853
+ if (a === "root") {
2854
2854
  t.root = l;
2855
2855
  continue;
2856
2856
  }
2857
- if (c === "reply") {
2857
+ if (a === "reply") {
2858
2858
  t.reply = l;
2859
2859
  continue;
2860
2860
  }
2861
- if (c === "mention") {
2861
+ if (a === "mention") {
2862
2862
  t.mentions.push(l);
2863
2863
  continue;
2864
2864
  }
@@ -2876,7 +2876,7 @@ function $a(e) {
2876
2876
  }
2877
2877
  var Ra = {};
2878
2878
  D(Ra, {
2879
- fetchRelayInformation: () => Pa,
2879
+ fetchRelayInformation: () => Ma,
2880
2880
  useFetchImplementation: () => Oa
2881
2881
  });
2882
2882
  var Hr;
@@ -2887,13 +2887,13 @@ try {
2887
2887
  function Oa(e) {
2888
2888
  Hr = e;
2889
2889
  }
2890
- async function Pa(e) {
2890
+ async function Ma(e) {
2891
2891
  return await (await fetch(e.replace("ws://", "http://").replace("wss://", "https://"), {
2892
2892
  headers: { Accept: "application/nostr+json" }
2893
2893
  })).json();
2894
2894
  }
2895
- var Ma = {};
2896
- D(Ma, {
2895
+ var Pa = {};
2896
+ D(Pa, {
2897
2897
  getPow: () => qr,
2898
2898
  minePow: () => Ha
2899
2899
  });
@@ -2971,7 +2971,7 @@ D(Va, {
2971
2971
  parse: () => Za,
2972
2972
  test: () => za
2973
2973
  });
2974
- var Et = new RegExp(`nostr:(${$r.source})`);
2974
+ var Et = new RegExp(`nostr:(${Tr.source})`);
2975
2975
  function za(e) {
2976
2976
  return typeof e == "string" && new RegExp(`^${Et.source}$`).test(e);
2977
2977
  }
@@ -3258,12 +3258,12 @@ function yc(e) {
3258
3258
  };
3259
3259
  }
3260
3260
  function Gr(e, t, n = ir(32)) {
3261
- const { chacha_key: r, chacha_nonce: i, hmac_key: s } = Fr(t, n), o = hc(e), a = br(r, i, o), c = Wr(s, a, n);
3262
- return ue.encode(ht(new Uint8Array([2]), n, a, c));
3261
+ const { chacha_key: r, chacha_nonce: i, hmac_key: s } = Fr(t, n), o = hc(e), c = br(r, i, o), a = Wr(s, c, n);
3262
+ return ue.encode(ht(new Uint8Array([2]), n, c, a));
3263
3263
  }
3264
3264
  function Jr(e, t) {
3265
- const { nonce: n, ciphertext: r, mac: i } = yc(e), { chacha_key: s, chacha_nonce: o, hmac_key: a } = Fr(t, n), c = Wr(a, r, n);
3266
- if (!Ss(c, i))
3265
+ const { nonce: n, ciphertext: r, mac: i } = yc(e), { chacha_key: s, chacha_nonce: o, hmac_key: c } = Fr(t, n), a = Wr(c, r, n);
3266
+ if (!Ss(a, i))
3267
3267
  throw new Error("invalid MAC");
3268
3268
  const l = br(s, o, r);
3269
3269
  return dc(l);
@@ -3320,11 +3320,11 @@ async function Ec(e) {
3320
3320
  try {
3321
3321
  let t = "", { lud06: n, lud16: r } = JSON.parse(e.content);
3322
3322
  if (n) {
3323
- let { words: o } = je.decode(n, 1e3), a = je.fromWords(o);
3324
- t = ie.decode(a);
3323
+ let { words: o } = je.decode(n, 1e3), c = je.fromWords(o);
3324
+ t = ie.decode(c);
3325
3325
  } else if (r) {
3326
- let [o, a] = r.split("@");
3327
- t = new URL(`/.well-known/lnurlp/${o}`, `https://${a}`).toString();
3326
+ let [o, c] = r.split("@");
3327
+ t = new URL(`/.well-known/lnurlp/${o}`, `https://${c}`).toString();
3328
3328
  } else
3329
3329
  return null;
3330
3330
  let s = await (await pn(t)).json();
@@ -3382,7 +3382,7 @@ function Ac({
3382
3382
  bolt11: n,
3383
3383
  paidAt: r
3384
3384
  }) {
3385
- let i = JSON.parse(e), s = i.tags.filter(([a]) => a === "e" || a === "p" || a === "a"), o = {
3385
+ let i = JSON.parse(e), s = i.tags.filter(([c]) => c === "e" || c === "p" || c === "a"), o = {
3386
3386
  kind: 9735,
3387
3387
  created_at: Math.round(r.getTime() / 1e3),
3388
3388
  content: "",
@@ -3451,7 +3451,7 @@ function ni(e, t) {
3451
3451
  }
3452
3452
  function gn(e) {
3453
3453
  const t = Se(te.encode(JSON.stringify(e)));
3454
- return M(t);
3454
+ return P(t);
3455
3455
  }
3456
3456
  function ri(e, t) {
3457
3457
  const n = e.tags.find((i) => i[0] === "payload");
@@ -3479,36 +3479,36 @@ const He = 4, Rn = 30078, Rc = 100;
3479
3479
  var Cc = /* @__PURE__ */ ((e) => (e[e.Us = 0] = "Us", e[e.Them = 1] = "Them", e))(Cc || {});
3480
3480
  function Oc(e) {
3481
3481
  return JSON.stringify({
3482
- rootKey: M(e.rootKey),
3482
+ rootKey: P(e.rootKey),
3483
3483
  theirNostrPublicKey: e.theirNostrPublicKey,
3484
3484
  ourCurrentNostrKey: e.ourCurrentNostrKey ? {
3485
3485
  publicKey: e.ourCurrentNostrKey.publicKey,
3486
- privateKey: M(e.ourCurrentNostrKey.privateKey)
3486
+ privateKey: P(e.ourCurrentNostrKey.privateKey)
3487
3487
  } : void 0,
3488
3488
  ourNextNostrKey: {
3489
3489
  publicKey: e.ourNextNostrKey.publicKey,
3490
- privateKey: M(e.ourNextNostrKey.privateKey)
3490
+ privateKey: P(e.ourNextNostrKey.privateKey)
3491
3491
  },
3492
- receivingChainKey: e.receivingChainKey ? M(e.receivingChainKey) : void 0,
3493
- sendingChainKey: e.sendingChainKey ? M(e.sendingChainKey) : void 0,
3492
+ receivingChainKey: e.receivingChainKey ? P(e.receivingChainKey) : void 0,
3493
+ sendingChainKey: e.sendingChainKey ? P(e.sendingChainKey) : void 0,
3494
3494
  sendingChainMessageNumber: e.sendingChainMessageNumber,
3495
3495
  receivingChainMessageNumber: e.receivingChainMessageNumber,
3496
3496
  previousSendingChainMessageCount: e.previousSendingChainMessageCount,
3497
3497
  skippedMessageKeys: Object.fromEntries(
3498
3498
  Object.entries(e.skippedMessageKeys).map(([t, n]) => [
3499
3499
  t,
3500
- M(n)
3500
+ P(n)
3501
3501
  ])
3502
3502
  ),
3503
3503
  skippedHeaderKeys: Object.fromEntries(
3504
3504
  Object.entries(e.skippedHeaderKeys).map(([t, n]) => [
3505
3505
  t,
3506
- n.map((r) => M(r))
3506
+ n.map((r) => P(r))
3507
3507
  ])
3508
3508
  )
3509
3509
  });
3510
3510
  }
3511
- function Pc(e) {
3511
+ function Mc(e) {
3512
3512
  const t = JSON.parse(e);
3513
3513
  return {
3514
3514
  rootKey: W(t.rootKey),
@@ -3540,7 +3540,7 @@ function Pc(e) {
3540
3540
  )
3541
3541
  };
3542
3542
  }
3543
- async function* Mc(e) {
3543
+ async function* Pc(e) {
3544
3544
  const t = [];
3545
3545
  let n = null;
3546
3546
  const r = e.onMessage((i) => {
@@ -3586,11 +3586,11 @@ class at {
3586
3586
  * @returns A new Channel instance
3587
3587
  */
3588
3588
  static init(t, n, r, i, s, o) {
3589
- const a = Me(), [c, l] = Re(s, j.getConversationKey(a, n), 2);
3589
+ const c = Pe(), [a, l] = Re(s, j.getConversationKey(c, n), 2);
3590
3590
  let f, u;
3591
- i ? (f = { publicKey: Ce(r), privateKey: r }, u = { publicKey: Ce(a), privateKey: a }) : u = { publicKey: Ce(r), privateKey: r };
3591
+ i ? (f = { publicKey: Ce(r), privateKey: r }, u = { publicKey: Ce(c), privateKey: c }) : u = { publicKey: Ce(r), privateKey: r };
3592
3592
  const d = {
3593
- rootKey: i ? c : s,
3593
+ rootKey: i ? a : s,
3594
3594
  theirNostrPublicKey: n,
3595
3595
  ourCurrentNostrKey: f,
3596
3596
  ourNextNostrKey: u,
@@ -3655,26 +3655,26 @@ class at {
3655
3655
  this.state.receivingChainKey = s, this.state.receivingChainMessageNumber++;
3656
3656
  try {
3657
3657
  return j.decrypt(n, o);
3658
- } catch (a) {
3659
- throw console.error(this.name, "Decryption failed:", a, {
3660
- messageKey: M(o).slice(0, 4),
3661
- receivingChainKey: M(this.state.receivingChainKey).slice(0, 4),
3662
- sendingChainKey: this.state.sendingChainKey && M(this.state.sendingChainKey).slice(0, 4),
3663
- rootKey: M(this.state.rootKey).slice(0, 4)
3664
- }), a;
3658
+ } catch (c) {
3659
+ throw console.error(this.name, "Decryption failed:", c, {
3660
+ messageKey: P(o).slice(0, 4),
3661
+ receivingChainKey: P(this.state.receivingChainKey).slice(0, 4),
3662
+ sendingChainKey: this.state.sendingChainKey && P(this.state.sendingChainKey).slice(0, 4),
3663
+ rootKey: P(this.state.rootKey).slice(0, 4)
3664
+ }), c;
3665
3665
  }
3666
3666
  }
3667
3667
  ratchetStep(t) {
3668
3668
  this.state.previousSendingChainMessageCount = this.state.sendingChainMessageNumber, this.state.sendingChainMessageNumber = 0, this.state.receivingChainMessageNumber = 0, this.state.theirNostrPublicKey = t;
3669
3669
  const n = j.getConversationKey(this.state.ourNextNostrKey.privateKey, this.state.theirNostrPublicKey), [r, i] = Re(this.state.rootKey, n, 2);
3670
3670
  this.state.receivingChainKey = i, this.state.ourCurrentNostrKey = this.state.ourNextNostrKey;
3671
- const s = Me();
3671
+ const s = Pe();
3672
3672
  this.state.ourNextNostrKey = {
3673
3673
  publicKey: Ce(s),
3674
3674
  privateKey: s
3675
3675
  };
3676
- const o = j.getConversationKey(this.state.ourNextNostrKey.privateKey, this.state.theirNostrPublicKey), [a, c] = Re(r, o, 2);
3677
- this.state.rootKey = a, this.state.sendingChainKey = c;
3676
+ const o = j.getConversationKey(this.state.ourNextNostrKey.privateKey, this.state.theirNostrPublicKey), [c, a] = Re(r, o, 2);
3677
+ this.state.rootKey = c, this.state.sendingChainKey = a;
3678
3678
  }
3679
3679
  // 3. MESSAGE KEY FUNCTIONS
3680
3680
  skipMessageKeys(t, n) {
@@ -3687,11 +3687,11 @@ class at {
3687
3687
  if (this.state.skippedMessageKeys[s] = i, !this.state.skippedHeaderKeys[n]) {
3688
3688
  const o = [];
3689
3689
  if (this.state.ourCurrentNostrKey) {
3690
- const c = j.getConversationKey(this.state.ourCurrentNostrKey.privateKey, n);
3691
- o.push(c);
3690
+ const a = j.getConversationKey(this.state.ourCurrentNostrKey.privateKey, n);
3691
+ o.push(a);
3692
3692
  }
3693
- const a = j.getConversationKey(this.state.ourNextNostrKey.privateKey, n);
3694
- o.push(a), this.state.skippedHeaderKeys[n] = o;
3693
+ const c = j.getConversationKey(this.state.ourNextNostrKey.privateKey, n);
3694
+ o.push(c), this.state.skippedHeaderKeys[n] = o;
3695
3695
  }
3696
3696
  this.state.receivingChainMessageNumber++;
3697
3697
  }
@@ -3701,7 +3701,7 @@ class at {
3701
3701
  const i = Lt(r, t.number);
3702
3702
  if (i in this.state.skippedMessageKeys) {
3703
3703
  const o = this.state.skippedMessageKeys[i];
3704
- return delete this.state.skippedMessageKeys[i], Object.keys(this.state.skippedMessageKeys).some((c) => c.startsWith(`${r}:`)) || (delete this.state.skippedHeaderKeys[r], (s = this.nostrUnsubscribe) == null || s.call(this), this.nostrUnsubscribe = void 0), j.decrypt(n, o);
3704
+ return delete this.state.skippedMessageKeys[i], Object.keys(this.state.skippedMessageKeys).some((a) => a.startsWith(`${r}:`)) || (delete this.state.skippedHeaderKeys[r], (s = this.nostrUnsubscribe) == null || s.call(this), this.nostrUnsubscribe = void 0), j.decrypt(n, o);
3705
3705
  }
3706
3706
  return null;
3707
3707
  }
@@ -3735,12 +3735,12 @@ class at {
3735
3735
  if (!i)
3736
3736
  this.state.theirNostrPublicKey !== n.nextPublicKey && (this.state.theirNostrPublicKey = n.nextPublicKey, (o = this.nostrUnsubscribe) == null || o.call(this), this.nostrUnsubscribe = this.nostrNextUnsubscribe, this.nostrNextUnsubscribe = this.nostrSubscribe(
3737
3737
  { authors: [this.state.theirNostrPublicKey], kinds: [He] },
3738
- (a) => this.handleNostrEvent(a)
3738
+ (c) => this.handleNostrEvent(c)
3739
3739
  )), r && (this.skipMessageKeys(n.previousChainLength, t.pubkey), this.ratchetStep(n.nextPublicKey));
3740
3740
  else if (!(Lt(t.pubkey, n.number) in this.state.skippedMessageKeys))
3741
3741
  return;
3742
3742
  const s = this.ratchetDecrypt(n, t.content, t.pubkey);
3743
- this.internalSubscriptions.forEach((a) => a({ id: t.id, data: s, pubkey: n.nextPublicKey, time: n.time }));
3743
+ this.internalSubscriptions.forEach((c) => c({ id: t.id, data: s, pubkey: n.nextPublicKey, time: n.time }));
3744
3744
  }
3745
3745
  subscribeToNostrEvents() {
3746
3746
  if (this.nostrNextUnsubscribe) return;
@@ -3762,11 +3762,13 @@ function et(e, t) {
3762
3762
  return rn(Se, n, "nip44-v2");
3763
3763
  }
3764
3764
  class Oe {
3765
- constructor(t, n, r, i, s, o, a = []) {
3766
- this.inviterSessionPublicKey = t, this.linkSecret = n, this.inviter = r, this.inviterSessionPrivateKey = i, this.label = s, this.maxUses = o, this.usedBy = a;
3765
+ constructor(t, n, r, i, s, o, c = []) {
3766
+ this.inviterSessionPublicKey = t, this.linkSecret = n, this.inviter = r, this.inviterSessionPrivateKey = i, this.label = s, this.maxUses = o, this.usedBy = c;
3767
3767
  }
3768
3768
  static createNew(t, n, r) {
3769
- const i = Me(), s = Ce(i), o = M(Me());
3769
+ if (!t)
3770
+ throw new Error("Inviter public key is required");
3771
+ const i = Pe(), s = Ce(i), o = P(Pe());
3770
3772
  return new Oe(
3771
3773
  s,
3772
3774
  o,
@@ -3787,12 +3789,12 @@ class Oe {
3787
3789
  } catch (l) {
3788
3790
  throw new Error("Invite data in URL hash is not valid JSON: " + l);
3789
3791
  }
3790
- const { inviter: o, sessionKey: a, linkSecret: c } = s;
3791
- if (!o || !a || !c)
3792
+ const { inviter: o, sessionKey: c, linkSecret: a } = s;
3793
+ if (!o || !c || !a)
3792
3794
  throw new Error("Missing required fields (inviter, sessionKey, linkSecret) in invite data.");
3793
3795
  return new Oe(
3794
- a,
3795
3796
  c,
3797
+ a,
3796
3798
  o
3797
3799
  );
3798
3800
  }
@@ -3809,12 +3811,12 @@ class Oe {
3809
3811
  );
3810
3812
  }
3811
3813
  static fromEvent(t) {
3812
- var o, a;
3814
+ var o, c;
3813
3815
  if (!t.sig)
3814
3816
  throw new Error("Event is not signed");
3815
3817
  if (!gt(t))
3816
3818
  throw new Error("Event signature is invalid");
3817
- const { tags: n } = t, r = (o = n.find(([c]) => c === "sessionKey")) == null ? void 0 : o[1], i = (a = n.find(([c]) => c === "linkSecret")) == null ? void 0 : a[1], s = t.pubkey;
3819
+ const { tags: n } = t, r = (o = n.find(([a]) => a === "sessionKey")) == null ? void 0 : o[1], i = (c = n.find(([a]) => a === "linkSecret")) == null ? void 0 : c[1], s = t.pubkey;
3818
3820
  if (!r || !i)
3819
3821
  throw new Error("Invalid invite event: missing session key or link secret");
3820
3822
  return new Oe(
@@ -3823,25 +3825,24 @@ class Oe {
3823
3825
  s
3824
3826
  );
3825
3827
  }
3826
- static fromUser(t, n) {
3827
- const r = {
3828
+ static fromUser(t, n, r) {
3829
+ const i = {
3828
3830
  kinds: [Rn],
3829
3831
  authors: [t],
3830
3832
  limit: 1,
3831
3833
  "#d": ["nostr-double-ratchet/invite"]
3832
3834
  };
3833
- return new Promise((i) => {
3834
- const s = n(r, (o) => {
3835
+ let s = 0;
3836
+ return n(i, (c) => {
3837
+ if (!(!c.created_at || c.created_at <= s)) {
3838
+ s = c.created_at;
3835
3839
  try {
3836
- const a = Oe.fromEvent(o);
3837
- s(), i(a);
3838
- } catch {
3839
- s(), i(void 0);
3840
+ const a = Oe.fromEvent(c);
3841
+ r(a);
3842
+ } catch (a) {
3843
+ console.error("Error processing invite:", a);
3840
3844
  }
3841
- });
3842
- setTimeout(() => {
3843
- s(), i(void 0);
3844
- }, 1e4);
3845
+ }
3845
3846
  });
3846
3847
  }
3847
3848
  /**
@@ -3894,7 +3895,7 @@ class Oe {
3894
3895
  * so the inviter can create the channel on their side.
3895
3896
  */
3896
3897
  async accept(t, n, r) {
3897
- const i = Me(), s = Ce(i), o = this.inviter || this.inviterSessionPublicKey, a = W(this.linkSecret), c = at.init(t, this.inviterSessionPublicKey, i, !0, a, void 0), l = Me(), f = Ce(l), u = typeof r == "function" ? r : (g, h) => Promise.resolve(j.encrypt(g, et(r, h))), d = {
3898
+ const i = Pe(), s = Ce(i), o = this.inviter || this.inviterSessionPublicKey, c = W(this.linkSecret), a = at.init(t, this.inviterSessionPublicKey, i, !0, c, void 0), l = Pe(), f = Ce(l), u = typeof r == "function" ? r : (g, h) => Promise.resolve(j.encrypt(g, et(r, h))), d = {
3898
3899
  pubkey: n,
3899
3900
  tags: [["secret", this.linkSecret]],
3900
3901
  content: await u(s, o),
@@ -3906,7 +3907,7 @@ class Oe {
3906
3907
  created_at: Math.floor(Date.now() / 1e3),
3907
3908
  tags: [["p", this.inviterSessionPublicKey]]
3908
3909
  };
3909
- return { channel: c, event: ae(p, l) };
3910
+ return { channel: a, event: ae(p, l) };
3910
3911
  }
3911
3912
  listen(t, n, r) {
3912
3913
  if (!this.inviterSessionPrivateKey)
@@ -3921,14 +3922,14 @@ class Oe {
3921
3922
  console.error("Invite has reached maximum number of uses");
3922
3923
  return;
3923
3924
  }
3924
- const o = await j.decrypt(s.content, et(this.inviterSessionPrivateKey, s.pubkey)), a = JSON.parse(o);
3925
- if (!a.tags || !a.tags.some(([g, h]) => g === "secret" && h === this.linkSecret)) {
3925
+ const o = await j.decrypt(s.content, et(this.inviterSessionPrivateKey, s.pubkey)), c = JSON.parse(o);
3926
+ if (!c.tags || !c.tags.some(([g, h]) => g === "secret" && h === this.linkSecret)) {
3926
3927
  console.error("Invalid secret from event", s);
3927
3928
  return;
3928
3929
  }
3929
- const c = typeof t == "function" ? t : (g, h) => Promise.resolve(j.decrypt(g, et(t, h))), l = a.pubkey;
3930
+ const a = typeof t == "function" ? t : (g, h) => Promise.resolve(j.decrypt(g, et(t, h))), l = c.pubkey;
3930
3931
  this.usedBy.push(l);
3931
- const f = await c(a.content, l), u = W(this.linkSecret), d = s.id, p = at.init(n, f, this.inviterSessionPrivateKey, !1, u, d);
3932
+ const f = await a(c.content, l), u = W(this.linkSecret), d = s.id, p = at.init(n, f, this.inviterSessionPrivateKey, !1, u, d);
3932
3933
  r(p, l);
3933
3934
  } catch (o) {
3934
3935
  console.error("Error processing invite message:", o);
@@ -3943,8 +3944,8 @@ export {
3943
3944
  Rc as MAX_SKIP,
3944
3945
  He as MESSAGE_EVENT_KIND,
3945
3946
  Cc as Sender,
3946
- Mc as createMessageStream,
3947
- Pc as deserializeChannelState,
3947
+ Pc as createMessageStream,
3948
+ Mc as deserializeChannelState,
3948
3949
  Re as kdf,
3949
3950
  Oc as serializeChannelState,
3950
3951
  Lt as skippedMessageIndexKey