@prosopo/procaptcha-bundle 3.0.9 → 3.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/bundle/ProcaptchaWidget-48FxVPQd.js +187 -0
  3. package/dist/bundle/ProcaptchaWidget-B2BzhXLv.js +992 -0
  4. package/dist/bundle/builder-DNHtDoNG.js +44 -0
  5. package/dist/bundle/{captchaComponentProvider-CZppE3Vb.js → captchaComponentProvider-B7Vxx339.js} +256 -99
  6. package/dist/bundle/{captchaRenderer-CY8KuZK-.js → captchaRenderer-DdOlOCKw.js} +3 -3
  7. package/dist/bundle/{commonChunk-24zMb_mF.js → commonChunk-HCVkoCqn.js} +9 -12
  8. package/dist/bundle/{emotion-element-5486c51c.browser.esm-PRDDgd_k.js → emotion-element-5486c51c.browser.esm-D7qvHZDV.js} +1 -1
  9. package/dist/bundle/{fp.esm-BADUiinQ.js → fp.esm-DYWeNGcH.js} +648 -548
  10. package/dist/bundle/index-7Xh-Mf8v.js +1318 -0
  11. package/dist/bundle/{index-BiwZ4wVT.js → index-C00_J7av.js} +48 -12
  12. package/dist/bundle/{index-BzOMq-ud.js → index-DyYmvHVN.js} +1 -1
  13. package/dist/bundle/locales/ar/translation.json +12 -11
  14. package/dist/bundle/locales/az/translation.json +12 -11
  15. package/dist/bundle/locales/cs/translation.json +12 -11
  16. package/dist/bundle/locales/de/translation.json +12 -11
  17. package/dist/bundle/locales/el/translation.json +12 -11
  18. package/dist/bundle/locales/en/translation.json +4 -3
  19. package/dist/bundle/locales/es/translation.json +12 -11
  20. package/dist/bundle/locales/fi/translation.json +29 -28
  21. package/dist/bundle/locales/fr/translation.json +12 -11
  22. package/dist/bundle/locales/hi/translation.json +41 -40
  23. package/dist/bundle/locales/hu/translation.json +12 -11
  24. package/dist/bundle/locales/id/translation.json +12 -11
  25. package/dist/bundle/locales/it/translation.json +12 -11
  26. package/dist/bundle/locales/ja/translation.json +12 -11
  27. package/dist/bundle/locales/jv/translation.json +12 -11
  28. package/dist/bundle/locales/ko/translation.json +7 -6
  29. package/dist/bundle/locales/ml/translation.json +12 -11
  30. package/dist/bundle/locales/ms/translation.json +12 -11
  31. package/dist/bundle/locales/nl/translation.json +12 -11
  32. package/dist/bundle/locales/no/translation.json +12 -11
  33. package/dist/bundle/locales/pl/translation.json +12 -11
  34. package/dist/bundle/locales/pt/translation.json +12 -11
  35. package/dist/bundle/locales/pt-BR/translation.json +12 -11
  36. package/dist/bundle/locales/ro/translation.json +12 -11
  37. package/dist/bundle/locales/ru/translation.json +12 -11
  38. package/dist/bundle/locales/sr/translation.json +12 -11
  39. package/dist/bundle/locales/sv/translation.json +12 -11
  40. package/dist/bundle/locales/th/translation.json +12 -11
  41. package/dist/bundle/locales/tr/translation.json +7 -6
  42. package/dist/bundle/locales/uk/translation.json +12 -11
  43. package/dist/bundle/locales/vi/translation.json +12 -11
  44. package/dist/bundle/locales/zh-CN/translation.json +12 -11
  45. package/dist/bundle/nobleChunk-Qozzkbsq.js +3648 -0
  46. package/dist/bundle/procaptcha.bundle.js +2 -2
  47. package/dist/bundle/{utilCryptoChunk-CIPUtfoO.js → utilCryptoChunk-qm-BM2eT.js} +618 -647
  48. package/dist/bundle/{web2Chunk-7Vd8yt2r.js → web2Chunk-DCsWA5PR.js} +1150 -994
  49. package/dist/bundle/{web3Chunk-DrUvbVNW.js → web3Chunk-B8txCqUJ.js} +3 -3
  50. package/dist/index.js +142 -108
  51. package/dist/util/captcha/captchaComponentProvider.js +18 -10
  52. package/dist/util/captcha/captchaComponentsList.js +6 -5
  53. package/dist/util/captcha/captchaRenderer.js +58 -40
  54. package/dist/util/captcha/captchaType.js +9 -5
  55. package/dist/util/captcha/components/frictionlessCaptcha.js +19 -9
  56. package/dist/util/captcha/components/imageCaptcha.js +13 -5
  57. package/dist/util/captcha/components/powCaptcha.js +13 -5
  58. package/dist/util/config.js +15 -12
  59. package/dist/util/configCreator.js +21 -22
  60. package/dist/util/language.js +14 -13
  61. package/dist/util/timeout.js +13 -8
  62. package/dist/util/widgetFactory.js +77 -55
  63. package/dist/util/widgetThemeResolver.js +14 -17
  64. package/package.json +23 -20
  65. package/stats.html +1 -1
  66. package/vite.cjs.config.ts +2 -3
  67. package/vite.esm.config.ts +20 -0
  68. package/vite.test.config.ts +9 -5
  69. package/dist/bundle/ProcaptchaWidget-D_kzGjgO.js +0 -612
  70. package/dist/bundle/ProcaptchaWidget-DlrcrISF.js +0 -148
  71. package/dist/bundle/builder-CQlqPNRd.js +0 -37
  72. package/dist/bundle/index-BRg_gWPo.js +0 -1328
  73. package/dist/bundle/nobleChunk-Xl5XLrx3.js +0 -3635
  74. package/dist/components.d.ts +0 -5
  75. package/dist/components.d.ts.map +0 -1
  76. package/dist/components.js +0 -5
  77. package/dist/components.js.map +0 -1
  78. package/dist/index.d.ts +0 -16
  79. package/dist/index.d.ts.map +0 -1
  80. package/dist/index.js.map +0 -1
  81. package/dist/tests/util/captchaType.test.d.ts +0 -2
  82. package/dist/tests/util/captchaType.test.d.ts.map +0 -1
  83. package/dist/tests/util/captchaType.test.js +0 -36
  84. package/dist/tests/util/captchaType.test.js.map +0 -1
  85. package/dist/tests/util/config.test.d.ts +0 -2
  86. package/dist/tests/util/config.test.d.ts.map +0 -1
  87. package/dist/tests/util/config.test.js +0 -69
  88. package/dist/tests/util/config.test.js.map +0 -1
  89. package/dist/tests/util/renderLogic.test.d.ts +0 -2
  90. package/dist/tests/util/renderLogic.test.d.ts.map +0 -1
  91. package/dist/tests/util/renderLogic.test.js +0 -126
  92. package/dist/tests/util/renderLogic.test.js.map +0 -1
  93. package/dist/util/captcha/captchaComponentProvider.d.ts +0 -8
  94. package/dist/util/captcha/captchaComponentProvider.d.ts.map +0 -1
  95. package/dist/util/captcha/captchaComponentProvider.js.map +0 -1
  96. package/dist/util/captcha/captchaComponentsList.d.ts +0 -6
  97. package/dist/util/captcha/captchaComponentsList.d.ts.map +0 -1
  98. package/dist/util/captcha/captchaComponentsList.js.map +0 -1
  99. package/dist/util/captcha/captchaProps.d.ts +0 -9
  100. package/dist/util/captcha/captchaProps.d.ts.map +0 -1
  101. package/dist/util/captcha/captchaProps.js +0 -2
  102. package/dist/util/captcha/captchaProps.js.map +0 -1
  103. package/dist/util/captcha/captchaRenderer.d.ts +0 -24
  104. package/dist/util/captcha/captchaRenderer.d.ts.map +0 -1
  105. package/dist/util/captcha/captchaRenderer.js.map +0 -1
  106. package/dist/util/captcha/captchaType.d.ts +0 -3
  107. package/dist/util/captcha/captchaType.d.ts.map +0 -1
  108. package/dist/util/captcha/captchaType.js.map +0 -1
  109. package/dist/util/captcha/components/frictionlessCaptcha.d.ts +0 -4
  110. package/dist/util/captcha/components/frictionlessCaptcha.d.ts.map +0 -1
  111. package/dist/util/captcha/components/frictionlessCaptcha.js.map +0 -1
  112. package/dist/util/captcha/components/imageCaptcha.d.ts +0 -4
  113. package/dist/util/captcha/components/imageCaptcha.d.ts.map +0 -1
  114. package/dist/util/captcha/components/imageCaptcha.js.map +0 -1
  115. package/dist/util/captcha/components/powCaptcha.d.ts +0 -4
  116. package/dist/util/captcha/components/powCaptcha.d.ts.map +0 -1
  117. package/dist/util/captcha/components/powCaptcha.js.map +0 -1
  118. package/dist/util/config.d.ts +0 -6
  119. package/dist/util/config.d.ts.map +0 -1
  120. package/dist/util/config.js.map +0 -1
  121. package/dist/util/configCreator.d.ts +0 -5
  122. package/dist/util/configCreator.d.ts.map +0 -1
  123. package/dist/util/configCreator.js.map +0 -1
  124. package/dist/util/language.d.ts +0 -3
  125. package/dist/util/language.d.ts.map +0 -1
  126. package/dist/util/language.js.map +0 -1
  127. package/dist/util/timeout.d.ts +0 -3
  128. package/dist/util/timeout.d.ts.map +0 -1
  129. package/dist/util/timeout.js.map +0 -1
  130. package/dist/util/widgetFactory.d.ts +0 -18
  131. package/dist/util/widgetFactory.d.ts.map +0 -1
  132. package/dist/util/widgetFactory.js.map +0 -1
  133. package/dist/util/widgetThemeResolver.d.ts +0 -9
  134. package/dist/util/widgetThemeResolver.d.ts.map +0 -1
  135. package/dist/util/widgetThemeResolver.js.map +0 -1
