@prosopo/procaptcha-bundle 3.0.12 → 3.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js +17 -7
  2. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js.map +1 -1
  3. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +1 -1
  4. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js +1 -1
  5. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js.map +1 -1
  6. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts +1 -0
  7. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts.map +1 -1
  8. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts +1 -1
  9. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
  10. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js +2 -1
  11. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +1 -1
  12. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +1 -1
  13. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js +2 -2
  14. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js.map +1 -1
  15. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts.map +1 -1
  16. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js +6 -2
  17. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js.map +1 -1
  18. package/CHANGELOG.md +374 -0
  19. package/dist/bundle/{ProcaptchaWidget-48FxVPQd.js → ProcaptchaWidget-CJ-4hVS1.js} +25 -25
  20. package/dist/bundle/{ProcaptchaWidget-B2BzhXLv.js → ProcaptchaWidget-Cw3s7cGX.js} +290 -268
  21. package/dist/bundle/{builder-DNHtDoNG.js → builder-ByZ5z580.js} +3 -1
  22. package/dist/bundle/captchaComponentProvider-Cn75EmSH.js +1002 -0
  23. package/dist/bundle/{captchaRenderer-DdOlOCKw.js → captchaRenderer-s4QuLEen.js} +23 -22
  24. package/dist/bundle/{commonChunk-HCVkoCqn.js → commonChunk-BjvuHlB1.js} +62 -68
  25. package/dist/bundle/{emotion-element-5486c51c.browser.esm-D7qvHZDV.js → emotion-element-c39617d8.browser.esm-BNNnmykm.js} +343 -345
  26. package/dist/bundle/index-BuQg3Zno.js +1884 -0
  27. package/dist/bundle/{index-DyYmvHVN.js → index-DIdd2cUz.js} +1 -1
  28. package/dist/bundle/{index-C00_J7av.js → index-IgqrmVIs.js} +61 -59
  29. package/dist/bundle/nobleChunk-Bbltwf44.js +2728 -0
  30. package/dist/bundle/procaptcha.bundle.js +2 -2
  31. package/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +1 -1
  32. package/dist/bundle/util/captcha/captchaProps.d.ts +1 -0
  33. package/dist/bundle/util/captcha/captchaProps.d.ts.map +1 -1
  34. package/dist/bundle/util/captcha/captchaRenderer.d.ts +1 -1
  35. package/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
  36. package/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +1 -1
  37. package/dist/bundle/util/widgetFactory.d.ts.map +1 -1
  38. package/dist/bundle/{utilChunk-sqstc6C5.js → utilChunk-DPr6oTOj.js} +22 -22
  39. package/dist/bundle/{utilCryptoChunk-qm-BM2eT.js → utilCryptoChunk-D6ZLkbFV.js} +176 -167
  40. package/dist/bundle/{web2Chunk-DCsWA5PR.js → web2Chunk-CNoojUDK.js} +1083 -983
  41. package/dist/bundle/web3Chunk-BlYvY4Ea.js +525 -0
  42. package/dist/bundle/{zodChunk-wTu9ZHzV.js → zodChunk-aEfPZzrp.js} +3 -3
  43. package/dist/cjs/util/captcha/captchaComponentProvider.cjs +3 -2
  44. package/dist/cjs/util/captcha/captchaRenderer.cjs +4 -3
  45. package/dist/cjs/util/captcha/components/frictionlessCaptcha.cjs +4 -3
  46. package/dist/cjs/util/captcha/components/imageCaptcha.cjs +1 -1
  47. package/dist/cjs/util/captcha/components/powCaptcha.cjs +1 -1
  48. package/dist/cjs/util/widgetFactory.cjs +7 -2
  49. package/dist/util/captcha/captchaComponentProvider.js +3 -2
  50. package/dist/util/captcha/captchaRenderer.js +4 -3
  51. package/dist/util/captcha/components/frictionlessCaptcha.js +4 -3
  52. package/dist/util/captcha/components/imageCaptcha.js +1 -1
  53. package/dist/util/captcha/components/powCaptcha.js +1 -1
  54. package/dist/util/widgetFactory.js +7 -2
  55. package/package.json +25 -26
  56. package/stats.html +1 -1
  57. package/vite.test.config.ts +3 -2
  58. package/dist/bundle/captchaComponentProvider-B7Vxx339.js +0 -968
  59. package/dist/bundle/index-7Xh-Mf8v.js +0 -1318
  60. package/dist/bundle/nobleChunk-Qozzkbsq.js +0 -3648
  61. package/dist/bundle/web3Chunk-B8txCqUJ.js +0 -517
