@prosopo/client-bundle-example 2.8.2 → 2.9.4

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 (131) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +3 -2
  3. package/dist/assets/{captcha-BhkVCEXM.css → captcha-DAWM1slf.css} +1 -1
  4. package/dist/assets/{frictionless-explicit-CNjy6JJ4.js → frictionless-explicit-CtnTw8dK.js} +1 -1
  5. package/dist/assets/{frictionless-implicit-Dq_sNGRK.js → frictionless-implicit-BH7anfOq.js} +1 -1
  6. package/dist/assets/{image-explicit-DQvfVB7-.js → image-explicit-Dm_JoW0N.js} +1 -1
  7. package/dist/assets/image-implicit-M0Y7U93R.js +1 -0
  8. package/dist/assets/{index-Dpt_5E72.js → index-Ck5HfpfQ.js} +1 -1
  9. package/dist/assets/{invisible-frictionless-explicit-DugBtRe4.js → invisible-frictionless-explicit-CSPYfcNr.js} +1 -1
  10. package/dist/assets/{invisible-frictionless-implicit-DYYos8W9.js → invisible-frictionless-implicit-D0saDt4U.js} +1 -1
  11. package/dist/assets/{invisible-image-explicit-C5Z4gSb1.js → invisible-image-explicit-erOMAo-F.js} +1 -1
  12. package/dist/assets/{invisible-image-implicit-DfNFNlFj.js → invisible-image-implicit-c0sMfk2s.js} +1 -1
  13. package/dist/assets/{invisible-pow-explicit-DjqGWFUb.js → invisible-pow-explicit-BgMt7lhN.js} +1 -1
  14. package/dist/assets/{invisible-pow-implicit-BRXL14FH.js → invisible-pow-implicit-CnxS8gw2.js} +1 -1
  15. package/dist/assets/{pow-explicit-BexxbnHM.js → pow-explicit-BgDWNJK9.js} +1 -1
  16. package/dist/assets/{pow-implicit-Dpt_5E72.js → pow-implicit-Ck5HfpfQ.js} +1 -1
  17. package/dist/cjs/index.cjs +1 -0
  18. package/dist/frictionless-explicit.html +8 -8
  19. package/dist/frictionless-implicit.html +7 -7
  20. package/dist/image-explicit.html +4 -4
  21. package/dist/index.html +4 -4
  22. package/dist/invisible-frictionless-explicit.html +4 -4
  23. package/dist/invisible-frictionless-implicit.html +4 -4
  24. package/dist/invisible-image-explicit.html +4 -4
  25. package/dist/invisible-image-implicit.html +4 -4
  26. package/dist/invisible-pow-explicit.html +4 -4
  27. package/dist/invisible-pow-implicit.html +4 -4
  28. package/dist/plugins/navigation-injector.ts +1 -1
  29. package/dist/pow-explicit.html +4 -4
  30. package/dist/pow-implicit.html +4 -4
  31. package/env.staging +6 -0
  32. package/package.json +29 -16
  33. package/vite.cjs.config.ts +22 -0
  34. package/vite.config.ts +21 -2
  35. package/vite.esm.config.ts +20 -0
  36. package/dist/assets/ProcaptchaWidget-DrBDhP6X.js +0 -636
  37. package/dist/assets/ProcaptchaWidget-rAM-9Rap.js +0 -360
  38. package/dist/assets/Signer-DP9drQ55.js +0 -23
  39. package/dist/assets/_commonjsHelpers-DaMA6jEr.js +0 -8
  40. package/dist/assets/asU8a-CJdNkNEq.js +0 -9
  41. package/dist/assets/bip39-Du2cANEV.js +0 -365
  42. package/dist/assets/browser-ponyfill-Dy1JBTMg.js +0 -339
  43. package/dist/assets/captchaComponentProvider-DmV1WTrT.js +0 -1242
  44. package/dist/assets/captchaRenderer-RIsSZXCC.js +0 -70
  45. package/dist/assets/components.d.ts +0 -5
  46. package/dist/assets/components.d.ts.map +0 -1
  47. package/dist/assets/emotion-element-5486c51c.browser.esm-C3u8NMUC.js +0 -1807
  48. package/dist/assets/fp.esm-DYWeNGcH.js +0 -1654
  49. package/dist/assets/hash-_rWungeW.js +0 -1268
  50. package/dist/assets/i18nFrontend-CsPT71ro.js +0 -2273
  51. package/dist/assets/image-implicit-Bwa9QJO5.js +0 -1
  52. package/dist/assets/index-BVr9fC_3.js +0 -4386
  53. package/dist/assets/index-BjRdPnnE.js +0 -1198
  54. package/dist/assets/index-Cu5oL_7b.js +0 -81
  55. package/dist/assets/index-DxIFpl6U.js +0 -5416
  56. package/dist/assets/index-QVME9Prx.js +0 -32
  57. package/dist/assets/index-Wgw2GQWq.js +0 -596
  58. package/dist/assets/index.d.ts +0 -16
  59. package/dist/assets/index.d.ts.map +0 -1
  60. package/dist/assets/locales/ar/translation.json +0 -56
  61. package/dist/assets/locales/az/translation.json +0 -56
  62. package/dist/assets/locales/cs/translation.json +0 -56
  63. package/dist/assets/locales/de/translation.json +0 -56
  64. package/dist/assets/locales/el/translation.json +0 -56
  65. package/dist/assets/locales/en/translation.json +0 -56
  66. package/dist/assets/locales/es/translation.json +0 -56
  67. package/dist/assets/locales/fi/translation.json +0 -56
  68. package/dist/assets/locales/fr/translation.json +0 -56
  69. package/dist/assets/locales/hi/translation.json +0 -56
  70. package/dist/assets/locales/hu/translation.json +0 -56
  71. package/dist/assets/locales/id/translation.json +0 -56
  72. package/dist/assets/locales/it/translation.json +0 -56
  73. package/dist/assets/locales/ja/translation.json +0 -56
  74. package/dist/assets/locales/jv/translation.json +0 -56
  75. package/dist/assets/locales/ko/translation.json +0 -56
  76. package/dist/assets/locales/ml/translation.json +0 -56
  77. package/dist/assets/locales/ms/translation.json +0 -56
  78. package/dist/assets/locales/nl/translation.json +0 -56
  79. package/dist/assets/locales/no/translation.json +0 -56
  80. package/dist/assets/locales/pl/translation.json +0 -56
  81. package/dist/assets/locales/pt/translation.json +0 -56
  82. package/dist/assets/locales/pt-br/translation.json +0 -56
  83. package/dist/assets/locales/ro/translation.json +0 -56
  84. package/dist/assets/locales/ru/translation.json +0 -56
  85. package/dist/assets/locales/sr/translation.json +0 -56
  86. package/dist/assets/locales/sv/translation.json +0 -56
  87. package/dist/assets/locales/th/translation.json +0 -56
  88. package/dist/assets/locales/tr/translation.json +0 -56
  89. package/dist/assets/locales/uk/translation.json +0 -56
  90. package/dist/assets/locales/vi/translation.json +0 -56
  91. package/dist/assets/locales/zh-cn/translation.json +0 -56
  92. package/dist/assets/procaptcha.bundle.js +0 -7
  93. package/dist/assets/spread-DEmVz7RJ.js +0 -15
  94. package/dist/assets/tests/util/captchaType.test.d.ts +0 -2
  95. package/dist/assets/tests/util/captchaType.test.d.ts.map +0 -1
  96. package/dist/assets/tests/util/config.test.d.ts +0 -2
  97. package/dist/assets/tests/util/config.test.d.ts.map +0 -1
  98. package/dist/assets/tests/util/renderLogic.test.d.ts +0 -2
  99. package/dist/assets/tests/util/renderLogic.test.d.ts.map +0 -1
  100. package/dist/assets/toU8a-C68WUzs_.js +0 -24
  101. package/dist/assets/translations-DEL070wJ.js +0 -2918
  102. package/dist/assets/useTranslation-CJplXtqb.js +0 -158
  103. package/dist/assets/util/captcha/captchaComponentProvider.d.ts +0 -8
  104. package/dist/assets/util/captcha/captchaComponentProvider.d.ts.map +0 -1
  105. package/dist/assets/util/captcha/captchaComponentsList.d.ts +0 -6
  106. package/dist/assets/util/captcha/captchaComponentsList.d.ts.map +0 -1
  107. package/dist/assets/util/captcha/captchaProps.d.ts +0 -9
  108. package/dist/assets/util/captcha/captchaProps.d.ts.map +0 -1
  109. package/dist/assets/util/captcha/captchaRenderer.d.ts +0 -24
  110. package/dist/assets/util/captcha/captchaRenderer.d.ts.map +0 -1
  111. package/dist/assets/util/captcha/captchaType.d.ts +0 -2
  112. package/dist/assets/util/captcha/captchaType.d.ts.map +0 -1
  113. package/dist/assets/util/captcha/components/frictionlessCaptcha.d.ts +0 -4
  114. package/dist/assets/util/captcha/components/frictionlessCaptcha.d.ts.map +0 -1
  115. package/dist/assets/util/captcha/components/imageCaptcha.d.ts +0 -4
  116. package/dist/assets/util/captcha/components/imageCaptcha.d.ts.map +0 -1
  117. package/dist/assets/util/captcha/components/powCaptcha.d.ts +0 -4
  118. package/dist/assets/util/captcha/components/powCaptcha.d.ts.map +0 -1
  119. package/dist/assets/util/config.d.ts +0 -6
  120. package/dist/assets/util/config.d.ts.map +0 -1
  121. package/dist/assets/util/configCreator.d.ts +0 -5
  122. package/dist/assets/util/configCreator.d.ts.map +0 -1
  123. package/dist/assets/util/language.d.ts +0 -3
  124. package/dist/assets/util/language.d.ts.map +0 -1
  125. package/dist/assets/util/timeout.d.ts +0 -3
  126. package/dist/assets/util/timeout.d.ts.map +0 -1
  127. package/dist/assets/util/widgetFactory.d.ts +0 -18
  128. package/dist/assets/util/widgetFactory.d.ts.map +0 -1
  129. package/dist/assets/util/widgetThemeResolver.d.ts +0 -9
  130. package/dist/assets/util/widgetThemeResolver.d.ts.map +0 -1
  131. /package/dist/assets/{captcha-ByKnSsbG.js → captcha-BaCo3bEP.js} +0 -0
