@prosopo/procaptcha-bundle 2.0.1 → 2.0.2

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,22 +1,22 @@
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));
1
+ import { r as m, z as j, a as b, e as ue, A as w, P as oe, l as B, d as U, j as l, b as A, R as pe, W as he, C as fe, c as ge, f as me, g as xe, h as be, i as ye, k as Ce, L as we, m as Ae, n as ve, o as Te } from "./index-DU1XrpZS.js";
2
+ import { u as Ie, h as Ee, _ as Se, a as Ne, b as Pe, I as De, R as Oe, g as He, c as Re, d as Le, i as _e, e as q, P as T, f as P, j as k, s as re, k as ke, l as Me, m as We, n as Ge, r as je, o as ze, p as Be, E as Ue, q as $e, t as Fe, C as Ke } from "./utils-C4GbA2iF.js";
3
+ function Ve(t) {
4
+ return Ie(Ee(t));
5
5
  }
6
- function Je() {
6
+ function qe() {
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];
10
10
  typeof n[0] == "string" && (n[0] = "react-i18next:: ".concat(n[0])), (t = console).warn.apply(t, n);
11
11
  }
12
12
  }
13
- var te = {};
14
- function q() {
13
+ var Z = {};
14
+ function X() {
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()), Je.apply(void 0, e));
17
+ typeof e[0] == "string" && Z[e[0]] || (typeof e[0] == "string" && (Z[e[0]] = /* @__PURE__ */ new Date()), qe.apply(void 0, e));
18
18
  }
