@prosopo/procaptcha-bundle 0.3.5 → 0.3.37

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,16 @@
1
- import { A as f, P as I, j as n, C as W, W as _, a as C, c as k, e as P, f as R, g as O, i as G, L as H, k as U, m as L, n as j, l as F, d as B, r as b } from "./index-HgeMtpKw.js";
2
- import { B as K, u as M, n as q, h as w, l as X, w as $, t as z, q as J, A as Q, W as V, K as Y, x as Z, C as ee, m as D, y as te, z as ne } from "./utils-CfklpKIj.js";
1
+ import { A as p, P as I, j as n, C as W, W as _, a as C, c as k, e as P, f as R, g as O, i as G, L as H, k as U, m as L, n as j, l as F, d as B, r as b } from "./index-ChKfVXCq.js";
2
+ import { B as K, u as M, p as q, h as w, m as X, w as $, t as z, q as J, A as Q, W as V, K as Y, x as Z, C as ee, n as D, y as te, z as ne } from "./utils-C0DFj2UN.js";
3
3
  const oe = (a, e) => {
4
4
  let o = 0;
5
5
  const c = "0".repeat(e);
6
6
  for (; ; ) {
7
- const d = new TextEncoder().encode(o + a);
8
- if (ae(K(d)).startsWith(c))
7
+ const l = new TextEncoder().encode(o + a);
8
+ if (ae(K(l)).startsWith(c))
9
9
  return o;
10
10
  o += 1;
11
11
  }
12
12
  }, ae = (a) => Array.from(a).map((e) => e.toString(16).padStart(2, "0")).join(""), re = (a, e, o, c) => {
13
- const d = () => ({
13
+ const l = () => ({
14
14
  showModal: !1,
15
15
  loading: !1,
16
16
  index: 0,
@@ -20,14 +20,14 @@ const oe = (a, e) => {
20
20
  captchaApi: void 0,
21
21
  account: void 0
22
22
  }), r = () => {
23
- window.clearTimeout(e.timeout), u({ timeout: void 0 });
23
+ window.clearTimeout(e.timeout), d({ timeout: void 0 });
24
24
  }, i = () => {
25
25
  const t = {
26
26
  userAccountAddress: "",
27
27
  ...a
28
28
  };
29
29
  return I.parse(t);
30
- }, p = (t) => {
30
+ }, f = (t) => {
31
31
  const s = t.networks[t.defaultNetwork];
32
32
  if (!s)
33
33
  throw new w("DEVELOPER.NETWORK_NOT_FOUND", {
@@ -35,7 +35,7 @@ const oe = (a, e) => {
35
35
  });
36
36
  return s;
37
37
  }, A = async () => {
38
- const t = p(i()), s = await Q.create({
38
+ const t = f(i()), s = await Q.create({
39
39
  provider: new V(t.endpoint),
40
40
  initWasm: !1,
41
41
  noInitWarn: !0
@@ -45,41 +45,42 @@ const oe = (a, e) => {
45
45
  if (!e.account)
46
46
  throw new w("GENERAL.ACCOUNT_NOT_FOUND", { context: { error: "Account not loaded" } });
47
47
  return e.account;
48
- }, l = () => {
48
+ }, u = () => {
49
49
  if (!e.dappAccount)
50
50
  throw new w("GENERAL.SITE_KEY_MISSING");
51
51
  return e.dappAccount;
52
- }, u = D(e, o), N = () => {
53
- r(), u(d());
52
+ }, d = D(e, o), N = () => {
53
+ r(), d(l());
54
54
  };
55
55
  return {
56
56
  start: async () => {
57
57
  if (e.loading || e.isHuman)
58
58
  return;
59
- N();
59
+ N(), d({
60
+ loading: !0
61
+ });
60
62
  const t = i(), s = new M(), h = t.userAccountAddress || (await s.getAccount(t)).account.address;
61
- if (u({
62
- loading: !0,
63
+ if (d({
63
64
  account: { account: { address: h } }
64
- }), u({ dappAccount: t.account.address }), await q(100), !t.web2 && !t.userAccountAddress)
65
+ }), d({ dappAccount: t.account.address }), await q(100), !t.web2 && !t.userAccountAddress)
65
66
  throw new w("GENERAL.ACCOUNT_NOT_FOUND", {
66
67
  context: { error: "Account address has not been set for web3 mode" }
67
68
  });
68
- const m = await A(), S = X(o, e, c), v = await $(m.query.getRandomActiveProvider, m.query)(h, l()), y = z(v.provider.url.toString()), E = new J(p(i()), y, l()), g = await E.getPowCaptchaChallenge(h, l()), T = oe(g.challenge, g.difficulty);
69
- (await E.submitPowCaptchaSolution(g, x().account.address, l(), v, T))[f.verified] && (u({
69
+ const m = await A(), S = X(o, e, c), v = await $(m.query.getRandomActiveProvider, m.query)(h, u()), y = z(v.provider.url.toString()), E = new J(f(i()), y, u()), g = await E.getPowCaptchaChallenge(h, u()), T = oe(g.challenge, g.difficulty);
70
+ (await E.submitPowCaptchaSolution(g, x().account.address, u(), v, T))[p.verified] && (d({
70
71
  isHuman: !0,
71
72
  loading: !1
72
73
  }), S.onHuman({
73
74
  providerUrl: y,
74
- [f.user]: x().account.address,
75
- [f.dapp]: l(),
76
- [f.challenge]: g.challenge,
77
- [f.blockNumber]: v.blockNumber
75
+ [p.user]: x().account.address,
76
+ [p.dapp]: u(),
77
+ [p.challenge]: g.challenge,
78
+ [p.blockNumber]: v.blockNumber
78
79
  }));
79
80
  }
80
81
  };
81
82
  }, le = (a) => {
82
- const e = a.config, o = e.theme === "light" ? "light" : "dark", c = a.config.theme === "light" ? F : B, d = a.callbacks || {}, [r, i] = te(b.useState, b.useRef), p = D(r, i), A = re(e, r, p, d);
83
+ const e = a.config, o = e.theme === "light" ? "light" : "dark", c = a.config.theme === "light" ? F : B, l = a.callbacks || {}, [r, i] = te(b.useState, b.useRef), f = D(r, i), A = re(e, r, f, l);
83
84
  return n("div", { children: n("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: n(W, { children: n(_, { children: C("div", { style: k, "data-cy": "button-human", children: [" ", C("div", { style: {
84
85
  padding: P,
85
86
  border: R,