@prosopo/procaptcha-bundle 2.2.3 → 2.3.1

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.
@@ -1,16 +1,18 @@
1
- import { G as L, p as O, f as m, i as k, n as U, A as r, m as M, o as j, E as F, r as h, q as B, j as n, W as X, C as K, s as Y, a as G, t as q, v as V, w as $, x as z, y as J, L as Q, B as Z, D as ee, F as ne, l as te, d as ae } from "./index-B27PXNfK.js";
2
- import { g as H, b as P, a as oe, s as se, E as re, u as ce, c as ie, C as le } from "./Checkbox-DM6n1-r-.js";
1
+ import { p as L, P as h, g as k, a as O, A as r, e as U, b as M, r as f, i as j, j as n, W as F, C as B, c as X, d as G, f as K, h as Y, k as q, l as V, m as $, L as z, n as J, o as Q, q as Z, s as ee, t as ne } from "./index-43V4q4_w.js";
2
+ import { g as H, b as P, s as te, a as ae, u as oe, c as se, C as re } from "./Checkbox-1g4X-3Qk.js";
3
+ import { s as ce } from "./sha256-CxfeEiTA.js";
4
+ import { ExtensionWeb2 as ie, ExtensionWeb3 as le } from "./index-Cks8mtaG.js";
3
5
  const ue = (c, e) => {
4
6
  let t = 0;
5
7
  const l = "0".repeat(e);
6
8
  for (; ; ) {
7
9
  const a = new TextEncoder().encode(t + c);
8
- if (de(L(a)).startsWith(l))
10
+ if (de(ce(a)).startsWith(l))
9
11
  return t;
10
12
  t += 1;
11
13
  }
12
14
  }, de = (c) => Array.from(c).map((e) => e.toString(16).padStart(2, "0")).join(""), ge = (c, e, t, l, a) => {
13
- const d = H(t, e, l), w = () => ({
15
+ const u = H(t, e, l), w = () => ({
14
16
  showModal: !1,
15
17
  loading: !1,
16
18
  index: 0,
@@ -19,77 +21,77 @@ const ue = (c, e) => {
19
21
  isHuman: !1,
20
22
  captchaApi: void 0,
21
23
  account: void 0
22
- }), u = () => {
24
+ }), d = () => {
23
25
  window.clearTimeout(Number(e.timeout)), s({ timeout: void 0 });
24
- }, x = () => {
26
+ }, A = () => {
25
27
  window.clearTimeout(Number(e.successfullChallengeTimeout)), s({ successfullChallengeTimeout: void 0 });
26
28
  }, p = () => {
27
29
  const o = {
28
30
  userAccountAddress: "",
29
31
  ...c
30
32
  };
31
- return e.account && (o.userAccountAddress = e.account.account.address), j.parse(o);
32
- }, f = () => {
33
+ return e.account && (o.userAccountAddress = e.account.account.address), M.parse(o);
34
+ }, m = () => {
33
35
  if (!e.account)
34
- throw new m("GENERAL.ACCOUNT_NOT_FOUND", {
36
+ throw new h("GENERAL.ACCOUNT_NOT_FOUND", {
35
37
  context: { error: "Account not loaded" }
36
38
  });
37
39
  return { account: e.account };
38
40
  }, g = () => {
39
41
  if (!e.dappAccount)
40
- throw new m("GENERAL.SITE_KEY_MISSING");
42
+ throw new h("GENERAL.SITE_KEY_MISSING");
41
43
  return e.dappAccount;
42
- }, s = P(e, t), A = () => {
43
- u(), x(), s(w()), d.onReset();
44
+ }, s = P(e, t), x = () => {
45
+ d(), A(), s(w()), u.onReset();
44
46
  }, S = () => {
45
- const o = p().captchas.pow.solutionTimeout, b = setTimeout(() => {
46
- s({ isHuman: !1 }), d.onExpired();
47
+ const o = p().captchas.pow.solutionTimeout, y = setTimeout(() => {
48
+ s({ isHuman: !1 }), u.onExpired();
47
49
  }, o);
48
- s({ successfullChallengeTimeout: b });
49
- }, y = async () => {
50
- await O(async () => {
50
+ s({ successfullChallengeTimeout: y });
51
+ }, b = async () => {
52
+ await L(async () => {
51
53
  var N;
52
54
  if (e.loading || e.isHuman)
53
55
  return;
54
- A(), s({
56
+ x(), s({
55
57
  loading: !0
56
58
  }), s({ attemptCount: e.attemptCount + 1 });
57
- const o = p(), D = await (async () => a ? a.userAccount : await (o.web2 ? new F() : new re()).getAccount(o))(), v = D.account.address;
59
+ const o = p(), I = await (async () => a ? a.userAccount : await (o.web2 ? new ie() : new le()).getAccount(o))(), v = I.account.address;
58
60
  if (s({
59
61
  account: { account: { address: v } }
60
- }), s({ dappAccount: o.account.address }), await oe(100), !o.web2 && !o.userAccountAddress)
61
- throw new m("GENERAL.ACCOUNT_NOT_FOUND", {
62
+ }), s({ dappAccount: o.account.address }), await te(100), !o.web2 && !o.userAccountAddress)
63
+ throw new h("GENERAL.ACCOUNT_NOT_FOUND", {
62
64
  context: {
63
65
  error: "Account address has not been set for web3 mode"
64
66
  }
65
67
  });
66
68
  let T;
67
69
  a != null && a.provider ? T = a.provider : T = await k(p());
68
- const I = H(t, e, l), R = T.provider.url, _ = new U(R, g()), i = await _.getPowCaptchaChallenge(v, g(), a == null ? void 0 : a.sessionId);
70
+ const D = H(t, e, l), R = T.provider.url, _ = new O(R, g()), i = await _.getPowCaptchaChallenge(v, g(), a == null ? void 0 : a.sessionId);
69
71
  if (i.error)
70
72
  s({
71
73
  loading: !1,
72
74
  error: i.error.message
73
75
  });
74
76
  else {
75
- const E = ue(i.challenge, i.difficulty), C = (N = D.extension) == null ? void 0 : N.signer;
77
+ const E = ue(i.challenge, i.difficulty), C = (N = I.extension) == null ? void 0 : N.signer;
76
78
  if (!C || !C.signRaw)
77
- throw new m("GENERAL.CANT_FIND_KEYRINGPAIR", {
79
+ throw new h("GENERAL.CANT_FIND_KEYRINGPAIR", {
78
80
  context: {
79
81
  error: "Signer is not defined, cannot sign message to prove account ownership"
80
82
  }
81
83
  });
82
84
  const W = await C.signRaw({
83
85
  address: v,
84
- data: se(i[r.timestamp].toString()),
86
+ data: ae(i[r.timestamp].toString()),
85
87
  type: "bytes"
86
88
  });
87
- (await _.submitPowCaptchaSolution(i, f().account.account.address, g(), E, W.signature.toString(), o.captchas.pow.verifiedTimeout))[r.verified] ? (s({
89
+ (await _.submitPowCaptchaSolution(i, m().account.account.address, g(), E, W.signature.toString(), o.captchas.pow.verifiedTimeout))[r.verified] ? (s({
88
90
  isHuman: !0,
89
91
  loading: !1
90
- }), I.onHuman(M({
92
+ }), D.onHuman(U({
91
93
  [r.providerUrl]: R,
92
- [r.user]: f().account.account.address,
94
+ [r.user]: m().account.account.address,
93
95
  [r.dapp]: g(),
94
96
  [r.challenge]: i.challenge,
95
97
  [r.nonce]: E,
@@ -103,33 +105,34 @@ const ue = (c, e) => {
103
105
  })), S()) : (s({
104
106
  isHuman: !1,
105
107
  loading: !1
106
- }), I.onFailed());
108
+ }), D.onFailed());
107
109
  }
108
- }, y, A, e.attemptCount, 10);
110
+ }, b, x, e.attemptCount, 10);
109
111
  };
110
112
  return {
111
- start: y,
112
- resetState: A
113
+ start: b,
114
+ resetState: x
113
115
  };
114
- }, me = (c) => {
115
- const { t: e } = ce(), t = c.config, l = t.theme === "light" ? "light" : "dark", a = c.frictionlessState, d = c.config.theme === "light" ? te : ae, w = c.callbacks || {}, [u, x] = ie(h.useState, h.useRef), p = P(u, x), f = h.useRef(ge(t, u, p, w, a)), g = h.useRef(null);
116
- return h.useEffect(() => {
117
- t.language && B.changeLanguage(t.language);
116
+ }, Ae = (c) => {
117
+ const { t: e } = oe(), t = c.config, l = t.theme === "light" ? "light" : "dark", a = c.frictionlessState, u = c.config.theme === "light" ? ee : ne, w = c.callbacks || {}, [d, A] = se(f.useState, f.useRef), p = P(d, A), m = f.useRef(ge(t, d, p, w, a)), g = f.useRef(null);
118
+ return f.useEffect(() => {
119
+ t.language && j.changeLanguage(t.language);
118
120
  }, [t.language]), n("div", { ref: g, children: n("div", { style: {
119
- maxWidth: X,
121
+ maxWidth: F,
120
122
  maxHeight: "100%",
121
- overflowX: "auto"
122
- }, children: n(K, { children: n(Y, { children: G("div", { style: q, "data-cy": "button-human", children: [" ", G("div", { style: {
123
- padding: V,
124
- border: $,
125
- backgroundColor: d.palette.background.default,
126
- borderColor: d.palette.grey[300],
127
- borderRadius: z,
123
+ overflowX: "auto",
124
+ ...u.font
125
+ }, children: n(B, { children: n(X, { children: G("div", { style: K, "data-cy": "button-human", children: [" ", G("div", { style: {
126
+ padding: Y,
127
+ border: q,
128
+ backgroundColor: u.palette.background.default,
129
+ borderColor: u.palette.grey[300],
130
+ borderRadius: V,
128
131
  display: "flex",
129
132
  alignItems: "center",
130
133
  flexWrap: "wrap",
131
134
  justifyContent: "space-between",
132
- minHeight: `${J}px`,
135
+ minHeight: `${$}px`,
133
136
  overflow: "hidden"
134
137
  }, children: [n("div", { style: { display: "inline-flex", flexDirection: "column" }, children: n("div", { style: {
135
138
  display: "flex",
@@ -144,8 +147,8 @@ const ue = (c, e) => {
144
147
  verticalAlign: "middle"
145
148
  }, children: n("div", { style: {
146
149
  display: "flex"
147
- }, children: n("div", { style: { flex: 1 }, children: u.loading ? n(Q, { themeColor: l, "aria-label": "Loading spinner" }) : n(le, { checked: u.isHuman, onChange: f.current.start, themeColor: l, labelText: e("WIDGET.I_AM_HUMAN"), error: u.error, "aria-label": "human checkbox" }) }) }) }) }) }), n("div", { style: { display: "inline-flex", flexDirection: "column" }, children: n("a", { href: Z, target: "_blank", "aria-label": ee, children: n("div", { style: { flex: 1 }, children: n(ne, { themeColor: l, "aria-label": "Prosopo logo" }) }) }) })] })] }) }) }) }) });
150
+ }, children: n("div", { style: { flex: 1 }, children: d.loading ? n(z, { themeColor: l, "aria-label": "Loading spinner" }) : n(re, { checked: d.isHuman, onChange: m.current.start, themeColor: l, labelText: e("WIDGET.I_AM_HUMAN"), error: d.error, "aria-label": "human checkbox" }) }) }) }) }) }), n("div", { style: { display: "inline-flex", flexDirection: "column" }, children: n("a", { href: J, target: "_blank", "aria-label": Q, children: n("div", { style: { flex: 1 }, children: n(Z, { themeColor: l, "aria-label": "Prosopo logo" }) }) }) })] })] }) }) }) }) });
148
151
  };
