altcha 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/altcha.js CHANGED
@@ -1,37 +1,37 @@
1
- var Ge = Object.defineProperty;
2
- var Se = (t, e, n) => e in t ? Ge(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var L = (t, e, n) => (Se(t, typeof e != "symbol" ? e + "" : e, n), n);
4
- function Z() {
1
+ var Xe = Object.defineProperty;
2
+ var Ye = (t, e, r) => e in t ? Xe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var N = (t, e, r) => (Ye(t, typeof e != "symbol" ? e + "" : e, r), r);
4
+ function X() {
5
5
  }
6
- function ge(t) {
6
+ function xe(t) {
7
7
  return t();
8
8
  }
9
- function ie() {
9
+ function me() {
10
10
  return /* @__PURE__ */ Object.create(null);
11
11
  }
12
- function P(t) {
13
- t.forEach(ge);
12
+ function B(t) {
13
+ t.forEach(xe);
14
14
  }
15
- function be(t) {
15
+ function Ce(t) {
16
16
  return typeof t == "function";
17
17
  }
18
- function Ue(t, e) {
18
+ function Ke(t, e) {
19
19
  return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
20
20
  }
21
- function Ve(t) {
21
+ function Be(t) {
22
22
  return Object.keys(t).length === 0;
23
23
  }
24
- function b(t, e) {
24
+ function v(t, e) {
25
25
  t.appendChild(e);
26
26
  }
27
- function Me(t, e, n) {
28
- const o = Fe(t);
29
- if (!o.getElementById(e)) {
30
- const l = $("style");
31
- l.id = e, l.textContent = n, Oe(o, l);
27
+ function We(t, e, r) {
28
+ const n = Je(t);
29
+ if (!n.getElementById(e)) {
30
+ const o = p("style");
31
+ o.id = e, o.textContent = r, Qe(n, o);
32
32
  }
33
33
  }
34
- function Fe(t) {
34
+ function Je(t) {
35
35
  if (!t)
36
36
  return document;
37
37
  const e = t.getRootNode ? t.getRootNode() : t.ownerDocument;
@@ -41,168 +41,168 @@ function Fe(t) {
41
41
  e
42
42
  ) : t.ownerDocument;
43
43
  }
44
- function Oe(t, e) {
45
- return b(
44
+ function Qe(t, e) {
45
+ return v(
46
46
  /** @type {Document} */
47
47
  t.head || t,
48
48
  e
49
49
  ), e.sheet;
50
50
  }
51
- function N(t, e, n) {
52
- t.insertBefore(e, n || null);
51
+ function I(t, e, r) {
52
+ t.insertBefore(e, r || null);
53
53
  }
54
- function I(t) {
54
+ function L(t) {
55
55
  t.parentNode && t.parentNode.removeChild(t);
56
56
  }
57
- function $(t) {
57
+ function p(t) {
58
58
  return document.createElement(t);
59
59
  }
60
60
  function S(t) {
61
61
  return document.createElementNS("http://www.w3.org/2000/svg", t);
62
62
  }
63
- function Ye(t) {
63
+ function ze(t) {
64
64
  return document.createTextNode(t);
65
65
  }
66
- function M() {
67
- return Ye(" ");
66
+ function Z() {
67
+ return ze(" ");
68
68
  }
69
- function K(t, e, n, o) {
70
- return t.addEventListener(e, n, o), () => t.removeEventListener(e, n, o);
69
+ function re(t, e, r, n) {
70
+ return t.addEventListener(e, r, n), () => t.removeEventListener(e, r, n);
71
71
  }
72
- function c(t, e, n) {
73
- n == null ? t.removeAttribute(e) : t.getAttribute(e) !== n && t.setAttribute(e, n);
72
+ function c(t, e, r) {
73
+ r == null ? t.removeAttribute(e) : t.getAttribute(e) !== r && t.setAttribute(e, r);
74
74
  }
75
- function Ze(t) {
75
+ function qe(t) {
76
76
  return Array.from(t.childNodes);
77
77
  }
78
- function le(t, e, n) {
79
- t.classList.toggle(e, !!n);
78
+ function ve(t, e, r) {
79
+ t.classList.toggle(e, !!r);
80
80
  }
81
- function Be(t, e, { bubbles: n = !1, cancelable: o = !1 } = {}) {
82
- return new CustomEvent(t, { detail: e, bubbles: n, cancelable: o });
81
+ function et(t, e, { bubbles: r = !1, cancelable: n = !1 } = {}) {
82
+ return new CustomEvent(t, { detail: e, bubbles: r, cancelable: n });
83
83
  }
84
- function He(t) {
84
+ function tt(t) {
85
85
  const e = {};
86
86
  return t.childNodes.forEach(
87
87
  /** @param {Element} node */
88
- (n) => {
89
- e[n.slot || "default"] = !0;
88
+ (r) => {
89
+ e[r.slot || "default"] = !0;
90
90
  }
91
91
  ), e;
92
92
  }
93
- let W;
94
- function H(t) {
95
- W = t;
93
+ let K;
94
+ function Y(t) {
95
+ K = t;
96
96
  }
97
- function ee() {
98
- if (!W)
97
+ function se() {
98
+ if (!K)
99
99
  throw new Error("Function called outside component initialization");
100
- return W;
100
+ return K;
101
101
  }
102
- function We(t) {
103
- ee().$$.on_mount.push(t);
102
+ function rt(t) {
103
+ se().$$.on_mount.push(t);
104
104
  }
105
- function Pe(t) {
106
- ee().$$.on_destroy.push(t);
105
+ function nt(t) {
106
+ se().$$.on_destroy.push(t);
107
107
  }
108
- function Te() {
109
- const t = ee();
110
- return (e, n, { cancelable: o = !1 } = {}) => {
111
- const l = t.$$.callbacks[e];
112
- if (l) {
113
- const r = Be(
108
+ function it() {
109
+ const t = se();
110
+ return (e, r, { cancelable: n = !1 } = {}) => {
111
+ const o = t.$$.callbacks[e];
112
+ if (o) {
113
+ const l = et(
114
114
  /** @type {string} */
115
115
  e,
116
- n,
117
- { cancelable: o }
116
+ r,
117
+ { cancelable: n }
118
118
  );
119
- return l.slice().forEach((s) => {
120
- s.call(t, r);
121
- }), !r.defaultPrevented;
119
+ return o.slice().forEach((s) => {
120
+ s.call(t, l);
121
+ }), !l.defaultPrevented;
122
122
  }
123
123
  return !0;
124
124
  };
125
125
  }
126
- const O = [], J = [];
127
- let Y = [];
128
- const se = [], me = /* @__PURE__ */ Promise.resolve();
129
- let Q = !1;
130
- function ve() {
131
- Q || (Q = !0, me.then(C));
126
+ const D = [], ie = [];
127
+ let P = [];
128
+ const we = [], Le = /* @__PURE__ */ Promise.resolve();
129
+ let oe = !1;
130
+ function Ie() {
131
+ oe || (oe = !0, Le.then(C));
132
132
  }
133
- function Xe() {
134
- return ve(), me;
133
+ function ot() {
134
+ return Ie(), Le;
135
135
  }
136
- function q(t) {
137
- Y.push(t);
136
+ function le(t) {
137
+ P.push(t);
138
138
  }
139
- const z = /* @__PURE__ */ new Set();
140
- let F = 0;
139
+ const ne = /* @__PURE__ */ new Set();
140
+ let U = 0;
141
141
  function C() {
142
- if (F !== 0)
142
+ if (U !== 0)
143
143
  return;
144
- const t = W;
144
+ const t = K;
145
145
  do {
146
146
  try {
147
- for (; F < O.length; ) {
148
- const e = O[F];
149
- F++, H(e), De(e.$$);
147
+ for (; U < D.length; ) {
148
+ const e = D[U];
149
+ U++, Y(e), lt(e.$$);
150
150
  }
151
151
  } catch (e) {
152
- throw O.length = 0, F = 0, e;
152
+ throw D.length = 0, U = 0, e;
153
153
  }
154
- for (H(null), O.length = 0, F = 0; J.length; )
155
- J.pop()();
156
- for (let e = 0; e < Y.length; e += 1) {
157
- const n = Y[e];
158
- z.has(n) || (z.add(n), n());
154
+ for (Y(null), D.length = 0, U = 0; ie.length; )
155
+ ie.pop()();
156
+ for (let e = 0; e < P.length; e += 1) {
157
+ const r = P[e];
158
+ ne.has(r) || (ne.add(r), r());
159
159
  }
160
- Y.length = 0;
161
- } while (O.length);
162
- for (; se.length; )
163
- se.pop()();
164
- Q = !1, z.clear(), H(t);
160
+ P.length = 0;
161
+ } while (D.length);
162
+ for (; we.length; )
163
+ we.pop()();
164
+ oe = !1, ne.clear(), Y(t);
165
165
  }
166
- function De(t) {
166
+ function lt(t) {
167
167
  if (t.fragment !== null) {
168
- t.update(), P(t.before_update);
168
+ t.update(), B(t.before_update);
169
169
  const e = t.dirty;
170
- t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(q);
170
+ t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(le);
171
171
  }
172
172
  }
173
- function Ke(t) {
174
- const e = [], n = [];
175
- Y.forEach((o) => t.indexOf(o) === -1 ? e.push(o) : n.push(o)), n.forEach((o) => o()), Y = e;
173
+ function st(t) {
174
+ const e = [], r = [];
175
+ P.forEach((n) => t.indexOf(n) === -1 ? e.push(n) : r.push(n)), r.forEach((n) => n()), P = e;
176
176
  }
177
- const ze = /* @__PURE__ */ new Set();
178
- function Je(t, e) {
179
- t && t.i && (ze.delete(t), t.i(e));
177
+ const ct = /* @__PURE__ */ new Set();
178
+ function ut(t, e) {
179
+ t && t.i && (ct.delete(t), t.i(e));
180
180
  }
181
- function Qe(t, e, n) {
182
- const { fragment: o, after_update: l } = t.$$;
183
- o && o.m(e, n), q(() => {
184
- const r = t.$$.on_mount.map(ge).filter(be);
185
- t.$$.on_destroy ? t.$$.on_destroy.push(...r) : P(r), t.$$.on_mount = [];
186
- }), l.forEach(q);
181
+ function at(t, e, r) {
182
+ const { fragment: n, after_update: o } = t.$$;
183
+ n && n.m(e, r), le(() => {
184
+ const l = t.$$.on_mount.map(xe).filter(Ce);
185
+ t.$$.on_destroy ? t.$$.on_destroy.push(...l) : B(l), t.$$.on_mount = [];
186
+ }), o.forEach(le);
187
187
  }
188
- function qe(t, e) {
189
- const n = t.$$;
190
- n.fragment !== null && (Ke(n.after_update), P(n.on_destroy), n.fragment && n.fragment.d(e), n.on_destroy = n.fragment = null, n.ctx = []);
188
+ function ft(t, e) {
189
+ const r = t.$$;
190
+ r.fragment !== null && (st(r.after_update), B(r.on_destroy), r.fragment && r.fragment.d(e), r.on_destroy = r.fragment = null, r.ctx = []);
191
191
  }
192
- function et(t, e) {
193
- t.$$.dirty[0] === -1 && (O.push(t), ve(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31;
192
+ function ht(t, e) {
193
+ t.$$.dirty[0] === -1 && (D.push(t), Ie(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31;
194
194
  }
195
- function tt(t, e, n, o, l, r, s = null, u = [-1]) {
196
- const f = W;
197
- H(t);
195
+ function dt(t, e, r, n, o, l, s = null, u = [-1]) {
196
+ const f = K;
197
+ Y(t);
198
198
  const a = t.$$ = {
199
199
  fragment: null,
200
200
  ctx: [],
201
201
  // state
202
- props: r,
203
- update: Z,
204
- not_equal: l,
205
- bound: ie(),
202
+ props: l,
203
+ update: X,
204
+ not_equal: o,
205
+ bound: me(),
206
206
  // lifecycle
207
207
  on_mount: [],
208
208
  on_destroy: [],
@@ -211,124 +211,124 @@ function tt(t, e, n, o, l, r, s = null, u = [-1]) {
211
211
  after_update: [],
212
212
  context: new Map(e.context || (f ? f.$$.context : [])),
213
213
  // everything else
214
- callbacks: ie(),
214
+ callbacks: me(),
215
215
  dirty: u,
216
216
  skip_bound: !1,
217
217
  root: e.target || f.$$.root
218
218
  };
219
219
  s && s(a.root);
220
- let R = !1;
221
- if (a.ctx = n ? n(t, e.props || {}, (p, j, ...x) => {
222
- const A = x.length ? x[0] : j;
223
- return a.ctx && l(a.ctx[p], a.ctx[p] = A) && (!a.skip_bound && a.bound[p] && a.bound[p](A), R && et(t, p)), j;
224
- }) : [], a.update(), R = !0, P(a.before_update), a.fragment = o ? o(a.ctx) : !1, e.target) {
220
+ let y = !1;
221
+ if (a.ctx = r ? r(t, e.props || {}, (w, R, ...M) => {
222
+ const j = M.length ? M[0] : R;
223
+ return a.ctx && o(a.ctx[w], a.ctx[w] = j) && (!a.skip_bound && a.bound[w] && a.bound[w](j), y && ht(t, w)), R;
224
+ }) : [], a.update(), y = !0, B(a.before_update), a.fragment = n ? n(a.ctx) : !1, e.target) {
225
225
  if (e.hydrate) {
226
- const p = Ze(e.target);
227
- a.fragment && a.fragment.l(p), p.forEach(I);
226
+ const w = qe(e.target);
227
+ a.fragment && a.fragment.l(w), w.forEach(L);
228
228
  } else
229
229
  a.fragment && a.fragment.c();
230
- e.intro && Je(t.$$.fragment), Qe(t, e.target, e.anchor), C();
230
+ e.intro && ut(t.$$.fragment), at(t, e.target, e.anchor), C();
231
231
  }
232
- H(f);
232
+ Y(f);
233
233
  }
234
- let _e;
235
- typeof HTMLElement == "function" && (_e = class extends HTMLElement {
236
- constructor(e, n, o) {
234
+ let Re;
235
+ typeof HTMLElement == "function" && (Re = class extends HTMLElement {
236
+ constructor(e, r, n) {
237
237
  super();
238
238
  /** The Svelte component constructor */
239
- L(this, "$$ctor");
239
+ N(this, "$$ctor");
240
240
  /** Slots */
241
- L(this, "$$s");
241
+ N(this, "$$s");
242
242
  /** The Svelte component instance */
243
- L(this, "$$c");
243
+ N(this, "$$c");
244
244
  /** Whether or not the custom element is connected */
245
- L(this, "$$cn", !1);
245
+ N(this, "$$cn", !1);
246
246
  /** Component props data */
247
- L(this, "$$d", {});
247
+ N(this, "$$d", {});
248
248
  /** `true` if currently in the process of reflecting component props back to attributes */
249
- L(this, "$$r", !1);
249
+ N(this, "$$r", !1);
250
250
  /** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
251
- L(this, "$$p_d", {});
251
+ N(this, "$$p_d", {});
252
252
  /** @type {Record<string, Function[]>} Event listeners */
253
- L(this, "$$l", {});
253
+ N(this, "$$l", {});
254
254
  /** @type {Map<Function, Function>} Event listener unsubscribe functions */
255
- L(this, "$$l_u", /* @__PURE__ */ new Map());
256
- this.$$ctor = e, this.$$s = n, o && this.attachShadow({ mode: "open" });
255
+ N(this, "$$l_u", /* @__PURE__ */ new Map());
256
+ this.$$ctor = e, this.$$s = r, n && this.attachShadow({ mode: "open" });
257
257
  }
258
- addEventListener(e, n, o) {
259
- if (this.$$l[e] = this.$$l[e] || [], this.$$l[e].push(n), this.$$c) {
260
- const l = this.$$c.$on(e, n);
261
- this.$$l_u.set(n, l);
258
+ addEventListener(e, r, n) {
259
+ if (this.$$l[e] = this.$$l[e] || [], this.$$l[e].push(r), this.$$c) {
260
+ const o = this.$$c.$on(e, r);
261
+ this.$$l_u.set(r, o);
262
262
  }
263
- super.addEventListener(e, n, o);
263
+ super.addEventListener(e, r, n);
264
264
  }
265
- removeEventListener(e, n, o) {
266
- if (super.removeEventListener(e, n, o), this.$$c) {
267
- const l = this.$$l_u.get(n);
268
- l && (l(), this.$$l_u.delete(n));
265
+ removeEventListener(e, r, n) {
266
+ if (super.removeEventListener(e, r, n), this.$$c) {
267
+ const o = this.$$l_u.get(r);
268
+ o && (o(), this.$$l_u.delete(r));
269
269
  }
270
270
  }
271
271
  async connectedCallback() {
272
272
  if (this.$$cn = !0, !this.$$c) {
273
- let e = function(r) {
273
+ let e = function(l) {
274
274
  return () => {
275
275
  let s;
276
276
  return {
277
277
  c: function() {
278
- s = $("slot"), r !== "default" && c(s, "name", r);
278
+ s = p("slot"), l !== "default" && c(s, "name", l);
279
279
  },
280
280
  /**
281
281
  * @param {HTMLElement} target
282
282
  * @param {HTMLElement} [anchor]
283
283
  */
284
- m: function(a, R) {
285
- N(a, s, R);
284
+ m: function(a, y) {
285
+ I(a, s, y);
286
286
  },
287
287
  d: function(a) {
288
- a && I(s);
288
+ a && L(s);
289
289
  }
290
290
  };
291
291
  };
292
292
  };
293
293
  if (await Promise.resolve(), !this.$$cn || this.$$c)
294
294
  return;
295
- const n = {}, o = He(this);
296
- for (const r of this.$$s)
297
- r in o && (n[r] = [e(r)]);
298
- for (const r of this.attributes) {
299
- const s = this.$$g_p(r.name);
300
- s in this.$$d || (this.$$d[s] = T(s, r.value, this.$$p_d, "toProp"));
295
+ const r = {}, n = tt(this);
296
+ for (const l of this.$$s)
297
+ l in n && (r[l] = [e(l)]);
298
+ for (const l of this.attributes) {
299
+ const s = this.$$g_p(l.name);
300
+ s in this.$$d || (this.$$d[s] = z(s, l.value, this.$$p_d, "toProp"));
301
301
  }
302
- for (const r in this.$$p_d)
303
- !(r in this.$$d) && this[r] !== void 0 && (this.$$d[r] = this[r], delete this[r]);
302
+ for (const l in this.$$p_d)
303
+ !(l in this.$$d) && this[l] !== void 0 && (this.$$d[l] = this[l], delete this[l]);
304
304
  this.$$c = new this.$$ctor({
305
305
  target: this.shadowRoot || this,
306
306
  props: {
307
307
  ...this.$$d,
308
- $$slots: n,
308
+ $$slots: r,
309
309
  $$scope: {
310
310
  ctx: []
311
311
  }
312
312
  }
313
313
  });
314
- const l = () => {
314
+ const o = () => {
315
315
  this.$$r = !0;
316
- for (const r in this.$$p_d)
317
- if (this.$$d[r] = this.$$c.$$.ctx[this.$$c.$$.props[r]], this.$$p_d[r].reflect) {
318
- const s = T(
319
- r,
320
- this.$$d[r],
316
+ for (const l in this.$$p_d)
317
+ if (this.$$d[l] = this.$$c.$$.ctx[this.$$c.$$.props[l]], this.$$p_d[l].reflect) {
318
+ const s = z(
319
+ l,
320
+ this.$$d[l],
321
321
  this.$$p_d,
322
322
  "toAttribute"
323
323
  );
324
- s == null ? this.removeAttribute(this.$$p_d[r].attribute || r) : this.setAttribute(this.$$p_d[r].attribute || r, s);
324
+ s == null ? this.removeAttribute(this.$$p_d[l].attribute || l) : this.setAttribute(this.$$p_d[l].attribute || l, s);
325
325
  }
326
326
  this.$$r = !1;
327
327
  };
328
- this.$$c.$$.after_update.push(l), l();
329
- for (const r in this.$$l)
330
- for (const s of this.$$l[r]) {
331
- const u = this.$$c.$on(r, s);
328
+ this.$$c.$$.after_update.push(o), o();
329
+ for (const l in this.$$l)
330
+ for (const s of this.$$l[l]) {
331
+ const u = this.$$c.$on(l, s);
332
332
  this.$$l_u.set(s, u);
333
333
  }
334
334
  this.$$l = {};
@@ -336,9 +336,9 @@ typeof HTMLElement == "function" && (_e = class extends HTMLElement {
336
336
  }
337
337
  // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
338
338
  // and setting attributes through setAttribute etc, this is helpful
339
- attributeChangedCallback(e, n, o) {
340
- var l;
341
- this.$$r || (e = this.$$g_p(e), this.$$d[e] = T(e, o, this.$$p_d, "toProp"), (l = this.$$c) == null || l.$set({ [e]: this.$$d[e] }));
339
+ attributeChangedCallback(e, r, n) {
340
+ var o;
341
+ this.$$r || (e = this.$$g_p(e), this.$$d[e] = z(e, n, this.$$p_d, "toProp"), (o = this.$$c) == null || o.$set({ [e]: this.$$d[e] }));
342
342
  }
343
343
  disconnectedCallback() {
344
344
  this.$$cn = !1, Promise.resolve().then(() => {
@@ -347,17 +347,17 @@ typeof HTMLElement == "function" && (_e = class extends HTMLElement {
347
347
  }
348
348
  $$g_p(e) {
349
349
  return Object.keys(this.$$p_d).find(
350
- (n) => this.$$p_d[n].attribute === e || !this.$$p_d[n].attribute && n.toLowerCase() === e
350
+ (r) => this.$$p_d[r].attribute === e || !this.$$p_d[r].attribute && r.toLowerCase() === e
351
351
  ) || e;
352
352
  }
353
353
  });
354
- function T(t, e, n, o) {
355
- var r;
356
- const l = (r = n[t]) == null ? void 0 : r.type;
357
- if (e = l === "Boolean" && typeof e != "boolean" ? e != null : e, !o || !n[t])
354
+ function z(t, e, r, n) {
355
+ var l;
356
+ const o = (l = r[t]) == null ? void 0 : l.type;
357
+ if (e = o === "Boolean" && typeof e != "boolean" ? e != null : e, !n || !r[t])
358
358
  return e;
359
- if (o === "toAttribute")
360
- switch (l) {
359
+ if (n === "toAttribute")
360
+ switch (o) {
361
361
  case "Object":
362
362
  case "Array":
363
363
  return e == null ? null : JSON.stringify(e);
@@ -369,7 +369,7 @@ function T(t, e, n, o) {
369
369
  return e;
370
370
  }
371
371
  else
372
- switch (l) {
372
+ switch (o) {
373
373
  case "Object":
374
374
  case "Array":
375
375
  return e && JSON.parse(e);
@@ -381,10 +381,10 @@ function T(t, e, n, o) {
381
381
  return e;
382
382
  }
383
383
  }
384
- function nt(t, e, n, o, l, r) {
385
- let s = class extends _e {
384
+ function gt(t, e, r, n, o, l) {
385
+ let s = class extends Re {
386
386
  constructor() {
387
- super(t, n, l), this.$$p_d = e;
387
+ super(t, r, o), this.$$p_d = e;
388
388
  }
389
389
  static get observedAttributes() {
390
390
  return Object.keys(e).map(
@@ -399,20 +399,20 @@ function nt(t, e, n, o, l, r) {
399
399
  },
400
400
  set(f) {
401
401
  var a;
402
- f = T(u, f, e), this.$$d[u] = f, (a = this.$$c) == null || a.$set({ [u]: f });
402
+ f = z(u, f, e), this.$$d[u] = f, (a = this.$$c) == null || a.$set({ [u]: f });
403
403
  }
404
404
  });
405
- }), o.forEach((u) => {
405
+ }), n.forEach((u) => {
406
406
  Object.defineProperty(s.prototype, u, {
407
407
  get() {
408
408
  var f;
409
409
  return (f = this.$$c) == null ? void 0 : f[u];
410
410
  }
411
411
  });
412
- }), r && (s = r(s)), t.element = /** @type {any} */
412
+ }), l && (s = l(s)), t.element = /** @type {any} */
413
413
  s, s;
414
414
  }
415
- class rt {
415
+ class bt {
416
416
  constructor() {
417
417
  /**
418
418
  * ### PRIVATE API
@@ -421,7 +421,7 @@ class rt {
421
421
  *
422
422
  * @type {any}
423
423
  */
424
- L(this, "$$");
424
+ N(this, "$$");
425
425
  /**
426
426
  * ### PRIVATE API
427
427
  *
@@ -429,11 +429,11 @@ class rt {
429
429
  *
430
430
  * @type {any}
431
431
  */
432
- L(this, "$$set");
432
+ N(this, "$$set");
433
433
  }
434
434
  /** @returns {void} */
435
435
  $destroy() {
436
- qe(this, 1), this.$destroy = Z;
436
+ ft(this, 1), this.$destroy = X;
437
437
  }
438
438
  /**
439
439
  * @template {Extract<keyof Events, string>} K
@@ -441,13 +441,13 @@ class rt {
441
441
  * @param {((e: Events[K]) => void) | null | undefined} callback
442
442
  * @returns {() => void}
443
443
  */
444
- $on(e, n) {
445
- if (!be(n))
446
- return Z;
447
- const o = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
448
- return o.push(n), () => {
449
- const l = o.indexOf(n);
450
- l !== -1 && o.splice(l, 1);
444
+ $on(e, r) {
445
+ if (!Ce(r))
446
+ return X;
447
+ const n = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
448
+ return n.push(r), () => {
449
+ const o = n.indexOf(r);
450
+ o !== -1 && n.splice(o, 1);
451
451
  };
452
452
  }
453
453
  /**
@@ -455,26 +455,26 @@ class rt {
455
455
  * @returns {void}
456
456
  */
457
457
  $set(e) {
458
- this.$$set && !Ve(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
458
+ this.$$set && !Be(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
459
459
  }
460
460
  }
461
- const ot = "4";
462
- typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(ot);
463
- const we = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IHI9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGMoZSl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KGUpXS5tYXAobj0+bi50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBsKGUsbixhKXtyZXR1cm4gYyhhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChhLnRvVXBwZXJDYXNlKCksci5lbmNvZGUoZStuKSkpfWFzeW5jIGZ1bmN0aW9uIGkoZSxuLGE9IlNIQS0yNTYiLG89MWU3KXtjb25zdCBzPURhdGUubm93KCk7Zm9yKGxldCB0PTA7dDw9bzt0KyspaWYoYXdhaXQgbChuLHQsYSk9PT1lKXJldHVybntudW1iZXI6dCx0b29rOkRhdGUubm93KCktc307cmV0dXJuIG51bGx9b25tZXNzYWdlPWFzeW5jIGU9Pntjb25zdHthbGc6bixjaGFsbGVuZ2U6YSxtYXg6byxzYWx0OnN9PWUuZGF0YXx8e307aWYoYSYmcyl7Y29uc3QgdD1hd2FpdCBpKGEscyxuLG8pO3NlbGYucG9zdE1lc3NhZ2UodCYmey4uLnQsd29ya2VyOiEwfSl9ZWxzZSBzZWxmLnBvc3RNZXNzYWdlKG51bGwpfX0pKCk7Cg==", it = (t) => Uint8Array.from(atob(t), (e) => e.charCodeAt(0)), ce = typeof window < "u" && window.Blob && new Blob([it(we)], { type: "text/javascript;charset=utf-8" });
464
- function lt(t) {
461
+ const mt = "4";
462
+ typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(mt);
463
+ const Ne = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGcodCl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KHQpXS5tYXAoZT0+ZS50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBoKHQsZSxvKXtyZXR1cm4gZyhhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUodCtlKSkpfWZ1bmN0aW9uIG0odCxlLG89IlNIQS0yNTYiLGk9MWU2LHA9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyO3JldHVybntwcm9taXNlOm5ldyBQcm9taXNlKChzLGMpPT57Y29uc3Qgcj1EYXRlLm5vdygpLGQ9bD0+e2Euc2lnbmFsLmFib3J0ZWR8fGw+PWk/cyhudWxsKTpoKGUsbCxvKS50aGVuKHc9Pnt3PT09dD9zKHtudW1iZXI6bCx0b29rOkRhdGUubm93KCktcn0pOmQobCsxKX0pLmNhdGNoKGMpfTtkKHApfSksY29udHJvbGxlcjphfX1sZXQgbjtvbm1lc3NhZ2U9YXN5bmMgdD0+e2NvbnN0e3R5cGU6ZSxwYXlsb2FkOm99PXQuZGF0YTtpZihlPT09ImFib3J0IiluPT1udWxsfHxuLmFib3J0KCksbj12b2lkIDA7ZWxzZSBpZihlPT09IndvcmsiKXtjb25zdHthbGc6aSxjaGFsbGVuZ2U6cCxtYXg6YSxzYWx0OnUsc3RhcnQ6c309b3x8e30sYz1tKHAsdSxpLGEscyk7bj1jLmNvbnRyb2xsZXIsYy5wcm9taXNlLnRoZW4ocj0+e3NlbGYucG9zdE1lc3NhZ2UociYmey4uLnIsd29ya2VyOiEwfSl9KX19fSkoKTsK", vt = (t) => Uint8Array.from(atob(t), (e) => e.charCodeAt(0)), _e = typeof window < "u" && window.Blob && new Blob([vt(Ne)], { type: "text/javascript;charset=utf-8" });
464
+ function wt(t) {
465
465
  let e;
466
466
  try {
467
- if (e = ce && (window.URL || window.webkitURL).createObjectURL(ce), !e)
467
+ if (e = _e && (window.URL || window.webkitURL).createObjectURL(_e), !e)
468
468
  throw "";
469
- const n = new Worker(e, {
469
+ const r = new Worker(e, {
470
470
  name: t == null ? void 0 : t.name
471
471
  });
472
- return n.addEventListener("error", () => {
472
+ return r.addEventListener("error", () => {
473
473
  (window.URL || window.webkitURL).revokeObjectURL(e);
474
- }), n;
474
+ }), r;
475
475
  } catch {
476
476
  return new Worker(
477
- "data:text/javascript;base64," + we,
477
+ "data:text/javascript;base64," + Ne,
478
478
  {
479
479
  name: t == null ? void 0 : t.name
480
480
  }
@@ -483,286 +483,354 @@ function lt(t) {
483
483
  e && (window.URL || window.webkitURL).revokeObjectURL(e);
484
484
  }
485
485
  }
486
- const st = 1e7, ct = new TextEncoder();
487
- function ut(t) {
486
+ const _t = new TextEncoder();
487
+ function pt(t) {
488
488
  return [...new Uint8Array(t)].map((e) => e.toString(16).padStart(2, "0")).join("");
489
489
  }
490
- async function at(t = 1e5, e = "SHA-256") {
491
- const n = Date.now().toString(16), o = Math.round(Math.random() * t), l = await $e(n, o, e);
490
+ async function kt(t, e = "SHA-256", r = 1e5) {
491
+ const n = Date.now().toString(16);
492
+ t || (t = Math.round(Math.random() * r));
493
+ const o = await je(n, t, e);
492
494
  return {
493
495
  algorithm: e,
494
- challenge: l,
496
+ challenge: o,
495
497
  salt: n,
496
498
  signature: ""
497
499
  };
498
500
  }
499
- async function $e(t, e, n) {
500
- return ut(await crypto.subtle.digest(n.toUpperCase(), ct.encode(t + e)));
501
+ async function je(t, e, r) {
502
+ return pt(await crypto.subtle.digest(r.toUpperCase(), _t.encode(t + e)));
501
503
  }
502
- async function ft(t, e, n = "SHA-256", o = st) {
503
- const l = Date.now();
504
- for (let r = 0; r <= o; r++)
505
- if (await $e(e, r, n) === t)
506
- return {
507
- number: r,
508
- took: Date.now() - l
504
+ function $t(t, e, r = "SHA-256", n = 1e6, o = 0) {
505
+ const l = new AbortController();
506
+ return {
507
+ promise: new Promise((u, f) => {
508
+ const a = Date.now(), y = (w) => {
509
+ l.signal.aborted || w >= n ? u(null) : je(e, w, r).then((R) => {
510
+ R === t ? u({
511
+ number: w,
512
+ took: Date.now() - a
513
+ }) : y(w + 1);
514
+ }).catch(f);
509
515
  };
510
- return null;
516
+ y(o);
517
+ }),
518
+ controller: l
519
+ };
511
520
  }
512
- var y = /* @__PURE__ */ ((t) => (t.ERROR = "error", t.VERIFIED = "verified", t.VERIFYING = "verifying", t.UNVERIFIED = "unverified", t))(y || {});
513
- function ht(t) {
514
- Me(t, "svelte-vuofbg", ".altcha.svelte-vuofbg.svelte-vuofbg{background:var(--altcha-color-base, transparent);border:var(--altcha-border-width, 1px) solid var(--altcha-color-border, #a0a0a0);border-radius:var(--altcha-border-radius, 3px);color:var(--altcha-color-text, currentColor);display:flex;flex-direction:column;max-width:var(--altcha-max-width, 260px);overflow:hidden;position:relative;text-align:left}.altcha.svelte-vuofbg.svelte-vuofbg:focus-within{border-color:var(--altcha-color-border-focus, currentColor)}.altcha-main.svelte-vuofbg.svelte-vuofbg{align-items:center;display:flex;gap:0.4rem;padding:0.7rem}.altcha-label.svelte-vuofbg.svelte-vuofbg{flex-grow:1}.altcha-label.svelte-vuofbg label.svelte-vuofbg{cursor:pointer}.altcha-logo.svelte-vuofbg.svelte-vuofbg{color:currentColor;opacity:0.3}.altcha-logo.svelte-vuofbg.svelte-vuofbg:hover{opacity:1}.altcha-error.svelte-vuofbg.svelte-vuofbg{color:var(--altcha-color-error-text, #f23939);display:flex;font-size:0.85rem;gap:0.3rem;padding:0 0.7rem 0.7rem}.altcha-footer.svelte-vuofbg.svelte-vuofbg{align-items:center;background-color:var(--altcha-color-footer-bg, transparent);display:flex;font-size:0.75rem;opacity:0.4;padding:0.2rem 0.7rem;text-align:right}.altcha-footer.svelte-vuofbg.svelte-vuofbg:hover{opacity:1}.altcha-footer.svelte-vuofbg>.svelte-vuofbg:first-child{flex-grow:1}.altcha-footer.svelte-vuofbg a{color:currentColor}.altcha-checkbox.svelte-vuofbg.svelte-vuofbg{display:flex;align-items:center;height:24px;width:24px}.altcha-checkbox.svelte-vuofbg input.svelte-vuofbg{width:18px;height:18px;margin:0}.altcha-hidden.svelte-vuofbg.svelte-vuofbg{display:none}.altcha-spinner.svelte-vuofbg.svelte-vuofbg{animation:svelte-vuofbg-altcha-spinner 0.75s infinite linear;transform-origin:center}@keyframes svelte-vuofbg-altcha-spinner{100%{transform:rotate(360deg)}}");
521
+ var m = /* @__PURE__ */ ((t) => (t.ERROR = "error", t.VERIFIED = "verified", t.VERIFYING = "verifying", t.UNVERIFIED = "unverified", t.EXPIRED = "expired", t))(m || {});
522
+ function yt(t) {
523
+ We(t, "svelte-vuofbg", ".altcha.svelte-vuofbg.svelte-vuofbg{background:var(--altcha-color-base, transparent);border:var(--altcha-border-width, 1px) solid var(--altcha-color-border, #a0a0a0);border-radius:var(--altcha-border-radius, 3px);color:var(--altcha-color-text, currentColor);display:flex;flex-direction:column;max-width:var(--altcha-max-width, 260px);overflow:hidden;position:relative;text-align:left}.altcha.svelte-vuofbg.svelte-vuofbg:focus-within{border-color:var(--altcha-color-border-focus, currentColor)}.altcha-main.svelte-vuofbg.svelte-vuofbg{align-items:center;display:flex;gap:0.4rem;padding:0.7rem}.altcha-label.svelte-vuofbg.svelte-vuofbg{flex-grow:1}.altcha-label.svelte-vuofbg label.svelte-vuofbg{cursor:pointer}.altcha-logo.svelte-vuofbg.svelte-vuofbg{color:currentColor;opacity:0.3}.altcha-logo.svelte-vuofbg.svelte-vuofbg:hover{opacity:1}.altcha-error.svelte-vuofbg.svelte-vuofbg{color:var(--altcha-color-error-text, #f23939);display:flex;font-size:0.85rem;gap:0.3rem;padding:0 0.7rem 0.7rem}.altcha-footer.svelte-vuofbg.svelte-vuofbg{align-items:center;background-color:var(--altcha-color-footer-bg, transparent);display:flex;font-size:0.75rem;opacity:0.4;padding:0.2rem 0.7rem;text-align:right}.altcha-footer.svelte-vuofbg.svelte-vuofbg:hover{opacity:1}.altcha-footer.svelte-vuofbg>.svelte-vuofbg:first-child{flex-grow:1}.altcha-footer.svelte-vuofbg a{color:currentColor}.altcha-checkbox.svelte-vuofbg.svelte-vuofbg{display:flex;align-items:center;height:24px;width:24px}.altcha-checkbox.svelte-vuofbg input.svelte-vuofbg{width:18px;height:18px;margin:0}.altcha-hidden.svelte-vuofbg.svelte-vuofbg{display:none}.altcha-spinner.svelte-vuofbg.svelte-vuofbg{animation:svelte-vuofbg-altcha-spinner 0.75s infinite linear;transform-origin:center}@keyframes svelte-vuofbg-altcha-spinner{100%{transform:rotate(360deg)}}");
515
524
  }
516
- function ue(t) {
517
- let e, n, o;
525
+ function pe(t) {
526
+ let e, r, n;
518
527
  return {
519
528
  c() {
520
- e = S("svg"), n = S("path"), o = S("path"), c(n, "d", "M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"), c(n, "fill", "currentColor"), c(n, "opacity", ".25"), c(o, "d", "M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"), c(o, "fill", "currentColor"), c(o, "class", "altcha-spinner svelte-vuofbg"), c(e, "width", "24"), c(e, "height", "24"), c(e, "viewBox", "0 0 24 24"), c(e, "xmlns", "http://www.w3.org/2000/svg");
529
+ e = S("svg"), r = S("path"), n = S("path"), c(r, "d", "M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"), c(r, "fill", "currentColor"), c(r, "opacity", ".25"), c(n, "d", "M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"), c(n, "fill", "currentColor"), c(n, "class", "altcha-spinner svelte-vuofbg"), c(e, "width", "24"), c(e, "height", "24"), c(e, "viewBox", "0 0 24 24"), c(e, "xmlns", "http://www.w3.org/2000/svg");
521
530
  },
522
- m(l, r) {
523
- N(l, e, r), b(e, n), b(e, o);
531
+ m(o, l) {
532
+ I(o, e, l), v(e, r), v(e, n);
524
533
  },
525
- d(l) {
526
- l && I(e);
534
+ d(o) {
535
+ o && L(e);
527
536
  }
528
537
  };
529
538
  }
530
- function dt(t) {
531
- let e, n = (
539
+ function Et(t) {
540
+ let e, r = (
532
541
  /*_strings*/
533
542
  t[9].label + ""
534
- ), o;
543
+ ), n;
535
544
  return {
536
545
  c() {
537
- e = $("label"), c(e, "for", o = /*name*/
546
+ e = p("label"), c(e, "for", n = /*name*/
538
547
  t[3] + "_checkbox"), c(e, "class", "svelte-vuofbg");
539
548
  },
540
- m(l, r) {
541
- N(l, e, r), e.innerHTML = n;
549
+ m(o, l) {
550
+ I(o, e, l), e.innerHTML = r;
542
551
  },
543
- p(l, r) {
544
- r[0] & /*_strings*/
545
- 512 && n !== (n = /*_strings*/
546
- l[9].label + "") && (e.innerHTML = n), r[0] & /*name*/
547
- 8 && o !== (o = /*name*/
548
- l[3] + "_checkbox") && c(e, "for", o);
552
+ p(o, l) {
553
+ l[0] & /*_strings*/
554
+ 512 && r !== (r = /*_strings*/
555
+ o[9].label + "") && (e.innerHTML = r), l[0] & /*name*/
556
+ 8 && n !== (n = /*name*/
557
+ o[3] + "_checkbox") && c(e, "for", n);
549
558
  },
550
- d(l) {
551
- l && I(e);
559
+ d(o) {
560
+ o && L(e);
552
561
  }
553
562
  };
554
563
  }
555
- function gt(t) {
556
- let e, n = (
564
+ function xt(t) {
565
+ let e, r = (
557
566
  /*_strings*/
558
567
  t[9].verifying + ""
559
568
  );
560
569
  return {
561
570
  c() {
562
- e = $("span");
571
+ e = p("span");
563
572
  },
564
- m(o, l) {
565
- N(o, e, l), e.innerHTML = n;
573
+ m(n, o) {
574
+ I(n, e, o), e.innerHTML = r;
566
575
  },
567
- p(o, l) {
568
- l[0] & /*_strings*/
569
- 512 && n !== (n = /*_strings*/
570
- o[9].verifying + "") && (e.innerHTML = n);
576
+ p(n, o) {
577
+ o[0] & /*_strings*/
578
+ 512 && r !== (r = /*_strings*/
579
+ n[9].verifying + "") && (e.innerHTML = r);
571
580
  },
572
- d(o) {
573
- o && I(e);
581
+ d(n) {
582
+ n && L(e);
574
583
  }
575
584
  };
576
585
  }
577
- function bt(t) {
578
- let e, n = (
586
+ function Ct(t) {
587
+ let e, r = (
579
588
  /*_strings*/
580
589
  t[9].verified + ""
581
- ), o, l;
590
+ ), n, o;
582
591
  return {
583
592
  c() {
584
- e = $("span"), o = M(), l = $("input"), c(l, "type", "hidden"), c(
585
- l,
593
+ e = p("span"), n = Z(), o = p("input"), c(o, "type", "hidden"), c(
594
+ o,
586
595
  "name",
587
596
  /*name*/
588
597
  t[3]
589
- ), l.value = /*payload*/
598
+ ), o.value = /*payload*/
590
599
  t[4];
591
600
  },
592
- m(r, s) {
593
- N(r, e, s), e.innerHTML = n, N(r, o, s), N(r, l, s);
601
+ m(l, s) {
602
+ I(l, e, s), e.innerHTML = r, I(l, n, s), I(l, o, s);
594
603
  },
595
- p(r, s) {
604
+ p(l, s) {
596
605
  s[0] & /*_strings*/
597
- 512 && n !== (n = /*_strings*/
598
- r[9].verified + "") && (e.innerHTML = n), s[0] & /*name*/
606
+ 512 && r !== (r = /*_strings*/
607
+ l[9].verified + "") && (e.innerHTML = r), s[0] & /*name*/
599
608
  8 && c(
600
- l,
609
+ o,
601
610
  "name",
602
611
  /*name*/
603
- r[3]
612
+ l[3]
604
613
  ), s[0] & /*payload*/
605
- 16 && (l.value = /*payload*/
606
- r[4]);
614
+ 16 && (o.value = /*payload*/
615
+ l[4]);
607
616
  },
608
- d(r) {
609
- r && (I(e), I(o), I(l));
617
+ d(l) {
618
+ l && (L(e), L(n), L(o));
610
619
  }
611
620
  };
612
621
  }
613
- function ae(t) {
614
- let e, n, o, l, r, s;
622
+ function ke(t) {
623
+ let e, r, n, o, l, s;
615
624
  return {
616
625
  c() {
617
- e = $("div"), n = $("a"), o = S("svg"), l = S("path"), r = S("path"), s = S("path"), c(l, "d", "M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"), c(l, "fill", "currentColor"), c(r, "d", "M3.57212 2.33956C1.65755 3.94607 0.496389 6.11731 0.12782 8.40523L2.04639 9.13961C2.26047 7.15832 3.21057 5.25375 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577L13.8302 6.78606L19.9633 9.13364C19.7929 7.15555 19.0335 5.20847 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956Z"), c(r, "fill", "currentColor"), c(s, "d", "M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"), c(s, "fill", "currentColor"), c(o, "width", "22"), c(o, "height", "22"), c(o, "viewBox", "0 0 20 20"), c(o, "fill", "none"), c(o, "xmlns", "http://www.w3.org/2000/svg"), c(n, "href", ye), c(n, "target", "_blank"), c(n, "class", "altcha-logo svelte-vuofbg");
626
+ e = p("div"), r = p("a"), n = S("svg"), o = S("path"), l = S("path"), s = S("path"), c(o, "d", "M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"), c(o, "fill", "currentColor"), c(l, "d", "M3.57212 2.33956C1.65755 3.94607 0.496389 6.11731 0.12782 8.40523L2.04639 9.13961C2.26047 7.15832 3.21057 5.25375 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577L13.8302 6.78606L19.9633 9.13364C19.7929 7.15555 19.0335 5.20847 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956Z"), c(l, "fill", "currentColor"), c(s, "d", "M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"), c(s, "fill", "currentColor"), c(n, "width", "22"), c(n, "height", "22"), c(n, "viewBox", "0 0 20 20"), c(n, "fill", "none"), c(n, "xmlns", "http://www.w3.org/2000/svg"), c(r, "href", Ae), c(r, "target", "_blank"), c(r, "class", "altcha-logo svelte-vuofbg");
618
627
  },
619
628
  m(u, f) {
620
- N(u, e, f), b(e, n), b(n, o), b(o, l), b(o, r), b(o, s);
629
+ I(u, e, f), v(e, r), v(r, n), v(n, o), v(n, l), v(n, s);
621
630
  },
622
- p: Z,
631
+ p: X,
623
632
  d(u) {
624
- u && I(e);
633
+ u && L(e);
634
+ }
635
+ };
636
+ }
637
+ function $e(t) {
638
+ let e, r, n, o;
639
+ function l(f, a) {
640
+ return (
641
+ /*state*/
642
+ f[5] === m.EXPIRED ? It : Lt
643
+ );
644
+ }
645
+ let s = l(t), u = s(t);
646
+ return {
647
+ c() {
648
+ e = p("div"), r = S("svg"), n = S("path"), o = Z(), u.c(), c(n, "stroke-linecap", "round"), c(n, "stroke-linejoin", "round"), c(n, "d", "M6 18L18 6M6 6l12 12"), c(r, "width", "14"), c(r, "height", "14"), c(r, "xmlns", "http://www.w3.org/2000/svg"), c(r, "fill", "none"), c(r, "viewBox", "0 0 24 24"), c(r, "stroke-width", "1.5"), c(r, "stroke", "currentColor"), c(e, "class", "altcha-error svelte-vuofbg");
649
+ },
650
+ m(f, a) {
651
+ I(f, e, a), v(e, r), v(r, n), v(e, o), u.m(e, null);
652
+ },
653
+ p(f, a) {
654
+ s === (s = l(f)) && u ? u.p(f, a) : (u.d(1), u = s(f), u && (u.c(), u.m(e, null)));
655
+ },
656
+ d(f) {
657
+ f && L(e), u.d();
625
658
  }
626
659
  };
627
660
  }
628
- function fe(t) {
629
- let e, n, o, l, r, s = (
661
+ function Lt(t) {
662
+ let e, r = (
630
663
  /*_strings*/
631
664
  t[9].error + ""
632
665
  );
633
666
  return {
634
667
  c() {
635
- e = $("div"), n = S("svg"), o = S("path"), l = M(), r = $("div"), c(o, "stroke-linecap", "round"), c(o, "stroke-linejoin", "round"), c(o, "d", "M6 18L18 6M6 6l12 12"), c(n, "width", "14"), c(n, "height", "14"), c(n, "xmlns", "http://www.w3.org/2000/svg"), c(n, "fill", "none"), c(n, "viewBox", "0 0 24 24"), c(n, "stroke-width", "1.5"), c(n, "stroke", "currentColor"), c(
636
- r,
668
+ e = p("div"), c(
669
+ e,
637
670
  "title",
638
671
  /*error*/
639
672
  t[8]
640
- ), c(e, "class", "altcha-error svelte-vuofbg");
673
+ );
641
674
  },
642
- m(u, f) {
643
- N(u, e, f), b(e, n), b(n, o), b(e, l), b(e, r), r.innerHTML = s;
675
+ m(n, o) {
676
+ I(n, e, o), e.innerHTML = r;
644
677
  },
645
- p(u, f) {
646
- f[0] & /*_strings*/
647
- 512 && s !== (s = /*_strings*/
648
- u[9].error + "") && (r.innerHTML = s), f[0] & /*error*/
678
+ p(n, o) {
679
+ o[0] & /*_strings*/
680
+ 512 && r !== (r = /*_strings*/
681
+ n[9].error + "") && (e.innerHTML = r), o[0] & /*error*/
649
682
  256 && c(
650
- r,
683
+ e,
651
684
  "title",
652
685
  /*error*/
653
- u[8]
686
+ n[8]
654
687
  );
655
688
  },
656
- d(u) {
657
- u && I(e);
689
+ d(n) {
690
+ n && L(e);
658
691
  }
659
692
  };
660
693
  }
661
- function he(t) {
662
- let e, n, o = (
694
+ function It(t) {
695
+ let e, r = (
696
+ /*_strings*/
697
+ t[9].expired + ""
698
+ );
699
+ return {
700
+ c() {
701
+ e = p("div"), c(
702
+ e,
703
+ "title",
704
+ /*error*/
705
+ t[8]
706
+ );
707
+ },
708
+ m(n, o) {
709
+ I(n, e, o), e.innerHTML = r;
710
+ },
711
+ p(n, o) {
712
+ o[0] & /*_strings*/
713
+ 512 && r !== (r = /*_strings*/
714
+ n[9].expired + "") && (e.innerHTML = r), o[0] & /*error*/
715
+ 256 && c(
716
+ e,
717
+ "title",
718
+ /*error*/
719
+ n[8]
720
+ );
721
+ },
722
+ d(n) {
723
+ n && L(e);
724
+ }
725
+ };
726
+ }
727
+ function ye(t) {
728
+ let e, r, n = (
663
729
  /*_strings*/
664
730
  t[9].footer + ""
665
731
  );
666
732
  return {
667
733
  c() {
668
- e = $("div"), n = $("div"), c(n, "class", "svelte-vuofbg"), c(e, "class", "altcha-footer svelte-vuofbg");
734
+ e = p("div"), r = p("div"), c(r, "class", "svelte-vuofbg"), c(e, "class", "altcha-footer svelte-vuofbg");
669
735
  },
670
- m(l, r) {
671
- N(l, e, r), b(e, n), n.innerHTML = o;
736
+ m(o, l) {
737
+ I(o, e, l), v(e, r), r.innerHTML = n;
672
738
  },
673
- p(l, r) {
674
- r[0] & /*_strings*/
675
- 512 && o !== (o = /*_strings*/
676
- l[9].footer + "") && (n.innerHTML = o);
739
+ p(o, l) {
740
+ l[0] & /*_strings*/
741
+ 512 && n !== (n = /*_strings*/
742
+ o[9].footer + "") && (r.innerHTML = n);
677
743
  },
678
- d(l) {
679
- l && I(e);
744
+ d(o) {
745
+ o && L(e);
680
746
  }
681
747
  };
682
748
  }
683
- function mt(t) {
684
- let e, n, o, l, r, s, u, f, a, R, p, j, x, A, _ = (
749
+ function Rt(t) {
750
+ let e, r, n, o, l, s, u, f, a, y, w, R, M, j, _ = (
685
751
  /*state*/
686
- t[5] === y.VERIFYING && ue()
752
+ t[5] === m.VERIFYING && pe()
687
753
  );
688
- function G(h, v) {
754
+ function V(h, d) {
689
755
  return (
690
756
  /*state*/
691
- h[5] === y.VERIFIED ? bt : (
757
+ h[5] === m.VERIFIED ? Ct : (
692
758
  /*state*/
693
- h[5] === y.VERIFYING ? gt : dt
759
+ h[5] === m.VERIFYING ? xt : Et
694
760
  )
695
761
  );
696
762
  }
697
- let V = G(t), k = V(t), g = (
763
+ let A = V(t), E = A(t), k = (
698
764
  /*hidelogo*/
699
- t[2] !== !0 && ae()
700
- ), m = (
765
+ t[2] !== !0 && ke()
766
+ ), $ = (
701
767
  /*error*/
702
- t[8] && fe(t)
703
- ), d = (
768
+ (t[8] || /*state*/
769
+ t[5] === m.EXPIRED) && $e(t)
770
+ ), b = (
704
771
  /*_strings*/
705
772
  t[9].footer && /*hidefooter*/
706
- t[1] !== !0 && he(t)
773
+ t[1] !== !0 && ye(t)
707
774
  );
708
775
  return {
709
776
  c() {
710
- e = $("div"), n = $("div"), _ && _.c(), o = M(), l = $("div"), r = $("input"), f = M(), a = $("div"), k.c(), R = M(), g && g.c(), p = M(), m && m.c(), j = M(), d && d.c(), c(r, "type", "checkbox"), c(r, "id", s = /*name*/
711
- t[3] + "_checkbox"), r.required = u = /*auto*/
712
- t[0] !== "onsubmit", c(r, "class", "svelte-vuofbg"), c(l, "class", "altcha-checkbox svelte-vuofbg"), le(
713
- l,
777
+ e = p("div"), r = p("div"), _ && _.c(), n = Z(), o = p("div"), l = p("input"), f = Z(), a = p("div"), E.c(), y = Z(), k && k.c(), w = Z(), $ && $.c(), R = Z(), b && b.c(), c(l, "type", "checkbox"), c(l, "id", s = /*name*/
778
+ t[3] + "_checkbox"), l.required = u = /*auto*/
779
+ t[0] !== "onsubmit", c(l, "class", "svelte-vuofbg"), c(o, "class", "altcha-checkbox svelte-vuofbg"), ve(
780
+ o,
714
781
  "altcha-hidden",
715
782
  /*state*/
716
- t[5] === y.VERIFYING
717
- ), c(a, "class", "altcha-label svelte-vuofbg"), c(n, "class", "altcha-main svelte-vuofbg"), c(e, "class", "altcha svelte-vuofbg"), c(
783
+ t[5] === m.VERIFYING
784
+ ), c(a, "class", "altcha-label svelte-vuofbg"), c(r, "class", "altcha-main svelte-vuofbg"), c(e, "class", "altcha svelte-vuofbg"), c(
718
785
  e,
719
786
  "data-state",
720
787
  /*state*/
721
788
  t[5]
722
789
  );
723
790
  },
724
- m(h, v) {
725
- N(h, e, v), b(e, n), _ && _.m(n, null), b(n, o), b(n, l), b(l, r), r.checked = /*checked*/
726
- t[6], b(n, f), b(n, a), k.m(a, null), b(n, R), g && g.m(n, null), b(e, p), m && m.m(e, null), b(e, j), d && d.m(e, null), t[24](e), x || (A = [
727
- K(
728
- r,
791
+ m(h, d) {
792
+ I(h, e, d), v(e, r), _ && _.m(r, null), v(r, n), v(r, o), v(o, l), l.checked = /*checked*/
793
+ t[6], v(r, f), v(r, a), E.m(a, null), v(r, y), k && k.m(r, null), v(e, w), $ && $.m(e, null), v(e, R), b && b.m(e, null), t[26](e), M || (j = [
794
+ re(
795
+ l,
729
796
  "change",
730
797
  /*input_change_handler*/
731
- t[23]
798
+ t[25]
732
799
  ),
733
- K(
734
- r,
800
+ re(
801
+ l,
735
802
  "change",
736
803
  /*onCheckedChange*/
737
804
  t[10]
738
805
  ),
739
- K(
740
- r,
806
+ re(
807
+ l,
741
808
  "invalid",
742
809
  /*onInvalid*/
743
810
  t[11]
744
811
  )
745
- ], x = !0);
812
+ ], M = !0);
746
813
  },
747
- p(h, v) {
814
+ p(h, d) {
748
815
  /*state*/
749
- h[5] === y.VERIFYING ? _ || (_ = ue(), _.c(), _.m(n, o)) : _ && (_.d(1), _ = null), v[0] & /*name*/
816
+ h[5] === m.VERIFYING ? _ || (_ = pe(), _.c(), _.m(r, n)) : _ && (_.d(1), _ = null), d[0] & /*name*/
750
817
  8 && s !== (s = /*name*/
751
- h[3] + "_checkbox") && c(r, "id", s), v[0] & /*auto*/
818
+ h[3] + "_checkbox") && c(l, "id", s), d[0] & /*auto*/
752
819
  1 && u !== (u = /*auto*/
753
- h[0] !== "onsubmit") && (r.required = u), v[0] & /*checked*/
754
- 64 && (r.checked = /*checked*/
755
- h[6]), v[0] & /*state*/
756
- 32 && le(
757
- l,
820
+ h[0] !== "onsubmit") && (l.required = u), d[0] & /*checked*/
821
+ 64 && (l.checked = /*checked*/
822
+ h[6]), d[0] & /*state*/
823
+ 32 && ve(
824
+ o,
758
825
  "altcha-hidden",
759
826
  /*state*/
760
- h[5] === y.VERIFYING
761
- ), V === (V = G(h)) && k ? k.p(h, v) : (k.d(1), k = V(h), k && (k.c(), k.m(a, null))), /*hidelogo*/
762
- h[2] !== !0 ? g ? g.p(h, v) : (g = ae(), g.c(), g.m(n, null)) : g && (g.d(1), g = null), /*error*/
763
- h[8] ? m ? m.p(h, v) : (m = fe(h), m.c(), m.m(e, j)) : m && (m.d(1), m = null), /*_strings*/
827
+ h[5] === m.VERIFYING
828
+ ), A === (A = V(h)) && E ? E.p(h, d) : (E.d(1), E = A(h), E && (E.c(), E.m(a, null))), /*hidelogo*/
829
+ h[2] !== !0 ? k ? k.p(h, d) : (k = ke(), k.c(), k.m(r, null)) : k && (k.d(1), k = null), /*error*/
830
+ h[8] || /*state*/
831
+ h[5] === m.EXPIRED ? $ ? $.p(h, d) : ($ = $e(h), $.c(), $.m(e, R)) : $ && ($.d(1), $ = null), /*_strings*/
764
832
  h[9].footer && /*hidefooter*/
765
- h[1] !== !0 ? d ? d.p(h, v) : (d = he(h), d.c(), d.m(e, null)) : d && (d.d(1), d = null), v[0] & /*state*/
833
+ h[1] !== !0 ? b ? b.p(h, d) : (b = ye(h), b.c(), b.m(e, null)) : b && (b.d(1), b = null), d[0] & /*state*/
766
834
  32 && c(
767
835
  e,
768
836
  "data-state",
@@ -770,202 +838,242 @@ function mt(t) {
770
838
  h[5]
771
839
  );
772
840
  },
773
- i: Z,
774
- o: Z,
841
+ i: X,
842
+ o: X,
775
843
  d(h) {
776
- h && I(e), _ && _.d(), k.d(), g && g.d(), m && m.d(), d && d.d(), t[24](null), x = !1, P(A);
844
+ h && L(e), _ && _.d(), E.d(), k && k.d(), $ && $.d(), b && b.d(), t[26](null), M = !1, B(j);
777
845
  }
778
846
  };
779
847
  }
780
- const ye = "https://altcha.org/";
781
- function de(t) {
848
+ const Ae = "https://altcha.org/";
849
+ function Ee(t) {
782
850
  return JSON.parse(t);
783
851
  }
784
- function vt(t, e, n) {
785
- let o, l, r, { auto: s = void 0 } = e, { challengeurl: u = void 0 } = e, { challengejson: f = void 0 } = e, { debug: a = !1 } = e, { hidefooter: R = !1 } = e, { hidelogo: p = !1 } = e, { name: j = "altcha" } = e, { maxnumber: x = void 0 } = e, { mockerror: A = !1 } = e, { strings: _ = void 0 } = e, { test: G = !1 } = e;
786
- const V = Te(), k = ["SHA-256", "SHA-384", "SHA-512"];
787
- let g = !1, m, d = null, h = null, v = null, U = y.UNVERIFIED;
788
- Pe(() => {
789
- d && (d.removeEventListener("submit", te), d.removeEventListener("reset", ne), d = null);
790
- }), We(() => {
791
- E("mounted", "0.1.9"), G && E("using test mode"), s !== void 0 && E("auto", s), d = m.closest("form"), d && (d.addEventListener("submit", te), d.addEventListener("reset", ne)), s === "onload" && B();
852
+ function Nt(t, e, r) {
853
+ let n, o, l, { auto: s = void 0 } = e, { challengeurl: u = void 0 } = e, { challengejson: f = void 0 } = e, { debug: a = !1 } = e, { expire: y = void 0 } = e, { hidefooter: w = !1 } = e, { hidelogo: R = !1 } = e, { name: M = "altcha" } = e, { maxnumber: j = 1e6 } = e, { mockerror: _ = !1 } = e, { strings: V = void 0 } = e, { test: A = !1 } = e, { workers: E = navigator.hardwareConcurrency || 8 } = e;
854
+ const k = it(), $ = ["SHA-256", "SHA-384", "SHA-512"];
855
+ let b = !1, h, d = null, q = null, H = null, G = m.UNVERIFIED, ee;
856
+ nt(() => {
857
+ d && (d.removeEventListener("submit", ce), d.removeEventListener("reset", ue), d = null);
858
+ }), rt(() => {
859
+ x("mounted", "0.2.0"), x("workers", E), A && x("using test mode"), y && te(y), s !== void 0 && x("auto", s), d = h.closest("form"), d && (d.addEventListener("submit", ce), d.addEventListener("reset", ue)), s === "onload" && F();
792
860
  });
793
- function E(...i) {
794
- (a || i.some((w) => w instanceof Error)) && console[i[0] instanceof Error ? "error" : "log"]("ALTCHA", ...i);
861
+ function x(...i) {
862
+ (a || i.some((g) => g instanceof Error)) && console[i[0] instanceof Error ? "error" : "log"]("ALTCHA", ...i);
795
863
  }
796
- function te(i) {
797
- d && s === "onsubmit" && U === y.UNVERIFIED && (i.preventDefault(), i.stopPropagation(), B().then(() => {
864
+ function ce(i) {
865
+ d && s === "onsubmit" && G === m.UNVERIFIED && (i.preventDefault(), i.stopPropagation(), F().then(() => {
798
866
  d == null || d.requestSubmit();
799
867
  }));
800
868
  }
801
- function ne() {
802
- X();
869
+ function ue() {
870
+ W();
803
871
  }
804
- function pe(i, w) {
872
+ function Me(i, g) {
805
873
  return btoa(JSON.stringify({
806
874
  algorithm: i.algorithm,
807
875
  challenge: i.challenge,
808
- number: w.number,
876
+ number: g.number,
809
877
  salt: i.salt,
810
878
  signature: i.signature,
811
- test: G ? !0 : void 0,
812
- took: w.took
879
+ test: A ? !0 : void 0,
880
+ took: g.took
813
881
  }));
814
882
  }
815
- function re(i) {
883
+ function ae(i) {
816
884
  if (!i.algorithm)
817
885
  throw new Error("Invalid challenge. Property algorithm is missing.");
818
886
  if (i.signature === void 0)
819
887
  throw new Error("Invalid challenge. Property signature is missing.");
820
- if (!k.includes(i.algorithm.toUpperCase()))
821
- throw new Error(`Unknown algorithm value. Allowed values: ${k.join(", ")}`);
888
+ if (!$.includes(i.algorithm.toUpperCase()))
889
+ throw new Error(`Unknown algorithm value. Allowed values: ${$.join(", ")}`);
822
890
  if (!i.challenge || i.challenge.length < 40)
823
891
  throw new Error("Challenge is too short. Min. 40 chars.");
824
892
  if (!i.salt || i.salt.length < 10)
825
893
  throw new Error("Salt is too short. Min. 10 chars.");
826
894
  }
827
- async function ke() {
895
+ async function Te() {
896
+ if (_)
897
+ throw x("mocking error"), new Error("Mocked error.");
898
+ if (n)
899
+ return x("using provided json data"), n;
828
900
  if (A)
829
- throw E("mocking error"), new Error("Mocked error.");
830
- if (o)
831
- return E("using provided json data"), o;
832
- if (G)
833
- return E("generating test challenge"), at();
901
+ return x("generating test challenge"), kt();
834
902
  {
835
903
  if (!u)
836
904
  throw new Error("Attribute challengeurl not set.");
837
- E("fetching challenge from", u);
905
+ x("fetching challenge from", u);
838
906
  const i = await fetch(u);
839
907
  if (i.status !== 200)
840
908
  throw new Error(`Server responded with ${i.status}.`);
909
+ const g = i.headers.get("Expires");
910
+ if (g != null && g.length) {
911
+ const O = Date.parse(g);
912
+ isNaN(O) || te(O - Date.now());
913
+ }
841
914
  return i.json();
842
915
  }
843
916
  }
844
- async function Ee(i) {
845
- let w = null;
917
+ function fe() {
918
+ u && G === m.VERIFIED ? F() : W(m.EXPIRED, l.expired);
919
+ }
920
+ async function Ge(i) {
921
+ let g = null;
846
922
  if ("Worker" in window) {
847
923
  try {
848
- w = await Ce(i.challenge, i.salt, i.algorithm);
849
- } catch (D) {
850
- E(D);
924
+ g = await Se(i.challenge, i.salt, i.algorithm);
925
+ } catch (O) {
926
+ x(O);
851
927
  }
852
- if ((w == null ? void 0 : w.number) !== void 0)
853
- return { data: i, solution: w };
928
+ if ((g == null ? void 0 : g.number) !== void 0)
929
+ return { data: i, solution: g };
854
930
  }
855
931
  return {
856
932
  data: i,
857
- solution: await ft(i.challenge, i.salt, i.algorithm, x)
933
+ solution: await $t(i.challenge, i.salt, i.algorithm, j).promise
858
934
  };
859
935
  }
860
- async function Ce(i, w, D) {
861
- const oe = new lt();
862
- return new Promise((je) => {
863
- oe.addEventListener("message", (Ae) => {
864
- je(Ae.data);
865
- }), oe.postMessage({ alg: D, challenge: i, max: x, salt: w });
866
- });
936
+ async function Se(i, g, O, J = Math.ceil(E)) {
937
+ const Q = [];
938
+ if (J < 1)
939
+ throw new Error("Wrong number of workers configured.");
940
+ if (J > 16)
941
+ throw new Error("Too many workers. Max. 16 allowed workers.");
942
+ for (let T = 0; T < J; T++)
943
+ Q.push(new wt());
944
+ const he = Math.ceil(j / J), Ue = await Promise.all(Q.map((T, De) => {
945
+ const de = De * he;
946
+ return new Promise((Pe) => {
947
+ T.addEventListener("message", (ge) => {
948
+ if (ge.data)
949
+ for (const be of Q)
950
+ be !== T && be.postMessage({ type: "abort" });
951
+ Pe(ge.data);
952
+ }), T.postMessage({
953
+ payload: {
954
+ alg: O,
955
+ challenge: i,
956
+ max: de + he,
957
+ salt: g,
958
+ start: de
959
+ },
960
+ type: "work"
961
+ });
962
+ });
963
+ }));
964
+ for (const T of Q)
965
+ T.terminate();
966
+ return Ue.find((T) => !!T) || null;
867
967
  }
868
- function xe() {
869
- [y.UNVERIFIED, y.ERROR].includes(U) ? B() : n(6, g = !0);
968
+ function Ve() {
969
+ [m.UNVERIFIED, m.ERROR, m.EXPIRED].includes(G) ? F() : r(6, b = !0);
870
970
  }
871
- function Le() {
872
- U === y.VERIFYING && alert(r.waitAlert);
971
+ function Ze() {
972
+ G === m.VERIFYING && alert(l.waitAlert);
873
973
  }
874
- function Ie(i) {
875
- i.auto !== void 0 && (n(0, s = i.auto), s === "onload" && B()), i.challenge && (re(i.challenge), o = i.challenge), i.debug !== void 0 && n(12, a = !!i.debug), i.hidefooter !== void 0 && n(1, R = !!i.hidefooter), i.hidelogo !== void 0 && n(2, p = !!i.hidelogo), i.maxnumber !== void 0 && n(13, x = +i.maxnumber), i.mockerror !== void 0 && n(14, A = !!i.mockerror), i.name !== void 0 && n(3, j = i.name), i.test !== void 0 && n(15, G = !!i.test), i.strings && n(22, l = i.strings);
974
+ function te(i) {
975
+ console.log(">>>"), x("expire", i), clearTimeout(ee), i < 1 ? fe() : ee = setTimeout(fe, i);
976
+ }
977
+ function He(i) {
978
+ i.auto !== void 0 && (r(0, s = i.auto), s === "onload" && F()), i.expire !== void 0 && (te(i.expire), r(13, y = i.expire)), i.challenge && (ae(i.challenge), n = i.challenge), i.debug !== void 0 && r(12, a = !!i.debug), i.hidefooter !== void 0 && r(1, w = !!i.hidefooter), i.hidelogo !== void 0 && r(2, R = !!i.hidelogo), i.maxnumber !== void 0 && r(14, j = +i.maxnumber), i.mockerror !== void 0 && r(15, _ = !!i.mockerror), i.name !== void 0 && r(3, M = i.name), i.test !== void 0 && r(16, A = !!i.test), i.strings && r(24, o = i.strings), i.workers !== void 0 && r(17, E = +i.workers);
876
979
  }
877
- function X(i = y.UNVERIFIED) {
878
- n(6, g = !1), n(8, h = null), n(4, v = null), n(5, U = i);
980
+ function W(i = m.UNVERIFIED, g = null) {
981
+ clearTimeout(ee), r(6, b = !1), r(8, q = g), r(4, H = null), r(5, G = i);
879
982
  }
880
- async function B() {
881
- return X(y.VERIFYING), ke().then((i) => (re(i), E("challenge", i), Ee(i))).then(({ data: i, solution: w }) => {
882
- if (E("solution", w), (w == null ? void 0 : w.number) !== void 0)
883
- E("verified"), n(5, U = y.VERIFIED), n(6, g = !0), n(4, v = pe(i, w)), E("payload", v), Xe().then(() => {
884
- V("verified", { payload: v });
983
+ async function F() {
984
+ return W(m.VERIFYING), Te().then((i) => (ae(i), x("challenge", i), Ge(i))).then(({ data: i, solution: g }) => {
985
+ if (x("solution", g), (g == null ? void 0 : g.number) !== void 0)
986
+ x("verified"), r(5, G = m.VERIFIED), r(6, b = !0), r(4, H = Me(i, g)), x("payload", H), ot().then(() => {
987
+ k("verified", { payload: H });
885
988
  });
886
989
  else
887
990
  throw new Error("Unexpected result returned.");
888
991
  }).catch((i) => {
889
- E(i), n(5, U = y.ERROR), n(6, g = !1), n(8, h = i);
992
+ x(i), r(5, G = m.ERROR), r(6, b = !1), r(8, q = i.message);
890
993
  });
891
994
  }
892
- function Re() {
893
- g = this.checked, n(6, g);
995
+ function Fe() {
996
+ b = this.checked, r(6, b);
894
997
  }
895
- function Ne(i) {
896
- J[i ? "unshift" : "push"](() => {
897
- m = i, n(7, m);
998
+ function Oe(i) {
999
+ ie[i ? "unshift" : "push"](() => {
1000
+ h = i, r(7, h);
898
1001
  });
899
1002
  }
900
1003
  return t.$$set = (i) => {
901
- "auto" in i && n(0, s = i.auto), "challengeurl" in i && n(16, u = i.challengeurl), "challengejson" in i && n(17, f = i.challengejson), "debug" in i && n(12, a = i.debug), "hidefooter" in i && n(1, R = i.hidefooter), "hidelogo" in i && n(2, p = i.hidelogo), "name" in i && n(3, j = i.name), "maxnumber" in i && n(13, x = i.maxnumber), "mockerror" in i && n(14, A = i.mockerror), "strings" in i && n(18, _ = i.strings), "test" in i && n(15, G = i.test);
1004
+ "auto" in i && r(0, s = i.auto), "challengeurl" in i && r(18, u = i.challengeurl), "challengejson" in i && r(19, f = i.challengejson), "debug" in i && r(12, a = i.debug), "expire" in i && r(13, y = i.expire), "hidefooter" in i && r(1, w = i.hidefooter), "hidelogo" in i && r(2, R = i.hidelogo), "name" in i && r(3, M = i.name), "maxnumber" in i && r(14, j = i.maxnumber), "mockerror" in i && r(15, _ = i.mockerror), "strings" in i && r(20, V = i.strings), "test" in i && r(16, A = i.test), "workers" in i && r(17, E = i.workers);
902
1005
  }, t.$$.update = () => {
903
1006
  t.$$.dirty[0] & /*challengejson*/
904
- 131072 && (o = f ? de(f) : void 0), t.$$.dirty[0] & /*strings*/
905
- 262144 && n(22, l = _ ? de(_) : {}), t.$$.dirty[0] & /*parsedStrings*/
906
- 4194304 && n(9, r = {
1007
+ 524288 && (n = f ? Ee(f) : void 0), t.$$.dirty[0] & /*strings*/
1008
+ 1048576 && r(24, o = V ? Ee(V) : {}), t.$$.dirty[0] & /*parsedStrings*/
1009
+ 16777216 && r(9, l = {
907
1010
  error: "Verification failed. Try again later.",
908
- footer: `Protected by <a href="${ye}" target="_blank">ALTCHA</a>`,
1011
+ expired: "Verification expired. Try again.",
1012
+ footer: `Protected by <a href="${Ae}" target="_blank">ALTCHA</a>`,
909
1013
  label: "I'm not a robot",
910
1014
  verified: "Verified",
911
1015
  verifying: "Verifying...",
912
1016
  waitAlert: "Verifying... please wait.",
913
- ...l
1017
+ ...o
914
1018
  }), t.$$.dirty[0] & /*payload, state*/
915
- 48 && V("statechange", { payload: v, state: U });
1019
+ 48 && k("statechange", { payload: H, state: G });
916
1020
  }, [
917
1021
  s,
1022
+ w,
918
1023
  R,
919
- p,
920
- j,
921
- v,
922
- U,
923
- g,
924
- m,
1024
+ M,
1025
+ H,
1026
+ G,
1027
+ b,
925
1028
  h,
926
- r,
927
- xe,
928
- Le,
1029
+ q,
1030
+ l,
1031
+ Ve,
1032
+ Ze,
929
1033
  a,
930
- x,
1034
+ y,
1035
+ j,
1036
+ _,
931
1037
  A,
932
- G,
1038
+ E,
933
1039
  u,
934
1040
  f,
935
- _,
936
- Ie,
937
- X,
938
- B,
939
- l,
940
- Re,
941
- Ne
1041
+ V,
1042
+ He,
1043
+ W,
1044
+ F,
1045
+ o,
1046
+ Fe,
1047
+ Oe
942
1048
  ];
943
1049
  }
944
- class _t extends rt {
1050
+ class jt extends bt {
945
1051
  constructor(e) {
946
- super(), tt(
1052
+ super(), dt(
947
1053
  this,
948
1054
  e,
949
- vt,
950
- mt,
951
- Ue,
1055
+ Nt,
1056
+ Rt,
1057
+ Ke,
952
1058
  {
953
1059
  auto: 0,
954
- challengeurl: 16,
955
- challengejson: 17,
1060
+ challengeurl: 18,
1061
+ challengejson: 19,
956
1062
  debug: 12,
1063
+ expire: 13,
957
1064
  hidefooter: 1,
958
1065
  hidelogo: 2,
959
1066
  name: 3,
960
- maxnumber: 13,
961
- mockerror: 14,
962
- strings: 18,
963
- test: 15,
964
- configure: 19,
965
- reset: 20,
966
- verify: 21
1067
+ maxnumber: 14,
1068
+ mockerror: 15,
1069
+ strings: 20,
1070
+ test: 16,
1071
+ workers: 17,
1072
+ configure: 21,
1073
+ reset: 22,
1074
+ verify: 23
967
1075
  },
968
- ht,
1076
+ yt,
969
1077
  [-1, -1]
970
1078
  );
971
1079
  }
@@ -976,13 +1084,13 @@ class _t extends rt {
976
1084
  this.$$set({ auto: e }), C();
977
1085
  }
978
1086
  get challengeurl() {
979
- return this.$$.ctx[16];
1087
+ return this.$$.ctx[18];
980
1088
  }
981
1089
  set challengeurl(e) {
982
1090
  this.$$set({ challengeurl: e }), C();
983
1091
  }
984
1092
  get challengejson() {
985
- return this.$$.ctx[17];
1093
+ return this.$$.ctx[19];
986
1094
  }
987
1095
  set challengejson(e) {
988
1096
  this.$$set({ challengejson: e }), C();
@@ -993,6 +1101,12 @@ class _t extends rt {
993
1101
  set debug(e) {
994
1102
  this.$$set({ debug: e }), C();
995
1103
  }
1104
+ get expire() {
1105
+ return this.$$.ctx[13];
1106
+ }
1107
+ set expire(e) {
1108
+ this.$$set({ expire: e }), C();
1109
+ }
996
1110
  get hidefooter() {
997
1111
  return this.$$.ctx[1];
998
1112
  }
@@ -1012,40 +1126,46 @@ class _t extends rt {
1012
1126
  this.$$set({ name: e }), C();
1013
1127
  }
1014
1128
  get maxnumber() {
1015
- return this.$$.ctx[13];
1129
+ return this.$$.ctx[14];
1016
1130
  }
1017
1131
  set maxnumber(e) {
1018
1132
  this.$$set({ maxnumber: e }), C();
1019
1133
  }
1020
1134
  get mockerror() {
1021
- return this.$$.ctx[14];
1135
+ return this.$$.ctx[15];
1022
1136
  }
1023
1137
  set mockerror(e) {
1024
1138
  this.$$set({ mockerror: e }), C();
1025
1139
  }
1026
1140
  get strings() {
1027
- return this.$$.ctx[18];
1141
+ return this.$$.ctx[20];
1028
1142
  }
1029
1143
  set strings(e) {
1030
1144
  this.$$set({ strings: e }), C();
1031
1145
  }
1032
1146
  get test() {
1033
- return this.$$.ctx[15];
1147
+ return this.$$.ctx[16];
1034
1148
  }
1035
1149
  set test(e) {
1036
1150
  this.$$set({ test: e }), C();
1037
1151
  }
1152
+ get workers() {
1153
+ return this.$$.ctx[17];
1154
+ }
1155
+ set workers(e) {
1156
+ this.$$set({ workers: e }), C();
1157
+ }
1038
1158
  get configure() {
1039
- return this.$$.ctx[19];
1159
+ return this.$$.ctx[21];
1040
1160
  }
1041
1161
  get reset() {
1042
- return this.$$.ctx[20];
1162
+ return this.$$.ctx[22];
1043
1163
  }
1044
1164
  get verify() {
1045
- return this.$$.ctx[21];
1165
+ return this.$$.ctx[23];
1046
1166
  }
1047
1167
  }
1048
- customElements.define("altcha-widget", nt(_t, { auto: {}, challengeurl: {}, challengejson: {}, debug: { type: "Boolean" }, hidefooter: { type: "Boolean" }, hidelogo: { type: "Boolean" }, name: {}, maxnumber: {}, mockerror: { type: "Boolean" }, strings: {}, test: { type: "Boolean" } }, [], ["configure", "reset", "verify"], !1));
1168
+ customElements.define("altcha-widget", gt(jt, { auto: {}, challengeurl: {}, challengejson: {}, debug: { type: "Boolean" }, expire: {}, hidefooter: { type: "Boolean" }, hidelogo: { type: "Boolean" }, name: {}, maxnumber: {}, mockerror: { type: "Boolean" }, strings: {}, test: { type: "Boolean" }, workers: {} }, [], ["configure", "reset", "verify"], !1));
1049
1169
  export {
1050
- _t as Altcha
1170
+ jt as Altcha
1051
1171
  };