@prosopo/procaptcha-bundle 2.0.3 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts +12 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.js +71 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/captchaType.test.d.ts +2 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/captchaType.test.d.ts.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/captchaType.test.js +36 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/captchaType.test.js.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/config.test.d.ts +2 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/config.test.d.ts.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/config.test.js +69 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/config.test.js.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captchaType.d.ts +2 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captchaType.d.ts.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captchaType.js +8 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captchaType.js.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts +8 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js +31 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/defaultCallbacks.d.ts +19 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/defaultCallbacks.d.ts.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/defaultCallbacks.js +147 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/defaultCallbacks.js.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/form.d.ts +2 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/form.d.ts.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/form.js +2 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/form.js.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/language.d.ts +3 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/language.d.ts.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/language.js +17 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/language.js.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/theme.d.ts +3 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/theme.d.ts.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/theme.js +9 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/theme.js.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.d.ts +3 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.d.ts.map +1 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.js +9 -0
- package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.js.map +1 -0
- package/dist/bundle/ProcaptchaWidget-BJTWbWXX.js +157 -0
- package/dist/bundle/ProcaptchaWidget-CyCdGVAQ.js +624 -0
- package/dist/bundle/index-DkYajG2c.js +19015 -0
- package/dist/bundle/index.d.ts +1 -14
- package/dist/bundle/index.d.ts.map +1 -1
- package/dist/bundle/procaptcha.bundle.js +1 -1
- package/dist/bundle/tests/captchaType.test.d.ts +2 -0
- package/dist/bundle/tests/captchaType.test.d.ts.map +1 -0
- package/dist/bundle/tests/config.test.d.ts +2 -0
- package/dist/bundle/tests/config.test.d.ts.map +1 -0
- package/dist/bundle/util/captchaType.d.ts +2 -0
- package/dist/bundle/util/captchaType.d.ts.map +1 -0
- package/dist/bundle/util/config.d.ts +8 -0
- package/dist/bundle/util/config.d.ts.map +1 -0
- package/dist/bundle/util/defaultCallbacks.d.ts +19 -0
- package/dist/bundle/util/defaultCallbacks.d.ts.map +1 -0
- package/dist/bundle/util/form.d.ts +2 -0
- package/dist/bundle/util/form.d.ts.map +1 -0
- package/dist/bundle/util/language.d.ts +3 -0
- package/dist/bundle/util/language.d.ts.map +1 -0
- package/dist/bundle/util/theme.d.ts +3 -0
- package/dist/bundle/util/theme.d.ts.map +1 -0
- package/dist/bundle/util/timeout.d.ts +3 -0
- package/dist/bundle/util/timeout.d.ts.map +1 -0
- package/dist/bundle/{utils-Cpz4o_0n.js → utils-CAk_TqSc.js} +9596 -11830
- package/dist/cjs/index.cjs +43 -200
- package/dist/cjs/util/captchaType.cjs +12 -0
- package/dist/cjs/util/config.cjs +33 -0
- package/dist/cjs/util/defaultCallbacks.cjs +134 -0
- package/dist/cjs/util/form.cjs +4 -0
- package/dist/cjs/util/language.cjs +18 -0
- package/dist/cjs/util/theme.cjs +9 -0
- package/dist/cjs/util/timeout.cjs +14 -0
- package/dist/index.d.ts +1 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -206
- package/dist/index.js.map +1 -1
- package/dist/tests/captchaType.test.d.ts +2 -0
- package/dist/tests/captchaType.test.d.ts.map +1 -0
- package/dist/tests/captchaType.test.js +36 -0
- package/dist/tests/captchaType.test.js.map +1 -0
- package/dist/tests/config.test.d.ts +2 -0
- package/dist/tests/config.test.d.ts.map +1 -0
- package/dist/tests/config.test.js +69 -0
- package/dist/tests/config.test.js.map +1 -0
- package/dist/util/captchaType.d.ts +3 -0
- package/dist/util/captchaType.d.ts.map +1 -0
- package/dist/util/captchaType.js +8 -0
- package/dist/util/captchaType.js.map +1 -0
- package/dist/util/config.d.ts +8 -0
- package/dist/util/config.d.ts.map +1 -0
- package/dist/util/config.js +31 -0
- package/dist/util/config.js.map +1 -0
- package/dist/util/defaultCallbacks.d.ts +19 -0
- package/dist/util/defaultCallbacks.d.ts.map +1 -0
- package/dist/util/defaultCallbacks.js +147 -0
- package/dist/util/defaultCallbacks.js.map +1 -0
- package/dist/util/form.d.ts +2 -0
- package/dist/util/form.d.ts.map +1 -0
- package/dist/util/form.js +2 -0
- package/dist/util/form.js.map +1 -0
- package/dist/util/language.d.ts +3 -0
- package/dist/util/language.d.ts.map +1 -0
- package/dist/util/language.js +17 -0
- package/dist/util/language.js.map +1 -0
- package/dist/util/theme.d.ts +3 -0
- package/dist/util/theme.d.ts.map +1 -0
- package/dist/util/theme.js +9 -0
- package/dist/util/theme.js.map +1 -0
- package/dist/util/timeout.d.ts +3 -0
- package/dist/util/timeout.d.ts.map +1 -0
- package/dist/util/timeout.js +9 -0
- package/dist/util/timeout.js.map +1 -0
- package/package.json +65 -59
- package/stats.html +1 -1
- package/vite.config.ts +24 -24
- package/vite.config.ts.timestamp-1717674816132-b375b28e04de9.mjs +56 -0
- package/vite.config.ts.timestamp-1723148478701-50a086cc53355.mjs +56 -0
- package/vite.test.config.ts +34 -0
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts +0 -25
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js +0 -259
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +0 -1
- package/dist/bundle/ProcaptchaWidget-BzBkw8-_.js +0 -775
- package/dist/bundle/ProcaptchaWidget-nO3NsM0R.js +0 -155
- package/dist/bundle/index-DsnIPyZG.js +0 -14976
|
@@ -1,775 +0,0 @@
|
|
|
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-DsnIPyZG.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-Cpz4o_0n.js";
|
|
3
|
-
function Ve(t) {
|
|
4
|
-
return Ie(Ee(t));
|
|
5
|
-
}
|
|
6
|
-
function qe() {
|
|
7
|
-
if (console && console.warn) {
|
|
8
|
-
for (var t, e = arguments.length, n = new Array(e), o = 0; o < e; o++)
|
|
9
|
-
n[o] = arguments[o];
|
|
10
|
-
typeof n[0] == "string" && (n[0] = "react-i18next:: ".concat(n[0])), (t = console).warn.apply(t, n);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
var Z = {};
|
|
14
|
-
function X() {
|
|
15
|
-
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
16
|
-
e[n] = arguments[n];
|
|
17
|
-
typeof e[0] == "string" && Z[e[0]] || (typeof e[0] == "string" && (Z[e[0]] = /* @__PURE__ */ new Date()), qe.apply(void 0, e));
|
|
18
|
-
}
|
|
19
|
-
function Q(t, e, n) {
|
|
20
|
-
t.loadNamespaces(e, function() {
|
|
21
|
-
if (t.isInitialized)
|
|
22
|
-
n();
|
|
23
|
-
else {
|
|
24
|
-
var o = function a() {
|
|
25
|
-
setTimeout(function() {
|
|
26
|
-
t.off("initialized", a);
|
|
27
|
-
}, 0), n();
|
|
28
|
-
};
|
|
29
|
-
t.on("initialized", o);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
function Xe(t, e) {
|
|
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
|
-
if (o.toLowerCase() === "cimode") return !0;
|
|
36
|
-
var i = function(s, f) {
|
|
37
|
-
var g = e.services.backendConnector.state["".concat(s, "|").concat(f)];
|
|
38
|
-
return g === -1 || g === 2;
|
|
39
|
-
};
|
|
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
|
-
}
|
|
42
|
-
function Ye(t, e) {
|
|
43
|
-
var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
44
|
-
if (!e.languages || !e.languages.length)
|
|
45
|
-
return X("i18n.languages were undefined or empty", e.languages), !0;
|
|
46
|
-
var o = e.options.ignoreJSONStructure !== void 0;
|
|
47
|
-
return o ? e.hasLoadedNamespace(t, {
|
|
48
|
-
precheck: function(r, i) {
|
|
49
|
-
if (n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && r.services.backendConnector.backend && r.isLanguageChangingTo && !i(r.isLanguageChangingTo, t)) return !1;
|
|
50
|
-
}
|
|
51
|
-
}) : Xe(t, e, n);
|
|
52
|
-
}
|
|
53
|
-
function Je(t, e) {
|
|
54
|
-
var n = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
|
|
55
|
-
if (n != null) {
|
|
56
|
-
var o, a, r, i, d = [], s = !0, f = !1;
|
|
57
|
-
try {
|
|
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
|
-
} finally {
|
|
62
|
-
try {
|
|
63
|
-
if (!s && n.return != null && (i = n.return(), Object(i) !== i)) return;
|
|
64
|
-
} finally {
|
|
65
|
-
if (f) throw a;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return d;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function Ze(t, e) {
|
|
72
|
-
return Se(t) || Je(t, e) || Ne(t, e) || Pe();
|
|
73
|
-
}
|
|
74
|
-
function ee(t, e) {
|
|
75
|
-
var n = Object.keys(t);
|
|
76
|
-
if (Object.getOwnPropertySymbols) {
|
|
77
|
-
var o = Object.getOwnPropertySymbols(t);
|
|
78
|
-
e && (o = o.filter(function(a) {
|
|
79
|
-
return Object.getOwnPropertyDescriptor(t, a).enumerable;
|
|
80
|
-
})), n.push.apply(n, o);
|
|
81
|
-
}
|
|
82
|
-
return n;
|
|
83
|
-
}
|
|
84
|
-
function F(t) {
|
|
85
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
86
|
-
var n = arguments[e] != null ? arguments[e] : {};
|
|
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
|
-
Object.defineProperty(t, o, Object.getOwnPropertyDescriptor(n, o));
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
return t;
|
|
94
|
-
}
|
|
95
|
-
var Qe = function(e, n) {
|
|
96
|
-
var o = m.useRef();
|
|
97
|
-
return m.useEffect(function() {
|
|
98
|
-
o.current = e;
|
|
99
|
-
}, [e, n]), o.current;
|
|
100
|
-
};
|
|
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
|
-
}
|
|
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
|
-
});
|
|
116
|
-
function C() {
|
|
117
|
-
return r.getFixedT(null, s.nsMode === "fallback" ? u : u[0], g);
|
|
118
|
-
}
|
|
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
|
-
m.useEffect(function() {
|
|
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
|
-
}
|
|
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
|
-
});
|
|
134
|
-
};
|
|
135
|
-
}, [r, L]);
|
|
136
|
-
var W = m.useRef(!0);
|
|
137
|
-
m.useEffect(function() {
|
|
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
|
-
});
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
function tt(t) {
|
|
149
|
-
return et("translation", { i18n: _e, ...t });
|
|
150
|
-
}
|
|
151
|
-
const nt = (t) => Array.isArray(t) && t !== null, z = new Array(256), ae = new Array(256 * 256);
|
|
152
|
-
for (let t = 0; t < 256; t++)
|
|
153
|
-
z[t] = t.toString(16).padStart(2, "0");
|
|
154
|
-
for (let t = 0; t < 256; t++) {
|
|
155
|
-
const e = t << 8;
|
|
156
|
-
for (let n = 0; n < 256; n++)
|
|
157
|
-
ae[e | n] = z[t] + z[n];
|
|
158
|
-
}
|
|
159
|
-
function K(t, e) {
|
|
160
|
-
const n = t.length % 2 | 0, o = t.length - n | 0;
|
|
161
|
-
for (let a = 0; a < o; a += 2)
|
|
162
|
-
e += ae[t[a] << 8 | t[a + 1]];
|
|
163
|
-
return n && (e += z[t[o] | 0]), e;
|
|
164
|
-
}
|
|
165
|
-
function ot(t, e = -1, n = !0) {
|
|
166
|
-
const o = n ? "0x" : "";
|
|
167
|
-
if (!(t != null && t.length))
|
|
168
|
-
return o;
|
|
169
|
-
if (e > 0) {
|
|
170
|
-
const a = Math.ceil(e / 8);
|
|
171
|
-
if (t.length > a)
|
|
172
|
-
return `${K(t.subarray(0, a / 2), o)}…${K(t.subarray(t.length - a / 2), "")}`;
|
|
173
|
-
}
|
|
174
|
-
return K(t, o);
|
|
175
|
-
}
|
|
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
|
-
});
|
|
181
|
-
function at(t) {
|
|
182
|
-
return q([
|
|
183
|
-
t.captchaId,
|
|
184
|
-
t.captchaContentId,
|
|
185
|
-
[...t.solution].sort(),
|
|
186
|
-
t.salt
|
|
187
|
-
]);
|
|
188
|
-
}
|
|
189
|
-
class te {
|
|
190
|
-
constructor(e) {
|
|
191
|
-
this.hash = e, this.parent = null;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
class it {
|
|
195
|
-
constructor() {
|
|
196
|
-
this.leaves = [], this.layers = [];
|
|
197
|
-
}
|
|
198
|
-
getRoot() {
|
|
199
|
-
if (this.root === void 0)
|
|
200
|
-
throw new T("DATASET.MERKLE_ERROR", {
|
|
201
|
-
context: {
|
|
202
|
-
error: "root undefined",
|
|
203
|
-
failedFuncName: this.getRoot.name
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
return this.root;
|
|
207
|
-
}
|
|
208
|
-
build(e) {
|
|
209
|
-
this.layers.length && (this.layers = []);
|
|
210
|
-
const n = [];
|
|
211
|
-
for (const o of e) {
|
|
212
|
-
const a = new te(o);
|
|
213
|
-
this.leaves.push(a), n.push(a.hash);
|
|
214
|
-
}
|
|
215
|
-
this.layers.push(n), this.root = this.buildMerkleTree(this.leaves)[0];
|
|
216
|
-
}
|
|
217
|
-
buildMerkleTree(e) {
|
|
218
|
-
const n = e.length;
|
|
219
|
-
if (n === 1)
|
|
220
|
-
return e;
|
|
221
|
-
const o = [];
|
|
222
|
-
let a = 0;
|
|
223
|
-
const r = [];
|
|
224
|
-
for (; a < n; ) {
|
|
225
|
-
const i = e[a];
|
|
226
|
-
if (i === void 0)
|
|
227
|
-
throw new T("DEVELOPER.GENERAL", {
|
|
228
|
-
context: { error: "leftChild undefined" }
|
|
229
|
-
});
|
|
230
|
-
const d = a + 1 < n ? b(e, a + 1) : i, s = this.createParent(i, d);
|
|
231
|
-
r.push(s.hash), o.push(s), a += 2;
|
|
232
|
-
}
|
|
233
|
-
return this.layers.push(r), this.buildMerkleTree(o);
|
|
234
|
-
}
|
|
235
|
-
createParent(e, n) {
|
|
236
|
-
const o = new te(q([e.hash, n.hash]));
|
|
237
|
-
return e.parent = o.hash, n.parent = o.hash, o;
|
|
238
|
-
}
|
|
239
|
-
proof(e) {
|
|
240
|
-
const n = [];
|
|
241
|
-
let o = 0;
|
|
242
|
-
for (; o < this.layers.length - 1; ) {
|
|
243
|
-
const r = this.layers[o];
|
|
244
|
-
if (r === void 0)
|
|
245
|
-
throw new T("DATASET.MERKLE_ERROR", {
|
|
246
|
-
context: {
|
|
247
|
-
error: "layer undefined",
|
|
248
|
-
failedFuncName: this.proof.name,
|
|
249
|
-
layerNum: o
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
const i = r.indexOf(e);
|
|
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
|
-
}
|
|
258
|
-
const a = b(this.layers, this.layers.length - 1);
|
|
259
|
-
return [...n, [b(a, 0)]];
|
|
260
|
-
}
|
|
261
|
-
}
|
|
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
|
-
}
|
|
266
|
-
get web2() {
|
|
267
|
-
return this._web2;
|
|
268
|
-
}
|
|
269
|
-
async getCaptchaChallenge() {
|
|
270
|
-
try {
|
|
271
|
-
const e = await this.providerApi.getCaptchaChallenge(this.userAccount, this.provider);
|
|
272
|
-
for (const n of e.captchas)
|
|
273
|
-
for (const o of n.items)
|
|
274
|
-
o.data && (o.data = o.data.replace(/^http(s)*:\/\//, "//"));
|
|
275
|
-
return e;
|
|
276
|
-
} catch (e) {
|
|
277
|
-
throw new P("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
|
|
278
|
-
context: { error: e }
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
}
|
|
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
|
-
context: { error: "Merkle tree root is undefined" }
|
|
287
|
-
});
|
|
288
|
-
const s = i.root.hash, f = void 0;
|
|
289
|
-
let g;
|
|
290
|
-
try {
|
|
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 }
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
return [g, s, f];
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
const se = "@prosopo/procaptcha";
|
|
301
|
-
function J() {
|
|
302
|
-
return ie.parse(JSON.parse(Ve(localStorage.getItem(se) || "0x7b7d")));
|
|
303
|
-
}
|
|
304
|
-
function ce(t) {
|
|
305
|
-
localStorage.setItem(se, re(JSON.stringify(ie.parse(t))));
|
|
306
|
-
}
|
|
307
|
-
function ct(t) {
|
|
308
|
-
ce({ ...J(), account: t });
|
|
309
|
-
}
|
|
310
|
-
function lt() {
|
|
311
|
-
return J().account || null;
|
|
312
|
-
}
|
|
313
|
-
const V = {
|
|
314
|
-
setAccount: ct,
|
|
315
|
-
getAccount: lt,
|
|
316
|
-
setProcaptchaStorage: ce,
|
|
317
|
-
getProcaptchaStorage: J
|
|
318
|
-
}, dt = () => ({
|
|
319
|
-
showModal: !1,
|
|
320
|
-
loading: !1,
|
|
321
|
-
index: 0,
|
|
322
|
-
challenge: void 0,
|
|
323
|
-
solutions: void 0,
|
|
324
|
-
isHuman: !1,
|
|
325
|
-
captchaApi: void 0,
|
|
326
|
-
account: void 0
|
|
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));
|
|
329
|
-
return {
|
|
330
|
-
providerAccount: o.address,
|
|
331
|
-
provider: {
|
|
332
|
-
url: o.url,
|
|
333
|
-
datasetId: o.datasetId,
|
|
334
|
-
datasetIdContent: o.datasetIdContent
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
};
|
|
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 = () => {
|
|
343
|
-
const c = {
|
|
344
|
-
userAccountAddress: "",
|
|
345
|
-
...t
|
|
346
|
-
};
|
|
347
|
-
return e.account && (c.userAccountAddress = e.account.account.address), oe.parse(c);
|
|
348
|
-
}, s = async (c) => {
|
|
349
|
-
try {
|
|
350
|
-
await c();
|
|
351
|
-
} catch (p) {
|
|
352
|
-
console.error(p), r(p), i({ isHuman: !1, showModal: !1, loading: !1 });
|
|
353
|
-
}
|
|
354
|
-
}, f = async () => {
|
|
355
|
-
a.onOpen(), await s(async () => {
|
|
356
|
-
if (e.loading || e.isHuman)
|
|
357
|
-
return;
|
|
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();
|
|
364
|
-
if (E.captchas.length <= 0)
|
|
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(() => {
|
|
367
|
-
a.onChallengeExpired(), i({ isHuman: !1, showModal: !1, loading: !1 });
|
|
368
|
-
}, G);
|
|
369
|
-
i({
|
|
370
|
-
index: 0,
|
|
371
|
-
solutions: E.captchas.map(() => []),
|
|
372
|
-
challenge: E,
|
|
373
|
-
showModal: !0,
|
|
374
|
-
timeout: _
|
|
375
|
-
});
|
|
376
|
-
});
|
|
377
|
-
}, g = async () => {
|
|
378
|
-
await s(async () => {
|
|
379
|
-
if (D(), !e.challenge)
|
|
380
|
-
throw new T("CAPTCHA.NO_CAPTCHA", {
|
|
381
|
-
context: { error: "Cannot submit, no Captcha found in state" }
|
|
382
|
-
});
|
|
383
|
-
i({ showModal: !1 });
|
|
384
|
-
const c = e.challenge, p = je(), h = e.challenge.captchas.map((N, le) => {
|
|
385
|
-
const de = b(e.solutions, le);
|
|
386
|
-
return {
|
|
387
|
-
captchaId: N.captchaId,
|
|
388
|
-
captchaContentId: N.captchaContentId,
|
|
389
|
-
salt: p,
|
|
390
|
-
solution: de
|
|
391
|
-
};
|
|
392
|
-
}), x = O(), v = W(x).signer;
|
|
393
|
-
if (!b(c.captchas, 0).datasetId)
|
|
394
|
-
throw new k("CAPTCHA.INVALID_CAPTCHA_ID", {
|
|
395
|
-
context: { error: "No datasetId set for challenge" }
|
|
396
|
-
});
|
|
397
|
-
const E = e.captchaApi;
|
|
398
|
-
if (!E)
|
|
399
|
-
throw new T("CAPTCHA.INVALID_TOKEN", {
|
|
400
|
-
context: { error: "No Captcha API found in state" }
|
|
401
|
-
});
|
|
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,
|
|
416
|
-
loading: !1
|
|
417
|
-
}), e.isHuman) {
|
|
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
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
})), M();
|
|
437
|
-
}
|
|
438
|
-
});
|
|
439
|
-
}, u = async () => {
|
|
440
|
-
D(), S(), a.onClose();
|
|
441
|
-
}, y = (c) => {
|
|
442
|
-
if (!e.challenge)
|
|
443
|
-
throw new T("CAPTCHA.NO_CAPTCHA", {
|
|
444
|
-
context: { error: "Cannot select, no Captcha found in state" }
|
|
445
|
-
});
|
|
446
|
-
if (e.index >= e.challenge.captchas.length || e.index < 0)
|
|
447
|
-
throw new T("CAPTCHA.NO_CAPTCHA", {
|
|
448
|
-
context: {
|
|
449
|
-
error: "Cannot select, index is out of range for this Captcha"
|
|
450
|
-
}
|
|
451
|
-
});
|
|
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 = () => {
|
|
455
|
-
if (!e.challenge)
|
|
456
|
-
throw new T("CAPTCHA.NO_CAPTCHA", {
|
|
457
|
-
context: { error: "Cannot select, no Captcha found in state" }
|
|
458
|
-
});
|
|
459
|
-
if (e.index + 1 >= e.challenge.captchas.length)
|
|
460
|
-
throw new T("CAPTCHA.NO_CAPTCHA", {
|
|
461
|
-
context: {
|
|
462
|
-
error: "Cannot select, index is out of range for this Captcha"
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
i({ index: e.index + 1 });
|
|
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 = () => {
|
|
472
|
-
window.clearTimeout(e.timeout), i({ timeout: void 0 });
|
|
473
|
-
}, M = () => {
|
|
474
|
-
const c = t.captchas.image.solutionTimeout, p = setTimeout(() => {
|
|
475
|
-
i({ isHuman: !1 }), a.onExpired();
|
|
476
|
-
}, c);
|
|
477
|
-
i({ successfullChallengeTimeout: p });
|
|
478
|
-
}, S = () => {
|
|
479
|
-
D(), i(dt());
|
|
480
|
-
}, L = async () => {
|
|
481
|
-
const c = d();
|
|
482
|
-
if (!c.web2 && !c.userAccountAddress)
|
|
483
|
-
throw new P("GENERAL.ACCOUNT_NOT_FOUND", {
|
|
484
|
-
context: { error: "Account address has not been set for web3 mode" }
|
|
485
|
-
});
|
|
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 = () => {
|
|
489
|
-
if (!e.account)
|
|
490
|
-
throw new P("GENERAL.ACCOUNT_NOT_FOUND", {
|
|
491
|
-
context: { error: "Account not loaded" }
|
|
492
|
-
});
|
|
493
|
-
return e.account;
|
|
494
|
-
}, I = () => {
|
|
495
|
-
if (!e.dappAccount)
|
|
496
|
-
throw new P("GENERAL.SITE_KEY_MISSING");
|
|
497
|
-
return e.dappAccount;
|
|
498
|
-
}, W = (c) => {
|
|
499
|
-
const p = c || O();
|
|
500
|
-
if (!p.extension)
|
|
501
|
-
throw new P("ACCOUNT.NO_POLKADOT_EXTENSION", {
|
|
502
|
-
context: { error: "Extension not loaded" }
|
|
503
|
-
});
|
|
504
|
-
return p.extension;
|
|
505
|
-
};
|
|
506
|
-
return {
|
|
507
|
-
start: f,
|
|
508
|
-
cancel: u,
|
|
509
|
-
submit: g,
|
|
510
|
-
select: y,
|
|
511
|
-
nextRound: C
|
|
512
|
-
};
|
|
513
|
-
}
|
|
514
|
-
const ht = (t) => {
|
|
515
|
-
if (!t.hash)
|
|
516
|
-
throw new k("CAPTCHA.MISSING_ITEM_HASH", {
|
|
517
|
-
context: { item: t }
|
|
518
|
-
});
|
|
519
|
-
return t.hash;
|
|
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 = {
|
|
522
|
-
0: {
|
|
523
|
-
paddingLeft: 0,
|
|
524
|
-
paddingRight: s,
|
|
525
|
-
paddingTop: s,
|
|
526
|
-
paddingBottom: s
|
|
527
|
-
},
|
|
528
|
-
1: {
|
|
529
|
-
paddingLeft: s,
|
|
530
|
-
paddingRight: s,
|
|
531
|
-
paddingTop: s,
|
|
532
|
-
paddingBottom: s
|
|
533
|
-
},
|
|
534
|
-
2: {
|
|
535
|
-
paddingLeft: s,
|
|
536
|
-
paddingRight: 0,
|
|
537
|
-
paddingTop: s,
|
|
538
|
-
paddingBottom: s
|
|
539
|
-
}
|
|
540
|
-
}, g = {
|
|
541
|
-
0: { paddingTop: d },
|
|
542
|
-
2: { paddingBottom: d }
|
|
543
|
-
};
|
|
544
|
-
return l("div", { style: {
|
|
545
|
-
paddingRight: 0.5,
|
|
546
|
-
paddingBottom: 0.5,
|
|
547
|
-
width: "100%",
|
|
548
|
-
height: "100%",
|
|
549
|
-
display: "flex",
|
|
550
|
-
flexDirection: "row",
|
|
551
|
-
flexWrap: "wrap"
|
|
552
|
-
}, children: a.map((u, y) => {
|
|
553
|
-
const C = ht(u), R = {
|
|
554
|
-
...f[y % 3],
|
|
555
|
-
...g[Math.floor(y / 3)],
|
|
556
|
-
flexGrow: 1,
|
|
557
|
-
flexBasis: "33.3333%",
|
|
558
|
-
boxSizing: "border-box"
|
|
559
|
-
};
|
|
560
|
-
return l("div", { style: R, children: A("div", { style: {
|
|
561
|
-
cursor: "pointer",
|
|
562
|
-
height: "100%",
|
|
563
|
-
width: "100%",
|
|
564
|
-
border: 1,
|
|
565
|
-
borderStyle: "solid",
|
|
566
|
-
borderColor: r.palette.grey[300]
|
|
567
|
-
}, onClick: i ? void 0 : () => n(C), onTouchStart: i ? () => n(C) : void 0, children: [l("div", { children: l("img", { style: {
|
|
568
|
-
width: "100%",
|
|
569
|
-
backgroundColor: r.palette.grey[300],
|
|
570
|
-
opacity: e.includes(C) && i ? "50%" : "100%",
|
|
571
|
-
display: "block",
|
|
572
|
-
objectFit: "contain",
|
|
573
|
-
aspectRatio: "1/1",
|
|
574
|
-
height: "auto"
|
|
575
|
-
}, src: u.data, alt: `Captcha image ${y + 1}` }) }), l("div", { style: {
|
|
576
|
-
position: "relative",
|
|
577
|
-
width: "100%",
|
|
578
|
-
height: "100%",
|
|
579
|
-
top: "-100%",
|
|
580
|
-
visibility: e.includes(C) ? "visible" : "hidden",
|
|
581
|
-
transition: "opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
|
|
582
|
-
opacity: 1
|
|
583
|
-
}, children: l("div", { style: {
|
|
584
|
-
position: "absolute",
|
|
585
|
-
top: 0,
|
|
586
|
-
left: 0,
|
|
587
|
-
bottom: 0,
|
|
588
|
-
right: 0,
|
|
589
|
-
height: "100%",
|
|
590
|
-
width: "100%",
|
|
591
|
-
display: "flex",
|
|
592
|
-
alignItems: "center",
|
|
593
|
-
justifyContent: "center",
|
|
594
|
-
backgroundColor: "rgba(0,0,0,0.5)"
|
|
595
|
-
}, children: l("svg", { style: {
|
|
596
|
-
backgroundColor: "transparent",
|
|
597
|
-
display: "block",
|
|
598
|
-
width: "35%",
|
|
599
|
-
height: "35%",
|
|
600
|
-
transition: "fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
|
|
601
|
-
userSelect: "none",
|
|
602
|
-
fill: "currentcolor"
|
|
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);
|
|
604
|
-
}) });
|
|
605
|
-
};
|
|
606
|
-
function gt(t = {}) {
|
|
607
|
-
return Object.keys(t).reduce((e, n) => ({ ...e, [`data-${n}`]: t[n] }), {});
|
|
608
|
-
}
|
|
609
|
-
function Y({ general: t, dev: e }) {
|
|
610
|
-
return {
|
|
611
|
-
...gt(t)
|
|
612
|
-
};
|
|
613
|
-
}
|
|
614
|
-
const mt = {
|
|
615
|
-
display: "inline-flex",
|
|
616
|
-
alignItems: "center",
|
|
617
|
-
justifyContent: "center",
|
|
618
|
-
position: "relative",
|
|
619
|
-
boxSizing: "border-box",
|
|
620
|
-
outline: "0px",
|
|
621
|
-
border: "0px",
|
|
622
|
-
margin: "0px",
|
|
623
|
-
cursor: "pointer",
|
|
624
|
-
userSelect: "none",
|
|
625
|
-
verticalAlign: "middle",
|
|
626
|
-
appearance: void 0,
|
|
627
|
-
textDecoration: "none",
|
|
628
|
-
fontWeight: "500",
|
|
629
|
-
fontSize: "0.875rem",
|
|
630
|
-
lineHeight: "1.75",
|
|
631
|
-
letterSpacing: "0.02857em",
|
|
632
|
-
textTransform: "uppercase",
|
|
633
|
-
minWidth: "64px",
|
|
634
|
-
padding: "6px 16px",
|
|
635
|
-
borderRadius: "4px",
|
|
636
|
-
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",
|
|
637
|
-
color: "rgb(0, 0, 0)",
|
|
638
|
-
backgroundColor: "#ffffff",
|
|
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"
|
|
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(() => {
|
|
642
|
-
const s = {
|
|
643
|
-
...mt,
|
|
644
|
-
color: r ? a.palette.primary.contrastText : a.palette.background.contrastText
|
|
645
|
-
};
|
|
646
|
-
return e === "cancel" ? {
|
|
647
|
-
...s,
|
|
648
|
-
backgroundColor: r ? a.palette.grey[600] : "transparent"
|
|
649
|
-
} : {
|
|
650
|
-
...s,
|
|
651
|
-
backgroundColor: r ? a.palette.primary.main : a.palette.background.default
|
|
652
|
-
};
|
|
653
|
-
}, [e, r, a]);
|
|
654
|
-
return l("button", { ...Y({ dev: { cy: `button-${e}` } }), onMouseEnter: () => i(!0), onMouseLeave: () => i(!1), style: d, onClick: (s) => {
|
|
655
|
-
s.preventDefault(), o();
|
|
656
|
-
}, "aria-label": n, children: n });
|
|
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: {
|
|
660
|
-
overflowX: "auto",
|
|
661
|
-
overflowY: "auto",
|
|
662
|
-
width: "100%",
|
|
663
|
-
maxWidth: "500px",
|
|
664
|
-
maxHeight: "100%",
|
|
665
|
-
display: "flex",
|
|
666
|
-
flexDirection: "column",
|
|
667
|
-
border: "1px solid #dddddd",
|
|
668
|
-
boxShadow: "rgba(255, 255, 255, 0.2) 0px 0px 4px",
|
|
669
|
-
borderRadius: "4px",
|
|
670
|
-
padding: `${u.spacing.unit}px`,
|
|
671
|
-
backgroundColor: u.palette.background.default
|
|
672
|
-
}, children: A("div", { style: {
|
|
673
|
-
backgroundColor: u.palette.background.default,
|
|
674
|
-
display: "flex",
|
|
675
|
-
flexDirection: "column",
|
|
676
|
-
minWidth: "300px"
|
|
677
|
-
}, children: [l("div", { style: {
|
|
678
|
-
display: "flex",
|
|
679
|
-
alignItems: "center",
|
|
680
|
-
width: "100%"
|
|
681
|
-
}, children: l("div", { style: {
|
|
682
|
-
backgroundColor: u.palette.primary.main,
|
|
683
|
-
width: "100%"
|
|
684
|
-
}, children: A("div", { style: {
|
|
685
|
-
paddingLeft: `${u.spacing.half}px`,
|
|
686
|
-
paddingRight: `${u.spacing.half}px`
|
|
687
|
-
}, children: [A("p", { style: {
|
|
688
|
-
color: "#ffffff",
|
|
689
|
-
fontWeight: 700,
|
|
690
|
-
lineHeight: 1.5
|
|
691
|
-
}, children: [s("WIDGET.SELECT_ALL"), ":", " ", l("span", { style: { textTransform: "capitalize" }, children: `${b(t.captchas, e).target}` })] }), l("p", { style: {
|
|
692
|
-
color: "#ffffff",
|
|
693
|
-
fontWeight: 500,
|
|
694
|
-
lineHeight: 0.8,
|
|
695
|
-
fontSize: "0.8rem"
|
|
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: {
|
|
697
|
-
display: "flex",
|
|
698
|
-
alignItems: "center",
|
|
699
|
-
justifyContent: "center",
|
|
700
|
-
width: "100%"
|
|
701
|
-
}, ...Y({ dev: { cy: "dots-captcha" } }) }), l("div", { style: {
|
|
702
|
-
padding: `0 ${u.spacing}px`,
|
|
703
|
-
display: "flex",
|
|
704
|
-
width: "100%"
|
|
705
|
-
} }), A("div", { style: {
|
|
706
|
-
padding: `0 ${u.spacing}px`,
|
|
707
|
-
display: "flex",
|
|
708
|
-
alignItems: "center",
|
|
709
|
-
justifyContent: "space-between",
|
|
710
|
-
lineHeight: 1.75
|
|
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) => {
|
|
713
|
-
const { show: n, children: o } = t, r = {
|
|
714
|
-
position: "fixed",
|
|
715
|
-
zIndex: 2147483646,
|
|
716
|
-
inset: 0,
|
|
717
|
-
display: n ? "block" : "none"
|
|
718
|
-
}, i = {
|
|
719
|
-
position: "fixed",
|
|
720
|
-
display: "flex",
|
|
721
|
-
alignItems: "center",
|
|
722
|
-
justifyContent: "center",
|
|
723
|
-
right: 0,
|
|
724
|
-
bottom: 0,
|
|
725
|
-
top: 0,
|
|
726
|
-
left: 0,
|
|
727
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
728
|
-
zIndex: -1
|
|
729
|
-
}, d = {
|
|
730
|
-
position: "absolute",
|
|
731
|
-
top: "50%",
|
|
732
|
-
left: "50%",
|
|
733
|
-
transform: "translate(-50%, -50%)",
|
|
734
|
-
width: "400px",
|
|
735
|
-
backgroundColor: "transparent",
|
|
736
|
-
border: "none",
|
|
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,"
|
|
738
|
-
};
|
|
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,
|
|
744
|
-
maxHeight: "100%",
|
|
745
|
-
overflowX: "auto"
|
|
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,
|
|
752
|
-
display: "flex",
|
|
753
|
-
alignItems: "center",
|
|
754
|
-
flexWrap: "wrap",
|
|
755
|
-
justifyContent: "space-between",
|
|
756
|
-
minHeight: `${Ce}px`,
|
|
757
|
-
overflow: "hidden"
|
|
758
|
-
}, children: [l("div", { style: { display: "inline-flex", flexDirection: "column" }, children: l("div", { style: {
|
|
759
|
-
alignItems: "center",
|
|
760
|
-
flex: 1
|
|
761
|
-
}, children: A("div", { style: {
|
|
762
|
-
display: "flex",
|
|
763
|
-
alignItems: "center",
|
|
764
|
-
justifyContent: "center",
|
|
765
|
-
flexDirection: "column",
|
|
766
|
-
verticalAlign: "middle"
|
|
767
|
-
}, children: [l("div", { style: {
|
|
768
|
-
display: o.loading ? "none" : "flex"
|
|
769
|
-
}, children: l(Ke, { themeColor: i, onChange: r.start, checked: o.isHuman, labelText: "I am human", "aria-label": "human checkbox" }) }), l("div", { style: {
|
|
770
|
-
display: o.loading ? "flex" : "none"
|
|
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" }) }) }) })] })] }) }) })] }) });
|
|
772
|
-
};
|
|
773
|
-
export {
|
|
774
|
-
wt as default
|
|
775
|
-
};
|