19
- function ne(t, e, n) {
19
+ function Q(t, e, n) {
20
20
  t.loadNamespaces(e, function() {
21
21
  if (t.isInitialized)
22
22
  n();
@@ -30,48 +30,48 @@ function ne(t, e, n) {
30
30
  }
31
31
  });
32
32
  }
33
- function qe(t, e) {
33
+ function Xe(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
- var i = function(s, h) {
37
- var b = e.services.backendConnector.state["".concat(s, "|").concat(h)];
38
- return b === -1 || b === 2;
36
+ var i = function(s, f) {
37
+ var g = e.services.backendConnector.state["".concat(s, "|").concat(f)];
38
+ return g === -1 || g === 2;
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 Ze(t, e) {
42
+ function Ye(t, e) {
43
43
  var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
44
44
  if (!e.languages || !e.languages.length)
45
- return q("i18n.languages were undefined or empty", e.languages), !0;
45
+ return X("i18n.languages were undefined or empty", e.languages), !0;
46
46
  var o = e.options.ignoreJSONStructure !== void 0;
47
47
  return o ? e.hasLoadedNamespace(t, {
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
- }) : qe(t, e, n);
51
+ }) : Xe(t, e, n);
52
52
  }
53
- function Qe(t, e) {
53
+ function Je(t, e) {
54
54
  var n = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
55
55
  if (n != null) {
56
- var o, a, r, i, l = [], s = !0, h = !1;
56
+ var o, a, r, i, d = [], s = !0, f = !1;
57
57
  try {
58
- if (r = (n = n.call(t)).next, e !== 0) for (; !(s = (o = r.call(n)).done) && (l.push(o.value), l.length !== e); s = !0) ;
59
- } catch (b) {
60
- h = !0, a = b;
58
+ if (r = (n = n.call(t)).next, e !== 0) for (; !(s = (o = r.call(n)).done) && (d.push(o.value), d.length !== e); s = !0) ;
59
+ } catch (g) {
60
+ f = !0, a = g;
61
61
  } finally {
62
62
  try {
63
63
  if (!s && n.return != null && (i = n.return(), Object(i) !== i)) return;
64
64
  } finally {
65
- if (h) throw a;
65
+ if (f) throw a;
66
66
  }
67
67
  }
68
- return l;
68
+ return d;
69
69
  }
70
70
  }
71
- function et(t, e) {
72
- return Pe(t) || Qe(t, e) || ke(t, e) || Oe();
71
+ function Ze(t, e) {
72
+ return Se(t) || Je(t, e) || Ne(t, e) || Pe();
73
73
  }
74
- function oe(t, e) {
74
+ function ee(t, e) {
75
75
  var n = Object.keys(t);
76
76
  if (Object.getOwnPropertySymbols) {
77
77
  var o = Object.getOwnPropertySymbols(t);
@@ -81,117 +81,117 @@ function oe(t, e) {
81
81
  }
82
82
  return n;
83
83
  }
84
- function V(t) {
84
+ function F(t) {
85
85
  for (var e = 1; e < arguments.length; e++) {
86
86
  var n = arguments[e] != null ? arguments[e] : {};
87
- e % 2 ? oe(Object(n), !0).forEach(function(o) {
88
- _e(t, o, n[o]);
89
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : oe(Object(n)).forEach(function(o) {
87
+ e % 2 ? ee(Object(n), !0).forEach(function(o) {
88
+ Re(t, o, n[o]);
89
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : ee(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 tt = function(e, n) {
95
+ var Qe = 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 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
- if (r && !r.reportNamespaces && (r.reportNamespaces = new Re()), !r) {
104
- q("You will need to pass in an i18next instance by using initReactI18next");
105
- var i = function(u) {
106
- return Array.isArray(u) ? u[u.length - 1] : u;
107
- }, l = [i, {}, !1];
108
- return l.t = i, l.i18n = {}, l.ready = !1, l;
101
+ function et(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 || Le();
103
+ if (r && !r.reportNamespaces && (r.reportNamespaces = new Oe()), !r) {
104
+ X("You will need to pass in an i18next instance by using initReactI18next");
105
+ var i = function(h) {
106
+ return Array.isArray(h) ? h[h.length - 1] : h;
107
+ }, d = [i, {}, !1];
108
+ return d.t = i, d.i18n = {}, d.ready = !1, d;
109
109
  }
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({}, Le()), r.options.react), e), h = s.useSuspense, b = s.keyPrefix, p = t;
112
- p = typeof p == "string" ? [p] : p || ["translation"], r.reportNamespaces.addUsedNamespaces && r.reportNamespaces.addUsedNamespaces(p);
113
- var f = (r.isInitialized || r.initializedStoreOnce) && p.every(function(c) {
114
- return Ze(c, r, s);
110
+ r.options.react && r.options.react.wait !== void 0 && X("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
111
+ var s = F(F(F({}, He()), r.options.react), e), f = s.useSuspense, g = s.keyPrefix, u = t;
112
+ u = typeof u == "string" ? [u] : u || ["translation"], r.reportNamespaces.addUsedNamespaces && r.reportNamespaces.addUsedNamespaces(u);
113
+ var y = (r.isInitialized || r.initializedStoreOnce) && u.every(function(p) {
114
+ return Ye(p, r, s);
115
115
  });
116
- function y() {
117
- return r.getFixedT(null, s.nsMode === "fallback" ? p : p[0], b);
116
+ function C() {
117
+ return r.getFixedT(null, s.nsMode === "fallback" ? u : u[0], g);
118
118
  }
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);
119
+ var R = m.useState(C), D = Ze(R, 2), M = D[0], S = D[1], L = u.join(), O = Qe(L), I = m.useRef(!0);
120
120
  m.useEffect(function() {
121
- var c = s.bindI18n, u = s.bindI18nStore;
122
- I.current = !0, !f && !h && ne(r, p, function() {
123
- I.current && N(y);
124
- }), f && D && D !== L && I.current && N(y);
125
- function g() {
126
- I.current && N(y);
121
+ var p = s.bindI18n, h = s.bindI18nStore;
122
+ I.current = !0, !y && !f && Q(r, u, function() {
123
+ I.current && S(C);
124
+ }), y && O && O !== L && I.current && S(C);
125
+ function x() {
126
+ I.current && S(C);
127
127
  }
128
- return c && r && r.on(c, g), u && r && r.store.on(u, g), function() {
129
- I.current = !1, c && r && c.split(" ").forEach(function(x) {
130
- return r.off(x, g);
131
- }), u && r && u.split(" ").forEach(function(x) {
132
- return r.store.off(x, g);
128
+ return p && r && r.on(p, x), h && r && r.store.on(h, x), function() {
129
+ I.current = !1, p && r && p.split(" ").forEach(function(v) {
130
+ return r.off(v, x);
131
+ }), h && r && h.split(" ").forEach(function(v) {
132
+ return r.store.off(v, x);
133
133
  });
134
134
  };
135
135
  }, [r, L]);
136
136
  var W = m.useRef(!0);
137
137
  m.useEffect(function() {
138
- I.current && !W.current && N(y), W.current = !1;
139
- }, [r, b]);
140
- var P = [M, r, f];
141
- if (P.t = M, P.i18n = r, P.ready = f, f || !f && !h) return P;
142
- throw new Promise(function(c) {
143
- ne(r, p, function() {
144
- c();
138
+ I.current && !W.current && S(C), W.current = !1;
139
+ }, [r, g]);
140
+ var c = [M, r, y];
141
+ if (c.t = M, c.i18n = r, c.ready = y, y || !y && !f) return c;
142
+ throw new Promise(function(p) {
143
+ Q(r, u, function() {
144
+ p();
145
145
  });
146
146
  });
147
147
  }
148
- function ot(t) {
149
- return nt("translation", { i18n: Me, ...t });
148
+ function tt(t) {
149
+ return et("translation", { i18n: _e, ...t });
150
150
  }
151
- const rt = (t) => Array.isArray(t) && t !== null, B = new Array(256), le = new Array(256 * 256);
151
+ const nt = (t) => Array.isArray(t) && t !== null, z = new Array(256), ae = new Array(256 * 256);
152
152
  for (let t = 0; t < 256; t++)
153
- B[t] = t.toString(16).padStart(2, "0");
153
+ z[t] = t.toString(16).padStart(2, "0");
154
154
  for (let t = 0; t < 256; t++) {
155
155
  const e = t << 8;
156
156
  for (let n = 0; n < 256; n++)
157
- le[e | n] = B[t] + B[n];
157
+ ae[e | n] = z[t] + z[n];
158
158
  }
159
- function X(t, e) {
159
+ function K(t, e) {
160
160
  const n = t.length % 2 | 0, o = t.length - n | 0;
161
161
  for (let a = 0; a < o; a += 2)
162
- e += le[t[a] << 8 | t[a + 1]];
163
- return n && (e += B[t[o] | 0]), e;
162
+ e += ae[t[a] << 8 | t[a + 1]];
163
+ return n && (e += z[t[o] | 0]), e;
164
164
  }
165
- function at(t, e = -1, n = !0) {
165
+ function ot(t, e = -1, n = !0) {
166
166
  const o = n ? "0x" : "";
167
167
  if (!(t != null && t.length))
168
168
  return o;
169
169
  if (e > 0) {
170
170
  const a = Math.ceil(e / 8);
171
171
  if (t.length > a)
172
- return `${X(t.subarray(0, a / 2), o)}…${X(t.subarray(t.length - a / 2), "")}`;
172
+ return `${K(t.subarray(0, a / 2), o)}…${K(t.subarray(t.length - a / 2), "")}`;
173
173
  }
174
- return X(t, o);
174
+ return K(t, o);
175
175
  }
176
- const it = (t) => rt(t) ? at(new Uint8Array(t)) : t.toString(), de = z.object({
177
- account: z.string().optional(),
178
- blockNumber: z.number().optional(),
179
- providerUrl: z.string().optional()
176
+ const rt = (t) => nt(t) ? ot(new Uint8Array(t)) : t.toString(), ie = j.object({
177
+ account: j.string().optional(),
178
+ blockNumber: j.number().optional(),
179
+ providerUrl: j.string().optional()
180
180
  });
181
- function st(t) {
182
- return J([
181
+ function at(t) {
182
+ return q([
183
183
  t.captchaId,
184
184
  t.captchaContentId,
185
185
  [...t.solution].sort(),
186
186
  t.salt
187
187
  ]);
188
188
  }
189
- class re {
189
+ class te {
190
190
  constructor(e) {
191
191
  this.hash = e, this.parent = null;
192
192
  }
193
193
  }
194
- class ct {
194
+ class it {
195
195
  constructor() {
196
196
  this.leaves = [], this.layers = [];
197
197
  }
@@ -209,7 +209,7 @@ class ct {
209
209
  this.layers.length && (this.layers = []);
210
210
  const n = [];
211
211
  for (const o of e) {
212
- const a = new re(o);
212
+ const a = new te(o);
213
213
  this.leaves.push(a), n.push(a.hash);
214
214
  }
215
215
  this.layers.push(n), this.root = this.buildMerkleTree(this.leaves)[0];
@@ -227,13 +227,13 @@ class ct {
227
227
  throw new T("DEVELOPER.GENERAL", {
228
228
  context: { error: "leftChild undefined" }
229
229
  });
230
- const l = a + 1 < n ? C(e, a + 1) : i, s = this.createParent(i, l);
230
+ const d = a + 1 < n ? b(e, a + 1) : i, s = this.createParent(i, d);
231
231
  r.push(s.hash), o.push(s), a += 2;
232
232
  }
233
233
  return this.layers.push(r), this.buildMerkleTree(o);
234
234
  }
235
235
  createParent(e, n) {
236
- const o = new re(J([e.hash, n.hash]));
236
+ const o = new te(q([e.hash, n.hash]));
237
237
  return e.parent = o.hash, n.parent = o.hash, o;
238
238
  }
239
239
  proof(e) {
@@ -250,18 +250,18 @@ class ct {
250
250
  }
251
251
  });
252
252
  const i = r.indexOf(e);
253
- let l = i % 2 && i > 0 ? i - 1 : i + 1;
254
- l > r.length - 1 && (l = i);
255
- const s = [e], h = C(r, l);
256
- l > i ? s.push(h) : s.unshift(h), n.push([C(s, 0), C(s, 1)]), o += 1, e = J(s);
253
+ let d = i % 2 && i > 0 ? i - 1 : i + 1;
254
+ d > r.length - 1 && (d = i);
255
+ const s = [e], f = b(r, d);
256
+ d > i ? s.push(f) : s.unshift(f), n.push([b(s, 0), b(s, 1)]), o += 1, e = q(s);
257
257
  }
258
- const a = C(this.layers, this.layers.length - 1);
259
- return [...n, [C(a, 0)]];
258
+ const a = b(this.layers, this.layers.length - 1);
259
+ return [...n, [b(a, 0)]];
260
260
  }
261
261
  }
262
- class lt {
263
- constructor(e, n, o, a, r, i) {
264
- this.userAccount = e, this.contract = n, this.provider = o, this.providerApi = a, this._web2 = r, this.dappAccount = i;
262
+ class st {
263
+ constructor(e, n, o, a, r) {
264
+ this.userAccount = e, this.provider = n, this.providerApi = o, this._web2 = a, this.dappAccount = r;
265
265
  }
266
266
  get web2() {
267
267
  return this._web2;
@@ -274,60 +274,48 @@ class lt {
274
274
  o.data && (o.data = o.data.replace(/^http(s)*:\/\//, "//"));
275
275
  return e;
276
276
  } catch (e) {
277
- throw new S("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
277
+ throw new P("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
278
278
  context: { error: e }
279
279
  });
280
280
  }
281
281
  }
282
- async submitCaptchaSolution(e, n, o, a, r, i) {
283
- const l = new ct(), s = o.map((w) => st(w));
284
- if (l.build(s), !l.root)
285
- throw new H("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
282
+ async submitCaptchaSolution(e, n, o, a, r) {
283
+ const i = new it(), d = o.map((u) => at(u));
284
+ if (i.build(d), !i.root)
285
+ throw new k("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
286
286
  context: { error: "Merkle tree root is undefined" }
287
287
  });
288
- const h = l.root.hash, b = void 0;
289
- let p;
290
- if (!e || !e.signRaw)
291
- throw new S("GENERAL.CANT_FIND_KEYRINGPAIR", {
292
- context: {
293
- error: "Signer is not defined, cannot sign message to prove account ownership"
294
- }
295
- });
296
- let f;
297
- p = (await e.signRaw({
298
- address: this.userAccount,
299
- data: ce(n),
300
- type: "bytes"
301
- })).signature;
288
+ const s = i.root.hash, f = void 0;
289
+ let g;
302
290
  try {
303
- f = await this.providerApi.submitCaptchaSolution(o, n, this.userAccount, a, r, i, p);
304
- } catch (w) {
305
- throw new H("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
306
- context: { error: w }
291
+ g = await this.providerApi.submitCaptchaSolution(o, n, this.userAccount, a, r, e);
292
+ } catch (u) {
293
+ throw new k("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
294
+ context: { error: u }
307
295
  });
308
296
  }
309
- return [f, h, b];
297
+ return [g, s, f];
310
298
  }
311
299
  }
312
- const ue = "@prosopo/procaptcha";
313
- function Q() {
314
- return de.parse(JSON.parse(Ye(localStorage.getItem(ue) || "0x7b7d")));
300
+ const se = "@prosopo/procaptcha";
301
+ function J() {
302
+ return ie.parse(JSON.parse(Ve(localStorage.getItem(se) || "0x7b7d")));
315
303
  }
316
- function pe(t) {
317
- localStorage.setItem(ue, ce(JSON.stringify(de.parse(t))));
304
+ function ce(t) {
305
+ localStorage.setItem(se, re(JSON.stringify(ie.parse(t))));
318
306
  }
319
- function dt(t) {
320
- pe({ ...Q(), account: t });
307
+ function ct(t) {
308
+ ce({ ...J(), account: t });
321
309
  }
322
- function ut() {
323
- return Q().account || null;
310
+ function lt() {
311
+ return J().account || null;
324
312
  }
325
- const Y = {
326
- setAccount: dt,
327
- getAccount: ut,
328
- setProcaptchaStorage: pe,
329
- getProcaptchaStorage: Q
330
- }, pt = () => ({
313
+ const V = {
314
+ setAccount: ct,
315
+ getAccount: lt,
316
+ setProcaptchaStorage: ce,
317
+ getProcaptchaStorage: J
318
+ }, dt = () => ({
331
319
  showModal: !1,
332
320
  loading: !1,
333
321
  index: 0,
@@ -336,121 +324,121 @@ const Y = {
336
324
  isHuman: !1,
337
325
  captchaApi: void 0,
338
326
  account: void 0
339
- }), ae = (t) => {
340
- const e = t.networks[t.defaultNetwork];
341
- if (!e)
342
- throw new S("DEVELOPER.NETWORK_NOT_FOUND", {
343
- context: {
344
- error: `No network found for environment ${t.defaultEnvironment}`
345
- }
346
- });
347
- return e;
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));
327
+ }), ut = (t) => {
328
+ const e = (a, r) => Math.floor(Math.random() * (r - a + 1) + a), n = Be(t.defaultEnvironment), o = b(n, e(0, n.length - 1));
350
329
  return {
351
330
  providerAccount: o.address,
352
331
  provider: {
353
332
  url: o.url,
354
333
  datasetId: o.datasetId,
355
334
  datasetIdContent: o.datasetIdContent
356
- },
357
- blockNumber: 0
335
+ }
358
336
  };
359
337
  };
360
- function ft(t, e, n, o) {
361
- const a = We(n, e, o), r = (c) => {
362
- const u = c instanceof Error ? c : new Error(String(c));
363
- a.onError(u);
364
- }, i = Ge(e, n), l = () => {
338
+ function pt(t, e, n, o) {
339
+ const a = ke(n, e, o), r = (c) => {
340
+ const p = c instanceof Error ? c : new Error(String(c));
341
+ a.onError(p);
342
+ }, i = Me(e, n), d = () => {
365
343
  const c = {
366
344
  userAccountAddress: "",
367
345
  ...t
368
346
  };
369
- return e.account && (c.userAccountAddress = e.account.account.address), se.parse(c);
347
+ return e.account && (c.userAccountAddress = e.account.account.address), oe.parse(c);
370
348
  }, s = async (c) => {
371
349
  try {
372
350
  await c();
373
- } catch (u) {
374
- console.error(u), r(u), i({ isHuman: !1, showModal: !1, loading: !1 });
351
+ } catch (p) {
352
+ console.error(p), r(p), i({ isHuman: !1, showModal: !1, loading: !1 });
375
353
  }
376
- }, h = async () => {
354
+ }, f = async () => {
377
355
  a.onOpen(), await s(async () => {
378
356
  if (e.loading || e.isHuman)
379
357
  return;
380
- await je(), N(), i({ loading: !0 });
381
- const c = l();
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();
358
+ await We(), S(), i({ loading: !0 });
359
+ const c = d();
360
+ i({ dappAccount: c.account.address }), await Ge(100);
361
+ const p = await L(), h = ut(d()), x = h.provider.url, v = await R(x), $ = new st(p.account.address, h, v, c.web2, c.account.address || "");
362
+ i({ captchaApi: $ });
363
+ const E = await $.getCaptchaChallenge();
386
364
  if (E.captchas.length <= 0)
387
- throw new H("DEVELOPER.PROVIDER_NO_CAPTCHA");
388
- const j = E.captchas.map((_) => _.timeLimitMs || c.captchas.image.challengeTimeout).reduce((_, K) => _ + K), k = setTimeout(() => {
365
+ throw new k("DEVELOPER.PROVIDER_NO_CAPTCHA");
366
+ const G = E.captchas.map((H) => H.timeLimitMs || c.captchas.image.challengeTimeout).reduce((H, N) => H + N), _ = setTimeout(() => {
389
367
  a.onChallengeExpired(), i({ isHuman: !1, showModal: !1, loading: !1 });
390
- }, j);
368
+ }, G);
391
369
  i({
392
370
  index: 0,
393
371
  solutions: E.captchas.map(() => []),
394
372
  challenge: E,
395
373
  showModal: !0,
396
- timeout: k,
397
- blockNumber: G
374
+ timeout: _
398
375
  });
399
376
  });
400
- }, b = async () => {
377
+ }, g = async () => {
401
378
  await s(async () => {
402
- if (O(), !e.challenge)
379
+ if (D(), !e.challenge)
403
380
  throw new T("CAPTCHA.NO_CAPTCHA", {
404
381
  context: { error: "Cannot submit, no Captcha found in state" }
405
382
  });
406
383
  i({ showModal: !1 });
407
- const c = e.challenge, u = Be(), g = e.challenge.captchas.map((k, _) => {
408
- const K = C(e.solutions, _);
384
+ const c = e.challenge, p = je(), h = e.challenge.captchas.map((N, le) => {
385
+ const de = b(e.solutions, le);
409
386
  return {
410
- captchaId: k.captchaId,
411
- captchaContentId: k.captchaContentId,
412
- salt: u,
413
- solution: K
387
+ captchaId: N.captchaId,
388
+ captchaContentId: N.captchaContentId,
389
+ salt: p,
390
+ solution: de
414
391
  };
415
- }), x = D(), G = W(), F = P(x).signer;
416
- if (!C(c.captchas, 0).datasetId)
417
- throw new H("CAPTCHA.INVALID_CAPTCHA_ID", {
392
+ }), x = O(), v = W(x).signer;
393
+ if (!b(c.captchas, 0).datasetId)
394
+ throw new k("CAPTCHA.INVALID_CAPTCHA_ID", {
418
395
  context: { error: "No datasetId set for challenge" }
419
396
  });
420
- const R = e.captchaApi;
421
- if (!R)
397
+ const E = e.captchaApi;
398
+ if (!E)
422
399
  throw new T("CAPTCHA.INVALID_TOKEN", {
423
400
  context: { error: "No Captcha API found in state" }
424
401
  });
425
- const E = await R.submitCaptchaSolution(F, c.requestHash, g, u, c.timestamp, c.signature.provider.timestamp), j = E[0].verified;
426
- if (j || a.onFailed(), i({
427
- submission: E,
428
- isHuman: j,
402
+ if (!v || !v.signRaw)
403
+ throw new P("GENERAL.CANT_FIND_KEYRINGPAIR", {
404
+ context: {
405
+ error: "Signer is not defined, cannot sign message to prove account ownership"
406
+ }
407
+ });
408
+ const G = await v.signRaw({
409
+ address: x.account.address,
410
+ data: re(c.requestHash),
411
+ type: "bytes"
412
+ }), _ = await E.submitCaptchaSolution(G.signature, c.requestHash, h, c.timestamp, c.signature.provider.requestHash), H = _[0].verified;
413
+ if (H || a.onFailed(), i({
414
+ submission: _,
415
+ isHuman: H,
429
416
  loading: !1
430
417
  }), e.isHuman) {
431
- const k = R.provider.provider.url;
432
- Y.setProcaptchaStorage({
433
- ...Y.getProcaptchaStorage(),
434
- providerUrl: k,
435
- blockNumber: G
436
- }), a.onHuman(he({
437
- [v.providerUrl]: k,
438
- [v.user]: x.account.address,
439
- [v.dapp]: I(),
440
- [v.commitmentId]: it(E[1]),
441
- [v.blockNumber]: G,
442
- [v.timestamp]: c.timestamp,
443
- [v.signature]: {
444
- [v.provider]: {
445
- [v.timestamp]: c.signature.provider.timestamp
418
+ const N = E.provider.provider.url;
419
+ V.setProcaptchaStorage({
420
+ ...V.getProcaptchaStorage(),
421
+ providerUrl: N
422
+ }), a.onHuman(ue({
423
+ [w.providerUrl]: N,
424
+ [w.user]: x.account.address,
425
+ [w.dapp]: I(),
426
+ [w.commitmentId]: rt(_[1]),
427
+ [w.timestamp]: c.timestamp,
428
+ [w.signature]: {
429
+ [w.provider]: {
430
+ [w.requestHash]: c.signature.provider.requestHash
431
+ },
432
+ [w.user]: {
433
+ [w.requestHash]: G.signature
446
434
  }
447
435
  }
448
436
  })), M();
449
437
  }
450
438
  });
451
- }, p = async () => {
452
- O(), N(), a.onClose();
453
- }, f = (c) => {
439
+ }, u = async () => {
440
+ D(), S(), a.onClose();
441
+ }, y = (c) => {
454
442
  if (!e.challenge)
455
443
  throw new T("CAPTCHA.NO_CAPTCHA", {
456
444
  context: { error: "Cannot select, no Captcha found in state" }
@@ -461,9 +449,9 @@ function ft(t, e, n, o) {
461
449
  error: "Cannot select, index is out of range for this Captcha"
462
450
  }
463
451
  });
464
- const u = e.index, g = e.solutions, x = C(g, u);
465
- x.includes(c) ? x.splice(x.indexOf(c), 1) : x.push(c), i({ solutions: g });
466
- }, y = () => {
452
+ const p = e.index, h = e.solutions, x = b(h, p);
453
+ x.includes(c) ? x.splice(x.indexOf(c), 1) : x.push(c), i({ solutions: h });
454
+ }, C = () => {
467
455
  if (!e.challenge)
468
456
  throw new T("CAPTCHA.NO_CAPTCHA", {
469
457
  context: { error: "Cannot select, no Captcha found in state" }
@@ -475,62 +463,62 @@ function ft(t, e, n, o) {
475
463
  }
476
464
  });
477
465
  i({ index: e.index + 1 });
478
- }, w = async (c) => {
479
- const u = l(), g = ae(u);
480
- if (!u.account.address)
481
- throw new S("GENERAL.SITE_KEY_MISSING");
482
- return new Ue(g, c, u.account.address);
483
- }, O = () => {
466
+ }, R = async (c) => {
467
+ const p = d();
468
+ if (!p.account.address)
469
+ throw new P("GENERAL.SITE_KEY_MISSING");
470
+ return new ze(c, p.account.address);
471
+ }, D = () => {
484
472
  window.clearTimeout(e.timeout), i({ timeout: void 0 });
485
473
  }, M = () => {
486
- const c = t.captchas.image.solutionTimeout, u = setTimeout(() => {
474
+ const c = t.captchas.image.solutionTimeout, p = setTimeout(() => {
487
475
  i({ isHuman: !1 }), a.onExpired();
488
476
  }, c);
489
- i({ successfullChallengeTimeout: u });
490
- }, N = () => {
491
- O(), i(pt());
477
+ i({ successfullChallengeTimeout: p });
478
+ }, S = () => {
479
+ D(), i(dt());
492
480
  }, L = async () => {
493
- const c = l();
481
+ const c = d();
494
482
  if (!c.web2 && !c.userAccountAddress)
495
- throw new S("GENERAL.ACCOUNT_NOT_FOUND", {
483
+ throw new P("GENERAL.ACCOUNT_NOT_FOUND", {
496
484
  context: { error: "Account address has not been set for web3 mode" }
497
485
  });
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 = () => {
486
+ const h = await (c.web2 ? new Ue() : new $e()).getAccount(c);
487
+ return V.setAccount(h.account.address), i({ account: h }), O();
488
+ }, O = () => {
501
489
  if (!e.account)
502
- throw new S("GENERAL.ACCOUNT_NOT_FOUND", {
490
+ throw new P("GENERAL.ACCOUNT_NOT_FOUND", {
503
491
  context: { error: "Account not loaded" }
504
492
  });
505
493
  return e.account;
506
494
  }, I = () => {
507
495
  if (!e.dappAccount)
508
- throw new S("GENERAL.SITE_KEY_MISSING");
496
+ throw new P("GENERAL.SITE_KEY_MISSING");
509
497
  return e.dappAccount;
510
- }, W = () => e.blockNumber || 0, P = (c) => {
511
- const u = c || D();
512
- if (!u.extension)
513
- throw new S("ACCOUNT.NO_POLKADOT_EXTENSION", {
498
+ }, W = (c) => {
499
+ const p = c || O();
500
+ if (!p.extension)
501
+ throw new P("ACCOUNT.NO_POLKADOT_EXTENSION", {
514
502
  context: { error: "Extension not loaded" }
515
503
  });
516
- return u.extension;
504
+ return p.extension;
517
505
  };
518
506
  return {
519
- start: h,
520
- cancel: p,
521
- submit: b,
522
- select: f,
523
- nextRound: y
507
+ start: f,
508
+ cancel: u,
509
+ submit: g,
510
+ select: y,
511
+ nextRound: C
524
512
  };
525
513
  }
526
- const gt = (t) => {
514
+ const ht = (t) => {
527
515
  if (!t.hash)
528
- throw new H("CAPTCHA.MISSING_ITEM_HASH", {
516
+ throw new k("CAPTCHA.MISSING_ITEM_HASH", {
529
517
  context: { item: t }
530
518
  });
531
519
  return t.hash;
532
- }, mt = ({ challenge: t, solution: e, onClick: n, themeColor: o }) => {
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 = {
520
+ }, ft = ({ challenge: t, solution: e, onClick: n, themeColor: o }) => {
521
+ const a = t.items, r = m.useMemo(() => o === "light" ? B : U, [o]), i = "ontouchstart" in window, d = `${r.spacing.unit}px`, s = `${r.spacing.half}px`, f = {
534
522
  0: {
535
523
  paddingLeft: 0,
536
524
  paddingRight: s,
@@ -549,11 +537,11 @@ const gt = (t) => {
549
537
  paddingTop: s,
550
538
  paddingBottom: s
551
539
  }
552
- }, b = {
553
- 0: { paddingTop: l },
554
- 2: { paddingBottom: l }
540
+ }, g = {
541
+ 0: { paddingTop: d },
542
+ 2: { paddingBottom: d }
555
543
  };
556
- return d("div", { style: {
544
+ return l("div", { style: {
557
545
  paddingRight: 0.5,
558
546
  paddingBottom: 0.5,
559
547
  width: "100%",
@@ -561,38 +549,38 @@ const gt = (t) => {
561
549
  display: "flex",
562
550
  flexDirection: "row",
563
551
  flexWrap: "wrap"
564
- }, children: a.map((p, f) => {
565
- const y = gt(p), w = {
566
- ...h[f % 3],
567
- ...b[Math.floor(f / 3)],
552
+ }, children: a.map((u, y) => {
553
+ const C = ht(u), R = {
554
+ ...f[y % 3],
555
+ ...g[Math.floor(y / 3)],
568
556
  flexGrow: 1,
569
557
  flexBasis: "33.3333%",
570
558
  boxSizing: "border-box"
571
559
  };
572
- return d("div", { style: w, children: A("div", { style: {
560
+ return l("div", { style: R, children: A("div", { style: {
573
561
  cursor: "pointer",
574
562
  height: "100%",
575
563
  width: "100%",
576
564
  border: 1,
577
565
  borderStyle: "solid",
578
566
  borderColor: r.palette.grey[300]
579
- }, onClick: i ? void 0 : () => n(y), onTouchStart: i ? () => n(y) : void 0, children: [d("div", { children: d("img", { style: {
567
+ }, onClick: i ? void 0 : () => n(C), onTouchStart: i ? () => n(C) : void 0, children: [l("div", { children: l("img", { style: {
580
568
  width: "100%",
581
569
  backgroundColor: r.palette.grey[300],
582
- opacity: e.includes(y) && i ? "50%" : "100%",
570
+ opacity: e.includes(C) && i ? "50%" : "100%",
583
571
  display: "block",
584
572
  objectFit: "contain",
585
573
  aspectRatio: "1/1",
586
574
  height: "auto"
587
- }, src: p.data, alt: `Captcha image ${f + 1}` }) }), d("div", { style: {
575
+ }, src: u.data, alt: `Captcha image ${y + 1}` }) }), l("div", { style: {
588
576
  position: "relative",
589
577
  width: "100%",
590
578
  height: "100%",
591
579
  top: "-100%",
592
- visibility: e.includes(y) ? "visible" : "hidden",
580
+ visibility: e.includes(C) ? "visible" : "hidden",
593
581
  transition: "opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
594
582
  opacity: 1
595
- }, children: d("div", { style: {
583
+ }, children: l("div", { style: {
596
584
  position: "absolute",
597
585
  top: 0,
598
586
  left: 0,
@@ -604,7 +592,7 @@ const gt = (t) => {
604
592
  alignItems: "center",
605
593
  justifyContent: "center",
606
594
  backgroundColor: "rgba(0,0,0,0.5)"
607
- }, children: d("svg", { style: {
595
+ }, children: l("svg", { style: {
608
596
  backgroundColor: "transparent",
609
597
  display: "block",
610
598
  width: "35%",
@@ -612,18 +600,18 @@ const gt = (t) => {
612
600
  transition: "fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
613
601
  userSelect: "none",
614
602
  fill: "currentcolor"
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);
603
+ }, focusable: "false", color: "#fff", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "CheckIcon", "aria-label": "Check icon", children: l("path", { d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" }) }) }) })] }) }, u.hash);
616
604
  }) });
617
605
  };
618
- function bt(t = {}) {
606
+ function gt(t = {}) {
619
607
  return Object.keys(t).reduce((e, n) => ({ ...e, [`data-${n}`]: t[n] }), {});
620
608
  }
621
- function Z({ general: t, dev: e }) {
609
+ function Y({ general: t, dev: e }) {
622
610
  return {
623
- ...bt(t)
611
+ ...gt(t)
624
612
  };
625
613
  }
626
- const xt = {
614
+ const mt = {
627
615
  display: "inline-flex",
628
616
  alignItems: "center",
629
617
  justifyContent: "center",
@@ -649,10 +637,10 @@ const xt = {
649
637
  color: "rgb(0, 0, 0)",
650
638
  backgroundColor: "#ffffff",
651
639
  boxShadow: "rgba(0, 0, 0, 0.2) 0px 3px 1px -2px, rgba(0, 0, 0, 0.14) 0px 2px 2px 0px, rgba(0, 0, 0, 0.12) 0px 1px 5px 0px"
652
- }, ie = ({ themeColor: t, buttonType: e, text: n, onClick: o }) => {
653
- const a = m.useMemo(() => t === "light" ? U : $, [t]), [r, i] = m.useState(!1), l = m.useMemo(() => {
640
+ }, ne = ({ themeColor: t, buttonType: e, text: n, onClick: o }) => {
641
+ const a = m.useMemo(() => t === "light" ? B : U, [t]), [r, i] = m.useState(!1), d = m.useMemo(() => {
654
642
  const s = {
655
- ...xt,
643
+ ...mt,
656
644
  color: r ? a.palette.primary.contrastText : a.palette.background.contrastText
657
645
  };
658
646
  return e === "cancel" ? {
@@ -663,12 +651,12 @@ const xt = {
663
651
  backgroundColor: r ? a.palette.primary.main : a.palette.background.default
664
652
  };
665
653
  }, [e, r, a]);
666
- return d("button", { ...Z({ dev: { cy: `button-${e}` } }), onMouseEnter: () => i(!0), onMouseLeave: () => i(!1), style: l, onClick: (s) => {
654
+ return l("button", { ...Y({ dev: { cy: `button-${e}` } }), onMouseEnter: () => i(!0), onMouseLeave: () => i(!1), style: d, onClick: (s) => {
667
655
  s.preventDefault(), o();
668
656
  }, "aria-label": n, children: n });
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
- return d(m.Suspense, { fallback: d("div", { children: "Loading..." }), children: d("div", { style: {
657
+ }, xt = ({ challenge: t, index: e, solutions: n, onSubmit: o, onCancel: a, onClick: r, onNext: i, themeColor: d }) => {
658
+ const { t: s } = tt(), f = t.captchas ? b(t.captchas, e) : null, g = n ? b(n, e) : [], u = m.useMemo(() => d === "light" ? B : U, [d]);
659
+ return l(m.Suspense, { fallback: l("div", { children: "Loading..." }), children: l("div", { style: {
672
660
  overflowX: "auto",
673
661
  overflowY: "auto",
674
662
  width: "100%",
@@ -679,49 +667,49 @@ const xt = {
679
667
  border: "1px solid #dddddd",
680
668
  boxShadow: "rgba(255, 255, 255, 0.2) 0px 0px 4px",
681
669
  borderRadius: "4px",
682
- padding: `${p.spacing.unit}px`,
683
- backgroundColor: p.palette.background.default
670
+ padding: `${u.spacing.unit}px`,
671
+ backgroundColor: u.palette.background.default
684
672
  }, children: A("div", { style: {
685
- backgroundColor: p.palette.background.default,
673
+ backgroundColor: u.palette.background.default,
686
674
  display: "flex",
687
675
  flexDirection: "column",
688
676
  minWidth: "300px"
689
- }, children: [d("div", { style: {
677
+ }, children: [l("div", { style: {
690
678
  display: "flex",
691
679
  alignItems: "center",
692
680
  width: "100%"
693
- }, children: d("div", { style: {
694
- backgroundColor: p.palette.primary.main,
681
+ }, children: l("div", { style: {
682
+ backgroundColor: u.palette.primary.main,
695
683
  width: "100%"
696
684
  }, children: A("div", { style: {
697
- paddingLeft: `${p.spacing.half}px`,
698
- paddingRight: `${p.spacing.half}px`
685
+ paddingLeft: `${u.spacing.half}px`,
686
+ paddingRight: `${u.spacing.half}px`
699
687
  }, children: [A("p", { style: {
700
688
  color: "#ffffff",
701
689
  fontWeight: 700,
702
690
  lineHeight: 1.5
703
- }, children: [s("WIDGET.SELECT_ALL"), ":", " ", d("span", { style: { textTransform: "capitalize" }, children: `${C(t.captchas, e).target}` })] }), d("p", { style: {
691
+ }, children: [s("WIDGET.SELECT_ALL"), ":", " ", l("span", { style: { textTransform: "capitalize" }, children: `${b(t.captchas, e).target}` })] }), l("p", { style: {
704
692
  color: "#ffffff",
705
693
  fontWeight: 500,
706
694
  lineHeight: 0.8,
707
695
  fontSize: "0.8rem"
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: {
696
+ }, children: s("WIDGET.IF_NONE_CLICK_NEXT") })] }) }) }), l("div", { ...Y({ dev: { cy: `captcha-${e}` } }), children: f && l(ft, { challenge: f, solution: g, onClick: r, themeColor: d }) }), l("div", { style: {
709
697
  display: "flex",
710
698
  alignItems: "center",
711
699
  justifyContent: "center",
712
700
  width: "100%"
713
- }, ...Z({ dev: { cy: "dots-captcha" } }) }), d("div", { style: {
714
- padding: `0 ${p.spacing}px`,
701
+ }, ...Y({ dev: { cy: "dots-captcha" } }) }), l("div", { style: {
702
+ padding: `0 ${u.spacing}px`,
715
703
  display: "flex",
716
704
  width: "100%"
717
705
  } }), A("div", { style: {
718
- padding: `0 ${p.spacing}px`,
706
+ padding: `0 ${u.spacing}px`,
719
707
  display: "flex",
720
708
  alignItems: "center",
721
709
  justifyContent: "space-between",
722
710
  lineHeight: 1.75
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
- }, Ct = fe.memo((t, e) => {
711
+ }, children: [l(ne, { themeColor: d, buttonType: "cancel", onClick: a, text: s("WIDGET.CANCEL"), "aria-label": s("WIDGET.CANCEL") }), l(ne, { themeColor: d, 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" })] })] }) }) });
712
+ }, bt = pe.memo((t, e) => {
725
713
  const { show: n, children: o } = t, r = {
726
714
  position: "fixed",
727
715
  zIndex: 2147483646,
@@ -738,7 +726,7 @@ const xt = {
738
726
  left: 0,
739
727
  backgroundColor: "rgba(0, 0, 0, 0.5)",
740
728
  zIndex: -1
741
- }, l = {
729
+ }, d = {
742
730
  position: "absolute",
743
731
  top: "50%",
744
732
  left: "50%",
@@ -748,26 +736,26 @@ const xt = {
748
736
  border: "none",
749
737
  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
738
  };
751
- return A("div", { className: "modalOuter", style: r, children: [d("div", { className: "modalBackground", style: i }), d("div", { className: "modalInner", style: l, children: o })] });
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,
739
+ return A("div", { className: "modalOuter", style: r, children: [l("div", { className: "modalBackground", style: i }), l("div", { className: "modalInner", style: d, children: o })] });
740
+ }), wt = (t) => {
741
+ const e = oe.parse(t.config), n = t.callbacks || {}, [o, a] = Fe(m.useState, m.useRef), r = pt(e, o, a, n), i = t.config.theme === "light" ? "light" : "dark", d = t.config.theme === "light" ? B : U;
742
+ return l("div", { children: A("div", { style: {
743
+ maxWidth: he,
756
744
  maxHeight: "100%",
757
745
  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,
761
- backgroundColor: l.palette.background.default,
762
- borderColor: l.palette.grey[300],
763
- borderRadius: we,
746
+ }, children: [l(bt, { show: o.showModal, children: o.challenge ? l(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" }) : l("div", { children: "No challenge set." }) }), l(fe, { children: l(ge, { children: A("div", { style: me, "data-cy": "button-human", children: [" ", A("div", { style: {
747
+ padding: xe,
748
+ border: be,
749
+ backgroundColor: d.palette.background.default,
750
+ borderColor: d.palette.grey[300],
751
+ borderRadius: ye,
764
752
  display: "flex",
765
753
  alignItems: "center",
766
754
  flexWrap: "wrap",
767
755
  justifyContent: "space-between",
768
- minHeight: `${Ae}px`,
756
+ minHeight: `${Ce}px`,
769
757
  overflow: "hidden"
770
- }, children: [d("div", { style: { display: "inline-flex", flexDirection: "column" }, children: d("div", { style: {
758
+ }, children: [l("div", { style: { display: "inline-flex", flexDirection: "column" }, children: l("div", { style: {
771
759
  alignItems: "center",
772
760
  flex: 1
773
761
  }, children: A("div", { style: {
@@ -776,12 +764,12 @@ const xt = {
776
764
  justifyContent: "center",
777
765
  flexDirection: "column",
778
766
  verticalAlign: "middle"
779
- }, children: [d("div", { style: {
767
+ }, children: [l("div", { style: {
780
768
  display: o.loading ? "none" : "flex"
781
- }, children: d(Xe, { themeColor: i, onChange: r.start, checked: o.isHuman, labelText: "I am human", "aria-label": "human checkbox" }) }), d("div", { style: {
769
+ }, children: l(Ke, { themeColor: i, onChange: r.start, checked: o.isHuman, labelText: "I am human", "aria-label": "human checkbox" }) }), l("div", { style: {
782
770
  display: o.loading ? "flex" : "none"
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" }) }) }) })] })] }) }) })] }) });
771
+ }, children: l("div", { style: { display: "inline-flex" }, children: l(we, { themeColor: i, "aria-label": "Loading spinner" }) }) })] }) }) }), l("div", { style: { display: "inline-flex", flexDirection: "column" }, children: l("a", { href: Ae, target: "_blank", "aria-label": ve, rel: "noreferrer", children: l("div", { style: { flex: 1 }, children: l(Te, { themeColor: i, "aria-label": "Prosopo logo" }) }) }) })] })] }) }) })] }) });
784
772
  };
785
773
  export {
786
- vt as default
774
+ wt as default
787
775
  };