@prosopo/procaptcha-bundle 2.5.3 → 2.5.5

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-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +1 -1
  2. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.js +15 -17
  3. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +1 -1
  4. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js +23 -27
  5. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js.map +1 -1
  6. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts +2 -2
  7. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
  8. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js +4 -7
  9. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +1 -1
  10. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts +2 -2
  11. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts.map +1 -1
  12. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js +9 -4
  13. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js.map +1 -1
  14. package/dist/bundle/ProcaptchaWidget-CCSN3Dxj.js +636 -0
  15. package/dist/bundle/{ProcaptchaWidget-Dnwno-4N.js → ProcaptchaWidget-Dfex8hc8.js} +4 -4
  16. package/dist/bundle/{asU8a-JliaME7-.js → asU8a-CAsEnbuP.js} +1 -1
  17. package/dist/bundle/{bip39-CFjno8fK.js → bip39-DCaMcFzo.js} +2 -2
  18. package/dist/bundle/{captchaComponentProvider-dcMua0p9.js → captchaComponentProvider-Dm44AMrY.js} +23 -18
  19. package/dist/bundle/captchaRenderer-BBodRhQu.js +70 -0
  20. package/dist/bundle/{emotion-element-5486c51c.browser.esm-Bywq83R5.js → emotion-element-5486c51c.browser.esm-CQHFV-dS.js} +711 -746
  21. package/dist/bundle/{fp.esm-C0kLYOiJ.js → fp.esm-DYWeNGcH.js} +17 -0
  22. package/dist/bundle/{hash-CtL1HOjf.js → hash-D-64Vz5z.js} +1 -1
  23. package/dist/bundle/{captchaRenderer-D-du50M4.js → index-9I1Aae33.js} +1293 -1355
  24. package/dist/bundle/index-DCHEbWAs.js +1242 -0
  25. package/dist/bundle/{index-DcG_c-Na.js → index-DkQ4njKa.js} +12 -12
  26. package/dist/bundle/{index-BTlHNFX8.js → index-DxswvPTy.js} +285 -183
  27. package/dist/bundle/{index-BMjJnq60.js → index-nNwZuute.js} +252 -252
  28. package/dist/bundle/index.d.ts.map +1 -1
  29. package/dist/bundle/locales/de/translation.json +55 -405
  30. package/dist/bundle/locales/en/translation.json +55 -405
  31. package/dist/bundle/locales/es/translation.json +55 -405
  32. package/dist/bundle/locales/fr/translation.json +55 -405
  33. package/dist/bundle/locales/it/translation.json +55 -405
  34. package/dist/bundle/locales/pt/translation.json +55 -405
  35. package/dist/bundle/locales/pt-BR/translation.json +55 -405
  36. package/dist/bundle/procaptcha.bundle.js +1 -1
  37. package/dist/bundle/{useTranslation-7b6JJ18N.js → useTranslation-CEt2t9kE.js} +1 -1
  38. package/dist/bundle/util/captcha/captchaRenderer.d.ts +2 -2
  39. package/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
  40. package/dist/bundle/util/widgetFactory.d.ts +2 -2
  41. package/dist/bundle/util/widgetFactory.d.ts.map +1 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +15 -17
  44. package/dist/index.js.map +1 -1
  45. package/dist/tests/util/renderLogic.test.js +23 -27
  46. package/dist/tests/util/renderLogic.test.js.map +1 -1
  47. package/dist/util/captcha/captchaRenderer.d.ts +2 -2
  48. package/dist/util/captcha/captchaRenderer.d.ts.map +1 -1
  49. package/dist/util/captcha/captchaRenderer.js +4 -7
  50. package/dist/util/captcha/captchaRenderer.js.map +1 -1
  51. package/dist/util/widgetFactory.d.ts +2 -2
  52. package/dist/util/widgetFactory.d.ts.map +1 -1
  53. package/dist/util/widgetFactory.js +9 -4
  54. package/dist/util/widgetFactory.js.map +1 -1
  55. package/package.json +20 -14
  56. package/stats.html +1 -1
  57. package/vite.config.ts +18 -3
  58. package/vite.serve.config.ts +24 -0
  59. package/dist/bundle/ProcaptchaWidget-BlWWnPeB.js +0 -615
  60. package/dist/bundle/index-B8oMghZ3.js +0 -1120
