@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.
Files changed (60) hide show
  1. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js +19 -9
  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 +347 -0
  19. package/dist/bundle/{ProcaptchaWidget-BIt2pcrz.js → ProcaptchaWidget-CJ-4hVS1.js} +24 -24
  20. package/dist/bundle/{ProcaptchaWidget-CXxnCzl2.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-CqnUYyKY.js → captchaRenderer-s4QuLEen.js} +23 -22
  24. package/dist/bundle/{commonChunk-BKceWhtS.js → commonChunk-BjvuHlB1.js} +62 -68
  25. package/dist/bundle/{emotion-element-5486c51c.browser.esm-CimrRZxS.js → emotion-element-c39617d8.browser.esm-BNNnmykm.js} +343 -345
  26. package/dist/bundle/index-BuQg3Zno.js +1884 -0
  27. package/dist/bundle/{index-KHTbPva_.js → index-DIdd2cUz.js} +1 -1
  28. package/dist/bundle/{index-hrOz2CPm.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/{utilCryptoChunk-BKe3CKqn.js → utilCryptoChunk-D6ZLkbFV.js} +252 -243
  39. package/dist/bundle/{web2Chunk-Cqw91v-J.js → web2Chunk-CNoojUDK.js} +1067 -977
  40. package/dist/bundle/web3Chunk-BlYvY4Ea.js +525 -0
  41. package/dist/bundle/{zodChunk-wTu9ZHzV.js → zodChunk-aEfPZzrp.js} +3 -3
  42. package/dist/cjs/util/captcha/captchaComponentProvider.cjs +3 -2
  43. package/dist/cjs/util/captcha/captchaRenderer.cjs +4 -3
  44. package/dist/cjs/util/captcha/components/frictionlessCaptcha.cjs +4 -3
  45. package/dist/cjs/util/captcha/components/imageCaptcha.cjs +1 -1
  46. package/dist/cjs/util/captcha/components/powCaptcha.cjs +1 -1
  47. package/dist/cjs/util/widgetFactory.cjs +7 -2
  48. package/dist/util/captcha/captchaComponentProvider.js +3 -2
  49. package/dist/util/captcha/captchaRenderer.js +4 -3
  50. package/dist/util/captcha/components/frictionlessCaptcha.js +4 -3
  51. package/dist/util/captcha/components/imageCaptcha.js +1 -1
  52. package/dist/util/captcha/components/powCaptcha.js +1 -1
  53. package/dist/util/widgetFactory.js +7 -2
  54. package/package.json +19 -20
  55. package/stats.html +1 -1
  56. package/vite.test.config.ts +3 -2
  57. package/dist/bundle/captchaComponentProvider-BGEAkC9Y.js +0 -968
  58. package/dist/bundle/index-7Xh-Mf8v.js +0 -1318
  59. package/dist/bundle/nobleChunk-CQ4ENyKh.js +0 -3769
  60. package/dist/bundle/web3Chunk-BcwDKvjL.js +0 -517
@@ -0,0 +1,1002 @@
1
+ import { h as ce, j as C, E as le, a as ue, s as de, w as Se, T as Pe, u as Tt, i as we, r as xe, b as Ce, g as Te } from "./emotion-element-c39617d8.browser.esm-BNNnmykm.js";
2
+ import { r as m, c as w, A as i, S as Ee, d as ke, e as q, U as Ae, R as Ie, l as Oe, P as Re, C as N } from "./web2Chunk-CNoojUDK.js";
3
+ import { g as je, W as Ne, l as _e, d as Fe } from "./index-IgqrmVIs.js";
4
+ import { g as It } from "./bnChunk-DRlDxTFg.js";
5
+ import { a as Y } from "./commonChunk-BjvuHlB1.js";
6
+ import { z as I } from "./zodChunk-aEfPZzrp.js";
7
+ const Me = I.object({
8
+ address: I.string(),
9
+ url: I.string(),
10
+ datasetId: I.string(),
11
+ weight: I.number().optional().default(1).transform((e) => {
12
+ const t = Math.round(e);
13
+ return Math.max(1, Math.min(100, t));
14
+ })
15
+ }), re = (e) => Object.values(e).map(
16
+ (r) => Me.parse(r)
17
+ ).sort((r, o) => r.url.localeCompare(o.url)), $e = async (e) => {
18
+ if (e === "production") {
19
+ const t = await fetch(
20
+ "https://provider-list.prosopo.io/",
21
+ {
22
+ method: "GET",
23
+ mode: "cors"
24
+ }
25
+ ).then((r) => r.json());
26
+ return re(t);
27
+ }
28
+ if (e === "staging") {
29
+ const t = await fetch(
30
+ "https://provider-list.prosopo.io/staging.json",
31
+ { method: "GET", mode: "cors" }
32
+ ).then((r) => r.json());
33
+ return re(t);
34
+ }
35
+ if (e === "development")
36
+ return [
37
+ {
38
+ address: "5EjTA28bKSbFPPyMbUjNtArxyqjwq38r1BapVmLZShaqEedV",
39
+ url: "http://localhost:9229",
40
+ datasetId: "0x9f460e81ac9c71b486f796a21bb36e2263694756a6621134d110da217fd3ef25",
41
+ weight: 1
42
+ }
43
+ ];
44
+ throw new Y("CONFIG.UNKNOWN_ENVIRONMENT", {
45
+ context: { environment: e }
46
+ });
47
+ };
48
+ let B = [];
49
+ function De(e, t) {
50
+ if (e.length === 0)
51
+ throw new Error("No providers available");
52
+ const r = e.reduce((n, d) => n + d.weight, 0), o = t % r;
53
+ let a = 0;
54
+ for (const n of e)
55
+ if (a += n.weight, o < a)
56
+ return n;
57
+ const s = e[e.length - 1];
58
+ if (!s)
59
+ throw new Error("No providers available");
60
+ return s;
61
+ }
62
+ const pe = async (e, t) => {
63
+ B.length === 0 && (B = await $e(e));
64
+ const r = De(B, t);
65
+ return {
66
+ providerAccount: r.address,
67
+ provider: {
68
+ url: r.url,
69
+ datasetId: r.datasetId
70
+ }
71
+ };
72
+ }, jt = async (e) => {
73
+ const r = window.crypto.getRandomValues(new Uint8Array(10)).reduce((o, a) => o + a, 0);
74
+ return await pe(e, r);
75
+ }, Le = async (e, t, r, o, a) => {
76
+ try {
77
+ await e();
78
+ } catch (s) {
79
+ if (o >= a)
80
+ return console.error(s), console.error(
81
+ `Max retries (${o} of ${a}) reached, aborting`
82
+ ), r();
83
+ console.error(s), r(), await t();
84
+ }
85
+ }, _ = (e) => ({
86
+ ...je(void 0),
87
+ ...e
88
+ }), Ue = async (e) => e ? (await import("./web2Chunk-CNoojUDK.js").then((t) => t.m)).default : (await import("./web3Chunk-BlYvY4Ea.js")).default;
89
+ function V() {
90
+ return V = Object.assign ? Object.assign.bind() : function(e) {
91
+ for (var t = 1; t < arguments.length; t++) {
92
+ var r = arguments[t];
93
+ for (var o in r) ({}).hasOwnProperty.call(r, o) && (e[o] = r[o]);
94
+ }
95
+ return e;
96
+ }, V.apply(null, arguments);
97
+ }
98
+ var fe = { exports: {} }, c = {};
99
+ var p = typeof Symbol == "function" && Symbol.for, J = p ? Symbol.for("react.element") : 60103, Z = p ? Symbol.for("react.portal") : 60106, F = p ? Symbol.for("react.fragment") : 60107, M = p ? Symbol.for("react.strict_mode") : 60108, $ = p ? Symbol.for("react.profiler") : 60114, D = p ? Symbol.for("react.provider") : 60109, L = p ? Symbol.for("react.context") : 60110, Q = p ? Symbol.for("react.async_mode") : 60111, U = p ? Symbol.for("react.concurrent_mode") : 60111, z = p ? Symbol.for("react.forward_ref") : 60112, H = p ? Symbol.for("react.suspense") : 60113, ze = p ? Symbol.for("react.suspense_list") : 60120, K = p ? Symbol.for("react.memo") : 60115, W = p ? Symbol.for("react.lazy") : 60116, He = p ? Symbol.for("react.block") : 60121, Ke = p ? Symbol.for("react.fundamental") : 60117, We = p ? Symbol.for("react.responder") : 60118, qe = p ? Symbol.for("react.scope") : 60119;
100
+ function v(e) {
101
+ if (typeof e == "object" && e !== null) {
102
+ var t = e.$$typeof;
103
+ switch (t) {
104
+ case J:
105
+ switch (e = e.type, e) {
106
+ case Q:
107
+ case U:
108
+ case F:
109
+ case $:
110
+ case M:
111
+ case H:
112
+ return e;
113
+ default:
114
+ switch (e = e && e.$$typeof, e) {
115
+ case L:
116
+ case z:
117
+ case W:
118
+ case K:
119
+ case D:
120
+ return e;
121
+ default:
122
+ return t;
123
+ }
124
+ }
125
+ case Z:
126
+ return t;
127
+ }
128
+ }
129
+ }
130
+ function me(e) {
131
+ return v(e) === U;
132
+ }
133
+ c.AsyncMode = Q;
134
+ c.ConcurrentMode = U;
135
+ c.ContextConsumer = L;
136
+ c.ContextProvider = D;
137
+ c.Element = J;
138
+ c.ForwardRef = z;
139
+ c.Fragment = F;
140
+ c.Lazy = W;
141
+ c.Memo = K;
142
+ c.Portal = Z;
143
+ c.Profiler = $;
144
+ c.StrictMode = M;
145
+ c.Suspense = H;
146
+ c.isAsyncMode = function(e) {
147
+ return me(e) || v(e) === Q;
148
+ };
149
+ c.isConcurrentMode = me;
150
+ c.isContextConsumer = function(e) {
151
+ return v(e) === L;
152
+ };
153
+ c.isContextProvider = function(e) {
154
+ return v(e) === D;
155
+ };
156
+ c.isElement = function(e) {
157
+ return typeof e == "object" && e !== null && e.$$typeof === J;
158
+ };
159
+ c.isForwardRef = function(e) {
160
+ return v(e) === z;
161
+ };
162
+ c.isFragment = function(e) {
163
+ return v(e) === F;
164
+ };
165
+ c.isLazy = function(e) {
166
+ return v(e) === W;
167
+ };
168
+ c.isMemo = function(e) {
169
+ return v(e) === K;
170
+ };
171
+ c.isPortal = function(e) {
172
+ return v(e) === Z;
173
+ };
174
+ c.isProfiler = function(e) {
175
+ return v(e) === $;
176
+ };
177
+ c.isStrictMode = function(e) {
178
+ return v(e) === M;
179
+ };
180
+ c.isSuspense = function(e) {
181
+ return v(e) === H;
182
+ };
183
+ c.isValidElementType = function(e) {
184
+ return typeof e == "string" || typeof e == "function" || e === F || e === U || e === $ || e === M || e === H || e === ze || typeof e == "object" && e !== null && (e.$$typeof === W || e.$$typeof === K || e.$$typeof === D || e.$$typeof === L || e.$$typeof === z || e.$$typeof === Ke || e.$$typeof === We || e.$$typeof === qe || e.$$typeof === He);
185
+ };
186
+ c.typeOf = v;
187
+ fe.exports = c;
188
+ var Be = fe.exports, he = Be;
189
+ var Ge = {
190
+ $$typeof: !0,
191
+ render: !0,
192
+ defaultProps: !0,
193
+ displayName: !0,
194
+ propTypes: !0
195
+ }, Ve = {
196
+ $$typeof: !0,
197
+ compare: !0,
198
+ defaultProps: !0,
199
+ displayName: !0,
200
+ propTypes: !0,
201
+ type: !0
202
+ }, ge = {};
203
+ ge[he.ForwardRef] = Ge;
204
+ ge[he.Memo] = Ve;
205
+ var Nt = Object.prototype;
206
+ function S(e, t, r) {
207
+ return ce.call(t, "css") ? C.jsx(le, ue(e, t), r) : C.jsx(e, t, r);
208
+ }
209
+ function Xe(e, t, r) {
210
+ return ce.call(t, "css") ? C.jsxs(le, ue(e, t), r) : C.jsxs(e, t, r);
211
+ }
212
+ function Ye() {
213
+ for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
214
+ t[r] = arguments[r];
215
+ return de(t);
216
+ }
217
+ function Je(e) {
218
+ var t = /* @__PURE__ */ Object.create(null);
219
+ return function(r) {
220
+ return t[r] === void 0 && (t[r] = e(r)), t[r];
221
+ };
222
+ }
223
+ var Ze = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/, Qe = /* @__PURE__ */ Je(
224
+ function(e) {
225
+ return Ze.test(e) || e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && e.charCodeAt(2) < 91;
226
+ }
227
+ /* Z+1 */
228
+ ), et = Qe, tt = function(t) {
229
+ return t !== "theme";
230
+ }, oe = function(t) {
231
+ return typeof t == "string" && // 96 is one less than the char code
232
+ // for "a" so this is checking that
233
+ // it's a lowercase character
234
+ t.charCodeAt(0) > 96 ? et : tt;
235
+ }, ae = function(t, r, o) {
236
+ var a;
237
+ if (r) {
238
+ var s = r.shouldForwardProp;
239
+ a = t.__emotion_forwardProp && s ? function(n) {
240
+ return t.__emotion_forwardProp(n) && s(n);
241
+ } : s;
242
+ }
243
+ return typeof a != "function" && o && (a = t.__emotion_forwardProp), a;
244
+ }, rt = function(t) {
245
+ var r = t.cache, o = t.serialized, a = t.isStringTag;
246
+ return xe(r, o, a), Ce(function() {
247
+ return we(r, o, a);
248
+ }), null;
249
+ }, ot = function e(t, r) {
250
+ var o = t.__emotion_real === t, a = o && t.__emotion_base || t, s, n;
251
+ r !== void 0 && (s = r.label, n = r.target);
252
+ var d = ae(t, r, o), y = d || oe(a), h = !y("as");
253
+ return function() {
254
+ var b = arguments, f = o && t.__emotion_styles !== void 0 ? t.__emotion_styles.slice(0) : [];
255
+ if (s !== void 0 && f.push("label:" + s + ";"), b[0] == null || b[0].raw === void 0)
256
+ f.push.apply(f, b);
257
+ else {
258
+ f.push(b[0][0]);
259
+ for (var g = b.length, T = 1; T < g; T++)
260
+ f.push(b[T], b[0][T]);
261
+ }
262
+ var u = Se(function(l, P, O) {
263
+ var k = h && l.as || a, x = "", A = [], E = l;
264
+ if (l.theme == null) {
265
+ E = {};
266
+ for (var ee in l)
267
+ E[ee] = l[ee];
268
+ E.theme = m.useContext(Pe);
269
+ }
270
+ typeof l.className == "string" ? x = Te(P.registered, A, l.className) : l.className != null && (x = l.className + " ");
271
+ var te = de(f.concat(A), P.registered, E);
272
+ x += P.key + "-" + te.name, n !== void 0 && (x += " " + n);
273
+ var be = h && d === void 0 ? oe(k) : y, R = {};
274
+ for (var j in l)
275
+ h && j === "as" || // $FlowFixMe
276
+ be(j) && (R[j] = l[j]);
277
+ return R.className = x, R.ref = O, /* @__PURE__ */ m.createElement(m.Fragment, null, /* @__PURE__ */ m.createElement(rt, {
278
+ cache: P,
279
+ serialized: te,
280
+ isStringTag: typeof k == "string"
281
+ }), /* @__PURE__ */ m.createElement(k, R));
282
+ });
283
+ return u.displayName = s !== void 0 ? s : "Styled(" + (typeof a == "string" ? a : a.displayName || a.name || "Component") + ")", u.defaultProps = t.defaultProps, u.__emotion_real = u, u.__emotion_base = a, u.__emotion_styles = f, u.__emotion_forwardProp = d, Object.defineProperty(u, "toString", {
284
+ value: function() {
285
+ return "." + n;
286
+ }
287
+ }), u.withComponent = function(l, P) {
288
+ return e(l, V({}, r, P, {
289
+ shouldForwardProp: ae(u, P, !0)
290
+ })).apply(void 0, f);
291
+ }, u;
292
+ };
293
+ }, at = [
294
+ "a",
295
+ "abbr",
296
+ "address",
297
+ "area",
298
+ "article",
299
+ "aside",
300
+ "audio",
301
+ "b",
302
+ "base",
303
+ "bdi",
304
+ "bdo",
305
+ "big",
306
+ "blockquote",
307
+ "body",
308
+ "br",
309
+ "button",
310
+ "canvas",
311
+ "caption",
312
+ "cite",
313
+ "code",
314
+ "col",
315
+ "colgroup",
316
+ "data",
317
+ "datalist",
318
+ "dd",
319
+ "del",
320
+ "details",
321
+ "dfn",
322
+ "dialog",
323
+ "div",
324
+ "dl",
325
+ "dt",
326
+ "em",
327
+ "embed",
328
+ "fieldset",
329
+ "figcaption",
330
+ "figure",
331
+ "footer",
332
+ "form",
333
+ "h1",
334
+ "h2",
335
+ "h3",
336
+ "h4",
337
+ "h5",
338
+ "h6",
339
+ "head",
340
+ "header",
341
+ "hgroup",
342
+ "hr",
343
+ "html",
344
+ "i",
345
+ "iframe",
346
+ "img",
347
+ "input",
348
+ "ins",
349
+ "kbd",
350
+ "keygen",
351
+ "label",
352
+ "legend",
353
+ "li",
354
+ "link",
355
+ "main",
356
+ "map",
357
+ "mark",
358
+ "marquee",
359
+ "menu",
360
+ "menuitem",
361
+ "meta",
362
+ "meter",
363
+ "nav",
364
+ "noscript",
365
+ "object",
366
+ "ol",
367
+ "optgroup",
368
+ "option",
369
+ "output",
370
+ "p",
371
+ "param",
372
+ "picture",
373
+ "pre",
374
+ "progress",
375
+ "q",
376
+ "rp",
377
+ "rt",
378
+ "ruby",
379
+ "s",
380
+ "samp",
381
+ "script",
382
+ "section",
383
+ "select",
384
+ "small",
385
+ "source",
386
+ "span",
387
+ "strong",
388
+ "style",
389
+ "sub",
390
+ "summary",
391
+ "sup",
392
+ "table",
393
+ "tbody",
394
+ "td",
395
+ "textarea",
396
+ "tfoot",
397
+ "th",
398
+ "thead",
399
+ "time",
400
+ "title",
401
+ "tr",
402
+ "track",
403
+ "u",
404
+ "ul",
405
+ "var",
406
+ "video",
407
+ "wbr",
408
+ // SVG
409
+ "circle",
410
+ "clipPath",
411
+ "defs",
412
+ "ellipse",
413
+ "foreignObject",
414
+ "g",
415
+ "image",
416
+ "line",
417
+ "linearGradient",
418
+ "mask",
419
+ "path",
420
+ "pattern",
421
+ "polygon",
422
+ "polyline",
423
+ "radialGradient",
424
+ "rect",
425
+ "stop",
426
+ "svg",
427
+ "text",
428
+ "tspan"
429
+ ], X = ot.bind();
430
+ at.forEach(function(e) {
431
+ X[e] = X(e);
432
+ });
433
+ const nt = Ye`{
434
+ &:before {
435
+ content: '""';
436
+ position: absolute;
437
+ height: 100%;
438
+ width: 100%;
439
+ }
440
+ }`, st = {
441
+ width: "28px",
442
+ height: "28px",
443
+ minWidth: "14px",
444
+ minHeight: "14px",
445
+ top: "auto",
446
+ left: "auto",
447
+ opacity: "1",
448
+ borderRadius: "12.5%",
449
+ appearance: "none",
450
+ cursor: "pointer",
451
+ margin: "0",
452
+ borderStyle: "solid",
453
+ borderWidth: "1px"
454
+ }, ne = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", it = "https://docs.prosopo.io/en/basics/faq/", ct = () => Array.from(
455
+ { length: 8 },
456
+ () => ne[Math.floor(Math.random() * ne.length)]
457
+ ).join(""), lt = ({
458
+ theme: e,
459
+ onChange: t,
460
+ checked: r,
461
+ labelText: o,
462
+ error: a,
463
+ loading: s
464
+ }) => {
465
+ const n = {
466
+ ...st,
467
+ border: `1px solid ${e.palette.background.contrastText}`
468
+ }, [d, y] = m.useState(!1), h = X.label`
469
+ color: ${e.palette.background.contrastText};
470
+ position: relative;
471
+ display: flex;
472
+ cursor: pointer;
473
+ user-select: none;
474
+
475
+ @container widget (max-width: 219px) {
476
+ display: none;
477
+ }
478
+ @container widget (min-width: 220px) {
479
+ font-size: 12px;
480
+ }
481
+ @container widget (min-width: 250px) {
482
+ font-size: 14px;
483
+ }
484
+ @container widget (min-width: 270px) {
485
+ font-size: 16px;
486
+ }
487
+ `, b = m.useMemo(() => ({
488
+ ...n,
489
+ borderColor: d ? e.palette.background.contrastText : e.palette.border,
490
+ appearance: r ? "auto" : "none",
491
+ flex: 1,
492
+ margin: "15px",
493
+ minWidth: "28px",
494
+ minHeight: "28px"
495
+ }), [d, e, r]), f = ct();
496
+ return /* @__PURE__ */ Xe(
497
+ "span",
498
+ {
499
+ style: {
500
+ display: "inline-flex",
501
+ alignItems: "center",
502
+ minHeight: "58px"
503
+ },
504
+ children: [
505
+ s ? /* @__PURE__ */ S(
506
+ "div",
507
+ {
508
+ className: Ne,
509
+ "aria-label": "Loading spinner"
510
+ }
511
+ ) : /* @__PURE__ */ S(
512
+ "input",
513
+ {
514
+ name: f,
515
+ id: f,
516
+ onMouseEnter: () => y(!0),
517
+ onMouseLeave: () => y(!1),
518
+ css: nt,
519
+ type: "checkbox",
520
+ "aria-live": "assertive",
521
+ "aria-label": o,
522
+ onKeyDown: (g) => {
523
+ g.isTrusted && g.key === "Enter" && (g.preventDefault(), g.stopPropagation(), y(!1), t(g));
524
+ },
525
+ onChange: (g) => {
526
+ g.isTrusted && (g.preventDefault(), g.stopPropagation(), y(!1), t(g));
527
+ },
528
+ checked: r,
529
+ style: b,
530
+ disabled: a !== void 0,
531
+ className: s ? "checkbox__loading-spinner" : "",
532
+ "data-cy": "captcha-checkbox"
533
+ }
534
+ ),
535
+ a ? /* @__PURE__ */ S(h, { htmFor: f, children: /* @__PURE__ */ S(
536
+ "a",
537
+ {
538
+ css: {
539
+ color: e.palette.error.main
540
+ },
541
+ href: it,
542
+ children: a
543
+ }
544
+ ) }) : /* @__PURE__ */ S(h, { htmFor: f, children: o })
545
+ ]
546
+ }
547
+ );
548
+ };
549
+ class G extends Error {
550
+ constructor(t, r, o) {
551
+ super(`HTTP error! status: ${t} (${r}) for URL: ${o}`), this.status = t, this.statusText = r, this.url = o, this.name = "HttpError";
552
+ }
553
+ }
554
+ class ut {
555
+ constructor(t, r = "") {
556
+ this.baseURL = t + r;
557
+ }
558
+ async fetch(t, r) {
559
+ var o;
560
+ try {
561
+ const a = await fetch(this.baseURL + t, r);
562
+ if (!a.ok && // Only throw an error if the response is not JSON and not a 400 error
563
+ a.status !== 400 && !((o = a.headers.get("content-type")) != null && o.includes("application/json")))
564
+ throw new G(a.status, a.statusText, a.url);
565
+ return this.responseHandler(a);
566
+ } catch (a) {
567
+ return this.errorHandler(a);
568
+ }
569
+ }
570
+ async post(t, r, o) {
571
+ var s;
572
+ const a = {
573
+ "Content-Type": "application/json",
574
+ ...(o == null ? void 0 : o.headers) || {}
575
+ };
576
+ try {
577
+ const n = await fetch(this.baseURL + t, {
578
+ method: "POST",
579
+ body: JSON.stringify(r),
580
+ ...o,
581
+ headers: a
582
+ });
583
+ if (!n.ok && // Only throw an error if the response is not JSON and not a 400 error
584
+ n.status !== 400 && !((s = n.headers.get("content-type")) != null && s.includes("application/json")))
585
+ throw new G(n.status, n.statusText, n.url);
586
+ return this.responseHandler(n);
587
+ } catch (n) {
588
+ return this.errorHandler(n);
589
+ }
590
+ }
591
+ async responseHandler(t) {
592
+ try {
593
+ return await t.json();
594
+ } catch (r) {
595
+ throw console.error("Error parsing JSON:", r), r;
596
+ }
597
+ }
598
+ errorHandler(t) {
599
+ return t instanceof G ? console.error("HTTP error:", t) : console.error("API request error:", t), Promise.reject(t);
600
+ }
601
+ }
602
+ class dt extends ut {
603
+ constructor(t, r) {
604
+ const o = t.startsWith("http") ? t : `https://${t}`;
605
+ super(o), this.account = r;
606
+ }
607
+ }
608
+ class pt extends dt {
609
+ getCaptchaChallenge(t, r, o) {
610
+ const { provider: a } = r, s = this.account, n = {
611
+ [i.dapp]: s,
612
+ [i.user]: t,
613
+ [i.datasetId]: a.datasetId
614
+ };
615
+ return o && (n[i.sessionId] = o), this.post(w.GetImageCaptchaChallenge, n, {
616
+ headers: {
617
+ "Prosopo-Site-Key": this.account,
618
+ "Prosopo-User": t
619
+ }
620
+ });
621
+ }
622
+ submitCaptchaSolution(t, r, o, a, s, n) {
623
+ const d = {
624
+ [i.user]: o,
625
+ [i.dapp]: this.account,
626
+ [i.captchas]: t,
627
+ [i.requestHash]: r,
628
+ [i.timestamp]: a,
629
+ [i.signature]: {
630
+ [i.user]: {
631
+ [i.timestamp]: n
632
+ },
633
+ [i.provider]: {
634
+ [i.requestHash]: s
635
+ }
636
+ }
637
+ };
638
+ return this.post(w.SubmitImageCaptchaSolution, d, {
639
+ headers: {
640
+ "Prosopo-Site-Key": this.account,
641
+ "Prosopo-User": o
642
+ }
643
+ });
644
+ }
645
+ verifyDappUser(t, r, o, a, s) {
646
+ const n = {
647
+ [i.token]: t,
648
+ [i.dappSignature]: r,
649
+ [i.ip]: s
650
+ };
651
+ return a && (n[i.maxVerifiedTime] = a), this.post(w.VerifyImageCaptchaSolutionDapp, n, {
652
+ headers: {
653
+ "Prosopo-Site-Key": this.account,
654
+ "Prosopo-User": o
655
+ }
656
+ });
657
+ }
658
+ getPowCaptchaChallenge(t, r, o) {
659
+ const a = {
660
+ [i.user]: t.toString(),
661
+ [i.dapp]: r.toString(),
662
+ ...o && { [i.sessionId]: o }
663
+ };
664
+ return this.post(w.GetPowCaptchaChallenge, a, {
665
+ headers: {
666
+ "Prosopo-Site-Key": this.account,
667
+ "Prosopo-User": t
668
+ }
669
+ });
670
+ }
671
+ submitPowCaptchaSolution(t, r, o, a, s, n) {
672
+ const d = Ee.parse({
673
+ [i.challenge]: t.challenge,
674
+ [i.difficulty]: t.difficulty,
675
+ [i.timestamp]: t.timestamp,
676
+ [i.user]: r.toString(),
677
+ [i.dapp]: o.toString(),
678
+ [i.nonce]: a,
679
+ [i.verifiedTimeout]: n,
680
+ [i.signature]: {
681
+ [i.provider]: t[i.signature][i.provider],
682
+ [i.user]: {
683
+ [i.timestamp]: s
684
+ }
685
+ }
686
+ });
687
+ return this.post(w.SubmitPowCaptchaSolution, d, {
688
+ headers: {
689
+ "Prosopo-Site-Key": this.account,
690
+ "Prosopo-User": r
691
+ }
692
+ });
693
+ }
694
+ getFrictionlessCaptcha(t, r, o) {
695
+ const a = {
696
+ [i.token]: t,
697
+ [i.dapp]: r,
698
+ [i.user]: o
699
+ };
700
+ return this.post(w.GetFrictionlessCaptchaChallenge, a, {
701
+ headers: {
702
+ "Prosopo-Site-Key": this.account,
703
+ "Prosopo-User": o
704
+ }
705
+ });
706
+ }
707
+ submitUserEvents(t, r) {
708
+ return this.post(
709
+ w.SubmitUserEvents,
710
+ { events: t, string: r },
711
+ {
712
+ headers: {
713
+ "Prosopo-Site-Key": this.account
714
+ }
715
+ }
716
+ );
717
+ }
718
+ getProviderStatus() {
719
+ return this.fetch(w.GetProviderStatus, {
720
+ headers: {
721
+ "Prosopo-Site-Key": this.account
722
+ }
723
+ });
724
+ }
725
+ getProviderDetails() {
726
+ return this.fetch(ke.GetProviderDetails, {
727
+ headers: {
728
+ "Prosopo-Site-Key": this.account
729
+ }
730
+ });
731
+ }
732
+ submitPowCaptchaVerify(t, r, o, a, s) {
733
+ const n = {
734
+ [i.token]: t,
735
+ [i.dappSignature]: r,
736
+ [i.verifiedTimeout]: o,
737
+ [i.ip]: s
738
+ };
739
+ return this.post(w.VerifyPowCaptchaSolution, n, {
740
+ headers: {
741
+ "Prosopo-Site-Key": this.account,
742
+ "Prosopo-User": a
743
+ }
744
+ });
745
+ }
746
+ registerSiteKey(t, r, o, a, s) {
747
+ const n = { siteKey: t, tier: r, settings: o };
748
+ return this.post(q.SiteKeyRegister, n, {
749
+ headers: {
750
+ "Prosopo-Site-Key": this.account,
751
+ timestamp: a,
752
+ signature: s
753
+ }
754
+ });
755
+ }
756
+ updateDetectorKey(t, r, o) {
757
+ return this.post(
758
+ q.UpdateDetectorKey,
759
+ Ae.parse({ detectorKey: t }),
760
+ {
761
+ headers: {
762
+ "Prosopo-Site-Key": this.account,
763
+ timestamp: r,
764
+ signature: o
765
+ }
766
+ }
767
+ );
768
+ }
769
+ removeDetectorKey(t, r, o, a) {
770
+ return this.post(
771
+ q.RemoveDetectorKey,
772
+ Ie.parse({
773
+ detectorKey: t,
774
+ expirationInSeconds: a
775
+ }),
776
+ {
777
+ headers: {
778
+ "Prosopo-Site-Key": this.account,
779
+ timestamp: r,
780
+ signature: o
781
+ }
782
+ }
783
+ );
784
+ }
785
+ }
786
+ const ft = m.lazy(
787
+ async () => import("./ProcaptchaWidget-CJ-4hVS1.js")
788
+ ), ye = (e) => /* @__PURE__ */ S(m.Suspense, { children: /* @__PURE__ */ S(
789
+ ft,
790
+ {
791
+ config: e.config,
792
+ callbacks: e.callbacks,
793
+ frictionlessState: e.frictionlessState,
794
+ i18n: e.i18n
795
+ }
796
+ ) }), mt = m.lazy(async () => import("./ProcaptchaWidget-Cw3s7cGX.js")), ve = (e) => /* @__PURE__ */ S(m.Suspense, { children: /* @__PURE__ */ S(mt, { ...e }) }), ht = async () => (await import("./index-BuQg3Zno.js")).default, gt = async (e, t) => {
797
+ let r;
798
+ const o = new Promise((a, s) => {
799
+ r = setTimeout(() => {
800
+ s(new Y("API.UNKNOWN"));
801
+ }, t);
802
+ });
803
+ try {
804
+ const a = await Promise.race([e, o]);
805
+ return r && clearTimeout(r), a;
806
+ } catch (a) {
807
+ throw r && clearTimeout(r), a;
808
+ }
809
+ }, yt = async (e, t, r) => {
810
+ const a = await new (await Ue(e.web2))().getAccount(e), n = await (await ht())(
811
+ e.defaultEnvironment,
812
+ pe,
813
+ t,
814
+ r,
815
+ a.account.address
816
+ );
817
+ if (!e.account.address)
818
+ throw new Y("GENERAL.SITE_KEY_MISSING");
819
+ const d = n.provider;
820
+ if (!d)
821
+ throw new Error("Provider Selection Failed");
822
+ const y = new pt(
823
+ d.provider.url,
824
+ e.account.address
825
+ ), h = await gt(
826
+ y.getFrictionlessCaptcha(
827
+ n.token,
828
+ e.account.address,
829
+ a.account.address
830
+ ),
831
+ 1e4
832
+ // 10 second timeout
833
+ );
834
+ return {
835
+ captchaType: h.captchaType,
836
+ sessionId: h.sessionId,
837
+ provider: d,
838
+ status: h.status,
839
+ userAccount: a,
840
+ error: h.error
841
+ };
842
+ }, se = (e, t, r, o, a, s) => {
843
+ const n = e === "light" ? _e : Fe;
844
+ return t === "invisible" ? null : /* @__PURE__ */ S(
845
+ lt,
846
+ {
847
+ theme: n,
848
+ onChange: async () => {
849
+ },
850
+ checked: !1,
851
+ labelText: o ? a("WIDGET.I_AM_HUMAN") : "",
852
+ error: r,
853
+ "aria-label": "human checkbox",
854
+ loading: s
855
+ }
856
+ );
857
+ }, ie = (e) => ({
858
+ loading: !1,
859
+ attemptCount: e || 0
860
+ }), vt = ({
861
+ config: e,
862
+ callbacks: t,
863
+ restart: r,
864
+ i18n: o,
865
+ detectBot: a = yt,
866
+ container: s
867
+ }) => {
868
+ const n = m.useRef(ie(0)), d = _(t);
869
+ m.useEffect(() => {
870
+ e.language && (o ? o.language !== e.language && o.changeLanguage(e.language).then((u) => u) : Oe().then((u) => {
871
+ u.language !== e.language && u.changeLanguage(e.language).then((l) => l);
872
+ }));
873
+ }, [o, e.language]);
874
+ const [y, h] = m.useState(
875
+ se(
876
+ e.theme,
877
+ e.mode,
878
+ n.current.errorMessage,
879
+ o.isInitialized,
880
+ o.t,
881
+ !0
882
+ )
883
+ ), b = (u) => {
884
+ n.current = ie(
885
+ u || n.current.attemptCount
886
+ );
887
+ }, f = (u, l) => {
888
+ l === "CAPTCHA.NO_SESSION_FOUND" && setTimeout(() => {
889
+ g();
890
+ }, 0), h(
891
+ se(
892
+ e.theme,
893
+ e.mode,
894
+ u || "Cannot load CAPTCHA",
895
+ o.isInitialized,
896
+ o.t,
897
+ !1
898
+ )
899
+ );
900
+ }, g = () => {
901
+ setTimeout(() => {
902
+ b(0), d.onReset(), r();
903
+ }, 1e4);
904
+ }, T = async () => {
905
+ await Le(
906
+ async () => {
907
+ var O, k, x, A, E;
908
+ n.current.attemptCount += 1;
909
+ const u = Re.parse(e), l = await a(u, s, r);
910
+ if ((O = l.error) != null && O.message) {
911
+ n.current = {
912
+ ...n.current,
913
+ loading: !1,
914
+ errorMessage: (k = l.error) == null ? void 0 : k.message
915
+ }, d.onError(new Error((x = l.error) == null ? void 0 : x.message)), f((A = l.error) == null ? void 0 : A.message, (E = l.error) == null ? void 0 : E.key);
916
+ return;
917
+ }
918
+ const P = {
919
+ provider: l.provider,
920
+ sessionId: l.sessionId,
921
+ userAccount: l.userAccount,
922
+ restart: r
923
+ // Pass restart function
924
+ };
925
+ l.captchaType === "image" ? h(
926
+ /* @__PURE__ */ S(
927
+ ve,
928
+ {
929
+ config: e,
930
+ callbacks: t,
931
+ frictionlessState: P,
932
+ i18n: o
933
+ }
934
+ )
935
+ ) : (h(
936
+ /* @__PURE__ */ S(
937
+ ye,
938
+ {
939
+ config: e,
940
+ callbacks: t,
941
+ frictionlessState: P,
942
+ i18n: o
943
+ }
944
+ )
945
+ ), n.current = {
946
+ ...n.current,
947
+ loading: !1
948
+ });
949
+ },
950
+ T,
951
+ b,
952
+ n.current.attemptCount,
953
+ 5
954
+ ).finally(() => {
955
+ n.current.attemptCount >= 5 && (f(), g());
956
+ });
957
+ };
958
+ return m.useEffect(() => {
959
+ (async () => {
960
+ await T();
961
+ })();
962
+ }, [e, t, a, e.language]), y;
963
+ }, bt = (e) => {
964
+ const { config: t, callbacks: r, i18n: o, container: a } = e, [s, n] = m.useState(0), d = () => {
965
+ n((y) => y + 1);
966
+ };
967
+ return C.jsx(vt, { config: t, callbacks: _(r), restart: d, i18n: o, container: a }, s);
968
+ }, St = (e) => {
969
+ const { config: t, callbacks: r, i18n: o } = e;
970
+ return C.jsx(ve, { config: t, callbacks: _(r), i18n: o });
971
+ }, Pt = (e) => {
972
+ const { config: t, callbacks: r, i18n: o } = e;
973
+ return C.jsx(ye, { config: t, callbacks: _(r), i18n: o });
974
+ }, wt = {
975
+ [N.image]: St,
976
+ [N.pow]: Pt,
977
+ [N.frictionless]: bt
978
+ };
979
+ class xt {
980
+ getCaptchaComponent(t, r) {
981
+ if (t === N.invisible)
982
+ throw new Error("Not Implemented");
983
+ const o = wt[t];
984
+ return "rendering ".concat(t), C.jsx(o, { config: r.config, callbacks: r.callbacks, i18n: r.i18n, container: r.container });
985
+ }
986
+ }
987
+ const _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
988
+ __proto__: null,
989
+ CaptchaComponentProvider: xt
990
+ }, Symbol.toStringTag, { value: "Module" }));
991
+ export {
992
+ lt as C,
993
+ Ue as E,
994
+ pt as P,
995
+ Xe as a,
996
+ jt as b,
997
+ Ye as c,
998
+ _t as d,
999
+ _ as g,
1000
+ S as j,
1001
+ Le as p
1002
+ };