@@ -1,12 +1,12 @@
1
- import { j as l, a as H, g as oe, p as U, b as ne, P as ae, E as re, c as se, C as ie } from "./captchaComponentProvider-B7Vxx339.js";
2
- import { r as m, u as V, a as b, A as w, f as ce, h as le, s as de, P as X, g as ue, l as pe } from "./web2Chunk-DCsWA5PR.js";
3
- import { b as _, c as W, P as v, a as N } from "./commonChunk-HCVkoCqn.js";
4
- import { b as he, u as ge } from "./builder-DNHtDoNG.js";
5
- import { u as fe } from "./utilCryptoChunk-qm-BM2eT.js";
6
- import { w as me } from "./utilChunk-sqstc6C5.js";
7
- import { l as M, d as D } from "./index-C00_J7av.js";
8
- import { r as xe } from "./index-DyYmvHVN.js";
9
- const Ce = {
1
+ import { j as d, a as P, g as ie, p as z, b as ce, P as le, E as de, c as ue, C as he } from "./captchaComponentProvider-Cn75EmSH.js";
2
+ import { r as C, u as Z, a as v, A, g as pe, h as ge, i as fe, s as me, P as Q, j as xe, l as Ce } from "./web2Chunk-CNoojUDK.js";
3
+ import { b as _, P as T, a as H } from "./commonChunk-BjvuHlB1.js";
4
+ import { b as we, u as be } from "./builder-ByZ5z580.js";
5
+ import { u as U, v as ye } from "./utilCryptoChunk-D6ZLkbFV.js";
6
+ import { w as Ae } from "./utilChunk-DPr6oTOj.js";
7
+ import { l as M, d as D } from "./index-IgqrmVIs.js";
8
+ import { r as ve } from "./index-DIdd2cUz.js";
9
+ const Ee = {
10
10
  border: "none",
11
11
  paddingTop: "6px",
12
12
  paddingBottom: "6px",
@@ -15,16 +15,16 @@ const Ce = {
15
15
  width: "39px",
16
16
  borderRadius: "50%",
17
17
  display: "flex"
18
- }, we = ({
18
+ }, Te = ({
19
19
  themeColor: r,
20
20
  onReload: e
21
21
  }) => {
22
- const o = m.useMemo(
22
+ const o = C.useMemo(
23
23
  () => r === "light" ? M : D,
24
24
  [r]
25
- ), [n, t] = m.useState(!1), i = m.useMemo(() => ({
25
+ ), [n, t] = C.useState(!1), i = C.useMemo(() => ({
26
26
  ...{
27
- ...Ce,
27
+ ...Ee,
28
28
  backgroundColor: o.palette.background.default,
29
29
  color: n ? o.palette.primary.contrastText : o.palette.background.contrastText,
30
30
  border: `1px solid ${o.palette.grey[500]}`,
@@ -37,7 +37,7 @@ const Ce = {
37
37
  },
38
38
  backgroundColor: n ? o.palette.grey[700] : o.palette.background.default
39
39
  }), [n, o]);
40
- return /* @__PURE__ */ l(
40
+ return /* @__PURE__ */ d(
41
41
  "button",
42
42
  {
43
43
  className: "reload-button",
@@ -49,7 +49,7 @@ const Ce = {
49
49
  onClick: (a) => {
50
50
  a.preventDefault(), e();
51
51
  },
52
- children: /* @__PURE__ */ H(
52
+ children: /* @__PURE__ */ P(
53
53
  "svg",
54
54
  {
55
55
  width: "16px",
@@ -60,8 +60,8 @@ const Ce = {
60
60
  xmlnsXlink: "http://www.w3.org/1999/xlink",
61
61
  style: { display: "flex" },
62
62
  children: [
63
- /* @__PURE__ */ l("title", { children: "reload" }),
64
- /* @__PURE__ */ l(
63
+ /* @__PURE__ */ d("title", { children: "reload" }),
64
+ /* @__PURE__ */ d(
65
65
  "path",
66
66
  {
67
67
  shapeRendering: "optimizeQuality",
@@ -75,23 +75,23 @@ const Ce = {
75
75
  )
76
76
  }
77
77
  );
78
- }, be = (r) => {
78
+ }, Ie = (r) => {
79
79
  if (!r.hash)
80
80
  throw new _("CAPTCHA.MISSING_ITEM_HASH", {
81
81
  context: { item: r }
82
82
  });
83
83
  return r.hash;
84
- }, Ae = ({
84
+ }, Ne = ({
85
85
  challenge: r,
86
86
  solution: e,
87
87
  onClick: o,
88
88
  themeColor: n
89
89
  }) => {
90
- const t = r.items, i = m.useMemo(
90
+ const t = r.items, i = C.useMemo(
91
91
  () => n === "light" ? M : D,
92
92
  [n]
93
93
  ), a = `${i.spacing.unit}px`;
94
- return /* @__PURE__ */ l(
94
+ return /* @__PURE__ */ d(
95
95
  "div",
96
96
  {
97
97
  style: {
@@ -107,16 +107,16 @@ const Ce = {
107
107
  paddingTop: a,
108
108
  gap: "10px"
109
109
  },
110
- children: t.map((s, d) => {
111
- const u = be(s);
112
- return /* @__PURE__ */ l("div", { style: {
110
+ children: t.map((s, l) => {
111
+ const h = Ie(s);
112
+ return /* @__PURE__ */ d("div", { style: {
113
113
  // enable the items in the grid to grow in width to use up excess space
114
114
  flexGrow: 1,
115
115
  // make the width of each item 1/3rd of the width overall, i.e. 3 columns
116
116
  flexBasis: "calc(33.333% - 10px)",
117
117
  // include the padding / margin / border in the width
118
118
  boxSizing: "border-box"
119
- }, children: /* @__PURE__ */ H(
119
+ }, children: /* @__PURE__ */ P(
120
120
  "div",
121
121
  {
122
122
  style: {
@@ -127,9 +127,21 @@ const Ce = {
127
127
  padding: 0,
128
128
  margin: 0
129
129
  },
130
- onClick: () => o(u),
130
+ onClick: (u) => {
131
+ if (u.isTrusted) {
132
+ if ("touches" in u && u.touches.length > 0 && u.touches[0]) {
133
+ o(h, u.touches[0].clientX, u.touches[0].clientY);
134
+ return;
135
+ }
136
+ if ("clientX" in u && "clientY" in u) {
137
+ o(h, u.clientX, u.clientY);
138
+ return;
139
+ }
140
+ o(h, 0, 0);
141
+ }
142
+ },
131
143
  children: [
132
- /* @__PURE__ */ l(
144
+ /* @__PURE__ */ d(
133
145
  "img",
134
146
  {
135
147
  style: {
@@ -149,10 +161,14 @@ const Ce = {
149
161
  borderColor: i.palette.grey[300]
150
162
  },
151
163
  src: s.data,
152
- alt: `Captcha image ${d + 1}`
164
+ alt: `Captcha image ${l + 1}`,
165
+ onError: (u) => {
166
+ const f = u.currentTarget;
167
+ f._retryCount = (f._retryCount || 0) + 1, f._retryCount <= 3 && (f.src = `${s.data}?retry=${Date.now()}`);
168
+ }
153
169
  }
154
170
  ),
155
- /* @__PURE__ */ l(
171
+ /* @__PURE__ */ d(
156
172
  "div",
157
173
  {
158
174
  style: {
@@ -169,9 +185,9 @@ const Ce = {
169
185
  justifyContent: "center",
170
186
  // make bg half opacity, i.e. shadowing the item's img
171
187
  backgroundColor: "rgba(0,0,0,0.5)",
172
- visibility: e.includes(u) ? "visible" : "hidden"
188
+ visibility: e.some((u) => u[0] === h) ? "visible" : "hidden"
173
189
  },
174
- children: /* @__PURE__ */ l(
190
+ children: /* @__PURE__ */ d(
175
191
  "svg",
176
192
  {
177
193
  style: {
@@ -191,7 +207,7 @@ const Ce = {
191
207
  viewBox: "0 0 24 24",
192
208
  "data-testid": "CheckIcon",
193
209
  "aria-label": "Check icon",
194
- children: /* @__PURE__ */ l("path", { d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" })
210
+ children: /* @__PURE__ */ d("path", { d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" })
195
211
  }
196
212
  )
197
213
  }
@@ -203,22 +219,22 @@ const Ce = {
203
219
  }
204
220
  );
205
221
  };
206
- function ye(r = {}) {
222
+ function He(r = {}) {
207
223
  return Object.keys(r).reduce(
208
224
  // biome-ignore lint/performance/noAccumulatingSpread: TODO fix
209
225
  (e, o) => ({ ...e, [`data-${o}`]: r[o] }),
210
226
  {}
211
227
  );
212
228
  }
213
- function q({
229
+ function J({
214
230
  general: r,
215
231
  dev: e
216
232
  }) {
217
233
  return {
218
- ...ye(r)
234
+ ...He(r)
219
235
  };
220
236
  }
221
- const ve = {
237
+ const Pe = {
222
238
  display: "inline-flex",
223
239
  alignItems: "center",
224
240
  justifyContent: "center",
@@ -241,18 +257,18 @@ const ve = {
241
257
  borderRadius: "4px",
242
258
  transition: "background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
243
259
  backgroundColor: "#ffffff"
244
- }, B = ({
260
+ }, F = ({
245
261
  themeColor: r,
246
262
  buttonType: e,
247
263
  text: o,
248
264
  onClick: n
249
265
  }) => {
250
- const t = m.useMemo(
266
+ const t = C.useMemo(
251
267
  () => r === "light" ? M : D,
252
268
  [r]
253
- ), [i, a] = m.useState(!1), s = m.useMemo(() => {
254
- const d = {
255
- ...ve,
269
+ ), [i, a] = C.useState(!1), s = C.useMemo(() => {
270
+ const l = {
271
+ ...Pe,
256
272
  border: `1px solid ${t.palette.grey[500]}`,
257
273
  boxShadow: `0px 1px 3px 0px ${t.palette.grey[500]}`,
258
274
  fontFamily: t.font.fontFamily,
@@ -260,28 +276,28 @@ const ve = {
260
276
  color: i ? t.palette.primary.contrastText : t.palette.background.contrastText
261
277
  };
262
278
  return e === "cancel" ? {
263
- ...d,
279
+ ...l,
264
280
  backgroundColor: i ? t.palette.grey[600] : "transparent"
265
281
  } : {
266
- ...d,
282
+ ...l,
267
283
  backgroundColor: i ? t.palette.primary.main : t.palette.background.default
268
284
  };
269
285
  }, [e, i, t]);
270
- return /* @__PURE__ */ l(
286
+ return /* @__PURE__ */ d(
271
287
  "button",
272
288
  {
273
- ...q({ dev: {} }),
289
+ ...J({ dev: {} }),
274
290
  onMouseEnter: () => a(!0),
275
291
  onMouseLeave: () => a(!1),
276
292
  style: s,
277
- onClick: (d) => {
278
- d.preventDefault(), n();
293
+ onClick: (l) => {
294
+ l.isTrusted && (l.preventDefault(), n());
279
295
  },
280
296
  "aria-label": o,
281
297
  children: o
282
298
  }
283
299
  );
284
- }, $ = ({
300
+ }, K = ({
285
301
  challenge: r,
286
302
  index: e,
287
303
  solutions: o,
@@ -290,13 +306,13 @@ const ve = {
290
306
  onClick: i,
291
307
  onNext: a,
292
308
  onReload: s,
293
- themeColor: d
309
+ themeColor: l
294
310
  }) => {
295
- const { t: u } = V(), C = r.captchas ? b(r.captchas, e) : null, h = o ? b(o, e) : [], A = m.useMemo(
296
- () => d === "light" ? M : D,
297
- [d]
298
- ), k = `${A.spacing.unit * 2}px`, g = `${A.spacing.unit}px`;
299
- return /* @__PURE__ */ l(m.Suspense, { fallback: /* @__PURE__ */ l("div", { children: "Loading..." }), children: /* @__PURE__ */ l(
311
+ const { t: h } = Z(), b = r.captchas ? v(r.captchas, e) : null, u = o ? v(o, e) : [], f = C.useMemo(
312
+ () => l === "light" ? M : D,
313
+ [l]
314
+ ), R = `${f.spacing.unit * 2}px`, g = `${f.spacing.unit}px`;
315
+ return /* @__PURE__ */ d(C.Suspense, { fallback: /* @__PURE__ */ d("div", { children: "Loading..." }), children: /* @__PURE__ */ d(
300
316
  "div",
301
317
  {
302
318
  style: {
@@ -310,16 +326,16 @@ const ve = {
310
326
  border: "1px solid #dddddd",
311
327
  boxShadow: "rgba(255, 255, 255, 0.2) 0px 0px 4px",
312
328
  borderRadius: "4px",
313
- backgroundColor: A.palette.background.default,
329
+ backgroundColor: f.palette.background.default,
314
330
  userSelect: "none",
315
331
  touchAction: "none",
316
332
  overscrollBehavior: "none"
317
333
  },
318
- children: /* @__PURE__ */ H(
334
+ children: /* @__PURE__ */ P(
319
335
  "div",
320
336
  {
321
337
  style: {
322
- backgroundColor: A.palette.background.default,
338
+ backgroundColor: f.palette.background.default,
323
339
  display: "flex",
324
340
  flexDirection: "column",
325
341
  minWidth: "300px",
@@ -328,7 +344,7 @@ const ve = {
328
344
  justifyContent: "center"
329
345
  },
330
346
  children: [
331
- /* @__PURE__ */ l(
347
+ /* @__PURE__ */ d(
332
348
  "div",
333
349
  {
334
350
  style: {
@@ -336,23 +352,23 @@ const ve = {
336
352
  alignItems: "center",
337
353
  width: "100%"
338
354
  },
339
- children: /* @__PURE__ */ l(
355
+ children: /* @__PURE__ */ d(
340
356
  "div",
341
357
  {
342
358
  style: {
343
- backgroundColor: A.palette.primary.main,
359
+ backgroundColor: f.palette.primary.main,
344
360
  width: "100%",
345
361
  marginTop: g
346
362
  },
347
- children: /* @__PURE__ */ H(
363
+ children: /* @__PURE__ */ P(
348
364
  "div",
349
365
  {
350
366
  style: {
351
- padding: `${A.spacing.half}px`,
352
- fontFamily: A.font.fontFamily
367
+ padding: `${f.spacing.half}px`,
368
+ fontFamily: f.font.fontFamily
353
369
  },
354
370
  children: [
355
- /* @__PURE__ */ H(
371
+ /* @__PURE__ */ P(
356
372
  "p",
357
373
  {
358
374
  style: {
@@ -361,14 +377,14 @@ const ve = {
361
377
  lineHeight: 1.5
362
378
  },
363
379
  children: [
364
- u("WIDGET.SELECT_ALL"),
380
+ h("WIDGET.SELECT_ALL"),
365
381
  ":",
366
382
  " ",
367
- /* @__PURE__ */ l("span", { children: `${b(r.captchas, e).target} ` })
383
+ /* @__PURE__ */ d("span", { children: `${v(r.captchas, e).target} ` })
368
384
  ]
369
385
  }
370
386
  ),
371
- /* @__PURE__ */ l(
387
+ /* @__PURE__ */ d(
372
388
  "p",
373
389
  {
374
390
  style: {
@@ -377,7 +393,7 @@ const ve = {
377
393
  lineHeight: 0.8,
378
394
  fontSize: "0.8rem"
379
395
  },
380
- children: u("WIDGET.IF_NONE_CLICK_NEXT")
396
+ children: h("WIDGET.IF_NONE_CLICK_NEXT")
381
397
  }
382
398
  )
383
399
  ]
@@ -387,23 +403,23 @@ const ve = {
387
403
  )
388
404
  }
389
405
  ),
390
- /* @__PURE__ */ l(
406
+ /* @__PURE__ */ d(
391
407
  "div",
392
408
  {
393
- ...q({ dev: {} }),
409
+ ...J({ dev: {} }),
394
410
  style: { overflow: "hidden" },
395
- children: C && /* @__PURE__ */ l(
396
- Ae,
411
+ children: b && /* @__PURE__ */ d(
412
+ Ne,
397
413
  {
398
- challenge: C,
399
- solution: h,
414
+ challenge: b,
415
+ solution: u,
400
416
  onClick: i,
401
- themeColor: d
417
+ themeColor: l
402
418
  }
403
419
  )
404
420
  }
405
421
  ),
406
- /* @__PURE__ */ l(
422
+ /* @__PURE__ */ d(
407
423
  "div",
408
424
  {
409
425
  style: {
@@ -411,24 +427,23 @@ const ve = {
411
427
  alignItems: "center",
412
428
  justifyContent: "space-between",
413
429
  lineHeight: 1.75,
414
- padding: `${g} 0 ${k} 0`
430
+ padding: `${g} 0 ${R} 0`
415
431
  },
416
- children: /* @__PURE__ */ H(
432
+ children: /* @__PURE__ */ P(
417
433
  "div",
418
434
  {
419
435
  style: {
420
436
  // expand to full height / width of parent
421
437
  width: "100%",
422
438
  height: "100%",
423
- // display children in flex, spreading them evenly and wrapping when row length exceeded
439
+ // display children in flex, spreading them evenly
424
440
  display: "flex",
425
441
  flexDirection: "row",
426
- flexWrap: "wrap",
427
442
  justifyContent: "space-between",
428
443
  gap: "10px"
429
444
  },
430
445
  children: [
431
- /* @__PURE__ */ l(
446
+ /* @__PURE__ */ d(
432
447
  "div",
433
448
  {
434
449
  style: {
@@ -437,19 +452,19 @@ const ve = {
437
452
  // make the width of each item 1/3rd of the width overall, i.e. 3 columns
438
453
  flexBasis: "calc(33.333% - 10px)"
439
454
  },
440
- children: /* @__PURE__ */ l(
441
- B,
455
+ children: /* @__PURE__ */ d(
456
+ F,
442
457
  {
443
- themeColor: d,
458
+ themeColor: l,
444
459
  buttonType: "cancel",
445
460
  onClick: t,
446
- text: u("WIDGET.CANCEL"),
447
- "aria-label": u("WIDGET.CANCEL")
461
+ text: h("WIDGET.CANCEL"),
462
+ "aria-label": h("WIDGET.CANCEL")
448
463
  }
449
464
  )
450
465
  }
451
466
  ),
452
- /* @__PURE__ */ l(
467
+ /* @__PURE__ */ d(
453
468
  "div",
454
469
  {
455
470
  style: {
@@ -458,10 +473,10 @@ const ve = {
458
473
  // make the width of each item 1/3rd of the width overall, i.e. 3 columns
459
474
  flexBasis: "calc(33.333% - 10px)"
460
475
  },
461
- children: /* @__PURE__ */ l(we, { themeColor: d, onReload: s })
476
+ children: /* @__PURE__ */ d(Te, { themeColor: l, onReload: s })
462
477
  }
463
478
  ),
464
- /* @__PURE__ */ l(
479
+ /* @__PURE__ */ d(
465
480
  "div",
466
481
  {
467
482
  style: {
@@ -470,14 +485,14 @@ const ve = {
470
485
  // make the width of each item 1/3rd of the width overall, i.e. 3 columns
471
486
  flexBasis: "calc(33.333% - 10px)"
472
487
  },
473
- children: /* @__PURE__ */ l(
474
- B,
488
+ children: /* @__PURE__ */ d(
489
+ F,
475
490
  {
476
- themeColor: d,
491
+ themeColor: l,
477
492
  buttonType: "next",
478
- text: e < r.captchas.length - 1 ? u("WIDGET.NEXT") : u("WIDGET.SUBMIT"),
493
+ text: e < r.captchas.length - 1 ? h("WIDGET.NEXT") : h("WIDGET.SUBMIT"),
479
494
  onClick: e < r.captchas.length - 1 ? a : n,
480
- "aria-label": e < r.captchas.length - 1 ? u("WIDGET.NEXT") : u("WIDGET.SUBMIT"),
495
+ "aria-label": e < r.captchas.length - 1 ? h("WIDGET.NEXT") : h("WIDGET.SUBMIT"),
481
496
  "data-cy": "button-next"
482
497
  }
483
498
  )
@@ -494,26 +509,26 @@ const ve = {
494
509
  }
495
510
  ) });
496
511
  };
497
- function Ee(r) {
498
- return W([
512
+ function Re(r) {
513
+ return U([
499
514
  r.captchaId,
500
515
  r.captchaContentId,
501
516
  [...r.solution].sort(),
502
517
  r.salt
503
518
  ]);
504
519
  }
505
- class z {
520
+ class V {
506
521
  constructor(e) {
507
522
  this.hash = e, this.parent = null;
508
523
  }
509
524
  }
510
- class Te {
525
+ class ke {
511
526
  constructor() {
512
527
  this.leaves = [], this.layers = [];
513
528
  }
514
529
  getRoot() {
515
530
  if (this.root === void 0)
516
- throw new v("DATASET.MERKLE_ERROR", {
531
+ throw new T("DATASET.MERKLE_ERROR", {
517
532
  context: {
518
533
  error: "root undefined",
519
534
  failedFuncName: this.getRoot.name
@@ -525,7 +540,7 @@ class Te {
525
540
  this.layers.length && (this.layers = []);
526
541
  const o = [];
527
542
  for (const n of e) {
528
- const t = new z(n);
543
+ const t = new V(n);
529
544
  this.leaves.push(t), o.push(t.hash);
530
545
  }
531
546
  this.layers.push(o), this.root = this.buildMerkleTree(this.leaves)[0];
@@ -540,17 +555,17 @@ class Te {
540
555
  for (; t < o; ) {
541
556
  const a = e[t];
542
557
  if (a === void 0)
543
- throw new v("DEVELOPER.GENERAL", {
558
+ throw new T("DEVELOPER.GENERAL", {
544
559
  context: { error: "leftChild undefined" }
545
560
  });
546
- const s = t + 1 < o ? b(e, t + 1) : a, d = this.createParent(a, s);
547
- i.push(d.hash), n.push(d), t += 2;
561
+ const s = t + 1 < o ? v(e, t + 1) : a, l = this.createParent(a, s);
562
+ i.push(l.hash), n.push(l), t += 2;
548
563
  }
549
564
  return this.layers.push(i), this.buildMerkleTree(n);
550
565
  }
551
566
  createParent(e, o) {
552
- const n = new z(
553
- W([e.hash, o.hash])
567
+ const n = new V(
568
+ U([e.hash, o.hash])
554
569
  );
555
570
  return e.parent = n.hash, o.parent = n.hash, n;
556
571
  }
@@ -560,7 +575,7 @@ class Te {
560
575
  for (; n < this.layers.length - 1; ) {
561
576
  const i = this.layers[n];
562
577
  if (i === void 0)
563
- throw new v("DATASET.MERKLE_ERROR", {
578
+ throw new T("DATASET.MERKLE_ERROR", {
564
579
  context: {
565
580
  error: "layer undefined",
566
581
  failedFuncName: this.proof.name,
@@ -570,14 +585,14 @@ class Te {
570
585
  const a = i.indexOf(e);
571
586
  let s = a % 2 && a > 0 ? a - 1 : a + 1;
572
587
  s > i.length - 1 && (s = a);
573
- const d = [e], u = b(i, s);
574
- s > a ? d.push(u) : d.unshift(u), o.push([b(d, 0), b(d, 1)]), n += 1, e = W(d);
588
+ const l = [e], h = v(i, s);
589
+ s > a ? l.push(h) : l.unshift(h), o.push([v(l, 0), v(l, 1)]), n += 1, e = U(l);
575
590
  }
576
- const t = b(this.layers, this.layers.length - 1);
577
- return [...o, [b(t, 0)]];
591
+ const t = v(this.layers, this.layers.length - 1);
592
+ return [...o, [v(t, 0)]];
578
593
  }
579
594
  }
580
- class F {
595
+ class X {
581
596
  constructor(e, o, n, t, i) {
582
597
  this.userAccount = e, this.provider = o, this.providerApi = n, this._web2 = t, this.dappAccount = i;
583
598
  }
@@ -591,30 +606,30 @@ class F {
591
606
  this.provider,
592
607
  e
593
608
  );
594
- if (o[w.error])
609
+ if (o[A.error])
595
610
  return o;
596
611
  for (const n of o.captchas)
597
612
  for (const t of n.items)
598
613
  t.data && (t.data = `https://${t.data.replace(/^http(s)*:\/\//, "")}`);
599
614
  return o;
600
615
  } catch (o) {
601
- throw new N("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
616
+ throw new H("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
602
617
  context: { error: o }
603
618
  });
604
619
  }
605
620
  }
606
621
  async submitCaptchaSolution(e, o, n, t, i) {
607
- const a = new Te(), s = n.map(
608
- (C) => Ee(C)
622
+ const a = new ke(), s = n.map(
623
+ (b) => Re(b)
609
624
  );
610
625
  if (a.build(s), !a.root)
611
626
  throw new _("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
612
627
  context: { error: "Merkle tree root is undefined" }
613
628
  });
614
- const d = a.root.hash;
615
- let u;
629
+ const l = a.root.hash;
630
+ let h;
616
631
  try {
617
- u = await this.providerApi.submitCaptchaSolution(
632
+ h = await this.providerApi.submitCaptchaSolution(
618
633
  n,
619
634
  o,
620
635
  this.userAccount,
@@ -622,15 +637,15 @@ class F {
622
637
  i,
623
638
  e
624
639
  );
625
- } catch (C) {
640
+ } catch (b) {
626
641
  throw new _("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
627
- context: { error: C }
642
+ context: { error: b }
628
643
  });
629
644
  }
630
- return [u, d];
645
+ return [h, l];
631
646
  }
632
647
  }
633
- const Ie = () => ({
648
+ const Le = () => ({
634
649
  // note order matters! see buildUpdateState. These fields are set in order, so disable modal first, then set loading to false, etc.
635
650
  showModal: !1,
636
651
  loading: !1,
@@ -642,17 +657,17 @@ const Ie = () => ({
642
657
  account: void 0
643
658
  // don't handle timeout here, this should be handled by the state management
644
659
  });
645
- function Ne(r, e, o, n, t) {
646
- const i = oe(n), a = he(e, o), s = () => {
660
+ function _e(r, e, o, n, t) {
661
+ const i = ie(n), a = we(e, o), s = () => {
647
662
  const c = {
648
663
  userAccountAddress: "",
649
664
  ...r
650
665
  };
651
- return e.account && (c.userAccountAddress = e.account.account.address), X.parse(c);
652
- }, d = async () => {
653
- i.onOpen(), await U(
666
+ return e.account && (c.userAccountAddress = e.account.account.address), Q.parse(c);
667
+ }, l = async () => {
668
+ i.onOpen(), await z(
654
669
  async () => {
655
- var P;
670
+ var I;
656
671
  if (e.loading || e.isHuman)
657
672
  return;
658
673
  a({ loading: !0 }), a({
@@ -661,25 +676,25 @@ function Ne(r, e, o, n, t) {
661
676
  sessionId: t == null ? void 0 : t.sessionId
662
677
  });
663
678
  const c = s();
664
- a({ dappAccount: c.account.address }), await de(100);
665
- const f = await Y();
679
+ a({ dappAccount: c.account.address }), await me(100);
680
+ const m = await ee();
666
681
  let x = e.captchaApi;
667
682
  if (t != null && t.provider) {
668
- const I = t.provider.provider.url, y = await g(I);
669
- x = new F(
670
- f.account.address,
683
+ const w = t.provider.provider.url, y = await g(w);
684
+ x = new X(
685
+ m.account.address,
671
686
  t.provider,
672
687
  y,
673
688
  c.web2,
674
689
  c.account.address || ""
675
690
  ), a({ captchaApi: x });
676
691
  } else {
677
- const I = await ne(
678
- s()
679
- ), y = I.provider.url, E = await g(y);
680
- x = new F(
681
- f.account.address,
682
- I,
692
+ const w = await ce(
693
+ s().defaultEnvironment
694
+ ), y = w.provider.url, E = await g(y);
695
+ x = new X(
696
+ m.account.address,
697
+ w,
683
698
  E,
684
699
  c.web2,
685
700
  c.account.address || ""
@@ -695,15 +710,15 @@ function Ne(r, e, o, n, t) {
695
710
  message: p.error.message,
696
711
  key: p.error.key || "API.UNKNOWN_ERROR"
697
712
  }
698
- }), i.onError(new Error((P = p.error) == null ? void 0 : P.message));
713
+ }), i.onError(new Error((I = p.error) == null ? void 0 : I.message));
699
714
  else {
700
715
  if (p.captchas.length <= 0)
701
716
  throw new _("DEVELOPER.PROVIDER_NO_CAPTCHA");
702
- const I = p.captchas.map(
717
+ const w = p.captchas.map(
703
718
  (E) => E.timeLimitMs || c.captchas.image.challengeTimeout
704
- ).reduce((E, L) => E + L), y = setTimeout(() => {
719
+ ).reduce((E, W) => E + W), y = setTimeout(() => {
705
720
  i.onChallengeExpired(), a({ isHuman: !1, showModal: !1, loading: !1 });
706
- }, I);
721
+ }, w);
707
722
  a({
708
723
  index: 0,
709
724
  solutions: p.captchas.map(() => []),
@@ -714,169 +729,176 @@ function Ne(r, e, o, n, t) {
714
729
  });
715
730
  }
716
731
  },
717
- d,
718
- R,
732
+ l,
733
+ L,
719
734
  e.attemptCount,
720
735
  10
721
736
  );
722
- }, u = async () => {
723
- await U(
737
+ }, h = async () => {
738
+ await z(
724
739
  async () => {
725
- if (T(), !e.challenge)
726
- throw new v("CAPTCHA.NO_CAPTCHA", {
740
+ if (N(), !e.challenge)
741
+ throw new T("CAPTCHA.NO_CAPTCHA", {
727
742
  context: { error: "Cannot submit, no Captcha found in state" }
728
743
  });
729
744
  a({ showModal: !1 });
730
- const c = e.challenge, f = fe(), x = e.challenge.captchas.map(
731
- (O, ee) => {
732
- const te = b(e.solutions, ee);
745
+ const c = e.challenge, m = e.challenge.captchas.map(
746
+ (O, ne) => {
747
+ const B = v(e.solutions, ne), j = B.flatMap(([k, $, se]) => [$, se]), ae = ye(
748
+ j.map((k) => k.toString(16).length + 4).reduce((k, $) => k + $, 0)
749
+ ), re = pe(ae, j);
733
750
  return {
734
751
  captchaId: O.captchaId,
735
752
  captchaContentId: O.captchaContentId,
736
- salt: f,
737
- solution: te
753
+ salt: re,
754
+ solution: B.flatMap((k) => k[0])
738
755
  };
739
756
  }
740
- ), p = G(), P = Q(p).signer;
741
- if (!b(c.captchas, 0).datasetId)
757
+ ), x = G(), p = oe(x).signer;
758
+ if (!v(c.captchas, 0).datasetId)
742
759
  throw new _("CAPTCHA.INVALID_CAPTCHA_ID", {
743
760
  context: { error: "No datasetId set for challenge" }
744
761
  });
745
- const y = e.captchaApi;
746
- if (!y)
747
- throw new v("CAPTCHA.INVALID_TOKEN", {
762
+ const w = e.captchaApi;
763
+ if (!w)
764
+ throw new T("CAPTCHA.INVALID_TOKEN", {
748
765
  context: { error: "No Captcha API found in state" }
749
766
  });
750
- if (!P || !P.signRaw)
751
- throw new N("GENERAL.CANT_FIND_KEYRINGPAIR", {
767
+ if (!p || !p.signRaw)
768
+ throw new H("GENERAL.CANT_FIND_KEYRINGPAIR", {
752
769
  context: {
753
770
  error: "Signer is not defined, cannot sign message to prove account ownership"
754
771
  }
755
772
  });
756
- const E = await P.signRaw({
757
- address: p.account.address,
758
- data: me(c[w.timestamp]),
773
+ const y = await p.signRaw({
774
+ address: x.account.address,
775
+ data: Ae(c[A.timestamp]),
759
776
  type: "bytes"
760
- }), L = await y.submitCaptchaSolution(
761
- E.signature,
777
+ }), E = await w.submitCaptchaSolution(
778
+ y.signature,
762
779
  c.requestHash,
763
- x,
780
+ m,
764
781
  c.timestamp,
765
782
  c.signature.provider.requestHash
766
- ), J = L[0].verified;
783
+ ), W = E[0].verified;
767
784
  if (a({
768
- submission: L,
769
- isHuman: J,
785
+ submission: E,
786
+ isHuman: W,
770
787
  loading: !1
771
788
  }), e.isHuman) {
772
- const O = y.provider.provider.url;
789
+ const O = w.provider.provider.url;
773
790
  i.onHuman(
774
- ce({
775
- [w.providerUrl]: O,
776
- [w.user]: p.account.address,
777
- [w.dapp]: Z(),
778
- [w.commitmentId]: le(L[1]),
779
- [w.timestamp]: c.timestamp,
780
- [w.signature]: {
781
- [w.provider]: {
782
- [w.requestHash]: c.signature.provider.requestHash
791
+ ge({
792
+ [A.providerUrl]: O,
793
+ [A.user]: x.account.address,
794
+ [A.dapp]: te(),
795
+ [A.commitmentId]: fe(E[1]),
796
+ [A.timestamp]: c.timestamp,
797
+ [A.signature]: {
798
+ [A.provider]: {
799
+ [A.requestHash]: c.signature.provider.requestHash
783
800
  },
784
- [w.user]: {
785
- [w.timestamp]: E.signature
801
+ [A.user]: {
802
+ [A.timestamp]: y.signature
786
803
  }
787
804
  }
788
805
  })
789
806
  ), S();
790
807
  } else
791
- i.onFailed(), R(t == null ? void 0 : t.restart);
808
+ i.onFailed(), L(t == null ? void 0 : t.restart);
792
809
  },
793
- d,
794
- R,
810
+ l,
811
+ L,
795
812
  e.attemptCount,
796
813
  10
797
814
  );
798
- }, C = async () => {
799
- T(), R(t == null ? void 0 : t.restart), i.onClose();
800
- }, h = async () => {
801
- T(), i.onReload(), R(t == null ? void 0 : t.restart), t != null && t.restart || await d();
802
- }, A = (c) => {
815
+ }, b = async () => {
816
+ N(), L(t == null ? void 0 : t.restart), i.onClose();
817
+ }, u = async () => {
818
+ N(), i.onReload(), L(t == null ? void 0 : t.restart), t != null && t.restart || await l();
819
+ }, f = (c, m, x) => {
803
820
  if (!e.challenge)
804
- throw new v("CAPTCHA.NO_CAPTCHA", {
821
+ throw new T("CAPTCHA.NO_CAPTCHA", {
805
822
  context: { error: "Cannot select, no Captcha found in state" }
806
823
  });
807
824
  if (e.index >= e.challenge.captchas.length || e.index < 0)
808
- throw new v("CAPTCHA.NO_CAPTCHA", {
825
+ throw new T("CAPTCHA.NO_CAPTCHA", {
809
826
  context: {
810
827
  error: "Cannot select, index is out of range for this Captcha"
811
828
  }
812
829
  });
813
- const f = e.index, x = e.solutions, p = b(x, f);
814
- p.includes(c) ? p.splice(p.indexOf(c), 1) : p.push(c), a({ solutions: x });
815
- }, k = () => {
830
+ const p = e.index, I = e.solutions, w = v(I, p);
831
+ if (w.some((y) => y[0] === c)) {
832
+ const y = w.filter((E) => E[0] !== c);
833
+ I[p] = y;
834
+ } else
835
+ I[p] = [...w, [c, m || 0, x || 0]];
836
+ a({ solutions: I });
837
+ }, R = () => {
816
838
  if (!e.challenge)
817
- throw new v("CAPTCHA.NO_CAPTCHA", {
839
+ throw new T("CAPTCHA.NO_CAPTCHA", {
818
840
  context: { error: "Cannot select, no Captcha found in state" }
819
841
  });
820
842
  if (e.index + 1 >= e.challenge.captchas.length)
821
- throw new v("CAPTCHA.NO_CAPTCHA", {
843
+ throw new T("CAPTCHA.NO_CAPTCHA", {
822
844
  context: {
823
845
  error: "Cannot select, index is out of range for this Captcha"
824
846
  }
825
847
  });
826
848
  a({ index: e.index + 1 });
827
849
  }, g = async (c) => {
828
- const f = s();
829
- if (!f.account.address)
830
- throw new N("GENERAL.SITE_KEY_MISSING");
831
- return new ae(c, f.account.address);
832
- }, T = () => {
850
+ const m = s();
851
+ if (!m.account.address)
852
+ throw new H("GENERAL.SITE_KEY_MISSING");
853
+ return new le(c, m.account.address);
854
+ }, N = () => {
833
855
  window.clearTimeout(Number(e.timeout)), a({ timeout: void 0 });
834
856
  }, S = () => {
835
- const c = r.captchas.image.solutionTimeout, f = setTimeout(() => {
857
+ const c = r.captchas.image.solutionTimeout, m = setTimeout(() => {
836
858
  a({ isHuman: !1 }), i.onExpired();
837
859
  }, c);
838
- a({ successfullChallengeTimeout: f });
839
- }, R = (c) => {
840
- T(), a(Ie()), i.onReset(), c && c();
841
- }, Y = async () => {
860
+ a({ successfullChallengeTimeout: m });
861
+ }, L = (c) => {
862
+ N(), a(Le()), i.onReset(), c && c();
863
+ }, ee = async () => {
842
864
  const c = s();
843
865
  if (!c.web2 && !c.userAccountAddress)
844
- throw new N("GENERAL.ACCOUNT_NOT_FOUND", {
866
+ throw new H("GENERAL.ACCOUNT_NOT_FOUND", {
845
867
  context: { error: "Account address has not been set for web3 mode" }
846
868
  });
847
869
  const x = await (async () => {
848
- const p = new (await re(c.web2))();
870
+ const p = new (await de(c.web2))();
849
871
  return t ? t.userAccount : await p.getAccount(c);
850
872
  })();
851
873
  return a({ account: x }), G();
852
874
  }, G = () => {
853
875
  if (!e.account)
854
- throw new N("GENERAL.ACCOUNT_NOT_FOUND", {
876
+ throw new H("GENERAL.ACCOUNT_NOT_FOUND", {
855
877
  context: { error: "Account not loaded" }
856
878
  });
857
879
  return e.account;
858
- }, Z = () => {
880
+ }, te = () => {
859
881
  if (!e.dappAccount)
860
- throw new N("GENERAL.SITE_KEY_MISSING");
882
+ throw new H("GENERAL.SITE_KEY_MISSING");
861
883
  return e.dappAccount;
862
- }, Q = (c) => {
863
- const f = c || G();
864
- if (!f.extension)
865
- throw new N("ACCOUNT.NO_POLKADOT_EXTENSION", {
884
+ }, oe = (c) => {
885
+ const m = c || G();
886
+ if (!m.extension)
887
+ throw new H("ACCOUNT.NO_POLKADOT_EXTENSION", {
866
888
  context: { error: "Extension not loaded" }
867
889
  });
868
- return f.extension;
890
+ return m.extension;
869
891
  };
870
892
  return {
871
- start: d,
872
- cancel: C,
873
- submit: u,
874
- select: A,
875
- nextRound: k,
876
- reload: h
893
+ start: l,
894
+ cancel: b,
895
+ submit: h,
896
+ select: f,
897
+ nextRound: R,
898
+ reload: u
877
899
  };
878
900
  }
879
- const He = se`
901
+ const Me = ue`
880
902
  position: absolute;
881
903
  top: 50%;
882
904
  left: 50%;
@@ -895,7 +917,7 @@ const He = se`
895
917
  @supports (-webkit-touch-callout: none) {
896
918
  transform: translate(-50%, -100%);
897
919
  }
898
- `, j = ue.memo((r) => {
920
+ `, Y = xe.memo((r) => {
899
921
  const { show: e, children: o } = r, t = {
900
922
  position: "fixed",
901
923
  zIndex: 2147483646,
@@ -905,88 +927,88 @@ const He = se`
905
927
  justifyContent: "center",
906
928
  minHeight: "100vh"
907
929
  };
908
- return xe.createPortal(
909
- /* @__PURE__ */ l("div", { className: "prosopo-modalOuter", style: t, children: /* @__PURE__ */ l("div", { className: "prosopo-modalInner", css: He, children: o }) }),
930
+ return ve.createPortal(
931
+ /* @__PURE__ */ d("div", { className: "prosopo-modalOuter", style: t, children: /* @__PURE__ */ d("div", { className: "prosopo-modalInner", css: Me, children: o }) }),
910
932
  document.body
911
933
  );
912
- }), K = "procaptcha:execute", Se = (r) => {
913
- var k;
914
- const { t: e, ready: o } = V(), n = X.parse(r.config), t = r.frictionlessState, i = r.i18n, a = r.callbacks || {}, [s, d] = ge(m.useState, m.useRef), [u, C] = m.useState(!1), h = Ne(
934
+ }), q = "procaptcha:execute", je = (r) => {
935
+ var R;
936
+ const { t: e, ready: o } = Z(), n = Q.parse(r.config), t = r.frictionlessState, i = r.i18n, a = r.callbacks || {}, [s, l] = be(C.useState, C.useRef), [h, b] = C.useState(!1), u = _e(
915
937
  n,
916
938
  s,
917
- d,
939
+ l,
918
940
  a,
919
941
  t
920
- ), A = r.config.theme === "light" ? M : D;
921
- return m.useEffect(() => {
922
- n.language && (i ? i.language !== n.language && i.changeLanguage(n.language).then((g) => g) : pe().then((g) => {
923
- g.language !== n.language && g.changeLanguage(n.language).then((T) => T);
942
+ ), f = r.config.theme === "light" ? M : D;
943
+ return C.useEffect(() => {
944
+ n.language && (i ? i.language !== n.language && i.changeLanguage(n.language).then((g) => g) : Ce().then((g) => {
945
+ g.language !== n.language && g.changeLanguage(n.language).then((N) => N);
924
946
  }));
925
- }, [i, n.language]), m.useEffect(() => {
926
- s.error && (C(!1), s.error.key === "CAPTCHA.NO_SESSION_FOUND" && t && setTimeout(() => {
947
+ }, [i, n.language]), C.useEffect(() => {
948
+ s.error && (b(!1), s.error.key === "CAPTCHA.NO_SESSION_FOUND" && t && setTimeout(() => {
927
949
  t.restart();
928
950
  }, 3e3));
929
- }, [s.error, t]), m.useEffect(() => {
930
- const g = (T) => {
931
- if (d({
951
+ }, [s.error, t]), C.useEffect(() => {
952
+ const g = (N) => {
953
+ if (l({
932
954
  showModal: !0
933
- }), !s.challenge && h.start)
955
+ }), !s.challenge && u.start)
934
956
  try {
935
- h.start();
957
+ u.start();
936
958
  } catch (S) {
937
959
  console.error("Error starting verification:", S);
938
960
  }
939
961
  };
940
- return document.addEventListener(K, g), () => {
962
+ return document.addEventListener(q, g), () => {
941
963
  document.removeEventListener(
942
- K,
964
+ q,
943
965
  g
944
966
  );
945
967
  };
946
- }, [h, s.challenge, d]), n.mode === "invisible" ? /* @__PURE__ */ l(j, { show: s.showModal, children: s.challenge ? /* @__PURE__ */ l(
947
- $,
968
+ }, [u, s.challenge, l]), n.mode === "invisible" ? /* @__PURE__ */ d(Y, { show: s.showModal, children: s.challenge ? /* @__PURE__ */ d(
969
+ K,
948
970
  {
949
971
  challenge: s.challenge,
950
972
  index: s.index,
951
973
  solutions: s.solutions,
952
- onSubmit: h.submit,
953
- onCancel: h.cancel,
954
- onClick: h.select,
955
- onNext: h.nextRound,
956
- onReload: h.reload,
974
+ onSubmit: u.submit,
975
+ onCancel: u.cancel,
976
+ onClick: u.select,
977
+ onNext: u.nextRound,
978
+ onReload: u.reload,
957
979
  themeColor: n.theme ?? "light"
958
980
  }
959
- ) : null }) : /* @__PURE__ */ H("div", { className: "image-captcha", children: [
960
- /* @__PURE__ */ l(j, { show: s.showModal, children: s.challenge ? /* @__PURE__ */ l(
961
- $,
981
+ ) : null }) : /* @__PURE__ */ P("div", { className: "image-captcha", children: [
982
+ /* @__PURE__ */ d(Y, { show: s.showModal, children: s.challenge ? /* @__PURE__ */ d(
983
+ K,
962
984
  {
963
985
  challenge: s.challenge,
964
986
  index: s.index,
965
987
  solutions: s.solutions,
966
- onSubmit: h.submit,
967
- onCancel: h.cancel,
968
- onClick: h.select,
969
- onNext: h.nextRound,
970
- onReload: h.reload,
988
+ onSubmit: u.submit,
989
+ onCancel: u.cancel,
990
+ onClick: u.select,
991
+ onNext: u.nextRound,
992
+ onReload: u.reload,
971
993
  themeColor: n.theme ?? "light"
972
994
  }
973
- ) : /* @__PURE__ */ l("div", { children: "No challenge set." }) }),
974
- /* @__PURE__ */ l(
975
- ie,
995
+ ) : /* @__PURE__ */ d("div", { children: "No challenge set." }) }),
996
+ /* @__PURE__ */ d(
997
+ he,
976
998
  {
977
- theme: A,
978
- onChange: async () => {
979
- u || (C(!0), await h.start(), C(!1));
999
+ theme: f,
1000
+ onChange: async (g) => {
1001
+ g.isTrusted && (h || (b(!0), await u.start(), b(!1)));
980
1002
  },
981
1003
  checked: s.isHuman,
982
1004
  labelText: o ? e("WIDGET.I_AM_HUMAN") : "",
983
- error: (k = s.error) == null ? void 0 : k.message,
1005
+ error: (R = s.error) == null ? void 0 : R.message,
984
1006
  "aria-label": "human checkbox",
985
- loading: u
1007
+ loading: h
986
1008
  }
987
1009
  )
988
1010
  ] });
989
1011
  };
990
1012
  export {
991
- Se as default
1013
+ je as default
992
1014
  };