@@ -1,19 +1,24 @@
1
- import { u as h, a as hr, b as D, s as q, i as $e, c as De, x as fr, o as pr, d as Y, e as z, f as gr, g as yr, h as mr, j as wr, k as br, l as vr, m as kr, n as ye, p as Er, q as xr } from "./utilChunk-sqstc6C5.js";
2
- import { b as me, s as Ar, r as x, a as Ur, n as m, c as I, R as g, u as ie, i as Ie, d as A, e as Ne, m as Sr, f as Br, g as _r, k as Rr, h as $r, p as Dr, j as Ir, l as Nr, o as Pr } from "./nobleChunk-Xl5XLrx3.js";
3
- import { B as Tr } from "./bnChunk-DRlDxTFg.js";
4
- function ce(r) {
1
+ var Ee = (r) => {
2
+ throw TypeError(r);
3
+ };
4
+ var xe = (r, e, t) => e.has(r) || Ee("Cannot " + t);
5
+ var k = (r, e, t) => (xe(r, e, "read from private field"), t ? t.call(r) : e.get(r)), W = (r, e, t) => e.has(r) ? Ee("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), J = (r, e, t, n) => (xe(r, e, "write to private field"), n ? n.call(r, t) : e.set(r, t), t);
6
+ import { b as Ae, s as jr, r as U, a as Tr, n as y, c as D, R as g, u as he, i as Te, d as S, e as _e, m as _r, f as zr, g as Cr, k as Lr, h as Hr, p as Or, j as Fr, l as Mr, o as qr } from "./nobleChunk-Qozzkbsq.js";
7
+ import { u as h, a as Vr, b as I, s as V, i as ze, c as Ce, x as Kr, o as Yr, d as Z, e as C, f as Wr, g as Jr, h as Zr, j as Gr, k as Xr, l as Qr, m as et, n as Ue, p as rt, q as tt } from "./utilChunk-sqstc6C5.js";
8
+ import { B as nt } from "./bnChunk-DRlDxTFg.js";
9
+ function fe(r) {
5
10
  return r instanceof Uint8Array || ArrayBuffer.isView(r) && r.constructor.name === "Uint8Array";
6
11
  }
7
- function jr(r, ...e) {
8
- if (!ce(r))
12
+ function ot(r, ...e) {
13
+ if (!fe(r))
9
14
  throw new Error("Uint8Array expected");
10
15
  if (e.length > 0 && !e.includes(r.length))
11
16
  throw new Error("Uint8Array expected of length " + e + ", got length=" + r.length);
12
17
  }
13
- function Pe(r, e) {
18
+ function Le(r, e) {
14
19
  return Array.isArray(e) ? e.length === 0 ? !0 : r ? e.every((t) => typeof t == "string") : e.every((t) => Number.isSafeInteger(t)) : !1;
15
20
  }
16
- function N(r, e) {
21
+ function P(r, e) {
17
22
  if (typeof e != "string")
18
23
  throw new Error(`${r}: string expected`);
19
24
  return !0;
@@ -22,60 +27,60 @@ function T(r) {
22
27
  if (!Number.isSafeInteger(r))
23
28
  throw new Error(`invalid integer: ${r}`);
24
29
  }
25
- function L(r) {
30
+ function O(r) {
26
31
  if (!Array.isArray(r))
27
32
  throw new Error("array expected");
28
33
  }
29
- function H(r, e) {
30
- if (!Pe(!0, e))
34
+ function F(r, e) {
35
+ if (!Le(!0, e))
31
36
  throw new Error(`${r}: array of strings expected`);
32
37
  }
33
- function Te(r, e) {
34
- if (!Pe(!1, e))
38
+ function He(r, e) {
39
+ if (!Le(!1, e))
35
40
  throw new Error(`${r}: array of numbers expected`);
36
41
  }
37
42
  // @__NO_SIDE_EFFECTS__
38
- function je(...r) {
39
- const e = (a) => a, t = (a, s) => (i) => a(s(i)), n = r.map((a) => a.encode).reduceRight(t, e), o = r.map((a) => a.decode).reduce(t, e);
43
+ function Oe(...r) {
44
+ const e = (s) => s, t = (s, i) => (a) => s(i(a)), n = r.map((s) => s.encode).reduceRight(t, e), o = r.map((s) => s.decode).reduce(t, e);
40
45
  return { encode: n, decode: o };
41
46
  }
42
47
  // @__NO_SIDE_EFFECTS__
43
- function ze(r) {
48
+ function Fe(r) {
44
49
  const e = typeof r == "string" ? r.split("") : r, t = e.length;
45
- H("alphabet", e);
46
- const n = new Map(e.map((o, a) => [o, a]));
50
+ F("alphabet", e);
51
+ const n = new Map(e.map((o, s) => [o, s]));
47
52
  return {
48
- encode: (o) => (L(o), o.map((a) => {
49
- if (!Number.isSafeInteger(a) || a < 0 || a >= t)
50
- throw new Error(`alphabet.encode: digit index outside alphabet "${a}". Allowed: ${r}`);
51
- return e[a];
53
+ encode: (o) => (O(o), o.map((s) => {
54
+ if (!Number.isSafeInteger(s) || s < 0 || s >= t)
55
+ throw new Error(`alphabet.encode: digit index outside alphabet "${s}". Allowed: ${r}`);
56
+ return e[s];
52
57
  })),
53
- decode: (o) => (L(o), o.map((a) => {
54
- N("alphabet.decode", a);
55
- const s = n.get(a);
56
- if (s === void 0)
57
- throw new Error(`Unknown letter: "${a}". Allowed: ${r}`);
58
- return s;
58
+ decode: (o) => (O(o), o.map((s) => {
59
+ P("alphabet.decode", s);
60
+ const i = n.get(s);
61
+ if (i === void 0)
62
+ throw new Error(`Unknown letter: "${s}". Allowed: ${r}`);
63
+ return i;
59
64
  }))
60
65
  };
61
66
  }
62
67
  // @__NO_SIDE_EFFECTS__
63
- function Ce(r = "") {
64
- return N("join", r), {
65
- encode: (e) => (H("join.decode", e), e.join(r)),
66
- decode: (e) => (N("join.decode", e), e.split(r))
68
+ function Me(r = "") {
69
+ return P("join", r), {
70
+ encode: (e) => (F("join.decode", e), e.join(r)),
71
+ decode: (e) => (P("join.decode", e), e.split(r))
67
72
  };
68
73
  }
69
74
  // @__NO_SIDE_EFFECTS__
70
- function zr(r, e = "=") {
71
- return T(r), N("padding", e), {
75
+ function st(r, e = "=") {
76
+ return T(r), P("padding", e), {
72
77
  encode(t) {
73
- for (H("padding.encode", t); t.length * r % 8; )
78
+ for (F("padding.encode", t); t.length * r % 8; )
74
79
  t.push(e);
75
80
  return t;
76
81
  },
77
82
  decode(t) {
78
- H("padding.decode", t);
83
+ F("padding.decode", t);
79
84
  let n = t.length;
80
85
  if (n * r % 8)
81
86
  throw new Error("padding: invalid, string should have whole number of bytes");
@@ -86,258 +91,277 @@ function zr(r, e = "=") {
86
91
  }
87
92
  };
88
93
  }
89
- function we(r, e, t) {
94
+ function Se(r, e, t) {
90
95
  if (e < 2)
91
96
  throw new Error(`convertRadix: invalid from=${e}, base cannot be less than 2`);
92
97
  if (t < 2)
93
98
  throw new Error(`convertRadix: invalid to=${t}, base cannot be less than 2`);
94
- if (L(r), !r.length)
99
+ if (O(r), !r.length)
95
100
  return [];
96
101
  let n = 0;
97
- const o = [], a = Array.from(r, (i) => {
98
- if (T(i), i < 0 || i >= e)
99
- throw new Error(`invalid integer: ${i}`);
100
- return i;
101
- }), s = a.length;
102
+ const o = [], s = Array.from(r, (a) => {
103
+ if (T(a), a < 0 || a >= e)
104
+ throw new Error(`invalid integer: ${a}`);
105
+ return a;
106
+ }), i = s.length;
102
107
  for (; ; ) {
103
- let i = 0, l = !0;
104
- for (let c = n; c < s; c++) {
105
- const u = a[c], d = e * i, p = d + u;
106
- if (!Number.isSafeInteger(p) || d / e !== i || p - u !== d)
108
+ let a = 0, l = !0;
109
+ for (let c = n; c < i; c++) {
110
+ const u = s[c], d = e * a, p = d + u;
111
+ if (!Number.isSafeInteger(p) || d / e !== a || p - u !== d)
107
112
  throw new Error("convertRadix: carry overflow");
108
113
  const b = p / t;
109
- i = p % t;
114
+ a = p % t;
110
115
  const w = Math.floor(b);
111
- if (a[c] = w, !Number.isSafeInteger(w) || w * t + i !== p)
116
+ if (s[c] = w, !Number.isSafeInteger(w) || w * t + a !== p)
112
117
  throw new Error("convertRadix: carry overflow");
113
118
  if (l)
114
119
  w ? l = !1 : n = c;
115
120
  else continue;
116
121
  }
117
- if (o.push(i), l)
122
+ if (o.push(a), l)
118
123
  break;
119
124
  }
120
- for (let i = 0; i < r.length - 1 && r[i] === 0; i++)
125
+ for (let a = 0; a < r.length - 1 && r[a] === 0; a++)
121
126
  o.push(0);
122
127
  return o.reverse();
123
128
  }
124
- const Oe = (r, e) => e === 0 ? r : Oe(e, r % e), F = /* @__NO_SIDE_EFFECTS__ */ (r, e) => r + (e - Oe(r, e)), W = /* @__PURE__ */ (() => {
129
+ const qe = (r, e) => e === 0 ? r : qe(e, r % e), M = /* @__NO_SIDE_EFFECTS__ */ (r, e) => r + (e - qe(r, e)), G = /* @__PURE__ */ (() => {
125
130
  let r = [];
126
131
  for (let e = 0; e < 40; e++)
127
132
  r.push(2 ** e);
128
133
  return r;
129
134
  })();
130
- function be(r, e, t, n) {
131
- if (L(r), e <= 0 || e > 32)
135
+ function Be(r, e, t, n) {
136
+ if (O(r), e <= 0 || e > 32)
132
137
  throw new Error(`convertRadix2: wrong from=${e}`);
133
138
  if (t <= 0 || t > 32)
134
139
  throw new Error(`convertRadix2: wrong to=${t}`);
135
- if (/* @__PURE__ */ F(e, t) > 32)
136
- throw new Error(`convertRadix2: carry overflow from=${e} to=${t} carryBits=${/* @__PURE__ */ F(e, t)}`);
137
- let o = 0, a = 0;
138
- const s = W[e], i = W[t] - 1, l = [];
140
+ if (/* @__PURE__ */ M(e, t) > 32)
141
+ throw new Error(`convertRadix2: carry overflow from=${e} to=${t} carryBits=${/* @__PURE__ */ M(e, t)}`);
142
+ let o = 0, s = 0;
143
+ const i = G[e], a = G[t] - 1, l = [];
139
144
  for (const c of r) {
140
- if (T(c), c >= s)
145
+ if (T(c), c >= i)
141
146
  throw new Error(`convertRadix2: invalid data word=${c} from=${e}`);
142
- if (o = o << e | c, a + e > 32)
143
- throw new Error(`convertRadix2: carry overflow pos=${a} from=${e}`);
144
- for (a += e; a >= t; a -= t)
145
- l.push((o >> a - t & i) >>> 0);
146
- const u = W[a];
147
+ if (o = o << e | c, s + e > 32)
148
+ throw new Error(`convertRadix2: carry overflow pos=${s} from=${e}`);
149
+ for (s += e; s >= t; s -= t)
150
+ l.push((o >> s - t & a) >>> 0);
151
+ const u = G[s];
147
152
  if (u === void 0)
148
153
  throw new Error("invalid carry");
149
154
  o &= u - 1;
150
155
  }
151
- if (o = o << t - a & i, !n && a >= e)
156
+ if (o = o << t - s & a, !n && s >= e)
152
157
  throw new Error("Excess padding");
153
158
  if (!n && o > 0)
154
159
  throw new Error(`Non-zero padding: ${o}`);
155
- return n && a > 0 && l.push(o >>> 0), l;
160
+ return n && s > 0 && l.push(o >>> 0), l;
156
161
  }
157
162
  // @__NO_SIDE_EFFECTS__
158
- function Cr(r) {
163
+ function at(r) {
159
164
  T(r);
160
165
  const e = 2 ** 8;
161
166
  return {
162
167
  encode: (t) => {
163
- if (!ce(t))
168
+ if (!fe(t))
164
169
  throw new Error("radix.encode input should be Uint8Array");
165
- return we(Array.from(t), e, r);
170
+ return Se(Array.from(t), e, r);
166
171
  },
167
- decode: (t) => (Te("radix.decode", t), Uint8Array.from(we(t, r, e)))
172
+ decode: (t) => (He("radix.decode", t), Uint8Array.from(Se(t, r, e)))
168
173
  };
169
174
  }
170
175
  // @__NO_SIDE_EFFECTS__
171
- function Or(r, e = !1) {
176
+ function it(r, e = !1) {
172
177
  if (T(r), r <= 0 || r > 32)
173
178
  throw new Error("radix2: bits should be in (0..32]");
174
- if (/* @__PURE__ */ F(8, r) > 32 || /* @__PURE__ */ F(r, 8) > 32)
179
+ if (/* @__PURE__ */ M(8, r) > 32 || /* @__PURE__ */ M(r, 8) > 32)
175
180
  throw new Error("radix2: carry overflow");
176
181
  return {
177
182
  encode: (t) => {
178
- if (!ce(t))
183
+ if (!fe(t))
179
184
  throw new Error("radix2.encode input should be Uint8Array");
180
- return be(Array.from(t), 8, r, !e);
185
+ return Be(Array.from(t), 8, r, !e);
181
186
  },
182
- decode: (t) => (Te("radix2.decode", t), Uint8Array.from(be(t, r, 8, e)))
187
+ decode: (t) => (He("radix2.decode", t), Uint8Array.from(Be(t, r, 8, e)))
183
188
  };
184
189
  }
185
- const Lr = typeof Uint8Array.from([]).toBase64 == "function" && typeof Uint8Array.fromBase64 == "function", Hr = (r, e) => {
186
- N("base64", r);
190
+ const ct = typeof Uint8Array.from([]).toBase64 == "function" && typeof Uint8Array.fromBase64 == "function", lt = (r, e) => {
191
+ P("base64", r);
187
192
  const t = /^[A-Za-z0-9=+/]+$/, n = "base64";
188
193
  if (r.length > 0 && !t.test(r))
189
194
  throw new Error("invalid base64");
190
195
  return Uint8Array.fromBase64(r, { alphabet: n, lastChunkHandling: "strict" });
191
- }, Fr = Lr ? {
196
+ }, ut = ct ? {
192
197
  encode(r) {
193
- return jr(r), r.toBase64();
198
+ return ot(r), r.toBase64();
194
199
  },
195
200
  decode(r) {
196
- return Hr(r);
201
+ return lt(r);
197
202
  }
198
- } : /* @__PURE__ */ je(/* @__PURE__ */ Or(6), /* @__PURE__ */ ze("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ zr(6), /* @__PURE__ */ Ce("")), Mr = /* @__NO_SIDE_EFFECTS__ */ (r) => /* @__PURE__ */ je(/* @__PURE__ */ Cr(58), /* @__PURE__ */ ze(r), /* @__PURE__ */ Ce("")), qr = /* @__PURE__ */ Mr("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
199
- function Le({ coder: r, ipfs: e }, t) {
203
+ } : /* @__PURE__ */ Oe(/* @__PURE__ */ it(6), /* @__PURE__ */ Fe("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ st(6), /* @__PURE__ */ Me("")), dt = /* @__NO_SIDE_EFFECTS__ */ (r) => /* @__PURE__ */ Oe(/* @__PURE__ */ at(58), /* @__PURE__ */ Fe(r), /* @__PURE__ */ Me("")), ht = /* @__PURE__ */ dt("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
204
+ function Ve({ coder: r, ipfs: e }, t) {
200
205
  return (n, o) => (t(n, o), r.decode(e && o ? n.substring(1) : n));
201
206
  }
202
- function He({ coder: r, ipfs: e }) {
207
+ function Ke({ coder: r, ipfs: e }) {
203
208
  return (t, n) => {
204
209
  const o = r.encode(h(t));
205
210
  return e && n ? `${e}${o}` : o;
206
211
  };
207
212
  }
208
- function Fe({ chars: r, ipfs: e, type: t, withPadding: n }) {
209
- return (o, a) => {
213
+ function Ye({
214
+ chars: r,
215
+ ipfs: e,
216
+ type: t,
217
+ withPadding: n
218
+ }) {
219
+ return (o, s) => {
210
220
  if (typeof o != "string")
211
221
  throw new Error(`Expected ${t} string input`);
212
- if (e && a && !o.startsWith(e))
213
- throw new Error(`Expected ipfs-compatible ${t} to start with '${e}'`);
214
- for (let s = a ? 1 : 0, i = o.length; s < i; s++) {
215
- const l = o[s];
222
+ if (e && s && !o.startsWith(e))
223
+ throw new Error(
224
+ `Expected ipfs-compatible ${t} to start with '${e}'`
225
+ );
226
+ for (let i = s ? 1 : 0, a = o.length; i < a; i++) {
227
+ const l = o[i];
216
228
  if (l === void 0)
217
- throw new Error(`Invalid undefined value at index ${s}`);
218
- if (!r.includes(l)) if (n && o[s] === "=") {
219
- if (s !== i - 1) {
220
- if (o[s + 1] !== "=") throw new Error(`Invalid ${t} padding sequence "${o[s]}${o[s + 1]}" at index ${s}`);
229
+ throw new Error(`Invalid undefined value at index ${i}`);
230
+ if (!r.includes(l)) if (n && o[i] === "=") {
231
+ if (i !== a - 1) {
232
+ if (o[i + 1] !== "=") throw new Error(
233
+ `Invalid ${t} padding sequence "${o[i]}${o[i + 1]}" at index ${i}`
234
+ );
221
235
  }
222
236
  } else
223
- throw new Error(`Invalid ${t} character "${o[s]}" (0x${o.charCodeAt(s).toString(16)}) at index ${s}`);
237
+ throw new Error(
238
+ `Invalid ${t} character "${o[i]}" (0x${o.charCodeAt(i).toString(16)}) at index ${i}`
239
+ );
224
240
  }
225
241
  return !0;
226
242
  };
227
243
  }
228
- const le = {
244
+ const pe = {
229
245
  chars: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
230
- coder: qr,
246
+ coder: ht,
231
247
  ipfs: "z",
232
248
  type: "base58"
233
- }, Vr = Fe(le), Kr = Le(le, Vr), Yr = He(le);
234
- function Me(r) {
235
- return (...e) => hr(r(...e));
249
+ }, We = /* @__PURE__ */ Ye(pe), Je = /* @__PURE__ */ Ve(pe, We), Ze = /* @__PURE__ */ Ke(pe);
250
+ function Ge(r) {
251
+ return (...e) => Vr(r(...e));
236
252
  }
237
- function ue(r, e = 256, t, n) {
238
- const o = Math.ceil(e / 8), a = h(r);
239
- return t ? me(a, { dkLen: o, key: t }) : me(a, { dkLen: o });
253
+ function K(r, e = 256, t, n) {
254
+ const o = Math.ceil(e / 8), s = h(r);
255
+ return t ? Ae(s, { dkLen: o, key: t }) : Ae(s, { dkLen: o });
240
256
  }
241
- const Wt = Me(ue), Wr = q("SS58PRE");
242
- function qe(r) {
243
- return ue(D(Wr, r), 512);
257
+ const ft = /* @__PURE__ */ Ge(K), pt = V("SS58PRE");
258
+ function Xe(r) {
259
+ return K(I(pt, r), 512);
244
260
  }
245
- function Jr(r) {
261
+ function gt(r) {
246
262
  if (r[0] === void 0)
247
263
  throw new Error("Invalid address: first byte cannot be undefined");
248
264
  if (r[1] === void 0)
249
265
  throw new Error("Invalid address: second byte cannot be undefined");
250
- const e = r[0] & 64 ? 2 : 1, t = e === 1 ? r[0] : (r[0] & 63) << 2 | r[1] >> 6 | (r[1] & 63) << 8, n = [34 + e, 35 + e].includes(r.length), o = r.length - (n ? 2 : 1), a = qe(r.subarray(0, o));
251
- return [(r[0] & 128) === 0 && ![46, 47].includes(r[0]) && (n ? r[r.length - 2] === a[0] && r[r.length - 1] === a[1] : r[r.length - 1] === a[0]), o, e, t];
266
+ const e = r[0] & 64 ? 2 : 1, t = e === 1 ? r[0] : (r[0] & 63) << 2 | r[1] >> 6 | (r[1] & 63) << 8, n = [34 + e, 35 + e].includes(
267
+ r.length
268
+ ), o = r.length - (n ? 2 : 1), s = Xe(r.subarray(0, o));
269
+ return [(r[0] & 128) === 0 && ![46, 47].includes(r[0]) && (n ? r[r.length - 2] === s[0] && r[r.length - 1] === s[1] : r[r.length - 1] === s[0]), o, e, t];
252
270
  }
253
- const C = {
271
+ const L = {
254
272
  allowedDecodedLengths: [1, 2, 4, 8, 32, 33],
273
+ // publicKey has prefix + 2 checksum bytes, short only prefix + 1 checksum byte
255
274
  allowedEncodedLengths: [3, 4, 6, 10, 35, 36, 37, 38],
256
275
  prefix: 42
257
276
  };
258
- function Ve(r, e, t = -1) {
277
+ function ge(r, e, t = -1) {
259
278
  if (!r)
260
279
  throw new Error("Invalid empty address passed");
261
- if ($e(r) || De(r))
280
+ if (ze(r) || Ce(r))
262
281
  return h(r);
263
282
  try {
264
- const n = Kr(r);
265
- if (!C.allowedEncodedLengths.includes(n.length))
283
+ const n = Je(r);
284
+ if (!L.allowedEncodedLengths.includes(n.length))
266
285
  throw new Error("Invalid decoded address length");
267
- const [o, a, s, i] = Jr(n);
286
+ const [o, s, i, a] = gt(n);
268
287
  if (!o && !e)
269
288
  throw new Error("Invalid decoded address checksum");
270
- if (t !== -1 && t !== i)
271
- throw new Error(`Expected ss58Format ${t}, received ${i}`);
272
- return n.slice(s, a);
289
+ if (t !== -1 && t !== a)
290
+ throw new Error(
291
+ `Expected ss58Format ${t}, received ${a}`
292
+ );
293
+ return n.slice(i, s);
273
294
  } catch (n) {
274
295
  throw new Error(`Decoding ${r}: ${n.message}`);
275
296
  }
276
297
  }
277
- function Jt(r, e = C.prefix) {
278
- const t = Ve(r);
298
+ function mt(r, e = L.prefix) {
299
+ const t = ge(r);
279
300
  if (e < 0 || e > 16383 || [46, 47].includes(e))
280
301
  throw new Error("Out of range ss58Format specified");
281
- if (!C.allowedDecodedLengths.includes(t.length))
282
- throw new Error(`Expected a valid key to convert, with length ${C.allowedDecodedLengths.join(", ")}`);
283
- const n = D(e < 64 ? [e] : [
284
- (e & 252) >> 2 | 64,
285
- e >> 8 | (e & 3) << 6
286
- ], t);
287
- return Yr(D(n, qe(n).subarray(0, [32, 33].includes(t.length) ? 2 : 1)));
288
- }
289
- const de = {
302
+ if (!L.allowedDecodedLengths.includes(t.length))
303
+ throw new Error(
304
+ `Expected a valid key to convert, with length ${L.allowedDecodedLengths.join(", ")}`
305
+ );
306
+ const n = I(
307
+ e < 64 ? [e] : [
308
+ (e & 252) >> 2 | 64,
309
+ e >> 8 | (e & 3) << 6
310
+ ],
311
+ t
312
+ );
313
+ return Ze(
314
+ I(
315
+ n,
316
+ Xe(n).subarray(0, [32, 33].includes(t.length) ? 2 : 1)
317
+ )
318
+ );
319
+ }
320
+ const me = {
290
321
  chars: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
291
- coder: Fr,
322
+ coder: ut,
292
323
  type: "base64",
293
324
  withPadding: !0
294
- }, Gr = Fe(de), Gt = Le(de, Gr), Zr = He(de);
295
- function j(r, e) {
325
+ }, Qe = /* @__PURE__ */ Ye(me), yt = /* @__PURE__ */ Ve(me, Qe), er = /* @__PURE__ */ Ke(me);
326
+ function z(r, e) {
296
327
  return r << e | r >>> 32 - e;
297
328
  }
298
- function v(r, e) {
329
+ function E(r, e) {
299
330
  let t = r[e + 3] & 255;
300
331
  return t = t << 8 | r[e + 2] & 255, t = t << 8 | r[e + 1] & 255, t << 8 | r[e + 0] & 255;
301
332
  }
302
- function J(r, e, t) {
333
+ function X(r, e, t) {
303
334
  for (let n = 0; n < 4; n++)
304
335
  r[e + n] = t & 255, t >>>= 8;
305
336
  }
306
- function Xr(r, e, t, n, o) {
307
- let a = 0;
308
- for (let s = 0; s < o; s++)
309
- a |= r[e + s] ^ t[n + s];
310
- return (1 & a - 1 >>> 8) - 1;
337
+ function wt(r, e, t, n, o) {
338
+ let s = 0;
339
+ for (let i = 0; i < o; i++) s |= r[e + i] ^ t[n + i];
340
+ return (1 & s - 1 >>> 8) - 1;
311
341
  }
312
- function re(r, e, t, n, o) {
313
- const a = new Uint32Array(16), s = new Uint32Array(16), i = new Uint32Array(16), l = new Uint32Array(4);
342
+ function oe(r, e, t, n, o) {
343
+ const s = new Uint32Array(16), i = new Uint32Array(16), a = new Uint32Array(16), l = new Uint32Array(4);
314
344
  let c, u, d;
315
345
  for (c = 0; c < 4; c++)
316
- s[5 * c] = v(n, 4 * c), s[1 + c] = v(t, 4 * c), s[6 + c] = v(e, 4 * c), s[11 + c] = v(t, 16 + 4 * c);
317
- for (c = 0; c < 16; c++)
318
- i[c] = s[c];
346
+ i[5 * c] = E(n, 4 * c), i[1 + c] = E(t, 4 * c), i[6 + c] = E(e, 4 * c), i[11 + c] = E(t, 16 + 4 * c);
347
+ for (c = 0; c < 16; c++) a[c] = i[c];
319
348
  for (c = 0; c < 20; c++) {
320
349
  for (u = 0; u < 4; u++) {
321
- for (d = 0; d < 4; d++)
322
- l[d] = s[(5 * u + 4 * d) % 16];
323
- for (l[1] ^= j(l[0] + l[3] | 0, 7), l[2] ^= j(l[1] + l[0] | 0, 9), l[3] ^= j(l[2] + l[1] | 0, 13), l[0] ^= j(l[3] + l[2] | 0, 18), d = 0; d < 4; d++)
324
- a[4 * u + (u + d) % 4] = l[d];
350
+ for (d = 0; d < 4; d++) l[d] = i[(5 * u + 4 * d) % 16];
351
+ for (l[1] ^= z(l[0] + l[3] | 0, 7), l[2] ^= z(l[1] + l[0] | 0, 9), l[3] ^= z(l[2] + l[1] | 0, 13), l[0] ^= z(l[3] + l[2] | 0, 18), d = 0; d < 4; d++) s[4 * u + (u + d) % 4] = l[d];
325
352
  }
326
- for (d = 0; d < 16; d++)
327
- s[d] = a[d];
353
+ for (d = 0; d < 16; d++) i[d] = s[d];
328
354
  }
329
355
  if (o) {
330
- for (c = 0; c < 16; c++)
331
- s[c] = s[c] + i[c] | 0;
356
+ for (c = 0; c < 16; c++) i[c] = i[c] + a[c] | 0;
332
357
  for (c = 0; c < 4; c++)
333
- s[5 * c] = s[5 * c] - v(n, 4 * c) | 0, s[6 + c] = s[6 + c] - v(e, 4 * c) | 0;
358
+ i[5 * c] = i[5 * c] - E(n, 4 * c) | 0, i[6 + c] = i[6 + c] - E(e, 4 * c) | 0;
334
359
  for (c = 0; c < 4; c++)
335
- J(r, 4 * c, s[5 * c]), J(r, 16 + 4 * c, s[6 + c]);
360
+ X(r, 4 * c, i[5 * c]), X(r, 16 + 4 * c, i[6 + c]);
336
361
  } else
337
- for (c = 0; c < 16; c++)
338
- J(r, 4 * c, s[c] + i[c] | 0);
362
+ for (c = 0; c < 16; c++) X(r, 4 * c, i[c] + a[c] | 0);
339
363
  }
340
- const te = new Uint8Array([
364
+ const se = new Uint8Array([
341
365
  101,
342
366
  120,
343
367
  112,
@@ -355,37 +379,32 @@ const te = new Uint8Array([
355
379
  32,
356
380
  107
357
381
  ]);
358
- function Qr(r, e, t, n, o, a, s) {
359
- const i = new Uint8Array(16), l = new Uint8Array(64);
382
+ function bt(r, e, t, n, o, s, i) {
383
+ const a = new Uint8Array(16), l = new Uint8Array(64);
360
384
  let c, u;
361
- if (!o)
362
- return 0;
363
- for (u = 0; u < 16; u++)
364
- i[u] = 0;
365
- for (u = 0; u < 8; u++)
366
- i[u] = a[u];
385
+ if (!o) return 0;
386
+ for (u = 0; u < 16; u++) a[u] = 0;
387
+ for (u = 0; u < 8; u++) a[u] = s[u];
367
388
  for (; o >= 64; ) {
368
- for (re(l, i, s, te, !1), u = 0; u < 64; u++)
369
- r[e + u] = (t ? t[n + u] : 0) ^ l[u];
389
+ for (oe(l, a, i, se, !1), u = 0; u < 64; u++) r[e + u] = (t ? t[n + u] : 0) ^ l[u];
370
390
  for (c = 1, u = 8; u < 16; u++)
371
- c = c + (i[u] & 255) | 0, i[u] = c & 255, c >>>= 8;
391
+ c = c + (a[u] & 255) | 0, a[u] = c & 255, c >>>= 8;
372
392
  o -= 64, e += 64, t && (n += 64);
373
393
  }
374
394
  if (o > 0)
375
- for (re(l, i, s, te, !1), u = 0; u < o; u++)
376
- r[e + u] = (t ? t[n + u] : 0) ^ l[u];
395
+ for (oe(l, a, i, se, !1), u = 0; u < o; u++) r[e + u] = (t ? t[n + u] : 0) ^ l[u];
377
396
  return 0;
378
397
  }
379
- function ne(r, e, t, n, o, a, s) {
380
- const i = new Uint8Array(32);
381
- return re(i, a, s, te, !0), Qr(r, e, t, n, o, a.subarray(16), i);
398
+ function ae(r, e, t, n, o, s, i) {
399
+ const a = new Uint8Array(32);
400
+ return oe(a, s, i, se, !0), bt(r, e, t, n, o, s.subarray(16), a);
382
401
  }
383
- function G(r, e) {
402
+ function Q(r, e) {
384
403
  let t = 0;
385
404
  for (let n = 0; n < 17; n++)
386
405
  t = t + (r[n] + e[n] | 0) | 0, r[n] = t & 255, t >>>= 8;
387
406
  }
388
- const et = new Uint32Array([
407
+ const vt = new Uint32Array([
389
408
  5,
390
409
  0,
391
410
  0,
@@ -404,133 +423,124 @@ const et = new Uint32Array([
404
423
  0,
405
424
  252
406
425
  ]);
407
- function Ke(r, e, t, n, o, a) {
408
- let s, i, l;
426
+ function rr(r, e, t, n, o, s) {
427
+ let i, a, l;
409
428
  const c = new Uint32Array(17), u = new Uint32Array(17), d = new Uint32Array(17), p = new Uint32Array(17), b = new Uint32Array(17);
410
- for (i = 0; i < 17; i++)
411
- u[i] = d[i] = 0;
412
- for (i = 0; i < 16; i++)
413
- u[i] = a[i];
429
+ for (a = 0; a < 17; a++) u[a] = d[a] = 0;
430
+ for (a = 0; a < 16; a++) u[a] = s[a];
414
431
  for (u[3] &= 15, u[4] &= 252, u[7] &= 15, u[8] &= 252, u[11] &= 15, u[12] &= 252, u[15] &= 15; o > 0; ) {
415
- for (i = 0; i < 17; i++)
416
- p[i] = 0;
417
- for (i = 0; i < 16 && i < o; ++i)
418
- p[i] = t[n + i];
419
- for (p[i] = 1, n += i, o -= i, G(d, p), s = 0; s < 17; s++)
420
- for (c[s] = 0, i = 0; i < 17; i++)
421
- c[s] = c[s] + d[i] * (i <= s ? u[s - i] : 320 * u[s + 17 - i] | 0) | 0 | 0;
422
- for (s = 0; s < 17; s++)
423
- d[s] = c[s];
424
- for (l = 0, i = 0; i < 16; i++)
425
- l = l + d[i] | 0, d[i] = l & 255, l >>>= 8;
426
- for (l = l + d[16] | 0, d[16] = l & 3, l = 5 * (l >>> 2) | 0, i = 0; i < 16; i++)
427
- l = l + d[i] | 0, d[i] = l & 255, l >>>= 8;
432
+ for (a = 0; a < 17; a++) p[a] = 0;
433
+ for (a = 0; a < 16 && a < o; ++a) p[a] = t[n + a];
434
+ for (p[a] = 1, n += a, o -= a, Q(d, p), i = 0; i < 17; i++)
435
+ for (c[i] = 0, a = 0; a < 17; a++)
436
+ c[i] = c[i] + d[a] * (a <= i ? u[i - a] : 320 * u[i + 17 - a] | 0) | 0 | 0;
437
+ for (i = 0; i < 17; i++) d[i] = c[i];
438
+ for (l = 0, a = 0; a < 16; a++)
439
+ l = l + d[a] | 0, d[a] = l & 255, l >>>= 8;
440
+ for (l = l + d[16] | 0, d[16] = l & 3, l = 5 * (l >>> 2) | 0, a = 0; a < 16; a++)
441
+ l = l + d[a] | 0, d[a] = l & 255, l >>>= 8;
428
442
  l = l + d[16] | 0, d[16] = l;
429
443
  }
430
- for (i = 0; i < 17; i++)
431
- b[i] = d[i];
432
- G(d, et);
444
+ for (a = 0; a < 17; a++) b[a] = d[a];
445
+ Q(d, vt);
433
446
  const w = -(d[16] >>> 7) | 0;
434
- for (i = 0; i < 17; i++)
435
- d[i] ^= w & (b[i] ^ d[i]);
436
- for (i = 0; i < 16; i++)
437
- p[i] = a[i + 16];
438
- for (p[16] = 0, G(d, p), i = 0; i < 16; i++)
439
- r[e + i] = d[i];
447
+ for (a = 0; a < 17; a++) d[a] ^= w & (b[a] ^ d[a]);
448
+ for (a = 0; a < 16; a++) p[a] = s[a + 16];
449
+ for (p[16] = 0, Q(d, p), a = 0; a < 16; a++) r[e + a] = d[a];
440
450
  return 0;
441
451
  }
442
- function rt(r, e, t, n, o, a) {
443
- const s = new Uint8Array(16);
444
- return Ke(s, 0, t, n, o, a), Xr(r, e, s, 0, 16);
452
+ function kt(r, e, t, n, o, s) {
453
+ const i = new Uint8Array(16);
454
+ return rr(i, 0, t, n, o, s), wt(r, e, i, 0, 16);
445
455
  }
446
- function tt(r, e, t, n, o) {
447
- if (t < 32)
448
- return -1;
449
- ne(r, 0, e, 0, t, n, o), Ke(r, 16, r, 32, t - 32, r);
450
- for (let a = 0; a < 16; a++)
451
- r[a] = 0;
456
+ function Et(r, e, t, n, o) {
457
+ if (t < 32) return -1;
458
+ ae(r, 0, e, 0, t, n, o), rr(r, 16, r, 32, t - 32, r);
459
+ for (let s = 0; s < 16; s++) r[s] = 0;
452
460
  return 0;
453
461
  }
454
- function nt(r, e, t, n, o) {
455
- const a = new Uint8Array(32);
456
- if (t < 32 || (ne(a, 0, null, 0, 32, n, o), rt(e, 16, e, 32, t - 32, a) !== 0))
457
- return -1;
458
- ne(r, 0, e, 0, t, n, o);
459
- for (let s = 0; s < 32; s++)
460
- r[s] = 0;
462
+ function xt(r, e, t, n, o) {
463
+ const s = new Uint8Array(32);
464
+ if (t < 32 || (ae(s, 0, null, 0, 32, n, o), kt(e, 16, e, 32, t - 32, s) !== 0)) return -1;
465
+ ae(r, 0, e, 0, t, n, o);
466
+ for (let i = 0; i < 32; i++) r[i] = 0;
461
467
  return 0;
462
468
  }
463
- const ot = 32, at = 24, oe = 32, ae = 16;
464
- function Ye(r, e) {
465
- if (r.length !== ot)
466
- throw new Error("bad key size");
467
- if (e.length !== at)
469
+ const At = 32, Ut = 24, ie = 32, ce = 16;
470
+ function tr(r, e) {
471
+ if (r.length !== At) throw new Error("bad key size");
472
+ if (e.length !== Ut)
468
473
  throw new Error("bad nonce size");
469
474
  }
470
- function We(...r) {
475
+ function nr(...r) {
471
476
  for (let e = 0, t = r.length; e < t; e++)
472
477
  if (!(r[e] instanceof Uint8Array))
473
478
  throw new TypeError("unexpected type, use Uint8Array");
474
479
  }
475
- function st(r, e, t) {
476
- We(r, e, t), Ye(t, e);
477
- const n = new Uint8Array(oe + r.length), o = new Uint8Array(n.length);
478
- for (let a = 0; a < r.length; a++)
479
- n[a + oe] = r[a];
480
- return tt(o, n, n.length, e, t), o.subarray(ae);
480
+ function St(r, e, t) {
481
+ nr(r, e, t), tr(t, e);
482
+ const n = new Uint8Array(ie + r.length), o = new Uint8Array(n.length);
483
+ for (let s = 0; s < r.length; s++)
484
+ n[s + ie] = r[s];
485
+ return Et(o, n, n.length, e, t), o.subarray(ce);
481
486
  }
482
- function it(r, e, t) {
483
- We(r, e, t), Ye(t, e);
484
- const n = new Uint8Array(ae + r.length), o = new Uint8Array(n.length);
485
- for (let a = 0; a < r.length; a++)
486
- n[a + ae] = r[a];
487
- return n.length < 32 || nt(o, n, n.length, e, t) !== 0 ? null : o.subarray(oe);
487
+ function Bt(r, e, t) {
488
+ nr(r, e, t), tr(t, e);
489
+ const n = new Uint8Array(ce + r.length), o = new Uint8Array(n.length);
490
+ for (let s = 0; s < r.length; s++)
491
+ n[s + ce] = r[s];
492
+ return n.length < 32 || xt(o, n, n.length, e, t) !== 0 ? null : o.subarray(ie);
488
493
  }
489
- function ct(r, e, t) {
490
- return it(r, e, t);
494
+ function or(r, e, t) {
495
+ return Bt(r, e, t);
491
496
  }
492
- const lt = fr.crypto;
493
- function ut(r) {
494
- return lt.getRandomValues(r);
497
+ const Rt = Kr.crypto;
498
+ function $t(r) {
499
+ return Rt.getRandomValues(r);
495
500
  }
496
- function V(r = 32) {
497
- return ut(new Uint8Array(r));
501
+ function _(r = 32) {
502
+ return $t(new Uint8Array(r));
498
503
  }
499
- const Zt = Me(V);
500
- function Xt(r, e, t = V(24)) {
504
+ const Nt = /* @__PURE__ */ Ge(_);
505
+ function Dt(r, e, t = _(24)) {
501
506
  return {
502
- encrypted: st(r, t, e),
507
+ encrypted: St(r, t, e),
503
508
  nonce: t
504
509
  };
505
510
  }
506
- const O = {
511
+ const H = {
507
512
  N: 32768,
508
513
  p: 1,
509
514
  r: 8
510
515
  };
511
- function dt(r, e = V(), t = O, n) {
516
+ function sr(r, e = _(), t = H, n) {
512
517
  const o = h(r);
513
518
  return {
514
519
  params: t,
515
- password: Ar(o, e, pr({ dkLen: 64 }, t)),
520
+ password: jr(o, e, Yr({ dkLen: 64 }, t)),
516
521
  salt: e
517
522
  };
518
523
  }
519
- const Z = { isLe: !0 }, X = { bitLength: 32, isLe: !0 }, ht = { bitLength: 256, isLe: !0 };
520
- function ft(r) {
521
- const e = r.subarray(0, 32), t = Y(r.subarray(32, 36), Z).toNumber(), n = Y(r.subarray(36, 40), Z).toNumber(), o = Y(r.subarray(40, 44), Z).toNumber();
522
- if (t !== O.N || n !== O.p || o !== O.r)
524
+ const ee = { isLe: !0 }, re = { bitLength: 32, isLe: !0 }, It = { bitLength: 256, isLe: !0 };
525
+ function ar(r) {
526
+ const e = r.subarray(0, 32), t = Z(r.subarray(32, 36), ee).toNumber(), n = Z(r.subarray(36, 40), ee).toNumber(), o = Z(r.subarray(40, 44), ee).toNumber();
527
+ if (t !== H.N || n !== H.p || o !== H.r)
523
528
  throw new Error("Invalid injected scrypt params found");
524
529
  return { params: { N: t, p: n, r: o }, salt: e };
525
530
  }
526
- function Qt(r, { N: e, p: t, r: n }) {
527
- return D(r, z(e, X), z(t, X), z(n, X));
531
+ function Pt(r, { N: e, p: t, r: n }) {
532
+ return I(
533
+ r,
534
+ C(e, re),
535
+ C(t, re),
536
+ C(n, re)
537
+ );
528
538
  }
529
- const Je = [
539
+ const ye = [
530
540
  "scrypt",
531
541
  "xsalsa20-poly1305"
532
- ], pt = ["none"], gt = "3", ve = 24, yt = 32 + 3 * 4;
533
- function en(r, e, t = Je) {
542
+ ], ir = ["none"], cr = "3", le = 24, lr = 32 + 3 * 4;
543
+ function jt(r, e, t = ye) {
534
544
  if (!r)
535
545
  throw new Error("No encrypted data available to decode");
536
546
  if (t.includes("xsalsa20-poly1305") && !e)
@@ -539,233 +549,129 @@ function en(r, e, t = Je) {
539
549
  if (e) {
540
550
  let o;
541
551
  if (t.includes("scrypt")) {
542
- const { params: a, salt: s } = ft(r);
543
- o = dt(e, s, a).password, r = r.subarray(yt);
552
+ const { params: s, salt: i } = ar(r);
553
+ o = sr(e, i, s).password, r = r.subarray(lr);
544
554
  } else
545
- o = q(e);
546
- n = ct(r.subarray(ve), r.subarray(0, ve), gr(o, 256, !0));
555
+ o = V(e);
556
+ n = or(
557
+ r.subarray(le),
558
+ r.subarray(0, le),
559
+ Wr(o, 256, !0)
560
+ );
547
561
  }
548
562
  if (!n)
549
563
  throw new Error("Unable to decode using the supplied passphrase");
550
564
  return n;
551
565
  }
552
- function rn(r, e, t) {
566
+ function Tt(r, e, t) {
553
567
  return {
554
- encoded: Zr(r),
568
+ encoded: er(r),
555
569
  encoding: {
556
570
  content: e,
557
- type: t ? Je : pt,
558
- version: gt
571
+ type: t ? ye : ir,
572
+ version: cr
559
573
  }
560
574
  };
561
575
  }
562
- var ke = function() {
563
- return ke = Object.assign || function(e) {
564
- for (var t, n = 1, o = arguments.length; n < o; n++) {
565
- t = arguments[n];
566
- for (var a in t) Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);
567
- }
568
- return e;
569
- }, ke.apply(this, arguments);
570
- };
571
- function tn(r, e, t, n) {
572
- function o(a) {
573
- return a instanceof t ? a : new t(function(s) {
574
- s(a);
575
- });
576
- }
577
- return new (t || (t = Promise))(function(a, s) {
578
- function i(u) {
579
- try {
580
- c(n.next(u));
581
- } catch (d) {
582
- s(d);
583
- }
584
- }
585
- function l(u) {
586
- try {
587
- c(n.throw(u));
588
- } catch (d) {
589
- s(d);
590
- }
591
- }
592
- function c(u) {
593
- u.done ? a(u.value) : o(u.value).then(i, l);
594
- }
595
- c((n = n.apply(r, e || [])).next());
596
- });
597
- }
598
- function nn(r, e) {
599
- var t = { label: 0, sent: function() {
600
- if (a[0] & 1) throw a[1];
601
- return a[1];
602
- }, trys: [], ops: [] }, n, o, a, s = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
603
- return s.next = i(0), s.throw = i(1), s.return = i(2), typeof Symbol == "function" && (s[Symbol.iterator] = function() {
604
- return this;
605
- }), s;
606
- function i(c) {
607
- return function(u) {
608
- return l([c, u]);
609
- };
610
- }
611
- function l(c) {
612
- if (n) throw new TypeError("Generator is already executing.");
613
- for (; s && (s = 0, c[0] && (t = 0)), t; ) try {
614
- if (n = 1, o && (a = c[0] & 2 ? o.return : c[0] ? o.throw || ((a = o.return) && a.call(o), 0) : o.next) && !(a = a.call(o, c[1])).done) return a;
615
- switch (o = 0, a && (c = [c[0] & 2, a.value]), c[0]) {
616
- case 0:
617
- case 1:
618
- a = c;
619
- break;
620
- case 4:
621
- return t.label++, { value: c[1], done: !1 };
622
- case 5:
623
- t.label++, o = c[1], c = [0];
624
- continue;
625
- case 7:
626
- c = t.ops.pop(), t.trys.pop();
627
- continue;
628
- default:
629
- if (a = t.trys, !(a = a.length > 0 && a[a.length - 1]) && (c[0] === 6 || c[0] === 2)) {
630
- t = 0;
631
- continue;
632
- }
633
- if (c[0] === 3 && (!a || c[1] > a[0] && c[1] < a[3])) {
634
- t.label = c[1];
635
- break;
636
- }
637
- if (c[0] === 6 && t.label < a[1]) {
638
- t.label = a[1], a = c;
639
- break;
640
- }
641
- if (a && t.label < a[2]) {
642
- t.label = a[2], t.ops.push(c);
643
- break;
644
- }
645
- a[2] && t.ops.pop(), t.trys.pop();
646
- continue;
647
- }
648
- c = e.call(r, t);
649
- } catch (u) {
650
- c = [6, u], o = 0;
651
- } finally {
652
- n = a = 0;
653
- }
654
- if (c[0] & 5) throw c[1];
655
- return { value: c[0] ? c[1] : void 0, done: !0 };
656
- }
657
- }
658
- function on(r, e, t) {
659
- if (t || arguments.length === 2) for (var n = 0, o = e.length, a; n < o; n++)
660
- (a || !(n in e)) && (a || (a = Array.prototype.slice.call(e, 0, n)), a[n] = e[n]);
661
- return r.concat(a || Array.prototype.slice.call(e));
662
- }
663
- function _(r, e, t, n) {
664
- if (t === "a" && !n) throw new TypeError("Private accessor was defined without a getter");
665
- if (typeof e == "function" ? r !== e || !n : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
666
- return t === "m" ? n : t === "a" ? n.call(r) : n ? n.value : e.get(r);
667
- }
668
- function Ee(r, e, t, n, o) {
669
- if (n === "m") throw new TypeError("Private method is not writable");
670
- if (n === "a" && !o) throw new TypeError("Private accessor was defined without a setter");
671
- if (typeof e == "function" ? r !== e || !o : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
672
- return n === "a" ? o.call(r, t) : o ? o.value = t : e.set(r, t), t;
673
- }
674
- var $, k;
675
- const mt = /^\d+$/, wt = 32;
676
- class he {
576
+ const _t = /^\d+$/, zt = 32;
577
+ var A, v;
578
+ const ke = class ke {
677
579
  constructor() {
678
- $.set(this, new Uint8Array(32)), k.set(this, !1);
580
+ W(this, A, new Uint8Array(32));
581
+ W(this, v, !1);
679
582
  }
680
583
  static from(e) {
681
- const t = new he(), [n, o] = e.startsWith("/") ? [e.substring(1), !0] : [e, !1];
682
- return t.soft(mt.test(n) ? new Tr(n, 10) : n), o ? t.harden() : t;
584
+ const t = new ke(), [n, o] = e.startsWith("/") ? [e.substring(1), !0] : [e, !1];
585
+ return t.soft(_t.test(n) ? new nt(n, 10) : n), o ? t.harden() : t;
683
586
  }
684
587
  get chainCode() {
685
- return _(this, $, "f");
588
+ return k(this, A);
686
589
  }
687
590
  get isHard() {
688
- return _(this, k, "f");
591
+ return k(this, v);
689
592
  }
690
593
  get isSoft() {
691
- return !_(this, k, "f");
594
+ return !k(this, v);
692
595
  }
693
596
  hard(e) {
694
597
  return this.soft(e).harden();
695
598
  }
696
599
  harden() {
697
- return Ee(this, k, !0, "f"), this;
600
+ return J(this, v, !0), this;
698
601
  }
699
602
  soft(e) {
700
- return yr(e) || mr(e) || wr(e) ? this.soft(z(e, ht)) : De(e) ? this.soft(br(e)) : vr(e) ? this.soft(kr(q(e))) : e.length > wt ? this.soft(ue(e)) : (_(this, $, "f").fill(0), _(this, $, "f").set(e, 0), this);
603
+ return Jr(e) || Zr(e) || Gr(e) ? this.soft(C(e, It)) : Ce(e) ? this.soft(Xr(e)) : Qr(e) ? this.soft(et(V(e))) : e.length > zt ? this.soft(K(e)) : (k(this, A).fill(0), k(this, A).set(e, 0), this);
701
604
  }
702
605
  soften() {
703
- return Ee(this, k, !1, "f"), this;
606
+ return J(this, v, !1), this;
704
607
  }
705
- }
706
- $ = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap();
707
- const bt = /\/(\/?)([^/]+)/g;
708
- function vt(r) {
709
- const e = r.match(bt), t = [];
608
+ };
609
+ A = new WeakMap(), v = new WeakMap();
610
+ let ue = ke;
611
+ const Ct = /\/(\/?)([^/]+)/g;
612
+ function ur(r) {
613
+ const e = r.match(Ct), t = [];
710
614
  let n = "";
711
615
  if (e) {
712
616
  n = e.join("");
713
617
  for (const o of e)
714
- t.push(he.from(o.substring(1)));
618
+ t.push(ue.from(o.substring(1)));
715
619
  }
716
620
  if (n !== r)
717
- throw new Error(`Re-constructed path "${n}" does not match input`);
621
+ throw new Error(
622
+ `Re-constructed path "${n}" does not match input`
623
+ );
718
624
  return {
719
625
  parts: e,
720
626
  path: t
721
627
  };
722
628
  }
723
- const kt = /^(\w+( \w+)*)((\/\/?[^/]+)*)(\/\/\/(.*))?$/;
724
- function an(r) {
725
- const e = r.match(kt);
629
+ const Lt = /^(\w+( \w+)*)((\/\/?[^/]+)*)(\/\/\/(.*))?$/;
630
+ function Ht(r) {
631
+ const e = r.match(Lt);
726
632
  if (e === null)
727
633
  throw new Error("Unable to match provided value to a secret URI");
728
634
  const [, t, , n, , , o] = e;
729
635
  if (!t)
730
636
  throw new Error("Unable to extract phrase from provided value");
731
- const { path: a } = vt(n || "");
637
+ const { path: s } = ur(n || "");
732
638
  return {
733
639
  derivePath: n || "",
734
640
  password: o,
735
- path: a,
641
+ path: s,
736
642
  phrase: t
737
643
  };
738
644
  }
739
- const Ge = BigInt(0), Ze = BigInt(3);
740
- function Q(r) {
645
+ const dr = BigInt(0), hr = BigInt(3);
646
+ function te(r) {
741
647
  if (typeof r == "string")
742
- return ie(r);
743
- if (Ie(r))
648
+ return he(r);
649
+ if (Te(r))
744
650
  return r;
745
651
  throw new Error("Wrong data");
746
652
  }
747
653
  function f(r, e, ...t) {
748
- if (!Ie(e))
654
+ if (!Te(e))
749
655
  throw new Error(`${r}: Uint8Array expected`);
750
656
  if (t.length && !t.includes(e.length))
751
657
  throw new Error(`${r}: Uint8Array expected of length ${t}, not of length=${e.length}`);
752
658
  }
753
- function M(r, e) {
659
+ function q(r, e) {
754
660
  if (!Number.isSafeInteger(e) || e < 0 || e > 4294967295)
755
661
  throw new Error(`${r}: wrong u32 integer: ${e}`);
756
662
  return e;
757
663
  }
758
- function U(...r) {
664
+ function B(...r) {
759
665
  for (const e of r)
760
666
  e.fill(0);
761
667
  }
762
- const E = Uint8Array.of(), fe = Br.CURVE.n;
763
- function xe(r, e) {
668
+ const x = Uint8Array.of(), we = zr.CURVE.n;
669
+ function Re(r, e) {
764
670
  f(r, e, 32);
765
- const t = A(e);
766
- return Ne(r, t, Ge, fe), t;
671
+ const t = S(e);
672
+ return _e(r, t, dr, we), t;
767
673
  }
768
- const P = (r) => Sr(r, fe), R = 166, y = {
674
+ const j = (r) => _r(r, we), N = 166, m = {
769
675
  I: 1,
770
676
  A: 2,
771
677
  C: 4,
@@ -773,31 +679,31 @@ const P = (r) => Sr(r, fe), R = 166, y = {
773
679
  M: 16,
774
680
  K: 32
775
681
  };
776
- class pe {
682
+ class be {
777
683
  constructor(e) {
778
- this.state = new Uint8Array(200), this.pos = 0, this.posBegin = 0, this.curFlags = 0, this.state.set([1, R + 2, 1, 0, 1, 96], 0), this.state.set(ie("STROBEv1.0.2"), 6), this.state32 = _r(this.state), this.keccakF1600(), this.metaAD(e, !1);
684
+ this.state = new Uint8Array(200), this.pos = 0, this.posBegin = 0, this.curFlags = 0, this.state.set([1, N + 2, 1, 0, 1, 96], 0), this.state.set(he("STROBEv1.0.2"), 6), this.state32 = Cr(this.state), this.keccakF1600(), this.metaAD(e, !1);
779
685
  }
780
686
  keccakF1600() {
781
- Rr(this.state32);
687
+ Lr(this.state32);
782
688
  }
783
689
  runF() {
784
- this.state[this.pos] ^= this.posBegin, this.state[this.pos + 1] ^= 4, this.state[R + 1] ^= 128, this.keccakF1600(), this.pos = 0, this.posBegin = 0;
690
+ this.state[this.pos] ^= this.posBegin, this.state[this.pos + 1] ^= 4, this.state[N + 1] ^= 128, this.keccakF1600(), this.pos = 0, this.posBegin = 0;
785
691
  }
786
692
  // keccak.update()
787
693
  absorb(e) {
788
694
  for (let t = 0; t < e.length; t++)
789
- this.state[this.pos++] ^= e[t], this.pos === R && this.runF();
695
+ this.state[this.pos++] ^= e[t], this.pos === N && this.runF();
790
696
  }
791
697
  // keccak.xof()
792
698
  squeeze(e) {
793
699
  const t = new Uint8Array(e);
794
700
  for (let n = 0; n < t.length; n++)
795
- t[n] = this.state[this.pos], this.state[this.pos++] = 0, this.pos === R && this.runF();
701
+ t[n] = this.state[this.pos], this.state[this.pos++] = 0, this.pos === N && this.runF();
796
702
  return t;
797
703
  }
798
704
  overwrite(e) {
799
705
  for (let t = 0; t < e.length; t++)
800
- this.state[this.pos++] = e[t], this.pos === R && this.runF();
706
+ this.state[this.pos++] = e[t], this.pos === N && this.runF();
801
707
  }
802
708
  beginOp(e, t) {
803
709
  if (t) {
@@ -805,49 +711,49 @@ class pe {
805
711
  throw new Error(`Continued op with changed flags from ${this.curFlags.toString(2)} to ${e.toString(2)}`);
806
712
  return;
807
713
  }
808
- if ((e & y.T) !== 0)
714
+ if ((e & m.T) !== 0)
809
715
  throw new Error("T flag is not supported");
810
716
  const n = this.posBegin;
811
- this.posBegin = this.pos + 1, this.curFlags = e, this.absorb(new Uint8Array([n, e])), (e & (y.C | y.K)) !== 0 && this.pos !== 0 && this.runF();
717
+ this.posBegin = this.pos + 1, this.curFlags = e, this.absorb(new Uint8Array([n, e])), (e & (m.C | m.K)) !== 0 && this.pos !== 0 && this.runF();
812
718
  }
813
719
  // Public API
814
720
  metaAD(e, t) {
815
- this.beginOp(y.M | y.A, t), this.absorb(Q(e));
721
+ this.beginOp(m.M | m.A, t), this.absorb(te(e));
816
722
  }
817
723
  AD(e, t) {
818
- this.beginOp(y.A, t), this.absorb(Q(e));
724
+ this.beginOp(m.A, t), this.absorb(te(e));
819
725
  }
820
726
  PRF(e, t) {
821
- return this.beginOp(y.I | y.A | y.C, t), this.squeeze(e);
727
+ return this.beginOp(m.I | m.A | m.C, t), this.squeeze(e);
822
728
  }
823
729
  KEY(e, t) {
824
- this.beginOp(y.A | y.C, t), this.overwrite(Q(e));
730
+ this.beginOp(m.A | m.C, t), this.overwrite(te(e));
825
731
  }
826
732
  // Utils
827
733
  clone() {
828
- const e = new pe("0");
734
+ const e = new be("0");
829
735
  return e.pos = this.pos, e.posBegin = this.posBegin, e.state.set(this.state), e.curFlags = this.curFlags, e;
830
736
  }
831
737
  clean() {
832
738
  this.state.fill(0), this.pos = 0, this.curFlags = 0, this.posBegin = 0;
833
739
  }
834
740
  }
835
- class Et {
741
+ class Ot {
836
742
  constructor(e) {
837
- this.strobe = new pe("Merlin v1.0"), this.appendMessage("dom-sep", e);
743
+ this.strobe = new be("Merlin v1.0"), this.appendMessage("dom-sep", e);
838
744
  }
839
745
  appendMessage(e, t) {
840
- this.strobe.metaAD(e, !1), M("Merlin.appendMessage", t.length), this.strobe.metaAD(m(t.length, 4), !0), this.strobe.AD(t, !1);
746
+ this.strobe.metaAD(e, !1), q("Merlin.appendMessage", t.length), this.strobe.metaAD(y(t.length, 4), !0), this.strobe.AD(t, !1);
841
747
  }
842
748
  challengeBytes(e, t) {
843
- return this.strobe.metaAD(e, !1), M("Merlin.challengeBytes", t), this.strobe.metaAD(m(t, 4), !0), this.strobe.PRF(t, !1);
749
+ return this.strobe.metaAD(e, !1), q("Merlin.challengeBytes", t), this.strobe.metaAD(y(t, 4), !0), this.strobe.PRF(t, !1);
844
750
  }
845
751
  clean() {
846
752
  this.strobe.clean();
847
753
  }
848
754
  }
849
- class S extends Et {
850
- constructor(e, t = x) {
755
+ class R extends Ot {
756
+ constructor(e, t = U) {
851
757
  super(e), this.rng = t;
852
758
  }
853
759
  label(e) {
@@ -863,149 +769,151 @@ class S extends Et {
863
769
  this.appendMessage(e, t.toRawBytes());
864
770
  }
865
771
  challengeScalar(e) {
866
- return P(A(this.challengeBytes(e, 64)));
772
+ return j(S(this.challengeBytes(e, 64)));
867
773
  }
868
774
  witnessScalar(e, t = []) {
869
- return P(A(this.witnessBytes(e, 64, t)));
775
+ return j(S(this.witnessBytes(e, 64, t)));
870
776
  }
871
777
  witnessBytes(e, t, n = []) {
872
- M("SigningContext.witnessBytes", t);
778
+ q("SigningContext.witnessBytes", t);
873
779
  const o = this.strobe.clone();
874
- for (const s of n)
875
- o.metaAD(e, !1), M("SigningContext.witnessBytes nonce length", s.length), o.metaAD(m(s.length, 4), !0), o.KEY(s, !1);
876
- const a = this.rng(32);
877
- return o.metaAD("rng", !1), o.KEY(a, !1), o.metaAD(m(t, 4), !1), o.PRF(t, !1);
780
+ for (const i of n)
781
+ o.metaAD(e, !1), q("SigningContext.witnessBytes nonce length", i.length), o.metaAD(y(i.length, 4), !0), o.KEY(i, !1);
782
+ const s = this.rng(32);
783
+ return o.metaAD("rng", !1), o.KEY(s, !1), o.metaAD(y(t, 4), !1), o.PRF(t, !1);
878
784
  }
879
785
  }
880
- const xt = $r(256), Xe = (r) => m(r << Ze & xt, 32), B = (r) => A(r) >> Ze;
881
- function K(r) {
786
+ const Ft = Hr(256), fr = (r) => y(r << hr & Ft, 32), $ = (r) => S(r) >> hr;
787
+ function Y(r) {
882
788
  f("secretKey", r, 64);
883
- const e = B(r.subarray(0, 32));
789
+ const e = $(r.subarray(0, 32));
884
790
  return g.BASE.multiply(e).toRawBytes();
885
791
  }
886
- function Qe(r) {
792
+ function pr(r) {
887
793
  f("seed", r, 32);
888
- const e = Ur(r);
794
+ const e = Tr(r);
889
795
  e[0] &= 248, e[31] &= 63, e[31] |= 64;
890
- const t = Xe(B(e.subarray(0, 32))), n = e.subarray(32, 64), o = I(t, n);
891
- return U(t, n, e), o;
796
+ const t = fr($(e.subarray(0, 32))), n = e.subarray(32, 64), o = D(t, n);
797
+ return B(t, n, e), o;
892
798
  }
893
- const er = ie("substrate");
894
- function At(r, e, t = x) {
799
+ const gr = he("substrate");
800
+ function Mt(r, e, t = U) {
895
801
  f("message", e), f("secretKey", r, 64);
896
- const n = new S("SigningContext", t);
897
- n.label(er), n.bytes(e);
898
- const o = B(r.subarray(0, 32)), a = r.subarray(32, 64), s = g.fromHex(K(r));
899
- n.protoName("Schnorr-sig"), n.commitPoint("sign:pk", s);
900
- const i = n.witnessScalar("signing", [a]), l = g.BASE.multiply(i);
802
+ const n = new R("SigningContext", t);
803
+ n.label(gr), n.bytes(e);
804
+ const o = $(r.subarray(0, 32)), s = r.subarray(32, 64), i = g.fromHex(Y(r));
805
+ n.protoName("Schnorr-sig"), n.commitPoint("sign:pk", i);
806
+ const a = n.witnessScalar("signing", [s]), l = g.BASE.multiply(a);
901
807
  n.commitPoint("sign:R", l);
902
- const c = n.challengeScalar("sign:c"), u = P(c * o + i), d = I(l.toRawBytes(), m(u, 32));
808
+ const c = n.challengeScalar("sign:c"), u = j(c * o + a), d = D(l.toRawBytes(), y(u, 32));
903
809
  return d[63] |= 128, n.clean(), d;
904
810
  }
905
- function Ut(r, e, t) {
811
+ function qt(r, e, t) {
906
812
  if (f("message", r), f("signature", e, 64), f("publicKey", t, 32), (e[63] & 128) === 0)
907
813
  throw new Error("Schnorrkel marker missing");
908
814
  const n = Uint8Array.from(e.subarray(32, 64));
909
815
  n[31] &= 127;
910
- const o = g.fromHex(e.subarray(0, 32)), a = A(n);
911
- Ne("s", a, Ge, fe);
912
- const s = new S("SigningContext");
913
- s.label(er), s.bytes(r);
914
- const i = g.fromHex(t);
915
- if (i.equals(g.ZERO))
816
+ const o = g.fromHex(e.subarray(0, 32)), s = S(n);
817
+ _e("s", s, dr, we);
818
+ const i = new R("SigningContext");
819
+ i.label(gr), i.bytes(r);
820
+ const a = g.fromHex(t);
821
+ if (a.equals(g.ZERO))
916
822
  return !1;
917
- s.protoName("Schnorr-sig"), s.commitPoint("sign:pk", i), s.commitPoint("sign:R", o);
918
- const l = s.challengeScalar("sign:c"), c = g.BASE.multiply(a), u = i.negate().multiply(l).add(c);
919
- return s.clean(), U(n), u.equals(o);
823
+ i.protoName("Schnorr-sig"), i.commitPoint("sign:pk", a), i.commitPoint("sign:R", o);
824
+ const l = i.challengeScalar("sign:c"), c = g.BASE.multiply(s), u = a.negate().multiply(l).add(c);
825
+ return i.clean(), B(n), u.equals(o);
920
826
  }
921
- const rr = {
922
- secretSoft(r, e, t = x) {
827
+ const mr = {
828
+ secretSoft(r, e, t = U) {
923
829
  f("secretKey", r, 64), f("chainCode", e, 32);
924
- const n = B(r.subarray(0, 32)), o = r.subarray(32, 64), a = g.fromHex(K(r)), s = new S("SchnorrRistrettoHDKD", t);
925
- s.bytes(E), s.appendMessage("chain-code", e), s.commitPoint("public-key", a);
926
- const i = s.challengeScalar("HDKD-scalar"), l = s.challengeBytes("HDKD-chaincode", 32), c = I(m(n, 32), o), u = s.witnessBytes("HDKD-nonce", 32, [o, c]), d = Xe(P(n + i)), p = I(d, u);
927
- return U(d, u, c, l), s.clean(), p;
830
+ const n = $(r.subarray(0, 32)), o = r.subarray(32, 64), s = g.fromHex(Y(r)), i = new R("SchnorrRistrettoHDKD", t);
831
+ i.bytes(x), i.appendMessage("chain-code", e), i.commitPoint("public-key", s);
832
+ const a = i.challengeScalar("HDKD-scalar"), l = i.challengeBytes("HDKD-chaincode", 32), c = D(y(n, 32), o), u = i.witnessBytes("HDKD-nonce", 32, [o, c]), d = fr(j(n + a)), p = D(d, u);
833
+ return B(d, u, c, l), i.clean(), p;
928
834
  },
929
835
  secretHard(r, e) {
930
836
  f("secretKey", r, 64), f("chainCode", e, 32);
931
- const t = m(B(r.subarray(0, 32)), 32), n = new S("SchnorrRistrettoHDKD");
932
- n.bytes(E), n.appendMessage("chain-code", e), n.appendMessage("secret-key", t);
933
- const o = n.challengeBytes("HDKD-hard", 32), a = n.challengeBytes("HDKD-chaincode", 32);
837
+ const t = y($(r.subarray(0, 32)), 32), n = new R("SchnorrRistrettoHDKD");
838
+ n.bytes(x), n.appendMessage("chain-code", e), n.appendMessage("secret-key", t);
839
+ const o = n.challengeBytes("HDKD-hard", 32), s = n.challengeBytes("HDKD-chaincode", 32);
934
840
  n.clean();
935
- const s = Qe(o);
936
- return U(t, o, a), n.clean(), s;
841
+ const i = pr(o);
842
+ return B(t, o, s), n.clean(), i;
937
843
  }
938
- }, Ae = {
939
- proove(r, e, t, n, o, a) {
844
+ }, $e = {
845
+ proove(r, e, t, n, o, s) {
940
846
  n.protoName("DLEQProof"), n.commitPoint("vrf:h", o);
941
- const s = n.witnessScalar("proving\x000", [e]), i = g.BASE.multiply(s);
942
- n.commitPoint("vrf:R=g^r", i);
943
- const l = o.multiply(s);
944
- n.commitPoint("vrf:h^r", l), n.commitPoint("vrf:pk", t), n.commitPoint("vrf:h^sk", a);
945
- const c = n.challengeScalar("prove"), u = P(s - c * r);
946
- return { proof: { c, s: u }, proofBatchable: { R: i, Hr: l, s: u } };
847
+ const i = n.witnessScalar("proving\x000", [e]), a = g.BASE.multiply(i);
848
+ n.commitPoint("vrf:R=g^r", a);
849
+ const l = o.multiply(i);
850
+ n.commitPoint("vrf:h^r", l), n.commitPoint("vrf:pk", t), n.commitPoint("vrf:h^sk", s);
851
+ const c = n.challengeScalar("prove"), u = j(i - c * r);
852
+ return { proof: { c, s: u }, proofBatchable: { R: a, Hr: l, s: u } };
947
853
  },
948
854
  verify(r, e, t, n, o) {
949
855
  if (r.equals(g.ZERO))
950
856
  return !1;
951
857
  e.protoName("DLEQProof"), e.commitPoint("vrf:h", t);
952
- const a = r.multiply(o.c).add(g.BASE.multiply(o.s));
953
- e.commitPoint("vrf:R=g^r", a);
954
- const s = n.multiply(o.c).add(t.multiply(o.s));
955
- e.commitPoint("vrf:h^r", s), e.commitPoint("vrf:pk", r), e.commitPoint("vrf:h^sk", n);
956
- const i = e.challengeScalar("prove");
957
- return o.c === i ? { R: a, Hr: s, s: o.s } : !1;
858
+ const s = r.multiply(o.c).add(g.BASE.multiply(o.s));
859
+ e.commitPoint("vrf:R=g^r", s);
860
+ const i = n.multiply(o.c).add(t.multiply(o.s));
861
+ e.commitPoint("vrf:h^r", i), e.commitPoint("vrf:pk", r), e.commitPoint("vrf:h^sk", n);
862
+ const a = e.challengeScalar("prove");
863
+ return o.c === a ? { R: s, Hr: i, s: o.s } : !1;
958
864
  }
959
865
  };
960
- function Ue(r, e, t, n, o = x) {
961
- const a = new S("SigningContext", o);
962
- a.label(r), a.bytes(e), a.commitPoint("vrf-nm-pk", n);
963
- const s = a.challengeBytes("VRFHash", 64), i = g.hashToCurve(s), l = new S("VRF", o);
964
- return t.length && l.label(t), a.clean(), U(s), { input: i, t: l };
965
- }
966
- const tr = {
967
- sign(r, e, t = E, n = E, o = x) {
866
+ function Ne(r, e, t, n, o = U) {
867
+ const s = new R("SigningContext", o);
868
+ s.label(r), s.bytes(e), s.commitPoint("vrf-nm-pk", n);
869
+ const i = s.challengeBytes("VRFHash", 64), a = g.hashToCurve(i), l = new R("VRF", o);
870
+ return t.length && l.label(t), s.clean(), B(i), { input: a, t: l };
871
+ }
872
+ const yr = {
873
+ sign(r, e, t = x, n = x, o = U) {
968
874
  f("msg", r), f("secretKey", e, 64), f("ctx", t), f("extra", n);
969
- const a = B(e.subarray(0, 32)), s = e.subarray(32, 64), i = g.fromHex(K(e)), { input: l, t: c } = Ue(t, r, n, i, o), u = l.multiply(a), d = { output: u }, { proof: p } = Ae.proove(a, s, i, c, l, u), b = m(p.c, 32), w = m(p.s, 32), dr = I(d.output.toRawBytes(), b, w);
970
- return U(s, b, w), dr;
875
+ const s = $(e.subarray(0, 32)), i = e.subarray(32, 64), a = g.fromHex(Y(e)), { input: l, t: c } = Ne(t, r, n, a, o), u = l.multiply(s), d = { output: u }, { proof: p } = $e.proove(s, i, a, c, l, u), b = y(p.c, 32), w = y(p.s, 32), Pr = D(d.output.toRawBytes(), b, w);
876
+ return B(i, b, w), Pr;
971
877
  },
972
- verify(r, e, t, n = E, o = E, a = x) {
878
+ verify(r, e, t, n = x, o = x, s = U) {
973
879
  f("msg", r), f("signature", e, 96), f("pubkey", t, 32), f("ctx", n), f("extra", o);
974
- const s = g.fromHex(t);
975
- if (s.equals(g.ZERO))
880
+ const i = g.fromHex(t);
881
+ if (i.equals(g.ZERO))
976
882
  return !1;
977
- const i = {
978
- c: xe("signature.c", e.subarray(32, 64)),
979
- s: xe("signature.s", e.subarray(64, 96))
980
- }, { input: l, t: c } = Ue(n, r, o, s, a), u = g.fromHex(e.subarray(0, 32));
883
+ const a = {
884
+ c: Re("signature.c", e.subarray(32, 64)),
885
+ s: Re("signature.s", e.subarray(64, 96))
886
+ }, { input: l, t: c } = Ne(n, r, o, i, s), u = g.fromHex(e.subarray(0, 32));
981
887
  if (u.equals(g.ZERO))
982
888
  throw new Error("vrf.verify: wrong output point (identity)");
983
- return Ae.verify(s, c, l, u, i) !== !1;
889
+ return $e.verify(i, c, l, u, a) !== !1;
984
890
  }
985
- }, se = 64, St = 32, ee = se + St;
986
- function Bt(r) {
891
+ }, de = 64, Vt = 32, ne = de + Vt;
892
+ function Kt(r) {
987
893
  const e = h(r);
988
- if (e.length !== ee)
989
- throw new Error(`Expected keypair with ${ee} bytes, found ${e.length}`);
894
+ if (e.length !== ne)
895
+ throw new Error(
896
+ `Expected keypair with ${ne} bytes, found ${e.length}`
897
+ );
990
898
  return {
991
- publicKey: e.slice(se, ee),
992
- secretKey: e.slice(0, se)
899
+ publicKey: e.slice(de, ne),
900
+ secretKey: e.slice(0, de)
993
901
  };
994
902
  }
995
- function nr(r) {
903
+ function wr(r) {
996
904
  return (e, t) => {
997
- if (!$e(t) || t.length !== 32)
905
+ if (!ze(t) || t.length !== 32)
998
906
  throw new Error("Invalid chainCode passed to derive");
999
- const n = r(e.secretKey, t), o = K(n);
1000
- return Bt(D(n, o));
907
+ const n = r(e.secretKey, t), o = Y(n);
908
+ return Kt(I(n, o));
1001
909
  };
1002
910
  }
1003
- const _t = nr(rr.secretHard), Rt = nr(rr.secretSoft);
1004
- function $t(r, { chainCode: e, isSoft: t }) {
1005
- return t ? Rt(r, e) : _t(r, e);
911
+ const br = /* @__PURE__ */ wr(mr.secretHard), vr = /* @__PURE__ */ wr(mr.secretSoft);
912
+ function kr(r, { chainCode: e, isSoft: t }) {
913
+ return t ? vr(r, e) : br(r, e);
1006
914
  }
1007
- const Se = {
1008
- sr25519: $t,
915
+ const De = {
916
+ sr25519: kr,
1009
917
  ecdsa: () => {
1010
918
  throw new Error("ECDSA key derivation not implemented yet");
1011
919
  },
@@ -1016,103 +924,108 @@ const Se = {
1016
924
  throw new Error("Ethereum key derivation not implemented yet");
1017
925
  }
1018
926
  };
1019
- function sn(r, e, t) {
927
+ function Yt(r, e, t) {
1020
928
  if (!t)
1021
929
  throw new Error("Invalid type provided");
1022
- if (!Se[t])
930
+ if (!De[t])
1023
931
  throw new Error(`Unsupported keypair type: ${t}`);
1024
- const n = Se[t];
932
+ const n = De[t];
1025
933
  let o = r;
1026
- for (const a of e)
1027
- o = n(o, a);
934
+ for (const s of e)
935
+ o = n(o, s);
1028
936
  return o;
1029
937
  }
1030
- function Dt(r, e = V(), t = 2048, n) {
1031
- const o = h(r), a = h(e);
938
+ function Er(r, e = _(), t = 2048, n) {
939
+ const o = h(r), s = h(e);
1032
940
  return {
1033
- password: Dr(Ir, o, a, { c: t, dkLen: 64 }),
941
+ password: Or(Fr, o, s, { c: t, dkLen: 64 }),
1034
942
  rounds: t,
1035
943
  salt: e
1036
944
  };
1037
945
  }
1038
- const It = { 256: Nr }, Nt = It[256], or = "abandon|ability|able|about|above|absent|absorb|abstract|absurd|abuse|access|accident|account|accuse|achieve|acid|acoustic|acquire|across|act|action|actor|actress|actual|adapt|add|addict|address|adjust|admit|adult|advance|advice|aerobic|affair|afford|afraid|again|age|agent|agree|ahead|aim|air|airport|aisle|alarm|album|alcohol|alert|alien|all|alley|allow|almost|alone|alpha|already|also|alter|always|amateur|amazing|among|amount|amused|analyst|anchor|ancient|anger|angle|angry|animal|ankle|announce|annual|another|answer|antenna|antique|anxiety|any|apart|apology|appear|apple|approve|april|arch|arctic|area|arena|argue|arm|armed|armor|army|around|arrange|arrest|arrive|arrow|art|artefact|artist|artwork|ask|aspect|assault|asset|assist|assume|asthma|athlete|atom|attack|attend|attitude|attract|auction|audit|august|aunt|author|auto|autumn|average|avocado|avoid|awake|aware|away|awesome|awful|awkward|axis|baby|bachelor|bacon|badge|bag|balance|balcony|ball|bamboo|banana|banner|bar|barely|bargain|barrel|base|basic|basket|battle|beach|bean|beauty|because|become|beef|before|begin|behave|behind|believe|below|belt|bench|benefit|best|betray|better|between|beyond|bicycle|bid|bike|bind|biology|bird|birth|bitter|black|blade|blame|blanket|blast|bleak|bless|blind|blood|blossom|blouse|blue|blur|blush|board|boat|body|boil|bomb|bone|bonus|book|boost|border|boring|borrow|boss|bottom|bounce|box|boy|bracket|brain|brand|brass|brave|bread|breeze|brick|bridge|brief|bright|bring|brisk|broccoli|broken|bronze|broom|brother|brown|brush|bubble|buddy|budget|buffalo|build|bulb|bulk|bullet|bundle|bunker|burden|burger|burst|bus|business|busy|butter|buyer|buzz|cabbage|cabin|cable|cactus|cage|cake|call|calm|camera|camp|can|canal|cancel|candy|cannon|canoe|canvas|canyon|capable|capital|captain|car|carbon|card|cargo|carpet|carry|cart|case|cash|casino|castle|casual|cat|catalog|catch|category|cattle|caught|cause|caution|cave|ceiling|celery|cement|census|century|cereal|certain|chair|chalk|champion|change|chaos|chapter|charge|chase|chat|cheap|check|cheese|chef|cherry|chest|chicken|chief|child|chimney|choice|choose|chronic|chuckle|chunk|churn|cigar|cinnamon|circle|citizen|city|civil|claim|clap|clarify|claw|clay|clean|clerk|clever|click|client|cliff|climb|clinic|clip|clock|clog|close|cloth|cloud|clown|club|clump|cluster|clutch|coach|coast|coconut|code|coffee|coil|coin|collect|color|column|combine|come|comfort|comic|common|company|concert|conduct|confirm|congress|connect|consider|control|convince|cook|cool|copper|copy|coral|core|corn|correct|cost|cotton|couch|country|couple|course|cousin|cover|coyote|crack|cradle|craft|cram|crane|crash|crater|crawl|crazy|cream|credit|creek|crew|cricket|crime|crisp|critic|crop|cross|crouch|crowd|crucial|cruel|cruise|crumble|crunch|crush|cry|crystal|cube|culture|cup|cupboard|curious|current|curtain|curve|cushion|custom|cute|cycle|dad|damage|damp|dance|danger|daring|dash|daughter|dawn|day|deal|debate|debris|decade|december|decide|decline|decorate|decrease|deer|defense|define|defy|degree|delay|deliver|demand|demise|denial|dentist|deny|depart|depend|deposit|depth|deputy|derive|describe|desert|design|desk|despair|destroy|detail|detect|develop|device|devote|diagram|dial|diamond|diary|dice|diesel|diet|differ|digital|dignity|dilemma|dinner|dinosaur|direct|dirt|disagree|discover|disease|dish|dismiss|disorder|display|distance|divert|divide|divorce|dizzy|doctor|document|dog|doll|dolphin|domain|donate|donkey|donor|door|dose|double|dove|draft|dragon|drama|drastic|draw|dream|dress|drift|drill|drink|drip|drive|drop|drum|dry|duck|dumb|dune|during|dust|dutch|duty|dwarf|dynamic|eager|eagle|early|earn|earth|easily|east|easy|echo|ecology|economy|edge|edit|educate|effort|egg|eight|either|elbow|elder|electric|elegant|element|elephant|elevator|elite|else|embark|embody|embrace|emerge|emotion|employ|empower|empty|enable|enact|end|endless|endorse|enemy|energy|enforce|engage|engine|enhance|enjoy|enlist|enough|enrich|enroll|ensure|enter|entire|entry|envelope|episode|equal|equip|era|erase|erode|erosion|error|erupt|escape|essay|essence|estate|eternal|ethics|evidence|evil|evoke|evolve|exact|example|excess|exchange|excite|exclude|excuse|execute|exercise|exhaust|exhibit|exile|exist|exit|exotic|expand|expect|expire|explain|expose|express|extend|extra|eye|eyebrow|fabric|face|faculty|fade|faint|faith|fall|false|fame|family|famous|fan|fancy|fantasy|farm|fashion|fat|fatal|father|fatigue|fault|favorite|feature|february|federal|fee|feed|feel|female|fence|festival|fetch|fever|few|fiber|fiction|field|figure|file|film|filter|final|find|fine|finger|finish|fire|firm|first|fiscal|fish|fit|fitness|fix|flag|flame|flash|flat|flavor|flee|flight|flip|float|flock|floor|flower|fluid|flush|fly|foam|focus|fog|foil|fold|follow|food|foot|force|forest|forget|fork|fortune|forum|forward|fossil|foster|found|fox|fragile|frame|frequent|fresh|friend|fringe|frog|front|frost|frown|frozen|fruit|fuel|fun|funny|furnace|fury|future|gadget|gain|galaxy|gallery|game|gap|garage|garbage|garden|garlic|garment|gas|gasp|gate|gather|gauge|gaze|general|genius|genre|gentle|genuine|gesture|ghost|giant|gift|giggle|ginger|giraffe|girl|give|glad|glance|glare|glass|glide|glimpse|globe|gloom|glory|glove|glow|glue|goat|goddess|gold|good|goose|gorilla|gospel|gossip|govern|gown|grab|grace|grain|grant|grape|grass|gravity|great|green|grid|grief|grit|grocery|group|grow|grunt|guard|guess|guide|guilt|guitar|gun|gym|habit|hair|half|hammer|hamster|hand|happy|harbor|hard|harsh|harvest|hat|have|hawk|hazard|head|health|heart|heavy|hedgehog|height|hello|helmet|help|hen|hero|hidden|high|hill|hint|hip|hire|history|hobby|hockey|hold|hole|holiday|hollow|home|honey|hood|hope|horn|horror|horse|hospital|host|hotel|hour|hover|hub|huge|human|humble|humor|hundred|hungry|hunt|hurdle|hurry|hurt|husband|hybrid|ice|icon|idea|identify|idle|ignore|ill|illegal|illness|image|imitate|immense|immune|impact|impose|improve|impulse|inch|include|income|increase|index|indicate|indoor|industry|infant|inflict|inform|inhale|inherit|initial|inject|injury|inmate|inner|innocent|input|inquiry|insane|insect|inside|inspire|install|intact|interest|into|invest|invite|involve|iron|island|isolate|issue|item|ivory|jacket|jaguar|jar|jazz|jealous|jeans|jelly|jewel|job|join|joke|journey|joy|judge|juice|jump|jungle|junior|junk|just|kangaroo|keen|keep|ketchup|key|kick|kid|kidney|kind|kingdom|kiss|kit|kitchen|kite|kitten|kiwi|knee|knife|knock|know|lab|label|labor|ladder|lady|lake|lamp|language|laptop|large|later|latin|laugh|laundry|lava|law|lawn|lawsuit|layer|lazy|leader|leaf|learn|leave|lecture|left|leg|legal|legend|leisure|lemon|lend|length|lens|leopard|lesson|letter|level|liar|liberty|library|license|life|lift|light|like|limb|limit|link|lion|liquid|list|little|live|lizard|load|loan|lobster|local|lock|logic|lonely|long|loop|lottery|loud|lounge|love|loyal|lucky|luggage|lumber|lunar|lunch|luxury|lyrics|machine|mad|magic|magnet|maid|mail|main|major|make|mammal|man|manage|mandate|mango|mansion|manual|maple|marble|march|margin|marine|market|marriage|mask|mass|master|match|material|math|matrix|matter|maximum|maze|meadow|mean|measure|meat|mechanic|medal|media|melody|melt|member|memory|mention|menu|mercy|merge|merit|merry|mesh|message|metal|method|middle|midnight|milk|million|mimic|mind|minimum|minor|minute|miracle|mirror|misery|miss|mistake|mix|mixed|mixture|mobile|model|modify|mom|moment|monitor|monkey|monster|month|moon|moral|more|morning|mosquito|mother|motion|motor|mountain|mouse|move|movie|much|muffin|mule|multiply|muscle|museum|mushroom|music|must|mutual|myself|mystery|myth|naive|name|napkin|narrow|nasty|nation|nature|near|neck|need|negative|neglect|neither|nephew|nerve|nest|net|network|neutral|never|news|next|nice|night|noble|noise|nominee|noodle|normal|north|nose|notable|note|nothing|notice|novel|now|nuclear|number|nurse|nut|oak|obey|object|oblige|obscure|observe|obtain|obvious|occur|ocean|october|odor|off|offer|office|often|oil|okay|old|olive|olympic|omit|once|one|onion|online|only|open|opera|opinion|oppose|option|orange|orbit|orchard|order|ordinary|organ|orient|original|orphan|ostrich|other|outdoor|outer|output|outside|oval|oven|over|own|owner|oxygen|oyster|ozone|pact|paddle|page|pair|palace|palm|panda|panel|panic|panther|paper|parade|parent|park|parrot|party|pass|patch|path|patient|patrol|pattern|pause|pave|payment|peace|peanut|pear|peasant|pelican|pen|penalty|pencil|people|pepper|perfect|permit|person|pet|phone|photo|phrase|physical|piano|picnic|picture|piece|pig|pigeon|pill|pilot|pink|pioneer|pipe|pistol|pitch|pizza|place|planet|plastic|plate|play|please|pledge|pluck|plug|plunge|poem|poet|point|polar|pole|police|pond|pony|pool|popular|portion|position|possible|post|potato|pottery|poverty|powder|power|practice|praise|predict|prefer|prepare|present|pretty|prevent|price|pride|primary|print|priority|prison|private|prize|problem|process|produce|profit|program|project|promote|proof|property|prosper|protect|proud|provide|public|pudding|pull|pulp|pulse|pumpkin|punch|pupil|puppy|purchase|purity|purpose|purse|push|put|puzzle|pyramid|quality|quantum|quarter|question|quick|quit|quiz|quote|rabbit|raccoon|race|rack|radar|radio|rail|rain|raise|rally|ramp|ranch|random|range|rapid|rare|rate|rather|raven|raw|razor|ready|real|reason|rebel|rebuild|recall|receive|recipe|record|recycle|reduce|reflect|reform|refuse|region|regret|regular|reject|relax|release|relief|rely|remain|remember|remind|remove|render|renew|rent|reopen|repair|repeat|replace|report|require|rescue|resemble|resist|resource|response|result|retire|retreat|return|reunion|reveal|review|reward|rhythm|rib|ribbon|rice|rich|ride|ridge|rifle|right|rigid|ring|riot|ripple|risk|ritual|rival|river|road|roast|robot|robust|rocket|romance|roof|rookie|room|rose|rotate|rough|round|route|royal|rubber|rude|rug|rule|run|runway|rural|sad|saddle|sadness|safe|sail|salad|salmon|salon|salt|salute|same|sample|sand|satisfy|satoshi|sauce|sausage|save|say|scale|scan|scare|scatter|scene|scheme|school|science|scissors|scorpion|scout|scrap|screen|script|scrub|sea|search|season|seat|second|secret|section|security|seed|seek|segment|select|sell|seminar|senior|sense|sentence|series|service|session|settle|setup|seven|shadow|shaft|shallow|share|shed|shell|sheriff|shield|shift|shine|ship|shiver|shock|shoe|shoot|shop|short|shoulder|shove|shrimp|shrug|shuffle|shy|sibling|sick|side|siege|sight|sign|silent|silk|silly|silver|similar|simple|since|sing|siren|sister|situate|six|size|skate|sketch|ski|skill|skin|skirt|skull|slab|slam|sleep|slender|slice|slide|slight|slim|slogan|slot|slow|slush|small|smart|smile|smoke|smooth|snack|snake|snap|sniff|snow|soap|soccer|social|sock|soda|soft|solar|soldier|solid|solution|solve|someone|song|soon|sorry|sort|soul|sound|soup|source|south|space|spare|spatial|spawn|speak|special|speed|spell|spend|sphere|spice|spider|spike|spin|spirit|split|spoil|sponsor|spoon|sport|spot|spray|spread|spring|spy|square|squeeze|squirrel|stable|stadium|staff|stage|stairs|stamp|stand|start|state|stay|steak|steel|stem|step|stereo|stick|still|sting|stock|stomach|stone|stool|story|stove|strategy|street|strike|strong|struggle|student|stuff|stumble|style|subject|submit|subway|success|such|sudden|suffer|sugar|suggest|suit|summer|sun|sunny|sunset|super|supply|supreme|sure|surface|surge|surprise|surround|survey|suspect|sustain|swallow|swamp|swap|swarm|swear|sweet|swift|swim|swing|switch|sword|symbol|symptom|syrup|system|table|tackle|tag|tail|talent|talk|tank|tape|target|task|taste|tattoo|taxi|teach|team|tell|ten|tenant|tennis|tent|term|test|text|thank|that|theme|then|theory|there|they|thing|this|thought|three|thrive|throw|thumb|thunder|ticket|tide|tiger|tilt|timber|time|tiny|tip|tired|tissue|title|toast|tobacco|today|toddler|toe|together|toilet|token|tomato|tomorrow|tone|tongue|tonight|tool|tooth|top|topic|topple|torch|tornado|tortoise|toss|total|tourist|toward|tower|town|toy|track|trade|traffic|tragic|train|transfer|trap|trash|travel|tray|treat|tree|trend|trial|tribe|trick|trigger|trim|trip|trophy|trouble|truck|true|truly|trumpet|trust|truth|try|tube|tuition|tumble|tuna|tunnel|turkey|turn|turtle|twelve|twenty|twice|twin|twist|two|type|typical|ugly|umbrella|unable|unaware|uncle|uncover|under|undo|unfair|unfold|unhappy|uniform|unique|unit|universe|unknown|unlock|until|unusual|unveil|update|upgrade|uphold|upon|upper|upset|urban|urge|usage|use|used|useful|useless|usual|utility|vacant|vacuum|vague|valid|valley|valve|van|vanish|vapor|various|vast|vault|vehicle|velvet|vendor|venture|venue|verb|verify|version|very|vessel|veteran|viable|vibrant|vicious|victory|video|view|village|vintage|violin|virtual|virus|visa|visit|visual|vital|vivid|vocal|voice|void|volcano|volume|vote|voyage|wage|wagon|wait|walk|wall|walnut|want|warfare|warm|warrior|wash|wasp|waste|water|wave|way|wealth|weapon|wear|weasel|weather|web|wedding|weekend|weird|welcome|west|wet|whale|what|wheat|wheel|when|where|whip|whisper|wide|width|wife|wild|will|win|window|wine|wing|wink|winner|winter|wire|wisdom|wise|wish|witness|wolf|woman|wonder|wood|wool|word|work|world|worry|worth|wrap|wreck|wrestle|wrist|write|wrong|yard|year|yellow|you|young|youth|zebra|zero|zone|zoo".split("|"), Be = "Invalid mnemonic", ar = "Invalid entropy", Pt = "Invalid mnemonic checksum";
1039
- function Tt(r) {
946
+ const xr = { 256: Mr }, Ar = xr[256], Ur = "abandon|ability|able|about|above|absent|absorb|abstract|absurd|abuse|access|accident|account|accuse|achieve|acid|acoustic|acquire|across|act|action|actor|actress|actual|adapt|add|addict|address|adjust|admit|adult|advance|advice|aerobic|affair|afford|afraid|again|age|agent|agree|ahead|aim|air|airport|aisle|alarm|album|alcohol|alert|alien|all|alley|allow|almost|alone|alpha|already|also|alter|always|amateur|amazing|among|amount|amused|analyst|anchor|ancient|anger|angle|angry|animal|ankle|announce|annual|another|answer|antenna|antique|anxiety|any|apart|apology|appear|apple|approve|april|arch|arctic|area|arena|argue|arm|armed|armor|army|around|arrange|arrest|arrive|arrow|art|artefact|artist|artwork|ask|aspect|assault|asset|assist|assume|asthma|athlete|atom|attack|attend|attitude|attract|auction|audit|august|aunt|author|auto|autumn|average|avocado|avoid|awake|aware|away|awesome|awful|awkward|axis|baby|bachelor|bacon|badge|bag|balance|balcony|ball|bamboo|banana|banner|bar|barely|bargain|barrel|base|basic|basket|battle|beach|bean|beauty|because|become|beef|before|begin|behave|behind|believe|below|belt|bench|benefit|best|betray|better|between|beyond|bicycle|bid|bike|bind|biology|bird|birth|bitter|black|blade|blame|blanket|blast|bleak|bless|blind|blood|blossom|blouse|blue|blur|blush|board|boat|body|boil|bomb|bone|bonus|book|boost|border|boring|borrow|boss|bottom|bounce|box|boy|bracket|brain|brand|brass|brave|bread|breeze|brick|bridge|brief|bright|bring|brisk|broccoli|broken|bronze|broom|brother|brown|brush|bubble|buddy|budget|buffalo|build|bulb|bulk|bullet|bundle|bunker|burden|burger|burst|bus|business|busy|butter|buyer|buzz|cabbage|cabin|cable|cactus|cage|cake|call|calm|camera|camp|can|canal|cancel|candy|cannon|canoe|canvas|canyon|capable|capital|captain|car|carbon|card|cargo|carpet|carry|cart|case|cash|casino|castle|casual|cat|catalog|catch|category|cattle|caught|cause|caution|cave|ceiling|celery|cement|census|century|cereal|certain|chair|chalk|champion|change|chaos|chapter|charge|chase|chat|cheap|check|cheese|chef|cherry|chest|chicken|chief|child|chimney|choice|choose|chronic|chuckle|chunk|churn|cigar|cinnamon|circle|citizen|city|civil|claim|clap|clarify|claw|clay|clean|clerk|clever|click|client|cliff|climb|clinic|clip|clock|clog|close|cloth|cloud|clown|club|clump|cluster|clutch|coach|coast|coconut|code|coffee|coil|coin|collect|color|column|combine|come|comfort|comic|common|company|concert|conduct|confirm|congress|connect|consider|control|convince|cook|cool|copper|copy|coral|core|corn|correct|cost|cotton|couch|country|couple|course|cousin|cover|coyote|crack|cradle|craft|cram|crane|crash|crater|crawl|crazy|cream|credit|creek|crew|cricket|crime|crisp|critic|crop|cross|crouch|crowd|crucial|cruel|cruise|crumble|crunch|crush|cry|crystal|cube|culture|cup|cupboard|curious|current|curtain|curve|cushion|custom|cute|cycle|dad|damage|damp|dance|danger|daring|dash|daughter|dawn|day|deal|debate|debris|decade|december|decide|decline|decorate|decrease|deer|defense|define|defy|degree|delay|deliver|demand|demise|denial|dentist|deny|depart|depend|deposit|depth|deputy|derive|describe|desert|design|desk|despair|destroy|detail|detect|develop|device|devote|diagram|dial|diamond|diary|dice|diesel|diet|differ|digital|dignity|dilemma|dinner|dinosaur|direct|dirt|disagree|discover|disease|dish|dismiss|disorder|display|distance|divert|divide|divorce|dizzy|doctor|document|dog|doll|dolphin|domain|donate|donkey|donor|door|dose|double|dove|draft|dragon|drama|drastic|draw|dream|dress|drift|drill|drink|drip|drive|drop|drum|dry|duck|dumb|dune|during|dust|dutch|duty|dwarf|dynamic|eager|eagle|early|earn|earth|easily|east|easy|echo|ecology|economy|edge|edit|educate|effort|egg|eight|either|elbow|elder|electric|elegant|element|elephant|elevator|elite|else|embark|embody|embrace|emerge|emotion|employ|empower|empty|enable|enact|end|endless|endorse|enemy|energy|enforce|engage|engine|enhance|enjoy|enlist|enough|enrich|enroll|ensure|enter|entire|entry|envelope|episode|equal|equip|era|erase|erode|erosion|error|erupt|escape|essay|essence|estate|eternal|ethics|evidence|evil|evoke|evolve|exact|example|excess|exchange|excite|exclude|excuse|execute|exercise|exhaust|exhibit|exile|exist|exit|exotic|expand|expect|expire|explain|expose|express|extend|extra|eye|eyebrow|fabric|face|faculty|fade|faint|faith|fall|false|fame|family|famous|fan|fancy|fantasy|farm|fashion|fat|fatal|father|fatigue|fault|favorite|feature|february|federal|fee|feed|feel|female|fence|festival|fetch|fever|few|fiber|fiction|field|figure|file|film|filter|final|find|fine|finger|finish|fire|firm|first|fiscal|fish|fit|fitness|fix|flag|flame|flash|flat|flavor|flee|flight|flip|float|flock|floor|flower|fluid|flush|fly|foam|focus|fog|foil|fold|follow|food|foot|force|forest|forget|fork|fortune|forum|forward|fossil|foster|found|fox|fragile|frame|frequent|fresh|friend|fringe|frog|front|frost|frown|frozen|fruit|fuel|fun|funny|furnace|fury|future|gadget|gain|galaxy|gallery|game|gap|garage|garbage|garden|garlic|garment|gas|gasp|gate|gather|gauge|gaze|general|genius|genre|gentle|genuine|gesture|ghost|giant|gift|giggle|ginger|giraffe|girl|give|glad|glance|glare|glass|glide|glimpse|globe|gloom|glory|glove|glow|glue|goat|goddess|gold|good|goose|gorilla|gospel|gossip|govern|gown|grab|grace|grain|grant|grape|grass|gravity|great|green|grid|grief|grit|grocery|group|grow|grunt|guard|guess|guide|guilt|guitar|gun|gym|habit|hair|half|hammer|hamster|hand|happy|harbor|hard|harsh|harvest|hat|have|hawk|hazard|head|health|heart|heavy|hedgehog|height|hello|helmet|help|hen|hero|hidden|high|hill|hint|hip|hire|history|hobby|hockey|hold|hole|holiday|hollow|home|honey|hood|hope|horn|horror|horse|hospital|host|hotel|hour|hover|hub|huge|human|humble|humor|hundred|hungry|hunt|hurdle|hurry|hurt|husband|hybrid|ice|icon|idea|identify|idle|ignore|ill|illegal|illness|image|imitate|immense|immune|impact|impose|improve|impulse|inch|include|income|increase|index|indicate|indoor|industry|infant|inflict|inform|inhale|inherit|initial|inject|injury|inmate|inner|innocent|input|inquiry|insane|insect|inside|inspire|install|intact|interest|into|invest|invite|involve|iron|island|isolate|issue|item|ivory|jacket|jaguar|jar|jazz|jealous|jeans|jelly|jewel|job|join|joke|journey|joy|judge|juice|jump|jungle|junior|junk|just|kangaroo|keen|keep|ketchup|key|kick|kid|kidney|kind|kingdom|kiss|kit|kitchen|kite|kitten|kiwi|knee|knife|knock|know|lab|label|labor|ladder|lady|lake|lamp|language|laptop|large|later|latin|laugh|laundry|lava|law|lawn|lawsuit|layer|lazy|leader|leaf|learn|leave|lecture|left|leg|legal|legend|leisure|lemon|lend|length|lens|leopard|lesson|letter|level|liar|liberty|library|license|life|lift|light|like|limb|limit|link|lion|liquid|list|little|live|lizard|load|loan|lobster|local|lock|logic|lonely|long|loop|lottery|loud|lounge|love|loyal|lucky|luggage|lumber|lunar|lunch|luxury|lyrics|machine|mad|magic|magnet|maid|mail|main|major|make|mammal|man|manage|mandate|mango|mansion|manual|maple|marble|march|margin|marine|market|marriage|mask|mass|master|match|material|math|matrix|matter|maximum|maze|meadow|mean|measure|meat|mechanic|medal|media|melody|melt|member|memory|mention|menu|mercy|merge|merit|merry|mesh|message|metal|method|middle|midnight|milk|million|mimic|mind|minimum|minor|minute|miracle|mirror|misery|miss|mistake|mix|mixed|mixture|mobile|model|modify|mom|moment|monitor|monkey|monster|month|moon|moral|more|morning|mosquito|mother|motion|motor|mountain|mouse|move|movie|much|muffin|mule|multiply|muscle|museum|mushroom|music|must|mutual|myself|mystery|myth|naive|name|napkin|narrow|nasty|nation|nature|near|neck|need|negative|neglect|neither|nephew|nerve|nest|net|network|neutral|never|news|next|nice|night|noble|noise|nominee|noodle|normal|north|nose|notable|note|nothing|notice|novel|now|nuclear|number|nurse|nut|oak|obey|object|oblige|obscure|observe|obtain|obvious|occur|ocean|october|odor|off|offer|office|often|oil|okay|old|olive|olympic|omit|once|one|onion|online|only|open|opera|opinion|oppose|option|orange|orbit|orchard|order|ordinary|organ|orient|original|orphan|ostrich|other|outdoor|outer|output|outside|oval|oven|over|own|owner|oxygen|oyster|ozone|pact|paddle|page|pair|palace|palm|panda|panel|panic|panther|paper|parade|parent|park|parrot|party|pass|patch|path|patient|patrol|pattern|pause|pave|payment|peace|peanut|pear|peasant|pelican|pen|penalty|pencil|people|pepper|perfect|permit|person|pet|phone|photo|phrase|physical|piano|picnic|picture|piece|pig|pigeon|pill|pilot|pink|pioneer|pipe|pistol|pitch|pizza|place|planet|plastic|plate|play|please|pledge|pluck|plug|plunge|poem|poet|point|polar|pole|police|pond|pony|pool|popular|portion|position|possible|post|potato|pottery|poverty|powder|power|practice|praise|predict|prefer|prepare|present|pretty|prevent|price|pride|primary|print|priority|prison|private|prize|problem|process|produce|profit|program|project|promote|proof|property|prosper|protect|proud|provide|public|pudding|pull|pulp|pulse|pumpkin|punch|pupil|puppy|purchase|purity|purpose|purse|push|put|puzzle|pyramid|quality|quantum|quarter|question|quick|quit|quiz|quote|rabbit|raccoon|race|rack|radar|radio|rail|rain|raise|rally|ramp|ranch|random|range|rapid|rare|rate|rather|raven|raw|razor|ready|real|reason|rebel|rebuild|recall|receive|recipe|record|recycle|reduce|reflect|reform|refuse|region|regret|regular|reject|relax|release|relief|rely|remain|remember|remind|remove|render|renew|rent|reopen|repair|repeat|replace|report|require|rescue|resemble|resist|resource|response|result|retire|retreat|return|reunion|reveal|review|reward|rhythm|rib|ribbon|rice|rich|ride|ridge|rifle|right|rigid|ring|riot|ripple|risk|ritual|rival|river|road|roast|robot|robust|rocket|romance|roof|rookie|room|rose|rotate|rough|round|route|royal|rubber|rude|rug|rule|run|runway|rural|sad|saddle|sadness|safe|sail|salad|salmon|salon|salt|salute|same|sample|sand|satisfy|satoshi|sauce|sausage|save|say|scale|scan|scare|scatter|scene|scheme|school|science|scissors|scorpion|scout|scrap|screen|script|scrub|sea|search|season|seat|second|secret|section|security|seed|seek|segment|select|sell|seminar|senior|sense|sentence|series|service|session|settle|setup|seven|shadow|shaft|shallow|share|shed|shell|sheriff|shield|shift|shine|ship|shiver|shock|shoe|shoot|shop|short|shoulder|shove|shrimp|shrug|shuffle|shy|sibling|sick|side|siege|sight|sign|silent|silk|silly|silver|similar|simple|since|sing|siren|sister|situate|six|size|skate|sketch|ski|skill|skin|skirt|skull|slab|slam|sleep|slender|slice|slide|slight|slim|slogan|slot|slow|slush|small|smart|smile|smoke|smooth|snack|snake|snap|sniff|snow|soap|soccer|social|sock|soda|soft|solar|soldier|solid|solution|solve|someone|song|soon|sorry|sort|soul|sound|soup|source|south|space|spare|spatial|spawn|speak|special|speed|spell|spend|sphere|spice|spider|spike|spin|spirit|split|spoil|sponsor|spoon|sport|spot|spray|spread|spring|spy|square|squeeze|squirrel|stable|stadium|staff|stage|stairs|stamp|stand|start|state|stay|steak|steel|stem|step|stereo|stick|still|sting|stock|stomach|stone|stool|story|stove|strategy|street|strike|strong|struggle|student|stuff|stumble|style|subject|submit|subway|success|such|sudden|suffer|sugar|suggest|suit|summer|sun|sunny|sunset|super|supply|supreme|sure|surface|surge|surprise|surround|survey|suspect|sustain|swallow|swamp|swap|swarm|swear|sweet|swift|swim|swing|switch|sword|symbol|symptom|syrup|system|table|tackle|tag|tail|talent|talk|tank|tape|target|task|taste|tattoo|taxi|teach|team|tell|ten|tenant|tennis|tent|term|test|text|thank|that|theme|then|theory|there|they|thing|this|thought|three|thrive|throw|thumb|thunder|ticket|tide|tiger|tilt|timber|time|tiny|tip|tired|tissue|title|toast|tobacco|today|toddler|toe|together|toilet|token|tomato|tomorrow|tone|tongue|tonight|tool|tooth|top|topic|topple|torch|tornado|tortoise|toss|total|tourist|toward|tower|town|toy|track|trade|traffic|tragic|train|transfer|trap|trash|travel|tray|treat|tree|trend|trial|tribe|trick|trigger|trim|trip|trophy|trouble|truck|true|truly|trumpet|trust|truth|try|tube|tuition|tumble|tuna|tunnel|turkey|turn|turtle|twelve|twenty|twice|twin|twist|two|type|typical|ugly|umbrella|unable|unaware|uncle|uncover|under|undo|unfair|unfold|unhappy|uniform|unique|unit|universe|unknown|unlock|until|unusual|unveil|update|upgrade|uphold|upon|upper|upset|urban|urge|usage|use|used|useful|useless|usual|utility|vacant|vacuum|vague|valid|valley|valve|van|vanish|vapor|various|vast|vault|vehicle|velvet|vendor|venture|venue|verb|verify|version|very|vessel|veteran|viable|vibrant|vicious|victory|video|view|village|vintage|violin|virtual|virus|visa|visit|visual|vital|vivid|vocal|voice|void|volcano|volume|vote|voyage|wage|wagon|wait|walk|wall|walnut|want|warfare|warm|warrior|wash|wasp|waste|water|wave|way|wealth|weapon|wear|weasel|weather|web|wedding|weekend|weird|welcome|west|wet|whale|what|wheat|wheel|when|where|whip|whisper|wide|width|wife|wild|will|win|window|wine|wing|wink|winner|winter|wire|wisdom|wise|wish|witness|wolf|woman|wonder|wood|wool|word|work|world|worry|worth|wrap|wreck|wrestle|wrist|write|wrong|yard|year|yellow|you|young|youth|zebra|zero|zone|zoo".split(
947
+ "|"
948
+ ), Ie = "Invalid mnemonic", Sr = "Invalid entropy", Wt = "Invalid mnemonic checksum";
949
+ function Jt(r) {
1040
950
  return (r || "").normalize("NFKD");
1041
951
  }
1042
- function sr(r) {
952
+ function Br(r) {
1043
953
  return Number.parseInt(r, 2);
1044
954
  }
1045
- function ir(r) {
955
+ function Rr(r) {
1046
956
  return r.map((e) => e.toString(2).padStart(8, "0")).join("");
1047
957
  }
1048
- function cr(r) {
1049
- return ir(Array.from(Nt(r))).slice(0, r.length * 8 / 32);
958
+ function $r(r) {
959
+ return Rr(Array.from(Ar(r))).slice(
960
+ 0,
961
+ r.length * 8 / 32
962
+ );
1050
963
  }
1051
- function ge(r, e = or) {
1052
- const t = Tt(r).split(" ");
964
+ function Nr(r, e = Ur) {
965
+ const t = Jt(r).split(" ");
1053
966
  if (t.length % 3 !== 0)
1054
- throw new Error(Be);
967
+ throw new Error(Ie);
1055
968
  const n = t.map((u) => {
1056
969
  const d = e.indexOf(u);
1057
970
  if (d === -1)
1058
- throw new Error(Be);
971
+ throw new Error(Ie);
1059
972
  return d.toString(2).padStart(11, "0");
1060
- }).join(""), o = Math.floor(n.length / 33) * 32, a = n.slice(0, o), s = n.slice(o), i = a.match(/(.{1,8})/g), l = i == null ? void 0 : i.map(sr);
973
+ }).join(""), o = Math.floor(n.length / 33) * 32, s = n.slice(0, o), i = n.slice(o), a = s.match(/(.{1,8})/g), l = a == null ? void 0 : a.map(Br);
1061
974
  if (!l || l.length % 4 !== 0 || l.length < 16 || l.length > 32)
1062
- throw new Error(ar);
975
+ throw new Error(Sr);
1063
976
  const c = h(l);
1064
- if (cr(c) !== s)
1065
- throw new Error(Pt);
977
+ if ($r(c) !== i)
978
+ throw new Error(Wt);
1066
979
  return c;
1067
980
  }
1068
- function jt(r, e = or) {
981
+ function Zt(r, e = Ur) {
1069
982
  if (r.length % 4 !== 0 || r.length < 16 || r.length > 32)
1070
- throw new Error(ar);
1071
- const t = `${ir(Array.from(r))}${cr(r)}`.match(/(.{1,11})/g), n = t == null ? void 0 : t.map((o) => e[sr(o)]);
983
+ throw new Error(Sr);
984
+ const t = `${Rr(Array.from(r))}${$r(r)}`.match(
985
+ /(.{1,11})/g
986
+ ), n = t == null ? void 0 : t.map((o) => e[Br(o)]);
1072
987
  if (!n || n.length < 12)
1073
988
  throw new Error("Unable to map entropy to mnemonic");
1074
989
  return n.join(" ");
1075
990
  }
1076
- function lr(r, e) {
991
+ function Gt(r, e) {
1077
992
  try {
1078
- ge(r, e);
993
+ Nr(r, e);
1079
994
  } catch {
1080
995
  return !1;
1081
996
  }
1082
997
  return !0;
1083
998
  }
1084
- const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1085
- __proto__: null,
1086
- entropyToMnemonic: jt,
1087
- mnemonicToEntropy: ge,
1088
- validateMnemonic: lr
1089
- }, Symbol.toStringTag, { value: "Module" }));
1090
- function zt(r, e, t) {
1091
- return ge(r, e);
999
+ function Dr(r, e, t) {
1000
+ return Nr(r, e);
1092
1001
  }
1093
- function Ct(r, e) {
1094
- return lr(r, e);
1002
+ function Ir(r, e) {
1003
+ return Gt(r, e);
1095
1004
  }
1096
- function ln(r, e = "", t, n) {
1097
- if (!Ct(r, t))
1005
+ function Xt(r, e = "", t, n) {
1006
+ if (!Ir(r, t))
1098
1007
  throw new Error("Invalid bip39 mnemonic specified");
1099
- const o = zt(r, t), a = q(`mnemonic${e}`);
1100
- return Dt(o, a).password.slice(0, 32);
1008
+ const o = Dr(r, t), s = V(`mnemonic${e}`);
1009
+ return Er(o, s).password.slice(0, 32);
1101
1010
  }
1102
- function un(r, e) {
1011
+ function Qt(r, e) {
1103
1012
  if (![33, 65].includes(r.length))
1104
- throw new Error(`Invalid publicKey provided, received ${r.length} bytes input`);
1105
- return r.length === 33 ? r : Pr.ProjectivePoint.fromHex(r).toRawBytes(!0);
1106
- }
1107
- function ur(r, e, t) {
1108
- const n = h(r), o = h(e), a = h(t);
1109
- if (a.length !== 32)
1013
+ throw new Error(
1014
+ `Invalid publicKey provided, received ${r.length} bytes input`
1015
+ );
1016
+ return r.length === 33 ? r : qr.ProjectivePoint.fromHex(r).toRawBytes(!0);
1017
+ }
1018
+ function ve(r, e, t) {
1019
+ const n = h(r), o = h(e), s = h(t);
1020
+ if (s.length !== 32)
1110
1021
  throw new Error("Invalid publicKey length, expected 32 bytes");
1111
1022
  if (o.length !== 64)
1112
1023
  throw new Error("Invalid signature length, expected 64 bytes");
1113
- return Ut(n, o, a);
1024
+ return qt(n, o, s);
1114
1025
  }
1115
- const Ot = [
1026
+ const en = [
1027
+ //["ecdsa", secp256k1VerifyHasher("blake2")],
1028
+ //["ethereum", secp256k1VerifyHasher("keccak")],
1116
1029
  [
1117
1030
  "ecdsa",
1118
1031
  () => {
@@ -1125,132 +1038,190 @@ const Ot = [
1125
1038
  throw new Error("Not Implemented");
1126
1039
  }
1127
1040
  ]
1128
- ], Lt = [
1041
+ ], rn = [
1042
+ //["ed25519", ed25519Verify],
1129
1043
  [
1130
1044
  "ed25519",
1131
1045
  () => {
1132
1046
  throw new Error("Not Implemented");
1133
1047
  }
1134
1048
  ],
1135
- ["sr25519", ur],
1136
- ...Ot
1137
- ], Ht = [
1049
+ ["sr25519", ve],
1050
+ ...en
1051
+ ], tn = [
1138
1052
  "ed25519",
1139
1053
  "sr25519",
1140
1054
  "ecdsa"
1141
1055
  ];
1142
- function Ft(r, { message: e, publicKey: t, signature: n }, o = Lt) {
1143
- return r.isValid = o.some(([a, s]) => {
1056
+ function nn(r, { message: e, publicKey: t, signature: n }, o = rn) {
1057
+ return r.isValid = o.some(([s, i]) => {
1144
1058
  try {
1145
- if (s(e, n, t))
1146
- return r.crypto = a, !0;
1059
+ if (i(e, n, t))
1060
+ return r.crypto = s, !0;
1147
1061
  } catch {
1148
1062
  }
1149
1063
  return !1;
1150
1064
  }), r;
1151
1065
  }
1152
- function Mt(r, { message: e, publicKey: t, signature: n }) {
1066
+ function on(r, { message: e, publicKey: t, signature: n }) {
1153
1067
  const o = n[0];
1154
1068
  if (o === void 0)
1155
- throw new Error("Invalid signature, expected first byte to indicate crypto type");
1069
+ throw new Error(
1070
+ "Invalid signature, expected first byte to indicate crypto type"
1071
+ );
1156
1072
  if (![0, 1, 2].includes(o))
1157
- throw new Error(`Unknown crypto type, expected signature prefix [0..2], found ${n[0]}`);
1158
- const a = Ht[o];
1159
- if (!a)
1073
+ throw new Error(
1074
+ `Unknown crypto type, expected signature prefix [0..2], found ${n[0]}`
1075
+ );
1076
+ const s = tn[o];
1077
+ if (!s)
1160
1078
  throw new Error(`Unknown crypto type, found ${o}`);
1161
- r.crypto = a;
1079
+ r.crypto = s;
1162
1080
  try {
1163
1081
  r.isValid = {
1164
- sr25519: () => ur(e, n.subarray(1), t),
1082
+ sr25519: () => ve(e, n.subarray(1), t),
1165
1083
  ecdsa: () => !1,
1166
1084
  ethereum: () => !1,
1167
1085
  ed25519: () => !1
1168
- }[a]();
1086
+ }[s]();
1169
1087
  } catch {
1170
1088
  }
1171
1089
  return r;
1172
1090
  }
1173
- function qt(r) {
1091
+ function sn(r) {
1174
1092
  const e = r[0];
1175
- if (!e)
1176
- throw new Error("Invalid signature, expected first byte to indicate crypto type");
1177
- return [0, 1, 2].includes(e) && [65, 66].includes(r.length) ? Mt : Ft;
1093
+ if (e === void 0)
1094
+ throw new Error(
1095
+ "Invalid signature, expected first byte to indicate crypto type"
1096
+ );
1097
+ return [0, 1, 2].includes(e) && [65, 66].includes(r.length) ? on : nn;
1178
1098
  }
1179
- function dn(r, e, t) {
1099
+ function an(r, e, t) {
1180
1100
  const n = h(e);
1181
1101
  if (![64, 65, 66].includes(n.length))
1182
- throw new Error(`Invalid signature length, expected [64..66] bytes, found ${n.length}`);
1183
- const o = Ve(t), a = {
1102
+ throw new Error(
1103
+ `Invalid signature length, expected [64..66] bytes, found ${n.length}`
1104
+ );
1105
+ const o = ge(t), s = {
1184
1106
  message: h(r),
1185
1107
  publicKey: o,
1186
1108
  signature: n
1187
- }, s = {
1109
+ }, i = {
1188
1110
  crypto: "none",
1189
1111
  isValid: !1,
1190
- isWrapped: ye(a.message, !0),
1112
+ isWrapped: Ue(s.message, !0),
1191
1113
  publicKey: o
1192
- }, i = ye(a.message, !1), l = qt(n);
1193
- return l(s, a), s.crypto !== "none" || s.isWrapped && !i ? s : (a.message = i ? Er(a.message) : xr(a.message), l(s, a));
1114
+ }, a = Ue(s.message, !1), l = sn(n);
1115
+ return l(i, s), i.crypto !== "none" || i.isWrapped && !a ? i : (s.message = a ? rt(s.message) : tt(s.message), l(i, s));
1194
1116
  }
1195
- function hn(r) {
1117
+ function cn(r) {
1196
1118
  const e = h(r);
1197
1119
  if (e.length !== 32)
1198
1120
  throw new Error(`Expected a seed of 32 bytes, found ${e.length}`);
1199
- const t = Qe(e), n = A(t.subarray(0, 32)) >> 3n, o = g.BASE.multiply(n).toRawBytes();
1121
+ const t = pr(e), n = S(t.subarray(0, 32)) >> 3n, o = g.BASE.multiply(n).toRawBytes();
1200
1122
  return {
1201
1123
  publicKey: new Uint8Array(o),
1202
1124
  secretKey: new Uint8Array(t)
1203
1125
  };
1204
1126
  }
1205
- function fn(r, { publicKey: e, secretKey: t }) {
1127
+ function ln(r, { publicKey: e, secretKey: t }) {
1206
1128
  const n = typeof r == "string" ? new TextEncoder().encode(r) : r, o = h(t);
1207
1129
  if (o.length !== 64)
1208
- throw new Error(`Expected secretKey to be 64 bytes, found ${o.length}`);
1209
- return At(o, n);
1210
- }
1211
- const _e = new Uint8Array();
1212
- function pn(r, { secretKey: e }, t = _e, n = _e) {
1213
- const o = h(r), a = h(e), s = h(t), i = h(n);
1214
- if (a.length !== 64)
1130
+ throw new Error(
1131
+ `Expected secretKey to be 64 bytes, found ${o.length}`
1132
+ );
1133
+ return Mt(o, n);
1134
+ }
1135
+ const Pe = new Uint8Array();
1136
+ function un(r, { secretKey: e }, t = Pe, n = Pe) {
1137
+ const o = h(r), s = h(e), i = h(t), a = h(n);
1138
+ if (s.length !== 64)
1215
1139
  throw new Error("Invalid secretKey length, expected 64 bytes");
1216
- return tr.sign(o, a, s, i);
1140
+ return yr.sign(o, s, i, a);
1217
1141
  }
1218
- const Re = new Uint8Array();
1219
- function gn(r, e, t, n = Re, o = Re) {
1220
- const a = h(r), s = h(e), i = h(t), l = h(n), c = h(o);
1221
- if (i.length !== 32)
1142
+ const je = new Uint8Array();
1143
+ function dn(r, e, t, n = je, o = je) {
1144
+ const s = h(r), i = h(e), a = h(t), l = h(n), c = h(o);
1145
+ if (a.length !== 32)
1222
1146
  throw new Error("Invalid publicKey length, expected 32 bytes");
1223
- if (s.length !== 96)
1147
+ if (i.length !== 96)
1224
1148
  throw new Error("Invalid vrfSign output length, expected 96 bytes");
1225
- return tr.verify(a, s, i, l, c);
1226
- }
1149
+ return yr.verify(
1150
+ s,
1151
+ i,
1152
+ a,
1153
+ l,
1154
+ c
1155
+ );
1156
+ }
1157
+ const mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1158
+ __proto__: null,
1159
+ ENCODING: ye,
1160
+ ENCODING_NONE: ir,
1161
+ ENCODING_VERSION: cr,
1162
+ NONCE_LENGTH: le,
1163
+ SCRYPT_LENGTH: lr,
1164
+ base58Decode: Je,
1165
+ base58Encode: Ze,
1166
+ base58Validate: We,
1167
+ base64Decode: yt,
1168
+ base64Encode: er,
1169
+ base64Validate: Qe,
1170
+ blake2AsHex: ft,
1171
+ blake2AsU8a: K,
1172
+ decodeAddress: ge,
1173
+ encodeAddress: mt,
1174
+ entropyToMnemonic: Zt,
1175
+ jsonDecryptData: jt,
1176
+ jsonEncryptFormat: Tt,
1177
+ keyExtractPath: ur,
1178
+ keyExtractSuri: Ht,
1179
+ keyFromPath: Yt,
1180
+ keyHdkdSr25519: kr,
1181
+ mnemonicToEntropy: Dr,
1182
+ mnemonicToMiniSecret: Xt,
1183
+ mnemonicValidate: Ir,
1184
+ naclDecrypt: or,
1185
+ naclEncrypt: Dt,
1186
+ pbkdf2Encode: Er,
1187
+ randomAsHex: Nt,
1188
+ randomAsU8a: _,
1189
+ scryptEncode: sr,
1190
+ scryptFromU8a: ar,
1191
+ scryptToU8a: Pt,
1192
+ secp256k1Compress: Qt,
1193
+ sha256AsU8a: Ar,
1194
+ shaAsU8a: xr,
1195
+ signatureVerify: an,
1196
+ sr25519DeriveHard: br,
1197
+ sr25519DeriveSoft: vr,
1198
+ sr25519FromSeed: cn,
1199
+ sr25519Sign: ln,
1200
+ sr25519Verify: ve,
1201
+ sr25519VrfSign: un,
1202
+ sr25519VrfVerify: dn
1203
+ }, Symbol.toStringTag, { value: "Module" }));
1227
1204
  export {
1228
- cn as A,
1229
- _,
1230
- Qt as a,
1231
- Wt as b,
1232
- rn as c,
1233
- gn as d,
1234
- pn as e,
1235
- dn as f,
1236
- un as g,
1237
- fn as h,
1238
- sn as i,
1239
- en as j,
1240
- vt as k,
1241
- hn as l,
1242
- Ve as m,
1243
- Xt as n,
1244
- Jt as o,
1245
- Ee as p,
1246
- Gt as q,
1247
- an as r,
1248
- dt as s,
1249
- ln as t,
1250
- ut as u,
1251
- Zt as v,
1252
- tn as w,
1253
- ke as x,
1254
- nn as y,
1255
- on as z
1205
+ Pt as a,
1206
+ ft as b,
1207
+ Tt as c,
1208
+ dn as d,
1209
+ un as e,
1210
+ an as f,
1211
+ Qt as g,
1212
+ ln as h,
1213
+ Yt as i,
1214
+ jt as j,
1215
+ ur as k,
1216
+ cn as l,
1217
+ ge as m,
1218
+ Dt as n,
1219
+ mt as o,
1220
+ yt as p,
1221
+ Ht as q,
1222
+ Xt as r,
1223
+ sr as s,
1224
+ $t as t,
1225
+ Nt as u,
1226
+ mn as v
1256
1227
  };