@@ -1,51 +1,143 @@
1
- function g(t, e, o) {
2
- if (t.length === 0)
1
+ function k(e, t, o) {
2
+ if (e.length === 0)
3
3
  throw new Error("Array is empty");
4
- if (!Number.isFinite(e))
5
- throw new Error(`Index ${e} is not a finite number`);
6
- if (e > 0 ? e = e % t.length : e = Math.ceil(Math.abs(e) / t.length) * t.length + e, e >= t.length)
7
- throw new Error(`Index ${e} larger than array length ${t.length}`);
8
- if (e < 0)
9
- throw new Error(`Index ${e} smaller than 0`);
10
- return t[e];
11
- }
12
- var l;
13
- (function(t) {
14
- t.image = "image", t.pow = "pow", t.frictionless = "frictionless";
15
- })(l || (l = {}));
16
- let u;
17
- async function T(t) {
18
- return new Promise((e, o) => {
4
+ if (!Number.isFinite(t))
5
+ throw new Error(`Index ${t} is not a finite number`);
6
+ if (t > 0 ? t = t % e.length : t = Math.ceil(Math.abs(t) / e.length) * e.length + t, t >= e.length)
7
+ throw new Error(`Index ${t} larger than array length ${e.length}`);
8
+ if (t < 0)
9
+ throw new Error(`Index ${t} smaller than 0`);
10
+ return e[t];
11
+ }
12
+ var u;
13
+ (function(e) {
14
+ e.datasetId = "datasetId", e.user = "user", e.dapp = "dapp", e.provider = "provider", e.blockNumber = "blockNumber", e.requestHash = "requestHash", e.captchas = "captchas", e.commitmentId = "commitmentId", e.proof = "proof", e.dappSignature = "dappSignature", e.dappUserSignature = "dappUserSignature", e.providerUrl = "providerUrl", e.procaptchaResponse = "procaptcha-response", e.verifiedTimeout = "verifiedTimeout", e.maxVerifiedTime = "maxVerifiedTime", e.verified = "verified", e.status = "status", e.challenge = "challenge", e.difficulty = "difficulty", e.nonce = "nonce", e.timeouts = "timeouts", e.token = "token", e.secret = "secret", e.timestamp = "timestamp", e.signature = "signature", e.error = "error", e.siteKey = "siteKey", e.captchaType = "captchaType", e.sessionId = "sessionId", e.settings = "settings", e.domains = "domains", e.frictionlessThreshold = "frictionlessThreshold", e.powDifficulty = "powDifficulty", e.score = "score", e.tier = "tier", e.detectorKey = "detectorKey";
15
+ })(u || (u = {}));
16
+ var g;
17
+ (function(e) {
18
+ e.image = "image", e.pow = "pow", e.frictionless = "frictionless";
19
+ })(g || (g = {}));
20
+ let _;
21
+ async function N(e) {
22
+ return new Promise((t, o) => {
19
23
  try {
20
24
  import("./i18nFrontend-C_RgmvGh.js").then((a) => a.b).then(({ default: a }) => {
21
- u || (u = a()), e(u);
25
+ _ || (_ = a()), t(_);
22
26
  });
23
27
  } catch (a) {
24
28
  o(a);
25
29
  }
26
30
  });
27
31
  }
28
- const k = (t) => {
29
- const e = window[t.replace("window.", "")];
30
- if (typeof e != "function")
31
- throw new Error(`Callback ${t} is not defined on the window object`);
32
- return e;
33
- }, S = "https://prosopo.io", R = "Visit prosopo.io to learn more about the service and its accessibility options.", I = 74, f = 80, A = "80px", m = "302px", W = "8px", D = "2px", $ = "1px solid", w = "checkbox__loading-spinner";
34
- function L(t) {
35
- const e = document.createElement("div");
36
- return e.className = "checkbox", e.innerHTML = z(t) + q, e;
32
+ function q(e) {
33
+ const t = e.getRootNode();
34
+ return (t instanceof ShadowRoot ? t.host : e).closest("form");
37
35
  }
38
- const M = (t) => (t.shadowRoot || t).querySelector(".checkbox__content"), q = `
36
+ const r = () => {
37
+ Array.from(document.getElementsByName(u.procaptchaResponse)).map((t) => t.remove());
38
+ }, m = (e) => {
39
+ const t = window[e.replace("window.", "")];
40
+ if (typeof t != "function")
41
+ throw new Error(`Callback ${e} is not defined on the window object`);
42
+ return t;
43
+ }, M = (e) => ({
44
+ onHuman: (t) => D(t, e),
45
+ onChallengeExpired: () => {
46
+ r();
47
+ },
48
+ onExtensionNotFound: () => {
49
+ console.error("Extension not found");
50
+ },
51
+ onExpired: () => {
52
+ r();
53
+ },
54
+ onError: (t) => {
55
+ r(), console.error(t);
56
+ },
57
+ onClose: () => {
58
+ },
59
+ onOpen: () => {
60
+ },
61
+ onFailed: () => {
62
+ alert("Captcha challenge failed. Please try again");
63
+ },
64
+ onReset: () => {
65
+ r();
66
+ },
67
+ onReload: () => {
68
+ }
69
+ }), s = (e, t, o) => {
70
+ const a = t.getAttribute(`data-${e}`);
71
+ if (a) {
72
+ const n = m(a);
73
+ if (n)
74
+ return n;
75
+ }
76
+ if (typeof o == "function")
77
+ return o;
78
+ if (typeof o == "string")
79
+ return m(o);
80
+ };
81
+ function z(e, t, o) {
82
+ const a = s("callback", o, e == null ? void 0 : e.callback);
83
+ a && (t.onHuman = (f) => {
84
+ D(f, o), a(f);
85
+ });
86
+ const n = s("chalexpired-callback", o, e == null ? void 0 : e["chalexpired-callback"]);
87
+ n && (t.onChallengeExpired = () => {
88
+ r(), n();
89
+ });
90
+ const c = s("expired-callback", o, e == null ? void 0 : e["expired-callback"]);
91
+ c && (t.onExpired = () => {
92
+ r(), c();
93
+ });
94
+ const i = s("error-callback", o, e == null ? void 0 : e["error-callback"]);
95
+ i && (t.onError = (f) => {
96
+ r(), i(f);
97
+ });
98
+ const l = s("close-callback", o, e == null ? void 0 : e["close-callback"]);
99
+ l && (t.onClose = () => {
100
+ l();
101
+ });
102
+ const v = s("open-callback", o, e == null ? void 0 : e["open-callback"]);
103
+ v && (t.onOpen = () => {
104
+ v();
105
+ });
106
+ const x = s("failed-callback", o, e == null ? void 0 : e["failed-callback"]);
107
+ x && (t.onFailed = () => {
108
+ x();
109
+ });
110
+ const h = s("reset-callback", o, e == null ? void 0 : e["reset-callback"]);
111
+ h && (t.onReset = () => {
112
+ r(), h();
113
+ });
114
+ }
115
+ const D = (e, t) => {
116
+ if (r(), t) {
117
+ const o = q(t);
118
+ if (!o) {
119
+ console.error("Parent form not found for the element:", t);
120
+ return;
121
+ }
122
+ const a = document.createElement("input");
123
+ a.type = "hidden", a.name = u.procaptchaResponse, a.value = e, o.appendChild(a);
124
+ }
125
+ }, U = "https://prosopo.io", H = "Visit prosopo.io to learn more about the service and its accessibility options.", F = 74, C = 80, G = "80px", T = "302px", j = "8px", B = "2px", K = "1px solid", R = "checkbox__loading-spinner";
126
+ function A(e) {
127
+ const t = document.createElement("div");
128
+ return t.className = "checkbox", t.innerHTML = Y(e) + V, t;
129
+ }
130
+ const X = (e) => (e.shadowRoot || e).querySelector(".checkbox__content"), V = `
39
131
  <div class="checkbox__outer">
40
132
  <div class="checkbox__wrapper">
41
133
  <div class="checkbox__inner">
42
134
  <div class="checkbox__content">
43
- <div class="${w}" aria-label="Loading spinner"></div>
135
+ <div class="${R}" aria-label="Loading spinner"></div>
44
136
  </div>
45
137
  </div>
46
138
  </div>
47
139
  </div>
48
- `, z = (t) => `
140
+ `, Y = (e) => `
49
141
  <style>
50
142
  .checkbox {
51
143
  display: flex;
@@ -73,21 +165,22 @@ const M = (t) => (t.shadowRoot || t).querySelector(".checkbox__content"), q = `
73
165
  display: inline-flex;
74
166
  }
75
167
 
76
- .${w} {
168
+ .${R} {
77
169
  margin-top: 0;
78
170
  margin-left: 15px;
79
171
  margin-right: 15px;
80
172
  width: 2em;
81
173
  height: 2em;
82
- border: 4px solid ${t.palette.background.contrastText};
174
+ border: 4px solid ${e.palette.background.contrastText};
83
175
  border-bottom-color: transparent;
84
176
  border-radius: 50%;
85
177
  display: inherit;
86
178
  box-sizing: border-box;
87
179
  animation: checkbox__loading-spinner-rotation 1s linear infinite;
180
+ will-change: transform;
88
181
  }
89
182
 
90
- @keyframes ${w}-rotation {
183
+ @keyframes ${R}-rotation {
91
184
  0% {
92
185
  transform: rotate(0deg);
93
186
  }
@@ -97,11 +190,11 @@ const M = (t) => (t.shadowRoot || t).querySelector(".checkbox__content"), q = `
97
190
  }
98
191
  </style>
99
192
  `;
100
- function N(t) {
101
- const e = document.createElement("div");
102
- return e.className = "logo", e.innerHTML = P + H(t), e;
193
+ function J(e) {
194
+ const t = document.createElement("div");
195
+ return t.className = "logo", t.innerHTML = Q + Z(e), t;
103
196
  }
104
- const P = `
197
+ const Q = `
105
198
  <style>
106
199
  .logo {
107
200
  display: inline-flex;
@@ -122,11 +215,11 @@ const P = `
122
215
  }
123
216
  </style>
124
217
  `;
125
- function H(t) {
218
+ function Z(e) {
126
219
  return `
127
- <a href="${S}"
220
+ <a href="${U}"
128
221
  target="_blank"
129
- aria-label="${R}">
222
+ aria-label="${H}">
130
223
  <div class="logo__outer">
131
224
  <div class="logo__wrapper">
132
225
  <div class="logo__inner">
@@ -135,7 +228,7 @@ function H(t) {
135
228
  xmlns="http://www.w3.org/2000/svg"
136
229
  viewBox="0 0 468.67004 487.99998"
137
230
  height="35px"
138
- style="fill: ${t.palette.logoFill};"
231
+ style="fill: ${e.palette.logoFill};"
139
232
  aria-label="Prosopo Logo With Text">
140
233
  <title>Prosopo Logo With Text</title>
141
234
  <g id="g1960" transform="translate(0,-35.903035)">
@@ -172,19 +265,19 @@ function H(t) {
172
265
  </a>
173
266
  `;
174
267
  }
175
- function U(t) {
176
- var n, r;
177
- const e = document.createElement("div");
178
- e.className = "widget";
179
- const o = L(t), a = N(t);
180
- return e.innerHTML = j(t) + G(B()), (n = e.querySelector(".widget__checkbox")) == null || n.replaceWith(o), (r = e.querySelector(".widget__logo")) == null || r.replaceWith(a), e;
268
+ function P(e) {
269
+ var n, c;
270
+ const t = document.createElement("div");
271
+ t.className = "widget";
272
+ const o = A(e), a = J(e);
273
+ return t.innerHTML = ee(e) + O(oe()), (n = t.querySelector(".widget__checkbox")) == null || n.replaceWith(o), (c = t.querySelector(".widget__logo")) == null || c.replaceWith(a), t;
181
274
  }
182
- function G(t) {
275
+ function O(e) {
183
276
  return `
184
277
  <div class="widget__outer">
185
278
  <div class="widget__wrapper">
186
279
  <div class="widget__inner">
187
- <div class="widget__dimensions" ${t ? 'data-cy="captcha-checkbox"' : ""}>
280
+ <div class="widget__dimensions" ${e ? 'data-cy="captcha-checkbox"' : ""}>
188
281
  <div class="widget__content">
189
282
  <div class="widget__checkbox"></div>
190
283
  <div class="widget__logo"></div>
@@ -195,91 +288,91 @@ function G(t) {
195
288
  </div>
196
289
  `;
197
290
  }
198
- function j(t) {
291
+ function ee(e) {
199
292
  return `
200
293
  <style>
201
294
  .widget {
202
295
  width: 100%;
203
- min-height: ${A}
296
+ min-height: ${G}
204
297
  }
205
298
 
206
299
  .widget__outer {
207
- max-width: ${m};
300
+ max-width: ${T};
208
301
  min-height: 100%;
209
302
  overflow-x: auto;
210
303
  width: 100%;
211
- font-family: ${t.font.fontFamily};
212
- color: ${t.font.color};
304
+ font-family: ${e.font.fontFamily};
305
+ color: ${e.font.color};
213
306
  }
214
307
 
215
308
  .widget__wrapper {
216
309
  container-type: size;
217
310
  display: flex;
218
311
  flex-direction: column;
219
- height: ${f}px;
312
+ height: ${C}px;
220
313
  }
221
314
 
222
315
  .widget__inner {
223
316
  max-height: 100%;
224
317
  min-width: 100%;
225
318
  overflow: hidden;
226
- height: ${f}px;
319
+ height: ${C}px;
227
320
  width: 100%;
228
321
  display: grid;
229
322
  }
230
323
 
231
324
  .widget__dimensions {
232
- max-width: ${m};
233
- min-height: ${f}px;
325
+ max-width: ${T};
326
+ min-height: ${C}px;
234
327
  }
235
328
 
236
329
  .widget__content {
237
- padding: ${D};
238
- border: ${$};
239
- background-color: ${t.palette.background.default};
240
- border-color: ${t.palette.grey[300]};
241
- border-radius: ${W};
330
+ padding: ${B};
331
+ border: ${K};
332
+ background-color: ${e.palette.background.default};
333
+ border-color: ${e.palette.grey[300]};
334
+ border-radius: ${j};
242
335
  display: flex;
243
336
  align-items: center;
244
337
  flex-wrap: wrap;
245
338
  justify-content: space-between;
246
- min-height: ${I}px;
339
+ min-height: ${F}px;
247
340
  overflow: hidden;
248
341
  }
249
342
  </style>
250
343
  `;
251
344
  }
252
- function F() {
253
- var e;
254
- return typeof process < "u" ? "production" : (e = import.meta.env) == null ? void 0 : e.MODE;
345
+ function te() {
346
+ var t;
347
+ return typeof process < "u" ? "production" : (t = import.meta.env) == null ? void 0 : t.MODE;
255
348
  }
256
- const B = () => F() !== "production", O = 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"';
257
- function K(t, e = "") {
258
- const o = document.createElement(t);
259
- V(o);
349
+ const oe = () => te() !== "production", ae = 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"';
350
+ function ne(e, t = "") {
351
+ const o = document.createElement(e);
352
+ ie(o);
260
353
  const a = o.attachShadow({ mode: "open" });
261
- return a.innerHTML = X(e), o;
354
+ return a.innerHTML = ce(t), o;
262
355
  }
263
- const X = (t) => `
356
+ const ce = (e) => `
264
357
  <style>
265
- *{font-family: ${O};}
358
+ *{font-family: ${ae};}
266
359
  </style>
267
360
 
268
361
  <style>
269
- ${t}
362
+ ${e}
270
363
  </style>
271
- `, V = (t) => {
272
- t.style.display = "flex", t.style.flexDirection = "column", t.style.width = "100%", t.style.maxWidth = m;
364
+ `, ie = (e) => {
365
+ e.style.display = "flex", e.style.flexDirection = "column", e.style.width = "100%", e.style.maxWidth = T;
273
366
  };
274
- function Y(t, e, o) {
275
- const a = U(e), n = K(o);
276
- J(n).appendChild(a), t.innerHTML = "", t.appendChild(n);
277
- const i = M(n);
367
+ function re(e, t, o) {
368
+ const a = P(t), n = ne(o);
369
+ le(n).appendChild(a), e.innerHTML = "", e.appendChild(n);
370
+ const i = X(n);
278
371
  if (!(i instanceof HTMLElement))
279
372
  throw new Error("Fail to initialize widget: interactive area is not found");
280
373
  return i;
281
374
  }
282
- const J = (t) => t.shadowRoot || t, d = {
375
+ const le = (e) => e.shadowRoot || e, y = {
283
376
  0: "#fff",
284
377
  100: "#f5f5f5",
285
378
  200: "#eeeeee",
@@ -290,7 +383,7 @@ const J = (t) => t.shadowRoot || t, d = {
290
383
  700: "#616161",
291
384
  800: "#424242",
292
385
  900: "#212121"
293
- }, h = 10, Q = {
386
+ }, b = 10, se = {
294
387
  palette: {
295
388
  mode: "light",
296
389
  primary: {
@@ -301,22 +394,22 @@ const J = (t) => t.shadowRoot || t, d = {
301
394
  default: "#fff",
302
395
  contrastText: "#000"
303
396
  },
304
- border: d[400],
397
+ border: y[400],
305
398
  error: {
306
399
  main: "#f44336"
307
400
  },
308
401
  logoFill: "#1d1d1b",
309
- grey: d
402
+ grey: y
310
403
  },
311
404
  spacing: {
312
- unit: h,
313
- half: Math.floor(h / 2)
405
+ unit: b,
406
+ half: Math.floor(b / 2)
314
407
  },
315
408
  font: {
316
409
  fontFamily: 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
317
410
  color: "#000"
318
411
  }
319
- }, Z = {
412
+ }, de = {
320
413
  palette: {
321
414
  mode: "dark",
322
415
  primary: {
@@ -327,29 +420,29 @@ const J = (t) => t.shadowRoot || t, d = {
327
420
  default: "#303030",
328
421
  contrastText: "#fff"
329
422
  },
330
- border: d[300],
423
+ border: y[300],
331
424
  error: {
332
425
  main: "#f44336"
333
426
  },
334
427
  logoFill: "#fff",
335
- grey: d
428
+ grey: y
336
429
  },
337
430
  spacing: {
338
- unit: h,
339
- half: Math.floor(h / 2)
431
+ unit: b,
432
+ half: Math.floor(b / 2)
340
433
  },
341
434
  font: {
342
435
  fontFamily: 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
343
436
  color: "#fff"
344
437
  }
345
438
  };
346
- function _(t) {
347
- return Object.values(l).find((a) => a === g(t, 0).getAttribute("data-captcha-type")) || "frictionless";
439
+ function I(e) {
440
+ return Object.values(g).find((a) => a === k(e, 0).getAttribute("data-captcha-type")) || "frictionless";
348
441
  }
349
- const x = (t) => document.querySelector('script[src*="'.concat(t, '"]')), tt = (t) => {
350
- const e = x(t);
351
- if (e && e.src.indexOf("".concat(t)) !== -1) {
352
- const o = new URLSearchParams(e.src.split("?")[1]);
442
+ const S = (e) => document.querySelector('script[src*="'.concat(e, '"]')), he = (e) => {
443
+ const t = S(e);
444
+ if (t && t.src.indexOf("".concat(e)) !== -1) {
445
+ const o = new URLSearchParams(t.src.split("?")[1]);
353
446
  return {
354
447
  onloadUrlCallback: o.get("onload") || void 0,
355
448
  renderExplicit: o.get("render") || void 0
@@ -357,105 +450,110 @@ const x = (t) => document.querySelector('script[src*="'.concat(t, '"]')), tt = (
357
450
  }
358
451
  return { onloadUrlCallback: void 0, renderExplicit: void 0 };
359
452
  };
360
- class et {
361
- constructor(e) {
362
- this.widgetThemeResolver = e, this.captchaRenderer = null, this._i18n = null;
453
+ class pe {
454
+ constructor(t) {
455
+ this.widgetThemeResolver = t, this.captchaRenderer = null, this._i18n = null;
363
456
  }
364
457
  get i18n() {
365
458
  if (this._i18n === null)
366
459
  throw new Error("I18n is not initialized");
367
460
  return this._i18n;
368
461
  }
369
- async createWidgets(e, o, a = !0, n = !1) {
370
- return Promise.all(e.map((r) => this.createWidget(r, o, a, n)));
462
+ async createWidgets(t, o, a = !0, n = !1) {
463
+ return Promise.all(t.map((c) => {
464
+ const i = M(c);
465
+ return z(o, i, c), this.createWidget(c, o, i, a, n);
466
+ }));
371
467
  }
372
- async createWidget(e, o, a = !0, n = !1) {
373
- o.theme = this.widgetThemeResolver.resolveWidgetTheme(e, o);
374
- const r = o.theme === "light" ? Q : Z;
375
- let i;
376
- if (n) {
377
- const b = document.createElement("div");
378
- e.appendChild(b), i = b;
468
+ async createWidget(t, o, a, n = !0, c = !1) {
469
+ o.theme = this.widgetThemeResolver.resolveWidgetTheme(t, o);
470
+ const i = o.theme === "light" ? se : de;
471
+ let l;
472
+ if (c) {
473
+ const h = document.createElement("div");
474
+ t.appendChild(h), l = h;
379
475
  } else
380
- i = Y(e, r, "prosopo-procaptcha");
476
+ l = re(t, i, "prosopo-procaptcha");
381
477
  return (await this.getCaptchaRenderer()).renderCaptcha({
382
478
  identifierPrefix: "procaptcha-",
383
479
  emotionCacheKey: "procaptcha",
384
480
  webComponentTag: "prosopo-procaptcha",
385
- defaultCaptchaType: l.frictionless
386
- }, i, o, a, this.i18n, n);
481
+ defaultCaptchaType: g.frictionless
482
+ }, l, o, a, n, this.i18n, c);
387
483
  }
388
484
  async getCaptchaRenderer() {
389
- return this._i18n === null && (this._i18n = await T()), this.captchaRenderer === null && (this.captchaRenderer = await this.createCaptchaRenderer()), this.captchaRenderer;
485
+ return this._i18n === null && (this._i18n = await N()), this.captchaRenderer === null && (this.captchaRenderer = await this.createCaptchaRenderer()), this.captchaRenderer;
390
486
  }
391
487
  async createCaptchaRenderer() {
392
- const e = (await import("./captchaRenderer-D-du50M4.js")).CaptchaRenderer, o = (await import("./captchaComponentProvider-dcMua0p9.js").then((a) => a.f)).CaptchaComponentProvider;
393
- return new e(new o());
488
+ const t = (await import("./captchaRenderer-BBodRhQu.js")).CaptchaRenderer, o = (await import("./captchaComponentProvider-Dm44AMrY.js").then((a) => a.h)).CaptchaComponentProvider;
489
+ return new t(new o());
394
490
  }
395
491
  }
396
- class ot {
492
+ class fe {
397
493
  constructor() {
398
494
  this.themesSet = /* @__PURE__ */ new Set(["light", "dark"]), this.defaultTheme = "light";
399
495
  }
400
- resolveWidgetTheme(e, o) {
401
- const a = o.theme || e.getAttribute("data-theme") || this.defaultTheme;
496
+ resolveWidgetTheme(t, o) {
497
+ const a = o.theme || t.getAttribute("data-theme") || this.defaultTheme;
402
498
  return this.validateTheme(a);
403
499
  }
404
- validateTheme(e) {
405
- return this.themesSet.has(e) ? e : this.defaultTheme;
500
+ validateTheme(t) {
501
+ return this.themesSet.has(t) ? t : this.defaultTheme;
406
502
  }
407
503
  }
408
- const v = "procaptcha.bundle.js";
409
- let c = [];
410
- const p = new et(new ot()), at = "procaptcha:execute", nt = async () => {
411
- const t = Array.from(document.getElementsByClassName("procaptcha")).filter((o) => o.tagName.toLowerCase() !== "button");
412
- if (t.length) {
413
- const o = g(t, 0).getAttribute("data-sitekey"), a = g(t, 0).getAttribute("data-web3");
504
+ const E = "procaptcha.bundle.js";
505
+ let d = [];
506
+ const w = new pe(new fe()), ue = "procaptcha:execute", W = async () => {
507
+ const e = Array.from(document.getElementsByClassName("procaptcha")).filter((o) => o.tagName.toLowerCase() !== "button");
508
+ if (e.length) {
509
+ const o = k(e, 0).getAttribute("data-sitekey"), a = k(e, 0).getAttribute("data-web3");
414
510
  if (!o) {
415
511
  console.error("No siteKey found");
416
512
  return;
417
513
  }
418
- const n = _(t), r = await p.createWidgets(t, {
514
+ const n = I(e), c = await w.createWidgets(e, {
419
515
  captchaType: n,
420
516
  siteKey: o
421
517
  }, a !== "true");
422
- c.push(...r);
518
+ d.push(...c);
423
519
  }
424
- const e = Array.from(document.getElementsByClassName("procaptcha")).filter((o) => o.tagName.toLowerCase() === "button");
425
- if (e.length)
426
- for (const o of e) {
427
- const a = o.getAttribute("data-sitekey") || "", n = o.getAttribute("data-callback") || "", r = _([o]), i = await p.createWidgets([o], {
428
- captchaType: r,
520
+ const t = Array.from(document.getElementsByClassName("procaptcha")).filter((o) => o.tagName.toLowerCase() === "button");
521
+ if (t.length)
522
+ for (const o of t) {
523
+ const a = o.getAttribute("data-sitekey") || "", n = o.getAttribute("data-callback") || "", c = I([o]), i = await w.createWidgets([o], {
524
+ captchaType: c,
429
525
  siteKey: a,
430
526
  callback: n
431
527
  }, !0, !0);
432
- c.push(...i), o.addEventListener("click", async (y) => {
433
- y.preventDefault(), E();
528
+ d.push(...i), o.addEventListener("click", async (l) => {
529
+ l.preventDefault(), L();
434
530
  });
435
531
  }
436
- }, rt = async (t, e) => {
437
- if (Object.prototype.hasOwnProperty.call(e, "size") && e.size === "invisible" || t.tagName.toLowerCase() === "button") {
438
- const n = await p.createWidgets([t], e, !0, !0);
439
- c.push(...n);
532
+ }, ge = async (e, t) => {
533
+ if (Object.prototype.hasOwnProperty.call(t, "size") && t.size === "invisible" || e.tagName.toLowerCase() === "button") {
534
+ const n = await w.createWidgets([e], t, !0, !0);
535
+ d.push(...n);
440
536
  return;
441
537
  }
442
- const a = await p.createWidgets([t], e);
443
- c.push(...a);
538
+ const a = await w.createWidgets([e], t);
539
+ d.push(...a);
444
540
  };
445
- function s(t) {
446
- document && document.readyState !== "loading" ? t() : document.addEventListener("DOMContentLoaded", t);
541
+ function p(e) {
542
+ document && document.readyState !== "loading" ? e() : document.addEventListener("DOMContentLoaded", () => {
543
+ e();
544
+ });
447
545
  }
448
- const E = () => {
449
- var t;
450
- const e = it();
451
- if (e.length === 0) {
546
+ const L = () => {
547
+ var e;
548
+ const t = me();
549
+ if (t.length === 0) {
452
550
  console.error("No Procaptcha containers found for execution");
453
551
  return;
454
552
  }
455
- const o = new CustomEvent(at, {
553
+ const o = new CustomEvent(ue, {
456
554
  detail: {
457
- containerId: ((t = e[0]) == null ? void 0 : t.id) || "procaptcha-container",
458
- containerCount: e.length,
555
+ containerId: ((e = t[0]) == null ? void 0 : e.id) || "procaptcha-container",
556
+ containerCount: t.length,
459
557
  timestamp: Date.now()
460
558
  },
461
559
  bubbles: !0,
@@ -463,42 +561,46 @@ const E = () => {
463
561
  });
464
562
  document.dispatchEvent(o);
465
563
  };
466
- function it() {
467
- const t = [], e = Array.from(document.querySelectorAll('[data-size="invisible"]'));
468
- t.push(...e);
564
+ function me() {
565
+ const e = [], t = Array.from(document.querySelectorAll('[data-size="invisible"]'));
566
+ e.push(...t);
469
567
  const o = Array.from(document.querySelectorAll('#procaptcha-container, [id$="-procaptcha-container"]')), a = Array.from(document.getElementsByClassName("p-procaptcha"));
470
- t.push(...a);
568
+ e.push(...a);
471
569
  for (const n of o)
472
- t.includes(n) || t.push(n);
473
- return t;
570
+ e.includes(n) || e.push(n);
571
+ return e;
474
572
  }
475
- const C = () => {
476
- var t;
477
- const { onloadUrlCallback: e, renderExplicit: o } = tt(v);
478
- if (o !== "explicit" && s(nt), e) {
479
- const a = k(e);
480
- let n = !1;
481
- (t = x(v)) == null || t.addEventListener("load", () => {
482
- s(a), n = !0;
483
- }), document.readyState === "complete" && !n && s(a);
573
+ const $ = () => {
574
+ var e, t;
575
+ const { onloadUrlCallback: o, renderExplicit: a } = he(E);
576
+ let n = !1;
577
+ if (a !== "explicit" && ((e = S(E)) == null || e.addEventListener("load", () => {
578
+ p(W), n = !0;
579
+ }), document.readyState === "complete" && !n && p(W)), o && ((t = S(E)) == null || t.addEventListener("load", () => {
580
+ const c = m(o);
581
+ p(c);
582
+ }), document.readyState === "complete" && !n)) {
583
+ const c = m(o);
584
+ p(c);
484
585
  }
485
- }, ct = () => {
486
- for (const t of c)
487
- t.unmount();
488
- c = [], C();
586
+ }, ye = () => {
587
+ for (const e of d)
588
+ e.unmount();
589
+ d = [], $();
489
590
  };
490
- window.procaptcha = { ready: s, render: rt, reset: ct, execute: E };
491
- C();
591
+ window.procaptcha = { ready: p, render: ge, reset: ye, execute: L };
592
+ $();
492
593
  export {
493
- l as C,
494
- w as W,
495
- g as a,
496
- Q as b,
497
- s as c,
498
- Z as d,
499
- E as e,
500
- ct as f,
501
- k as g,
502
- T as l,
503
- rt as r
594
+ u as A,
595
+ g as C,
596
+ R as W,
597
+ k as a,
598
+ se as b,
599
+ p as c,
600
+ de as d,
601
+ L as e,
602
+ ye as f,
603
+ M as g,
604
+ N as l,
605
+ ge as r
504
606
  };