@prosopo/procaptcha-bundle 2.0.0 → 2.0.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,9 +1,9 @@
1
- import { r as m, z, a as C, e as he, A as v, P as se, l as U, d as $, j as d, b as A, R as fe, C as ge, W as me, c as be, f as xe, g as ye, h as Ce, i as we, L as Ae, k as ve, m as Te, n as Ie } from "./index-jr-ls0GZ.js";
2
- import { u as Ee, h as Se, _ as Ne, a as Pe, b as ke, I as Oe, R as Re, g as De, c as Le, d as He, i as _e, e as J, P as T, f as S, j as _, s as ce, k as Me, l as We, m as Ge, n as je, r as ze, o as Be, E as Ue, p as $e, q as Fe, t as Ke, C as Ve } from "./utils-CHbJaqXT.js";
3
- function Xe(t) {
4
- return Ee(Se(t));
1
+ import { r as m, z, a as C, e as he, A as v, P as se, l as U, d as $, j as d, b as A, R as fe, W as ge, C as me, c as be, f as xe, g as ye, h as Ce, i as we, k as Ae, L as ve, m as Te, n as Ie, o as Ee } from "./index-DvT5XLGE.js";
2
+ import { u as Se, h as Ne, _ as Pe, a as ke, b as Oe, I as De, R as Re, g as Le, c as _e, d as He, i as Me, e as J, P as T, f as S, j as H, s as ce, k as We, l as Ge, m as je, n as ze, r as Be, o as Ue, E as $e, p as Fe, q as Ke, t as Ve, C as Xe } from "./utils-nH-g73b2.js";
3
+ function Ye(t) {
4
+ return Se(Ne(t));
5
5
  }
6
- function Ye() {
6
+ function Je() {
7
7
  if (console && console.warn) {
8
8
  for (var t, e = arguments.length, n = new Array(e), o = 0; o < e; o++)
9
9
  n[o] = arguments[o];
@@ -14,7 +14,7 @@ var te = {};
14
14
  function q() {
15
15
  for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
16
16
  e[n] = arguments[n];
17
- typeof e[0] == "string" && te[e[0]] || (typeof e[0] == "string" && (te[e[0]] = /* @__PURE__ */ new Date()), Ye.apply(void 0, e));
17
+ typeof e[0] == "string" && te[e[0]] || (typeof e[0] == "string" && (te[e[0]] = /* @__PURE__ */ new Date()), Je.apply(void 0, e));
18
18
  }
19
19
  function ne(t, e, n) {
20
20
  t.loadNamespaces(e, function() {
@@ -30,7 +30,7 @@ function ne(t, e, n) {
30
30
  }
31
31
  });
32
32
  }
33
- function Je(t, e) {
33
+ function qe(t, e) {
34
34
  var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, o = e.languages[0], a = e.options ? e.options.fallbackLng : !1, r = e.languages[e.languages.length - 1];
35
35
  if (o.toLowerCase() === "cimode") return !0;
36
36
  var i = function(s, h) {
@@ -39,7 +39,7 @@ function Je(t, e) {
39
39
  };
40
40
  return n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && e.services.backendConnector.backend && e.isLanguageChangingTo && !i(e.isLanguageChangingTo, t) ? !1 : !!(e.hasResourceBundle(o, t) || !e.services.backendConnector.backend || e.options.resources && !e.options.partialBundledLanguages || i(o, t) && (!a || i(r, t)));
41
41
  }
42
- function qe(t, e) {
42
+ function Ze(t, e) {
43
43
  var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
44
44
  if (!e.languages || !e.languages.length)
45
45
  return q("i18n.languages were undefined or empty", e.languages), !0;
@@ -48,9 +48,9 @@ function qe(t, e) {
48
48
  precheck: function(r, i) {
49
49
  if (n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && r.services.backendConnector.backend && r.isLanguageChangingTo && !i(r.isLanguageChangingTo, t)) return !1;
50
50
  }
51
- }) : Je(t, e, n);
51
+ }) : qe(t, e, n);
52
52
  }
53
- function Ze(t, e) {
53
+ function Qe(t, e) {
54
54
  var n = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
55
55
  if (n != null) {
56
56
  var o, a, r, i, l = [], s = !0, h = !1;
@@ -68,8 +68,8 @@ function Ze(t, e) {
68
68
  return l;
69
69
  }
70
70
  }
71
- function Qe(t, e) {
72
- return Ne(t) || Ze(t, e) || Pe(t, e) || ke();
71
+ function et(t, e) {
72
+ return Pe(t) || Qe(t, e) || ke(t, e) || Oe();
73
73
  }
74
74
  function oe(t, e) {
75
75
  var n = Object.keys(t);
@@ -85,21 +85,21 @@ function V(t) {
85
85
  for (var e = 1; e < arguments.length; e++) {
86
86
  var n = arguments[e] != null ? arguments[e] : {};
87
87
  e % 2 ? oe(Object(n), !0).forEach(function(o) {
88
- Le(t, o, n[o]);
88
+ _e(t, o, n[o]);
89
89
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : oe(Object(n)).forEach(function(o) {
90
90
  Object.defineProperty(t, o, Object.getOwnPropertyDescriptor(n, o));
91
91
  });
92
92
  }
93
93
  return t;
94
94
  }
95
- var et = function(e, n) {
95
+ var tt = function(e, n) {
96
96
  var o = m.useRef();
97
97
  return m.useEffect(function() {
98
98
  o.current = e;
99
99
  }, [e, n]), o.current;
100
100
  };
101
- function tt(t) {
102
- var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = e.i18n, o = m.useContext(Oe) || {}, a = o.i18n, r = n || a || He();
101
+ function nt(t) {
102
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = e.i18n, o = m.useContext(De) || {}, a = o.i18n, r = n || a || He();
103
103
  if (r && !r.reportNamespaces && (r.reportNamespaces = new Re()), !r) {
104
104
  q("You will need to pass in an i18next instance by using initReactI18next");
105
105
  var i = function(u) {
@@ -108,20 +108,20 @@ function tt(t) {
108
108
  return l.t = i, l.i18n = {}, l.ready = !1, l;
109
109
  }
110
110
  r.options.react && r.options.react.wait !== void 0 && q("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
111
- var s = V(V(V({}, De()), r.options.react), e), h = s.useSuspense, b = s.keyPrefix, p = t;
111
+ var s = V(V(V({}, Le()), r.options.react), e), h = s.useSuspense, b = s.keyPrefix, p = t;
112
112
  p = typeof p == "string" ? [p] : p || ["translation"], r.reportNamespaces.addUsedNamespaces && r.reportNamespaces.addUsedNamespaces(p);
113
113
  var f = (r.isInitialized || r.initializedStoreOnce) && p.every(function(c) {
114
- return qe(c, r, s);
114
+ return Ze(c, r, s);
115
115
  });
116
116
  function y() {
117
117
  return r.getFixedT(null, s.nsMode === "fallback" ? p : p[0], b);
118
118
  }
119
- var w = m.useState(y), O = Qe(w, 2), M = O[0], N = O[1], L = p.join(), R = et(L), I = m.useRef(!0);
119
+ var w = m.useState(y), O = et(w, 2), M = O[0], N = O[1], L = p.join(), D = tt(L), I = m.useRef(!0);
120
120
  m.useEffect(function() {
121
121
  var c = s.bindI18n, u = s.bindI18nStore;
122
122
  I.current = !0, !f && !h && ne(r, p, function() {
123
123
  I.current && N(y);
124
- }), f && R && R !== L && I.current && N(y);
124
+ }), f && D && D !== L && I.current && N(y);
125
125
  function g() {
126
126
  I.current && N(y);
127
127
  }
@@ -145,10 +145,10 @@ function tt(t) {
145
145
  });
146
146
  });
147
147
  }
148
- function nt(t) {
149
- return tt("translation", { i18n: _e, ...t });
148
+ function ot(t) {
149
+ return nt("translation", { i18n: Me, ...t });
150
150
  }
151
- const ot = (t) => Array.isArray(t) && t !== null, B = new Array(256), le = new Array(256 * 256);
151
+ const rt = (t) => Array.isArray(t) && t !== null, B = new Array(256), le = new Array(256 * 256);
152
152
  for (let t = 0; t < 256; t++)
153
153
  B[t] = t.toString(16).padStart(2, "0");
154
154
  for (let t = 0; t < 256; t++) {
@@ -162,7 +162,7 @@ function X(t, e) {
162
162
  e += le[t[a] << 8 | t[a + 1]];
163
163
  return n && (e += B[t[o] | 0]), e;
164
164
  }
165
- function rt(t, e = -1, n = !0) {
165
+ function at(t, e = -1, n = !0) {
166
166
  const o = n ? "0x" : "";
167
167
  if (!(t != null && t.length))
168
168
  return o;
@@ -173,12 +173,12 @@ function rt(t, e = -1, n = !0) {
173
173
  }
174
174
  return X(t, o);
175
175
  }
176
- const at = (t) => ot(t) ? rt(new Uint8Array(t)) : t.toString(), de = z.object({
176
+ const it = (t) => rt(t) ? at(new Uint8Array(t)) : t.toString(), de = z.object({
177
177
  account: z.string().optional(),
178
178
  blockNumber: z.number().optional(),
179
179
  providerUrl: z.string().optional()
180
180
  });
181
- function it(t) {
181
+ function st(t) {
182
182
  return J([
183
183
  t.captchaId,
184
184
  t.captchaContentId,
@@ -191,7 +191,7 @@ class re {
191
191
  this.hash = e, this.parent = null;
192
192
  }
193
193
  }
194
- class st {
194
+ class ct {
195
195
  constructor() {
196
196
  this.leaves = [], this.layers = [];
197
197
  }
@@ -259,7 +259,7 @@ class st {
259
259
  return [...n, [C(a, 0)]];
260
260
  }
261
261
  }
262
- class ct {
262
+ class lt {
263
263
  constructor(e, n, o, a, r, i) {
264
264
  this.userAccount = e, this.contract = n, this.provider = o, this.providerApi = a, this._web2 = r, this.dappAccount = i;
265
265
  }
@@ -280,9 +280,9 @@ class ct {
280
280
  }
281
281
  }
282
282
  async submitCaptchaSolution(e, n, o, a, r, i) {
283
- const l = new st(), s = o.map((w) => it(w));
283
+ const l = new ct(), s = o.map((w) => st(w));
284
284
  if (l.build(s), !l.root)
285
- throw new _("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
285
+ throw new H("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
286
286
  context: { error: "Merkle tree root is undefined" }
287
287
  });
288
288
  const h = l.root.hash, b = void 0;
@@ -302,7 +302,7 @@ class ct {
302
302
  try {
303
303
  f = await this.providerApi.submitCaptchaSolution(o, n, this.userAccount, a, r, i, p);
304
304
  } catch (w) {
305
- throw new _("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
305
+ throw new H("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
306
306
  context: { error: w }
307
307
  });
308
308
  }
@@ -311,23 +311,23 @@ class ct {
311
311
  }
312
312
  const ue = "@prosopo/procaptcha";
313
313
  function Q() {
314
- return de.parse(JSON.parse(Xe(localStorage.getItem(ue) || "0x7b7d")));
314
+ return de.parse(JSON.parse(Ye(localStorage.getItem(ue) || "0x7b7d")));
315
315
  }
316
316
  function pe(t) {
317
317
  localStorage.setItem(ue, ce(JSON.stringify(de.parse(t))));
318
318
  }
319
- function lt(t) {
319
+ function dt(t) {
320
320
  pe({ ...Q(), account: t });
321
321
  }
322
- function dt() {
322
+ function ut() {
323
323
  return Q().account || null;
324
324
  }
325
325
  const Y = {
326
- setAccount: lt,
327
- getAccount: dt,
326
+ setAccount: dt,
327
+ getAccount: ut,
328
328
  setProcaptchaStorage: pe,
329
329
  getProcaptchaStorage: Q
330
- }, ut = () => ({
330
+ }, pt = () => ({
331
331
  showModal: !1,
332
332
  loading: !1,
333
333
  index: 0,
@@ -345,8 +345,8 @@ const Y = {
345
345
  }
346
346
  });
347
347
  return e;
348
- }, pt = (t) => {
349
- const e = (a, r) => Math.floor(Math.random() * (r - a + 1) + a), n = Fe(t.defaultEnvironment), o = C(n, e(0, n.length - 1));
348
+ }, ht = (t) => {
349
+ const e = (a, r) => Math.floor(Math.random() * (r - a + 1) + a), n = Ke(t.defaultEnvironment), o = C(n, e(0, n.length - 1));
350
350
  return {
351
351
  providerAccount: o.address,
352
352
  provider: {
@@ -357,11 +357,11 @@ const Y = {
357
357
  blockNumber: 0
358
358
  };
359
359
  };
360
- function ht(t, e, n, o) {
361
- const a = Me(n, e, o), r = (c) => {
360
+ function ft(t, e, n, o) {
361
+ const a = We(n, e, o), r = (c) => {
362
362
  const u = c instanceof Error ? c : new Error(String(c));
363
363
  a.onError(u);
364
- }, i = We(e, n), l = () => {
364
+ }, i = Ge(e, n), l = () => {
365
365
  const c = {
366
366
  userAccountAddress: "",
367
367
  ...t
@@ -377,15 +377,15 @@ function ht(t, e, n, o) {
377
377
  a.onOpen(), await s(async () => {
378
378
  if (e.loading || e.isHuman)
379
379
  return;
380
- await Ge(), N(), i({ loading: !0 });
380
+ await je(), N(), i({ loading: !0 });
381
381
  const c = l();
382
- i({ dappAccount: c.account.address }), await je(100);
383
- const u = await L(), g = ae(c).contract.address, x = pt(l()), G = x.blockNumber, F = x.provider.url, ee = await w(F), D = new ct(u.account.address, g, x, ee, c.web2, c.account.address || "");
384
- i({ captchaApi: D });
385
- const E = await D.getCaptchaChallenge();
382
+ i({ dappAccount: c.account.address }), await ze(100);
383
+ const u = await L(), g = ae(c).contract.address, x = ht(l()), G = x.blockNumber, F = x.provider.url, ee = await w(F), R = new lt(u.account.address, g, x, ee, c.web2, c.account.address || "");
384
+ i({ captchaApi: R });
385
+ const E = await R.getCaptchaChallenge();
386
386
  if (E.captchas.length <= 0)
387
- throw new _("DEVELOPER.PROVIDER_NO_CAPTCHA");
388
- const j = E.captchas.map((H) => H.timeLimitMs || c.captchas.image.challengeTimeout).reduce((H, K) => H + K), k = setTimeout(() => {
387
+ throw new H("DEVELOPER.PROVIDER_NO_CAPTCHA");
388
+ const j = E.captchas.map((_) => _.timeLimitMs || c.captchas.image.challengeTimeout).reduce((_, K) => _ + K), k = setTimeout(() => {
389
389
  a.onChallengeExpired(), i({ isHuman: !1, showModal: !1, loading: !1 });
390
390
  }, j);
391
391
  i({
@@ -404,31 +404,31 @@ function ht(t, e, n, o) {
404
404
  context: { error: "Cannot submit, no Captcha found in state" }
405
405
  });
406
406
  i({ showModal: !1 });
407
- const c = e.challenge, u = ze(), g = e.challenge.captchas.map((k, H) => {
408
- const K = C(e.solutions, H);
407
+ const c = e.challenge, u = Be(), g = e.challenge.captchas.map((k, _) => {
408
+ const K = C(e.solutions, _);
409
409
  return {
410
410
  captchaId: k.captchaId,
411
411
  captchaContentId: k.captchaContentId,
412
412
  salt: u,
413
413
  solution: K
414
414
  };
415
- }), x = R(), G = W(), F = P(x).signer;
415
+ }), x = D(), G = W(), F = P(x).signer;
416
416
  if (!C(c.captchas, 0).datasetId)
417
- throw new _("CAPTCHA.INVALID_CAPTCHA_ID", {
417
+ throw new H("CAPTCHA.INVALID_CAPTCHA_ID", {
418
418
  context: { error: "No datasetId set for challenge" }
419
419
  });
420
- const D = e.captchaApi;
421
- if (!D)
420
+ const R = e.captchaApi;
421
+ if (!R)
422
422
  throw new T("CAPTCHA.INVALID_TOKEN", {
423
423
  context: { error: "No Captcha API found in state" }
424
424
  });
425
- const E = await D.submitCaptchaSolution(F, c.requestHash, g, u, c.timestamp, c.signature.provider.timestamp), j = E[0].verified;
425
+ const E = await R.submitCaptchaSolution(F, c.requestHash, g, u, c.timestamp, c.signature.provider.timestamp), j = E[0].verified;
426
426
  if (j || a.onFailed(), i({
427
427
  submission: E,
428
428
  isHuman: j,
429
429
  loading: !1
430
430
  }), e.isHuman) {
431
- const k = D.provider.provider.url;
431
+ const k = R.provider.provider.url;
432
432
  Y.setProcaptchaStorage({
433
433
  ...Y.getProcaptchaStorage(),
434
434
  providerUrl: k,
@@ -437,7 +437,7 @@ function ht(t, e, n, o) {
437
437
  [v.providerUrl]: k,
438
438
  [v.user]: x.account.address,
439
439
  [v.dapp]: I(),
440
- [v.commitmentId]: at(E[1]),
440
+ [v.commitmentId]: it(E[1]),
441
441
  [v.blockNumber]: G,
442
442
  [v.timestamp]: c.timestamp,
443
443
  [v.signature]: {
@@ -479,7 +479,7 @@ function ht(t, e, n, o) {
479
479
  const u = l(), g = ae(u);
480
480
  if (!u.account.address)
481
481
  throw new S("GENERAL.SITE_KEY_MISSING");
482
- return new Be(g, c, u.account.address);
482
+ return new Ue(g, c, u.account.address);
483
483
  }, O = () => {
484
484
  window.clearTimeout(e.timeout), i({ timeout: void 0 });
485
485
  }, M = () => {
@@ -488,16 +488,16 @@ function ht(t, e, n, o) {
488
488
  }, c);
489
489
  i({ successfullChallengeTimeout: u });
490
490
  }, N = () => {
491
- O(), i(ut());
491
+ O(), i(pt());
492
492
  }, L = async () => {
493
493
  const c = l();
494
494
  if (!c.web2 && !c.userAccountAddress)
495
495
  throw new S("GENERAL.ACCOUNT_NOT_FOUND", {
496
496
  context: { error: "Account address has not been set for web3 mode" }
497
497
  });
498
- const g = await (c.web2 ? new Ue() : new $e()).getAccount(c);
499
- return Y.setAccount(g.account.address), i({ account: g }), R();
500
- }, R = () => {
498
+ const g = await (c.web2 ? new $e() : new Fe()).getAccount(c);
499
+ return Y.setAccount(g.account.address), i({ account: g }), D();
500
+ }, D = () => {
501
501
  if (!e.account)
502
502
  throw new S("GENERAL.ACCOUNT_NOT_FOUND", {
503
503
  context: { error: "Account not loaded" }
@@ -508,7 +508,7 @@ function ht(t, e, n, o) {
508
508
  throw new S("GENERAL.SITE_KEY_MISSING");
509
509
  return e.dappAccount;
510
510
  }, W = () => e.blockNumber || 0, P = (c) => {
511
- const u = c || R();
511
+ const u = c || D();
512
512
  if (!u.extension)
513
513
  throw new S("ACCOUNT.NO_POLKADOT_EXTENSION", {
514
514
  context: { error: "Extension not loaded" }
@@ -523,13 +523,13 @@ function ht(t, e, n, o) {
523
523
  nextRound: y
524
524
  };
525
525
  }
526
- const ft = (t) => {
526
+ const gt = (t) => {
527
527
  if (!t.hash)
528
- throw new _("CAPTCHA.MISSING_ITEM_HASH", {
528
+ throw new H("CAPTCHA.MISSING_ITEM_HASH", {
529
529
  context: { item: t }
530
530
  });
531
531
  return t.hash;
532
- }, gt = ({ challenge: t, solution: e, onClick: n, themeColor: o }) => {
532
+ }, mt = ({ challenge: t, solution: e, onClick: n, themeColor: o }) => {
533
533
  const a = t.items, r = m.useMemo(() => o === "light" ? U : $, [o]), i = "ontouchstart" in window, l = `${r.spacing.unit}px`, s = `${r.spacing.half}px`, h = {
534
534
  0: {
535
535
  paddingLeft: 0,
@@ -562,7 +562,7 @@ const ft = (t) => {
562
562
  flexDirection: "row",
563
563
  flexWrap: "wrap"
564
564
  }, children: a.map((p, f) => {
565
- const y = ft(p), w = {
565
+ const y = gt(p), w = {
566
566
  ...h[f % 3],
567
567
  ...b[Math.floor(f / 3)],
568
568
  flexGrow: 1,
@@ -615,15 +615,15 @@ const ft = (t) => {
615
615
  }, focusable: "false", color: "#fff", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "CheckIcon", "aria-label": "Check icon", children: d("path", { d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" }) }) }) })] }) }, p.hash);
616
616
  }) });
617
617
  };
618
- function mt(t = {}) {
618
+ function bt(t = {}) {
619
619
  return Object.keys(t).reduce((e, n) => ({ ...e, [`data-${n}`]: t[n] }), {});
620
620
  }
621
621
  function Z({ general: t, dev: e }) {
622
622
  return {
623
- ...mt(t)
623
+ ...bt(t)
624
624
  };
625
625
  }
626
- const bt = {
626
+ const xt = {
627
627
  display: "inline-flex",
628
628
  alignItems: "center",
629
629
  justifyContent: "center",
@@ -652,7 +652,7 @@ const bt = {
652
652
  }, ie = ({ themeColor: t, buttonType: e, text: n, onClick: o }) => {
653
653
  const a = m.useMemo(() => t === "light" ? U : $, [t]), [r, i] = m.useState(!1), l = m.useMemo(() => {
654
654
  const s = {
655
- ...bt,
655
+ ...xt,
656
656
  color: r ? a.palette.primary.contrastText : a.palette.background.contrastText
657
657
  };
658
658
  return e === "cancel" ? {
@@ -666,8 +666,8 @@ const bt = {
666
666
  return d("button", { ...Z({ dev: { cy: `button-${e}` } }), onMouseEnter: () => i(!0), onMouseLeave: () => i(!1), style: l, onClick: (s) => {
667
667
  s.preventDefault(), o();
668
668
  }, "aria-label": n, children: n });
669
- }, xt = ({ challenge: t, index: e, solutions: n, onSubmit: o, onCancel: a, onClick: r, onNext: i, themeColor: l }) => {
670
- const { t: s } = nt(), h = t.captchas ? C(t.captchas, e) : null, b = n ? C(n, e) : [], p = m.useMemo(() => l === "light" ? U : $, [l]);
669
+ }, yt = ({ challenge: t, index: e, solutions: n, onSubmit: o, onCancel: a, onClick: r, onNext: i, themeColor: l }) => {
670
+ const { t: s } = ot(), h = t.captchas ? C(t.captchas, e) : null, b = n ? C(n, e) : [], p = m.useMemo(() => l === "light" ? U : $, [l]);
671
671
  return d(m.Suspense, { fallback: d("div", { children: "Loading..." }), children: d("div", { style: {
672
672
  overflowX: "auto",
673
673
  overflowY: "auto",
@@ -705,7 +705,7 @@ const bt = {
705
705
  fontWeight: 500,
706
706
  lineHeight: 0.8,
707
707
  fontSize: "0.8rem"
708
- }, children: s("WIDGET.IF_NONE_CLICK_NEXT") })] }) }) }), d("div", { ...Z({ dev: { cy: `captcha-${e}` } }), children: h && d(gt, { challenge: h, solution: b, onClick: r, themeColor: l }) }), d("div", { style: {
708
+ }, children: s("WIDGET.IF_NONE_CLICK_NEXT") })] }) }) }), d("div", { ...Z({ dev: { cy: `captcha-${e}` } }), children: h && d(mt, { challenge: h, solution: b, onClick: r, themeColor: l }) }), d("div", { style: {
709
709
  display: "flex",
710
710
  alignItems: "center",
711
711
  justifyContent: "center",
@@ -721,7 +721,7 @@ const bt = {
721
721
  justifyContent: "space-between",
722
722
  lineHeight: 1.75
723
723
  }, children: [d(ie, { themeColor: l, buttonType: "cancel", onClick: a, text: s("WIDGET.CANCEL"), "aria-label": s("WIDGET.CANCEL") }), d(ie, { themeColor: l, buttonType: "next", text: e < t.captchas.length - 1 ? s("WIDGET.NEXT") : s("WIDGET.SUBMIT"), onClick: e < t.captchas.length - 1 ? i : o, "aria-label": e < t.captchas.length - 1 ? s("WIDGET.NEXT") : s("WIDGET.SUBMIT"), "data-cy": "button-next" })] })] }) }) });
724
- }, yt = fe.memo((t, e) => {
724
+ }, Ct = fe.memo((t, e) => {
725
725
  const { show: n, children: o } = t, r = {
726
726
  position: "fixed",
727
727
  zIndex: 2147483646,
@@ -749,19 +749,23 @@ const bt = {
749
749
  boxShadow: "rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px,"
750
750
  };
751
751
  return A("div", { className: "modalOuter", style: r, children: [d("div", { className: "modalBackground", style: i }), d("div", { className: "modalInner", style: l, children: o })] });
752
- }), At = (t) => {
753
- const e = se.parse(t.config), n = t.callbacks || {}, [o, a] = Ke(m.useState, m.useRef), r = ht(e, o, a, n), i = t.config.theme === "light" ? "light" : "dark", l = t.config.theme === "light" ? U : $;
754
- return d("div", { children: A("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: [d(yt, { show: o.showModal, children: o.challenge ? d(xt, { challenge: o.challenge, index: o.index, solutions: o.solutions, onSubmit: r.submit, onCancel: r.cancel, onClick: r.select, onNext: r.nextRound, themeColor: e.theme ?? "light" }) : d("div", { children: "No challenge set." }) }), d(ge, { children: d(me, { children: A("div", { style: be, "data-cy": "button-human", children: [" ", A("div", { style: {
755
- padding: xe,
756
- border: ye,
752
+ }), vt = (t) => {
753
+ const e = se.parse(t.config), n = t.callbacks || {}, [o, a] = Ve(m.useState, m.useRef), r = ft(e, o, a, n), i = t.config.theme === "light" ? "light" : "dark", l = t.config.theme === "light" ? U : $;
754
+ return d("div", { children: A("div", { style: {
755
+ maxWidth: ge,
756
+ maxHeight: "100%",
757
+ overflowX: "auto"
758
+ }, children: [d(Ct, { show: o.showModal, children: o.challenge ? d(yt, { challenge: o.challenge, index: o.index, solutions: o.solutions, onSubmit: r.submit, onCancel: r.cancel, onClick: r.select, onNext: r.nextRound, themeColor: e.theme ?? "light" }) : d("div", { children: "No challenge set." }) }), d(me, { children: d(be, { children: A("div", { style: xe, "data-cy": "button-human", children: [" ", A("div", { style: {
759
+ padding: ye,
760
+ border: Ce,
757
761
  backgroundColor: l.palette.background.default,
758
762
  borderColor: l.palette.grey[300],
759
- borderRadius: Ce,
763
+ borderRadius: we,
760
764
  display: "flex",
761
765
  alignItems: "center",
762
766
  flexWrap: "wrap",
763
767
  justifyContent: "space-between",
764
- minHeight: `${we}px`,
768
+ minHeight: `${Ae}px`,
765
769
  overflow: "hidden"
766
770
  }, children: [d("div", { style: { display: "inline-flex", flexDirection: "column" }, children: d("div", { style: {
767
771
  alignItems: "center",
@@ -774,10 +778,10 @@ const bt = {
774
778
  verticalAlign: "middle"
775
779
  }, children: [d("div", { style: {
776
780
  display: o.loading ? "none" : "flex"
777
- }, children: d(Ve, { themeColor: i, onChange: r.start, checked: o.isHuman, labelText: "I am human", "aria-label": "human checkbox" }) }), d("div", { style: {
781
+ }, children: d(Xe, { themeColor: i, onChange: r.start, checked: o.isHuman, labelText: "I am human", "aria-label": "human checkbox" }) }), d("div", { style: {
778
782
  display: o.loading ? "flex" : "none"
779
- }, children: d("div", { style: { display: "inline-flex" }, children: d(Ae, { themeColor: i, "aria-label": "Loading spinner" }) }) })] }) }) }), d("div", { style: { display: "inline-flex", flexDirection: "column" }, children: d("a", { href: ve, target: "_blank", "aria-label": Te, rel: "noreferrer", children: d("div", { style: { flex: 1 }, children: d(Ie, { themeColor: i, "aria-label": "Prosopo logo" }) }) }) })] })] }) }) })] }) });
783
+ }, children: d("div", { style: { display: "inline-flex" }, children: d(ve, { themeColor: i, "aria-label": "Loading spinner" }) }) })] }) }) }), d("div", { style: { display: "inline-flex", flexDirection: "column" }, children: d("a", { href: Te, target: "_blank", "aria-label": Ie, rel: "noreferrer", children: d("div", { style: { flex: 1 }, children: d(Ee, { themeColor: i, "aria-label": "Prosopo logo" }) }) }) })] })] }) }) })] }) });
780
784
  };
781
785
  export {
782
- At as default
786
+ vt as default
783
787
  };
@@ -1,15 +1,15 @@
1
- import { A as o, e as G, a as H, P as L, r as v, j as n, C as U, W as j, b as D, c as M, f as B, g as F, h as K, i as V, L as X, k as Y, m as $, n as q, l as z, d as J } from "./index-jr-ls0GZ.js";
2
- import { v as Q, k as _, E as Z, p as ee, n as te, f as w, o as ne, s as oe, q as ae, l as k, t as re, C as se } from "./utils-CHbJaqXT.js";
3
- const ce = (s, e) => {
1
+ import { A as o, e as O, a as H, P as L, r as v, j as n, W as U, C as j, c as M, b as y, f as B, g as F, h as K, i as V, k as X, L as Y, m as $, n as q, o as z, l as J, d as Q } from "./index-DvT5XLGE.js";
2
+ import { v as Z, k as _, E as ee, p as te, n as ne, f as w, o as oe, s as ae, q as re, l as k, t as se, C as ce } from "./utils-nH-g73b2.js";
3
+ const ie = (s, e) => {
4
4
  let r = 0;
5
5
  const d = "0".repeat(e);
6
6
  for (; ; ) {
7
7
  const p = new TextEncoder().encode(r + s);
8
- if (ie(Q(p)).startsWith(d))
8
+ if (le(Z(p)).startsWith(d))
9
9
  return r;
10
10
  r += 1;
11
11
  }
12
- }, ie = (s) => Array.from(s).map((e) => e.toString(16).padStart(2, "0")).join(""), le = (s, e, r, d) => {
12
+ }, le = (s) => Array.from(s).map((e) => e.toString(16).padStart(2, "0")).join(""), de = (s, e, r, d) => {
13
13
  const p = _(r, e, d), u = () => ({
14
14
  showModal: !1,
15
15
  loading: !1,
@@ -19,9 +19,9 @@ const ce = (s, e) => {
19
19
  isHuman: !1,
20
20
  captchaApi: void 0,
21
21
  account: void 0
22
- }), b = () => {
22
+ }), T = () => {
23
23
  window.clearTimeout(e.timeout), a({ timeout: void 0 });
24
- }, T = () => {
24
+ }, b = () => {
25
25
  window.clearTimeout(e.successfullChallengeTimeout), a({ successfullChallengeTimeout: void 0 });
26
26
  }, i = () => {
27
27
  const t = {
@@ -49,58 +49,58 @@ const ce = (s, e) => {
49
49
  throw new w("GENERAL.SITE_KEY_MISSING");
50
50
  return e.dappAccount;
51
51
  }, a = k(e, r), I = () => {
52
- b(), T(), a(u());
52
+ T(), b(), a(u());
53
53
  }, P = () => {
54
54
  const t = i().captchas.pow.solutionTimeout, c = setTimeout(() => {
55
55
  a({ isHuman: !1 }), p.onExpired();
56
56
  }, t);
57
57
  a({ successfullChallengeTimeout: c });
58
58
  }, W = async () => {
59
- var y;
59
+ var S;
60
60
  if (e.loading || e.isHuman)
61
61
  return;
62
62
  I(), a({
63
63
  loading: !0
64
64
  });
65
- const t = i(), c = t.web2 ? new Z() : new ee(), h = t.userAccountAddress || (await c.getAccount(t)).account.address;
65
+ const t = i(), c = t.web2 ? new ee() : new te(), h = t.userAccountAddress || (await c.getAccount(t)).account.address;
66
66
  if (a({
67
67
  account: { account: { address: h } }
68
- }), a({ dappAccount: t.account.address }), await te(100), !t.web2 && !t.userAccountAddress)
68
+ }), a({ dappAccount: t.account.address }), await ne(100), !t.web2 && !t.userAccountAddress)
69
69
  throw new w("GENERAL.ACCOUNT_NOT_FOUND", {
70
70
  context: { error: "Account address has not been set for web3 mode" }
71
71
  });
72
- const f = O(), x = _(r, e, d), A = f.provider.url, N = new ne(E(i()), A, l()), m = await N.getPowCaptchaChallenge(h, l()), R = ce(m.challenge, m.difficulty), C = (y = (await c.getAccount(i())).extension) == null ? void 0 : y.signer;
72
+ const f = G(), x = _(r, e, d), A = f.provider.url, D = new oe(E(i()), A, l()), m = await D.getPowCaptchaChallenge(h, l()), N = ie(m.challenge, m.difficulty), C = (S = (await c.getAccount(i())).extension) == null ? void 0 : S.signer;
73
73
  if (!C || !C.signRaw)
74
74
  throw new w("GENERAL.CANT_FIND_KEYRINGPAIR", {
75
75
  context: {
76
76
  error: "Signer is not defined, cannot sign message to prove account ownership"
77
77
  }
78
78
  });
79
- const S = await C.signRaw({
79
+ const R = await C.signRaw({
80
80
  address: h,
81
- data: oe(m[o.timestamp].toString()),
81
+ data: ae(m[o.timestamp].toString()),
82
82
  type: "bytes"
83
83
  });
84
- (await N.submitPowCaptchaSolution(m, g().account.account.address, l(), R, S.signature.toString(), t.captchas.pow.verifiedTimeout))[o.verified] && (a({
84
+ (await D.submitPowCaptchaSolution(m, g().account.account.address, l(), N, R.signature.toString(), t.captchas.pow.verifiedTimeout))[o.verified] && (a({
85
85
  isHuman: !0,
86
86
  loading: !1
87
- }), x.onHuman(G({
87
+ }), x.onHuman(O({
88
88
  [o.providerUrl]: A,
89
89
  [o.user]: g().account.account.address,
90
90
  [o.dapp]: l(),
91
91
  [o.challenge]: m.challenge,
92
92
  [o.blockNumber]: f.blockNumber,
93
- [o.nonce]: R,
93
+ [o.nonce]: N,
94
94
  [o.timestamp]: m.timestamp,
95
95
  [o.signature]: {
96
96
  [o.provider]: m.signature.provider,
97
97
  [o.user]: {
98
- [o.timestamp]: S.signature.toString()
98
+ [o.timestamp]: R.signature.toString()
99
99
  }
100
100
  }
101
101
  })), P());
102
- }, O = () => {
103
- const t = (x, A) => Math.floor(Math.random() * (A - x + 1) + x), c = i().defaultEnvironment, h = ae(c), f = H(h, t(0, h.length - 1));
102
+ }, G = () => {
103
+ const t = (x, A) => Math.floor(Math.random() * (A - x + 1) + x), c = i().defaultEnvironment, h = re(c), f = H(h, t(0, h.length - 1));
104
104
  return {
105
105
  providerAccount: f.address,
106
106
  provider: {
@@ -115,8 +115,8 @@ const ce = (s, e) => {
115
115
  start: W,
116
116
  resetState: I
117
117
  };
118
- }, he = (s) => {
119
- const e = s.config, r = e.theme === "light" ? "light" : "dark", d = s.config.theme === "light" ? z : J, p = s.callbacks || {}, [u, b] = re(v.useState, v.useRef), T = k(u, b), i = v.useRef(le(e, u, T, p)), E = v.useRef(null);
118
+ }, pe = (s) => {
119
+ const e = s.config, r = e.theme === "light" ? "light" : "dark", d = s.config.theme === "light" ? J : Q, p = s.callbacks || {}, [u, T] = se(v.useState, v.useRef), b = k(u, T), i = v.useRef(de(e, u, b, p)), E = v.useRef(null);
120
120
  return v.useEffect(() => {
121
121
  const g = E.current;
122
122
  if (!g)
@@ -130,17 +130,21 @@ const ce = (s, e) => {
130
130
  return l.addEventListener("submit", a), () => {
131
131
  l.removeEventListener("submit", a);
132
132
  };
133
- }, []), n("div", { ref: E, children: n("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: n(U, { children: n(j, { children: D("div", { style: M, "data-cy": "button-human", children: [" ", D("div", { style: {
134
- padding: B,
135
- border: F,
133
+ }, []), n("div", { ref: E, children: n("div", { style: {
134
+ maxWidth: U,
135
+ maxHeight: "100%",
136
+ overflowX: "auto"
137
+ }, children: n(j, { children: n(M, { children: y("div", { style: B, "data-cy": "button-human", children: [" ", y("div", { style: {
138
+ padding: F,
139
+ border: K,
136
140
  backgroundColor: d.palette.background.default,
137
141
  borderColor: d.palette.grey[300],
138
- borderRadius: K,
142
+ borderRadius: V,
139
143
  display: "flex",
140
144
  alignItems: "center",
141
145
  flexWrap: "wrap",
142
146
  justifyContent: "space-between",
143
- minHeight: `${V}px`,
147
+ minHeight: `${X}px`,
144
148
  overflow: "hidden"
145
149
  }, children: [n("div", { style: { display: "inline-flex", flexDirection: "column" }, children: n("div", { style: {
146
150
  display: "flex",
@@ -155,8 +159,8 @@ const ce = (s, e) => {
155
159
  verticalAlign: "middle"
156
160
  }, children: n("div", { style: {
157
161
  display: "flex"
158
- }, children: n("div", { style: { flex: 1 }, children: u.loading ? n(X, { themeColor: r, "aria-label": "Loading spinner" }) : n(se, { checked: u.isHuman, onChange: i.current.start, themeColor: r, labelText: "I am human", "aria-label": "human checkbox" }) }) }) }) }) }), n("div", { style: { display: "inline-flex", flexDirection: "column" }, children: n("a", { href: Y, target: "_blank", "aria-label": $, rel: "noreferrer", children: n("div", { style: { flex: 1 }, children: n(q, { themeColor: r, "aria-label": "Prosopo logo" }) }) }) })] })] }) }) }) }) });
162
+ }, children: n("div", { style: { flex: 1 }, children: u.loading ? n(Y, { themeColor: r, "aria-label": "Loading spinner" }) : n(ce, { checked: u.isHuman, onChange: i.current.start, themeColor: r, labelText: "I am human", "aria-label": "human checkbox" }) }) }) }) }) }), n("div", { style: { display: "inline-flex", flexDirection: "column" }, children: n("a", { href: $, target: "_blank", "aria-label": q, rel: "noreferrer", children: n("div", { style: { flex: 1 }, children: n(z, { themeColor: r, "aria-label": "Prosopo logo" }) }) }) })] })] }) }) }) }) });
159
163
  };
160
164
  export {
161
- he as default
165
+ pe as default
162
166
  };