@btc-vision/transaction 1.8.7 → 1.8.8

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.
@@ -184,13 +184,13 @@ function Ia() {
184
184
  return u;
185
185
  }
186
186
  function i(p, u, d, w) {
187
- let b = 0, m = 0;
187
+ let y = 0, m = 0;
188
188
  const v = (1 << d) - 1, I = [];
189
- for (let P = 0; P < p.length; ++P) for (b = b << u | p[P], m += u; m >= d; ) m -= d, I.push(b >> m & v);
190
- if (w) m > 0 && I.push(b << d - m & v);
189
+ for (let P = 0; P < p.length; ++P) for (y = y << u | p[P], m += u; m >= d; ) m -= d, I.push(y >> m & v);
190
+ if (w) m > 0 && I.push(y << d - m & v);
191
191
  else {
192
192
  if (m >= u) return "Excess padding";
193
- if (b << d - m & v) return "Non-zero padding";
193
+ if (y << d - m & v) return "Non-zero padding";
194
194
  }
195
195
  return I;
196
196
  }
@@ -239,20 +239,20 @@ function Ia() {
239
239
  if (_ === 0) return "Missing prefix for " + v;
240
240
  const O = v.slice(0, _), z = v.slice(_ + 1);
241
241
  if (z.length < 6) return "Data too short";
242
- let D = n(O);
243
- if (typeof D == "string") return D;
244
- const X = [];
245
- for (let at = 0; at < z.length; ++at) {
246
- const q = z.charAt(at), Vt = t[q];
242
+ let M = n(O);
243
+ if (typeof M == "string") return M;
244
+ const Z = [];
245
+ for (let Q = 0; Q < z.length; ++Q) {
246
+ const q = z.charAt(Q), Vt = t[q];
247
247
  if (Vt === void 0) return "Unknown character " + q;
248
- D = r(D) ^ Vt, !(at + 6 >= z.length) && X.push(Vt);
248
+ M = r(M) ^ Vt, !(Q + 6 >= z.length) && Z.push(Vt);
249
249
  }
250
- return D !== u ? "Invalid checksum for " + v : {
250
+ return M !== u ? "Invalid checksum for " + v : {
251
251
  prefix: O,
252
- words: X
252
+ words: Z
253
253
  };
254
254
  }
255
- function b(v, I) {
255
+ function y(v, I) {
256
256
  const P = w(v, I);
257
257
  if (typeof P == "object") return P;
258
258
  }
@@ -262,7 +262,7 @@ function Ia() {
262
262
  throw new Error(P);
263
263
  }
264
264
  return {
265
- decodeUnsafe: b,
265
+ decodeUnsafe: y,
266
266
  decode: m,
267
267
  encode: d,
268
268
  toWords: o,
@@ -272,17 +272,17 @@ function Ia() {
272
272
  }
273
273
  return ye.bech32 = l("bech32"), ye.bech32m = l("bech32m"), ye;
274
274
  }
275
- var tt = Ia();
275
+ var et = Ia();
276
276
  function cr(e) {
277
277
  let t, r;
278
278
  try {
279
- t = tt.bech32.decode(e);
279
+ t = et.bech32.decode(e);
280
280
  } catch {
281
281
  }
282
282
  if (t) {
283
283
  if (r = t.words[0], r !== 0) throw new TypeError(e + " uses wrong encoding");
284
- } else if (t = tt.bech32m.decode(e), r = t.words[0], r === 0) throw new TypeError(e + " uses wrong encoding");
285
- const n = tt.bech32.fromWords(t.words.slice(1));
284
+ } else if (t = et.bech32m.decode(e), r = t.words[0], r === 0) throw new TypeError(e + " uses wrong encoding");
285
+ const n = et.bech32.fromWords(t.words.slice(1));
286
286
  return {
287
287
  version: r,
288
288
  prefix: t.prefix,
@@ -901,13 +901,13 @@ var Wn = class {
901
901
  process(e, t) {
902
902
  for (let u = 0; u < 16; u++, t += 4) oe[u] = e.getUint32(t, !1);
903
903
  for (let u = 16; u < 64; u++) {
904
- const d = oe[u - 15], w = oe[u - 2], b = Wt(d, 7) ^ Wt(d, 18) ^ d >>> 3;
905
- oe[u] = (Wt(w, 17) ^ Wt(w, 19) ^ w >>> 10) + oe[u - 7] + b + oe[u - 16] | 0;
904
+ const d = oe[u - 15], w = oe[u - 2], y = Wt(d, 7) ^ Wt(d, 18) ^ d >>> 3, m = Wt(w, 17) ^ Wt(w, 19) ^ w >>> 10;
905
+ oe[u] = m + oe[u - 7] + y + oe[u - 16] | 0;
906
906
  }
907
907
  let { A: r, B: n, C: i, D: o, E: a, F: f, G: l, H: p } = this;
908
908
  for (let u = 0; u < 64; u++) {
909
- const d = Wt(a, 6) ^ Wt(a, 11) ^ Wt(a, 25), w = p + d + Os(a, f, l) + Ca[u] + oe[u] | 0, b = (Wt(r, 2) ^ Wt(r, 13) ^ Wt(r, 22)) + Ps(r, n, i) | 0;
910
- p = l, l = f, f = a, a = o + w | 0, o = i, i = n, n = r, r = w + b | 0;
909
+ const d = Wt(a, 6) ^ Wt(a, 11) ^ Wt(a, 25), w = p + d + Os(a, f, l) + Ca[u] + oe[u] | 0, y = (Wt(r, 2) ^ Wt(r, 13) ^ Wt(r, 22)) + Ps(r, n, i) | 0;
910
+ p = l, l = f, f = a, a = o + w | 0, o = i, i = n, n = r, r = w + y | 0;
911
911
  }
912
912
  r = r + this.A | 0, n = n + this.B | 0, i = i + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, f = f + this.F | 0, l = l + this.G | 0, p = p + this.H | 0, this.set(r, n, i, o, a, f, l, p);
913
913
  }
@@ -932,7 +932,7 @@ var Wn = class {
932
932
  }, Ke = /* @__PURE__ */ Fn(() => new $a(), /* @__PURE__ */ La(1));
933
933
  function Ka(e) {
934
934
  if (e.length >= 255) throw new TypeError("Alphabet too long");
935
- const t = new Uint8Array(256);
935
+ const t = /* @__PURE__ */ new Uint8Array(256);
936
936
  for (let p = 0; p < t.length; p++) t[p] = 255;
937
937
  for (let p = 0; p < e.length; p++) {
938
938
  const u = e.charAt(p), d = u.charCodeAt(0);
@@ -944,10 +944,10 @@ function Ka(e) {
944
944
  if (p instanceof Uint8Array || (ArrayBuffer.isView(p) ? p = new Uint8Array(p.buffer, p.byteOffset, p.byteLength) : Array.isArray(p) && (p = Uint8Array.from(p))), !(p instanceof Uint8Array)) throw new TypeError("Expected Uint8Array");
945
945
  if (p.length === 0) return "";
946
946
  let u = 0, d = 0, w = 0;
947
- const b = p.length;
948
- for (; w !== b && p[w] === 0; ) w++, u++;
949
- const m = (b - w) * o + 1 >>> 0, v = new Uint8Array(m);
950
- for (; w !== b; ) {
947
+ const y = p.length;
948
+ for (; w !== y && p[w] === 0; ) w++, u++;
949
+ const m = (y - w) * o + 1 >>> 0, v = new Uint8Array(m);
950
+ for (; w !== y; ) {
951
951
  let S = p[w], _ = 0;
952
952
  for (let O = m - 1; (S !== 0 || _ < d) && O !== -1; O--, _++) S += 256 * v[O] >>> 0, v[O] = S % r >>> 0, S = S / r >>> 0;
953
953
  if (S !== 0) throw new Error("Non-zero carry");
@@ -961,25 +961,25 @@ function Ka(e) {
961
961
  }
962
962
  function f(p) {
963
963
  if (typeof p != "string") throw new TypeError("Expected String");
964
- if (p.length === 0) return new Uint8Array();
964
+ if (p.length === 0) return /* @__PURE__ */ new Uint8Array();
965
965
  let u = 0, d = 0, w = 0;
966
966
  for (; p[u] === n; ) d++, u++;
967
- const b = (p.length - u) * i + 1 >>> 0, m = new Uint8Array(b);
967
+ const y = (p.length - u) * i + 1 >>> 0, m = new Uint8Array(y);
968
968
  for (; u < p.length; ) {
969
969
  const S = p.charCodeAt(u);
970
970
  if (S > 255) return;
971
971
  let _ = t[S];
972
972
  if (_ === 255) return;
973
973
  let O = 0;
974
- for (let z = b - 1; (_ !== 0 || O < w) && z !== -1; z--, O++) _ += r * m[z] >>> 0, m[z] = _ % 256 >>> 0, _ = _ / 256 >>> 0;
974
+ for (let z = y - 1; (_ !== 0 || O < w) && z !== -1; z--, O++) _ += r * m[z] >>> 0, m[z] = _ % 256 >>> 0, _ = _ / 256 >>> 0;
975
975
  if (_ !== 0) throw new Error("Non-zero carry");
976
976
  w = O, u++;
977
977
  }
978
- let v = b - w;
979
- for (; v !== b && m[v] === 0; ) v++;
980
- const I = new Uint8Array(d + (b - v));
978
+ let v = y - w;
979
+ for (; v !== y && m[v] === 0; ) v++;
980
+ const I = new Uint8Array(d + (y - v));
981
981
  let P = d;
982
- for (; v !== b; ) I[P++] = m[v++];
982
+ for (; v !== y; ) I[P++] = m[v++];
983
983
  return I;
984
984
  }
985
985
  function l(p) {
@@ -1304,21 +1304,21 @@ function eh(e) {
1304
1304
  }
1305
1305
  var qn = {};
1306
1306
  qn.read = function(e, t, r, n, i) {
1307
- var o, a, f = i * 8 - n - 1, l = (1 << f) - 1, p = l >> 1, u = -7, d = r ? i - 1 : 0, w = r ? -1 : 1, b = e[t + d];
1308
- for (d += w, o = b & (1 << -u) - 1, b >>= -u, u += f; u > 0; o = o * 256 + e[t + d], d += w, u -= 8) ;
1307
+ var o, a, f = i * 8 - n - 1, l = (1 << f) - 1, p = l >> 1, u = -7, d = r ? i - 1 : 0, w = r ? -1 : 1, y = e[t + d];
1308
+ for (d += w, o = y & (1 << -u) - 1, y >>= -u, u += f; u > 0; o = o * 256 + e[t + d], d += w, u -= 8) ;
1309
1309
  for (a = o & (1 << -u) - 1, o >>= -u, u += n; u > 0; a = a * 256 + e[t + d], d += w, u -= 8) ;
1310
1310
  if (o === 0) o = 1 - p;
1311
1311
  else {
1312
- if (o === l) return a ? NaN : (b ? -1 : 1) * (1 / 0);
1312
+ if (o === l) return a ? NaN : (y ? -1 : 1) * (1 / 0);
1313
1313
  a = a + Math.pow(2, n), o = o - p;
1314
1314
  }
1315
- return (b ? -1 : 1) * a * Math.pow(2, o - n);
1315
+ return (y ? -1 : 1) * a * Math.pow(2, o - n);
1316
1316
  };
1317
1317
  qn.write = function(e, t, r, n, i, o) {
1318
- var a, f, l, p = o * 8 - i - 1, u = (1 << p) - 1, d = u >> 1, w = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, b = n ? 0 : o - 1, m = n ? 1 : -1, v = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
1319
- for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (f = isNaN(t) ? 1 : 0, a = u) : (a = Math.floor(Math.log(t) / Math.LN2), t * (l = Math.pow(2, -a)) < 1 && (a--, l *= 2), a + d >= 1 ? t += w / l : t += w * Math.pow(2, 1 - d), t * l >= 2 && (a++, l /= 2), a + d >= u ? (f = 0, a = u) : a + d >= 1 ? (f = (t * l - 1) * Math.pow(2, i), a = a + d) : (f = t * Math.pow(2, d - 1) * Math.pow(2, i), a = 0)); i >= 8; e[r + b] = f & 255, b += m, f /= 256, i -= 8) ;
1320
- for (a = a << i | f, p += i; p > 0; e[r + b] = a & 255, b += m, a /= 256, p -= 8) ;
1321
- e[r + b - m] |= v * 128;
1318
+ var a, f, l, p = o * 8 - i - 1, u = (1 << p) - 1, d = u >> 1, w = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, y = n ? 0 : o - 1, m = n ? 1 : -1, v = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
1319
+ for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (f = isNaN(t) ? 1 : 0, a = u) : (a = Math.floor(Math.log(t) / Math.LN2), t * (l = Math.pow(2, -a)) < 1 && (a--, l *= 2), a + d >= 1 ? t += w / l : t += w * Math.pow(2, 1 - d), t * l >= 2 && (a++, l /= 2), a + d >= u ? (f = 0, a = u) : a + d >= 1 ? (f = (t * l - 1) * Math.pow(2, i), a = a + d) : (f = t * Math.pow(2, d - 1) * Math.pow(2, i), a = 0)); i >= 8; e[r + y] = f & 255, y += m, f /= 256, i -= 8) ;
1320
+ for (a = a << i | f, p += i; p > 0; e[r + y] = a & 255, y += m, a /= 256, p -= 8) ;
1321
+ e[r + y - m] |= v * 128;
1322
1322
  };
1323
1323
  (function(e) {
1324
1324
  const t = Zr, r = qn, n = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null;
@@ -1369,8 +1369,8 @@ qn.write = function(e, t, r, n, i, o) {
1369
1369
  if (typeof s == "number") throw new TypeError('The "value" argument must not be of type number. Received type number');
1370
1370
  const g = s.valueOf && s.valueOf();
1371
1371
  if (g != null && g !== s) return u.from(g, h, c);
1372
- const y = _(s);
1373
- if (y) return y;
1372
+ const b = _(s);
1373
+ if (b) return b;
1374
1374
  if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof s[Symbol.toPrimitive] == "function") return u.from(s[Symbol.toPrimitive]("string"), h, c);
1375
1375
  throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof s);
1376
1376
  }
@@ -1381,11 +1381,11 @@ qn.write = function(e, t, r, n, i, o) {
1381
1381
  if (typeof s != "number") throw new TypeError('"size" argument must be of type number');
1382
1382
  if (s < 0) throw new RangeError('The value "' + s + '" is invalid for option "size"');
1383
1383
  }
1384
- function b(s, h, c) {
1384
+ function y(s, h, c) {
1385
1385
  return w(s), s <= 0 ? p(s) : h !== void 0 ? typeof c == "string" ? p(s).fill(h, c) : p(s).fill(h) : p(s);
1386
1386
  }
1387
1387
  u.alloc = function(s, h, c) {
1388
- return b(s, h, c);
1388
+ return y(s, h, c);
1389
1389
  };
1390
1390
  function m(s) {
1391
1391
  return w(s), p(s < 0 ? 0 : O(s) | 0);
@@ -1397,10 +1397,10 @@ qn.write = function(e, t, r, n, i, o) {
1397
1397
  };
1398
1398
  function v(s, h) {
1399
1399
  if ((typeof h != "string" || h === "") && (h = "utf8"), !u.isEncoding(h)) throw new TypeError("Unknown encoding: " + h);
1400
- const c = D(s, h) | 0;
1400
+ const c = M(s, h) | 0;
1401
1401
  let g = p(c);
1402
- const y = g.write(s, h);
1403
- return y !== c && (g = g.slice(0, y)), g;
1402
+ const b = g.write(s, h);
1403
+ return b !== c && (g = g.slice(0, b)), g;
1404
1404
  }
1405
1405
  function I(s) {
1406
1406
  const h = s.length < 0 ? 0 : O(s.length) | 0, c = p(h);
@@ -1441,8 +1441,8 @@ qn.write = function(e, t, r, n, i, o) {
1441
1441
  if (Ft(s, o) && (s = u.from(s, s.offset, s.byteLength)), Ft(h, o) && (h = u.from(h, h.offset, h.byteLength)), !u.isBuffer(s) || !u.isBuffer(h)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
1442
1442
  if (s === h) return 0;
1443
1443
  let c = s.length, g = h.length;
1444
- for (let y = 0, E = Math.min(c, g); y < E; ++y) if (s[y] !== h[y]) {
1445
- c = s[y], g = h[y];
1444
+ for (let b = 0, E = Math.min(c, g); b < E; ++b) if (s[b] !== h[b]) {
1445
+ c = s[b], g = h[b];
1446
1446
  break;
1447
1447
  }
1448
1448
  return c < g ? -1 : g < c ? 1 : 0;
@@ -1469,23 +1469,23 @@ qn.write = function(e, t, r, n, i, o) {
1469
1469
  let c;
1470
1470
  if (h === void 0) for (h = 0, c = 0; c < s.length; ++c) h += s[c].length;
1471
1471
  const g = u.allocUnsafe(h);
1472
- let y = 0;
1472
+ let b = 0;
1473
1473
  for (c = 0; c < s.length; ++c) {
1474
1474
  let E = s[c];
1475
- if (Ft(E, o)) y + E.length > g.length ? (u.isBuffer(E) || (E = u.from(E)), E.copy(g, y)) : o.prototype.set.call(g, E, y);
1476
- else if (u.isBuffer(E)) E.copy(g, y);
1475
+ if (Ft(E, o)) b + E.length > g.length ? (u.isBuffer(E) || (E = u.from(E)), E.copy(g, b)) : o.prototype.set.call(g, E, b);
1476
+ else if (u.isBuffer(E)) E.copy(g, b);
1477
1477
  else throw new TypeError('"list" argument must be an Array of Buffers');
1478
- y += E.length;
1478
+ b += E.length;
1479
1479
  }
1480
1480
  return g;
1481
1481
  };
1482
- function D(s, h) {
1482
+ function M(s, h) {
1483
1483
  if (u.isBuffer(s)) return s.length;
1484
1484
  if (a.isView(s) || Ft(s, a)) return s.byteLength;
1485
1485
  if (typeof s != "string") throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof s);
1486
1486
  const c = s.length, g = arguments.length > 2 && arguments[2] === !0;
1487
1487
  if (!g && c === 0) return 0;
1488
- let y = !1;
1488
+ let b = !1;
1489
1489
  for (; ; ) switch (h) {
1490
1490
  case "ascii":
1491
1491
  case "latin1":
@@ -1504,12 +1504,12 @@ qn.write = function(e, t, r, n, i, o) {
1504
1504
  case "base64":
1505
1505
  return bi(s).length;
1506
1506
  default:
1507
- if (y) return g ? -1 : hn(s).length;
1508
- h = ("" + h).toLowerCase(), y = !0;
1507
+ if (b) return g ? -1 : hn(s).length;
1508
+ h = ("" + h).toLowerCase(), b = !0;
1509
1509
  }
1510
1510
  }
1511
- u.byteLength = D;
1512
- function X(s, h, c) {
1511
+ u.byteLength = M;
1512
+ function Z(s, h, c) {
1513
1513
  let g = !1;
1514
1514
  if ((h === void 0 || h < 0) && (h = 0), h > this.length || ((c === void 0 || c > this.length) && (c = this.length), c <= 0) || (c >>>= 0, h >>>= 0, c <= h)) return "";
1515
1515
  for (s || (s = "utf8"); ; ) switch (s) {
@@ -1522,7 +1522,7 @@ qn.write = function(e, t, r, n, i, o) {
1522
1522
  return L(this, h, c);
1523
1523
  case "latin1":
1524
1524
  case "binary":
1525
- return M(this, h, c);
1525
+ return D(this, h, c);
1526
1526
  case "base64":
1527
1527
  return B(this, h, c);
1528
1528
  case "ucs2":
@@ -1536,28 +1536,28 @@ qn.write = function(e, t, r, n, i, o) {
1536
1536
  }
1537
1537
  }
1538
1538
  u.prototype._isBuffer = !0;
1539
- function at(s, h, c) {
1539
+ function Q(s, h, c) {
1540
1540
  const g = s[h];
1541
1541
  s[h] = s[c], s[c] = g;
1542
1542
  }
1543
1543
  u.prototype.swap16 = function() {
1544
1544
  const s = this.length;
1545
1545
  if (s % 2 !== 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
1546
- for (let h = 0; h < s; h += 2) at(this, h, h + 1);
1546
+ for (let h = 0; h < s; h += 2) Q(this, h, h + 1);
1547
1547
  return this;
1548
1548
  }, u.prototype.swap32 = function() {
1549
1549
  const s = this.length;
1550
1550
  if (s % 4 !== 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
1551
- for (let h = 0; h < s; h += 4) at(this, h, h + 3), at(this, h + 1, h + 2);
1551
+ for (let h = 0; h < s; h += 4) Q(this, h, h + 3), Q(this, h + 1, h + 2);
1552
1552
  return this;
1553
1553
  }, u.prototype.swap64 = function() {
1554
1554
  const s = this.length;
1555
1555
  if (s % 8 !== 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
1556
- for (let h = 0; h < s; h += 8) at(this, h, h + 7), at(this, h + 1, h + 6), at(this, h + 2, h + 5), at(this, h + 3, h + 4);
1556
+ for (let h = 0; h < s; h += 8) Q(this, h, h + 7), Q(this, h + 1, h + 6), Q(this, h + 2, h + 5), Q(this, h + 3, h + 4);
1557
1557
  return this;
1558
1558
  }, u.prototype.toString = function() {
1559
1559
  const s = this.length;
1560
- return s === 0 ? "" : arguments.length === 0 ? V(this, 0, s) : X.apply(this, arguments);
1560
+ return s === 0 ? "" : arguments.length === 0 ? V(this, 0, s) : Z.apply(this, arguments);
1561
1561
  }, u.prototype.toLocaleString = u.prototype.toString, u.prototype.equals = function(s) {
1562
1562
  if (!u.isBuffer(s)) throw new TypeError("Argument must be a Buffer");
1563
1563
  return this === s ? !0 : u.compare(this, s) === 0;
@@ -1565,54 +1565,54 @@ qn.write = function(e, t, r, n, i, o) {
1565
1565
  let s = "";
1566
1566
  const h = e.INSPECT_MAX_BYTES;
1567
1567
  return s = this.toString("hex", 0, h).replace(/(.{2})/g, "$1 ").trim(), this.length > h && (s += " ... "), "<Buffer " + s + ">";
1568
- }, n && (u.prototype[n] = u.prototype.inspect), u.prototype.compare = function(s, h, c, g, y) {
1568
+ }, n && (u.prototype[n] = u.prototype.inspect), u.prototype.compare = function(s, h, c, g, b) {
1569
1569
  if (Ft(s, o) && (s = u.from(s, s.offset, s.byteLength)), !u.isBuffer(s)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof s);
1570
- if (h === void 0 && (h = 0), c === void 0 && (c = s ? s.length : 0), g === void 0 && (g = 0), y === void 0 && (y = this.length), h < 0 || c > s.length || g < 0 || y > this.length) throw new RangeError("out of range index");
1571
- if (g >= y && h >= c) return 0;
1572
- if (g >= y) return -1;
1570
+ if (h === void 0 && (h = 0), c === void 0 && (c = s ? s.length : 0), g === void 0 && (g = 0), b === void 0 && (b = this.length), h < 0 || c > s.length || g < 0 || b > this.length) throw new RangeError("out of range index");
1571
+ if (g >= b && h >= c) return 0;
1572
+ if (g >= b) return -1;
1573
1573
  if (h >= c) return 1;
1574
- if (h >>>= 0, c >>>= 0, g >>>= 0, y >>>= 0, this === s) return 0;
1575
- let E = y - g, k = c - h;
1576
- const st = Math.min(E, k), bt = this.slice(g, y), ot = s.slice(h, c);
1577
- for (let rt = 0; rt < st; ++rt) if (bt[rt] !== ot[rt]) {
1578
- E = bt[rt], k = ot[rt];
1574
+ if (h >>>= 0, c >>>= 0, g >>>= 0, b >>>= 0, this === s) return 0;
1575
+ let E = b - g, k = c - h;
1576
+ const ot = Math.min(E, k), bt = this.slice(g, b), at = s.slice(h, c);
1577
+ for (let nt = 0; nt < ot; ++nt) if (bt[nt] !== at[nt]) {
1578
+ E = bt[nt], k = at[nt];
1579
1579
  break;
1580
1580
  }
1581
1581
  return E < k ? -1 : k < E ? 1 : 0;
1582
1582
  };
1583
- function q(s, h, c, g, y) {
1583
+ function q(s, h, c, g, b) {
1584
1584
  if (s.length === 0) return -1;
1585
- if (typeof c == "string" ? (g = c, c = 0) : c > 2147483647 ? c = 2147483647 : c < -2147483648 && (c = -2147483648), c = +c, un(c) && (c = y ? 0 : s.length - 1), c < 0 && (c = s.length + c), c >= s.length) {
1586
- if (y) return -1;
1585
+ if (typeof c == "string" ? (g = c, c = 0) : c > 2147483647 ? c = 2147483647 : c < -2147483648 && (c = -2147483648), c = +c, un(c) && (c = b ? 0 : s.length - 1), c < 0 && (c = s.length + c), c >= s.length) {
1586
+ if (b) return -1;
1587
1587
  c = s.length - 1;
1588
- } else if (c < 0) if (y) c = 0;
1588
+ } else if (c < 0) if (b) c = 0;
1589
1589
  else return -1;
1590
- if (typeof h == "string" && (h = u.from(h, g)), u.isBuffer(h)) return h.length === 0 ? -1 : Vt(s, h, c, g, y);
1591
- if (typeof h == "number") return h = h & 255, typeof o.prototype.indexOf == "function" ? y ? o.prototype.indexOf.call(s, h, c) : o.prototype.lastIndexOf.call(s, h, c) : Vt(s, [h], c, g, y);
1590
+ if (typeof h == "string" && (h = u.from(h, g)), u.isBuffer(h)) return h.length === 0 ? -1 : Vt(s, h, c, g, b);
1591
+ if (typeof h == "number") return h = h & 255, typeof o.prototype.indexOf == "function" ? b ? o.prototype.indexOf.call(s, h, c) : o.prototype.lastIndexOf.call(s, h, c) : Vt(s, [h], c, g, b);
1592
1592
  throw new TypeError("val must be string, number or Buffer");
1593
1593
  }
1594
- function Vt(s, h, c, g, y) {
1595
- let E = 1, k = s.length, st = h.length;
1594
+ function Vt(s, h, c, g, b) {
1595
+ let E = 1, k = s.length, ot = h.length;
1596
1596
  if (g !== void 0 && (g = String(g).toLowerCase(), g === "ucs2" || g === "ucs-2" || g === "utf16le" || g === "utf-16le")) {
1597
1597
  if (s.length < 2 || h.length < 2) return -1;
1598
- E = 2, k /= 2, st /= 2, c /= 2;
1599
- }
1600
- function bt(rt, pt) {
1601
- return E === 1 ? rt[pt] : rt.readUInt16BE(pt * E);
1602
- }
1603
- let ot;
1604
- if (y) {
1605
- let rt = -1;
1606
- for (ot = c; ot < k; ot++) if (bt(s, ot) === bt(h, rt === -1 ? 0 : ot - rt)) {
1607
- if (rt === -1 && (rt = ot), ot - rt + 1 === st) return rt * E;
1608
- } else rt !== -1 && (ot -= ot - rt), rt = -1;
1609
- } else for (c + st > k && (c = k - st), ot = c; ot >= 0; ot--) {
1610
- let rt = !0;
1611
- for (let pt = 0; pt < st; pt++) if (bt(s, ot + pt) !== bt(h, pt)) {
1612
- rt = !1;
1598
+ E = 2, k /= 2, ot /= 2, c /= 2;
1599
+ }
1600
+ function bt(nt, pt) {
1601
+ return E === 1 ? nt[pt] : nt.readUInt16BE(pt * E);
1602
+ }
1603
+ let at;
1604
+ if (b) {
1605
+ let nt = -1;
1606
+ for (at = c; at < k; at++) if (bt(s, at) === bt(h, nt === -1 ? 0 : at - nt)) {
1607
+ if (nt === -1 && (nt = at), at - nt + 1 === ot) return nt * E;
1608
+ } else nt !== -1 && (at -= at - nt), nt = -1;
1609
+ } else for (c + ot > k && (c = k - ot), at = c; at >= 0; at--) {
1610
+ let nt = !0;
1611
+ for (let pt = 0; pt < ot; pt++) if (bt(s, at + pt) !== bt(h, pt)) {
1612
+ nt = !1;
1613
1613
  break;
1614
1614
  }
1615
- if (rt) return ot;
1615
+ if (nt) return at;
1616
1616
  }
1617
1617
  return -1;
1618
1618
  }
@@ -1625,15 +1625,15 @@ qn.write = function(e, t, r, n, i, o) {
1625
1625
  };
1626
1626
  function Qt(s, h, c, g) {
1627
1627
  c = Number(c) || 0;
1628
- const y = s.length - c;
1629
- g ? (g = Number(g), g > y && (g = y)) : g = y;
1628
+ const b = s.length - c;
1629
+ g ? (g = Number(g), g > b && (g = b)) : g = b;
1630
1630
  const E = h.length;
1631
1631
  g > E / 2 && (g = E / 2);
1632
1632
  let k;
1633
1633
  for (k = 0; k < g; ++k) {
1634
- const st = parseInt(h.substr(k * 2, 2), 16);
1635
- if (un(st)) return k;
1636
- s[c + k] = st;
1634
+ const ot = parseInt(h.substr(k * 2, 2), 16);
1635
+ if (un(ot)) return k;
1636
+ s[c + k] = ot;
1637
1637
  }
1638
1638
  return k;
1639
1639
  }
@@ -1654,8 +1654,8 @@ qn.write = function(e, t, r, n, i, o) {
1654
1654
  else if (c === void 0 && typeof h == "string") g = h, c = this.length, h = 0;
1655
1655
  else if (isFinite(h)) h = h >>> 0, isFinite(c) ? (c = c >>> 0, g === void 0 && (g = "utf8")) : (g = c, c = void 0);
1656
1656
  else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
1657
- const y = this.length - h;
1658
- if ((c === void 0 || c > y) && (c = y), s.length > 0 && (c < 0 || h < 0) || h > this.length) throw new RangeError("Attempt to write outside buffer bounds");
1657
+ const b = this.length - h;
1658
+ if ((c === void 0 || c > b) && (c = b), s.length > 0 && (c < 0 || h < 0) || h > this.length) throw new RangeError("Attempt to write outside buffer bounds");
1659
1659
  g || (g = "utf8");
1660
1660
  let E = !1;
1661
1661
  for (; ; ) switch (g) {
@@ -1691,27 +1691,27 @@ qn.write = function(e, t, r, n, i, o) {
1691
1691
  function V(s, h, c) {
1692
1692
  c = Math.min(s.length, c);
1693
1693
  const g = [];
1694
- let y = h;
1695
- for (; y < c; ) {
1696
- const E = s[y];
1697
- let k = null, st = E > 239 ? 4 : E > 223 ? 3 : E > 191 ? 2 : 1;
1698
- if (y + st <= c) {
1699
- let bt, ot, rt, pt;
1700
- switch (st) {
1694
+ let b = h;
1695
+ for (; b < c; ) {
1696
+ const E = s[b];
1697
+ let k = null, ot = E > 239 ? 4 : E > 223 ? 3 : E > 191 ? 2 : 1;
1698
+ if (b + ot <= c) {
1699
+ let bt, at, nt, pt;
1700
+ switch (ot) {
1701
1701
  case 1:
1702
1702
  E < 128 && (k = E);
1703
1703
  break;
1704
1704
  case 2:
1705
- bt = s[y + 1], (bt & 192) === 128 && (pt = (E & 31) << 6 | bt & 63, pt > 127 && (k = pt));
1705
+ bt = s[b + 1], (bt & 192) === 128 && (pt = (E & 31) << 6 | bt & 63, pt > 127 && (k = pt));
1706
1706
  break;
1707
1707
  case 3:
1708
- bt = s[y + 1], ot = s[y + 2], (bt & 192) === 128 && (ot & 192) === 128 && (pt = (E & 15) << 12 | (bt & 63) << 6 | ot & 63, pt > 2047 && (pt < 55296 || pt > 57343) && (k = pt));
1708
+ bt = s[b + 1], at = s[b + 2], (bt & 192) === 128 && (at & 192) === 128 && (pt = (E & 15) << 12 | (bt & 63) << 6 | at & 63, pt > 2047 && (pt < 55296 || pt > 57343) && (k = pt));
1709
1709
  break;
1710
1710
  case 4:
1711
- bt = s[y + 1], ot = s[y + 2], rt = s[y + 3], (bt & 192) === 128 && (ot & 192) === 128 && (rt & 192) === 128 && (pt = (E & 15) << 18 | (bt & 63) << 12 | (ot & 63) << 6 | rt & 63, pt > 65535 && pt < 1114112 && (k = pt));
1711
+ bt = s[b + 1], at = s[b + 2], nt = s[b + 3], (bt & 192) === 128 && (at & 192) === 128 && (nt & 192) === 128 && (pt = (E & 15) << 18 | (bt & 63) << 12 | (at & 63) << 6 | nt & 63, pt > 65535 && pt < 1114112 && (k = pt));
1712
1712
  }
1713
1713
  }
1714
- k === null ? (k = 65533, st = 1) : k > 65535 && (k -= 65536, g.push(k >>> 10 & 1023 | 55296), k = 56320 | k & 1023), g.push(k), y += st;
1714
+ k === null ? (k = 65533, ot = 1) : k > 65535 && (k -= 65536, g.push(k >>> 10 & 1023 | 55296), k = 56320 | k & 1023), g.push(k), b += ot;
1715
1715
  }
1716
1716
  return C(g);
1717
1717
  }
@@ -1726,27 +1726,27 @@ qn.write = function(e, t, r, n, i, o) {
1726
1726
  function L(s, h, c) {
1727
1727
  let g = "";
1728
1728
  c = Math.min(s.length, c);
1729
- for (let y = h; y < c; ++y) g += String.fromCharCode(s[y] & 127);
1729
+ for (let b = h; b < c; ++b) g += String.fromCharCode(s[b] & 127);
1730
1730
  return g;
1731
1731
  }
1732
- function M(s, h, c) {
1732
+ function D(s, h, c) {
1733
1733
  let g = "";
1734
1734
  c = Math.min(s.length, c);
1735
- for (let y = h; y < c; ++y) g += String.fromCharCode(s[y]);
1735
+ for (let b = h; b < c; ++b) g += String.fromCharCode(s[b]);
1736
1736
  return g;
1737
1737
  }
1738
1738
  function F(s, h, c) {
1739
1739
  const g = s.length;
1740
1740
  (!h || h < 0) && (h = 0), (!c || c < 0 || c > g) && (c = g);
1741
- let y = "";
1742
- for (let E = h; E < c; ++E) y += ma[s[E]];
1743
- return y;
1741
+ let b = "";
1742
+ for (let E = h; E < c; ++E) b += ma[s[E]];
1743
+ return b;
1744
1744
  }
1745
1745
  function ct(s, h, c) {
1746
1746
  const g = s.slice(h, c);
1747
- let y = "";
1748
- for (let E = 0; E < g.length - 1; E += 2) y += String.fromCharCode(g[E] + g[E + 1] * 256);
1749
- return y;
1747
+ let b = "";
1748
+ for (let E = 0; E < g.length - 1; E += 2) b += String.fromCharCode(g[E] + g[E + 1] * 256);
1749
+ return b;
1750
1750
  }
1751
1751
  u.prototype.slice = function(s, h) {
1752
1752
  const c = this.length;
@@ -1760,13 +1760,13 @@ qn.write = function(e, t, r, n, i, o) {
1760
1760
  }
1761
1761
  u.prototype.readUintLE = u.prototype.readUIntLE = function(s, h, c) {
1762
1762
  s = s >>> 0, h = h >>> 0, c || W(s, h, this.length);
1763
- let g = this[s], y = 1, E = 0;
1764
- for (; ++E < h && (y *= 256); ) g += this[s + E] * y;
1763
+ let g = this[s], b = 1, E = 0;
1764
+ for (; ++E < h && (b *= 256); ) g += this[s + E] * b;
1765
1765
  return g;
1766
1766
  }, u.prototype.readUintBE = u.prototype.readUIntBE = function(s, h, c) {
1767
1767
  s = s >>> 0, h = h >>> 0, c || W(s, h, this.length);
1768
- let g = this[s + --h], y = 1;
1769
- for (; h > 0 && (y *= 256); ) g += this[s + --h] * y;
1768
+ let g = this[s + --h], b = 1;
1769
+ for (; h > 0 && (b *= 256); ) g += this[s + --h] * b;
1770
1770
  return g;
1771
1771
  }, u.prototype.readUint8 = u.prototype.readUInt8 = function(s, h) {
1772
1772
  return s = s >>> 0, h || W(s, 1, this.length), this[s];
@@ -1782,24 +1782,24 @@ qn.write = function(e, t, r, n, i, o) {
1782
1782
  s = s >>> 0, _e(s, "offset");
1783
1783
  const h = this[s], c = this[s + 7];
1784
1784
  (h === void 0 || c === void 0) && ze(s, this.length - 8);
1785
- const g = h + this[++s] * 2 ** 8 + this[++s] * 2 ** 16 + this[++s] * 2 ** 24, y = this[++s] + this[++s] * 2 ** 8 + this[++s] * 2 ** 16 + c * 2 ** 24;
1786
- return BigInt(g) + (BigInt(y) << BigInt(32));
1785
+ const g = h + this[++s] * 2 ** 8 + this[++s] * 2 ** 16 + this[++s] * 2 ** 24, b = this[++s] + this[++s] * 2 ** 8 + this[++s] * 2 ** 16 + c * 2 ** 24;
1786
+ return BigInt(g) + (BigInt(b) << BigInt(32));
1787
1787
  }), u.prototype.readBigUInt64BE = ie(function(s) {
1788
1788
  s = s >>> 0, _e(s, "offset");
1789
1789
  const h = this[s], c = this[s + 7];
1790
1790
  (h === void 0 || c === void 0) && ze(s, this.length - 8);
1791
- const g = h * 2 ** 24 + this[++s] * 2 ** 16 + this[++s] * 2 ** 8 + this[++s], y = this[++s] * 2 ** 24 + this[++s] * 2 ** 16 + this[++s] * 2 ** 8 + c;
1792
- return (BigInt(g) << BigInt(32)) + BigInt(y);
1791
+ const g = h * 2 ** 24 + this[++s] * 2 ** 16 + this[++s] * 2 ** 8 + this[++s], b = this[++s] * 2 ** 24 + this[++s] * 2 ** 16 + this[++s] * 2 ** 8 + c;
1792
+ return (BigInt(g) << BigInt(32)) + BigInt(b);
1793
1793
  }), u.prototype.readIntLE = function(s, h, c) {
1794
1794
  s = s >>> 0, h = h >>> 0, c || W(s, h, this.length);
1795
- let g = this[s], y = 1, E = 0;
1796
- for (; ++E < h && (y *= 256); ) g += this[s + E] * y;
1797
- return y *= 128, g >= y && (g -= Math.pow(2, 8 * h)), g;
1795
+ let g = this[s], b = 1, E = 0;
1796
+ for (; ++E < h && (b *= 256); ) g += this[s + E] * b;
1797
+ return b *= 128, g >= b && (g -= Math.pow(2, 8 * h)), g;
1798
1798
  }, u.prototype.readIntBE = function(s, h, c) {
1799
1799
  s = s >>> 0, h = h >>> 0, c || W(s, h, this.length);
1800
- let g = h, y = 1, E = this[s + --g];
1801
- for (; g > 0 && (y *= 256); ) E += this[s + --g] * y;
1802
- return y *= 128, E >= y && (E -= Math.pow(2, 8 * h)), E;
1800
+ let g = h, b = 1, E = this[s + --g];
1801
+ for (; g > 0 && (b *= 256); ) E += this[s + --g] * b;
1802
+ return b *= 128, E >= b && (E -= Math.pow(2, 8 * h)), E;
1803
1803
  }, u.prototype.readInt8 = function(s, h) {
1804
1804
  return s = s >>> 0, h || W(s, 1, this.length), this[s] & 128 ? (255 - this[s] + 1) * -1 : this[s];
1805
1805
  }, u.prototype.readInt16LE = function(s, h) {
@@ -1835,9 +1835,9 @@ qn.write = function(e, t, r, n, i, o) {
1835
1835
  }, u.prototype.readDoubleBE = function(s, h) {
1836
1836
  return s = s >>> 0, h || W(s, 8, this.length), r.read(this, s, !1, 52, 8);
1837
1837
  };
1838
- function K(s, h, c, g, y, E) {
1838
+ function K(s, h, c, g, b, E) {
1839
1839
  if (!u.isBuffer(s)) throw new TypeError('"buffer" argument must be a Buffer instance');
1840
- if (h > y || h < E) throw new RangeError('"value" argument is out of bounds');
1840
+ if (h > b || h < E) throw new RangeError('"value" argument is out of bounds');
1841
1841
  if (c + g > s.length) throw new RangeError("Index out of range");
1842
1842
  }
1843
1843
  u.prototype.writeUintLE = u.prototype.writeUIntLE = function(s, h, c, g) {
@@ -1845,16 +1845,16 @@ qn.write = function(e, t, r, n, i, o) {
1845
1845
  const k = Math.pow(2, 8 * c) - 1;
1846
1846
  K(this, s, h, c, k, 0);
1847
1847
  }
1848
- let y = 1, E = 0;
1849
- for (this[h] = s & 255; ++E < c && (y *= 256); ) this[h + E] = s / y & 255;
1848
+ let b = 1, E = 0;
1849
+ for (this[h] = s & 255; ++E < c && (b *= 256); ) this[h + E] = s / b & 255;
1850
1850
  return h + c;
1851
1851
  }, u.prototype.writeUintBE = u.prototype.writeUIntBE = function(s, h, c, g) {
1852
1852
  if (s = +s, h = h >>> 0, c = c >>> 0, !g) {
1853
1853
  const k = Math.pow(2, 8 * c) - 1;
1854
1854
  K(this, s, h, c, k, 0);
1855
1855
  }
1856
- let y = c - 1, E = 1;
1857
- for (this[h + y] = s & 255; --y >= 0 && (E *= 256); ) this[h + y] = s / E & 255;
1856
+ let b = c - 1, E = 1;
1857
+ for (this[h + b] = s & 255; --b >= 0 && (E *= 256); ) this[h + b] = s / E & 255;
1858
1858
  return h + c;
1859
1859
  }, u.prototype.writeUint8 = u.prototype.writeUInt8 = function(s, h, c) {
1860
1860
  return s = +s, h = h >>> 0, c || K(this, s, h, 1, 255, 0), this[h] = s & 255, h + 1;
@@ -1867,39 +1867,39 @@ qn.write = function(e, t, r, n, i, o) {
1867
1867
  }, u.prototype.writeUint32BE = u.prototype.writeUInt32BE = function(s, h, c) {
1868
1868
  return s = +s, h = h >>> 0, c || K(this, s, h, 4, 4294967295, 0), this[h] = s >>> 24, this[h + 1] = s >>> 16, this[h + 2] = s >>> 8, this[h + 3] = s & 255, h + 4;
1869
1869
  };
1870
- function nt(s, h, c, g, y) {
1871
- yi(h, g, y, s, c, 7);
1870
+ function it(s, h, c, g, b) {
1871
+ yi(h, g, b, s, c, 7);
1872
1872
  let E = Number(h & BigInt(4294967295));
1873
1873
  s[c++] = E, E = E >> 8, s[c++] = E, E = E >> 8, s[c++] = E, E = E >> 8, s[c++] = E;
1874
1874
  let k = Number(h >> BigInt(32) & BigInt(4294967295));
1875
1875
  return s[c++] = k, k = k >> 8, s[c++] = k, k = k >> 8, s[c++] = k, k = k >> 8, s[c++] = k, c;
1876
1876
  }
1877
- function lt(s, h, c, g, y) {
1878
- yi(h, g, y, s, c, 7);
1877
+ function lt(s, h, c, g, b) {
1878
+ yi(h, g, b, s, c, 7);
1879
1879
  let E = Number(h & BigInt(4294967295));
1880
1880
  s[c + 7] = E, E = E >> 8, s[c + 6] = E, E = E >> 8, s[c + 5] = E, E = E >> 8, s[c + 4] = E;
1881
1881
  let k = Number(h >> BigInt(32) & BigInt(4294967295));
1882
1882
  return s[c + 3] = k, k = k >> 8, s[c + 2] = k, k = k >> 8, s[c + 1] = k, k = k >> 8, s[c] = k, c + 8;
1883
1883
  }
1884
1884
  u.prototype.writeBigUInt64LE = ie(function(s, h = 0) {
1885
- return nt(this, s, h, BigInt(0), BigInt("0xffffffffffffffff"));
1885
+ return it(this, s, h, BigInt(0), BigInt("0xffffffffffffffff"));
1886
1886
  }), u.prototype.writeBigUInt64BE = ie(function(s, h = 0) {
1887
1887
  return lt(this, s, h, BigInt(0), BigInt("0xffffffffffffffff"));
1888
1888
  }), u.prototype.writeIntLE = function(s, h, c, g) {
1889
1889
  if (s = +s, h = h >>> 0, !g) {
1890
- const st = Math.pow(2, 8 * c - 1);
1891
- K(this, s, h, c, st - 1, -st);
1890
+ const ot = Math.pow(2, 8 * c - 1);
1891
+ K(this, s, h, c, ot - 1, -ot);
1892
1892
  }
1893
- let y = 0, E = 1, k = 0;
1894
- for (this[h] = s & 255; ++y < c && (E *= 256); ) s < 0 && k === 0 && this[h + y - 1] !== 0 && (k = 1), this[h + y] = (s / E >> 0) - k & 255;
1893
+ let b = 0, E = 1, k = 0;
1894
+ for (this[h] = s & 255; ++b < c && (E *= 256); ) s < 0 && k === 0 && this[h + b - 1] !== 0 && (k = 1), this[h + b] = (s / E >> 0) - k & 255;
1895
1895
  return h + c;
1896
1896
  }, u.prototype.writeIntBE = function(s, h, c, g) {
1897
1897
  if (s = +s, h = h >>> 0, !g) {
1898
- const st = Math.pow(2, 8 * c - 1);
1899
- K(this, s, h, c, st - 1, -st);
1898
+ const ot = Math.pow(2, 8 * c - 1);
1899
+ K(this, s, h, c, ot - 1, -ot);
1900
1900
  }
1901
- let y = c - 1, E = 1, k = 0;
1902
- for (this[h + y] = s & 255; --y >= 0 && (E *= 256); ) s < 0 && k === 0 && this[h + y + 1] !== 0 && (k = 1), this[h + y] = (s / E >> 0) - k & 255;
1901
+ let b = c - 1, E = 1, k = 0;
1902
+ for (this[h + b] = s & 255; --b >= 0 && (E *= 256); ) s < 0 && k === 0 && this[h + b + 1] !== 0 && (k = 1), this[h + b] = (s / E >> 0) - k & 255;
1903
1903
  return h + c;
1904
1904
  }, u.prototype.writeInt8 = function(s, h, c) {
1905
1905
  return s = +s, h = h >>> 0, c || K(this, s, h, 1, 127, -128), s < 0 && (s = 255 + s + 1), this[h] = s & 255, h + 1;
@@ -1912,24 +1912,24 @@ qn.write = function(e, t, r, n, i, o) {
1912
1912
  }, u.prototype.writeInt32BE = function(s, h, c) {
1913
1913
  return s = +s, h = h >>> 0, c || K(this, s, h, 4, 2147483647, -2147483648), s < 0 && (s = 4294967295 + s + 1), this[h] = s >>> 24, this[h + 1] = s >>> 16, this[h + 2] = s >>> 8, this[h + 3] = s & 255, h + 4;
1914
1914
  }, u.prototype.writeBigInt64LE = ie(function(s, h = 0) {
1915
- return nt(this, s, h, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1915
+ return it(this, s, h, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1916
1916
  }), u.prototype.writeBigInt64BE = ie(function(s, h = 0) {
1917
1917
  return lt(this, s, h, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1918
1918
  });
1919
- function _t(s, h, c, g, y, E) {
1919
+ function _t(s, h, c, g, b, E) {
1920
1920
  if (c + g > s.length) throw new RangeError("Index out of range");
1921
1921
  if (c < 0) throw new RangeError("Index out of range");
1922
1922
  }
1923
- function it(s, h, c, g, y) {
1924
- return h = +h, c = c >>> 0, y || _t(s, h, c, 4), r.write(s, h, c, g, 23, 4), c + 4;
1923
+ function st(s, h, c, g, b) {
1924
+ return h = +h, c = c >>> 0, b || _t(s, h, c, 4), r.write(s, h, c, g, 23, 4), c + 4;
1925
1925
  }
1926
1926
  u.prototype.writeFloatLE = function(s, h, c) {
1927
- return it(this, s, h, !0, c);
1927
+ return st(this, s, h, !0, c);
1928
1928
  }, u.prototype.writeFloatBE = function(s, h, c) {
1929
- return it(this, s, h, !1, c);
1929
+ return st(this, s, h, !1, c);
1930
1930
  };
1931
- function yt(s, h, c, g, y) {
1932
- return h = +h, c = c >>> 0, y || _t(s, h, c, 8), r.write(s, h, c, g, 52, 8), c + 8;
1931
+ function yt(s, h, c, g, b) {
1932
+ return h = +h, c = c >>> 0, b || _t(s, h, c, 8), r.write(s, h, c, g, 52, 8), c + 8;
1933
1933
  }
1934
1934
  u.prototype.writeDoubleLE = function(s, h, c) {
1935
1935
  return yt(this, s, h, !0, c);
@@ -1942,8 +1942,8 @@ qn.write = function(e, t, r, n, i, o) {
1942
1942
  if (c < 0 || c >= this.length) throw new RangeError("Index out of range");
1943
1943
  if (g < 0) throw new RangeError("sourceEnd out of bounds");
1944
1944
  g > this.length && (g = this.length), s.length - h < g - c && (g = s.length - h + c);
1945
- const y = g - c;
1946
- return this === s && typeof o.prototype.copyWithin == "function" ? this.copyWithin(h, c, g) : o.prototype.set.call(s, this.subarray(c, g), h), y;
1945
+ const b = g - c;
1946
+ return this === s && typeof o.prototype.copyWithin == "function" ? this.copyWithin(h, c, g) : o.prototype.set.call(s, this.subarray(c, g), h), b;
1947
1947
  }, u.prototype.fill = function(s, h, c, g) {
1948
1948
  if (typeof s == "string") {
1949
1949
  if (typeof h == "string" ? (g = h, h = 0, c = this.length) : typeof c == "string" && (g = c, c = this.length), g !== void 0 && typeof g != "string") throw new TypeError("encoding must be a string");
@@ -1956,12 +1956,12 @@ qn.write = function(e, t, r, n, i, o) {
1956
1956
  if (h < 0 || this.length < h || this.length < c) throw new RangeError("Out of range index");
1957
1957
  if (c <= h) return this;
1958
1958
  h = h >>> 0, c = c === void 0 ? this.length : c >>> 0, s || (s = 0);
1959
- let y;
1960
- if (typeof s == "number") for (y = h; y < c; ++y) this[y] = s;
1959
+ let b;
1960
+ if (typeof s == "number") for (b = h; b < c; ++b) this[b] = s;
1961
1961
  else {
1962
1962
  const E = u.isBuffer(s) ? s : u.from(s, g), k = E.length;
1963
1963
  if (k === 0) throw new TypeError('The value "' + s + '" is invalid for argument "value"');
1964
- for (y = 0; y < c - h; ++y) this[y + h] = E[y % k];
1964
+ for (b = 0; b < c - h; ++b) this[b + h] = E[b % k];
1965
1965
  }
1966
1966
  return this;
1967
1967
  };
@@ -1996,8 +1996,8 @@ qn.write = function(e, t, r, n, i, o) {
1996
1996
  }, RangeError), Be("ERR_INVALID_ARG_TYPE", function(s, h) {
1997
1997
  return `The "${s}" argument must be of type number. Received type ${typeof h}`;
1998
1998
  }, TypeError), Be("ERR_OUT_OF_RANGE", function(s, h, c) {
1999
- let g = `The value of "${s}" is out of range.`, y = c;
2000
- return Number.isInteger(c) && Math.abs(c) > 2 ** 32 ? y = je(String(c)) : typeof c == "bigint" && (y = String(c), (c > BigInt(2) ** BigInt(32) || c < -(BigInt(2) ** BigInt(32))) && (y = je(y)), y += "n"), g += ` It must be ${h}. Received ${y}`, g;
1999
+ let g = `The value of "${s}" is out of range.`, b = c;
2000
+ return Number.isInteger(c) && Math.abs(c) > 2 ** 32 ? b = je(String(c)) : typeof c == "bigint" && (b = String(c), (c > BigInt(2) ** BigInt(32) || c < -(BigInt(2) ** BigInt(32))) && (b = je(b)), b += "n"), g += ` It must be ${h}. Received ${b}`, g;
2001
2001
  }, RangeError);
2002
2002
  function je(s) {
2003
2003
  let h = "", c = s.length;
@@ -2008,13 +2008,13 @@ qn.write = function(e, t, r, n, i, o) {
2008
2008
  function da(s, h, c) {
2009
2009
  _e(h, "offset"), (s[h] === void 0 || s[h + c] === void 0) && ze(h, s.length - (c + 1));
2010
2010
  }
2011
- function yi(s, h, c, g, y, E) {
2011
+ function yi(s, h, c, g, b, E) {
2012
2012
  if (s > c || s < h) {
2013
2013
  const k = typeof h == "bigint" ? "n" : "";
2014
- let st;
2015
- throw h === 0 || h === BigInt(0) ? st = `>= 0${k} and < 2${k} ** ${(E + 1) * 8}${k}` : st = `>= -(2${k} ** ${(E + 1) * 8 - 1}${k}) and < 2 ** ${(E + 1) * 8 - 1}${k}`, new $t.ERR_OUT_OF_RANGE("value", st, s);
2014
+ let ot;
2015
+ throw h === 0 || h === BigInt(0) ? ot = `>= 0${k} and < 2${k} ** ${(E + 1) * 8}${k}` : ot = `>= -(2${k} ** ${(E + 1) * 8 - 1}${k}) and < 2 ** ${(E + 1) * 8 - 1}${k}`, new $t.ERR_OUT_OF_RANGE("value", ot, s);
2016
2016
  }
2017
- da(g, y, E);
2017
+ da(g, b, E);
2018
2018
  }
2019
2019
  function _e(s, h) {
2020
2020
  if (typeof s != "number") throw new $t.ERR_INVALID_ARG_TYPE(h, "number", s);
@@ -2032,11 +2032,11 @@ qn.write = function(e, t, r, n, i, o) {
2032
2032
  h = h || 1 / 0;
2033
2033
  let c;
2034
2034
  const g = s.length;
2035
- let y = null;
2035
+ let b = null;
2036
2036
  const E = [];
2037
2037
  for (let k = 0; k < g; ++k) {
2038
2038
  if (c = s.charCodeAt(k), c > 55295 && c < 57344) {
2039
- if (!y) {
2039
+ if (!b) {
2040
2040
  if (c > 56319) {
2041
2041
  (h -= 3) > -1 && E.push(239, 191, 189);
2042
2042
  continue;
@@ -2044,16 +2044,16 @@ qn.write = function(e, t, r, n, i, o) {
2044
2044
  (h -= 3) > -1 && E.push(239, 191, 189);
2045
2045
  continue;
2046
2046
  }
2047
- y = c;
2047
+ b = c;
2048
2048
  continue;
2049
2049
  }
2050
2050
  if (c < 56320) {
2051
- (h -= 3) > -1 && E.push(239, 191, 189), y = c;
2051
+ (h -= 3) > -1 && E.push(239, 191, 189), b = c;
2052
2052
  continue;
2053
2053
  }
2054
- c = (y - 55296 << 10 | c - 56320) + 65536;
2055
- } else y && (h -= 3) > -1 && E.push(239, 191, 189);
2056
- if (y = null, c < 128) {
2054
+ c = (b - 55296 << 10 | c - 56320) + 65536;
2055
+ } else b && (h -= 3) > -1 && E.push(239, 191, 189);
2056
+ if (b = null, c < 128) {
2057
2057
  if ((h -= 1) < 0) break;
2058
2058
  E.push(c);
2059
2059
  } else if (c < 2048) {
@@ -2075,18 +2075,18 @@ qn.write = function(e, t, r, n, i, o) {
2075
2075
  return h;
2076
2076
  }
2077
2077
  function ba(s, h) {
2078
- let c, g, y;
2078
+ let c, g, b;
2079
2079
  const E = [];
2080
- for (let k = 0; k < s.length && !((h -= 2) < 0); ++k) c = s.charCodeAt(k), g = c >> 8, y = c % 256, E.push(y), E.push(g);
2080
+ for (let k = 0; k < s.length && !((h -= 2) < 0); ++k) c = s.charCodeAt(k), g = c >> 8, b = c % 256, E.push(b), E.push(g);
2081
2081
  return E;
2082
2082
  }
2083
2083
  function bi(s) {
2084
2084
  return t.toByteArray(ga(s));
2085
2085
  }
2086
2086
  function br(s, h, c, g) {
2087
- let y;
2088
- for (y = 0; y < g && !(y + c >= h.length || y >= s.length); ++y) h[y + c] = s[y];
2089
- return y;
2087
+ let b;
2088
+ for (b = 0; b < g && !(b + c >= h.length || b >= s.length); ++b) h[b + c] = s[b];
2089
+ return b;
2090
2090
  }
2091
2091
  function Ft(s, h) {
2092
2092
  return s instanceof h || s != null && s.constructor != null && s.constructor.name != null && s.constructor.name === h.name;
@@ -2098,7 +2098,7 @@ qn.write = function(e, t, r, n, i, o) {
2098
2098
  const s = "0123456789abcdef", h = new Array(256);
2099
2099
  for (let c = 0; c < 16; ++c) {
2100
2100
  const g = c * 16;
2101
- for (let y = 0; y < 16; ++y) h[g + y] = s[c] + s[y];
2101
+ for (let b = 0; b < 16; ++b) h[g + b] = s[c] + s[b];
2102
2102
  }
2103
2103
  return h;
2104
2104
  })();
@@ -2281,7 +2281,7 @@ function gt(e) {
2281
2281
  }), n !== r.length) throw new Error("Could not decode chunks");
2282
2282
  return r;
2283
2283
  }
2284
- function et(e) {
2284
+ function rt(e) {
2285
2285
  if (yh(e)) return e;
2286
2286
  if (!(e instanceof Uint8Array)) throw new TypeError("Expected a Uint8Array");
2287
2287
  const t = [];
@@ -2302,7 +2302,7 @@ function et(e) {
2302
2302
  function Ks(e) {
2303
2303
  let t;
2304
2304
  if (Zn(e)) {
2305
- const r = et(e);
2305
+ const r = rt(e);
2306
2306
  if (!r) throw new Error("Could not convert invalid chunks to ASM");
2307
2307
  t = r;
2308
2308
  } else t = e;
@@ -2324,7 +2324,7 @@ function bh(e) {
2324
2324
  }));
2325
2325
  }
2326
2326
  function Ds(e) {
2327
- const t = Zn(e) ? et(e) : e;
2327
+ const t = Zn(e) ? rt(e) : e;
2328
2328
  if (!t || !Jr(t)) throw new TypeError("Expected push-only script");
2329
2329
  return t.map((r) => Nr(r) ? r : r === j.OP_0 ? Et(0) : Ns(r - Vs));
2330
2330
  }
@@ -2338,7 +2338,7 @@ var mh = sh, Ae = wh, Eh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.
2338
2338
  __proto__: null,
2339
2339
  compile: gt,
2340
2340
  countNonPushOnlyOPs: Xn,
2341
- decompile: et,
2341
+ decompile: rt,
2342
2342
  fromASM: bh,
2343
2343
  isCanonicalPubKey: Ms,
2344
2344
  isCanonicalScriptSignature: xe,
@@ -2470,8 +2470,8 @@ var mh = sh, Ae = wh, Eh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.
2470
2470
  const t = this.program;
2471
2471
  if (!t) return;
2472
2472
  if (!this.#t.bech32Opnet) throw new TypeError("Network does not support opnet");
2473
- const r = tt.bech32m.toWords(t);
2474
- return r.unshift(Pi), tt.bech32m.encode(this.#t.bech32Opnet, r);
2473
+ const r = et.bech32m.toWords(t);
2474
+ return r.unshift(Pi), et.bech32m.encode(this.#t.bech32Opnet, r);
2475
2475
  }
2476
2476
  #b() {
2477
2477
  if (this.#s) return this.#s;
@@ -2744,13 +2744,13 @@ var Er = /* @__PURE__ */ new Uint32Array(16), Ph = class extends Wn {
2744
2744
  for (let w = 0; w < 16; w++, t += 4) Er[w] = e.getUint32(t, !0);
2745
2745
  let r = this.h0 | 0, n = r, i = this.h1 | 0, o = i, a = this.h2 | 0, f = a, l = this.h3 | 0, p = l, u = this.h4 | 0, d = u;
2746
2746
  for (let w = 0; w < 5; w++) {
2747
- const b = 4 - w, m = Uh[w], v = Oh[w], I = js[w], P = zs[w], S = Th[w], _ = kh[w];
2747
+ const y = 4 - w, m = Uh[w], v = Oh[w], I = js[w], P = zs[w], S = Th[w], _ = kh[w];
2748
2748
  for (let O = 0; O < 16; O++) {
2749
2749
  const z = Ee(r + _i(w, i, a, l) + Er[I[O]] + m, S[O]) + u | 0;
2750
2750
  r = u, u = l, l = Ee(a, 10) | 0, a = i, i = z;
2751
2751
  }
2752
2752
  for (let O = 0; O < 16; O++) {
2753
- const z = Ee(n + _i(b, o, f, p) + Er[P[O]] + v, _[O]) + d | 0;
2753
+ const z = Ee(n + _i(y, o, f, p) + Er[P[O]] + v, _[O]) + d | 0;
2754
2754
  n = d, d = p, p = Ee(f, 10) | 0, f = o, o = z;
2755
2755
  }
2756
2756
  }
@@ -3518,11 +3518,11 @@ var Rh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3518
3518
  add(t) {
3519
3519
  const { X: r, Y: n, Z: i } = this, { X: o, Y: a, Z: f } = pn(t), l = 0n, p = Qs;
3520
3520
  let u = 0n, d = 0n, w = 0n;
3521
- const b = N(p * 3n);
3521
+ const y = N(p * 3n);
3522
3522
  let m = N(r * o), v = N(n * a), I = N(i * f), P = N(r + n), S = N(o + a);
3523
3523
  P = N(P * S), S = N(m + v), P = N(P - S), S = N(r + i);
3524
3524
  let _ = N(o + f);
3525
- return S = N(S * _), _ = N(m + I), S = N(S - _), _ = N(n + i), u = N(a + f), _ = N(_ * u), u = N(v + I), _ = N(_ - u), w = N(l * S), u = N(b * I), w = N(u + w), u = N(v - w), w = N(v + w), d = N(u * w), v = N(m + m), v = N(v + m), I = N(l * I), S = N(b * S), v = N(v + I), I = N(m - I), I = N(l * I), S = N(S + I), m = N(v * S), d = N(d + m), m = N(_ * S), u = N(P * u), u = N(u - m), m = N(P * v), w = N(_ * w), w = N(w + m), new be(u, d, w);
3525
+ return S = N(S * _), _ = N(m + I), S = N(S - _), _ = N(n + i), u = N(a + f), _ = N(_ * u), u = N(v + I), _ = N(_ - u), w = N(l * S), u = N(y * I), w = N(u + w), u = N(v - w), w = N(v + w), d = N(u * w), v = N(m + m), v = N(v + m), I = N(l * I), S = N(y * S), v = N(v + I), I = N(m - I), I = N(l * I), S = N(S + I), m = N(v * S), d = N(d + m), m = N(_ * S), u = N(P * u), u = N(u - m), m = N(P * v), w = N(_ * w), w = N(w + m), new be(u, d, w);
3526
3526
  }
3527
3527
  subtract(t) {
3528
3528
  return this.add(pn(t).negate());
@@ -3587,8 +3587,8 @@ var jh = (e) => Hr("0x" + (ro(e) || "0")), Ci = (e, t, r) => jh(e.subarray(t, r)
3587
3587
  for (let l = 0; l < oo; l++) {
3588
3588
  let p = Number(e & a);
3589
3589
  e >>= f, p > xn && (p -= o, e += 1n);
3590
- const u = l * xn, d = u, w = u + Math.abs(p) - 1, b = l % 2 !== 0, m = p < 0;
3591
- p === 0 ? n = n.add(Ki(b, t[d])) : r = r.add(Ki(m, t[w]));
3590
+ const u = l * xn, d = u, w = u + Math.abs(p) - 1, y = l % 2 !== 0, m = p < 0;
3591
+ p === 0 ? n = n.add(Ki(y, t[d])) : r = r.add(Ki(m, t[w]));
3592
3592
  }
3593
3593
  return e !== 0n && xt("invalid wnaf"), {
3594
3594
  p: r,
@@ -3743,7 +3743,7 @@ var he = j, ao = class Je {
3743
3743
  return this.#A;
3744
3744
  }
3745
3745
  #O() {
3746
- return this.#P || (this.#o && (this.#k = et(this.#o) ?? void 0), this.#P = !0), this.#k;
3746
+ return this.#P || (this.#o && (this.#k = rt(this.#o) ?? void 0), this.#P = !0), this.#k;
3747
3747
  }
3748
3748
  #x() {
3749
3749
  if (this.#e) return this.#e;
@@ -3798,7 +3798,7 @@ var he = j, ao = class Je {
3798
3798
  if (this.input) return [];
3799
3799
  }
3800
3800
  #C() {
3801
- let t = new Uint8Array(0);
3801
+ let t = /* @__PURE__ */ new Uint8Array(0);
3802
3802
  if (this.#e) {
3803
3803
  const r = this.#U();
3804
3804
  if (!r) throw new TypeError("Invalid address");
@@ -3970,7 +3970,7 @@ var Ye = j, ho = class tr {
3970
3970
  return this.#v;
3971
3971
  }
3972
3972
  #P() {
3973
- return this.#S || (this.#n && (this.#b = et(this.#n) ?? void 0), this.#S = !0), this.#b;
3973
+ return this.#S || (this.#n && (this.#b = rt(this.#n) ?? void 0), this.#S = !0), this.#b;
3974
3974
  }
3975
3975
  #U() {
3976
3976
  if (!this.#T) {
@@ -3979,7 +3979,7 @@ var Ye = j, ho = class tr {
3979
3979
  const r = t[t.length - 1];
3980
3980
  this.#A = {
3981
3981
  network: this.#t,
3982
- output: r === Ye.OP_FALSE ? new Uint8Array(0) : r,
3982
+ output: r === Ye.OP_FALSE ? /* @__PURE__ */ new Uint8Array(0) : r,
3983
3983
  input: gt(t.slice(0, -1)),
3984
3984
  witness: this.#o || []
3985
3985
  };
@@ -4014,7 +4014,7 @@ var Ye = j, ho = class tr {
4014
4014
  #_() {
4015
4015
  if (this.#n) return this.#n;
4016
4016
  const t = this.#i;
4017
- if (!(!t || !t.input || !t.output)) return gt([].concat(et(t.input), t.output));
4017
+ if (!(!t || !t.input || !t.output)) return gt([].concat(rt(t.input), t.output));
4018
4018
  }
4019
4019
  #R() {
4020
4020
  if (this.#i) return this.#i;
@@ -4028,7 +4028,7 @@ var Ye = j, ho = class tr {
4028
4028
  }
4029
4029
  #H(t) {
4030
4030
  if (t.output) {
4031
- const r = et(t.output);
4031
+ const r = rt(t.output);
4032
4032
  if (!r || r.length < 1) throw new TypeError("Redeem.output too short");
4033
4033
  if (t.output.byteLength > 520) throw new TypeError("Redeem.output unspendable if larger than 520 bytes");
4034
4034
  if (Xn(r) > 201) throw new TypeError("Redeem.output unspendable with more than 201 non-push ops");
@@ -4037,12 +4037,12 @@ var Ye = j, ho = class tr {
4037
4037
  const r = t.input.length > 0, n = t.witness && t.witness.length > 0;
4038
4038
  if (!r && !n) throw new TypeError("Empty input");
4039
4039
  if (r && n) throw new TypeError("Input and witness provided");
4040
- if (r && !Jr(et(t.input)))
4040
+ if (r && !Jr(rt(t.input)))
4041
4041
  throw new TypeError("Non push-only scriptSig");
4042
4042
  }
4043
4043
  }
4044
4044
  #L() {
4045
- let t = new Uint8Array(0);
4045
+ let t = /* @__PURE__ */ new Uint8Array(0);
4046
4046
  if (this.#e) {
4047
4047
  const r = this.#k();
4048
4048
  if (!r) throw new TypeError("Invalid address");
@@ -4388,13 +4388,13 @@ var nu = class {
4388
4388
  process(e, t) {
4389
4389
  for (let u = 0; u < 16; u++, t += 4) fe[u] = e.getUint32(t, !1);
4390
4390
  for (let u = 16; u < 64; u++) {
4391
- const d = fe[u - 15], w = fe[u - 2], b = Gt(d, 7) ^ Gt(d, 18) ^ d >>> 3;
4392
- fe[u] = (Gt(w, 17) ^ Gt(w, 19) ^ w >>> 10) + fe[u - 7] + b + fe[u - 16] | 0;
4391
+ const d = fe[u - 15], w = fe[u - 2], y = Gt(d, 7) ^ Gt(d, 18) ^ d >>> 3, m = Gt(w, 17) ^ Gt(w, 19) ^ w >>> 10;
4392
+ fe[u] = m + fe[u - 7] + y + fe[u - 16] | 0;
4393
4393
  }
4394
4394
  let { A: r, B: n, C: i, D: o, E: a, F: f, G: l, H: p } = this;
4395
4395
  for (let u = 0; u < 64; u++) {
4396
- const d = Gt(a, 6) ^ Gt(a, 11) ^ Gt(a, 25), w = p + d + eu(a, f, l) + iu[u] + fe[u] | 0, b = (Gt(r, 2) ^ Gt(r, 13) ^ Gt(r, 22)) + ru(r, n, i) | 0;
4397
- p = l, l = f, f = a, a = o + w | 0, o = i, i = n, n = r, r = w + b | 0;
4396
+ const d = Gt(a, 6) ^ Gt(a, 11) ^ Gt(a, 25), w = p + d + eu(a, f, l) + iu[u] + fe[u] | 0, y = (Gt(r, 2) ^ Gt(r, 13) ^ Gt(r, 22)) + ru(r, n, i) | 0;
4397
+ p = l, l = f, f = a, a = o + w | 0, o = i, i = n, n = r, r = w + y | 0;
4398
4398
  }
4399
4399
  r = r + this.A | 0, n = n + this.B | 0, i = i + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, f = f + this.F | 0, l = l + this.G | 0, p = p + this.H | 0, this.set(r, n, i, o, a, f, l, p);
4400
4400
  }
@@ -4419,7 +4419,7 @@ var nu = class {
4419
4419
  }, au = /* @__PURE__ */ Jh(() => new ou(), /* @__PURE__ */ tu(1));
4420
4420
  function hu(e) {
4421
4421
  if (e.length >= 255) throw new TypeError("Alphabet too long");
4422
- const t = new Uint8Array(256);
4422
+ const t = /* @__PURE__ */ new Uint8Array(256);
4423
4423
  for (let p = 0; p < t.length; p++) t[p] = 255;
4424
4424
  for (let p = 0; p < e.length; p++) {
4425
4425
  const u = e.charAt(p), d = u.charCodeAt(0);
@@ -4431,10 +4431,10 @@ function hu(e) {
4431
4431
  if (p instanceof Uint8Array || (ArrayBuffer.isView(p) ? p = new Uint8Array(p.buffer, p.byteOffset, p.byteLength) : Array.isArray(p) && (p = Uint8Array.from(p))), !(p instanceof Uint8Array)) throw new TypeError("Expected Uint8Array");
4432
4432
  if (p.length === 0) return "";
4433
4433
  let u = 0, d = 0, w = 0;
4434
- const b = p.length;
4435
- for (; w !== b && p[w] === 0; ) w++, u++;
4436
- const m = (b - w) * o + 1 >>> 0, v = new Uint8Array(m);
4437
- for (; w !== b; ) {
4434
+ const y = p.length;
4435
+ for (; w !== y && p[w] === 0; ) w++, u++;
4436
+ const m = (y - w) * o + 1 >>> 0, v = new Uint8Array(m);
4437
+ for (; w !== y; ) {
4438
4438
  let S = p[w], _ = 0;
4439
4439
  for (let O = m - 1; (S !== 0 || _ < d) && O !== -1; O--, _++) S += 256 * v[O] >>> 0, v[O] = S % r >>> 0, S = S / r >>> 0;
4440
4440
  if (S !== 0) throw new Error("Non-zero carry");
@@ -4448,25 +4448,25 @@ function hu(e) {
4448
4448
  }
4449
4449
  function f(p) {
4450
4450
  if (typeof p != "string") throw new TypeError("Expected String");
4451
- if (p.length === 0) return new Uint8Array();
4451
+ if (p.length === 0) return /* @__PURE__ */ new Uint8Array();
4452
4452
  let u = 0, d = 0, w = 0;
4453
4453
  for (; p[u] === n; ) d++, u++;
4454
- const b = (p.length - u) * i + 1 >>> 0, m = new Uint8Array(b);
4454
+ const y = (p.length - u) * i + 1 >>> 0, m = new Uint8Array(y);
4455
4455
  for (; u < p.length; ) {
4456
4456
  const S = p.charCodeAt(u);
4457
4457
  if (S > 255) return;
4458
4458
  let _ = t[S];
4459
4459
  if (_ === 255) return;
4460
4460
  let O = 0;
4461
- for (let z = b - 1; (_ !== 0 || O < w) && z !== -1; z--, O++) _ += r * m[z] >>> 0, m[z] = _ % 256 >>> 0, _ = _ / 256 >>> 0;
4461
+ for (let z = y - 1; (_ !== 0 || O < w) && z !== -1; z--, O++) _ += r * m[z] >>> 0, m[z] = _ % 256 >>> 0, _ = _ / 256 >>> 0;
4462
4462
  if (_ !== 0) throw new Error("Non-zero carry");
4463
4463
  w = O, u++;
4464
4464
  }
4465
- let v = b - w;
4466
- for (; v !== b && m[v] === 0; ) v++;
4467
- const I = new Uint8Array(d + (b - v));
4465
+ let v = y - w;
4466
+ for (; v !== y && m[v] === 0; ) v++;
4467
+ const I = new Uint8Array(d + (y - v));
4468
4468
  let P = d;
4469
- for (; v !== b; ) I[P++] = m[v++];
4469
+ for (; v !== y; ) I[P++] = m[v++];
4470
4470
  return I;
4471
4471
  }
4472
4472
  function l(p) {
@@ -4540,7 +4540,7 @@ function pu(e, t, r) {
4540
4540
  let l = n(e), p = n(e), u = 0;
4541
4541
  const d = () => {
4542
4542
  l.fill(1), p.fill(0), u = 0;
4543
- }, w = (...v) => r(p, we(l, ...v)), b = (v = i) => {
4543
+ }, w = (...v) => r(p, we(l, ...v)), y = (v = i) => {
4544
4544
  p = w(o, v), l = w(), v.length !== 0 && (p = w(a, v), l = w());
4545
4545
  }, m = () => {
4546
4546
  if (u++ >= f) throw new Error("drbg: tried max amount of iterations");
@@ -4554,9 +4554,9 @@ function pu(e, t, r) {
4554
4554
  return we(...I);
4555
4555
  };
4556
4556
  return (v, I) => {
4557
- d(), b(v);
4557
+ d(), y(v);
4558
4558
  let P;
4559
- for (; !(P = I(m())); ) b();
4559
+ for (; !(P = I(m())); ) y();
4560
4560
  return d(), P;
4561
4561
  };
4562
4562
  }
@@ -4616,8 +4616,8 @@ function yu(e) {
4616
4616
  const t = nn(e), r = Ao(e), n = r(t, t.neg(t.ONE)), i = r(t, n), o = r(t, t.neg(n)), a = (e + du) / vo;
4617
4617
  return (f, l) => {
4618
4618
  let p = f.pow(l, a), u = f.mul(p, n);
4619
- const d = f.mul(p, i), w = f.mul(p, o), b = f.eql(f.sqr(u), l), m = f.eql(f.sqr(d), l);
4620
- p = f.cmov(p, u, b), u = f.cmov(w, d, m);
4619
+ const d = f.mul(p, i), w = f.mul(p, o), y = f.eql(f.sqr(u), l), m = f.eql(f.sqr(d), l);
4620
+ p = f.cmov(p, u, y), u = f.cmov(w, d, m);
4621
4621
  const v = f.eql(f.sqr(u), l), I = f.cmov(p, u, v);
4622
4622
  return si(f, I, l), I;
4623
4623
  };
@@ -4638,10 +4638,10 @@ function Ao(e) {
4638
4638
  let p = r, u = f.mul(f.ONE, o), d = f.pow(l, t), w = f.pow(l, a);
4639
4639
  for (; !f.eql(d, f.ONE); ) {
4640
4640
  if (f.is0(d)) return f.ZERO;
4641
- let b = 1, m = f.sqr(d);
4642
- for (; !f.eql(m, f.ONE); ) if (b++, m = f.sqr(m), b === p) throw new Error("Cannot find square root");
4643
- const v = Tt << BigInt(p - b - 1), I = f.pow(u, v);
4644
- p = b, u = f.sqr(I), d = f.mul(d, u), w = f.mul(w, I);
4641
+ let y = 1, m = f.sqr(d);
4642
+ for (; !f.eql(m, f.ONE); ) if (y++, m = f.sqr(m), y === p) throw new Error("Cannot find square root");
4643
+ const v = Tt << BigInt(p - y - 1), I = f.pow(u, v);
4644
+ p = y, u = f.sqr(I), d = f.mul(d, u), w = f.mul(w, I);
4645
4645
  }
4646
4646
  return w;
4647
4647
  };
@@ -4845,13 +4845,13 @@ function qi(e, t, r) {
4845
4845
  const { windowSize: n, mask: i, maxNumber: o, shiftBy: a } = r;
4846
4846
  let f = Number(e & i), l = e >> a;
4847
4847
  f > n && (f -= o, l += Ie);
4848
- const p = t * n, u = p + Math.abs(f) - 1, d = f === 0, w = f < 0, b = t % 2 !== 0;
4848
+ const p = t * n, u = p + Math.abs(f) - 1, d = f === 0, w = f < 0, y = t % 2 !== 0;
4849
4849
  return {
4850
4850
  nextN: l,
4851
4851
  offset: u,
4852
4852
  isZero: d,
4853
4853
  isNeg: w,
4854
- isNegF: b,
4854
+ isNegF: y,
4855
4855
  offsetF: p
4856
4856
  };
4857
4857
  }
@@ -5020,8 +5020,8 @@ function Pu(e, t, r) {
5020
5020
  let p = e - f * n - l * o, u = -f * i - l * a;
5021
5021
  const d = p < re, w = u < re;
5022
5022
  d && (p = -p), w && (u = -u);
5023
- const b = ni(Math.ceil(lu(r) / 2)) + Ve;
5024
- if (p < re || p >= b || u < re || u >= b) throw new Error("splitScalar (endomorphism): failed, k=" + e);
5023
+ const y = ni(Math.ceil(lu(r) / 2)) + Ve;
5024
+ if (p < re || p >= y || u < re || u >= y) throw new Error("splitScalar (endomorphism): failed, k=" + e);
5025
5025
  return {
5026
5026
  k1neg: d,
5027
5027
  k1: p,
@@ -5151,8 +5151,8 @@ function _u(e, t = {}) {
5151
5151
  throw new Error("bad point: is not on curve, sqrt error" + ct);
5152
5152
  }
5153
5153
  u();
5154
- const M = n.isOdd(L);
5155
- return (B & 1) === 1 !== M && (L = n.neg(L)), {
5154
+ const D = n.isOdd(L);
5155
+ return (B & 1) === 1 !== D && (L = n.neg(L)), {
5156
5156
  x: $,
5157
5157
  y: L
5158
5158
  };
@@ -5165,7 +5165,7 @@ function _u(e, t = {}) {
5165
5165
  };
5166
5166
  } else throw new Error(`bad point: got length ${A}, expected compressed=${U} or uncompressed=${T}`);
5167
5167
  }
5168
- const b = t.toBytes || d, m = t.fromBytes || w;
5168
+ const y = t.toBytes || d, m = t.fromBytes || w;
5169
5169
  function v(Y) {
5170
5170
  const U = n.sqr(Y), T = n.mul(U, Y);
5171
5171
  return n.add(n.add(T, n.mul(Y, o.a)), o.b);
@@ -5188,7 +5188,7 @@ function _u(e, t = {}) {
5188
5188
  if (!l || !l.basises) throw new Error("no endo");
5189
5189
  return Pu(Y, l.basises, i.ORDER);
5190
5190
  }
5191
- const D = Wi((Y, U) => {
5191
+ const M = Wi((Y, U) => {
5192
5192
  const { X: T, Y: A, Z: B } = Y;
5193
5193
  if (n.eql(B, n.ONE)) return {
5194
5194
  x: T,
@@ -5206,7 +5206,7 @@ function _u(e, t = {}) {
5206
5206
  x: $,
5207
5207
  y: C
5208
5208
  };
5209
- }), X = Wi((Y) => {
5209
+ }), Z = Wi((Y) => {
5210
5210
  if (Y.is0()) {
5211
5211
  if (t.allowInfinityPoint && !n.is0(Y.Y)) return;
5212
5212
  throw new Error("bad point: ZERO");
@@ -5217,7 +5217,7 @@ function _u(e, t = {}) {
5217
5217
  if (!Y.isTorsionFree()) throw new Error("bad point: not in prime-order subgroup");
5218
5218
  return !0;
5219
5219
  });
5220
- function at(Y, U, T, A, B) {
5220
+ function Q(Y, U, T, A, B) {
5221
5221
  return T = new q(n.mul(T.X, Y), T.Y, T.Z), U = Dr(A, U), T = Dr(B, T), U.add(T);
5222
5222
  }
5223
5223
  class q {
@@ -5257,7 +5257,7 @@ function _u(e, t = {}) {
5257
5257
  return Qt.createCache(this, U), T || this.multiply(Ar), this;
5258
5258
  }
5259
5259
  assertValidity() {
5260
- X(this);
5260
+ Z(this);
5261
5261
  }
5262
5262
  hasEvenY() {
5263
5263
  const { y: U } = this.toAffine();
@@ -5266,26 +5266,26 @@ function _u(e, t = {}) {
5266
5266
  }
5267
5267
  equals(U) {
5268
5268
  O(U);
5269
- const { X: T, Y: A, Z: B } = this, { X: V, Y: $, Z: C } = U, L = n.eql(n.mul(T, C), n.mul(V, B)), M = n.eql(n.mul(A, C), n.mul($, B));
5270
- return L && M;
5269
+ const { X: T, Y: A, Z: B } = this, { X: V, Y: $, Z: C } = U, L = n.eql(n.mul(T, C), n.mul(V, B)), D = n.eql(n.mul(A, C), n.mul($, B));
5270
+ return L && D;
5271
5271
  }
5272
5272
  negate() {
5273
5273
  return new q(this.X, n.neg(this.Y), this.Z);
5274
5274
  }
5275
5275
  double() {
5276
5276
  const { a: U, b: T } = o, A = n.mul(T, Ar), { X: B, Y: V, Z: $ } = this;
5277
- let C = n.ZERO, L = n.ZERO, M = n.ZERO, F = n.mul(B, B), ct = n.mul(V, V), W = n.mul($, $), K = n.mul(B, V);
5278
- return K = n.add(K, K), M = n.mul(B, $), M = n.add(M, M), C = n.mul(U, M), L = n.mul(A, W), L = n.add(C, L), C = n.sub(ct, L), L = n.add(ct, L), L = n.mul(C, L), C = n.mul(K, C), M = n.mul(A, M), W = n.mul(U, W), K = n.sub(F, W), K = n.mul(U, K), K = n.add(K, M), M = n.add(F, F), F = n.add(M, F), F = n.add(F, W), F = n.mul(F, K), L = n.add(L, F), W = n.mul(V, $), W = n.add(W, W), F = n.mul(W, K), C = n.sub(C, F), M = n.mul(W, ct), M = n.add(M, M), M = n.add(M, M), new q(C, L, M);
5277
+ let C = n.ZERO, L = n.ZERO, D = n.ZERO, F = n.mul(B, B), ct = n.mul(V, V), W = n.mul($, $), K = n.mul(B, V);
5278
+ return K = n.add(K, K), D = n.mul(B, $), D = n.add(D, D), C = n.mul(U, D), L = n.mul(A, W), L = n.add(C, L), C = n.sub(ct, L), L = n.add(ct, L), L = n.mul(C, L), C = n.mul(K, C), D = n.mul(A, D), W = n.mul(U, W), K = n.sub(F, W), K = n.mul(U, K), K = n.add(K, D), D = n.add(F, F), F = n.add(D, F), F = n.add(F, W), F = n.mul(F, K), L = n.add(L, F), W = n.mul(V, $), W = n.add(W, W), F = n.mul(W, K), C = n.sub(C, F), D = n.mul(W, ct), D = n.add(D, D), D = n.add(D, D), new q(C, L, D);
5279
5279
  }
5280
5280
  add(U) {
5281
5281
  O(U);
5282
5282
  const { X: T, Y: A, Z: B } = this, { X: V, Y: $, Z: C } = U;
5283
- let L = n.ZERO, M = n.ZERO, F = n.ZERO;
5283
+ let L = n.ZERO, D = n.ZERO, F = n.ZERO;
5284
5284
  const ct = o.a, W = n.mul(o.b, Ar);
5285
- let K = n.mul(T, V), nt = n.mul(A, $), lt = n.mul(B, C), _t = n.add(T, A), it = n.add(V, $);
5286
- _t = n.mul(_t, it), it = n.add(K, nt), _t = n.sub(_t, it), it = n.add(T, B);
5285
+ let K = n.mul(T, V), it = n.mul(A, $), lt = n.mul(B, C), _t = n.add(T, A), st = n.add(V, $);
5286
+ _t = n.mul(_t, st), st = n.add(K, it), _t = n.sub(_t, st), st = n.add(T, B);
5287
5287
  let yt = n.add(V, C);
5288
- return it = n.mul(it, yt), yt = n.add(K, lt), it = n.sub(it, yt), yt = n.add(A, B), L = n.add($, C), yt = n.mul(yt, L), L = n.add(nt, lt), yt = n.sub(yt, L), F = n.mul(ct, it), L = n.mul(W, lt), F = n.add(L, F), L = n.sub(nt, F), F = n.add(nt, F), M = n.mul(L, F), nt = n.add(K, K), nt = n.add(nt, K), lt = n.mul(ct, lt), it = n.mul(W, it), nt = n.add(nt, lt), lt = n.sub(K, lt), lt = n.mul(ct, lt), it = n.add(it, lt), K = n.mul(nt, it), M = n.add(M, K), K = n.mul(yt, it), L = n.mul(_t, L), L = n.sub(L, K), K = n.mul(_t, nt), F = n.mul(yt, F), F = n.add(F, K), new q(L, M, F);
5288
+ return st = n.mul(st, yt), yt = n.add(K, lt), st = n.sub(st, yt), yt = n.add(A, B), L = n.add($, C), yt = n.mul(yt, L), L = n.add(it, lt), yt = n.sub(yt, L), F = n.mul(ct, st), L = n.mul(W, lt), F = n.add(L, F), L = n.sub(it, F), F = n.add(it, F), D = n.mul(L, F), it = n.add(K, K), it = n.add(it, K), lt = n.mul(ct, lt), st = n.mul(W, st), it = n.add(it, lt), lt = n.sub(K, lt), lt = n.mul(ct, lt), st = n.add(st, lt), K = n.mul(it, st), D = n.add(D, K), K = n.mul(yt, st), L = n.mul(_t, L), L = n.sub(L, K), K = n.mul(_t, it), F = n.mul(yt, F), F = n.add(F, K), new q(L, D, F);
5289
5289
  }
5290
5290
  subtract(U) {
5291
5291
  return this.add(U.negate());
@@ -5299,8 +5299,8 @@ function _u(e, t = {}) {
5299
5299
  let A, B;
5300
5300
  const V = ($) => Qt.cached(this, $, (C) => zi(q, C));
5301
5301
  if (T) {
5302
- const { k1neg: $, k1: C, k2neg: L, k2: M } = z(U), { p: F, f: ct } = V(C), { p: W, f: K } = V(M);
5303
- B = ct.add(K), A = at(T.beta, F, W, $, L);
5302
+ const { k1neg: $, k1: C, k2neg: L, k2: D } = z(U), { p: F, f: ct } = V(C), { p: W, f: K } = V(D);
5303
+ B = ct.add(K), A = Q(T.beta, F, W, $, L);
5304
5304
  } else {
5305
5305
  const { p: $, f: C } = V(U);
5306
5306
  A = $, B = C;
@@ -5314,12 +5314,12 @@ function _u(e, t = {}) {
5314
5314
  if (U === Ve) return A;
5315
5315
  if (Qt.hasCache(this)) return this.multiply(U);
5316
5316
  if (T) {
5317
- const { k1neg: B, k1: V, k2neg: $, k2: C } = z(U), { p1: L, p2: M } = ku(q, A, V, C);
5318
- return at(T.beta, L, M, B, $);
5317
+ const { k1neg: B, k1: V, k2neg: $, k2: C } = z(U), { p1: L, p2: D } = ku(q, A, V, C);
5318
+ return Q(T.beta, L, D, B, $);
5319
5319
  } else return Qt.unsafe(A, U);
5320
5320
  }
5321
5321
  toAffine(U) {
5322
- return D(this, U);
5322
+ return M(this, U);
5323
5323
  }
5324
5324
  isTorsionFree() {
5325
5325
  const { isTorsionFree: U } = t;
@@ -5333,7 +5333,7 @@ function _u(e, t = {}) {
5333
5333
  return this.multiplyUnsafe(a).is0();
5334
5334
  }
5335
5335
  toBytes(U = !0) {
5336
- return Kr(U, "isCompressed"), this.assertValidity(), b(q, this, U);
5336
+ return Kr(U, "isCompressed"), this.assertValidity(), y(q, this, U);
5337
5337
  }
5338
5338
  toHex(U = !0) {
5339
5339
  return en(this.toBytes(U));
@@ -5359,39 +5359,39 @@ function Ro(e, t) {
5359
5359
  }
5360
5360
  function Ru(e, t = {}) {
5361
5361
  const { Fn: r } = e, n = t.randomBytes || co, i = Object.assign(Ro(e.Fp, r), { seed: ko(r.ORDER) });
5362
- function o(b) {
5362
+ function o(y) {
5363
5363
  try {
5364
- const m = r.fromBytes(b);
5364
+ const m = r.fromBytes(y);
5365
5365
  return r.isValidNot0(m);
5366
5366
  } catch {
5367
5367
  return !1;
5368
5368
  }
5369
5369
  }
5370
- function a(b, m) {
5370
+ function a(y, m) {
5371
5371
  const { publicKey: v, publicKeyUncompressed: I } = i;
5372
5372
  try {
5373
- const P = b.length;
5374
- return m === !0 && P !== v || m === !1 && P !== I ? !1 : !!e.fromBytes(b);
5373
+ const P = y.length;
5374
+ return m === !0 && P !== v || m === !1 && P !== I ? !1 : !!e.fromBytes(y);
5375
5375
  } catch {
5376
5376
  return !1;
5377
5377
  }
5378
5378
  }
5379
- function f(b = n(i.seed)) {
5380
- return Su(ut(b, i.seed, "seed"), r.ORDER);
5379
+ function f(y = n(i.seed)) {
5380
+ return Su(ut(y, i.seed, "seed"), r.ORDER);
5381
5381
  }
5382
- function l(b, m = !0) {
5383
- return e.BASE.multiply(r.fromBytes(b)).toBytes(m);
5382
+ function l(y, m = !0) {
5383
+ return e.BASE.multiply(r.fromBytes(y)).toBytes(m);
5384
5384
  }
5385
- function p(b) {
5385
+ function p(y) {
5386
5386
  const { secretKey: m, publicKey: v, publicKeyUncompressed: I } = i;
5387
- if (!ti(b) || "_lengths" in r && r._lengths || m === v) return;
5388
- const P = ut(b, void 0, "key").length;
5387
+ if (!ti(y) || "_lengths" in r && r._lengths || m === v) return;
5388
+ const P = ut(y, void 0, "key").length;
5389
5389
  return P === v || P === I;
5390
5390
  }
5391
- function u(b, m, v = !0) {
5392
- if (p(b) === !0) throw new Error("first arg must be private key");
5391
+ function u(y, m, v = !0) {
5392
+ if (p(y) === !0) throw new Error("first arg must be private key");
5393
5393
  if (p(m) === !1) throw new Error("second arg must be public key");
5394
- const I = r.fromBytes(b);
5394
+ const I = r.fromBytes(y);
5395
5395
  return e.fromBytes(m).multiply(I).toBytes(v);
5396
5396
  }
5397
5397
  const d = {
@@ -5416,7 +5416,7 @@ function Nu(e, t, r = {}) {
5416
5416
  bits2int: "function",
5417
5417
  bits2int_modN: "function"
5418
5418
  }), r = Object.assign({}, r);
5419
- const n = r.randomBytes || co, i = r.hmac || ((T, A) => xo(t, T, A)), { Fp: o, Fn: a } = e, { ORDER: f, BITS: l } = a, { keygen: p, getPublicKey: u, getSharedSecret: d, utils: w, lengths: b } = Ru(e, r), m = {
5419
+ const n = r.randomBytes || co, i = r.hmac || ((T, A) => xo(t, T, A)), { Fp: o, Fn: a } = e, { ORDER: f, BITS: l } = a, { keygen: p, getPublicKey: u, getSharedSecret: d, utils: w, lengths: y } = Ru(e, r), m = {
5420
5420
  prehash: !0,
5421
5421
  lowS: typeof r.lowS == "boolean" ? r.lowS : !0,
5422
5422
  format: "compact",
@@ -5434,7 +5434,7 @@ function Nu(e, t, r = {}) {
5434
5434
  }
5435
5435
  function _(T, A) {
5436
5436
  Rn(A);
5437
- const B = b.signature;
5437
+ const B = y.signature;
5438
5438
  return ut(T, A === "compact" ? B : A === "recovered" ? B + 1 : void 0);
5439
5439
  }
5440
5440
  class O {
@@ -5457,11 +5457,11 @@ function Nu(e, t, r = {}) {
5457
5457
  _(A, B);
5458
5458
  let V;
5459
5459
  if (B === "der") {
5460
- const { r: M, s: F } = de.toSig(ut(A));
5461
- return new O(M, F);
5460
+ const { r: D, s: F } = de.toSig(ut(A));
5461
+ return new O(D, F);
5462
5462
  }
5463
5463
  B === "recovered" && (V = A[0], B = "compact", A = A.subarray(1));
5464
- const $ = b.signature / 2, C = A.subarray(0, $), L = A.subarray($, $ * 2);
5464
+ const $ = y.signature / 2, C = A.subarray(0, $), L = A.subarray($, $ * 2);
5465
5465
  return new O(a.fromBytes(C), a.fromBytes(L), V);
5466
5466
  }
5467
5467
  static fromHex(A, B) {
@@ -5478,9 +5478,9 @@ function Nu(e, t, r = {}) {
5478
5478
  recoverPublicKey(A) {
5479
5479
  const { r: B, s: V } = this, $ = this.assertRecovery(), C = $ === 2 || $ === 3 ? B + f : B;
5480
5480
  if (!o.isValid(C)) throw new Error("invalid recovery id: sig.r+curve.n != R.x");
5481
- const L = o.toBytes(C), M = e.fromBytes(we(_o(($ & 1) === 0), L)), F = a.inv(C), ct = D(ut(A, void 0, "msgHash")), W = a.create(-ct * F), K = a.create(V * F), nt = e.BASE.multiplyUnsafe(W).add(M.multiplyUnsafe(K));
5482
- if (nt.is0()) throw new Error("invalid recovery: point at infinify");
5483
- return nt.assertValidity(), nt;
5481
+ const L = o.toBytes(C), D = e.fromBytes(we(_o(($ & 1) === 0), L)), F = a.inv(C), ct = M(ut(A, void 0, "msgHash")), W = a.create(-ct * F), K = a.create(V * F), it = e.BASE.multiplyUnsafe(W).add(D.multiplyUnsafe(K));
5482
+ if (it.is0()) throw new Error("invalid recovery: point at infinify");
5483
+ return it.assertValidity(), it;
5484
5484
  }
5485
5485
  hasHighS() {
5486
5486
  return I(this.s);
@@ -5498,11 +5498,11 @@ function Nu(e, t, r = {}) {
5498
5498
  if (T.length > 8192) throw new Error("input is too large");
5499
5499
  const A = rn(T), B = T.length * 8 - l;
5500
5500
  return B > 0 ? A >> BigInt(B) : A;
5501
- }, D = r.bits2int_modN || function(T) {
5501
+ }, M = r.bits2int_modN || function(T) {
5502
5502
  return a.create(z(T));
5503
- }, X = ni(l);
5504
- function at(T) {
5505
- return cu("num < 2^" + l, T, re, X), a.toBytes(T);
5503
+ }, Z = ni(l);
5504
+ function Q(T) {
5505
+ return cu("num < 2^" + l, T, re, Z), a.toBytes(T);
5506
5506
  }
5507
5507
  function q(T, A) {
5508
5508
  return ut(T, void 0, "message"), A ? ut(t(T), void 0, "prehashed message") : T;
@@ -5510,22 +5510,22 @@ function Nu(e, t, r = {}) {
5510
5510
  function Vt(T, A, B) {
5511
5511
  const { lowS: V, prehash: $, extraEntropy: C } = bn(B, m);
5512
5512
  T = q(T, $);
5513
- const L = D(T), M = a.fromBytes(A);
5514
- if (!a.isValidNot0(M)) throw new Error("invalid private key");
5515
- const F = [at(M), at(L)];
5513
+ const L = M(T), D = a.fromBytes(A);
5514
+ if (!a.isValidNot0(D)) throw new Error("invalid private key");
5515
+ const F = [Q(D), Q(L)];
5516
5516
  if (C != null && C !== !1) {
5517
- const nt = C === !0 ? n(b.secretKey) : C;
5518
- F.push(ut(nt, void 0, "extraEntropy"));
5517
+ const it = C === !0 ? n(y.secretKey) : C;
5518
+ F.push(ut(it, void 0, "extraEntropy"));
5519
5519
  }
5520
5520
  const ct = we(...F), W = L;
5521
- function K(nt) {
5522
- const lt = z(nt);
5521
+ function K(it) {
5522
+ const lt = z(it);
5523
5523
  if (!a.isValidNot0(lt)) return;
5524
- const _t = a.inv(lt), it = e.BASE.multiply(lt).toAffine(), yt = a.create(it.x);
5524
+ const _t = a.inv(lt), st = e.BASE.multiply(lt).toAffine(), yt = a.create(st.x);
5525
5525
  if (yt === re) return;
5526
- const $t = a.create(_t * a.create(W + yt * M));
5526
+ const $t = a.create(_t * a.create(W + yt * D));
5527
5527
  if ($t === re) return;
5528
- let Be = (it.x === yt ? 0 : 2) | Number(it.y & Ve), je = $t;
5528
+ let Be = (st.x === yt ? 0 : 2) | Number(st.y & Ve), je = $t;
5529
5529
  return V && I($t) && (je = a.neg($t), Be ^= 1), new O(yt, je, v ? void 0 : Be);
5530
5530
  }
5531
5531
  return {
@@ -5540,15 +5540,15 @@ function Nu(e, t, r = {}) {
5540
5540
  function Y(T, A, B, V = {}) {
5541
5541
  const { lowS: $, prehash: C, format: L } = bn(V, m);
5542
5542
  if (B = ut(B, void 0, "publicKey"), A = q(A, C), !ti(T)) {
5543
- const M = T instanceof O ? ", use sig.toBytes()" : "";
5544
- throw new Error("verify expects Uint8Array signature" + M);
5543
+ const D = T instanceof O ? ", use sig.toBytes()" : "";
5544
+ throw new Error("verify expects Uint8Array signature" + D);
5545
5545
  }
5546
5546
  _(T, L);
5547
5547
  try {
5548
- const M = O.fromBytes(T, L), F = e.fromBytes(B);
5549
- if ($ && M.hasHighS()) return !1;
5550
- const { r: ct, s: W } = M, K = D(A), nt = a.inv(W), lt = a.create(K * nt), _t = a.create(ct * nt), it = e.BASE.multiplyUnsafe(lt).add(F.multiplyUnsafe(_t));
5551
- return it.is0() ? !1 : a.create(it.x) === ct;
5548
+ const D = O.fromBytes(T, L), F = e.fromBytes(B);
5549
+ if ($ && D.hasHighS()) return !1;
5550
+ const { r: ct, s: W } = D, K = M(A), it = a.inv(W), lt = a.create(K * it), _t = a.create(ct * it), st = e.BASE.multiplyUnsafe(lt).add(F.multiplyUnsafe(_t));
5551
+ return st.is0() ? !1 : a.create(st.x) === ct;
5552
5552
  } catch {
5553
5553
  return !1;
5554
5554
  }
@@ -5562,7 +5562,7 @@ function Nu(e, t, r = {}) {
5562
5562
  getPublicKey: u,
5563
5563
  getSharedSecret: d,
5564
5564
  utils: w,
5565
- lengths: b,
5565
+ lengths: y,
5566
5566
  Point: e,
5567
5567
  sign: Qt,
5568
5568
  verify: Y,
@@ -5584,7 +5584,7 @@ var oi = {
5584
5584
  basises: [[BigInt("0x3086d221a7d46bcde86c90e49284eb15"), -BigInt("0xe4437ed6010e88286f547fa90abfe4c3")], [BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]
5585
5585
  }, Qi = /* @__PURE__ */ BigInt(2);
5586
5586
  function Lu(e) {
5587
- const t = oi.p, r = BigInt(3), n = BigInt(6), i = BigInt(11), o = BigInt(22), a = BigInt(23), f = BigInt(44), l = BigInt(88), p = e * e * e % t, u = p * p * e % t, d = Rt(Rt(Rt(u, r, t) * u % t, r, t) * u % t, Qi, t) * p % t, w = Rt(d, i, t) * d % t, b = Rt(w, o, t) * w % t, m = Rt(b, f, t) * b % t, v = Rt(Rt(Rt(Rt(Rt(Rt(m, l, t) * m % t, f, t) * b % t, r, t) * u % t, a, t) * w % t, n, t) * p % t, Qi, t);
5587
+ const t = oi.p, r = BigInt(3), n = BigInt(6), i = BigInt(11), o = BigInt(22), a = BigInt(23), f = BigInt(44), l = BigInt(88), p = e * e * e % t, u = p * p * e % t, d = Rt(Rt(Rt(u, r, t) * u % t, r, t) * u % t, Qi, t) * p % t, w = Rt(d, i, t) * d % t, y = Rt(w, o, t) * w % t, m = Rt(y, f, t) * y % t, v = Rt(Rt(Rt(Rt(Rt(Rt(m, l, t) * m % t, f, t) * y % t, r, t) * u % t, a, t) * w % t, n, t) * p % t, Qi, t);
5588
5588
  if (!Nn.eql(Nn.sqr(v), e)) throw new Error("Cannot find square root");
5589
5589
  return v;
5590
5590
  }
@@ -5596,21 +5596,21 @@ var Nn = nn(oi.p, { sqrt: Lu });
5596
5596
  function H(e) {
5597
5597
  return Xh(e);
5598
5598
  }
5599
- function Z(e, t) {
5599
+ function X(e, t) {
5600
5600
  if (!e) throw new Error(`verifyCryptoBackend: ${t}`);
5601
5601
  }
5602
5602
  function Cu(e) {
5603
- Z(e.isPoint(H("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")), "isPoint should accept generator point"), Z(!e.isPoint(H("030000000000000000000000000000000000000000000000000000000000000005")), "isPoint should reject invalid point"), Z(e.isXOnlyPoint(H("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")), "isXOnlyPoint should accept generator x-coordinate"), Z(!e.isXOnlyPoint(H("0000000000000000000000000000000000000000000000000000000000000005")), "isXOnlyPoint should reject x-coordinate not on curve"), Z(!e.isXOnlyPoint(H("0000000000000000000000000000000000000000000000000000000000000000")), "isXOnlyPoint should reject zero"), Z(!e.isXOnlyPoint(H("79be667ef9dcbbac55a06295ce870b07")), "isXOnlyPoint should reject wrong length"), Z(e.isPrivate(H("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")), "isPrivate should accept valid scalar"), Z(e.isPrivate(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")), "isPrivate should accept n-1"), Z(!e.isPrivate(H("0000000000000000000000000000000000000000000000000000000000000000")), "isPrivate should reject zero"), Z(!e.isPrivate(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141")), "isPrivate should reject n"), Z(!e.isPrivate(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364142")), "isPrivate should reject n+1");
5603
+ X(e.isPoint(H("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")), "isPoint should accept generator point"), X(!e.isPoint(H("030000000000000000000000000000000000000000000000000000000000000005")), "isPoint should reject invalid point"), X(e.isXOnlyPoint(H("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")), "isXOnlyPoint should accept generator x-coordinate"), X(!e.isXOnlyPoint(H("0000000000000000000000000000000000000000000000000000000000000005")), "isXOnlyPoint should reject x-coordinate not on curve"), X(!e.isXOnlyPoint(H("0000000000000000000000000000000000000000000000000000000000000000")), "isXOnlyPoint should reject zero"), X(!e.isXOnlyPoint(H("79be667ef9dcbbac55a06295ce870b07")), "isXOnlyPoint should reject wrong length"), X(e.isPrivate(H("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")), "isPrivate should accept valid scalar"), X(e.isPrivate(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")), "isPrivate should accept n-1"), X(!e.isPrivate(H("0000000000000000000000000000000000000000000000000000000000000000")), "isPrivate should reject zero"), X(!e.isPrivate(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141")), "isPrivate should reject n"), X(!e.isPrivate(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364142")), "isPrivate should reject n+1");
5604
5604
  const t = e.privateAdd(H("0000000000000000000000000000000000000000000000000000000000000001"), H("0000000000000000000000000000000000000000000000000000000000000000"));
5605
- Z(t !== null && Ut(t, H("0000000000000000000000000000000000000000000000000000000000000001")), "privateAdd: 1 + 0 should equal 1"), Z(e.privateAdd(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"), H("0000000000000000000000000000000000000000000000000000000000000003")) === null, "privateAdd: (n-3) + 3 should return null (result is zero mod n)");
5605
+ X(t !== null && Ut(t, H("0000000000000000000000000000000000000000000000000000000000000001")), "privateAdd: 1 + 0 should equal 1"), X(e.privateAdd(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"), H("0000000000000000000000000000000000000000000000000000000000000003")) === null, "privateAdd: (n-3) + 3 should return null (result is zero mod n)");
5606
5606
  const r = e.privateAdd(H("e211078564db65c3ce7704f08262b1f38f1ef412ad15b5ac2d76657a63b2c500"), H("b51fbb69051255d1becbd683de5848242a89c229348dd72896a87ada94ae8665"));
5607
- Z(r !== null && Ut(r, H("9730c2ee69edbb958d42db7460bafa18fef9d955325aec99044c81c8282b0a24")), "privateAdd: known vector failed"), Z(Ut(e.privateNegate(H("0000000000000000000000000000000000000000000000000000000000000001")), H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")), "privateNegate(1) should equal n-1"), Z(Ut(e.privateNegate(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e")), H("0000000000000000000000000000000000000000000000000000000000000003")), "privateNegate(n-3) should equal 3"), Z(Ut(e.privateNegate(H("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af")), H("4eede1bf775995d70a494f0a7bb6bc11e0b8cccd41cce8009ab1132c8b0a3792")), "privateNegate known vector failed"), Z(Ut(e.pointCompress(H("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"), !0), H("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")), "pointCompress uncompressed->compressed failed"), Z(Ut(e.pointCompress(H("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"), !1), H("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")), "pointCompress uncompressed->uncompressed failed"), Z(Ut(e.pointCompress(H("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"), !0), H("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")), "pointCompress compressed->compressed failed"), Z(Ut(e.pointCompress(H("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"), !1), H("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")), "pointCompress compressed->uncompressed failed");
5607
+ X(r !== null && Ut(r, H("9730c2ee69edbb958d42db7460bafa18fef9d955325aec99044c81c8282b0a24")), "privateAdd: known vector failed"), X(Ut(e.privateNegate(H("0000000000000000000000000000000000000000000000000000000000000001")), H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")), "privateNegate(1) should equal n-1"), X(Ut(e.privateNegate(H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e")), H("0000000000000000000000000000000000000000000000000000000000000003")), "privateNegate(n-3) should equal 3"), X(Ut(e.privateNegate(H("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af")), H("4eede1bf775995d70a494f0a7bb6bc11e0b8cccd41cce8009ab1132c8b0a3792")), "privateNegate known vector failed"), X(Ut(e.pointCompress(H("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"), !0), H("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")), "pointCompress uncompressed->compressed failed"), X(Ut(e.pointCompress(H("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"), !1), H("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")), "pointCompress uncompressed->uncompressed failed"), X(Ut(e.pointCompress(H("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"), !0), H("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")), "pointCompress compressed->compressed failed"), X(Ut(e.pointCompress(H("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"), !1), H("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")), "pointCompress compressed->uncompressed failed");
5608
5608
  const n = e.pointFromScalar(H("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"));
5609
- Z(n !== null && Ut(n, H("02b07ba9dca9523b7ef4bd97703d43d20399eb698e194704791a25ce77a400df99")), "pointFromScalar known vector failed"), Z(e.xOnlyPointAddTweak(H("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"), H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")) === null, "xOnlyPointAddTweak should return null for infinity result");
5609
+ X(n !== null && Ut(n, H("02b07ba9dca9523b7ef4bd97703d43d20399eb698e194704791a25ce77a400df99")), "pointFromScalar known vector failed"), X(e.xOnlyPointAddTweak(H("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"), H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")) === null, "xOnlyPointAddTweak should return null for infinity result");
5610
5610
  let i = e.xOnlyPointAddTweak(H("1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b"), H("a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac"));
5611
- Z(i !== null && Ut(i.xOnlyPubkey, H("e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf")) && i.parity === 1, "xOnlyPointAddTweak parity=1 case failed"), i = e.xOnlyPointAddTweak(H("2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991"), H("823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47")), Z(i !== null && Ut(i.xOnlyPubkey, H("9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c")) && i.parity === 0, "xOnlyPointAddTweak parity=0 case failed");
5611
+ X(i !== null && Ut(i.xOnlyPubkey, H("e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf")) && i.parity === 1, "xOnlyPointAddTweak parity=1 case failed"), i = e.xOnlyPointAddTweak(H("2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991"), H("823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47")), X(i !== null && Ut(i.xOnlyPubkey, H("9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c")) && i.parity === 0, "xOnlyPointAddTweak parity=0 case failed");
5612
5612
  const o = e.sign(H("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"), H("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"));
5613
- Z(Ut(o, H("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5")), "sign known vector failed"), Z(e.verify(H("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"), H("0379be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"), o), "verify known vector failed"), e.signSchnorr && Z(Ut(e.signSchnorr(H("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"), H("c90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b14e5c9"), H("c87aa53824b4d7ae2eb035a2b5bbbccc080e76cdc6d1692c4b0b62d798e6d906")), H("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7")), "signSchnorr known vector failed"), e.verifySchnorr && Z(e.verifySchnorr(H("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"), H("dd308afec5777e13121fa72b9cc1b7cc0139715309b086c960e18fd969774eb8"), H("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7")), "verifySchnorr known vector failed");
5613
+ X(Ut(o, H("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5")), "sign known vector failed"), X(e.verify(H("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"), H("0379be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"), o), "verify known vector failed"), e.signSchnorr && X(Ut(e.signSchnorr(H("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"), H("c90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b14e5c9"), H("c87aa53824b4d7ae2eb035a2b5bbbccc080e76cdc6d1692c4b0b62d798e6d906")), H("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7")), "signSchnorr known vector failed"), e.verifySchnorr && X(e.verifySchnorr(H("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"), H("dd308afec5777e13121fa72b9cc1b7cc0139715309b086c960e18fd969774eb8"), H("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7")), "verifySchnorr known vector failed");
5614
5614
  }
5615
5615
  var Hn = class Kt {
5616
5616
  static #t;
@@ -5834,8 +5834,8 @@ var Ji = j, ts = 2, Mu = 80, No = class rr {
5834
5834
  if (this.#e) return this.#e;
5835
5835
  const t = this.hash;
5836
5836
  if (!t) return;
5837
- const r = tt.bech32m.toWords(t);
5838
- return r.unshift(ts), tt.bech32m.encode(this.#t.bech32, r);
5837
+ const r = et.bech32m.toWords(t);
5838
+ return r.unshift(ts), et.bech32m.encode(this.#t.bech32, r);
5839
5839
  }
5840
5840
  #B() {
5841
5841
  if (this.#s) return this.#s;
@@ -5885,7 +5885,7 @@ var Ji = j, ts = 2, Mu = 80, No = class rr {
5885
5885
  }
5886
5886
  }
5887
5887
  #L() {
5888
- let t = new Uint8Array(0);
5888
+ let t = /* @__PURE__ */ new Uint8Array(0);
5889
5889
  if (this.#e) {
5890
5890
  const i = this.#P();
5891
5891
  if (!i) throw new TypeError("Invalid address");
@@ -5914,7 +5914,7 @@ var Ji = j, ts = 2, Mu = 80, No = class rr {
5914
5914
  if (this.#o && this.redeem) {
5915
5915
  if (this.#o.redeemVersion && this.#o.redeemVersion !== this.redeem.redeemVersion) throw new TypeError("Redeem.redeemVersion and witness mismatch");
5916
5916
  if (this.#o.output) {
5917
- const i = et(this.#o.output);
5917
+ const i = rt(this.#o.output);
5918
5918
  if (!i || i.length === 0) throw new TypeError("Redeem.output is invalid");
5919
5919
  if (this.redeem.output && !x(this.#o.output, this.redeem.output)) throw new TypeError("Redeem.output and witness mismatch");
5920
5920
  }
@@ -6101,8 +6101,8 @@ var es = j, rs = 1, Fu = 80, Ho = class nr {
6101
6101
  if (this.#e) return this.#e;
6102
6102
  const t = this.pubkey;
6103
6103
  if (!t) return;
6104
- const r = tt.bech32m.toWords(t);
6105
- return r.unshift(rs), tt.bech32m.encode(this.#t.bech32, r);
6104
+ const r = et.bech32m.toWords(t);
6105
+ return r.unshift(rs), et.bech32m.encode(this.#t.bech32, r);
6106
6106
  }
6107
6107
  #K() {
6108
6108
  if (this.#s) return this.#s;
@@ -6179,7 +6179,7 @@ var es = j, rs = 1, Fu = 80, Ho = class nr {
6179
6179
  if (this.#o) return [this.#o];
6180
6180
  }
6181
6181
  #q() {
6182
- let t = new Uint8Array(0);
6182
+ let t = /* @__PURE__ */ new Uint8Array(0);
6183
6183
  if (this.#e) {
6184
6184
  const i = this.#L();
6185
6185
  if (!i) throw new TypeError("Invalid address");
@@ -6214,7 +6214,7 @@ var es = j, rs = 1, Fu = 80, Ho = class nr {
6214
6214
  if (this.#u && this.redeem) {
6215
6215
  if (this.#u.redeemVersion && this.#u.redeemVersion !== this.redeem.redeemVersion) throw new TypeError("Redeem.redeemVersion and witness mismatch");
6216
6216
  if (this.#u.output) {
6217
- const i = et(this.#u.output);
6217
+ const i = rt(this.#u.output);
6218
6218
  if (!i || i.length === 0) throw new TypeError("Redeem.output is invalid");
6219
6219
  if (this.redeem.output && !x(this.#u.output, this.redeem.output)) throw new TypeError("Redeem.output and witness mismatch");
6220
6220
  }
@@ -6259,7 +6259,7 @@ function wr(e, t) {
6259
6259
  }, t);
6260
6260
  return Object.assign(r.toPayment(), e);
6261
6261
  }
6262
- var ns = j, Wu = new Uint8Array(0), Lo = class ir {
6262
+ var ns = j, Wu = /* @__PURE__ */ new Uint8Array(0), Lo = class ir {
6263
6263
  static NAME = ft.P2WPKH;
6264
6264
  #t;
6265
6265
  #a;
@@ -6358,7 +6358,7 @@ var ns = j, Wu = new Uint8Array(0), Lo = class ir {
6358
6358
  #A() {
6359
6359
  if (!this.#S) {
6360
6360
  if (this.#e) {
6361
- const t = tt.bech32.decode(this.#e), r = t.words.shift(), n = tt.bech32.fromWords(t.words);
6361
+ const t = et.bech32.decode(this.#e), r = t.words.shift(), n = et.bech32.fromWords(t.words);
6362
6362
  this.#b = {
6363
6363
  version: r ?? 0,
6364
6364
  prefix: t.prefix,
@@ -6373,8 +6373,8 @@ var ns = j, Wu = new Uint8Array(0), Lo = class ir {
6373
6373
  if (this.#e) return this.#e;
6374
6374
  const t = this.hash;
6375
6375
  if (!t) return;
6376
- const r = tt.bech32.toWords(t);
6377
- return r.unshift(0), tt.bech32.encode(this.#t.bech32, r);
6376
+ const r = et.bech32.toWords(t);
6377
+ return r.unshift(0), et.bech32.encode(this.#t.bech32, r);
6378
6378
  }
6379
6379
  #k() {
6380
6380
  if (this.#s) return this.#s;
@@ -6404,7 +6404,7 @@ var ns = j, Wu = new Uint8Array(0), Lo = class ir {
6404
6404
  if (!(!this.#r || !this.#n)) return [this.#n, this.#r];
6405
6405
  }
6406
6406
  #_() {
6407
- let t = new Uint8Array(0);
6407
+ let t = /* @__PURE__ */ new Uint8Array(0);
6408
6408
  if (this.#e) {
6409
6409
  const r = this.#A();
6410
6410
  if (!r) throw new TypeError("Invalid address");
@@ -6452,7 +6452,7 @@ function sn(e, t) {
6452
6452
  }, t);
6453
6453
  return Object.assign(r.toPayment(), e);
6454
6454
  }
6455
- var is = j, mn = new Uint8Array(0);
6455
+ var is = j, mn = /* @__PURE__ */ new Uint8Array(0);
6456
6456
  function Sr(e) {
6457
6457
  return !!(e instanceof Uint8Array && e.length === 65 && e[0] === 4 && ke(e));
6458
6458
  }
@@ -6553,7 +6553,7 @@ var Co = class sr {
6553
6553
  #S() {
6554
6554
  if (!this.#v) {
6555
6555
  if (this.#e) {
6556
- const t = tt.bech32.decode(this.#e), r = t.words.shift(), n = tt.bech32.fromWords(t.words);
6556
+ const t = et.bech32.decode(this.#e), r = t.words.shift(), n = et.bech32.fromWords(t.words);
6557
6557
  this.#E = {
6558
6558
  version: r ?? 0,
6559
6559
  prefix: t.prefix,
@@ -6565,14 +6565,14 @@ var Co = class sr {
6565
6565
  return this.#E;
6566
6566
  }
6567
6567
  #A() {
6568
- return this.#b || (this.#n?.input && (this.#I = et(this.#n.input) ?? void 0), this.#b = !0), this.#I;
6568
+ return this.#b || (this.#n?.input && (this.#I = rt(this.#n.input) ?? void 0), this.#b = !0), this.#I;
6569
6569
  }
6570
6570
  #T() {
6571
6571
  if (this.#e) return this.#e;
6572
6572
  const t = this.hash;
6573
6573
  if (!t) return;
6574
- const r = tt.bech32.toWords(t);
6575
- return r.unshift(0), tt.bech32.encode(this.#t.bech32, r);
6574
+ const r = et.bech32.toWords(t);
6575
+ return r.unshift(0), et.bech32.encode(this.#t.bech32, r);
6576
6576
  }
6577
6577
  #k() {
6578
6578
  if (this.#s) return this.#s;
@@ -6612,7 +6612,7 @@ var Co = class sr {
6612
6612
  }
6613
6613
  }
6614
6614
  #B() {
6615
- let t = new Uint8Array(0);
6615
+ let t = /* @__PURE__ */ new Uint8Array(0);
6616
6616
  if (this.#e) {
6617
6617
  const r = this.#S();
6618
6618
  if (!r) throw new TypeError("Invalid address");
@@ -6635,7 +6635,7 @@ var Co = class sr {
6635
6635
  if (this.#n.network && this.#n.network !== this.#t) throw new TypeError("Network mismatch");
6636
6636
  if (this.#n.input && this.#n.input.length > 0 && this.#n.witness && this.#n.witness.length > 0) throw new TypeError("Ambiguous witness source");
6637
6637
  if (this.#n.output) {
6638
- const n = et(this.#n.output);
6638
+ const n = rt(this.#n.output);
6639
6639
  if (!n || n.length < 1) throw new TypeError("Redeem.output is invalid");
6640
6640
  if (this.#n.output.byteLength > 3600) throw new TypeError("Redeem.output unspendable if larger than 3600 bytes");
6641
6641
  if (Xn(n) > 201) throw new TypeError("Redeem.output unspendable with more than 201 non-push ops");
@@ -6646,12 +6646,12 @@ var Co = class sr {
6646
6646
  const r = this.#A();
6647
6647
  if (this.#n.input && r && !Jr(r)) throw new TypeError("Non push-only scriptSig");
6648
6648
  if (this.#i && this.#n.witness && !Ue(this.#i, this.#n.witness)) throw new TypeError("Witness and redeem.witness mismatch");
6649
- if (this.#n.input && r?.some(Sr) || this.#n.output && (et(this.#n.output) || []).some(Sr)) throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey");
6649
+ if (this.#n.input && r?.some(Sr) || this.#n.output && (rt(this.#n.output) || []).some(Sr)) throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey");
6650
6650
  }
6651
6651
  if (this.#i && this.#i.length > 0) {
6652
6652
  const r = this.#i[this.#i.length - 1];
6653
6653
  if (this.#n && this.#n.output && !x(this.#n.output, r)) throw new TypeError("Witness and redeem.output mismatch");
6654
- if (this.#i.some(Sr) || (et(r) || []).some(Sr)) throw new TypeError("Witness contains uncompressed pubkey");
6654
+ if (this.#i.some(Sr) || (rt(r) || []).some(Sr)) throw new TypeError("Witness contains uncompressed pubkey");
6655
6655
  }
6656
6656
  }
6657
6657
  };
@@ -6748,7 +6748,7 @@ var ss = j, Vo = class Br {
6748
6748
  #y() {
6749
6749
  if (this.#s) return this.#s;
6750
6750
  if (this.#n) {
6751
- const t = et(this.#n);
6751
+ const t = rt(this.#n);
6752
6752
  if (t && t.length > 0) return t[0];
6753
6753
  }
6754
6754
  }
@@ -6777,7 +6777,7 @@ var ss = j, Vo = class Br {
6777
6777
  if (this.#n && t && !x(this.#n, t)) throw new TypeError("Signature mismatch");
6778
6778
  }
6779
6779
  if (this.#n) {
6780
- const t = et(this.#n);
6780
+ const t = rt(this.#n);
6781
6781
  if (!t || t.length !== 1) throw new TypeError("Input is invalid");
6782
6782
  const r = this.signature;
6783
6783
  if (!r || !xe(r)) throw new TypeError("Input has invalid signature");
@@ -6890,7 +6890,7 @@ var He = j, Tr = He.OP_RESERVED, $o = class _r {
6890
6890
  };
6891
6891
  }
6892
6892
  #A(t) {
6893
- this.#S || (this.#S = !0, this.#b = et(t) ?? [], this.#h = this.#b[0] - Tr, this.#f = this.#b[this.#b.length - 2] - Tr, this.#u = this.#b.slice(1, -2), this.#w = !0, this.#g = !0, this.#y = !0);
6893
+ this.#S || (this.#S = !0, this.#b = rt(t) ?? [], this.#h = this.#b[0] - Tr, this.#f = this.#b[this.#b.length - 2] - Tr, this.#u = this.#b.slice(1, -2), this.#w = !0, this.#g = !0, this.#y = !0);
6894
6894
  }
6895
6895
  #T() {
6896
6896
  if (this.#e !== void 0) return this.#e;
@@ -6908,7 +6908,7 @@ var He = j, Tr = He.OP_RESERVED, $o = class _r {
6908
6908
  }
6909
6909
  #U() {
6910
6910
  if (this.#n) return this.#n;
6911
- if (this.#o) return et(this.#o)?.slice(1);
6911
+ if (this.#o) return rt(this.#o)?.slice(1);
6912
6912
  }
6913
6913
  #O() {
6914
6914
  if (this.#i) return this.#i;
@@ -6979,7 +6979,7 @@ function Gu(e) {
6979
6979
  const t = e.length;
6980
6980
  return Ct(t) + e.reduce((r, n) => r + Nt(n), 0);
6981
6981
  }
6982
- var ce = new Uint8Array(0), os = [], kr = Mt("0000000000000000000000000000000000000000000000000000000000000000"), as = Or(Mt("0000000000000000000000000000000000000000000000000000000000000001")), ju = 18446744073709551615n, J = class Q {
6982
+ var ce = /* @__PURE__ */ new Uint8Array(0), os = [], kr = Mt("0000000000000000000000000000000000000000000000000000000000000000"), as = Or(Mt("0000000000000000000000000000000000000000000000000000000000000001")), ju = 18446744073709551615n, tt = class J {
6983
6983
  static DEFAULT_SEQUENCE = 4294967295;
6984
6984
  static SIGHASH_DEFAULT = 0;
6985
6985
  static SIGHASH_ALL = 1;
@@ -6998,18 +6998,18 @@ var ce = new Uint8Array(0), os = [], kr = Mt("0000000000000000000000000000000000
6998
6998
  ins = [];
6999
6999
  outs = [];
7000
7000
  static fromBuffer(t, r) {
7001
- const n = new _a(t), i = new Q();
7001
+ const n = new _a(t), i = new J();
7002
7002
  i.version = n.readInt32LE();
7003
7003
  const o = n.readUInt8(), a = n.readUInt8();
7004
7004
  let f = !1;
7005
- o === Q.ADVANCED_TRANSACTION_MARKER && a === Q.ADVANCED_TRANSACTION_FLAG ? f = !0 : n.offset -= 2;
7005
+ o === J.ADVANCED_TRANSACTION_MARKER && a === J.ADVANCED_TRANSACTION_FLAG ? f = !0 : n.offset -= 2;
7006
7006
  const l = n.readVarInt();
7007
7007
  for (let u = 0; u < l; ++u) {
7008
- const d = n.readBytes(32), w = n.readUInt32LE(), b = n.readVarBytes(), m = n.readUInt32LE();
7008
+ const d = n.readBytes(32), w = n.readUInt32LE(), y = n.readVarBytes(), m = n.readUInt32LE();
7009
7009
  i.ins.push({
7010
7010
  hash: d,
7011
7011
  index: w,
7012
- script: b,
7012
+ script: y,
7013
7013
  sequence: m,
7014
7014
  witness: os
7015
7015
  });
@@ -7028,7 +7028,7 @@ var ce = new Uint8Array(0), os = [], kr = Mt("0000000000000000000000000000000000
7028
7028
  return i;
7029
7029
  }
7030
7030
  static fromHex(t) {
7031
- return Q.fromBuffer(Mt(t), !1);
7031
+ return J.fromBuffer(Mt(t), !1);
7032
7032
  }
7033
7033
  static isCoinbaseHash(t) {
7034
7034
  if (t.length !== 32) throw new TypeError("Expected 32-byte hash");
@@ -7037,13 +7037,13 @@ var ce = new Uint8Array(0), os = [], kr = Mt("0000000000000000000000000000000000
7037
7037
  }
7038
7038
  isCoinbase() {
7039
7039
  const t = this.ins[0];
7040
- return this.ins.length === 1 && t !== void 0 && Q.isCoinbaseHash(t.hash);
7040
+ return this.ins.length === 1 && t !== void 0 && J.isCoinbaseHash(t.hash);
7041
7041
  }
7042
7042
  addInput(t, r, n, i) {
7043
7043
  if (t.length !== 32) throw new TypeError("Expected 32-byte hash");
7044
7044
  if (!Number.isInteger(r) || r < 0 || r > 4294967295) throw new TypeError("Expected unsigned 32-bit integer for index");
7045
7045
  if (n != null && (!Number.isInteger(n) || n < 0 || n > 4294967295)) throw new TypeError("Expected unsigned 32-bit integer for sequence");
7046
- return n ??= Q.DEFAULT_SEQUENCE, this.ins.push({
7046
+ return n ??= J.DEFAULT_SEQUENCE, this.ins.push({
7047
7047
  hash: t,
7048
7048
  index: r,
7049
7049
  script: i || ce,
@@ -7074,7 +7074,7 @@ var ce = new Uint8Array(0), os = [], kr = Mt("0000000000000000000000000000000000
7074
7074
  return (r ? 10 : 8) + Ct(this.ins.length) + Ct(this.outs.length) + this.ins.reduce((n, i) => n + 40 + Nt(i.script), 0) + this.outs.reduce((n, i) => n + 8 + Nt(i.script), 0) + (r ? this.ins.reduce((n, i) => n + Gu(i.witness), 0) : 0);
7075
7075
  }
7076
7076
  clone() {
7077
- const t = new Q();
7077
+ const t = new J();
7078
7078
  return t.version = this.version, t.locktime = this.locktime, t.ins = this.ins.map((r) => ({
7079
7079
  hash: r.hash,
7080
7080
  index: r.index,
@@ -7091,13 +7091,13 @@ var ce = new Uint8Array(0), os = [], kr = Mt("0000000000000000000000000000000000
7091
7091
  if (!(r instanceof Uint8Array)) throw new TypeError("Expected Uint8Array for prevOutScript");
7092
7092
  if (!Number.isInteger(n)) throw new TypeError("Expected integer for hashType");
7093
7093
  if (t >= this.ins.length) return as;
7094
- const i = et(r);
7094
+ const i = rt(r);
7095
7095
  if (!i) throw new Error("Could not decompile prevOutScript");
7096
7096
  const o = gt(i.filter((l) => l !== j.OP_CODESEPARATOR)), a = this.clone();
7097
- if ((n & 31) === Q.SIGHASH_NONE) a.outs = [], a.ins.forEach((l, p) => {
7097
+ if ((n & 31) === J.SIGHASH_NONE) a.outs = [], a.ins.forEach((l, p) => {
7098
7098
  p !== t && (l.sequence = 0);
7099
7099
  });
7100
- else if ((n & 31) === Q.SIGHASH_SINGLE) {
7100
+ else if ((n & 31) === J.SIGHASH_SINGLE) {
7101
7101
  if (t >= this.outs.length) return as;
7102
7102
  a.outs.length = t + 1;
7103
7103
  for (let l = 0; l < t; l++) a.outs[l] = {
@@ -7108,7 +7108,7 @@ var ce = new Uint8Array(0), os = [], kr = Mt("0000000000000000000000000000000000
7108
7108
  p !== t && (l.sequence = 0);
7109
7109
  });
7110
7110
  }
7111
- n & Q.SIGHASH_ANYONECANPAY ? (a.ins = [a.ins[t]], a.ins[0].script = o) : (a.ins.forEach((l) => {
7111
+ n & J.SIGHASH_ANYONECANPAY ? (a.ins = [a.ins[t]], a.ins[0].script = o) : (a.ins.forEach((l) => {
7112
7112
  l.script = ce;
7113
7113
  }), a.ins[t].script = o);
7114
7114
  const f = Et(a.byteLength(!1) + 4);
@@ -7116,40 +7116,40 @@ var ce = new Uint8Array(0), os = [], kr = Mt("0000000000000000000000000000000000
7116
7116
  }
7117
7117
  hashForWitnessV1(t, r, n, i, o, a, f) {
7118
7118
  if (!Number.isInteger(t) || t < 0 || t > 4294967295) throw new TypeError("Expected unsigned 32-bit integer for inIndex");
7119
- if (!Array.isArray(r) || !r.every((D) => D instanceof Uint8Array)) throw new TypeError("Expected array of Uint8Array for prevOutScripts");
7120
- if (!Array.isArray(n) || !n.every((D) => typeof D == "bigint")) throw new TypeError("Expected array of bigint for values");
7119
+ if (!Array.isArray(r) || !r.every((M) => M instanceof Uint8Array)) throw new TypeError("Expected array of Uint8Array for prevOutScripts");
7120
+ if (!Array.isArray(n) || !n.every((M) => typeof M == "bigint")) throw new TypeError("Expected array of bigint for values");
7121
7121
  if (!Number.isInteger(i) || i < 0 || i > 4294967295) throw new TypeError("Expected unsigned 32-bit integer for hashType");
7122
7122
  if (n.length !== this.ins.length || r.length !== this.ins.length) throw new Error("Must supply prevout script and value for all inputs");
7123
- const l = i === Q.SIGHASH_DEFAULT ? Q.SIGHASH_ALL : i & Q.SIGHASH_OUTPUT_MASK, p = (i & Q.SIGHASH_INPUT_MASK) === Q.SIGHASH_ANYONECANPAY, u = l === Q.SIGHASH_NONE, d = l === Q.SIGHASH_SINGLE;
7124
- let w = ce, b = ce, m = ce, v = ce, I = ce;
7125
- if (!p) if (f) w = f.hashPrevouts, b = f.hashAmounts, m = f.hashScriptPubKeys, v = f.hashSequences;
7123
+ const l = i === J.SIGHASH_DEFAULT ? J.SIGHASH_ALL : i & J.SIGHASH_OUTPUT_MASK, p = (i & J.SIGHASH_INPUT_MASK) === J.SIGHASH_ANYONECANPAY, u = l === J.SIGHASH_NONE, d = l === J.SIGHASH_SINGLE;
7124
+ let w = ce, y = ce, m = ce, v = ce, I = ce;
7125
+ if (!p) if (f) w = f.hashPrevouts, y = f.hashAmounts, m = f.hashScriptPubKeys, v = f.hashSequences;
7126
7126
  else {
7127
- let D = new dt(36 * this.ins.length);
7128
- this.ins.forEach((X) => {
7129
- D.writeBytes(X.hash), D.writeUInt32LE(X.index);
7130
- }), w = It(D.finish()), D = new dt(8 * this.ins.length), n.forEach((X) => D.writeUInt64LE(X)), b = It(D.finish()), D = new dt(r.map(Nt).reduce((X, at) => X + at)), r.forEach((X) => D.writeVarBytes(X)), m = It(D.finish()), D = new dt(4 * this.ins.length), this.ins.forEach((X) => D.writeUInt32LE(X.sequence)), v = It(D.finish());
7127
+ let M = new dt(36 * this.ins.length);
7128
+ this.ins.forEach((Z) => {
7129
+ M.writeBytes(Z.hash), M.writeUInt32LE(Z.index);
7130
+ }), w = It(M.finish()), M = new dt(8 * this.ins.length), n.forEach((Z) => M.writeUInt64LE(Z)), y = It(M.finish()), M = new dt(r.map(Nt).reduce((Z, Q) => Z + Q)), r.forEach((Z) => M.writeVarBytes(Z)), m = It(M.finish()), M = new dt(4 * this.ins.length), this.ins.forEach((Z) => M.writeUInt32LE(Z.sequence)), v = It(M.finish());
7131
7131
  }
7132
7132
  if (u || d) {
7133
7133
  if (d && t < this.outs.length) {
7134
- const D = this.outs[t], X = new dt(8 + Nt(D.script));
7135
- X.writeUInt64LE(D.value), X.writeVarBytes(D.script), I = It(X.finish());
7134
+ const M = this.outs[t], Z = new dt(8 + Nt(M.script));
7135
+ Z.writeUInt64LE(M.value), Z.writeVarBytes(M.script), I = It(Z.finish());
7136
7136
  }
7137
7137
  } else if (f) I = f.hashOutputs;
7138
7138
  else {
7139
7139
  if (!this.outs.length) throw new Error("Add outputs to the transaction before signing.");
7140
- const D = new dt(this.outs.map((X) => 8 + Nt(X.script)).reduce((X, at) => X + at));
7141
- this.outs.forEach((X) => {
7142
- D.writeUInt64LE(X.value), D.writeVarBytes(X.script);
7143
- }), I = It(D.finish());
7140
+ const M = this.outs.map((Q) => 8 + Nt(Q.script)).reduce((Q, q) => Q + q), Z = new dt(M);
7141
+ this.outs.forEach((Q) => {
7142
+ Z.writeUInt64LE(Q.value), Z.writeVarBytes(Q.script);
7143
+ }), I = It(Z.finish());
7144
7144
  }
7145
7145
  const P = (o ? 2 : 0) + (a ? 1 : 0), S = new dt(174 - (p ? 49 : 0) - (u ? 32 : 0) + (a ? 32 : 0) + (o ? 37 : 0));
7146
- if (S.writeUInt8(i), S.writeInt32LE(this.version), S.writeUInt32LE(this.locktime), S.writeBytes(w), S.writeBytes(b), S.writeBytes(m), S.writeBytes(v), u || d || S.writeBytes(I), S.writeUInt8(P), p) {
7147
- const D = this.ins[t];
7148
- S.writeBytes(D.hash), S.writeUInt32LE(D.index), S.writeUInt64LE(n[t]), S.writeVarBytes(r[t]), S.writeUInt32LE(D.sequence);
7146
+ if (S.writeUInt8(i), S.writeInt32LE(this.version), S.writeUInt32LE(this.locktime), S.writeBytes(w), S.writeBytes(y), S.writeBytes(m), S.writeBytes(v), u || d || S.writeBytes(I), S.writeUInt8(P), p) {
7147
+ const M = this.ins[t];
7148
+ S.writeBytes(M.hash), S.writeUInt32LE(M.index), S.writeUInt64LE(n[t]), S.writeVarBytes(r[t]), S.writeUInt32LE(M.sequence);
7149
7149
  } else S.writeUInt32LE(t);
7150
7150
  if (a) {
7151
- const D = new dt(Nt(a));
7152
- D.writeVarBytes(a), S.writeBytes(It(D.finish()));
7151
+ const M = new dt(Nt(a));
7152
+ M.writeVarBytes(a), S.writeBytes(It(M.finish()));
7153
7153
  }
7154
7154
  d && S.writeBytes(I), o && (S.writeBytes(o), S.writeUInt8(0), S.writeUInt32LE(4294967295));
7155
7155
  const _ = new Uint8Array([0]), O = S.finish(), z = new Uint8Array(1 + O.length);
@@ -7188,14 +7188,14 @@ var ce = new Uint8Array(0), os = [], kr = Mt("0000000000000000000000000000000000
7188
7188
  if (typeof n != "bigint") throw new TypeError("Expected bigint for value");
7189
7189
  if (!Number.isInteger(i) || i < 0 || i > 4294967295) throw new TypeError("Expected unsigned 32-bit integer for hashType");
7190
7190
  let o, a, f = kr, l = kr, p = kr;
7191
- if (i & Q.SIGHASH_ANYONECANPAY || (o = Et(36 * this.ins.length), a = new dt(o, 0), this.ins.forEach((d) => {
7191
+ if (i & J.SIGHASH_ANYONECANPAY || (o = Et(36 * this.ins.length), a = new dt(o, 0), this.ins.forEach((d) => {
7192
7192
  a.writeBytes(d.hash), a.writeUInt32LE(d.index);
7193
- }), l = le(o)), !(i & Q.SIGHASH_ANYONECANPAY) && (i & 31) !== Q.SIGHASH_SINGLE && (i & 31) !== Q.SIGHASH_NONE && (o = Et(4 * this.ins.length), a = new dt(o, 0), this.ins.forEach((d) => {
7193
+ }), l = le(o)), !(i & J.SIGHASH_ANYONECANPAY) && (i & 31) !== J.SIGHASH_SINGLE && (i & 31) !== J.SIGHASH_NONE && (o = Et(4 * this.ins.length), a = new dt(o, 0), this.ins.forEach((d) => {
7194
7194
  a.writeUInt32LE(d.sequence);
7195
- }), p = le(o)), (i & 31) !== Q.SIGHASH_SINGLE && (i & 31) !== Q.SIGHASH_NONE) o = Et(this.outs.reduce((d, w) => d + 8 + Nt(w.script), 0)), a = new dt(o, 0), this.outs.forEach((d) => {
7195
+ }), p = le(o)), (i & 31) !== J.SIGHASH_SINGLE && (i & 31) !== J.SIGHASH_NONE) o = Et(this.outs.reduce((d, w) => d + 8 + Nt(w.script), 0)), a = new dt(o, 0), this.outs.forEach((d) => {
7196
7196
  a.writeUInt64LE(d.value), a.writeVarBytes(d.script);
7197
7197
  }), f = le(o);
7198
- else if ((i & 31) === Q.SIGHASH_SINGLE && t < this.outs.length) {
7198
+ else if ((i & 31) === J.SIGHASH_SINGLE && t < this.outs.length) {
7199
7199
  const d = this.outs[t];
7200
7200
  o = Et(8 + Nt(d.script)), a = new dt(o, 0), a.writeUInt64LE(d.value), a.writeVarBytes(d.script), f = le(o);
7201
7201
  }
@@ -7204,7 +7204,7 @@ var ce = new Uint8Array(0), os = [], kr = Mt("0000000000000000000000000000000000
7204
7204
  return a.writeInt32LE(this.version), a.writeBytes(l), a.writeBytes(p), a.writeBytes(u.hash), a.writeUInt32LE(u.index), a.writeVarBytes(r), a.writeUInt64LE(n), a.writeUInt32LE(u.sequence), a.writeBytes(f), a.writeUInt32LE(this.locktime), a.writeUInt32LE(i), Or(le(o));
7205
7205
  }
7206
7206
  getHash(t) {
7207
- return t && this.isCoinbase() ? new Uint8Array(32) : le(this.#t(void 0, void 0, t));
7207
+ return t && this.isCoinbase() ? /* @__PURE__ */ new Uint8Array(32) : le(this.#t(void 0, void 0, t));
7208
7208
  }
7209
7209
  getId() {
7210
7210
  return Yt(zn(this.getHash(!1)));
@@ -7230,7 +7230,7 @@ var ce = new Uint8Array(0), os = [], kr = Mt("0000000000000000000000000000000000
7230
7230
  const i = new dt(t, r || 0);
7231
7231
  i.writeInt32LE(this.version);
7232
7232
  const o = n && this.hasWitnesses();
7233
- return o && (i.writeUInt8(Q.ADVANCED_TRANSACTION_MARKER), i.writeUInt8(Q.ADVANCED_TRANSACTION_FLAG)), i.writeVarInt(this.ins.length), this.ins.forEach((a) => {
7233
+ return o && (i.writeUInt8(J.ADVANCED_TRANSACTION_MARKER), i.writeUInt8(J.ADVANCED_TRANSACTION_FLAG)), i.writeVarInt(this.ins.length), this.ins.forEach((a) => {
7234
7234
  i.writeBytes(a.hash), i.writeUInt32LE(a.index), i.writeVarBytes(a.script), i.writeUInt32LE(a.sequence);
7235
7235
  }), i.writeVarInt(this.outs.length), this.outs.forEach((a) => {
7236
7236
  i.writeUInt64LE(a.value), i.writeVarBytes(a.script);
@@ -7240,7 +7240,7 @@ var ce = new Uint8Array(0), os = [], kr = Mt("0000000000000000000000000000000000
7240
7240
  }
7241
7241
  }, zu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7242
7242
  __proto__: null,
7243
- Transaction: J
7243
+ Transaction: tt
7244
7244
  }, Symbol.toStringTag, { value: "Module" }));
7245
7245
  function ne(e) {
7246
7246
  return (t) => {
@@ -7270,7 +7270,7 @@ function or(e) {
7270
7270
  return o(e), Bt(t);
7271
7271
  }
7272
7272
  function Do(e, t) {
7273
- const r = et(t);
7273
+ const r = rt(t);
7274
7274
  if (r === null) throw new Error("Unknown script error");
7275
7275
  const n = St(e), i = Ce(e), o = Bn(e), a = o?.hybrid ? St(o.hybrid) : void 0, f = o?.uncompressed ? St(o.uncompressed) : void 0;
7276
7276
  return r.findIndex((l) => typeof l == "number" ? !1 : !!(vr(l, e) || vr(l, i) || x(l, n) || o && (vr(l, o.uncompressed) || vr(l, o.hybrid) || a && x(l, a) || f && x(l, f))));
@@ -7283,11 +7283,11 @@ function Zu(e, t) {
7283
7283
  }
7284
7284
  function Mo(e, t, r) {
7285
7285
  const { hashType: n } = t(e), i = [];
7286
- switch (n & J.SIGHASH_ANYONECANPAY && i.push("addInput"), n & 31) {
7287
- case J.SIGHASH_ALL:
7286
+ switch (n & tt.SIGHASH_ANYONECANPAY && i.push("addInput"), n & 31) {
7287
+ case tt.SIGHASH_ALL:
7288
7288
  break;
7289
- case J.SIGHASH_SINGLE:
7290
- case J.SIGHASH_NONE:
7289
+ case tt.SIGHASH_SINGLE:
7290
+ case tt.SIGHASH_NONE:
7291
7291
  i.push("addOutput"), i.push("setInputSequence");
7292
7292
  break;
7293
7293
  }
@@ -7303,7 +7303,7 @@ function Qu(e) {
7303
7303
  return r.map((n) => new Uint8Array(n.signature));
7304
7304
  }
7305
7305
  function Ju(e) {
7306
- const t = e.finalScriptSig ? et(new Uint8Array(e.finalScriptSig)) || [] : [], r = e.finalScriptWitness ? et(new Uint8Array(e.finalScriptWitness)) || [] : [];
7306
+ const t = e.finalScriptSig ? rt(new Uint8Array(e.finalScriptSig)) || [] : [], r = e.finalScriptWitness ? rt(new Uint8Array(e.finalScriptWitness)) || [] : [];
7307
7307
  return t.concat(r).filter((n) => n instanceof Uint8Array && xe(n)).map((n) => ({ signature: n }));
7308
7308
  }
7309
7309
  function us(e, t, r) {
@@ -7315,7 +7315,7 @@ function us(e, t, r) {
7315
7315
  }
7316
7316
  }
7317
7317
  function Le(e, t) {
7318
- return Bt([e, t ? new Uint8Array([t]) : new Uint8Array(0)]);
7318
+ return Bt([e, t ? new Uint8Array([t]) : /* @__PURE__ */ new Uint8Array(0)]);
7319
7319
  }
7320
7320
  function Lt(e) {
7321
7321
  return e && !!(e.tapInternalKey || e.tapMerkleRoot || e.tapLeafScript && e.tapLeafScript.length || e.tapBip32Derivation && e.tapBip32Derivation.length || e.witnessUtxo && (ui(new Uint8Array(e.witnessUtxo.script)) || fi(new Uint8Array(e.witnessUtxo.script))));
@@ -7361,7 +7361,7 @@ function nf(e, t) {
7361
7361
  function sf(e) {
7362
7362
  return {
7363
7363
  signature: e.subarray(0, 64),
7364
- hashType: e.subarray(64)[0] || J.SIGHASH_DEFAULT
7364
+ hashType: e.subarray(64)[0] || tt.SIGHASH_DEFAULT
7365
7365
  };
7366
7366
  }
7367
7367
  function of(e) {
@@ -7852,19 +7852,19 @@ var If = {
7852
7852
  const d = f[u];
7853
7853
  if (d.status === "fulfilled") {
7854
7854
  const w = d.value;
7855
- for (const b of w.results) l.set(b.inputIndex, {
7855
+ for (const y of w.results) l.set(y.inputIndex, {
7856
7856
  type: "result",
7857
- taskId: b.taskId,
7858
- signature: b.signature,
7859
- inputIndex: b.inputIndex,
7860
- publicKey: b.publicKey,
7861
- signatureType: b.signatureType,
7862
- leafHash: b.leafHash
7857
+ taskId: y.taskId,
7858
+ signature: y.signature,
7859
+ inputIndex: y.inputIndex,
7860
+ publicKey: y.publicKey,
7861
+ signatureType: y.signatureType,
7862
+ leafHash: y.leafHash
7863
7863
  });
7864
- for (const b of w.errors) p.set(b.inputIndex, b.error);
7864
+ for (const y of w.errors) p.set(y.inputIndex, y.error);
7865
7865
  } else {
7866
- const w = d.reason?.message ?? "Batch signing failed", b = o[u];
7867
- for (const m of b) p.set(m.inputIndex, w);
7866
+ const w = d.reason?.message ?? "Batch signing failed", y = o[u];
7867
+ for (const m of y) p.set(m.inputIndex, w);
7868
7868
  }
7869
7869
  }
7870
7870
  return this.#n || await this.#w(), {
@@ -7920,33 +7920,33 @@ var If = {
7920
7920
  };
7921
7921
  const o = this.#e[i] ?? await this.#p(), a = `batch-${this.#o++}`;
7922
7922
  return new Promise((f, l) => {
7923
- const p = {
7923
+ const p = setTimeout(() => {
7924
+ this.#s.delete(a), o.state = At.Idle, o.currentTaskId = null, o.taskStartTime = null, this.#d(o).catch(() => {
7925
+ }), this.#u().catch(() => {
7926
+ }), l(/* @__PURE__ */ new Error(`Batch signing timeout for ${t.length} tasks`));
7927
+ }, this.#a.maxKeyHoldTimeMs), u = {
7924
7928
  batchId: a,
7925
7929
  resolve: f,
7926
7930
  reject: l,
7927
- timeoutId: setTimeout(() => {
7928
- this.#s.delete(a), o.state = At.Idle, o.currentTaskId = null, o.taskStartTime = null, this.#d(o).catch(() => {
7929
- }), this.#u().catch(() => {
7930
- }), l(/* @__PURE__ */ new Error(`Batch signing timeout for ${t.length} tasks`));
7931
- }, this.#a.maxKeyHoldTimeMs)
7931
+ timeoutId: p
7932
7932
  };
7933
- this.#s.set(a, p), o.state = At.Busy, o.currentTaskId = a, o.taskStartTime = Date.now();
7934
- const u = {
7933
+ this.#s.set(a, u), o.state = At.Busy, o.currentTaskId = a, o.taskStartTime = Date.now();
7934
+ const d = t.map((y) => ({
7935
+ taskId: y.taskId,
7936
+ hash: y.hash,
7937
+ publicKey: n,
7938
+ signatureType: y.signatureType,
7939
+ lowR: y.lowR,
7940
+ inputIndex: y.inputIndex,
7941
+ sighashType: y.sighashType,
7942
+ leafHash: y.leafHash
7943
+ })), w = {
7935
7944
  type: "signBatch",
7936
7945
  batchId: a,
7937
- tasks: t.map((d) => ({
7938
- taskId: d.taskId,
7939
- hash: d.hash,
7940
- publicKey: n,
7941
- signatureType: d.signatureType,
7942
- lowR: d.lowR,
7943
- inputIndex: d.inputIndex,
7944
- sighashType: d.sighashType,
7945
- leafHash: d.leafHash
7946
- })),
7946
+ tasks: d,
7947
7947
  privateKey: r
7948
7948
  };
7949
- o.worker.postMessage(u);
7949
+ o.worker.postMessage(w);
7950
7950
  });
7951
7951
  }
7952
7952
  async #p() {
@@ -8005,7 +8005,7 @@ function Af(e, t, r, n, i) {
8005
8005
  inputIndex: t,
8006
8006
  hash: f,
8007
8007
  signatureType: Fo.Schnorr,
8008
- sighashType: r.sighashType ?? J.SIGHASH_DEFAULT,
8008
+ sighashType: r.sighashType ?? tt.SIGHASH_DEFAULT,
8009
8009
  leafHash: l
8010
8010
  });
8011
8011
  } catch {
@@ -8014,8 +8014,8 @@ function Af(e, t, r, n, i) {
8014
8014
  }
8015
8015
  function Sf(e, t, r, n, i) {
8016
8016
  try {
8017
- const o = r.sighashType ?? J.SIGHASH_ALL;
8018
- return (i.sighashTypes ?? [J.SIGHASH_ALL]).includes(o), null;
8017
+ const o = r.sighashType ?? tt.SIGHASH_ALL;
8018
+ return (i.sighashTypes ?? [tt.SIGHASH_ALL]).includes(o), null;
8019
8019
  } catch {
8020
8020
  return null;
8021
8021
  }
@@ -8036,7 +8036,7 @@ function Yl(e, t, r) {
8036
8036
  e.data.updateInput(i, { tapKeySig: f });
8037
8037
  }
8038
8038
  else {
8039
- const f = Ae.encode(o.signature, a.sighashType ?? J.SIGHASH_ALL), l = [{
8039
+ const f = Ae.encode(o.signature, a.sighashType ?? tt.SIGHASH_ALL), l = [{
8040
8040
  pubkey: Uint8Array.from(n),
8041
8041
  signature: f
8042
8042
  }];
@@ -8076,8 +8076,8 @@ function Go(e, t) {
8076
8076
  if (f.length < 2 || f.length > 40) throw new TypeError("Invalid program length for segwit address");
8077
8077
  const l = r === j.OP_0 ? 0 : r !== void 0 && r >= j.OP_1 && r <= j.OP_16 ? r - (j.OP_1 - 1) : -1;
8078
8078
  if (l < 15 || l > 16) throw new TypeError(`Invalid segwit version ${l}`);
8079
- const p = [l, ...tt.bech32m.toWords(f)];
8080
- return tt.bech32m.encode(t.bech32Opnet, p);
8079
+ const p = [l, ...et.bech32m.toWords(f)];
8080
+ return et.bech32m.encode(t.bech32Opnet, p);
8081
8081
  }
8082
8082
  function jo(e, t) {
8083
8083
  const r = e.subarray(2);
@@ -8105,8 +8105,8 @@ function Vn(e, t) {
8105
8105
  return r[0] = t, r.set(e, 1), Gn(r);
8106
8106
  }
8107
8107
  function Wr(e, t, r, n) {
8108
- const i = tt.bech32.toWords(e);
8109
- return i.unshift(t), t === 16 && n ? tt.bech32m.encode(n, i) : t === 0 ? tt.bech32.encode(r, i) : tt.bech32m.encode(r, i);
8108
+ const i = et.bech32.toWords(e);
8109
+ return i.unshift(t), t === 16 && n ? et.bech32m.encode(n, i) : t === 0 ? et.bech32.encode(r, i) : et.bech32m.encode(r, i);
8110
8110
  }
8111
8111
  function qo(e, t) {
8112
8112
  t = t || kt;
@@ -8116,12 +8116,12 @@ function qo(e, t) {
8116
8116
  if (r === 22 && e[0] === 0 && e[1] === 20) return Wr(e.subarray(2, 22), 0, t.bech32);
8117
8117
  if (r === 34 && e[0] === 0 && e[1] === 32) return Wr(e.subarray(2, 34), 0, t.bech32);
8118
8118
  if (r === 34 && e[0] === 81 && e[1] === 32) {
8119
- const n = tt.bech32m.toWords(e.subarray(2, 34));
8120
- return n.unshift(1), tt.bech32m.encode(t.bech32, n);
8119
+ const n = et.bech32m.toWords(e.subarray(2, 34));
8120
+ return n.unshift(1), et.bech32m.encode(t.bech32, n);
8121
8121
  }
8122
8122
  if (r === 34 && e[0] === 82 && e[1] === 32) {
8123
- const n = tt.bech32m.toWords(e.subarray(2, 34));
8124
- return n.unshift(2), tt.bech32m.encode(t.bech32, n);
8123
+ const n = et.bech32m.toWords(e.subarray(2, 34));
8124
+ return n.unshift(2), et.bech32m.encode(t.bech32, n);
8125
8125
  }
8126
8126
  try {
8127
8127
  return Go(e, t);
@@ -8238,7 +8238,7 @@ var Uf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8238
8238
  }
8239
8239
  #h() {
8240
8240
  if (this.#e) return this.#e;
8241
- if (this.#s) return et(this.#s)?.slice(1);
8241
+ if (this.#s) return rt(this.#s)?.slice(1);
8242
8242
  }
8243
8243
  #f() {
8244
8244
  if (this.#s) return this.#s;
@@ -8246,7 +8246,7 @@ var Uf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8246
8246
  }
8247
8247
  #u() {
8248
8248
  if (this.#s) {
8249
- const t = et(this.#s);
8249
+ const t = rt(this.#s);
8250
8250
  if (!t) throw new TypeError("Output is invalid");
8251
8251
  if (t[0] !== ls.OP_RETURN) throw new TypeError("Output is invalid");
8252
8252
  if (!t.slice(1).every((r) => r instanceof Uint8Array)) throw new TypeError("Output is invalid");
@@ -8325,7 +8325,7 @@ function Xt(e) {
8325
8325
  return r;
8326
8326
  }
8327
8327
  function G(e) {
8328
- const t = e || new Uint8Array();
8328
+ const t = e || /* @__PURE__ */ new Uint8Array();
8329
8329
  return t.length > 512 ? Rf(t) : _f(t);
8330
8330
  }
8331
8331
  function _f(e) {
@@ -8601,7 +8601,7 @@ function Tc(e) {
8601
8601
  return Number(an(e.value, 0, "LE"));
8602
8602
  }
8603
8603
  function kc(e) {
8604
- const t = Uint8Array.from([R.SIGHASH_TYPE]), r = new Uint8Array(4);
8604
+ const t = Uint8Array.from([R.SIGHASH_TYPE]), r = /* @__PURE__ */ new Uint8Array(4);
8605
8605
  return ci(r, 0, e, "LE"), {
8606
8606
  key: t,
8607
8607
  value: r
@@ -8831,8 +8831,8 @@ function li(e, t = ll) {
8831
8831
  path: "m"
8832
8832
  };
8833
8833
  for (const u of cl(f.value.length / 4 - 1)) {
8834
- const d = an(f.value, u * 4 + 4, "LE"), w = !!(d & 2147483648), b = d & 2147483647;
8835
- p.path += "/" + b.toString(10) + (w ? "'" : "");
8834
+ const d = an(f.value, u * 4 + 4, "LE"), w = !!(d & 2147483648), y = d & 2147483647;
8835
+ p.path += "/" + y.toString(10) + (w ? "'" : "");
8836
8836
  }
8837
8837
  return p;
8838
8838
  }
@@ -8841,9 +8841,9 @@ function li(e, t = ll) {
8841
8841
  u.set(f.masterFingerprint, 0);
8842
8842
  let d = 4;
8843
8843
  return p.slice(1).forEach((w) => {
8844
- const b = w.slice(-1) === "'";
8845
- let m = 2147483647 & parseInt(b ? w.slice(0, -1) : w, 10);
8846
- b && (m += 2147483648), ci(u, d, m, "LE"), d += 4;
8844
+ const y = w.slice(-1) === "'";
8845
+ let m = 2147483647 & parseInt(y ? w.slice(0, -1) : w, 10);
8846
+ y && (m += 2147483648), ci(u, d, m, "LE"), d += 4;
8847
8847
  }), {
8848
8848
  key: l,
8849
8849
  value: u
@@ -9076,7 +9076,7 @@ function gl(e, t) {
9076
9076
  }
9077
9077
  const u = l.filter((I) => I.key[0] === qt.UNSIGNED_TX);
9078
9078
  if (u.length !== 1) throw new Error("Format Error: Only one UNSIGNED_TX allowed");
9079
- const d = t(u[0].value), { inputCount: w, outputCount: b } = d.getInputOutputCounts(), m = [], v = [];
9079
+ const d = t(u[0].value), { inputCount: w, outputCount: y } = d.getInputOutputCounts(), m = [], v = [];
9080
9080
  for (const I of qr(w)) {
9081
9081
  const P = {}, S = [];
9082
9082
  for (; !f(); ) {
@@ -9086,7 +9086,7 @@ function gl(e, t) {
9086
9086
  }
9087
9087
  m.push(S);
9088
9088
  }
9089
- for (const I of qr(b)) {
9089
+ for (const I of qr(y)) {
9090
9090
  const P = {}, S = [];
9091
9091
  for (; !f(); ) {
9092
9092
  const _ = a(), O = G(_.key);
@@ -9219,7 +9219,7 @@ function yl({ globalMap: e, inputs: t, outputs: r }) {
9219
9219
  globalMap: e,
9220
9220
  inputs: t,
9221
9221
  outputs: r
9222
- }), a = ds(n), f = (d) => d.length === 0 ? [Uint8Array.from([0])] : d.map(ds), l = f(i), p = f(o), u = new Uint8Array(5);
9222
+ }), a = ds(n), f = (d) => d.length === 0 ? [Uint8Array.from([0])] : d.map(ds), l = f(i), p = f(o), u = /* @__PURE__ */ new Uint8Array(5);
9223
9223
  return u.set([
9224
9224
  112,
9225
9225
  115,
@@ -9335,10 +9335,12 @@ function wi(e) {
9335
9335
  }
9336
9336
  var vl = wi("global"), oa = wi("input"), aa = wi("output");
9337
9337
  function Il(e, t) {
9338
- oa(t, mt(e, e.length - 1));
9338
+ const r = mt(e, e.length - 1);
9339
+ oa(t, r);
9339
9340
  }
9340
9341
  function Al(e, t) {
9341
- aa(t, fr(e, e.length - 1));
9342
+ const r = fr(e, e.length - 1);
9343
+ aa(t, r);
9342
9344
  }
9343
9345
  var ys = class {
9344
9346
  constructor(e) {
@@ -9369,10 +9371,12 @@ var ys = class {
9369
9371
  return vl(e, this.globalMap), this;
9370
9372
  }
9371
9373
  updateInput(e, t) {
9372
- return oa(t, mt(this.inputs, e)), this;
9374
+ const r = mt(this.inputs, e);
9375
+ return oa(t, r), this;
9373
9376
  }
9374
9377
  updateOutput(e, t) {
9375
- return aa(t, fr(this.outputs, e)), this;
9378
+ const r = fr(this.outputs, e);
9379
+ return aa(t, r), this;
9376
9380
  }
9377
9381
  addUnknownKeyValToGlobal(e) {
9378
9382
  return Sn(e, this.globalMap.unknownKeyVals, Tn(qt)), this.globalMap.unknownKeyVals || (this.globalMap.unknownKeyVals = []), this.globalMap.unknownKeyVals.push(e), this;
@@ -9482,15 +9486,15 @@ function Es(e) {
9482
9486
  return o();
9483
9487
  }
9484
9488
  function Ul(e) {
9485
- let t = e & J.SIGHASH_ANYONECANPAY ? "SIGHASH_ANYONECANPAY | " : "";
9489
+ let t = e & tt.SIGHASH_ANYONECANPAY ? "SIGHASH_ANYONECANPAY | " : "";
9486
9490
  switch (e & 31) {
9487
- case J.SIGHASH_ALL:
9491
+ case tt.SIGHASH_ALL:
9488
9492
  t += "SIGHASH_ALL";
9489
9493
  break;
9490
- case J.SIGHASH_SINGLE:
9494
+ case tt.SIGHASH_SINGLE:
9491
9495
  t += "SIGHASH_SINGLE";
9492
9496
  break;
9493
- case J.SIGHASH_NONE:
9497
+ case tt.SIGHASH_NONE:
9494
9498
  t += "SIGHASH_NONE";
9495
9499
  break;
9496
9500
  }
@@ -9617,24 +9621,24 @@ var xl = class {
9617
9621
  }
9618
9622
  redeemFromFinalScriptSig(e) {
9619
9623
  if (!e) return;
9620
- const t = et(e);
9624
+ const t = rt(e);
9621
9625
  if (!t) return;
9622
9626
  const r = t[t.length - 1];
9623
- if (!(!(r instanceof Uint8Array) || vs(r) || Pl(r) || !et(r))) return r;
9627
+ if (!(!(r instanceof Uint8Array) || vs(r) || Pl(r) || !rt(r))) return r;
9624
9628
  }
9625
9629
  redeemFromFinalWitnessScript(e) {
9626
9630
  if (!e) return;
9627
9631
  const t = Es(e), r = t[t.length - 1];
9628
- if (!(!r || vs(r) || !et(r))) return r;
9632
+ if (!(!r || vs(r) || !rt(r))) return r;
9629
9633
  }
9630
9634
  finalizeAndComputeAmounts(e, t, r, n, i) {
9631
9635
  let o = 0n;
9632
9636
  e.forEach((d, w) => {
9633
- const b = t.ins[w];
9634
- if (r && d.finalScriptSig && (b.script = d.finalScriptSig), r && d.finalScriptWitness && (b.witness = Es(d.finalScriptWitness)), d.witnessUtxo) o += d.witnessUtxo.value;
9637
+ const y = t.ins[w];
9638
+ if (r && d.finalScriptSig && (y.script = d.finalScriptSig), r && d.finalScriptWitness && (y.witness = Es(d.finalScriptWitness)), d.witnessUtxo) o += d.witnessUtxo.value;
9635
9639
  else if (d.nonWitnessUtxo) {
9636
9640
  if (!i) throw new Error("txFromBuffer is required for nonWitnessUtxo inputs");
9637
- const m = this.getNonWitnessUtxoTx(d, w, i), v = b.index, I = m.outs[v];
9641
+ const m = this.getNonWitnessUtxoTx(d, w, i), v = y.index, I = m.outs[v];
9638
9642
  o += I.value;
9639
9643
  }
9640
9644
  });
@@ -9679,12 +9683,12 @@ var xl = class {
9679
9683
  };
9680
9684
  }
9681
9685
  getHashForSig(e, t, r, n) {
9682
- const i = this.#t.tx, o = t.sighashType || J.SIGHASH_ALL;
9686
+ const i = this.#t.tx, o = t.sighashType || tt.SIGHASH_ALL;
9683
9687
  Is(o, n);
9684
9688
  let a, f;
9685
9689
  if (t.nonWitnessUtxo) {
9686
- const d = this.#t.getNonWitnessUtxoTx(t, e, this.#a), w = i.ins[e], b = w.hash;
9687
- if (!x(b, d.getHash())) throw new Error(`Non-witness UTXO hash for input #${e} doesn't match the hash specified in the prevout`);
9690
+ const d = this.#t.getNonWitnessUtxoTx(t, e, this.#a), w = i.ins[e], y = w.hash;
9691
+ if (!x(y, d.getHash())) throw new Error(`Non-witness UTXO hash for input #${e} doesn't match the hash specified in the prevout`);
9688
9692
  const m = w.index;
9689
9693
  f = d.outs[m];
9690
9694
  } else if (t.witnessUtxo) f = {
@@ -9712,17 +9716,17 @@ PROCEED WITH CAUTION!
9712
9716
  };
9713
9717
  }
9714
9718
  getTaprootHashesForSig(e, t, r, n, i, o) {
9715
- const a = this.#t.tx, f = t.sighashType || J.SIGHASH_DEFAULT;
9719
+ const a = this.#t.tx, f = t.sighashType || tt.SIGHASH_DEFAULT;
9716
9720
  if (Is(f, o), !this.#t.prevOuts) {
9717
- const b = r.map((m, v) => this.#t.getScriptAndAmountFromUtxo(v, m, this.#a));
9718
- this.#t.prevOuts = b, this.#t.signingScripts = b.map((m) => m.script), this.#t.values = b.map((m) => m.value);
9721
+ const y = r.map((m, v) => this.#t.getScriptAndAmountFromUtxo(v, m, this.#a));
9722
+ this.#t.prevOuts = y, this.#t.signingScripts = y.map((m) => m.script), this.#t.values = y.map((m) => m.value);
9719
9723
  }
9720
9724
  const l = this.#t.signingScripts, p = this.#t.values;
9721
9725
  this.#t.taprootHashCache || (this.#t.taprootHashCache = a.getTaprootHashCache(l, p));
9722
9726
  const u = this.#t.taprootHashCache, d = [];
9723
9727
  if (t.tapInternalKey && !i) {
9724
- const b = this.#t.getPrevoutTaprootKey(e, t, this.#a) || new Uint8Array(0);
9725
- if (x(Ce(n), b)) {
9728
+ const y = this.#t.getPrevoutTaprootKey(e, t, this.#a) || /* @__PURE__ */ new Uint8Array(0);
9729
+ if (x(Ce(n), y)) {
9726
9730
  const m = a.hashForWitnessV1(e, l, p, f, void 0, void 0, u);
9727
9731
  d.push({
9728
9732
  pubkey: n,
@@ -9730,16 +9734,16 @@ PROCEED WITH CAUTION!
9730
9734
  });
9731
9735
  }
9732
9736
  }
9733
- const w = (t.tapLeafScript || []).filter((b) => Fr(n, b.script)).map((b) => {
9737
+ const w = (t.tapLeafScript || []).filter((y) => Fr(n, y.script)).map((y) => {
9734
9738
  const m = Pt({
9735
- output: b.script,
9736
- version: b.leafVersion
9739
+ output: y.script,
9740
+ version: y.leafVersion
9737
9741
  });
9738
- return Object.assign({ hash: m }, b);
9739
- }).filter((b) => !i || x(i, b.hash)).map((b) => ({
9742
+ return Object.assign({ hash: m }, y);
9743
+ }).filter((y) => !i || x(i, y.hash)).map((y) => ({
9740
9744
  pubkey: n,
9741
- hash: a.hashForWitnessV1(e, l, p, f, b.hash, void 0, u),
9742
- leafHash: b.hash
9745
+ hash: a.hashForWitnessV1(e, l, p, f, y.hash, void 0, u),
9746
+ leafHash: y.hash
9743
9747
  }));
9744
9748
  return d.concat(w);
9745
9749
  }
@@ -9901,7 +9905,7 @@ var Ll = new Uint8Array([
9901
9905
  ]), pa = class {
9902
9906
  tx;
9903
9907
  constructor(e = Ll) {
9904
- this.tx = J.fromBuffer(e), Sl(this.tx), Object.defineProperty(this, "tx", {
9908
+ this.tx = tt.fromBuffer(e), Sl(this.tx), Object.defineProperty(this, "tx", {
9905
9909
  enumerable: !1,
9906
9910
  writable: !0
9907
9911
  });
@@ -9929,7 +9933,7 @@ var Ll = new Uint8Array([
9929
9933
  maximumFeeRate: 5e3
9930
9934
  };
9931
9935
  function jt(e) {
9932
- return J.fromBuffer(e);
9936
+ return tt.fromBuffer(e);
9933
9937
  }
9934
9938
  function $l(e, t, r, n, i, o, a = !0, f) {
9935
9939
  return Rl(e, t, r, n, i, o, a, f);
@@ -9995,8 +9999,8 @@ var Zl = class Mn {
9995
9999
  return this.fromBuffer(n, r);
9996
10000
  }
9997
10001
  static fromBuffer(t, r = {}) {
9998
- const n = new Mn(r, ys.fromBuffer(t, Cl));
9999
- return Tl(n.#t.tx, n.#t), n.#t.hasSignatures = n.data.inputs.some((i) => i.partialSig?.length || i.tapKeySig || i.tapScriptSig?.length || i.finalScriptSig || i.finalScriptWitness), n;
10002
+ const n = ys.fromBuffer(t, Cl), i = new Mn(r, n);
10003
+ return Tl(i.#t.tx, i.#t), i.#t.hasSignatures = i.data.inputs.some((o) => o.partialSig?.length || o.tapKeySig || o.tapScriptSig?.length || o.finalScriptSig || o.finalScriptWitness), i;
10000
10004
  }
10001
10005
  combine(...t) {
10002
10006
  return this.data.combine(...t.map((r) => r.data)), this;
@@ -10015,7 +10019,7 @@ var Zl = class Mn {
10015
10019
  return Ur(t), Xe(this.data.inputs, "setVersion", this.#t.hasSignatures), this.#t.tx.version = t, this.#t.invalidate("outputs"), this;
10016
10020
  }
10017
10021
  setVersionTRUC() {
10018
- return this.setVersion(J.TRUC_VERSION);
10022
+ return this.setVersion(tt.TRUC_VERSION);
10019
10023
  }
10020
10024
  setLocktime(t) {
10021
10025
  return Ur(t), Xe(this.data.inputs, "setLocktime", this.#t.hasSignatures), this.#t.tx.locktime = t, this.#t.invalidate("outputs"), this;
@@ -10106,7 +10110,7 @@ var Zl = class Mn {
10106
10110
  const i = this.data.inputs[t];
10107
10111
  return Lt(i) ? this.#f(t, r, n) : this.#h(t, r, n);
10108
10112
  }
10109
- signAllInputsHD(t, r = [J.SIGHASH_ALL]) {
10113
+ signAllInputsHD(t, r = [tt.SIGHASH_ALL]) {
10110
10114
  if (!t || !t.publicKey || !t.fingerprint) throw new Error("Need HDSigner to sign input");
10111
10115
  const n = [];
10112
10116
  for (const i of Ze(this.data.inputs.length)) try {
@@ -10117,7 +10121,7 @@ var Zl = class Mn {
10117
10121
  if (n.every((i) => !i)) throw new Error("No inputs were signed");
10118
10122
  return this;
10119
10123
  }
10120
- async signAllInputsHDAsync(t, r = [J.SIGHASH_ALL]) {
10124
+ async signAllInputsHDAsync(t, r = [tt.SIGHASH_ALL]) {
10121
10125
  if (!t || !t.publicKey || !t.fingerprint) throw new Error("Need HDSigner to sign input");
10122
10126
  const n = [], i = [];
10123
10127
  for (const o of Ze(this.data.inputs.length)) i.push(this.signInputHDAsync(o, t, r).then(() => {
@@ -10127,11 +10131,11 @@ var Zl = class Mn {
10127
10131
  }));
10128
10132
  if (await Promise.all(i), n.every((o) => !o)) throw new Error("No inputs were signed");
10129
10133
  }
10130
- signInputHD(t, r, n = [J.SIGHASH_ALL]) {
10134
+ signInputHD(t, r, n = [tt.SIGHASH_ALL]) {
10131
10135
  if (!r || !r.publicKey || !r.fingerprint) throw new Error("Need HDSigner to sign input");
10132
10136
  return this.#r.getSignersFromHD(t, this.data.inputs, r).forEach((i) => this.signInput(t, i, n)), this;
10133
10137
  }
10134
- async signInputHDAsync(t, r, n = [J.SIGHASH_ALL]) {
10138
+ async signInputHDAsync(t, r, n = [tt.SIGHASH_ALL]) {
10135
10139
  if (!r || !r.publicKey || !r.fingerprint) throw new Error("Need HDSigner to sign input");
10136
10140
  const i = this.#r.getSignersFromHD(t, this.data.inputs, r).map((o) => this.signInputAsync(t, o, n));
10137
10141
  await Promise.all(i);
@@ -10257,11 +10261,11 @@ var Zl = class Mn {
10257
10261
  const f = [];
10258
10262
  let l, p, u;
10259
10263
  for (const d of a) {
10260
- const w = d.signature, b = d.pubkey, m = Ae.decode(w), { hash: v, script: I } = u !== m.hashType || !l || !p ? this.#r.getHashForSig(t, Object.assign({}, i, { sighashType: m.hashType }), !0) : {
10264
+ const w = d.signature, y = d.pubkey, m = Ae.decode(w), { hash: v, script: I } = u !== m.hashType || !l || !p ? this.#r.getHashForSig(t, Object.assign({}, i, { sighashType: m.hashType }), !0) : {
10261
10265
  hash: l,
10262
10266
  script: p
10263
10267
  };
10264
- u = m.hashType, l = v, p = I, ua(b, I, "verify"), f.push(r(b, v, m.signature));
10268
+ u = m.hashType, l = v, p = I, ua(y, I, "verify"), f.push(r(y, v, m.signature));
10265
10269
  }
10266
10270
  return f.every((d) => d);
10267
10271
  }
@@ -10278,22 +10282,22 @@ var Zl = class Mn {
10278
10282
  u++;
10279
10283
  }
10280
10284
  if (a) for (const d of a) {
10281
- const w = d.pubkey, b = l.find((m) => x(w, m.pubkey));
10282
- if (b) {
10283
- if (!r(w, b.hash, this.#r.trimTaprootSig(d.signature))) return !1;
10285
+ const w = d.pubkey, y = l.find((m) => x(w, m.pubkey));
10286
+ if (y) {
10287
+ if (!r(w, y.hash, this.#r.trimTaprootSig(d.signature))) return !1;
10284
10288
  u++;
10285
10289
  }
10286
10290
  }
10287
10291
  return u > 0;
10288
10292
  }
10289
- #u(t, r, n = [J.SIGHASH_ALL]) {
10293
+ #u(t, r, n = [tt.SIGHASH_ALL]) {
10290
10294
  const i = r.publicKey instanceof Uint8Array ? r.publicKey : new Uint8Array(r.publicKey), { hash: o, sighashType: a } = this.#r.getHashAndSighashType(this.data.inputs, t, i, n), f = r.sign(o), l = [{
10291
10295
  pubkey: i,
10292
10296
  signature: Ae.encode(f instanceof Uint8Array ? f : new Uint8Array(f), a)
10293
10297
  }];
10294
10298
  return this.data.updateInput(t, { partialSig: l }), this.#t.hasSignatures = !0, this;
10295
10299
  }
10296
- #c(t, r, n, i, o = [J.SIGHASH_DEFAULT]) {
10300
+ #c(t, r, n, i, o = [tt.SIGHASH_DEFAULT]) {
10297
10301
  const a = n.publicKey instanceof Uint8Array ? n.publicKey : new Uint8Array(n.publicKey);
10298
10302
  if (!("signSchnorr" in n) || typeof n.signSchnorr != "function") throw new Error(`Need Schnorr Signer to sign taproot input #${t}.`);
10299
10303
  const f = this.checkTaprootHashesForSig(t, r, n, i, o), l = n.signSchnorr.bind(n), p = f.filter((d) => !d.leafHash).map((d) => Le(l(d.hash), r.sighashType))[0], u = f.filter((d) => !!d.leafHash).map((d) => ({
@@ -10303,14 +10307,14 @@ var Zl = class Mn {
10303
10307
  }));
10304
10308
  return p && (this.data.updateInput(t, { tapKeySig: p }), this.#t.hasSignatures = !0), u.length && (this.data.updateInput(t, { tapScriptSig: u }), this.#t.hasSignatures = !0), this;
10305
10309
  }
10306
- async #p(t, r, n = [J.SIGHASH_ALL]) {
10310
+ async #p(t, r, n = [tt.SIGHASH_ALL]) {
10307
10311
  const i = r.publicKey instanceof Uint8Array ? r.publicKey : new Uint8Array(r.publicKey), { hash: o, sighashType: a } = this.#r.getHashAndSighashType(this.data.inputs, t, i, n), f = await r.sign(o), l = f instanceof Uint8Array ? f : new Uint8Array(f), p = [{
10308
10312
  pubkey: i,
10309
10313
  signature: Ae.encode(l, a)
10310
10314
  }];
10311
10315
  this.data.updateInput(t, { partialSig: p }), this.#t.hasSignatures = !0;
10312
10316
  }
10313
- async #l(t, r, n, i, o = [J.SIGHASH_DEFAULT]) {
10317
+ async #l(t, r, n, i, o = [tt.SIGHASH_DEFAULT]) {
10314
10318
  const a = n.publicKey instanceof Uint8Array ? n.publicKey : new Uint8Array(n.publicKey);
10315
10319
  if (!("signSchnorr" in n) || typeof n.signSchnorr != "function") throw new Error(`Need Schnorr Signer to sign taproot input #${t}.`);
10316
10320
  const f = this.checkTaprootHashesForSig(t, r, n, i, o), l = n.signSchnorr.bind(n), p = f.find((d) => !d.leafHash);
@@ -10321,10 +10325,10 @@ var Zl = class Mn {
10321
10325
  const u = f.filter((d) => !!d.leafHash);
10322
10326
  if (u.length) {
10323
10327
  const d = await Promise.all(u.map(async (w) => {
10324
- const b = await l(w.hash);
10328
+ const y = await l(w.hash);
10325
10329
  return {
10326
10330
  pubkey: Ce(a),
10327
- signature: Le(b, r.sighashType),
10331
+ signature: Le(y, r.sighashType),
10328
10332
  leafHash: w.leafHash
10329
10333
  };
10330
10334
  }));
@@ -10366,7 +10370,7 @@ export {
10366
10370
  Kl as g,
10367
10371
  zl as h,
10368
10372
  Uf as i,
10369
- J as j,
10373
+ tt as j,
10370
10374
  Mt as k,
10371
10375
  Yu as l,
10372
10376
  De as m,