@prosopo/procaptcha-bundle 3.0.13 → 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.
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js +19 -9
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts +1 -0
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js +2 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js +2 -2
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js +6 -2
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js.map +1 -1
- package/CHANGELOG.md +347 -0
- package/dist/bundle/{ProcaptchaWidget-BIt2pcrz.js → ProcaptchaWidget-CJ-4hVS1.js} +24 -24
- package/dist/bundle/{ProcaptchaWidget-CXxnCzl2.js → ProcaptchaWidget-Cw3s7cGX.js} +290 -268
- package/dist/bundle/{builder-DNHtDoNG.js → builder-ByZ5z580.js} +3 -1
- package/dist/bundle/captchaComponentProvider-Cn75EmSH.js +1002 -0
- package/dist/bundle/{captchaRenderer-CqnUYyKY.js → captchaRenderer-s4QuLEen.js} +23 -22
- package/dist/bundle/{commonChunk-BKceWhtS.js → commonChunk-BjvuHlB1.js} +62 -68
- package/dist/bundle/{emotion-element-5486c51c.browser.esm-CimrRZxS.js → emotion-element-c39617d8.browser.esm-BNNnmykm.js} +343 -345
- package/dist/bundle/index-BuQg3Zno.js +1884 -0
- package/dist/bundle/{index-KHTbPva_.js → index-DIdd2cUz.js} +1 -1
- package/dist/bundle/{index-hrOz2CPm.js → index-IgqrmVIs.js} +61 -59
- package/dist/bundle/nobleChunk-Bbltwf44.js +2728 -0
- package/dist/bundle/procaptcha.bundle.js +2 -2
- package/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +1 -1
- package/dist/bundle/util/captcha/captchaProps.d.ts +1 -0
- package/dist/bundle/util/captcha/captchaProps.d.ts.map +1 -1
- package/dist/bundle/util/captcha/captchaRenderer.d.ts +1 -1
- package/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
- package/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +1 -1
- package/dist/bundle/util/widgetFactory.d.ts.map +1 -1
- package/dist/bundle/{utilCryptoChunk-BKe3CKqn.js → utilCryptoChunk-D6ZLkbFV.js} +252 -243
- package/dist/bundle/{web2Chunk-Cqw91v-J.js → web2Chunk-CNoojUDK.js} +1067 -977
- package/dist/bundle/web3Chunk-BlYvY4Ea.js +525 -0
- package/dist/bundle/{zodChunk-wTu9ZHzV.js → zodChunk-aEfPZzrp.js} +3 -3
- package/dist/cjs/util/captcha/captchaComponentProvider.cjs +3 -2
- package/dist/cjs/util/captcha/captchaRenderer.cjs +4 -3
- package/dist/cjs/util/captcha/components/frictionlessCaptcha.cjs +4 -3
- package/dist/cjs/util/captcha/components/imageCaptcha.cjs +1 -1
- package/dist/cjs/util/captcha/components/powCaptcha.cjs +1 -1
- package/dist/cjs/util/widgetFactory.cjs +7 -2
- package/dist/util/captcha/captchaComponentProvider.js +3 -2
- package/dist/util/captcha/captchaRenderer.js +4 -3
- package/dist/util/captcha/components/frictionlessCaptcha.js +4 -3
- package/dist/util/captcha/components/imageCaptcha.js +1 -1
- package/dist/util/captcha/components/powCaptcha.js +1 -1
- package/dist/util/widgetFactory.js +7 -2
- package/package.json +19 -20
- package/stats.html +1 -1
- package/vite.test.config.ts +3 -2
- package/dist/bundle/captchaComponentProvider-BGEAkC9Y.js +0 -968
- package/dist/bundle/index-7Xh-Mf8v.js +0 -1318
- package/dist/bundle/nobleChunk-CQ4ENyKh.js +0 -3769
- package/dist/bundle/web3Chunk-BcwDKvjL.js +0 -517
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { r as
|
|
3
|
-
import { b as _,
|
|
4
|
-
import { b as
|
|
5
|
-
import { u as
|
|
6
|
-
import { w as
|
|
7
|
-
import { l as M, d as D } from "./index-
|
|
8
|
-
import { r as
|
|
9
|
-
const
|
|
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
|
-
},
|
|
18
|
+
}, Te = ({
|
|
19
19
|
themeColor: r,
|
|
20
20
|
onReload: e
|
|
21
21
|
}) => {
|
|
22
|
-
const o =
|
|
22
|
+
const o = C.useMemo(
|
|
23
23
|
() => r === "light" ? M : D,
|
|
24
24
|
[r]
|
|
25
|
-
), [n, t] =
|
|
25
|
+
), [n, t] = C.useState(!1), i = C.useMemo(() => ({
|
|
26
26
|
...{
|
|
27
|
-
...
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
64
|
-
/* @__PURE__ */
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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 =
|
|
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__ */
|
|
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,
|
|
111
|
-
const
|
|
112
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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: () =>
|
|
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__ */
|
|
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 ${
|
|
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__ */
|
|
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.
|
|
188
|
+
visibility: e.some((u) => u[0] === h) ? "visible" : "hidden"
|
|
173
189
|
},
|
|
174
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
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
|
|
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
|
|
229
|
+
function J({
|
|
214
230
|
general: r,
|
|
215
231
|
dev: e
|
|
216
232
|
}) {
|
|
217
233
|
return {
|
|
218
|
-
...
|
|
234
|
+
...He(r)
|
|
219
235
|
};
|
|
220
236
|
}
|
|
221
|
-
const
|
|
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
|
-
},
|
|
260
|
+
}, F = ({
|
|
245
261
|
themeColor: r,
|
|
246
262
|
buttonType: e,
|
|
247
263
|
text: o,
|
|
248
264
|
onClick: n
|
|
249
265
|
}) => {
|
|
250
|
-
const t =
|
|
266
|
+
const t = C.useMemo(
|
|
251
267
|
() => r === "light" ? M : D,
|
|
252
268
|
[r]
|
|
253
|
-
), [i, a] =
|
|
254
|
-
const
|
|
255
|
-
...
|
|
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
|
-
...
|
|
279
|
+
...l,
|
|
264
280
|
backgroundColor: i ? t.palette.grey[600] : "transparent"
|
|
265
281
|
} : {
|
|
266
|
-
...
|
|
282
|
+
...l,
|
|
267
283
|
backgroundColor: i ? t.palette.primary.main : t.palette.background.default
|
|
268
284
|
};
|
|
269
285
|
}, [e, i, t]);
|
|
270
|
-
return /* @__PURE__ */
|
|
286
|
+
return /* @__PURE__ */ d(
|
|
271
287
|
"button",
|
|
272
288
|
{
|
|
273
|
-
...
|
|
289
|
+
...J({ dev: {} }),
|
|
274
290
|
onMouseEnter: () => a(!0),
|
|
275
291
|
onMouseLeave: () => a(!1),
|
|
276
292
|
style: s,
|
|
277
|
-
onClick: (
|
|
278
|
-
|
|
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:
|
|
309
|
+
themeColor: l
|
|
294
310
|
}) => {
|
|
295
|
-
const { t:
|
|
296
|
-
() =>
|
|
297
|
-
[
|
|
298
|
-
),
|
|
299
|
-
return /* @__PURE__ */
|
|
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:
|
|
329
|
+
backgroundColor: f.palette.background.default,
|
|
314
330
|
userSelect: "none",
|
|
315
331
|
touchAction: "none",
|
|
316
332
|
overscrollBehavior: "none"
|
|
317
333
|
},
|
|
318
|
-
children: /* @__PURE__ */
|
|
334
|
+
children: /* @__PURE__ */ P(
|
|
319
335
|
"div",
|
|
320
336
|
{
|
|
321
337
|
style: {
|
|
322
|
-
backgroundColor:
|
|
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__ */
|
|
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__ */
|
|
355
|
+
children: /* @__PURE__ */ d(
|
|
340
356
|
"div",
|
|
341
357
|
{
|
|
342
358
|
style: {
|
|
343
|
-
backgroundColor:
|
|
359
|
+
backgroundColor: f.palette.primary.main,
|
|
344
360
|
width: "100%",
|
|
345
361
|
marginTop: g
|
|
346
362
|
},
|
|
347
|
-
children: /* @__PURE__ */
|
|
363
|
+
children: /* @__PURE__ */ P(
|
|
348
364
|
"div",
|
|
349
365
|
{
|
|
350
366
|
style: {
|
|
351
|
-
padding: `${
|
|
352
|
-
fontFamily:
|
|
367
|
+
padding: `${f.spacing.half}px`,
|
|
368
|
+
fontFamily: f.font.fontFamily
|
|
353
369
|
},
|
|
354
370
|
children: [
|
|
355
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
380
|
+
h("WIDGET.SELECT_ALL"),
|
|
365
381
|
":",
|
|
366
382
|
" ",
|
|
367
|
-
/* @__PURE__ */
|
|
383
|
+
/* @__PURE__ */ d("span", { children: `${v(r.captchas, e).target} ` })
|
|
368
384
|
]
|
|
369
385
|
}
|
|
370
386
|
),
|
|
371
|
-
/* @__PURE__ */
|
|
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:
|
|
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__ */
|
|
406
|
+
/* @__PURE__ */ d(
|
|
391
407
|
"div",
|
|
392
408
|
{
|
|
393
|
-
...
|
|
409
|
+
...J({ dev: {} }),
|
|
394
410
|
style: { overflow: "hidden" },
|
|
395
|
-
children:
|
|
396
|
-
|
|
411
|
+
children: b && /* @__PURE__ */ d(
|
|
412
|
+
Ne,
|
|
397
413
|
{
|
|
398
|
-
challenge:
|
|
399
|
-
solution:
|
|
414
|
+
challenge: b,
|
|
415
|
+
solution: u,
|
|
400
416
|
onClick: i,
|
|
401
|
-
themeColor:
|
|
417
|
+
themeColor: l
|
|
402
418
|
}
|
|
403
419
|
)
|
|
404
420
|
}
|
|
405
421
|
),
|
|
406
|
-
/* @__PURE__ */
|
|
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 ${
|
|
430
|
+
padding: `${g} 0 ${R} 0`
|
|
415
431
|
},
|
|
416
|
-
children: /* @__PURE__ */
|
|
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
|
|
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__ */
|
|
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__ */
|
|
441
|
-
|
|
455
|
+
children: /* @__PURE__ */ d(
|
|
456
|
+
F,
|
|
442
457
|
{
|
|
443
|
-
themeColor:
|
|
458
|
+
themeColor: l,
|
|
444
459
|
buttonType: "cancel",
|
|
445
460
|
onClick: t,
|
|
446
|
-
text:
|
|
447
|
-
"aria-label":
|
|
461
|
+
text: h("WIDGET.CANCEL"),
|
|
462
|
+
"aria-label": h("WIDGET.CANCEL")
|
|
448
463
|
}
|
|
449
464
|
)
|
|
450
465
|
}
|
|
451
466
|
),
|
|
452
|
-
/* @__PURE__ */
|
|
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__ */
|
|
476
|
+
children: /* @__PURE__ */ d(Te, { themeColor: l, onReload: s })
|
|
462
477
|
}
|
|
463
478
|
),
|
|
464
|
-
/* @__PURE__ */
|
|
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__ */
|
|
474
|
-
|
|
488
|
+
children: /* @__PURE__ */ d(
|
|
489
|
+
F,
|
|
475
490
|
{
|
|
476
|
-
themeColor:
|
|
491
|
+
themeColor: l,
|
|
477
492
|
buttonType: "next",
|
|
478
|
-
text: e < r.captchas.length - 1 ?
|
|
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 ?
|
|
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
|
|
498
|
-
return
|
|
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
|
|
520
|
+
class V {
|
|
506
521
|
constructor(e) {
|
|
507
522
|
this.hash = e, this.parent = null;
|
|
508
523
|
}
|
|
509
524
|
}
|
|
510
|
-
class
|
|
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
|
|
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
|
|
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
|
|
558
|
+
throw new T("DEVELOPER.GENERAL", {
|
|
544
559
|
context: { error: "leftChild undefined" }
|
|
545
560
|
});
|
|
546
|
-
const s = t + 1 < o ?
|
|
547
|
-
i.push(
|
|
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
|
|
553
|
-
|
|
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
|
|
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
|
|
574
|
-
s > a ?
|
|
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 =
|
|
577
|
-
return [...o, [
|
|
591
|
+
const t = v(this.layers, this.layers.length - 1);
|
|
592
|
+
return [...o, [v(t, 0)]];
|
|
578
593
|
}
|
|
579
594
|
}
|
|
580
|
-
class
|
|
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[
|
|
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
|
|
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
|
|
608
|
-
(
|
|
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
|
|
615
|
-
let
|
|
629
|
+
const l = a.root.hash;
|
|
630
|
+
let h;
|
|
616
631
|
try {
|
|
617
|
-
|
|
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 (
|
|
640
|
+
} catch (b) {
|
|
626
641
|
throw new _("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
|
|
627
|
-
context: { error:
|
|
642
|
+
context: { error: b }
|
|
628
643
|
});
|
|
629
644
|
}
|
|
630
|
-
return [
|
|
645
|
+
return [h, l];
|
|
631
646
|
}
|
|
632
647
|
}
|
|
633
|
-
const
|
|
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
|
|
646
|
-
const i =
|
|
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),
|
|
652
|
-
},
|
|
653
|
-
i.onOpen(), await
|
|
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
|
|
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
|
|
665
|
-
const
|
|
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
|
|
669
|
-
x = new
|
|
670
|
-
|
|
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
|
|
678
|
-
s()
|
|
679
|
-
), y =
|
|
680
|
-
x = new
|
|
681
|
-
|
|
682
|
-
|
|
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((
|
|
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
|
|
717
|
+
const w = p.captchas.map(
|
|
703
718
|
(E) => E.timeLimitMs || c.captchas.image.challengeTimeout
|
|
704
|
-
).reduce((E,
|
|
719
|
+
).reduce((E, W) => E + W), y = setTimeout(() => {
|
|
705
720
|
i.onChallengeExpired(), a({ isHuman: !1, showModal: !1, loading: !1 });
|
|
706
|
-
},
|
|
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
|
-
|
|
718
|
-
|
|
732
|
+
l,
|
|
733
|
+
L,
|
|
719
734
|
e.attemptCount,
|
|
720
735
|
10
|
|
721
736
|
);
|
|
722
|
-
},
|
|
723
|
-
await
|
|
737
|
+
}, h = async () => {
|
|
738
|
+
await z(
|
|
724
739
|
async () => {
|
|
725
|
-
if (
|
|
726
|
-
throw new
|
|
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,
|
|
731
|
-
(O,
|
|
732
|
-
const
|
|
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:
|
|
737
|
-
solution:
|
|
753
|
+
salt: re,
|
|
754
|
+
solution: B.flatMap((k) => k[0])
|
|
738
755
|
};
|
|
739
756
|
}
|
|
740
|
-
),
|
|
741
|
-
if (!
|
|
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
|
|
746
|
-
if (!
|
|
747
|
-
throw new
|
|
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 (!
|
|
751
|
-
throw new
|
|
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
|
|
757
|
-
address:
|
|
758
|
-
data:
|
|
773
|
+
const y = await p.signRaw({
|
|
774
|
+
address: x.account.address,
|
|
775
|
+
data: Ae(c[A.timestamp]),
|
|
759
776
|
type: "bytes"
|
|
760
|
-
}),
|
|
761
|
-
|
|
777
|
+
}), E = await w.submitCaptchaSolution(
|
|
778
|
+
y.signature,
|
|
762
779
|
c.requestHash,
|
|
763
|
-
|
|
780
|
+
m,
|
|
764
781
|
c.timestamp,
|
|
765
782
|
c.signature.provider.requestHash
|
|
766
|
-
),
|
|
783
|
+
), W = E[0].verified;
|
|
767
784
|
if (a({
|
|
768
|
-
submission:
|
|
769
|
-
isHuman:
|
|
785
|
+
submission: E,
|
|
786
|
+
isHuman: W,
|
|
770
787
|
loading: !1
|
|
771
788
|
}), e.isHuman) {
|
|
772
|
-
const O =
|
|
789
|
+
const O = w.provider.provider.url;
|
|
773
790
|
i.onHuman(
|
|
774
|
-
|
|
775
|
-
[
|
|
776
|
-
[
|
|
777
|
-
[
|
|
778
|
-
[
|
|
779
|
-
[
|
|
780
|
-
[
|
|
781
|
-
[
|
|
782
|
-
[
|
|
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
|
-
[
|
|
785
|
-
[
|
|
801
|
+
[A.user]: {
|
|
802
|
+
[A.timestamp]: y.signature
|
|
786
803
|
}
|
|
787
804
|
}
|
|
788
805
|
})
|
|
789
806
|
), S();
|
|
790
807
|
} else
|
|
791
|
-
i.onFailed(),
|
|
808
|
+
i.onFailed(), L(t == null ? void 0 : t.restart);
|
|
792
809
|
},
|
|
793
|
-
|
|
794
|
-
|
|
810
|
+
l,
|
|
811
|
+
L,
|
|
795
812
|
e.attemptCount,
|
|
796
813
|
10
|
|
797
814
|
);
|
|
798
|
-
},
|
|
799
|
-
|
|
800
|
-
},
|
|
801
|
-
|
|
802
|
-
},
|
|
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
|
|
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
|
|
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
|
|
814
|
-
|
|
815
|
-
|
|
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
|
|
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
|
|
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
|
|
829
|
-
if (!
|
|
830
|
-
throw new
|
|
831
|
-
return new
|
|
832
|
-
},
|
|
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,
|
|
857
|
+
const c = r.captchas.image.solutionTimeout, m = setTimeout(() => {
|
|
836
858
|
a({ isHuman: !1 }), i.onExpired();
|
|
837
859
|
}, c);
|
|
838
|
-
a({ successfullChallengeTimeout:
|
|
839
|
-
},
|
|
840
|
-
|
|
841
|
-
},
|
|
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
|
|
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
|
|
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
|
|
876
|
+
throw new H("GENERAL.ACCOUNT_NOT_FOUND", {
|
|
855
877
|
context: { error: "Account not loaded" }
|
|
856
878
|
});
|
|
857
879
|
return e.account;
|
|
858
|
-
},
|
|
880
|
+
}, te = () => {
|
|
859
881
|
if (!e.dappAccount)
|
|
860
|
-
throw new
|
|
882
|
+
throw new H("GENERAL.SITE_KEY_MISSING");
|
|
861
883
|
return e.dappAccount;
|
|
862
|
-
},
|
|
863
|
-
const
|
|
864
|
-
if (!
|
|
865
|
-
throw new
|
|
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
|
|
890
|
+
return m.extension;
|
|
869
891
|
};
|
|
870
892
|
return {
|
|
871
|
-
start:
|
|
872
|
-
cancel:
|
|
873
|
-
submit:
|
|
874
|
-
select:
|
|
875
|
-
nextRound:
|
|
876
|
-
reload:
|
|
893
|
+
start: l,
|
|
894
|
+
cancel: b,
|
|
895
|
+
submit: h,
|
|
896
|
+
select: f,
|
|
897
|
+
nextRound: R,
|
|
898
|
+
reload: u
|
|
877
899
|
};
|
|
878
900
|
}
|
|
879
|
-
const
|
|
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
|
-
`,
|
|
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
|
|
909
|
-
/* @__PURE__ */
|
|
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
|
-
}),
|
|
913
|
-
var
|
|
914
|
-
const { t: e, ready: o } =
|
|
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
|
-
|
|
939
|
+
l,
|
|
918
940
|
a,
|
|
919
941
|
t
|
|
920
|
-
),
|
|
921
|
-
return
|
|
922
|
-
n.language && (i ? i.language !== n.language && i.changeLanguage(n.language).then((g) => g) :
|
|
923
|
-
g.language !== n.language && g.changeLanguage(n.language).then((
|
|
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]),
|
|
926
|
-
s.error && (
|
|
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]),
|
|
930
|
-
const g = (
|
|
931
|
-
if (
|
|
951
|
+
}, [s.error, t]), C.useEffect(() => {
|
|
952
|
+
const g = (N) => {
|
|
953
|
+
if (l({
|
|
932
954
|
showModal: !0
|
|
933
|
-
}), !s.challenge &&
|
|
955
|
+
}), !s.challenge && u.start)
|
|
934
956
|
try {
|
|
935
|
-
|
|
957
|
+
u.start();
|
|
936
958
|
} catch (S) {
|
|
937
959
|
console.error("Error starting verification:", S);
|
|
938
960
|
}
|
|
939
961
|
};
|
|
940
|
-
return document.addEventListener(
|
|
962
|
+
return document.addEventListener(q, g), () => {
|
|
941
963
|
document.removeEventListener(
|
|
942
|
-
|
|
964
|
+
q,
|
|
943
965
|
g
|
|
944
966
|
);
|
|
945
967
|
};
|
|
946
|
-
}, [
|
|
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:
|
|
953
|
-
onCancel:
|
|
954
|
-
onClick:
|
|
955
|
-
onNext:
|
|
956
|
-
onReload:
|
|
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__ */
|
|
960
|
-
/* @__PURE__ */
|
|
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:
|
|
967
|
-
onCancel:
|
|
968
|
-
onClick:
|
|
969
|
-
onNext:
|
|
970
|
-
onReload:
|
|
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__ */
|
|
974
|
-
/* @__PURE__ */
|
|
975
|
-
|
|
995
|
+
) : /* @__PURE__ */ d("div", { children: "No challenge set." }) }),
|
|
996
|
+
/* @__PURE__ */ d(
|
|
997
|
+
he,
|
|
976
998
|
{
|
|
977
|
-
theme:
|
|
978
|
-
onChange: async () => {
|
|
979
|
-
|
|
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: (
|
|
1005
|
+
error: (R = s.error) == null ? void 0 : R.message,
|
|
984
1006
|
"aria-label": "human checkbox",
|
|
985
|
-
loading:
|
|
1007
|
+
loading: h
|
|
986
1008
|
}
|
|
987
1009
|
)
|
|
988
1010
|
] });
|
|
989
1011
|
};
|
|
990
1012
|
export {
|
|
991
|
-
|
|
1013
|
+
je as default
|
|
992
1014
|
};
|