149
152
  export {
150
- me as default
153
+ Ae as default
151
154
  };
@@ -0,0 +1,23 @@
1
+ let e, n = 0;
2
+ class i {
3
+ constructor(s) {
4
+ e = s;
5
+ }
6
+ async signPayload(s) {
7
+ const t = ++n;
8
+ return {
9
+ ...await e("pub(extrinsic.sign)", s),
10
+ id: t
11
+ };
12
+ }
13
+ async signRaw(s) {
14
+ const t = ++n;
15
+ return {
16
+ ...await e("pub(bytes.sign)", s),
17
+ id: t
18
+ };
19
+ }
20
+ }
21
+ export {
22
+ i as default
23
+ };
@@ -0,0 +1,9 @@
1
+ import { c as r, g as e } from "./hash-B8OCn-ev.js";
2
+ function n(a = 32) {
3
+ return e(new Uint8Array(a));
4
+ }
5
+ const o = /* @__PURE__ */ r(n);
6
+ export {
7
+ o as a,
8
+ n as r
9
+ };
@@ -0,0 +1,259 @@
1
+ import { H as X, s as Z } from "./sha256-CxfeEiTA.js";
2
+ import { H as ee, h as O, t as F, e as T, b as te, u as t, w as ae, d as re, n as C, a as se, f as q, i as ie, j as oe, p as ne, k as ce, l as le, s as de, m as he, q as G } from "./hash-B8OCn-ev.js";
3
+ import { r as ue } from "./asU8a-DDBcjges.js";
4
+ class P extends ee {
5
+ constructor(e, o) {
6
+ super(), this.finished = !1, this.destroyed = !1, O(e);
7
+ const a = F(o);
8
+ if (this.iHash = e.create(), typeof this.iHash.update != "function")
9
+ throw new Error("Expected instance of class which extends utils.Hash");
10
+ this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
11
+ const s = this.blockLen, i = new Uint8Array(s);
12
+ i.set(a.length > s ? e.create().update(a).digest() : a);
13
+ for (let n = 0; n < i.length; n++)
14
+ i[n] ^= 54;
15
+ this.iHash.update(i), this.oHash = e.create();
16
+ for (let n = 0; n < i.length; n++)
17
+ i[n] ^= 106;
18
+ this.oHash.update(i), i.fill(0);
19
+ }
20
+ update(e) {
21
+ return T(this), this.iHash.update(e), this;
22
+ }
23
+ digestInto(e) {
24
+ T(this), te(e, this.outputLen), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
25
+ }
26
+ digest() {
27
+ const e = new Uint8Array(this.oHash.outputLen);
28
+ return this.digestInto(e), e;
29
+ }
30
+ _cloneInto(e) {
31
+ e || (e = Object.create(Object.getPrototypeOf(this), {}));
32
+ const { oHash: o, iHash: a, finished: s, destroyed: i, blockLen: n, outputLen: c } = this;
33
+ return e = e, e.finished = s, e.destroyed = i, e.blockLen = n, e.outputLen = c, e.oHash = o._cloneInto(e.oHash), e.iHash = a._cloneInto(e.iHash), e;
34
+ }
35
+ destroy() {
36
+ this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
37
+ }
38
+ }
39
+ const K = (r, e, o) => new P(r, e).update(o).digest();
40
+ K.create = (r, e) => new P(r, e);
41
+ const [pe, be] = t.split([
42
+ "0x428a2f98d728ae22",
43
+ "0x7137449123ef65cd",
44
+ "0xb5c0fbcfec4d3b2f",
45
+ "0xe9b5dba58189dbbc",
46
+ "0x3956c25bf348b538",
47
+ "0x59f111f1b605d019",
48
+ "0x923f82a4af194f9b",
49
+ "0xab1c5ed5da6d8118",
50
+ "0xd807aa98a3030242",
51
+ "0x12835b0145706fbe",
52
+ "0x243185be4ee4b28c",
53
+ "0x550c7dc3d5ffb4e2",
54
+ "0x72be5d74f27b896f",
55
+ "0x80deb1fe3b1696b1",
56
+ "0x9bdc06a725c71235",
57
+ "0xc19bf174cf692694",
58
+ "0xe49b69c19ef14ad2",
59
+ "0xefbe4786384f25e3",
60
+ "0x0fc19dc68b8cd5b5",
61
+ "0x240ca1cc77ac9c65",
62
+ "0x2de92c6f592b0275",
63
+ "0x4a7484aa6ea6e483",
64
+ "0x5cb0a9dcbd41fbd4",
65
+ "0x76f988da831153b5",
66
+ "0x983e5152ee66dfab",
67
+ "0xa831c66d2db43210",
68
+ "0xb00327c898fb213f",
69
+ "0xbf597fc7beef0ee4",
70
+ "0xc6e00bf33da88fc2",
71
+ "0xd5a79147930aa725",
72
+ "0x06ca6351e003826f",
73
+ "0x142929670a0e6e70",
74
+ "0x27b70a8546d22ffc",
75
+ "0x2e1b21385c26c926",
76
+ "0x4d2c6dfc5ac42aed",
77
+ "0x53380d139d95b3df",
78
+ "0x650a73548baf63de",
79
+ "0x766a0abb3c77b2a8",
80
+ "0x81c2c92e47edaee6",
81
+ "0x92722c851482353b",
82
+ "0xa2bfe8a14cf10364",
83
+ "0xa81a664bbc423001",
84
+ "0xc24b8b70d0f89791",
85
+ "0xc76c51a30654be30",
86
+ "0xd192e819d6ef5218",
87
+ "0xd69906245565a910",
88
+ "0xf40e35855771202a",
89
+ "0x106aa07032bbd1b8",
90
+ "0x19a4c116b8d2d0c8",
91
+ "0x1e376c085141ab53",
92
+ "0x2748774cdf8eeb99",
93
+ "0x34b0bcb5e19b48a8",
94
+ "0x391c0cb3c5c95a63",
95
+ "0x4ed8aa4ae3418acb",
96
+ "0x5b9cca4f7763e373",
97
+ "0x682e6ff3d6b2b8a3",
98
+ "0x748f82ee5defb2fc",
99
+ "0x78a5636f43172f60",
100
+ "0x84c87814a1f0ab72",
101
+ "0x8cc702081a6439ec",
102
+ "0x90befffa23631e28",
103
+ "0xa4506cebde82bde9",
104
+ "0xbef9a3f7b2c67915",
105
+ "0xc67178f2e372532b",
106
+ "0xca273eceea26619c",
107
+ "0xd186b8c721c0c207",
108
+ "0xeada7dd6cde0eb1e",
109
+ "0xf57d4f7fee6ed178",
110
+ "0x06f067aa72176fba",
111
+ "0x0a637dc5a2c898a6",
112
+ "0x113f9804bef90dae",
113
+ "0x1b710b35131c471b",
114
+ "0x28db77f523047d84",
115
+ "0x32caab7b40c72493",
116
+ "0x3c9ebe0a15c9bebc",
117
+ "0x431d67c49c100d4c",
118
+ "0x4cc5d4becb3e42b6",
119
+ "0x597f299cfc657e2a",
120
+ "0x5fcb6fab3ad6faec",
121
+ "0x6c44198c4a475817"
122
+ ].map((r) => BigInt(r))), A = /* @__PURE__ */ new Uint32Array(80), L = /* @__PURE__ */ new Uint32Array(80);
123
+ class fe extends X {
124
+ constructor() {
125
+ super(128, 64, 16, !1), this.Ah = 1779033703, this.Al = -205731576, this.Bh = -1150833019, this.Bl = -2067093701, this.Ch = 1013904242, this.Cl = -23791573, this.Dh = -1521486534, this.Dl = 1595750129, this.Eh = 1359893119, this.El = -1377402159, this.Fh = -1694144372, this.Fl = 725511199, this.Gh = 528734635, this.Gl = -79577749, this.Hh = 1541459225, this.Hl = 327033209;
126
+ }
127
+ // prettier-ignore
128
+ get() {
129
+ const { Ah: e, Al: o, Bh: a, Bl: s, Ch: i, Cl: n, Dh: c, Dl: u, Eh: p, El: b, Fh: d, Fl: l, Gh: g, Gl: f, Hh: m, Hl: y } = this;
130
+ return [e, o, a, s, i, n, c, u, p, b, d, l, g, f, m, y];
131
+ }
132
+ // prettier-ignore
133
+ set(e, o, a, s, i, n, c, u, p, b, d, l, g, f, m, y) {
134
+ this.Ah = e | 0, this.Al = o | 0, this.Bh = a | 0, this.Bl = s | 0, this.Ch = i | 0, this.Cl = n | 0, this.Dh = c | 0, this.Dl = u | 0, this.Eh = p | 0, this.El = b | 0, this.Fh = d | 0, this.Fl = l | 0, this.Gh = g | 0, this.Gl = f | 0, this.Hh = m | 0, this.Hl = y | 0;
135
+ }
136
+ process(e, o) {
137
+ for (let h = 0; h < 16; h++, o += 4)
138
+ A[h] = e.getUint32(o), L[h] = e.getUint32(o += 4);
139
+ for (let h = 16; h < 80; h++) {
140
+ const k = A[h - 15] | 0, H = L[h - 15] | 0, B = t.rotrSH(k, H, 1) ^ t.rotrSH(k, H, 8) ^ t.shrSH(k, H, 7), E = t.rotrSL(k, H, 1) ^ t.rotrSL(k, H, 8) ^ t.shrSL(k, H, 7), w = A[h - 2] | 0, v = L[h - 2] | 0, j = t.rotrSH(w, v, 19) ^ t.rotrBH(w, v, 61) ^ t.shrSH(w, v, 6), I = t.rotrSL(w, v, 19) ^ t.rotrBL(w, v, 61) ^ t.shrSL(w, v, 6), z = t.add4L(E, I, L[h - 7], L[h - 16]), D = t.add4H(z, B, j, A[h - 7], A[h - 16]);
141
+ A[h] = D | 0, L[h] = z | 0;
142
+ }
143
+ let { Ah: a, Al: s, Bh: i, Bl: n, Ch: c, Cl: u, Dh: p, Dl: b, Eh: d, El: l, Fh: g, Fl: f, Gh: m, Gl: y, Hh: x, Hl: S } = this;
144
+ for (let h = 0; h < 80; h++) {
145
+ const k = t.rotrSH(d, l, 14) ^ t.rotrSH(d, l, 18) ^ t.rotrBH(d, l, 41), H = t.rotrSL(d, l, 14) ^ t.rotrSL(d, l, 18) ^ t.rotrBL(d, l, 41), B = d & g ^ ~d & m, E = l & f ^ ~l & y, w = t.add5L(S, H, E, be[h], L[h]), v = t.add5H(w, x, k, B, pe[h], A[h]), j = w | 0, I = t.rotrSH(a, s, 28) ^ t.rotrBH(a, s, 34) ^ t.rotrBH(a, s, 39), z = t.rotrSL(a, s, 28) ^ t.rotrBL(a, s, 34) ^ t.rotrBL(a, s, 39), D = a & i ^ a & c ^ i & c, Q = s & n ^ s & u ^ n & u;
146
+ x = m | 0, S = y | 0, m = g | 0, y = f | 0, g = d | 0, f = l | 0, { h: d, l } = t.add(p | 0, b | 0, v | 0, j | 0), p = c | 0, b = u | 0, c = i | 0, u = n | 0, i = a | 0, n = s | 0;
147
+ const U = t.add3L(j, z, Q);
148
+ a = t.add3H(U, v, I, D), s = U | 0;
149
+ }
150
+ ({ h: a, l: s } = t.add(this.Ah | 0, this.Al | 0, a | 0, s | 0)), { h: i, l: n } = t.add(this.Bh | 0, this.Bl | 0, i | 0, n | 0), { h: c, l: u } = t.add(this.Ch | 0, this.Cl | 0, c | 0, u | 0), { h: p, l: b } = t.add(this.Dh | 0, this.Dl | 0, p | 0, b | 0), { h: d, l } = t.add(this.Eh | 0, this.El | 0, d | 0, l | 0), { h: g, l: f } = t.add(this.Fh | 0, this.Fl | 0, g | 0, f | 0), { h: m, l: y } = t.add(this.Gh | 0, this.Gl | 0, m | 0, y | 0), { h: x, l: S } = t.add(this.Hh | 0, this.Hl | 0, x | 0, S | 0), this.set(a, s, i, n, c, u, p, b, d, l, g, f, m, y, x, S);
151
+ }
152
+ roundClean() {
153
+ A.fill(0), L.fill(0);
154
+ }
155
+ destroy() {
156
+ this.buffer.fill(0), this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
157
+ }
158
+ }
159
+ const N = /* @__PURE__ */ ae(() => new fe());
160
+ function me(r, e, o, a) {
161
+ O(r);
162
+ const s = re({ dkLen: 32, asyncTick: 10 }, a), { c: i, dkLen: n, asyncTick: c } = s;
163
+ if (C(i), C(n), C(c), i < 1)
164
+ throw new Error("PBKDF2: iterations (c) should be >= 1");
165
+ const u = F(e), p = F(o), b = new Uint8Array(n), d = K.create(r, u), l = d._cloneInto().update(p);
166
+ return { c: i, dkLen: n, asyncTick: c, DK: b, PRF: d, PRFSalt: l };
167
+ }
168
+ function ge(r, e, o, a, s) {
169
+ return r.destroy(), e.destroy(), a && a.destroy(), s.fill(0), o;
170
+ }
171
+ function ye(r, e, o, a) {
172
+ const { c: s, dkLen: i, DK: n, PRF: c, PRFSalt: u } = me(r, e, o, a);
173
+ let p;
174
+ const b = new Uint8Array(4), d = se(b), l = new Uint8Array(c.outputLen);
175
+ for (let g = 1, f = 0; f < i; g++, f += c.outputLen) {
176
+ const m = n.subarray(f, f + c.outputLen);
177
+ d.setInt32(0, g, !1), (p = u._cloneInto(p)).update(b).digestInto(l), m.set(l.subarray(0, m.length));
178
+ for (let y = 1; y < s; y++) {
179
+ c._cloneInto(p).update(l).digestInto(l);
180
+ for (let x = 0; x < m.length; x++)
181
+ m[x] ^= l[x];
182
+ }
183
+ }
184
+ return ge(c, u, n, p, l);
185
+ }
186
+ function xe(r, e = ue(), o = 2048, a) {
187
+ const s = q(r), i = q(e);
188
+ return {
189
+ password: !ie || oe() ? ne(s, i, o) : ye(N, s, i, { c: o, dkLen: 64 }),
190
+ rounds: o,
191
+ salt: e
192
+ };
193
+ }
194
+ const we = /* @__PURE__ */ le({ 256: de, 512: he }, { 256: Z, 512: N }), ve = /* @__PURE__ */ ce(256, we), R = "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("|"), M = "Invalid mnemonic", W = "Invalid entropy", ke = "Invalid mnemonic checksum";
195
+ function _(r) {
196
+ return (r || "").normalize("NFKD");
197
+ }
198
+ function V(r) {
199
+ return parseInt(r, 2);
200
+ }
201
+ function J(r) {
202
+ return r.map((e) => e.toString(2).padStart(8, "0")).join("");
203
+ }
204
+ function $(r) {
205
+ return J(Array.from(ve(r))).slice(0, r.length * 8 / 32);
206
+ }
207
+ function He(r, e) {
208
+ return xe(G(_(r)), G(`mnemonic${_(e)}`)).password;
209
+ }
210
+ function Y(r, e = R) {
211
+ const o = _(r).split(" ");
212
+ if (o.length % 3 !== 0)
213
+ throw new Error(M);
214
+ const a = o.map((b) => {
215
+ const d = e.indexOf(b);
216
+ if (d === -1)
217
+ throw new Error(M);
218
+ return d.toString(2).padStart(11, "0");
219
+ }).join(""), s = Math.floor(a.length / 33) * 32, i = a.slice(0, s), n = a.slice(s), c = i.match(/(.{1,8})/g), u = c == null ? void 0 : c.map(V);
220
+ if (!u || u.length % 4 !== 0 || u.length < 16 || u.length > 32)
221
+ throw new Error(W);
222
+ const p = q(u);
223
+ if ($(p) !== n)
224
+ throw new Error(ke);
225
+ return p;
226
+ }
227
+ function Ae(r, e = R) {
228
+ if (r.length % 4 !== 0 || r.length < 16 || r.length > 32)
229
+ throw new Error(W);
230
+ const o = `${J(Array.from(r))}${$(r)}`.match(/(.{1,11})/g), a = o == null ? void 0 : o.map((s) => e[V(s)]);
231
+ if (!a || a.length < 12)
232
+ throw new Error("Unable to map entropy to mnemonic");
233
+ return a.join(" ");
234
+ }
235
+ function Le(r, e) {
236
+ try {
237
+ Y(r, e);
238
+ } catch {
239
+ return !1;
240
+ }
241
+ return !0;
242
+ }
243
+ const Be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
244
+ __proto__: null,
245
+ entropyToMnemonic: Ae,
246
+ mnemonicToEntropy: Y,
247
+ mnemonicToSeedSync: He,
248
+ validateMnemonic: Le
249
+ }, Symbol.toStringTag, { value: "Module" }));
250
+ export {
251
+ He as a,
252
+ ye as b,
253
+ Be as c,
254
+ K as h,
255
+ Y as m,
256
+ xe as p,
257
+ N as s,
258
+ Le as v
259
+ };