@@ -1,1242 +0,0 @@
1
- import { h as ve, j as x, a as be, b as Se, s as we, w as Ae, r as v, T as Oe, u as Wt, i as Ie, d as Re, e as Fe, g as Ne, m as je, f as C, S as $e, k as Me, A as G, U as le, P as De } from "./emotion-element-5486c51c.browser.esm-C3u8NMUC.js";
2
- import { a as ze, g as Ke, W as He, A as i, l as Ue, b as We, d as qe, C as V } from "./index-Wgw2GQWq.js";
3
- import { e as Be } from "./translations-DEL070wJ.js";
4
- import { g as Vt } from "./_commonjsHelpers-DaMA6jEr.js";
5
- const Ge = { t: (t) => t };
6
- class re extends Error {
7
- constructor(e, r) {
8
- const o = (r == null ? void 0 : r.logger) || et(), s = (r == null ? void 0 : r.logLevel) || "error", n = (r == null ? void 0 : r.i18n) || Ge;
9
- e instanceof Error ? (super(n.t(e.message)), this.translationKey = r == null ? void 0 : r.translationKey, this.context = {
10
- ...r == null ? void 0 : r.context,
11
- ...r != null && r.translationKey ? { translationMessage: n.t(r.translationKey) } : {}
12
- }) : (super(n.t(e)), this.translationKey = e, this.context = r == null ? void 0 : r.context), r != null && r.silent || this.logError(o, s, r == null ? void 0 : r.name);
13
- }
14
- logError(e, r, o) {
15
- const s = { error: this.message, context: this.context }, n = { errorType: o || this.name, errorParams: s };
16
- r === "debug" && e.debug(this.stack), e[r](n);
17
- }
18
- }
19
- class Xt extends re {
20
- constructor(e, r) {
21
- const o = (r == null ? void 0 : r.name) || "ProsopoError", s = { ...r, name: o };
22
- super(e, s);
23
- }
24
- }
25
- class oe extends re {
26
- constructor(e, r) {
27
- const o = (r == null ? void 0 : r.name) || "ProsopoEnvError", s = { ...r, name: o };
28
- super(e, s);
29
- }
30
- }
31
- class Yt extends re {
32
- constructor(e, r) {
33
- const o = (r == null ? void 0 : r.name) || "ProsopoDatasetError", s = { ...r, name: o };
34
- super(e, s);
35
- }
36
- }
37
- const d = {
38
- fatal: 0,
39
- error: 0,
40
- warn: 1,
41
- log: 2,
42
- info: 3,
43
- success: 3,
44
- fail: 3,
45
- debug: 4,
46
- trace: 5,
47
- verbose: Number.POSITIVE_INFINITY
48
- }, ue = {
49
- // Silent
50
- silent: {
51
- level: -1
52
- },
53
- // Level 0
54
- fatal: {
55
- level: d.fatal
56
- },
57
- error: {
58
- level: d.error
59
- },
60
- // Level 1
61
- warn: {
62
- level: d.warn
63
- },
64
- // Level 2
65
- log: {
66
- level: d.log
67
- },
68
- // Level 3
69
- info: {
70
- level: d.info
71
- },
72
- success: {
73
- level: d.success
74
- },
75
- fail: {
76
- level: d.fail
77
- },
78
- ready: {
79
- level: d.info
80
- },
81
- start: {
82
- level: d.info
83
- },
84
- box: {
85
- level: d.info
86
- },
87
- // Level 4
88
- debug: {
89
- level: d.debug
90
- },
91
- // Level 5
92
- trace: {
93
- level: d.trace
94
- },
95
- // Verbose
96
- verbose: {
97
- level: d.verbose
98
- }
99
- };
100
- function X(t) {
101
- return t !== null && typeof t == "object";
102
- }
103
- function Q(t, e, r = ".", o) {
104
- if (!X(e))
105
- return Q(t, {}, r);
106
- const s = Object.assign({}, e);
107
- for (const n in t) {
108
- if (n === "__proto__" || n === "constructor")
109
- continue;
110
- const a = t[n];
111
- a != null && (Array.isArray(a) && Array.isArray(s[n]) ? s[n] = [...a, ...s[n]] : X(a) && X(s[n]) ? s[n] = Q(
112
- a,
113
- s[n],
114
- (r ? `${r}.` : "") + n.toString()
115
- ) : s[n] = a);
116
- }
117
- return s;
118
- }
119
- function Ve(t) {
120
- return (...e) => (
121
- // eslint-disable-next-line unicorn/no-array-reduce
122
- e.reduce((r, o) => Q(r, o, ""), {})
123
- );
124
- }
125
- const Xe = Ve();
126
- function Ye(t) {
127
- return Object.prototype.toString.call(t) === "[object Object]";
128
- }
129
- function Je(t) {
130
- return !(!Ye(t) || !t.message && !t.args || t.stack);
131
- }
132
- let Y = !1;
133
- const pe = [];
134
- class g {
135
- constructor(e = {}) {
136
- const r = e.types || ue;
137
- this.options = Xe(
138
- {
139
- ...e,
140
- defaults: { ...e.defaults },
141
- level: J(e.level, r),
142
- reporters: [...e.reporters || []]
143
- },
144
- {
145
- types: ue,
146
- throttle: 1e3,
147
- throttleMin: 5,
148
- formatOptions: {
149
- date: !0,
150
- colors: !1,
151
- compact: !0
152
- }
153
- }
154
- );
155
- for (const o in r) {
156
- const s = {
157
- type: o,
158
- ...this.options.defaults,
159
- ...r[o]
160
- };
161
- this[o] = this._wrapLogFn(s), this[o].raw = this._wrapLogFn(
162
- s,
163
- !0
164
- );
165
- }
166
- this.options.mockFn && this.mockTypes(), this._lastLog = {};
167
- }
168
- get level() {
169
- return this.options.level;
170
- }
171
- set level(e) {
172
- this.options.level = J(
173
- e,
174
- this.options.types,
175
- this.options.level
176
- );
177
- }
178
- prompt(e, r) {
179
- if (!this.options.prompt)
180
- throw new Error("prompt is not supported!");
181
- return this.options.prompt(e, r);
182
- }
183
- create(e) {
184
- const r = new g({
185
- ...this.options,
186
- ...e
187
- });
188
- return this._mockFn && r.mockTypes(this._mockFn), r;
189
- }
190
- withDefaults(e) {
191
- return this.create({
192
- ...this.options,
193
- defaults: {
194
- ...this.options.defaults,
195
- ...e
196
- }
197
- });
198
- }
199
- withTag(e) {
200
- return this.withDefaults({
201
- tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + e : e
202
- });
203
- }
204
- addReporter(e) {
205
- return this.options.reporters.push(e), this;
206
- }
207
- removeReporter(e) {
208
- if (e) {
209
- const r = this.options.reporters.indexOf(e);
210
- if (r >= 0)
211
- return this.options.reporters.splice(r, 1);
212
- } else
213
- this.options.reporters.splice(0);
214
- return this;
215
- }
216
- setReporters(e) {
217
- return this.options.reporters = Array.isArray(e) ? e : [e], this;
218
- }
219
- wrapAll() {
220
- this.wrapConsole(), this.wrapStd();
221
- }
222
- restoreAll() {
223
- this.restoreConsole(), this.restoreStd();
224
- }
225
- wrapConsole() {
226
- for (const e in this.options.types)
227
- console["__" + e] || (console["__" + e] = console[e]), console[e] = this[e].raw;
228
- }
229
- restoreConsole() {
230
- for (const e in this.options.types)
231
- console["__" + e] && (console[e] = console["__" + e], delete console["__" + e]);
232
- }
233
- wrapStd() {
234
- this._wrapStream(this.options.stdout, "log"), this._wrapStream(this.options.stderr, "log");
235
- }
236
- _wrapStream(e, r) {
237
- e && (e.__write || (e.__write = e.write), e.write = (o) => {
238
- this[r].raw(String(o).trim());
239
- });
240
- }
241
- restoreStd() {
242
- this._restoreStream(this.options.stdout), this._restoreStream(this.options.stderr);
243
- }
244
- _restoreStream(e) {
245
- e && e.__write && (e.write = e.__write, delete e.__write);
246
- }
247
- pauseLogs() {
248
- Y = !0;
249
- }
250
- resumeLogs() {
251
- Y = !1;
252
- const e = pe.splice(0);
253
- for (const r of e)
254
- r[0]._logFn(r[1], r[2]);
255
- }
256
- mockTypes(e) {
257
- const r = e || this.options.mockFn;
258
- if (this._mockFn = r, typeof r == "function")
259
- for (const o in this.options.types)
260
- this[o] = r(o, this.options.types[o]) || this[o], this[o].raw = this[o];
261
- }
262
- _wrapLogFn(e, r) {
263
- return (...o) => {
264
- if (Y) {
265
- pe.push([this, e, o, r]);
266
- return;
267
- }
268
- return this._logFn(e, o, r);
269
- };
270
- }
271
- _logFn(e, r, o) {
272
- if ((e.level || 0) > this.level)
273
- return !1;
274
- const s = {
275
- date: /* @__PURE__ */ new Date(),
276
- args: [],
277
- ...e,
278
- level: J(e.level, this.options.types)
279
- };
280
- !o && r.length === 1 && Je(r[0]) ? Object.assign(s, r[0]) : s.args = [...r], s.message && (s.args.unshift(s.message), delete s.message), s.additional && (Array.isArray(s.additional) || (s.additional = s.additional.split(`
281
- `)), s.args.push(`
282
- ` + s.additional.join(`
283
- `)), delete s.additional), s.type = typeof s.type == "string" ? s.type.toLowerCase() : "log", s.tag = typeof s.tag == "string" ? s.tag : "";
284
- const n = (c = !1) => {
285
- const p = (this._lastLog.count || 0) - this.options.throttleMin;
286
- if (this._lastLog.object && p > 0) {
287
- const b = [...this._lastLog.object.args];
288
- p > 1 && b.push(`(repeated ${p} times)`), this._log({ ...this._lastLog.object, args: b }), this._lastLog.count = 1;
289
- }
290
- c && (this._lastLog.object = s, this._log(s));
291
- };
292
- clearTimeout(this._lastLog.timeout);
293
- const a = this._lastLog.time && s.date ? s.date.getTime() - this._lastLog.time.getTime() : 0;
294
- if (this._lastLog.time = s.date, a < this.options.throttle)
295
- try {
296
- const c = JSON.stringify([
297
- s.type,
298
- s.tag,
299
- s.args
300
- ]), p = this._lastLog.serialized === c;
301
- if (this._lastLog.serialized = c, p && (this._lastLog.count = (this._lastLog.count || 0) + 1, this._lastLog.count > this.options.throttleMin)) {
302
- this._lastLog.timeout = setTimeout(
303
- n,
304
- this.options.throttle
305
- );
306
- return;
307
- }
308
- } catch {
309
- }
310
- n(!0);
311
- }
312
- _log(e) {
313
- for (const r of this.options.reporters)
314
- r.log(e, {
315
- options: this.options
316
- });
317
- }
318
- }
319
- function J(t, e = {}, r = 3) {
320
- return t === void 0 ? r : typeof t == "number" ? t : e[t] && e[t].level !== void 0 ? e[t].level : r;
321
- }
322
- g.prototype.add = g.prototype.addReporter;
323
- g.prototype.remove = g.prototype.removeReporter;
324
- g.prototype.clear = g.prototype.removeReporter;
325
- g.prototype.withScope = g.prototype.withTag;
326
- g.prototype.mock = g.prototype.mockTypes;
327
- g.prototype.pause = g.prototype.pauseLogs;
328
- g.prototype.resume = g.prototype.resumeLogs;
329
- function Ze(t = {}) {
330
- return new g(t);
331
- }
332
- class Qe {
333
- constructor(e) {
334
- this.options = { ...e }, this.defaultColor = "#7f8c8d", this.levelColorMap = {
335
- 0: "#c0392b",
336
- // Red
337
- 1: "#f39c12",
338
- // Yellow
339
- 3: "#00BCD4"
340
- // Cyan
341
- }, this.typeColorMap = {
342
- success: "#2ecc71"
343
- // Green
344
- };
345
- }
346
- _getLogFn(e) {
347
- return e < 1 ? console.__error || console.error : e === 1 ? console.__warn || console.warn : console.__log || console.log;
348
- }
349
- log(e) {
350
- const r = this._getLogFn(e.level), o = e.type === "log" ? "" : e.type, s = e.tag || "", a = `
351
- background: ${this.typeColorMap[e.type] || this.levelColorMap[e.level] || this.defaultColor};
352
- border-radius: 0.5em;
353
- color: white;
354
- font-weight: bold;
355
- padding: 2px 0.5em;
356
- `, c = `%c${[s, o].filter(Boolean).join(":")}`;
357
- typeof e.args[0] == "string" ? r(
358
- `${c}%c ${e.args[0]}`,
359
- a,
360
- // Empty string as style resets to default console style
361
- "",
362
- ...e.args.slice(1)
363
- ) : r(c, a, ...e.args);
364
- }
365
- }
366
- function xe(t = {}) {
367
- return Ze({
368
- reporters: t.reporters || [new Qe({})],
369
- prompt(r, o = {}) {
370
- return o.type === "confirm" ? Promise.resolve(confirm(r)) : Promise.resolve(prompt(r));
371
- },
372
- ...t
373
- });
374
- }
375
- xe();
376
- const _ = Be([
377
- "trace",
378
- "debug",
379
- "info",
380
- "warn",
381
- "error",
382
- "fatal",
383
- "log"
384
- ]);
385
- function et() {
386
- return st;
387
- }
388
- const tt = (t, e) => {
389
- const r = process != null && process.stdout ? process.stdout.write.bind(process.stdout) : console.info, o = process != null && process.stderr ? process.stderr.write.bind(process.stderr) : console.error;
390
- if (t.type === _.enum.error)
391
- if (t.args.length > 0 && t.args[0] instanceof Error) {
392
- const s = t.args[0], n = {
393
- ...t,
394
- args: [s.message]
395
- };
396
- o(`${JSON.stringify(n)}
397
- `);
398
- } else
399
- o(`${JSON.stringify(t)}
400
- `);
401
- else
402
- r(`${JSON.stringify(t)}
403
- `);
404
- }, rt = (t, e, r) => {
405
- const o = xe({
406
- reporters: [
407
- {
408
- log: (a, c) => {
409
- const p = tt, b = { ...a, requestId: r };
410
- p(b);
411
- }
412
- }
413
- ],
414
- formatOptions: { colors: !0, date: !0 }
415
- }).withTag(e);
416
- let s = t;
417
- const n = {
418
- log: o.log,
419
- info: o.info,
420
- debug: o.debug,
421
- trace: o.trace,
422
- warn: o.warn,
423
- error: o.error,
424
- fatal: o.fatal,
425
- setLogLevel: (a) => {
426
- let c = Number.NaN;
427
- const p = ot(a);
428
- switch (p) {
429
- case _.enum.trace:
430
- c = d.trace;
431
- break;
432
- case _.enum.debug:
433
- c = d.debug;
434
- break;
435
- case _.enum.info:
436
- c = d.info;
437
- break;
438
- case _.enum.warn:
439
- c = d.warn;
440
- break;
441
- case _.enum.error:
442
- c = d.error;
443
- break;
444
- case _.enum.fatal:
445
- c = d.fatal;
446
- break;
447
- case _.enum.log:
448
- c = d.log;
449
- break;
450
- default:
451
- throw new Error(`Invalid log level translation to consola's log level: ${a}`);
452
- }
453
- o.level = c, s = p;
454
- },
455
- getLogLevel: () => s
456
- };
457
- return n.setLogLevel(t), n;
458
- };
459
- function ot(t) {
460
- const r = (t || process.env.PROSOPO_LOG_LEVEL || "Info").toString().toLowerCase();
461
- try {
462
- return _.parse(r);
463
- } catch {
464
- throw new oe("CONFIG.INVALID_LOG_LEVEL", {
465
- context: { logLevel: t }
466
- });
467
- }
468
- }
469
- const st = rt(_.enum.info, "global"), de = (t) => Object.values(t), nt = async (t) => {
470
- if (t === "production") {
471
- const e = await fetch("https://provider-list.prosopo.io/", {
472
- method: "GET",
473
- mode: "cors"
474
- }).then((r) => r.json());
475
- return de(e);
476
- }
477
- if (t === "staging") {
478
- const e = await fetch("https://provider-list.prosopo.io/staging.json", { method: "GET", mode: "cors" }).then((r) => r.json());
479
- return de(e);
480
- }
481
- if (t === "development")
482
- return [
483
- {
484
- address: "5EjTA28bKSbFPPyMbUjNtArxyqjwq38r1BapVmLZShaqEedV",
485
- url: "http://localhost:9229",
486
- datasetId: "0x9f460e81ac9c71b486f796a21bb36e2263694756a6621134d110da217fd3ef25"
487
- }
488
- ];
489
- throw new oe("CONFIG.UNKNOWN_ENVIRONMENT", {
490
- context: { environment: t }
491
- });
492
- };
493
- let N = [];
494
- const at = async (t) => {
495
- const e = (o, s) => Math.floor(Math.random() * (s - o + 1) + o);
496
- N.length === 0 && (N = await nt(t.defaultEnvironment));
497
- const r = ze(N, e(0, N.length - 1));
498
- return {
499
- providerAccount: r.address,
500
- provider: {
501
- url: r.url,
502
- datasetId: r.datasetId
503
- }
504
- };
505
- }, it = async (t, e, r, o, s) => {
506
- try {
507
- await t();
508
- } catch (n) {
509
- if (o >= s)
510
- return console.error(n), console.error(`Max retries (${o} of ${s}) reached, aborting`), r();
511
- console.error(n), r(), await e();
512
- }
513
- }, j = (t) => ({
514
- ...Ke(void 0),
515
- ...t
516
- }), ct = async (t) => t ? (await import("./index-Cu5oL_7b.js")).ExtensionWeb2 : (await import("./index-Cu5oL_7b.js")).ExtensionWeb3;
517
- function ee() {
518
- return ee = Object.assign ? Object.assign.bind() : function(t) {
519
- for (var e = 1; e < arguments.length; e++) {
520
- var r = arguments[e];
521
- for (var o in r) ({}).hasOwnProperty.call(r, o) && (t[o] = r[o]);
522
- }
523
- return t;
524
- }, ee.apply(null, arguments);
525
- }
526
- var Pe = { exports: {} }, l = {};
527
- var f = typeof Symbol == "function" && Symbol.for, se = f ? Symbol.for("react.element") : 60103, ne = f ? Symbol.for("react.portal") : 60106, $ = f ? Symbol.for("react.fragment") : 60107, M = f ? Symbol.for("react.strict_mode") : 60108, D = f ? Symbol.for("react.profiler") : 60114, z = f ? Symbol.for("react.provider") : 60109, K = f ? Symbol.for("react.context") : 60110, ae = f ? Symbol.for("react.async_mode") : 60111, H = f ? Symbol.for("react.concurrent_mode") : 60111, U = f ? Symbol.for("react.forward_ref") : 60112, W = f ? Symbol.for("react.suspense") : 60113, lt = f ? Symbol.for("react.suspense_list") : 60120, q = f ? Symbol.for("react.memo") : 60115, B = f ? Symbol.for("react.lazy") : 60116, ut = f ? Symbol.for("react.block") : 60121, pt = f ? Symbol.for("react.fundamental") : 60117, dt = f ? Symbol.for("react.responder") : 60118, ft = f ? Symbol.for("react.scope") : 60119;
528
- function S(t) {
529
- if (typeof t == "object" && t !== null) {
530
- var e = t.$$typeof;
531
- switch (e) {
532
- case se:
533
- switch (t = t.type, t) {
534
- case ae:
535
- case H:
536
- case $:
537
- case D:
538
- case M:
539
- case W:
540
- return t;
541
- default:
542
- switch (t = t && t.$$typeof, t) {
543
- case K:
544
- case U:
545
- case B:
546
- case q:
547
- case z:
548
- return t;
549
- default:
550
- return e;
551
- }
552
- }
553
- case ne:
554
- return e;
555
- }
556
- }
557
- }
558
- function _e(t) {
559
- return S(t) === H;
560
- }
561
- l.AsyncMode = ae;
562
- l.ConcurrentMode = H;
563
- l.ContextConsumer = K;
564
- l.ContextProvider = z;
565
- l.Element = se;
566
- l.ForwardRef = U;
567
- l.Fragment = $;
568
- l.Lazy = B;
569
- l.Memo = q;
570
- l.Portal = ne;
571
- l.Profiler = D;
572
- l.StrictMode = M;
573
- l.Suspense = W;
574
- l.isAsyncMode = function(t) {
575
- return _e(t) || S(t) === ae;
576
- };
577
- l.isConcurrentMode = _e;
578
- l.isContextConsumer = function(t) {
579
- return S(t) === K;
580
- };
581
- l.isContextProvider = function(t) {
582
- return S(t) === z;
583
- };
584
- l.isElement = function(t) {
585
- return typeof t == "object" && t !== null && t.$$typeof === se;
586
- };
587
- l.isForwardRef = function(t) {
588
- return S(t) === U;
589
- };
590
- l.isFragment = function(t) {
591
- return S(t) === $;
592
- };
593
- l.isLazy = function(t) {
594
- return S(t) === B;
595
- };
596
- l.isMemo = function(t) {
597
- return S(t) === q;
598
- };
599
- l.isPortal = function(t) {
600
- return S(t) === ne;
601
- };
602
- l.isProfiler = function(t) {
603
- return S(t) === D;
604
- };
605
- l.isStrictMode = function(t) {
606
- return S(t) === M;
607
- };
608
- l.isSuspense = function(t) {
609
- return S(t) === W;
610
- };
611
- l.isValidElementType = function(t) {
612
- return typeof t == "string" || typeof t == "function" || t === $ || t === H || t === D || t === M || t === W || t === lt || typeof t == "object" && t !== null && (t.$$typeof === B || t.$$typeof === q || t.$$typeof === z || t.$$typeof === K || t.$$typeof === U || t.$$typeof === pt || t.$$typeof === dt || t.$$typeof === ft || t.$$typeof === ut);
613
- };
614
- l.typeOf = S;
615
- Pe.exports = l;
616
- var ht = Pe.exports, Ce = ht;
617
- var gt = {
618
- $$typeof: !0,
619
- render: !0,
620
- defaultProps: !0,
621
- displayName: !0,
622
- propTypes: !0
623
- }, mt = {
624
- $$typeof: !0,
625
- compare: !0,
626
- defaultProps: !0,
627
- displayName: !0,
628
- propTypes: !0,
629
- type: !0
630
- }, Te = {};
631
- Te[Ce.ForwardRef] = gt;
632
- Te[Ce.Memo] = mt;
633
- var Jt = Object.prototype;
634
- function T(t, e, r) {
635
- return ve.call(e, "css") ? x.jsx(be, Se(t, e), r) : x.jsx(t, e, r);
636
- }
637
- function yt(t, e, r) {
638
- return ve.call(e, "css") ? x.jsxs(be, Se(t, e), r) : x.jsxs(t, e, r);
639
- }
640
- function vt() {
641
- for (var t = arguments.length, e = new Array(t), r = 0; r < t; r++)
642
- e[r] = arguments[r];
643
- return we(e);
644
- }
645
- var bt = /^((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|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)-.*))$/, St = /* @__PURE__ */ je(
646
- function(t) {
647
- return bt.test(t) || t.charCodeAt(0) === 111 && t.charCodeAt(1) === 110 && t.charCodeAt(2) < 91;
648
- }
649
- /* Z+1 */
650
- ), wt = St, xt = function(e) {
651
- return e !== "theme";
652
- }, fe = function(e) {
653
- return typeof e == "string" && // 96 is one less than the char code
654
- // for "a" so this is checking that
655
- // it's a lowercase character
656
- e.charCodeAt(0) > 96 ? wt : xt;
657
- }, he = function(e, r, o) {
658
- var s;
659
- if (r) {
660
- var n = r.shouldForwardProp;
661
- s = e.__emotion_forwardProp && n ? function(a) {
662
- return e.__emotion_forwardProp(a) && n(a);
663
- } : n;
664
- }
665
- return typeof s != "function" && o && (s = e.__emotion_forwardProp), s;
666
- }, Pt = function(e) {
667
- var r = e.cache, o = e.serialized, s = e.isStringTag;
668
- return Re(r, o, s), Fe(function() {
669
- return Ie(r, o, s);
670
- }), null;
671
- }, _t = function t(e, r) {
672
- var o = e.__emotion_real === e, s = o && e.__emotion_base || e, n, a;
673
- r !== void 0 && (n = r.label, a = r.target);
674
- var c = he(e, r, o), p = c || fe(s), b = !p("as");
675
- return function() {
676
- var w = arguments, m = o && e.__emotion_styles !== void 0 ? e.__emotion_styles.slice(0) : [];
677
- if (n !== void 0 && m.push("label:" + n + ";"), w[0] == null || w[0].raw === void 0)
678
- m.push.apply(m, w);
679
- else {
680
- m.push(w[0][0]);
681
- for (var k = w.length, y = 1; y < k; y++)
682
- m.push(w[y], w[0][y]);
683
- }
684
- var u = Ae(function(h, P, A) {
685
- var E = b && h.as || s, L = "", O = [], I = h;
686
- if (h.theme == null) {
687
- I = {};
688
- for (var ie in h)
689
- I[ie] = h[ie];
690
- I.theme = v.useContext(Oe);
691
- }
692
- typeof h.className == "string" ? L = Ne(P.registered, O, h.className) : h.className != null && (L = h.className + " ");
693
- var ce = we(m.concat(O), P.registered, I);
694
- L += P.key + "-" + ce.name, a !== void 0 && (L += " " + a);
695
- var Ee = b && c === void 0 ? fe(E) : p, R = {};
696
- for (var F in h)
697
- b && F === "as" || Ee(F) && (R[F] = h[F]);
698
- return R.className = L, A && (R.ref = A), /* @__PURE__ */ v.createElement(v.Fragment, null, /* @__PURE__ */ v.createElement(Pt, {
699
- cache: P,
700
- serialized: ce,
701
- isStringTag: typeof E == "string"
702
- }), /* @__PURE__ */ v.createElement(E, R));
703
- });
704
- return u.displayName = n !== void 0 ? n : "Styled(" + (typeof s == "string" ? s : s.displayName || s.name || "Component") + ")", u.defaultProps = e.defaultProps, u.__emotion_real = u, u.__emotion_base = s, u.__emotion_styles = m, u.__emotion_forwardProp = c, Object.defineProperty(u, "toString", {
705
- value: function() {
706
- return "." + a;
707
- }
708
- }), u.withComponent = function(h, P) {
709
- return t(h, ee({}, r, P, {
710
- shouldForwardProp: he(u, P, !0)
711
- })).apply(void 0, m);
712
- }, u;
713
- };
714
- }, Ct = [
715
- "a",
716
- "abbr",
717
- "address",
718
- "area",
719
- "article",
720
- "aside",
721
- "audio",
722
- "b",
723
- "base",
724
- "bdi",
725
- "bdo",
726
- "big",
727
- "blockquote",
728
- "body",
729
- "br",
730
- "button",
731
- "canvas",
732
- "caption",
733
- "cite",
734
- "code",
735
- "col",
736
- "colgroup",
737
- "data",
738
- "datalist",
739
- "dd",
740
- "del",
741
- "details",
742
- "dfn",
743
- "dialog",
744
- "div",
745
- "dl",
746
- "dt",
747
- "em",
748
- "embed",
749
- "fieldset",
750
- "figcaption",
751
- "figure",
752
- "footer",
753
- "form",
754
- "h1",
755
- "h2",
756
- "h3",
757
- "h4",
758
- "h5",
759
- "h6",
760
- "head",
761
- "header",
762
- "hgroup",
763
- "hr",
764
- "html",
765
- "i",
766
- "iframe",
767
- "img",
768
- "input",
769
- "ins",
770
- "kbd",
771
- "keygen",
772
- "label",
773
- "legend",
774
- "li",
775
- "link",
776
- "main",
777
- "map",
778
- "mark",
779
- "marquee",
780
- "menu",
781
- "menuitem",
782
- "meta",
783
- "meter",
784
- "nav",
785
- "noscript",
786
- "object",
787
- "ol",
788
- "optgroup",
789
- "option",
790
- "output",
791
- "p",
792
- "param",
793
- "picture",
794
- "pre",
795
- "progress",
796
- "q",
797
- "rp",
798
- "rt",
799
- "ruby",
800
- "s",
801
- "samp",
802
- "script",
803
- "section",
804
- "select",
805
- "small",
806
- "source",
807
- "span",
808
- "strong",
809
- "style",
810
- "sub",
811
- "summary",
812
- "sup",
813
- "table",
814
- "tbody",
815
- "td",
816
- "textarea",
817
- "tfoot",
818
- "th",
819
- "thead",
820
- "time",
821
- "title",
822
- "tr",
823
- "track",
824
- "u",
825
- "ul",
826
- "var",
827
- "video",
828
- "wbr",
829
- // SVG
830
- "circle",
831
- "clipPath",
832
- "defs",
833
- "ellipse",
834
- "foreignObject",
835
- "g",
836
- "image",
837
- "line",
838
- "linearGradient",
839
- "mask",
840
- "path",
841
- "pattern",
842
- "polygon",
843
- "polyline",
844
- "radialGradient",
845
- "rect",
846
- "stop",
847
- "svg",
848
- "text",
849
- "tspan"
850
- ], te = _t.bind();
851
- Ct.forEach(function(t) {
852
- te[t] = te(t);
853
- });
854
- const Tt = vt`{
855
- &:before {
856
- content: '""';
857
- position: absolute;
858
- height: 100%;
859
- width: 100%;
860
- }
861
- }`, Lt = {
862
- width: "28px",
863
- height: "28px",
864
- minWidth: "14px",
865
- minHeight: "14px",
866
- top: "auto",
867
- left: "auto",
868
- opacity: "1",
869
- borderRadius: "12.5%",
870
- appearance: "none",
871
- cursor: "pointer",
872
- margin: "0",
873
- borderStyle: "solid",
874
- borderWidth: "1px"
875
- }, ge = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", kt = "https://docs.prosopo.io/en/basics/faq/", Et = () => Array.from({ length: 8 }, () => ge[Math.floor(Math.random() * ge.length)]).join(""), At = ({ theme: t, onChange: e, checked: r, labelText: o, error: s, loading: n }) => {
876
- const a = {
877
- ...Lt,
878
- border: `1px solid ${t.palette.background.contrastText}`
879
- }, [c, p] = v.useState(!1), b = te.label`
880
- color: ${t.palette.background.contrastText};
881
- position: relative;
882
- display: flex;
883
- cursor: pointer;
884
- user-select: none;
885
-
886
- @container widget (max-width: 219px) {
887
- display: none;
888
- }
889
- @container widget (min-width: 220px) {
890
- font-size: 12px;
891
- }
892
- @container widget (min-width: 250px) {
893
- font-size: 14px;
894
- }
895
- @container widget (min-width: 270px) {
896
- font-size: 16px;
897
- }
898
- `, w = v.useMemo(() => ({
899
- ...a,
900
- borderColor: c ? t.palette.background.contrastText : t.palette.border,
901
- appearance: r ? "auto" : "none",
902
- flex: 1,
903
- margin: "15px",
904
- minWidth: "28px",
905
- minHeight: "28px"
906
- }), [c, t, r]), m = Et();
907
- return yt("span", { style: {
908
- display: "inline-flex",
909
- alignItems: "center",
910
- minHeight: "58px"
911
- }, children: [n ? T("div", { className: He, "aria-label": "Loading spinner" }) : T("input", { name: m, id: m, onMouseEnter: () => p(!0), onMouseLeave: () => p(!1), css: Tt, type: "checkbox", "aria-live": "assertive", "aria-label": o, onChange: (k) => {
912
- k.preventDefault(), k.stopPropagation(), p(!1), e();
913
- }, checked: r, style: w, disabled: s !== void 0, className: n ? "checkbox__loading-spinner" : "", "data-cy": "captcha-checkbox" }), s ? T(b, { htmFor: m, children: T("a", { css: {
914
- color: t.palette.error.main
915
- }, href: kt, children: s }) }) : T(b, { htmFor: m, children: o })] });
916
- };
917
- class Z extends Error {
918
- constructor(e, r, o) {
919
- super(`HTTP error! status: ${e} (${r}) for URL: ${o}`), this.status = e, this.statusText = r, this.url = o, this.name = "HttpError";
920
- }
921
- }
922
- class Ot {
923
- constructor(e, r = "") {
924
- this.baseURL = e + r;
925
- }
926
- async fetch(e, r) {
927
- var o;
928
- try {
929
- const s = await fetch(this.baseURL + e, r);
930
- if (!s.ok && s.status !== 400 && !((o = s.headers.get("content-type")) != null && o.includes("application/json")))
931
- throw new Z(s.status, s.statusText, s.url);
932
- return this.responseHandler(s);
933
- } catch (s) {
934
- return this.errorHandler(s);
935
- }
936
- }
937
- async post(e, r, o) {
938
- var n;
939
- const s = {
940
- "Content-Type": "application/json",
941
- ...(o == null ? void 0 : o.headers) || {}
942
- };
943
- try {
944
- const a = await fetch(this.baseURL + e, {
945
- method: "POST",
946
- body: JSON.stringify(r),
947
- ...o,
948
- headers: s
949
- });
950
- if (!a.ok && a.status !== 400 && !((n = a.headers.get("content-type")) != null && n.includes("application/json")))
951
- throw new Z(a.status, a.statusText, a.url);
952
- return this.responseHandler(a);
953
- } catch (a) {
954
- return this.errorHandler(a);
955
- }
956
- }
957
- async responseHandler(e) {
958
- try {
959
- return await e.json();
960
- } catch (r) {
961
- throw console.error("Error parsing JSON:", r), r;
962
- }
963
- }
964
- errorHandler(e) {
965
- return e instanceof Z ? console.error("HTTP error:", e) : console.error("API request error:", e), Promise.reject(e);
966
- }
967
- }
968
- class It extends Ot {
969
- constructor(e, r) {
970
- const o = e.startsWith("http") ? e : `https://${e}`;
971
- super(o), this.account = r;
972
- }
973
- getCaptchaChallenge(e, r, o) {
974
- const { provider: s } = r, n = this.account, a = {
975
- [i.dapp]: n,
976
- [i.user]: e,
977
- [i.datasetId]: s.datasetId
978
- };
979
- return o && (a[i.sessionId] = o), this.post(C.GetImageCaptchaChallenge, a, {
980
- headers: {
981
- "Prosopo-Site-Key": this.account,
982
- "Prosopo-User": e
983
- }
984
- });
985
- }
986
- submitCaptchaSolution(e, r, o, s, n, a) {
987
- const c = {
988
- [i.user]: o,
989
- [i.dapp]: this.account,
990
- [i.captchas]: e,
991
- [i.requestHash]: r,
992
- [i.timestamp]: s,
993
- [i.signature]: {
994
- [i.user]: {
995
- [i.timestamp]: a
996
- },
997
- [i.provider]: {
998
- [i.requestHash]: n
999
- }
1000
- }
1001
- };
1002
- return this.post(C.SubmitImageCaptchaSolution, c, {
1003
- headers: {
1004
- "Prosopo-Site-Key": this.account,
1005
- "Prosopo-User": o
1006
- }
1007
- });
1008
- }
1009
- verifyDappUser(e, r, o, s) {
1010
- const n = {
1011
- [i.token]: e,
1012
- [i.dappSignature]: r
1013
- };
1014
- return s && (n[i.maxVerifiedTime] = s), this.post(C.VerifyImageCaptchaSolutionDapp, n, {
1015
- headers: {
1016
- "Prosopo-Site-Key": this.account,
1017
- "Prosopo-User": o
1018
- }
1019
- });
1020
- }
1021
- getPowCaptchaChallenge(e, r, o) {
1022
- const s = {
1023
- [i.user]: e.toString(),
1024
- [i.dapp]: r.toString(),
1025
- ...o && { [i.sessionId]: o }
1026
- };
1027
- return this.post(C.GetPowCaptchaChallenge, s, {
1028
- headers: {
1029
- "Prosopo-Site-Key": this.account,
1030
- "Prosopo-User": e
1031
- }
1032
- });
1033
- }
1034
- submitPowCaptchaSolution(e, r, o, s, n, a) {
1035
- const c = $e.parse({
1036
- [i.challenge]: e.challenge,
1037
- [i.difficulty]: e.difficulty,
1038
- [i.timestamp]: e.timestamp,
1039
- [i.user]: r.toString(),
1040
- [i.dapp]: o.toString(),
1041
- [i.nonce]: s,
1042
- [i.verifiedTimeout]: a,
1043
- [i.signature]: {
1044
- [i.provider]: e[i.signature][i.provider],
1045
- [i.user]: {
1046
- [i.timestamp]: n
1047
- }
1048
- }
1049
- });
1050
- return this.post(C.SubmitPowCaptchaSolution, c, {
1051
- headers: {
1052
- "Prosopo-Site-Key": this.account,
1053
- "Prosopo-User": r
1054
- }
1055
- });
1056
- }
1057
- getFrictionlessCaptcha(e, r, o) {
1058
- const s = {
1059
- [i.token]: e,
1060
- [i.dapp]: r,
1061
- [i.user]: o
1062
- };
1063
- return this.post(C.GetFrictionlessCaptchaChallenge, s, {
1064
- headers: {
1065
- "Prosopo-Site-Key": this.account,
1066
- "Prosopo-User": o
1067
- }
1068
- });
1069
- }
1070
- submitUserEvents(e, r) {
1071
- return this.post(C.SubmitUserEvents, { events: e, string: r }, {
1072
- headers: {
1073
- "Prosopo-Site-Key": this.account
1074
- }
1075
- });
1076
- }
1077
- getProviderStatus() {
1078
- return this.fetch(C.GetProviderStatus, {
1079
- headers: {
1080
- "Prosopo-Site-Key": this.account
1081
- }
1082
- });
1083
- }
1084
- getProviderDetails() {
1085
- return this.fetch(Me.GetProviderDetails, {
1086
- headers: {
1087
- "Prosopo-Site-Key": this.account
1088
- }
1089
- });
1090
- }
1091
- submitPowCaptchaVerify(e, r, o, s) {
1092
- const n = {
1093
- [i.token]: e,
1094
- [i.dappSignature]: r,
1095
- [i.verifiedTimeout]: o
1096
- };
1097
- return this.post(C.VerifyPowCaptchaSolution, n, {
1098
- headers: {
1099
- "Prosopo-Site-Key": this.account,
1100
- "Prosopo-User": s
1101
- }
1102
- });
1103
- }
1104
- registerSiteKey(e, r, o, s, n) {
1105
- const a = { siteKey: e, tier: r, settings: o };
1106
- return this.post(G.SiteKeyRegister, a, {
1107
- headers: {
1108
- "Prosopo-Site-Key": this.account,
1109
- timestamp: s,
1110
- signature: n
1111
- }
1112
- });
1113
- }
1114
- updateDetectorKey(e, r, o) {
1115
- return this.post(G.UpdateDetectorKey, le.parse({ detectorKey: e }), {
1116
- headers: {
1117
- "Prosopo-Site-Key": this.account,
1118
- timestamp: r,
1119
- signature: o
1120
- }
1121
- });
1122
- }
1123
- removeDetectorKey(e, r, o) {
1124
- return this.post(G.RemoveDetectorKey, le.parse({ detectorKey: e }), {
1125
- headers: {
1126
- "Prosopo-Site-Key": this.account,
1127
- timestamp: r,
1128
- signature: o
1129
- }
1130
- });
1131
- }
1132
- }
1133
- const Rt = v.lazy(async () => import("./ProcaptchaWidget-rAM-9Rap.js")), Le = (t) => T(v.Suspense, { children: T(Rt, { config: t.config, callbacks: t.callbacks, frictionlessState: t.frictionlessState, i18n: t.i18n }) }), Ft = v.lazy(async () => import("./ProcaptchaWidget-DrBDhP6X.js")), ke = (t) => T(v.Suspense, { children: T(Ft, { ...t }) }), Nt = async () => (await import("./index-BjRdPnnE.js")).default, jt = async (t) => {
1134
- const r = await (await Nt())(), s = await new (await ct(t.web2))().getAccount(t);
1135
- if (!t.account.address)
1136
- throw new oe("GENERAL.SITE_KEY_MISSING");
1137
- const n = await at(t), c = await new It(n.provider.url, t.account.address).getFrictionlessCaptcha(r.token, t.account.address, s.account.address);
1138
- return {
1139
- captchaType: c.captchaType,
1140
- sessionId: c.sessionId,
1141
- provider: n,
1142
- status: c.status,
1143
- userAccount: s,
1144
- error: c.error
1145
- };
1146
- }, me = (t, e, r, o, s) => {
1147
- const n = t === "light" ? We : qe;
1148
- return e === "invisible" ? null : x.jsx(At, { theme: n, onChange: async () => {
1149
- }, checked: !1, labelText: o("WIDGET.I_AM_HUMAN"), error: r, "aria-label": "human checkbox", loading: s });
1150
- }, ye = (t) => ({
1151
- loading: !1,
1152
- attemptCount: t || 0
1153
- }), $t = ({ config: t, callbacks: e, restart: r, i18n: o, detectBot: s = jt }) => {
1154
- const n = v.useRef(ye(0)), a = j(e);
1155
- v.useEffect(() => {
1156
- t.language && (o ? o.language !== t.language && o.changeLanguage(t.language).then((y) => y) : Ue().then((y) => {
1157
- y.language !== t.language && y.changeLanguage(t.language).then((u) => u);
1158
- }));
1159
- }, [o, t.language]);
1160
- const [c, p] = v.useState(me(t.theme, t.mode, n.current.errorMessage, o.t, !0)), b = (y) => {
1161
- n.current = ye(y || n.current.attemptCount);
1162
- }, w = (y, u) => {
1163
- u === "CAPTCHA.NO_SESSION_FOUND" && setTimeout(() => {
1164
- m();
1165
- }, 0), p(me(t.theme, t.mode, y || "Cannot load CAPTCHA", o.t, !1));
1166
- }, m = () => {
1167
- setTimeout(() => {
1168
- b(0), a.onReset(), r();
1169
- }, 1e4);
1170
- }, k = async () => {
1171
- await it(async () => {
1172
- var P, A, E, L, O;
1173
- n.current.attemptCount += 1;
1174
- const y = De.parse(t), u = await s(y);
1175
- if ((P = u.error) != null && P.message) {
1176
- n.current = {
1177
- ...n.current,
1178
- loading: !1,
1179
- errorMessage: (A = u.error) == null ? void 0 : A.message
1180
- }, a.onError(new Error((E = u.error) == null ? void 0 : E.message)), w((L = u.error) == null ? void 0 : L.message, (O = u.error) == null ? void 0 : O.key);
1181
- return;
1182
- }
1183
- const h = {
1184
- provider: u.provider,
1185
- sessionId: u.sessionId,
1186
- userAccount: u.userAccount,
1187
- restart: r
1188
- };
1189
- u.captchaType === "image" ? p(x.jsx(ke, { config: t, callbacks: e, frictionlessState: h, i18n: o })) : (p(x.jsx(Le, { config: t, callbacks: e, frictionlessState: h, i18n: o })), n.current = {
1190
- ...n.current,
1191
- loading: !1
1192
- });
1193
- }, k, b, n.current.attemptCount, 5).finally(() => {
1194
- n.current.attemptCount >= 5 && (w(), m());
1195
- });
1196
- };
1197
- return v.useEffect(() => {
1198
- (async () => {
1199
- await k();
1200
- })();
1201
- }, [t, e, s, t.language]), c;
1202
- }, Mt = (t) => {
1203
- const { config: e, callbacks: r, i18n: o } = t, [s, n] = v.useState(0), a = () => {
1204
- n((c) => c + 1);
1205
- };
1206
- return x.jsx($t, { config: e, callbacks: j(r), restart: a, i18n: o }, s);
1207
- }, Dt = (t) => {
1208
- const { config: e, callbacks: r, i18n: o } = t;
1209
- return x.jsx(ke, { config: e, callbacks: j(r), i18n: o });
1210
- }, zt = (t) => {
1211
- const { config: e, callbacks: r, i18n: o } = t;
1212
- return x.jsx(Le, { config: e, callbacks: j(r), i18n: o });
1213
- }, Kt = {
1214
- [V.image]: Dt,
1215
- [V.pow]: zt,
1216
- [V.frictionless]: Mt
1217
- };
1218
- class Ht {
1219
- getCaptchaComponent(e, r) {
1220
- const o = Kt[e];
1221
- return "rendering ".concat(e), x.jsx(o, { config: r.config, callbacks: r.callbacks, i18n: r.i18n });
1222
- }
1223
- }
1224
- const Zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1225
- __proto__: null,
1226
- CaptchaComponentProvider: Ht
1227
- }, Symbol.toStringTag, { value: "Module" }));
1228
- export {
1229
- At as C,
1230
- ct as E,
1231
- Yt as P,
1232
- yt as a,
1233
- Xt as b,
1234
- oe as c,
1235
- at as d,
1236
- It as e,
1237
- vt as f,
1238
- j as g,
1239
- Zt as h,
1240
- T as j,
1241
- it as p
1242
- };