@prosopo/procaptcha-bundle 0.3.41 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,24 @@
1
- import { z as Y, r as f, l as J, d as Q, j as u, a as I, b as g, A as K, h as ue, P as Ce, R as Pe, C as Oe, W as De, c as ke, e as He, f as Le, g as _e, i as Re, L as Me, k as We, m as Ue, n as je } from "./index-q4wiV8mV.js";
2
- import { _ as Ge, a as ze, b as Fe, I as Be, R as Ke, g as $e, c as Ve, d as Ye, i as Xe, P as z, o as qe, E as Je, e as P, f as ae, h as C, j as $, k as de, s as ve, l as Qe, m as Ze, w as pe, t as re, n as et, p as tt, r as nt, q as rt, u as ot, v as at, A as st, W as ct, K as it, x as lt, C as ut, y as dt, z as pt } from "./utils-DvyeJwNo.js";
3
- const Ae = Y.object({
4
- account: Y.string().optional(),
5
- blockNumber: Y.number().optional(),
6
- providerUrl: Y.string().optional()
1
+ import { z as X, r as f, l as Q, d as Z, j as u, a as T, b as g, A as b, h as de, P as ve, R as _e, C as Le, W as He, c as Re, e as Me, f as Ue, g as We, i as je, L as Ge, k as ze, m as Fe, n as Be } from "./index-BnKiDSMF.js";
2
+ import { _ as Ke, a as $e, b as Ve, I as Xe, R as Ye, g as qe, c as Je, d as Qe, i as Ze, P as M, o as et, E as tt, e as O, f as C, h as $, j as pe, s as Ae, k as nt, l as rt, w as he, t as ae, m as ot, n as at, p as Y, r as st, q as ct, u as it, v as lt, A as ut, W as dt, K as pt, x as ht, C as ft, y as gt, z as mt } from "./utils-6l_jjPQ7.js";
3
+ const Ee = X.object({
4
+ account: X.string().optional(),
5
+ blockNumber: X.number().optional(),
6
+ providerUrl: X.string().optional()
7
7
  });
8
- function ht() {
8
+ function wt() {
9
9
  if (console && console.warn) {
10
10
  for (var t, e = arguments.length, n = new Array(e), r = 0; r < e; r++)
11
11
  n[r] = arguments[r];
12
12
  typeof n[0] == "string" && (n[0] = "react-i18next:: ".concat(n[0])), (t = console).warn.apply(t, n);
13
13
  }
14
14
  }
15
- var he = {};
16
- function se() {
15
+ var fe = {};
16
+ function ce() {
17
17
  for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
18
18
  e[n] = arguments[n];
19
- typeof e[0] == "string" && he[e[0]] || (typeof e[0] == "string" && (he[e[0]] = /* @__PURE__ */ new Date()), ht.apply(void 0, e));
19
+ typeof e[0] == "string" && fe[e[0]] || (typeof e[0] == "string" && (fe[e[0]] = /* @__PURE__ */ new Date()), wt.apply(void 0, e));
20
20
  }
21
- function fe(t, e, n) {
21
+ function ge(t, e, n) {
22
22
  t.loadNamespaces(e, function() {
23
23
  if (t.isInitialized)
24
24
  n();
@@ -32,29 +32,29 @@ function fe(t, e, n) {
32
32
  }
33
33
  });
34
34
  }
35
- function ft(t, e) {
35
+ function bt(t, e) {
36
36
  var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, r = e.languages[0], a = e.options ? e.options.fallbackLng : !1, o = e.languages[e.languages.length - 1];
37
37
  if (r.toLowerCase() === "cimode")
38
38
  return !0;
39
39
  var s = function(i, p) {
40
- var b = e.services.backendConnector.state["".concat(i, "|").concat(p)];
41
- return b === -1 || b === 2;
40
+ var y = e.services.backendConnector.state["".concat(i, "|").concat(p)];
41
+ return y === -1 || y === 2;
42
42
  };
43
43
  return n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && e.services.backendConnector.backend && e.isLanguageChangingTo && !s(e.isLanguageChangingTo, t) ? !1 : !!(e.hasResourceBundle(r, t) || !e.services.backendConnector.backend || e.options.resources && !e.options.partialBundledLanguages || s(r, t) && (!a || s(o, t)));
44
44
  }
45
- function gt(t, e) {
45
+ function yt(t, e) {
46
46
  var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
47
47
  if (!e.languages || !e.languages.length)
48
- return se("i18n.languages were undefined or empty", e.languages), !0;
48
+ return ce("i18n.languages were undefined or empty", e.languages), !0;
49
49
  var r = e.options.ignoreJSONStructure !== void 0;
50
50
  return r ? e.hasLoadedNamespace(t, {
51
51
  precheck: function(o, s) {
52
52
  if (n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && o.services.backendConnector.backend && o.isLanguageChangingTo && !s(o.isLanguageChangingTo, t))
53
53
  return !1;
54
54
  }
55
- }) : ft(t, e, n);
55
+ }) : bt(t, e, n);
56
56
  }
57
- function mt(t, e) {
57
+ function xt(t, e) {
58
58
  var n = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
59
59
  if (n != null) {
60
60
  var r, a, o, s, c = [], i = !0, p = !1;
@@ -62,8 +62,8 @@ function mt(t, e) {
62
62
  if (o = (n = n.call(t)).next, e !== 0)
63
63
  for (; !(i = (r = o.call(n)).done) && (c.push(r.value), c.length !== e); i = !0)
64
64
  ;
65
- } catch (b) {
66
- p = !0, a = b;
65
+ } catch (y) {
66
+ p = !0, a = y;
67
67
  } finally {
68
68
  try {
69
69
  if (!i && n.return != null && (s = n.return(), Object(s) !== s))
@@ -76,10 +76,10 @@ function mt(t, e) {
76
76
  return c;
77
77
  }
78
78
  }
79
- function wt(t, e) {
80
- return Ge(t) || mt(t, e) || ze(t, e) || Fe();
79
+ function Ct(t, e) {
80
+ return Ke(t) || xt(t, e) || $e(t, e) || Ve();
81
81
  }
82
- function ge(t, e) {
82
+ function me(t, e) {
83
83
  var n = Object.keys(t);
84
84
  if (Object.getOwnPropertySymbols) {
85
85
  var r = Object.getOwnPropertySymbols(t);
@@ -89,80 +89,80 @@ function ge(t, e) {
89
89
  }
90
90
  return n;
91
91
  }
92
- function oe(t) {
92
+ function se(t) {
93
93
  for (var e = 1; e < arguments.length; e++) {
94
94
  var n = arguments[e] != null ? arguments[e] : {};
95
- e % 2 ? ge(Object(n), !0).forEach(function(r) {
96
- Ve(t, r, n[r]);
97
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : ge(Object(n)).forEach(function(r) {
95
+ e % 2 ? me(Object(n), !0).forEach(function(r) {
96
+ Je(t, r, n[r]);
97
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : me(Object(n)).forEach(function(r) {
98
98
  Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
99
99
  });
100
100
  }
101
101
  return t;
102
102
  }
103
- var bt = function(e, n) {
103
+ var vt = function(e, n) {
104
104
  var r = f.useRef();
105
105
  return f.useEffect(function() {
106
106
  r.current = e;
107
107
  }, [e, n]), r.current;
108
108
  };
109
- function yt(t) {
110
- var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = e.i18n, r = f.useContext(Be) || {}, a = r.i18n, o = n || a || Ye();
111
- if (o && !o.reportNamespaces && (o.reportNamespaces = new Ke()), !o) {
112
- se("You will need to pass in an i18next instance by using initReactI18next");
109
+ function At(t) {
110
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = e.i18n, r = f.useContext(Xe) || {}, a = r.i18n, o = n || a || Qe();
111
+ if (o && !o.reportNamespaces && (o.reportNamespaces = new Ye()), !o) {
112
+ ce("You will need to pass in an i18next instance by using initReactI18next");
113
113
  var s = function(E) {
114
114
  return Array.isArray(E) ? E[E.length - 1] : E;
115
115
  }, c = [s, {}, !1];
116
116
  return c.t = s, c.i18n = {}, c.ready = !1, c;
117
117
  }
118
- o.options.react && o.options.react.wait !== void 0 && se("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
119
- var i = oe(oe(oe({}, $e()), o.options.react), e), p = i.useSuspense, b = i.keyPrefix, m = t;
118
+ o.options.react && o.options.react.wait !== void 0 && ce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
119
+ var i = se(se(se({}, qe()), o.options.react), e), p = i.useSuspense, y = i.keyPrefix, m = t;
120
120
  m = typeof m == "string" ? [m] : m || ["translation"], o.reportNamespaces.addUsedNamespaces && o.reportNamespaces.addUsedNamespaces(m);
121
- var O = (o.isInitialized || o.initializedStoreOnce) && m.every(function(A) {
122
- return gt(A, o, i);
121
+ var k = (o.isInitialized || o.initializedStoreOnce) && m.every(function(A) {
122
+ return yt(A, o, i);
123
123
  });
124
- function v() {
125
- return o.getFixedT(null, i.nsMode === "fallback" ? m : m[0], b);
124
+ function I() {
125
+ return o.getFixedT(null, i.nsMode === "fallback" ? m : m[0], y);
126
126
  }
127
- var Z = f.useState(v), R = wt(Z, 2), U = R[0], L = R[1], j = m.join(), F = bt(j), _ = f.useRef(!0);
127
+ var ee = f.useState(I), U = Ct(ee, 2), G = U[0], H = U[1], z = m.join(), B = vt(z), R = f.useRef(!0);
128
128
  f.useEffect(function() {
129
129
  var A = i.bindI18n, E = i.bindI18nStore;
130
- _.current = !0, !O && !p && fe(o, m, function() {
131
- _.current && L(v);
132
- }), O && F && F !== j && _.current && L(v);
133
- function M() {
134
- _.current && L(v);
130
+ R.current = !0, !k && !p && ge(o, m, function() {
131
+ R.current && H(I);
132
+ }), k && B && B !== z && R.current && H(I);
133
+ function W() {
134
+ R.current && H(I);
135
135
  }
136
- return A && o && o.on(A, M), E && o && o.store.on(E, M), function() {
137
- _.current = !1, A && o && A.split(" ").forEach(function(V) {
138
- return o.off(V, M);
136
+ return A && o && o.on(A, W), E && o && o.store.on(E, W), function() {
137
+ R.current = !1, A && o && A.split(" ").forEach(function(V) {
138
+ return o.off(V, W);
139
139
  }), E && o && E.split(" ").forEach(function(V) {
140
- return o.store.off(V, M);
140
+ return o.store.off(V, W);
141
141
  });
142
142
  };
143
- }, [o, j]);
144
- var T = f.useRef(!0);
143
+ }, [o, z]);
144
+ var S = f.useRef(!0);
145
145
  f.useEffect(function() {
146
- _.current && !T.current && L(v), T.current = !1;
147
- }, [o, b]);
148
- var x = [U, o, O];
149
- if (x.t = U, x.i18n = o, x.ready = O, O || !O && !p)
150
- return x;
146
+ R.current && !S.current && H(I), S.current = !1;
147
+ }, [o, y]);
148
+ var v = [G, o, k];
149
+ if (v.t = G, v.i18n = o, v.ready = k, k || !k && !p)
150
+ return v;
151
151
  throw new Promise(function(A) {
152
- fe(o, m, function() {
152
+ ge(o, m, function() {
153
153
  A();
154
154
  });
155
155
  });
156
156
  }
157
- function xt(t) {
158
- return yt("translation", { i18n: Xe, ...t });
157
+ function Et(t) {
158
+ return At("translation", { i18n: Ze, ...t });
159
159
  }
160
- const Ct = (t) => {
160
+ const It = (t) => {
161
161
  if (!t.hash)
162
- throw new z("CAPTCHA.MISSING_ITEM_HASH", { context: { item: t } });
162
+ throw new M("CAPTCHA.MISSING_ITEM_HASH", { context: { item: t } });
163
163
  return t.hash;
164
- }, vt = ({ challenge: t, solution: e, onClick: n, themeColor: r }) => {
165
- const a = t.captcha.items, o = f.useMemo(() => r === "light" ? J : Q, [r]), s = "ontouchstart" in window;
164
+ }, Nt = ({ challenge: t, solution: e, onClick: n, themeColor: r }) => {
165
+ const a = t.captcha.items, o = f.useMemo(() => r === "light" ? Q : Z, [r]), s = "ontouchstart" in window;
166
166
  return u("div", { style: {
167
167
  paddingRight: 0.5,
168
168
  paddingBottom: 0.5,
@@ -172,14 +172,14 @@ const Ct = (t) => {
172
172
  flexDirection: "row",
173
173
  flexWrap: "wrap"
174
174
  }, children: a.map((c, i) => {
175
- const p = Ct(c);
175
+ const p = It(c);
176
176
  return u("div", { style: {
177
177
  paddingTop: "4px",
178
178
  paddingLeft: "4px",
179
179
  flexGrow: 1,
180
180
  flexBasis: "33.3333%",
181
181
  boxSizing: "border-box"
182
- }, children: I("div", { style: { cursor: "pointer", height: "100%", width: "100%" }, onClick: s ? void 0 : () => n(p), onTouchStart: s ? () => n(p) : void 0, children: [u("div", { style: { border: 1, borderColor: o.palette.grey[300] }, children: u("img", { style: {
182
+ }, children: T("div", { style: { cursor: "pointer", height: "100%", width: "100%" }, onClick: s ? void 0 : () => n(p), onTouchStart: s ? () => n(p) : void 0, children: [u("div", { style: { border: 1, borderColor: o.palette.grey[300] }, children: u("img", { style: {
183
183
  width: "100%",
184
184
  backgroundColor: o.palette.grey[300],
185
185
  opacity: e.includes(p) && s ? "50%" : "100%",
@@ -218,15 +218,15 @@ const Ct = (t) => {
218
218
  }, focusable: "false", color: "#fff", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "CheckIcon", children: u("path", { d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" }) }) }) })] }) }, i);
219
219
  }) });
220
220
  };
221
- function At(t = {}) {
221
+ function Tt(t = {}) {
222
222
  return Object.keys(t).reduce((e, n) => ({ ...e, [`data-${n}`]: t[n] }), {});
223
223
  }
224
- function ce({ general: t, dev: e }) {
224
+ function ie({ general: t, dev: e }) {
225
225
  return {
226
- ...At(t)
226
+ ...Tt(t)
227
227
  };
228
228
  }
229
- const Et = {
229
+ const St = {
230
230
  display: "inline-flex",
231
231
  alignItems: "center",
232
232
  justifyContent: "center",
@@ -252,10 +252,10 @@ const Et = {
252
252
  color: "rgb(0, 0, 0)",
253
253
  backgroundColor: "#ffffff",
254
254
  boxShadow: "rgba(0, 0, 0, 0.2) 0px 3px 1px -2px, rgba(0, 0, 0, 0.14) 0px 2px 2px 0px, rgba(0, 0, 0, 0.12) 0px 1px 5px 0px"
255
- }, me = ({ themeColor: t, buttonType: e, text: n, onClick: r }) => {
256
- const a = f.useMemo(() => t === "light" ? J : Q, [t]), [o, s] = f.useState(!1), c = f.useMemo(() => {
255
+ }, we = ({ themeColor: t, buttonType: e, text: n, onClick: r }) => {
256
+ const a = f.useMemo(() => t === "light" ? Q : Z, [t]), [o, s] = f.useState(!1), c = f.useMemo(() => {
257
257
  const i = {
258
- ...Et,
258
+ ...St,
259
259
  color: o ? a.palette.primary.contrastText : a.palette.background.contrastText
260
260
  };
261
261
  return e === "cancel" ? {
@@ -266,11 +266,11 @@ const Et = {
266
266
  backgroundColor: o ? a.palette.primary.main : a.palette.background.default
267
267
  };
268
268
  }, [e, o, a]);
269
- return u("button", { ...ce({ dev: { cy: `button-${e}` } }), onMouseEnter: () => s(!0), onMouseLeave: () => s(!1), style: c, onClick: (i) => {
269
+ return u("button", { ...ie({ dev: { cy: `button-${e}` } }), onMouseEnter: () => s(!0), onMouseLeave: () => s(!1), style: c, onClick: (i) => {
270
270
  i.preventDefault(), r();
271
271
  }, children: n });
272
- }, It = ({ challenge: t, index: e, solutions: n, onSubmit: r, onCancel: a, onClick: o, onNext: s, themeColor: c }) => {
273
- const { t: i } = xt(), p = t.captchas ? g(t.captchas, e) : null, b = n ? g(n, e) : [], m = f.useMemo(() => c === "light" ? J : Q, [c]);
272
+ }, Pt = ({ challenge: t, index: e, solutions: n, onSubmit: r, onCancel: a, onClick: o, onNext: s, themeColor: c }) => {
273
+ const { t: i } = Et(), p = t.captchas ? g(t.captchas, e) : null, y = n ? g(n, e) : [], m = f.useMemo(() => c === "light" ? Q : Z, [c]);
274
274
  return u(f.Suspense, { fallback: u("div", { children: "Loading..." }), children: u("div", { style: {
275
275
  overflowX: "auto",
276
276
  overflowY: "auto",
@@ -279,18 +279,18 @@ const Et = {
279
279
  maxHeight: "100%",
280
280
  display: "flex",
281
281
  flexDirection: "column"
282
- }, children: I("div", { style: {
282
+ }, children: T("div", { style: {
283
283
  backgroundColor: m.palette.background.default,
284
284
  display: "flex",
285
285
  flexDirection: "column",
286
286
  minWidth: "300px"
287
- }, children: [I("div", { style: {
287
+ }, children: [T("div", { style: {
288
288
  display: "flex",
289
289
  alignItems: "center",
290
290
  width: "100%",
291
291
  backgroundColor: m.palette.primary.main,
292
292
  padding: "24px 16px"
293
- }, children: [I("p", { style: {
293
+ }, children: [T("p", { style: {
294
294
  color: "#ffffff",
295
295
  fontWeight: 700,
296
296
  lineHeight: 1.5
@@ -299,73 +299,73 @@ const Et = {
299
299
  fontWeight: 700,
300
300
  textTransform: "capitalize",
301
301
  lineHeight: 1.5
302
- }, children: `${g(t.captchas, e).captcha.target}` })] }), u("div", { ...ce({ dev: { cy: "captcha-" + e } }), children: p && u(vt, { challenge: p, solution: b, onClick: o, themeColor: c }) }), u("div", { style: {
302
+ }, children: `${g(t.captchas, e).captcha.target}` })] }), u("div", { ...ie({ dev: { cy: "captcha-" + e } }), children: p && u(Nt, { challenge: p, solution: y, onClick: o, themeColor: c }) }), u("div", { style: {
303
303
  display: "flex",
304
304
  alignItems: "center",
305
305
  justifyContent: "center",
306
306
  width: "100%"
307
- }, ...ce({ dev: { cy: "dots-captcha" } }) }), u("div", { style: {
307
+ }, ...ie({ dev: { cy: "dots-captcha" } }) }), u("div", { style: {
308
308
  padding: "8px 16px",
309
309
  display: "flex",
310
310
  width: "100%"
311
- } }), I("div", { style: {
311
+ } }), T("div", { style: {
312
312
  padding: "0 16px 16px",
313
313
  display: "flex",
314
314
  alignItems: "center",
315
315
  justifyContent: "space-between",
316
316
  lineHeight: 1.75
317
- }, children: [u(me, { themeColor: c, buttonType: "cancel", onClick: a, text: i("WIDGET.CANCEL") }), u(me, { themeColor: c, buttonType: "next", text: e < t.captchas.length - 1 ? i("WIDGET.NEXT") : i("WIDGET.SUBMIT"), onClick: e < t.captchas.length - 1 ? s : r })] })] }) }) });
317
+ }, children: [u(we, { themeColor: c, buttonType: "cancel", onClick: a, text: i("WIDGET.CANCEL") }), u(we, { themeColor: c, buttonType: "next", text: e < t.captchas.length - 1 ? i("WIDGET.NEXT") : i("WIDGET.SUBMIT"), onClick: e < t.captchas.length - 1 ? s : r })] })] }) }) });
318
318
  };
319
- function Tt(t) {
319
+ function Ot(t) {
320
320
  return new Promise((e) => {
321
321
  document.readyState === "complete" ? e(t()) : window.addEventListener("load", () => e(t()));
322
322
  });
323
323
  }
324
- const q = window;
325
- q.injectedWeb3 = q.injectedWeb3 || {};
326
- Ee();
327
- let we = null;
328
- function Ee() {
329
- return Object.values(q.injectedWeb3).filter(({ connect: t, enable: e }) => !!(t || e)).length !== 0;
324
+ const J = window;
325
+ J.injectedWeb3 = J.injectedWeb3 || {};
326
+ Ie();
327
+ let be = null;
328
+ function Ie() {
329
+ return Object.values(J.injectedWeb3).filter(({ connect: t, enable: e }) => !!(t || e)).length !== 0;
330
330
  }
331
- function Nt(t) {
332
- return Promise.all(Object.entries(q.injectedWeb3).map(([e, { connect: n, enable: r, version: a }]) => Promise.resolve().then(() => n ? n(t) : r ? r(t).then((o) => qe({ name: e, version: a || "unknown" }, o)) : Promise.reject(new Error("No connect(..) or enable(...) hook found"))).catch(({ message: o }) => {
331
+ function kt(t) {
332
+ return Promise.all(Object.entries(J.injectedWeb3).map(([e, { connect: n, enable: r, version: a }]) => Promise.resolve().then(() => n ? n(t) : r ? r(t).then((o) => et({ name: e, version: a || "unknown" }, o)) : Promise.reject(new Error("No connect(..) or enable(...) hook found"))).catch(({ message: o }) => {
333
333
  console.error(`Error initializing ${e}: ${o}`);
334
334
  }))).then((e) => e.filter((n) => !!n));
335
335
  }
336
- function St(t, e = []) {
336
+ function Dt(t, e = []) {
337
337
  if (!t)
338
338
  throw new Error("You must pass a name for your app to the web3Enable function");
339
339
  const n = e.length ? Promise.all(e.map((r) => r().catch(() => !1))) : Promise.resolve([!0]);
340
- return we = Tt(() => n.then(() => Nt(t).then((r) => r.map((a) => (a.accounts.subscribe || (a.accounts.subscribe = (o) => (a.accounts.get().then(o).catch(console.error), () => {
340
+ return be = Ot(() => n.then(() => kt(t).then((r) => r.map((a) => (a.accounts.subscribe || (a.accounts.subscribe = (o) => (a.accounts.get().then(o).catch(console.error), () => {
341
341
  })), a))).catch(() => []).then((r) => {
342
342
  const a = r.map(({ name: o, version: s }) => `${o}/${s}`);
343
- return Ee(), `${r.length}`, r.length, `${a.join(", ")}`, r;
344
- }))), we;
343
+ return Ie(), `${r.length}`, r.length, `${a.join(", ")}`, r;
344
+ }))), be;
345
345
  }
346
- class Pt extends Je {
346
+ class _t extends tt {
347
347
  async getAccount(e) {
348
348
  const { dappName: n, userAccountAddress: r } = e;
349
349
  if (!r)
350
- throw new P("WIDGET.NO_ACCOUNTS_FOUND", { context: { error: "No account address provided" } });
351
- const a = await St(n);
350
+ throw new O("WIDGET.NO_ACCOUNTS_FOUND", { context: { error: "No account address provided" } });
351
+ const a = await Dt(n);
352
352
  if (a.length === 0)
353
- throw new P("WIDGET.NO_EXTENSION_FOUND");
353
+ throw new O("WIDGET.NO_EXTENSION_FOUND");
354
354
  for (const o of a) {
355
355
  const c = (await o.accounts.get()).find((i) => i.address === r);
356
356
  if (c)
357
357
  return { account: c, extension: o };
358
358
  }
359
- throw new P("WIDGET.ACCOUNT_NOT_FOUND", {
359
+ throw new O("WIDGET.ACCOUNT_NOT_FOUND", {
360
360
  context: { error: `No account found matching ${r}` }
361
361
  });
362
362
  }
363
363
  }
364
- async function Ot(t) {
364
+ async function Lt(t) {
365
365
  try {
366
366
  const e = await fetch(t);
367
367
  if (!e.ok)
368
- throw new ae("API.BAD_REQUEST", {
368
+ throw new M("API.BAD_REQUEST", {
369
369
  context: { error: `Network response was not ok, status: ${e.status}`, url: t }
370
370
  });
371
371
  const n = await e.arrayBuffer();
@@ -374,48 +374,48 @@ async function Ot(t) {
374
374
  throw new C("DATABASE.IMAGE_GET_FAILED", { context: { error: e } });
375
375
  }
376
376
  }
377
- const Dt = "NO_SOLUTION";
378
- function Ie(t, e = !1, n = !1, r) {
377
+ const Ht = "NO_SOLUTION";
378
+ function Ne(t, e = !1, n = !1, r) {
379
379
  try {
380
380
  const a = t.items.map((o, s) => {
381
381
  if (o.hash)
382
382
  return o.hash;
383
- throw new z("CAPTCHA.MISSING_ITEM_HASH", {
383
+ throw new M("CAPTCHA.MISSING_ITEM_HASH", {
384
384
  context: {
385
- computeCaptchaHashName: Ie.name,
385
+ computeCaptchaHashName: Ne.name,
386
386
  index: s
387
387
  }
388
388
  });
389
389
  });
390
390
  return $([
391
391
  t.target,
392
- ...e ? kt(t.solution) : [],
392
+ ...e ? Rt(t.solution) : [],
393
393
  n ? t.salt : "",
394
394
  r ? a.sort() : a
395
395
  ]);
396
396
  } catch (a) {
397
- throw new z("DATASET.HASH_ERROR", { context: { error: a } });
397
+ throw new M("DATASET.HASH_ERROR", { context: { error: a } });
398
398
  }
399
399
  }
400
- function kt(t) {
401
- return t !== void 0 ? t.sort() : [Dt];
400
+ function Rt(t) {
401
+ return t !== void 0 ? t.sort() : [Ht];
402
402
  }
403
- async function Ht(t) {
403
+ async function Mt(t) {
404
404
  if (t.type === "text")
405
- return { ...t, hash: de(t.data) };
405
+ return { ...t, hash: pe(t.data) };
406
406
  if (t.type === "image")
407
- return { ...t, hash: de(await Ot(t.data)) };
408
- throw new z("CAPTCHA.INVALID_ITEM_FORMAT");
407
+ return { ...t, hash: pe(await Lt(t.data)) };
408
+ throw new M("CAPTCHA.INVALID_ITEM_FORMAT");
409
409
  }
410
- function Lt(t) {
410
+ function Ut(t) {
411
411
  return $([t.captchaId, t.captchaContentId, [...t.solution].sort(), t.salt]);
412
412
  }
413
- class be {
413
+ class ye {
414
414
  constructor(e) {
415
415
  this.hash = e, this.parent = null;
416
416
  }
417
417
  }
418
- class _t {
418
+ class Wt {
419
419
  constructor() {
420
420
  this.leaves = [], this.layers = [];
421
421
  }
@@ -423,7 +423,7 @@ class _t {
423
423
  this.layers.length && (this.layers = []);
424
424
  const n = [];
425
425
  for (const r of e) {
426
- const a = new be(r);
426
+ const a = new ye(r);
427
427
  this.leaves.push(a), n.push(a.hash);
428
428
  }
429
429
  this.layers.push(n), this.root = this.buildMerkleTree(this.leaves)[0];
@@ -438,14 +438,14 @@ class _t {
438
438
  for (; a < n; ) {
439
439
  const s = e[a];
440
440
  if (s === void 0)
441
- throw new P("DEVELOPER.GENERAL", { context: { error: "leftChild undefined" } });
441
+ throw new O("DEVELOPER.GENERAL", { context: { error: "leftChild undefined" } });
442
442
  const c = a + 1 < n ? g(e, a + 1) : s, i = this.createParent(s, c);
443
443
  o.push(i.hash), r.push(i), a += 2;
444
444
  }
445
445
  return this.layers.push(o), this.buildMerkleTree(r);
446
446
  }
447
447
  createParent(e, n) {
448
- const r = new be($([e.hash, n.hash]));
448
+ const r = new ye($([e.hash, n.hash]));
449
449
  return e.parent = r.hash, n.parent = r.hash, r;
450
450
  }
451
451
  proof(e) {
@@ -454,7 +454,7 @@ class _t {
454
454
  for (; r < this.layers.length - 1; ) {
455
455
  const o = this.layers[r];
456
456
  if (o === void 0)
457
- throw new P("DATASET.MERKLE_ERROR", {
457
+ throw new O("DATASET.MERKLE_ERROR", {
458
458
  context: { error: "layer undefined", failedFuncName: this.proof.name, layerNum: r }
459
459
  });
460
460
  const s = o.indexOf(e);
@@ -467,7 +467,7 @@ class _t {
467
467
  return [...n, [g(a, 0)]];
468
468
  }
469
469
  }
470
- function Rt(t, e) {
470
+ function jt(t, e) {
471
471
  try {
472
472
  if (g(e, 0).indexOf(t) === -1)
473
473
  return !1;
@@ -483,7 +483,7 @@ function Rt(t, e) {
483
483
  return !1;
484
484
  }
485
485
  }
486
- class Mt {
486
+ class Gt {
487
487
  constructor(e, n, r, a, o, s) {
488
488
  this.userAccount = e, this.contract = n, this.provider = r, this.providerApi = a, this._web2 = o, this.dappAccount = s;
489
489
  }
@@ -507,61 +507,61 @@ class Mt {
507
507
  if (e.provider.datasetIdContent.toString() !== g(o, 0))
508
508
  throw new C("CAPTCHA.INVALID_DATASET_CONTENT_ID");
509
509
  for (const s of n.captchas) {
510
- if (!Wt(s))
510
+ if (!zt(s))
511
511
  throw new C("CAPTCHA.INVALID_CAPTCHA_CHALLENGE");
512
- if (!Rt(s.captcha.captchaContentId, s.proof))
512
+ if (!jt(s.captcha.captchaContentId, s.proof))
513
513
  throw new C("CAPTCHA.INVALID_CAPTCHA_CHALLENGE");
514
514
  }
515
515
  }
516
516
  async submitCaptchaSolution(e, n, r, a, o) {
517
- const s = new _t(), c = a.map((v) => Lt(v));
517
+ const s = new Wt(), c = a.map((I) => Ut(I));
518
518
  s.build(c);
519
519
  const i = s.root.hash, p = void 0;
520
- let b;
520
+ let y;
521
521
  if (!e || !e.signRaw)
522
522
  throw new C("GENERAL.CANT_FIND_KEYRINGPAIR", {
523
523
  context: { error: "Signer is not defined, cannot sign message to prove account ownership" }
524
524
  });
525
525
  let m;
526
- b = (await e.signRaw({
526
+ y = (await e.signRaw({
527
527
  address: this.userAccount,
528
- data: ve(n),
528
+ data: Ae(n),
529
529
  type: "bytes"
530
530
  })).signature;
531
531
  try {
532
- m = await this.providerApi.submitCaptchaSolution(a, n, this.contract.pair.address, o, b);
533
- } catch (v) {
534
- throw new z("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", { context: { error: v } });
532
+ m = await this.providerApi.submitCaptchaSolution(a, n, this.contract.pair.address, o, y);
533
+ } catch (I) {
534
+ throw new M("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", { context: { error: I } });
535
535
  }
536
536
  return [m, i, p];
537
537
  }
538
538
  }
539
- async function Wt(t) {
539
+ async function zt(t) {
540
540
  const e = t.captcha, n = t.proof;
541
- if (!(await Promise.all(e.items.map(async (a) => (await Ht(a)).hash === a.hash))).every((a) => a === !0))
541
+ if (!(await Promise.all(e.items.map(async (a) => (await Mt(a)).hash === a.hash))).every((a) => a === !0))
542
542
  return !1;
543
- const r = Ie(e, !1, !1, !1);
543
+ const r = Ne(e, !1, !1, !1);
544
544
  return r !== e.captchaContentId ? !1 : g(n, 0).indexOf(r) !== -1;
545
545
  }
546
546
  const Te = "@prosopo/procaptcha";
547
- function ie() {
548
- return Ae.parse(JSON.parse(Qe(localStorage.getItem(Te) || "0x7b7d")));
547
+ function le() {
548
+ return Ee.parse(JSON.parse(nt(localStorage.getItem(Te) || "0x7b7d")));
549
549
  }
550
- function Ne(t) {
551
- localStorage.setItem(Te, ve(JSON.stringify(Ae.parse(t))));
550
+ function Se(t) {
551
+ localStorage.setItem(Te, Ae(JSON.stringify(Ee.parse(t))));
552
552
  }
553
- function Ut(t) {
554
- Ne({ ...ie(), account: t });
553
+ function Ft(t) {
554
+ Se({ ...le(), account: t });
555
555
  }
556
- function jt() {
557
- return ie().account || null;
556
+ function Bt() {
557
+ return le().account || null;
558
558
  }
559
- const G = {
560
- setAccount: Ut,
561
- getAccount: jt,
562
- setProcaptchaStorage: Ne,
563
- getProcaptchaStorage: ie
564
- }, Gt = () => ({
559
+ const F = {
560
+ setAccount: Ft,
561
+ getAccount: Bt,
562
+ setProcaptchaStorage: Se,
563
+ getProcaptchaStorage: le
564
+ }, Kt = () => ({
565
565
  showModal: !1,
566
566
  loading: !1,
567
567
  index: 0,
@@ -570,7 +570,7 @@ const G = {
570
570
  isHuman: !1,
571
571
  captchaApi: void 0,
572
572
  account: void 0
573
- }), ye = (t) => {
573
+ }), xe = (t) => {
574
574
  const e = t.networks[t.defaultNetwork];
575
575
  if (!e)
576
576
  throw new C("DEVELOPER.NETWORK_NOT_FOUND", {
@@ -578,16 +578,16 @@ const G = {
578
578
  });
579
579
  return e;
580
580
  };
581
- function zt(t, e, n, r) {
582
- const a = Ze(n, e, r), o = (l) => {
581
+ function $t(t, e, n, r) {
582
+ const a = rt(n, e, r), o = (l) => {
583
583
  const d = l instanceof Error ? l : new Error(String(l));
584
584
  a.onError(d);
585
- }, s = et(e, n), c = () => {
585
+ }, s = ot(e, n), c = () => {
586
586
  const l = {
587
587
  userAccountAddress: "",
588
588
  ...t
589
589
  };
590
- return e.account && (l.userAccountAddress = e.account.account.address), Ce.parse(l);
590
+ return e.account && (l.userAccountAddress = e.account.account.address), ve.parse(l);
591
591
  }, i = async (l) => {
592
592
  try {
593
593
  await l();
@@ -598,231 +598,245 @@ function zt(t, e, n, r) {
598
598
  a.onOpen(), await i(async () => {
599
599
  if (e.loading || e.isHuman)
600
600
  return;
601
- j(), s({ loading: !0 });
601
+ z(), s({ loading: !0 });
602
602
  const l = c();
603
- s({ dappAccount: l.account.address }), await tt(100);
604
- const d = await _(), h = await M();
603
+ s({ dappAccount: l.account.address }), await at(100);
604
+ const d = await R(), h = await W();
605
605
  let w = !1;
606
606
  try {
607
607
  w = (await h.query.dappOperatorIsHumanUser(d.account.address, l.solutionThreshold)).value.unwrap().unwrap();
608
- } catch (S) {
608
+ } catch (N) {
609
609
  }
610
610
  if (w) {
611
- s({ isHuman: !0, loading: !1 }), a.onHuman({
612
- user: d.account.address,
613
- dapp: x()
614
- }), L();
611
+ s({ isHuman: !0, loading: !1 }), a.onHuman(Y({
612
+ [b.user]: d.account.address,
613
+ [b.dapp]: v(),
614
+ [b.blockNumber]: A()
615
+ })), H();
615
616
  return;
616
617
  }
617
- const y = G.getProcaptchaStorage();
618
+ const x = F.getProcaptchaStorage();
618
619
  let D;
619
- if (y.providerUrl && y.blockNumber) {
620
- D = await R(y.providerUrl);
620
+ if (x.providerUrl && x.blockNumber) {
621
+ D = await U(x.providerUrl);
621
622
  try {
622
- const S = await D.verifyDappUser(x(), d.account.address, y.blockNumber, void 0, t.captchas.image.cachedTimeout);
623
- if (S.verified) {
623
+ const N = E(d);
624
+ if (!N || !N.signer || !N.signer.signRaw)
625
+ throw new C("ACCOUNT.NO_POLKADOT_EXTENSION");
626
+ const re = N.signer.signRaw, { signature: Oe } = await re({
627
+ address: d.account.address,
628
+ data: x.blockNumber.toString(),
629
+ type: "bytes"
630
+ }), ke = Y({
631
+ [b.user]: d.account.address,
632
+ [b.dapp]: v(),
633
+ [b.blockNumber]: x.blockNumber
634
+ }), oe = await D.verifyUser(ke, Oe, t.captchas.image.cachedTimeout);
635
+ if (oe.verified) {
624
636
  s({ isHuman: !0, loading: !1 });
625
- const ne = {
626
- [K.providerUrl]: y.providerUrl,
627
- [K.user]: d.account.address,
628
- [K.dapp]: x(),
629
- [K.commitmentId]: ue(S.commitmentId),
630
- [K.blockNumber]: S.blockNumber
637
+ const De = {
638
+ [b.providerUrl]: x.providerUrl,
639
+ [b.user]: d.account.address,
640
+ [b.dapp]: v(),
641
+ [b.commitmentId]: de(oe.commitmentId),
642
+ [b.blockNumber]: oe.blockNumber
631
643
  };
632
- a.onHuman(ne), L();
644
+ a.onHuman(Y(De)), H();
633
645
  return;
634
646
  }
635
647
  } catch {
636
- console.error("Error contacting provider from storage", y.providerUrl);
648
+ console.error("Error contacting provider from storage", x.providerUrl);
637
649
  }
638
650
  }
639
- const k = await pe(h.query.getRandomActiveProvider, h.query)(d.account.address, x()), H = parseInt(k.blockNumber.toString()), W = re(k.provider.url.toString());
640
- D = await R(W);
641
- const N = await (await Z(h, k, D)).getCaptchaChallenge();
642
- if (N.captchas.length <= 0)
643
- throw new ae("DEVELOPER.PROVIDER_NO_CAPTCHA");
644
- const ee = N.captchas.map((S) => S.captcha.timeLimitMs || l.captchas.image.challengeTimeout).reduce((S, ne) => S + ne), te = setTimeout(() => {
651
+ const _ = await he(h.query.getRandomActiveProvider, h.query)(d.account.address, v()), L = parseInt(_.blockNumber.toString()), j = ae(_.provider.url.toString());
652
+ D = await U(j);
653
+ const P = await (await ee(h, _, D)).getCaptchaChallenge();
654
+ if (P.captchas.length <= 0)
655
+ throw new M("DEVELOPER.PROVIDER_NO_CAPTCHA");
656
+ const te = P.captchas.map((N) => N.captcha.timeLimitMs || l.captchas.image.challengeTimeout).reduce((N, re) => N + re), ne = setTimeout(() => {
645
657
  a.onChallengeExpired(), s({ isHuman: !1, showModal: !1, loading: !1 });
646
- }, ee);
658
+ }, te);
647
659
  s({
648
660
  index: 0,
649
- solutions: N.captchas.map(() => []),
650
- challenge: N,
661
+ solutions: P.captchas.map(() => []),
662
+ challenge: P,
651
663
  showModal: !0,
652
- timeout: te,
653
- blockNumber: H
664
+ timeout: ne,
665
+ blockNumber: L
654
666
  });
655
667
  });
656
- }, b = async () => {
668
+ }, y = async () => {
657
669
  await i(async () => {
658
- if (U(), !e.challenge)
659
- throw new P("CAPTCHA.NO_CAPTCHA", {
670
+ if (G(), !e.challenge)
671
+ throw new O("CAPTCHA.NO_CAPTCHA", {
660
672
  context: { error: "Cannot submit, no Captcha found in state" }
661
673
  });
662
674
  s({ showModal: !1 });
663
- const l = e.challenge, d = nt(), h = e.challenge.captchas.map((N, ee) => {
664
- const te = g(e.solutions, ee);
675
+ const l = e.challenge, d = st(), h = e.challenge.captchas.map((P, te) => {
676
+ const ne = g(e.solutions, te);
665
677
  return {
666
- captchaId: N.captcha.captchaId,
667
- captchaContentId: N.captcha.captchaContentId,
678
+ captchaId: P.captcha.captchaId,
679
+ captchaContentId: P.captcha.captchaContentId,
668
680
  salt: d,
669
- solution: te
681
+ solution: ne
670
682
  };
671
- }), w = T(), y = A(), D = E(w).signer, k = g(l.captchas, 0);
672
- if (!k.captcha.datasetId)
673
- throw new z("CAPTCHA.INVALID_CAPTCHA_ID", {
683
+ }), w = S(), x = A(), D = E(w).signer, _ = g(l.captchas, 0);
684
+ if (!_.captcha.datasetId)
685
+ throw new M("CAPTCHA.INVALID_CAPTCHA_ID", {
674
686
  context: { error: "No datasetId set for challenge" }
675
687
  });
676
- const H = F(), W = await H.submitCaptchaSolution(D, l.requestHash, k.captcha.datasetId, h, d), B = W[0].verified;
677
- if (B || a.onFailed(), s({
678
- submission: W,
679
- isHuman: B,
688
+ const L = B(), j = await L.submitCaptchaSolution(D, l.requestHash, _.captcha.datasetId, h, d), K = j[0].verified;
689
+ if (K || a.onFailed(), s({
690
+ submission: j,
691
+ isHuman: K,
680
692
  loading: !1
681
693
  }), e.isHuman) {
682
- const N = re(H.provider.provider.url.toString());
683
- G.setProcaptchaStorage({ ...G.getProcaptchaStorage(), providerUrl: N, blockNumber: y }), a.onHuman({
684
- providerUrl: N,
685
- user: w.account.address,
686
- dapp: x(),
687
- commitmentId: ue(W[1]),
688
- blockNumber: y
689
- }), L();
694
+ const P = ae(L.provider.provider.url.toString());
695
+ F.setProcaptchaStorage({ ...F.getProcaptchaStorage(), providerUrl: P, blockNumber: x }), a.onHuman(Y({
696
+ [b.providerUrl]: P,
697
+ [b.user]: w.account.address,
698
+ [b.dapp]: v(),
699
+ [b.commitmentId]: de(j[1]),
700
+ [b.blockNumber]: x
701
+ })), H();
690
702
  }
691
703
  });
692
704
  }, m = async () => {
693
- U(), j(), a.onClose();
694
- }, O = (l) => {
705
+ G(), z(), a.onClose();
706
+ }, k = (l) => {
695
707
  if (!e.challenge)
696
- throw new P("CAPTCHA.NO_CAPTCHA", {
708
+ throw new O("CAPTCHA.NO_CAPTCHA", {
697
709
  context: { error: "Cannot select, no Captcha found in state" }
698
710
  });
699
711
  if (e.index >= e.challenge.captchas.length || e.index < 0)
700
- throw new P("CAPTCHA.NO_CAPTCHA", {
712
+ throw new O("CAPTCHA.NO_CAPTCHA", {
701
713
  context: { error: "Cannot select, index is out of range for this Captcha" }
702
714
  });
703
715
  const d = e.index, h = e.solutions, w = g(h, d);
704
716
  w.includes(l) ? w.splice(w.indexOf(l), 1) : w.push(l), s({ solutions: h });
705
- }, v = () => {
717
+ }, I = () => {
706
718
  if (!e.challenge)
707
- throw new P("CAPTCHA.NO_CAPTCHA", {
719
+ throw new O("CAPTCHA.NO_CAPTCHA", {
708
720
  context: { error: "Cannot select, no Captcha found in state" }
709
721
  });
710
722
  if (e.index + 1 >= e.challenge.captchas.length)
711
- throw new P("CAPTCHA.NO_CAPTCHA", {
723
+ throw new O("CAPTCHA.NO_CAPTCHA", {
712
724
  context: { error: "Cannot select, index is out of range for this Captcha" }
713
725
  });
714
726
  s({ index: e.index + 1 });
715
- }, Z = async (l, d, h) => {
716
- const w = c(), y = new Mt(T().account.address, l, d, h, w.web2, x());
717
- return s({ captchaApi: y }), F();
718
- }, R = async (l) => {
719
- const d = c(), h = ye(d);
727
+ }, ee = async (l, d, h) => {
728
+ const w = c(), x = new Gt(S().account.address, l, d, h, w.web2, v());
729
+ return s({ captchaApi: x }), B();
730
+ }, U = async (l) => {
731
+ const d = c(), h = xe(d);
720
732
  if (!d.account.address)
721
733
  throw new C("GENERAL.SITE_KEY_MISSING");
722
- return new rt(h, l, d.account.address);
723
- }, U = () => {
734
+ return new ct(h, l, d.account.address);
735
+ }, G = () => {
724
736
  window.clearTimeout(e.timeout), s({ timeout: void 0 });
725
- }, L = () => {
737
+ }, H = () => {
726
738
  const l = t.captchas.image.solutionTimeout, d = setTimeout(() => {
727
739
  s({ isHuman: !1 }), a.onExpired();
728
740
  }, l);
729
741
  s({ successfullChallengeTimeout: d });
730
- }, j = () => {
731
- U(), s(Gt());
732
- }, F = () => {
742
+ }, z = () => {
743
+ G(), s(Kt());
744
+ }, B = () => {
733
745
  if (!e.captchaApi)
734
- throw new ae("API.UNKNOWN", { context: { error: "Captcha api not set", state: e } });
746
+ throw new C("API.UNKNOWN", {
747
+ context: { error: "Captcha api not set", state: e }
748
+ });
735
749
  return e.captchaApi;
736
- }, _ = async () => {
750
+ }, R = async () => {
737
751
  const l = c();
738
752
  if (!l.web2 && !l.userAccountAddress)
739
753
  throw new C("GENERAL.ACCOUNT_NOT_FOUND", {
740
754
  context: { error: "Account address has not been set for web3 mode" }
741
755
  });
742
- const h = await (l.web2 ? new ot() : new Pt()).getAccount(l);
743
- return G.setAccount(h.account.address), s({ account: h }), T();
744
- }, T = () => {
756
+ const h = await (l.web2 ? new it() : new _t()).getAccount(l);
757
+ return F.setAccount(h.account.address), s({ account: h }), S();
758
+ }, S = () => {
745
759
  if (!e.account)
746
760
  throw new C("GENERAL.ACCOUNT_NOT_FOUND", { context: { error: "Account not loaded" } });
747
761
  return e.account;
748
- }, x = () => {
762
+ }, v = () => {
749
763
  if (!e.dappAccount)
750
764
  throw new C("GENERAL.SITE_KEY_MISSING");
751
765
  return e.dappAccount;
752
766
  }, A = () => {
753
767
  if (!e.blockNumber)
754
- throw new at("CAPTCHA.INVALID_BLOCK_NO", { context: { error: "Block number not found" } });
768
+ throw new lt("CAPTCHA.INVALID_BLOCK_NO", { context: { error: "Block number not found" } });
755
769
  return e.blockNumber;
756
770
  }, E = (l) => {
757
- if (l = l || T(), !l.extension)
771
+ if (l = l || S(), !l.extension)
758
772
  throw new C("ACCOUNT.NO_POLKADOT_EXTENSION", { context: { error: "Extension not loaded" } });
759
773
  return l.extension;
760
- }, M = async () => {
761
- const l = c(), d = ye(l), h = await st.create({
762
- provider: new ct(d.endpoint),
774
+ }, W = async () => {
775
+ const l = c(), d = xe(l), h = await ut.create({
776
+ provider: new dt(d.endpoint),
763
777
  initWasm: !1,
764
778
  noInitWarn: !0
765
- }), w = "sr25519", y = new it({ type: w, ss58Format: h.registry.chainSS58 });
766
- return new lt(h, JSON.parse(ut), d.contract.address, "prosopo", 0, y.addFromAddress(T().account.address));
779
+ }), w = "sr25519", x = new pt({ type: w, ss58Format: h.registry.chainSS58 });
780
+ return new ht(h, JSON.parse(ft), d.contract.address, "prosopo", 0, x.addFromAddress(S().account.address));
767
781
  };
768
782
  return {
769
783
  start: p,
770
784
  cancel: m,
771
- submit: b,
772
- select: O,
773
- nextRound: v,
785
+ submit: y,
786
+ select: k,
787
+ nextRound: I,
774
788
  exportData: async (l) => {
775
- var k;
776
- const h = G.getProcaptchaStorage().providerUrl;
789
+ var _;
790
+ const h = F.getProcaptchaStorage().providerUrl;
777
791
  let w;
778
792
  if (h)
779
- w = await R(h);
793
+ w = await U(h);
780
794
  else {
781
- const H = await M(), W = await pe(H.query.getRandomActiveProvider, H.query)(T().account.address, x()), B = re(W.provider.url.toString());
782
- w = await R(B);
795
+ const L = await W(), j = await he(L.query.getRandomActiveProvider, L.query)(S().account.address, v()), K = ae(j.provider.url.toString());
796
+ w = await U(K);
783
797
  }
784
- if (!(G.getProcaptchaStorage().providerUrl || ((k = e.captchaApi) == null ? void 0 : k.provider.provider.url.toString())))
798
+ if (!(F.getProcaptchaStorage().providerUrl || ((_ = e.captchaApi) == null ? void 0 : _.provider.provider.url.toString())))
785
799
  return;
786
800
  let D = "";
787
801
  try {
788
- D = T().account.address;
789
- } catch (H) {
790
- console.error(H);
802
+ D = S().account.address;
803
+ } catch (L) {
804
+ console.error(L);
791
805
  }
792
806
  await w.submitUserEvents(l, D);
793
807
  }
794
808
  };
795
809
  }
796
- const Ft = 1e4, le = (t, e) => {
810
+ const Vt = 1e4, ue = (t, e) => {
797
811
  e((n) => {
798
812
  let r = [...n, t];
799
- return r.length > Ft && (r = r.slice(1)), r;
813
+ return r.length > Vt && (r = r.slice(1)), r;
800
814
  });
801
- }, Bt = (t, e) => {
815
+ }, Xt = (t, e) => {
802
816
  const n = {
803
817
  x: t.x,
804
818
  y: t.y,
805
819
  timestamp: t.timeStamp
806
820
  };
807
- le(n, e);
808
- }, xe = (t, e) => {
821
+ ue(n, e);
822
+ }, Ce = (t, e) => {
809
823
  const n = {
810
824
  key: t.key,
811
825
  timestamp: t.timeStamp,
812
826
  isShiftKey: t.shiftKey,
813
827
  isCtrlKey: t.ctrlKey
814
828
  };
815
- le(n, e);
816
- }, X = (t, e) => {
829
+ ue(n, e);
830
+ }, q = (t, e) => {
817
831
  for (const n of Array.from(t.touches))
818
- le({ x: n.clientX, y: n.clientY, timestamp: t.timeStamp }, e);
819
- }, Kt = (t, e, n, r) => {
820
- const a = Se(r);
821
- a && (a.addEventListener("mousemove", (o) => Bt(o, t)), a.addEventListener("keydown", (o) => xe(o, n)), a.addEventListener("keyup", (o) => xe(o, n)), a.addEventListener("touchstart", (o) => X(o, e)), a.addEventListener("touchend", (o) => X(o, e)), a.addEventListener("touchcancel", (o) => X(o, e)), a.addEventListener("touchmove", (o) => X(o, e)));
822
- }, Se = (t) => t.tagName === "FORM" ? t : t.parentElement ? Se(t.parentElement) : null, $t = ({ onProcessData: t, sendData: e, account: n }) => {
832
+ ue({ x: n.clientX, y: n.clientY, timestamp: t.timeStamp }, e);
833
+ }, Yt = (t, e, n, r) => {
834
+ const a = Pe(r);
835
+ a && (a.addEventListener("mousemove", (o) => Xt(o, t)), a.addEventListener("keydown", (o) => Ce(o, n)), a.addEventListener("keyup", (o) => Ce(o, n)), a.addEventListener("touchstart", (o) => q(o, e)), a.addEventListener("touchend", (o) => q(o, e)), a.addEventListener("touchcancel", (o) => q(o, e)), a.addEventListener("touchmove", (o) => q(o, e)));
836
+ }, Pe = (t) => t.tagName === "FORM" ? t : t.parentElement ? Pe(t.parentElement) : null, qt = ({ onProcessData: t, sendData: e, account: n }) => {
823
837
  const [r, a] = f.useState([]), [o, s] = f.useState([]), [c, i] = f.useState([]), p = f.useRef(null);
824
838
  return f.useEffect(() => {
825
- p && p.current && Kt(a, s, i, p.current);
839
+ p && p.current && Yt(a, s, i, p.current);
826
840
  }, []), f.useEffect(() => {
827
841
  n && t({
828
842
  mouseEvents: r,
@@ -830,7 +844,7 @@ const Ft = 1e4, le = (t, e) => {
830
844
  keyboardEvents: c
831
845
  });
832
846
  }, [e, n]), u("div", { ref: p });
833
- }, Vt = Pe.memo((t, e) => {
847
+ }, Jt = _e.memo((t, e) => {
834
848
  const { show: n, children: r } = t, o = {
835
849
  position: "fixed",
836
850
  zIndex: 2147483646,
@@ -857,25 +871,25 @@ const Ft = 1e4, le = (t, e) => {
857
871
  border: "none",
858
872
  boxShadow: "rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px,"
859
873
  };
860
- return I("div", { className: "modalOuter", style: o, children: [u("div", { className: "modalBackground", style: s }), u("div", { className: "modalInner", style: c, children: r })] });
861
- }), qt = (t) => {
862
- const e = Ce.parse(t.config), n = t.callbacks || {}, [r, a] = dt(f.useState, f.useRef), o = zt(e, r, a, n), s = t.config.theme === "light" ? "light" : "dark", c = t.config.theme === "light" ? J : Q;
863
- return u("div", { children: I("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: [u(Vt, { show: r.showModal, children: r.challenge ? u(It, { challenge: r.challenge, index: r.index, solutions: r.solutions, onSubmit: o.submit, onCancel: o.cancel, onClick: o.select, onNext: o.nextRound, themeColor: e.theme ?? "light" }) : u("div", { children: "No challenge set." }) }), I(Oe, { children: [u(De, { children: I("div", { style: ke, "data-cy": "button-human", children: [" ", I("div", { style: {
864
- padding: He,
865
- border: Le,
874
+ return T("div", { className: "modalOuter", style: o, children: [u("div", { className: "modalBackground", style: s }), u("div", { className: "modalInner", style: c, children: r })] });
875
+ }), en = (t) => {
876
+ const e = ve.parse(t.config), n = t.callbacks || {}, [r, a] = gt(f.useState, f.useRef), o = $t(e, r, a, n), s = t.config.theme === "light" ? "light" : "dark", c = t.config.theme === "light" ? Q : Z;
877
+ return u("div", { children: T("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: [u(Jt, { show: r.showModal, children: r.challenge ? u(Pt, { challenge: r.challenge, index: r.index, solutions: r.solutions, onSubmit: o.submit, onCancel: o.cancel, onClick: o.select, onNext: o.nextRound, themeColor: e.theme ?? "light" }) : u("div", { children: "No challenge set." }) }), T(Le, { children: [u(He, { children: T("div", { style: Re, "data-cy": "button-human", children: [" ", T("div", { style: {
878
+ padding: Me,
879
+ border: Ue,
866
880
  backgroundColor: c.palette.background.default,
867
881
  borderColor: c.palette.grey[300],
868
- borderRadius: _e,
882
+ borderRadius: We,
869
883
  display: "flex",
870
884
  alignItems: "center",
871
885
  flexWrap: "wrap",
872
886
  justifyContent: "space-between",
873
- minHeight: `${Re}px`,
887
+ minHeight: `${je}px`,
874
888
  overflow: "hidden"
875
889
  }, children: [u("div", { style: { display: "inline-flex", flexDirection: "column" }, children: u("div", { style: {
876
890
  alignItems: "center",
877
891
  flex: 1
878
- }, children: I("div", { style: {
892
+ }, children: T("div", { style: {
879
893
  display: "flex",
880
894
  alignItems: "center",
881
895
  justifyContent: "center",
@@ -883,10 +897,10 @@ const Ft = 1e4, le = (t, e) => {
883
897
  verticalAlign: "middle"
884
898
  }, children: [u("div", { style: {
885
899
  display: r.loading ? "none" : "flex"
886
- }, children: u(pt, { themeColor: s, onChange: o.start, checked: r.isHuman, labelText: "I am human" }) }), u("div", { style: {
900
+ }, children: u(mt, { themeColor: s, onChange: o.start, checked: r.isHuman, labelText: "I am human" }) }), u("div", { style: {
887
901
  display: r.loading ? "flex" : "none"
888
- }, children: u("div", { style: { display: "inline-flex" }, children: u(Me, { themeColor: s }) }) })] }) }) }), u("div", { style: { display: "inline-flex", flexDirection: "column" }, children: u("a", { href: We, target: "_blank", "aria-label": Ue, children: u("div", { style: { flex: 1 }, children: u(je, { themeColor: s }) }) }) })] })] }) }), e.devOnlyWatchEvents && u($t, { onProcessData: o.exportData, sendData: r.sendData, account: r.account })] })] }) });
902
+ }, children: u("div", { style: { display: "inline-flex" }, children: u(Ge, { themeColor: s }) }) })] }) }) }), u("div", { style: { display: "inline-flex", flexDirection: "column" }, children: u("a", { href: ze, target: "_blank", "aria-label": Fe, children: u("div", { style: { flex: 1 }, children: u(Be, { themeColor: s }) }) }) })] })] }) }), e.devOnlyWatchEvents && u(qt, { onProcessData: o.exportData, sendData: r.sendData, account: r.account })] })] }) });
889
903
  };
890
904
  export {
891
- qt as default
905
+ en as default
892
906
  };