altcha 0.6.7 → 0.8.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.
@@ -1,63 +1,116 @@
1
- var yt = Object.defineProperty;
2
- var vt = (n, e, t) => e in n ? yt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var O = (n, e, t) => vt(n, typeof e != "symbol" ? e + "" : e, t);
4
- function ie() {
1
+ var Kt = Object.defineProperty;
2
+ var ut = (n) => {
3
+ throw TypeError(n);
4
+ };
5
+ var Qt = (n, e, t) => e in n ? Kt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
+ var P = (n, e, t) => Qt(n, typeof e != "symbol" ? e + "" : e, t), ht = (n, e, t) => e.has(n) || ut("Cannot " + t);
7
+ var G = (n, e, t) => (ht(n, e, "read from private field"), t ? t.call(n) : e.get(n)), fe = (n, e, t) => e.has(n) ? ut("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), dt = (n, e, t, r) => (ht(n, e, "write to private field"), r ? r.call(n, t) : e.set(n, t), t);
8
+ function Me() {
9
+ }
10
+ function $t(n, e) {
11
+ for (const t in e) n[t] = e[t];
12
+ return (
13
+ /** @type {T & S} */
14
+ n
15
+ );
5
16
  }
6
- function et(n) {
17
+ function At(n) {
7
18
  return n();
8
19
  }
9
- function qe() {
20
+ function mt() {
10
21
  return /* @__PURE__ */ Object.create(null);
11
22
  }
12
- function ue(n) {
13
- n.forEach(et);
23
+ function Ie(n) {
24
+ n.forEach(At);
14
25
  }
15
- function tt(n) {
26
+ function xt(n) {
16
27
  return typeof n == "function";
17
28
  }
18
- function kt(n, e) {
29
+ function en(n, e) {
19
30
  return n != n ? e == e : n !== e || n && typeof n == "object" || typeof n == "function";
20
31
  }
21
- function Et(n) {
32
+ function tn(n) {
22
33
  return Object.keys(n).length === 0;
23
34
  }
24
- function p(n, e) {
35
+ function nn(n, e, t, r) {
36
+ if (n) {
37
+ const o = Lt(n, e, t, r);
38
+ return n[0](o);
39
+ }
40
+ }
41
+ function Lt(n, e, t, r) {
42
+ return n[1] && r ? $t(t.ctx.slice(), n[1](r(e))) : t.ctx;
43
+ }
44
+ function rn(n, e, t, r) {
45
+ if (n[2] && r) {
46
+ const o = n[2](r(t));
47
+ if (e.dirty === void 0)
48
+ return o;
49
+ if (typeof o == "object") {
50
+ const s = [], l = Math.max(e.dirty.length, o.length);
51
+ for (let c = 0; c < l; c += 1)
52
+ s[c] = e.dirty[c] | o[c];
53
+ return s;
54
+ }
55
+ return e.dirty | o;
56
+ }
57
+ return e.dirty;
58
+ }
59
+ function on(n, e, t, r, o, s) {
60
+ if (o) {
61
+ const l = Lt(e, t, r, s);
62
+ n.p(l, o);
63
+ }
64
+ }
65
+ function sn(n) {
66
+ if (n.ctx.length > 32) {
67
+ const e = [], t = n.ctx.length / 32;
68
+ for (let r = 0; r < t; r++)
69
+ e[r] = -1;
70
+ return e;
71
+ }
72
+ return -1;
73
+ }
74
+ function I(n, e) {
25
75
  n.appendChild(e);
26
76
  }
27
- function F(n, e, t) {
77
+ function B(n, e, t) {
28
78
  n.insertBefore(e, t || null);
29
79
  }
30
- function D(n) {
80
+ function S(n) {
31
81
  n.parentNode && n.parentNode.removeChild(n);
32
82
  }
33
83
  function M(n) {
34
84
  return document.createElement(n);
35
85
  }
36
- function Y(n) {
86
+ function re(n) {
37
87
  return document.createElementNS("http://www.w3.org/2000/svg", n);
38
88
  }
39
- function pt(n) {
89
+ function It(n) {
40
90
  return document.createTextNode(n);
41
91
  }
42
- function X() {
43
- return pt(" ");
92
+ function Q() {
93
+ return It(" ");
94
+ }
95
+ function ln() {
96
+ return It("");
44
97
  }
45
- function pe(n, e, t, i) {
46
- return n.addEventListener(e, t, i), () => n.removeEventListener(e, t, i);
98
+ function Pe(n, e, t, r) {
99
+ return n.addEventListener(e, t, r), () => n.removeEventListener(e, t, r);
47
100
  }
48
- function s(n, e, t) {
101
+ function u(n, e, t) {
49
102
  t == null ? n.removeAttribute(e) : n.getAttribute(e) !== t && n.setAttribute(e, t);
50
103
  }
51
- function xt(n) {
104
+ function cn(n) {
52
105
  return Array.from(n.childNodes);
53
106
  }
54
- function Ze(n, e, t) {
107
+ function gt(n, e, t) {
55
108
  n.classList.toggle(e, !!t);
56
109
  }
57
- function Ct(n, e, { bubbles: t = !1, cancelable: i = !1 } = {}) {
58
- return new CustomEvent(n, { detail: e, bubbles: t, cancelable: i });
110
+ function an(n, e, { bubbles: t = !1, cancelable: r = !1 } = {}) {
111
+ return new CustomEvent(n, { detail: e, bubbles: t, cancelable: r });
59
112
  }
60
- function Lt(n) {
113
+ function fn(n) {
61
114
  const e = {};
62
115
  return n.childNodes.forEach(
63
116
  /** @param {Element} node */
@@ -66,215 +119,224 @@ function Lt(n) {
66
119
  }
67
120
  ), e;
68
121
  }
69
- let ce;
70
- function fe(n) {
71
- ce = n;
122
+ let pe;
123
+ function ke(n) {
124
+ pe = n;
72
125
  }
73
- function Ie() {
74
- if (!ce) throw new Error("Function called outside component initialization");
75
- return ce;
126
+ function qe() {
127
+ if (!pe) throw new Error("Function called outside component initialization");
128
+ return pe;
76
129
  }
77
- function It(n) {
78
- Ie().$$.on_mount.push(n);
130
+ function un(n) {
131
+ qe().$$.on_mount.push(n);
79
132
  }
80
- function At(n) {
81
- Ie().$$.on_destroy.push(n);
133
+ function hn(n) {
134
+ qe().$$.on_destroy.push(n);
82
135
  }
83
- function Rt() {
84
- const n = Ie();
85
- return (e, t, { cancelable: i = !1 } = {}) => {
136
+ function dn() {
137
+ const n = qe();
138
+ return (e, t, { cancelable: r = !1 } = {}) => {
86
139
  const o = n.$$.callbacks[e];
87
140
  if (o) {
88
- const l = Ct(
141
+ const s = an(
89
142
  /** @type {string} */
90
143
  e,
91
144
  t,
92
- { cancelable: i }
145
+ { cancelable: r }
93
146
  );
94
- return o.slice().forEach((f) => {
95
- f.call(n, l);
96
- }), !l.defaultPrevented;
147
+ return o.slice().forEach((l) => {
148
+ l.call(n, s);
149
+ }), !s.defaultPrevented;
97
150
  }
98
151
  return !0;
99
152
  };
100
153
  }
101
- const ne = [], we = [];
102
- let re = [];
103
- const Ye = [], nt = /* @__PURE__ */ Promise.resolve();
104
- let Ce = !1;
105
- function rt() {
106
- Ce || (Ce = !0, nt.then(y));
154
+ const he = [], Ne = [];
155
+ let de = [];
156
+ const bt = [], Tt = /* @__PURE__ */ Promise.resolve();
157
+ let Oe = !1;
158
+ function Rt() {
159
+ Oe || (Oe = !0, Tt.then(E));
107
160
  }
108
- function $t() {
109
- return rt(), nt;
161
+ function mn() {
162
+ return Rt(), Tt;
110
163
  }
111
- function Le(n) {
112
- re.push(n);
164
+ function He(n) {
165
+ de.push(n);
113
166
  }
114
- const xe = /* @__PURE__ */ new Set();
115
- let te = 0;
116
- function y() {
117
- if (te !== 0)
167
+ const Be = /* @__PURE__ */ new Set();
168
+ let ue = 0;
169
+ function E() {
170
+ if (ue !== 0)
118
171
  return;
119
- const n = ce;
172
+ const n = pe;
120
173
  do {
121
174
  try {
122
- for (; te < ne.length; ) {
123
- const e = ne[te];
124
- te++, fe(e), Mt(e.$$);
175
+ for (; ue < he.length; ) {
176
+ const e = he[ue];
177
+ ue++, ke(e), gn(e.$$);
125
178
  }
126
179
  } catch (e) {
127
- throw ne.length = 0, te = 0, e;
180
+ throw he.length = 0, ue = 0, e;
128
181
  }
129
- for (fe(null), ne.length = 0, te = 0; we.length; ) we.pop()();
130
- for (let e = 0; e < re.length; e += 1) {
131
- const t = re[e];
132
- xe.has(t) || (xe.add(t), t());
182
+ for (ke(null), he.length = 0, ue = 0; Ne.length; ) Ne.pop()();
183
+ for (let e = 0; e < de.length; e += 1) {
184
+ const t = de[e];
185
+ Be.has(t) || (Be.add(t), t());
133
186
  }
134
- re.length = 0;
135
- } while (ne.length);
136
- for (; Ye.length; )
137
- Ye.pop()();
138
- Ce = !1, xe.clear(), fe(n);
187
+ de.length = 0;
188
+ } while (he.length);
189
+ for (; bt.length; )
190
+ bt.pop()();
191
+ Oe = !1, Be.clear(), ke(n);
139
192
  }
140
- function Mt(n) {
193
+ function gn(n) {
141
194
  if (n.fragment !== null) {
142
- n.update(), ue(n.before_update);
195
+ n.update(), Ie(n.before_update);
143
196
  const e = n.dirty;
144
- n.dirty = [-1], n.fragment && n.fragment.p(n.ctx, e), n.after_update.forEach(Le);
197
+ n.dirty = [-1], n.fragment && n.fragment.p(n.ctx, e), n.after_update.forEach(He);
145
198
  }
146
199
  }
147
- function St(n) {
200
+ function bn(n) {
148
201
  const e = [], t = [];
149
- re.forEach((i) => n.indexOf(i) === -1 ? e.push(i) : t.push(i)), t.forEach((i) => i()), re = e;
202
+ de.forEach((r) => n.indexOf(r) === -1 ? e.push(r) : t.push(r)), t.forEach((r) => r()), de = e;
150
203
  }
151
- const Tt = /* @__PURE__ */ new Set();
152
- function Dt(n, e) {
153
- n && n.i && (Tt.delete(n), n.i(e));
204
+ const De = /* @__PURE__ */ new Set();
205
+ let yn;
206
+ function Ft(n, e) {
207
+ n && n.i && (De.delete(n), n.i(e));
154
208
  }
155
- function Nt(n, e, t) {
156
- const { fragment: i, after_update: o } = n.$$;
157
- i && i.m(e, t), Le(() => {
158
- const l = n.$$.on_mount.map(et).filter(tt);
159
- n.$$.on_destroy ? n.$$.on_destroy.push(...l) : ue(l), n.$$.on_mount = [];
160
- }), o.forEach(Le);
209
+ function wn(n, e, t, r) {
210
+ if (n && n.o) {
211
+ if (De.has(n)) return;
212
+ De.add(n), yn.c.push(() => {
213
+ De.delete(n);
214
+ }), n.o(e);
215
+ }
216
+ }
217
+ function _n(n, e, t) {
218
+ const { fragment: r, after_update: o } = n.$$;
219
+ r && r.m(e, t), He(() => {
220
+ const s = n.$$.on_mount.map(At).filter(xt);
221
+ n.$$.on_destroy ? n.$$.on_destroy.push(...s) : Ie(s), n.$$.on_mount = [];
222
+ }), o.forEach(He);
161
223
  }
162
- function jt(n, e) {
224
+ function En(n, e) {
163
225
  const t = n.$$;
164
- t.fragment !== null && (St(t.after_update), ue(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
226
+ t.fragment !== null && (bn(t.after_update), Ie(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
165
227
  }
166
- function Vt(n, e) {
167
- n.$$.dirty[0] === -1 && (ne.push(n), rt(), n.$$.dirty.fill(0)), n.$$.dirty[e / 31 | 0] |= 1 << e % 31;
228
+ function vn(n, e) {
229
+ n.$$.dirty[0] === -1 && (he.push(n), Rt(), n.$$.dirty.fill(0)), n.$$.dirty[e / 31 | 0] |= 1 << e % 31;
168
230
  }
169
- function Ft(n, e, t, i, o, l, f = null, c = [-1]) {
170
- const h = ce;
171
- fe(n);
172
- const u = n.$$ = {
231
+ function kn(n, e, t, r, o, s, l = null, c = [-1]) {
232
+ const a = pe;
233
+ ke(n);
234
+ const h = n.$$ = {
173
235
  fragment: null,
174
236
  ctx: [],
175
237
  // state
176
- props: l,
177
- update: ie,
238
+ props: s,
239
+ update: Me,
178
240
  not_equal: o,
179
- bound: qe(),
241
+ bound: mt(),
180
242
  // lifecycle
181
243
  on_mount: [],
182
244
  on_destroy: [],
183
245
  on_disconnect: [],
184
246
  before_update: [],
185
247
  after_update: [],
186
- context: new Map(e.context || (h ? h.$$.context : [])),
248
+ context: new Map(e.context || (a ? a.$$.context : [])),
187
249
  // everything else
188
- callbacks: qe(),
250
+ callbacks: mt(),
189
251
  dirty: c,
190
252
  skip_bound: !1,
191
- root: e.target || h.$$.root
253
+ root: e.target || a.$$.root
192
254
  };
193
- f && f(u.root);
194
- let H = !1;
195
- if (u.ctx = t ? t(n, e.props || {}, (S, B, ...P) => {
196
- const k = P.length ? P[0] : B;
197
- return u.ctx && o(u.ctx[S], u.ctx[S] = k) && (!u.skip_bound && u.bound[S] && u.bound[S](k), H && Vt(n, S)), B;
198
- }) : [], u.update(), H = !0, ue(u.before_update), u.fragment = i ? i(u.ctx) : !1, e.target) {
255
+ l && l(h.root);
256
+ let w = !1;
257
+ if (h.ctx = t ? t(n, e.props || {}, (x, $, ...k) => {
258
+ const J = k.length ? k[0] : $;
259
+ return h.ctx && o(h.ctx[x], h.ctx[x] = J) && (!h.skip_bound && h.bound[x] && h.bound[x](J), w && vn(n, x)), $;
260
+ }) : [], h.update(), w = !0, Ie(h.before_update), h.fragment = r ? r(h.ctx) : !1, e.target) {
199
261
  if (e.hydrate) {
200
- const S = xt(e.target);
201
- u.fragment && u.fragment.l(S), S.forEach(D);
262
+ const x = cn(e.target);
263
+ h.fragment && h.fragment.l(x), x.forEach(S);
202
264
  } else
203
- u.fragment && u.fragment.c();
204
- e.intro && Dt(n.$$.fragment), Nt(n, e.target, e.anchor), y();
265
+ h.fragment && h.fragment.c();
266
+ e.intro && Ft(n.$$.fragment), _n(n, e.target, e.anchor), E();
205
267
  }
206
- fe(h);
268
+ ke(a);
207
269
  }
208
- let it;
209
- typeof HTMLElement == "function" && (it = class extends HTMLElement {
210
- constructor(e, t, i) {
270
+ let Dt;
271
+ typeof HTMLElement == "function" && (Dt = class extends HTMLElement {
272
+ constructor(e, t, r) {
211
273
  super();
212
274
  /** The Svelte component constructor */
213
- O(this, "$$ctor");
275
+ P(this, "$$ctor");
214
276
  /** Slots */
215
- O(this, "$$s");
277
+ P(this, "$$s");
216
278
  /** The Svelte component instance */
217
- O(this, "$$c");
279
+ P(this, "$$c");
218
280
  /** Whether or not the custom element is connected */
219
- O(this, "$$cn", !1);
281
+ P(this, "$$cn", !1);
220
282
  /** Component props data */
221
- O(this, "$$d", {});
283
+ P(this, "$$d", {});
222
284
  /** `true` if currently in the process of reflecting component props back to attributes */
223
- O(this, "$$r", !1);
285
+ P(this, "$$r", !1);
224
286
  /** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
225
- O(this, "$$p_d", {});
287
+ P(this, "$$p_d", {});
226
288
  /** @type {Record<string, Function[]>} Event listeners */
227
- O(this, "$$l", {});
289
+ P(this, "$$l", {});
228
290
  /** @type {Map<Function, Function>} Event listener unsubscribe functions */
229
- O(this, "$$l_u", /* @__PURE__ */ new Map());
230
- this.$$ctor = e, this.$$s = t, i && this.attachShadow({ mode: "open" });
291
+ P(this, "$$l_u", /* @__PURE__ */ new Map());
292
+ this.$$ctor = e, this.$$s = t, r && this.attachShadow({ mode: "open" });
231
293
  }
232
- addEventListener(e, t, i) {
294
+ addEventListener(e, t, r) {
233
295
  if (this.$$l[e] = this.$$l[e] || [], this.$$l[e].push(t), this.$$c) {
234
296
  const o = this.$$c.$on(e, t);
235
297
  this.$$l_u.set(t, o);
236
298
  }
237
- super.addEventListener(e, t, i);
299
+ super.addEventListener(e, t, r);
238
300
  }
239
- removeEventListener(e, t, i) {
240
- if (super.removeEventListener(e, t, i), this.$$c) {
301
+ removeEventListener(e, t, r) {
302
+ if (super.removeEventListener(e, t, r), this.$$c) {
241
303
  const o = this.$$l_u.get(t);
242
304
  o && (o(), this.$$l_u.delete(t));
243
305
  }
244
306
  }
245
307
  async connectedCallback() {
246
308
  if (this.$$cn = !0, !this.$$c) {
247
- let e = function(l) {
309
+ let e = function(s) {
248
310
  return () => {
249
- let f;
311
+ let l;
250
312
  return {
251
313
  c: function() {
252
- f = M("slot"), l !== "default" && s(f, "name", l);
314
+ l = M("slot"), s !== "default" && u(l, "name", s);
253
315
  },
254
316
  /**
255
317
  * @param {HTMLElement} target
256
318
  * @param {HTMLElement} [anchor]
257
319
  */
258
- m: function(u, H) {
259
- F(u, f, H);
320
+ m: function(h, w) {
321
+ B(h, l, w);
260
322
  },
261
- d: function(u) {
262
- u && D(f);
323
+ d: function(h) {
324
+ h && S(l);
263
325
  }
264
326
  };
265
327
  };
266
328
  };
267
329
  if (await Promise.resolve(), !this.$$cn || this.$$c)
268
330
  return;
269
- const t = {}, i = Lt(this);
270
- for (const l of this.$$s)
271
- l in i && (t[l] = [e(l)]);
272
- for (const l of this.attributes) {
273
- const f = this.$$g_p(l.name);
274
- f in this.$$d || (this.$$d[f] = _e(f, l.value, this.$$p_d, "toProp"));
331
+ const t = {}, r = fn(this);
332
+ for (const s of this.$$s)
333
+ s in r && (t[s] = [e(s)]);
334
+ for (const s of this.attributes) {
335
+ const l = this.$$g_p(s.name);
336
+ l in this.$$d || (this.$$d[l] = Se(l, s.value, this.$$p_d, "toProp"));
275
337
  }
276
- for (const l in this.$$p_d)
277
- !(l in this.$$d) && this[l] !== void 0 && (this.$$d[l] = this[l], delete this[l]);
338
+ for (const s in this.$$p_d)
339
+ !(s in this.$$d) && this[s] !== void 0 && (this.$$d[s] = this[s], delete this[s]);
278
340
  this.$$c = new this.$$ctor({
279
341
  target: this.shadowRoot || this,
280
342
  props: {
@@ -287,32 +349,32 @@ typeof HTMLElement == "function" && (it = class extends HTMLElement {
287
349
  });
288
350
  const o = () => {
289
351
  this.$$r = !0;
290
- for (const l in this.$$p_d)
291
- if (this.$$d[l] = this.$$c.$$.ctx[this.$$c.$$.props[l]], this.$$p_d[l].reflect) {
292
- const f = _e(
293
- l,
294
- this.$$d[l],
352
+ for (const s in this.$$p_d)
353
+ if (this.$$d[s] = this.$$c.$$.ctx[this.$$c.$$.props[s]], this.$$p_d[s].reflect) {
354
+ const l = Se(
355
+ s,
356
+ this.$$d[s],
295
357
  this.$$p_d,
296
358
  "toAttribute"
297
359
  );
298
- f == null ? this.removeAttribute(this.$$p_d[l].attribute || l) : this.setAttribute(this.$$p_d[l].attribute || l, f);
360
+ l == null ? this.removeAttribute(this.$$p_d[s].attribute || s) : this.setAttribute(this.$$p_d[s].attribute || s, l);
299
361
  }
300
362
  this.$$r = !1;
301
363
  };
302
364
  this.$$c.$$.after_update.push(o), o();
303
- for (const l in this.$$l)
304
- for (const f of this.$$l[l]) {
305
- const c = this.$$c.$on(l, f);
306
- this.$$l_u.set(f, c);
365
+ for (const s in this.$$l)
366
+ for (const l of this.$$l[s]) {
367
+ const c = this.$$c.$on(s, l);
368
+ this.$$l_u.set(l, c);
307
369
  }
308
370
  this.$$l = {};
309
371
  }
310
372
  }
311
373
  // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
312
374
  // and setting attributes through setAttribute etc, this is helpful
313
- attributeChangedCallback(e, t, i) {
375
+ attributeChangedCallback(e, t, r) {
314
376
  var o;
315
- this.$$r || (e = this.$$g_p(e), this.$$d[e] = _e(e, i, this.$$p_d, "toProp"), (o = this.$$c) == null || o.$set({ [e]: this.$$d[e] }));
377
+ this.$$r || (e = this.$$g_p(e), this.$$d[e] = Se(e, r, this.$$p_d, "toProp"), (o = this.$$c) == null || o.$set({ [e]: this.$$d[e] }));
316
378
  }
317
379
  disconnectedCallback() {
318
380
  this.$$cn = !1, Promise.resolve().then(() => {
@@ -325,12 +387,12 @@ typeof HTMLElement == "function" && (it = class extends HTMLElement {
325
387
  ) || e;
326
388
  }
327
389
  });
328
- function _e(n, e, t, i) {
329
- var l;
330
- const o = (l = t[n]) == null ? void 0 : l.type;
331
- if (e = o === "Boolean" && typeof e != "boolean" ? e != null : e, !i || !t[n])
390
+ function Se(n, e, t, r) {
391
+ var s;
392
+ const o = (s = t[n]) == null ? void 0 : s.type;
393
+ if (e = o === "Boolean" && typeof e != "boolean" ? e != null : e, !r || !t[n])
332
394
  return e;
333
- if (i === "toAttribute")
395
+ if (r === "toAttribute")
334
396
  switch (o) {
335
397
  case "Object":
336
398
  case "Array":
@@ -355,8 +417,8 @@ function _e(n, e, t, i) {
355
417
  return e;
356
418
  }
357
419
  }
358
- function Pt(n, e, t, i, o, l) {
359
- let f = class extends it {
420
+ function pn(n, e, t, r, o, s) {
421
+ let l = class extends Dt {
360
422
  constructor() {
361
423
  super(n, t, o), this.$$p_d = e;
362
424
  }
@@ -367,26 +429,26 @@ function Pt(n, e, t, i, o, l) {
367
429
  }
368
430
  };
369
431
  return Object.keys(e).forEach((c) => {
370
- Object.defineProperty(f.prototype, c, {
432
+ Object.defineProperty(l.prototype, c, {
371
433
  get() {
372
434
  return this.$$c && c in this.$$c ? this.$$c[c] : this.$$d[c];
373
435
  },
374
- set(h) {
375
- var u;
376
- h = _e(c, h, e), this.$$d[c] = h, (u = this.$$c) == null || u.$set({ [c]: h });
436
+ set(a) {
437
+ var h;
438
+ a = Se(c, a, e), this.$$d[c] = a, (h = this.$$c) == null || h.$set({ [c]: a });
377
439
  }
378
440
  });
379
- }), i.forEach((c) => {
380
- Object.defineProperty(f.prototype, c, {
441
+ }), r.forEach((c) => {
442
+ Object.defineProperty(l.prototype, c, {
381
443
  get() {
382
- var h;
383
- return (h = this.$$c) == null ? void 0 : h[c];
444
+ var a;
445
+ return (a = this.$$c) == null ? void 0 : a[c];
384
446
  }
385
447
  });
386
448
  }), n.element = /** @type {any} */
387
- f, f;
449
+ l, l;
388
450
  }
389
- class Ht {
451
+ class Cn {
390
452
  constructor() {
391
453
  /**
392
454
  * ### PRIVATE API
@@ -395,7 +457,7 @@ class Ht {
395
457
  *
396
458
  * @type {any}
397
459
  */
398
- O(this, "$$");
460
+ P(this, "$$");
399
461
  /**
400
462
  * ### PRIVATE API
401
463
  *
@@ -403,11 +465,11 @@ class Ht {
403
465
  *
404
466
  * @type {any}
405
467
  */
406
- O(this, "$$set");
468
+ P(this, "$$set");
407
469
  }
408
470
  /** @returns {void} */
409
471
  $destroy() {
410
- jt(this, 1), this.$destroy = ie;
472
+ En(this, 1), this.$destroy = Me;
411
473
  }
412
474
  /**
413
475
  * @template {Extract<keyof Events, string>} K
@@ -416,12 +478,12 @@ class Ht {
416
478
  * @returns {() => void}
417
479
  */
418
480
  $on(e, t) {
419
- if (!tt(t))
420
- return ie;
421
- const i = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
422
- return i.push(t), () => {
423
- const o = i.indexOf(t);
424
- o !== -1 && i.splice(o, 1);
481
+ if (!xt(t))
482
+ return Me;
483
+ const r = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
484
+ return r.push(t), () => {
485
+ const o = r.indexOf(t);
486
+ o !== -1 && r.splice(o, 1);
425
487
  };
426
488
  }
427
489
  /**
@@ -429,627 +491,876 @@ class Ht {
429
491
  * @returns {void}
430
492
  */
431
493
  $set(e) {
432
- this.$$set && !Et(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
494
+ this.$$set && !tn(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
433
495
  }
434
496
  }
435
- const Ot = "4";
436
- typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(Ot);
437
- const Bt = new TextEncoder();
438
- function Ut(n) {
497
+ const An = "4";
498
+ typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(An);
499
+ const St = new TextEncoder();
500
+ function xn(n) {
439
501
  return [...new Uint8Array(n)].map((e) => e.toString(16).padStart(2, "0")).join("");
440
502
  }
441
- async function qt(n, e = "SHA-256", t = 1e5) {
442
- const i = Date.now().toString(16);
503
+ async function Ln(n, e = "SHA-256", t = 1e5) {
504
+ const r = Date.now().toString(16);
443
505
  n || (n = Math.round(Math.random() * t));
444
- const o = await ot(i, n, e);
506
+ const o = await Mt(r, n, e);
445
507
  return {
446
508
  algorithm: e,
447
509
  challenge: o,
448
- salt: i,
510
+ salt: r,
449
511
  signature: ""
450
512
  };
451
513
  }
452
- async function ot(n, e, t) {
453
- return Ut(
514
+ async function Mt(n, e, t) {
515
+ return xn(
454
516
  await crypto.subtle.digest(
455
517
  t.toUpperCase(),
456
- Bt.encode(n + e)
518
+ St.encode(n + e)
457
519
  )
458
520
  );
459
521
  }
460
- function Zt(n, e, t = "SHA-256", i = 1e6, o = 0) {
461
- const l = new AbortController(), f = Date.now();
522
+ function In(n, e, t = "SHA-256", r = 1e6, o = 0) {
523
+ const s = new AbortController(), l = Date.now();
462
524
  return {
463
525
  promise: (async () => {
464
- for (let h = o; h <= i; h += 1) {
465
- if (l.signal.aborted)
526
+ for (let a = o; a <= r; a += 1) {
527
+ if (s.signal.aborted)
466
528
  return null;
467
- if (await ot(e, h, t) === n)
529
+ if (await Mt(e, a, t) === n)
468
530
  return {
469
- number: h,
470
- took: Date.now() - f
531
+ number: a,
532
+ took: Date.now() - l
471
533
  };
472
534
  }
473
535
  return null;
474
536
  })(),
475
- controller: l
537
+ controller: s
476
538
  };
477
539
  }
478
- var b = /* @__PURE__ */ ((n) => (n.ERROR = "error", n.VERIFIED = "verified", n.VERIFYING = "verifying", n.UNVERIFIED = "unverified", n.EXPIRED = "expired", n))(b || {});
479
- function Ge(n) {
480
- let e, t, i;
540
+ function Nt() {
541
+ try {
542
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
543
+ } catch {
544
+ }
545
+ }
546
+ function Tn(n) {
547
+ const e = atob(n), t = new Uint8Array(e.length);
548
+ for (let r = 0; r < e.length; r++)
549
+ t[r] = e.charCodeAt(r);
550
+ return t;
551
+ }
552
+ function Rn(n, e = 12) {
553
+ const t = new Uint8Array(e);
554
+ for (let r = 0; r < e; r++)
555
+ t[r] = n % 256, n = Math.floor(n / 256);
556
+ return t;
557
+ }
558
+ async function Fn(n, e = "", t = 1e6, r = 0) {
559
+ const o = "AES-GCM", s = new AbortController(), l = Date.now(), c = async () => {
560
+ for (let w = r; w <= t; w += 1) {
561
+ if (s.signal.aborted || !a || !h)
562
+ return null;
563
+ try {
564
+ const x = await crypto.subtle.decrypt(
565
+ {
566
+ name: o,
567
+ iv: Rn(w)
568
+ },
569
+ a,
570
+ h
571
+ );
572
+ if (x)
573
+ return {
574
+ clearText: new TextDecoder().decode(x),
575
+ took: Date.now() - l
576
+ };
577
+ } catch {
578
+ }
579
+ }
580
+ return null;
581
+ };
582
+ let a = null, h = null;
583
+ try {
584
+ h = Tn(n);
585
+ const w = await crypto.subtle.digest(
586
+ "SHA-256",
587
+ St.encode(e)
588
+ );
589
+ a = await crypto.subtle.importKey(
590
+ "raw",
591
+ w,
592
+ o,
593
+ !1,
594
+ ["decrypt"]
595
+ );
596
+ } catch {
597
+ return {
598
+ promise: Promise.reject(),
599
+ controller: s
600
+ };
601
+ }
602
+ return {
603
+ promise: c(),
604
+ controller: s
605
+ };
606
+ }
607
+ var me, ge, Ce, Ae, xe, Le;
608
+ class Dn {
609
+ constructor(e) {
610
+ P(this, "beaconUrl", null);
611
+ P(this, "error", null);
612
+ P(this, "loadTime", Date.now());
613
+ P(this, "submitTime", null);
614
+ P(this, "startTime", null);
615
+ P(this, "viewTimeThresholdMs", 1500);
616
+ fe(this, me, {});
617
+ fe(this, ge, null);
618
+ fe(this, Ce, this.onFormChange.bind(this));
619
+ fe(this, Ae, this.onFormFocus.bind(this));
620
+ fe(this, xe, this.onFormSubmit.bind(this));
621
+ fe(this, Le, this.onUnload.bind(this));
622
+ this.elForm = e, window.addEventListener("unload", G(this, Le)), this.elForm.addEventListener("change", G(this, Ce)), this.elForm.addEventListener("focusin", G(this, Ae)), this.elForm.addEventListener("submit", G(this, xe));
623
+ }
624
+ data() {
625
+ const e = Object.entries(G(this, me));
626
+ return {
627
+ correction: e.length && e.filter(([t, r]) => r > 1).length / e.length || 0,
628
+ dropoff: !this.submitTime && !this.error && G(this, ge) ? G(this, ge) : null,
629
+ error: this.error,
630
+ mobile: this.isMobile(),
631
+ start: this.startTime,
632
+ submit: this.submitTime,
633
+ tz: Nt()
634
+ };
635
+ }
636
+ dataAsBase64() {
637
+ try {
638
+ return btoa(
639
+ JSON.stringify(this.data())
640
+ );
641
+ } catch (e) {
642
+ console.error("failed to encode ALTCHA session data to base64", e);
643
+ }
644
+ return "";
645
+ }
646
+ destroy() {
647
+ window.removeEventListener("unload", G(this, Le)), this.elForm.removeEventListener("change", G(this, Ce)), this.elForm.removeEventListener("focusin", G(this, Ae)), this.elForm.removeEventListener("submit", G(this, xe));
648
+ }
649
+ end() {
650
+ this.submitTime || (this.submitTime = Date.now());
651
+ }
652
+ getFieldName(e, t = 40) {
653
+ const r = e.getAttribute("data-group-label"), o = e.getAttribute("name") || e.getAttribute("aria-label");
654
+ return ((r ? r + ": " : "") + o).slice(0, t);
655
+ }
656
+ isMobile() {
657
+ const e = "userAgentData" in navigator && navigator.userAgentData ? navigator.userAgentData : {};
658
+ return "mobile" in e ? e.mobile === !0 : /Mobi/i.test(window.navigator.userAgent);
659
+ }
660
+ isInput(e) {
661
+ return ["INPUT", "SELECT", "TEXTAREA"].includes(e.tagName);
662
+ }
663
+ onFormFieldChange(e) {
664
+ const t = this.getFieldName(e);
665
+ t && this.trackFieldChange(t);
666
+ }
667
+ onFormChange(e) {
668
+ const t = e.target;
669
+ t && this.isInput(t) && this.onFormFieldChange(t);
670
+ }
671
+ onFormFocus(e) {
672
+ const t = e.target;
673
+ if (this.startTime || this.start(), t && this.isInput(t)) {
674
+ const r = this.getFieldName(t);
675
+ r && dt(this, ge, r);
676
+ }
677
+ }
678
+ onFormSubmit() {
679
+ this.end();
680
+ }
681
+ onUnload() {
682
+ this.loadTime <= Date.now() - this.viewTimeThresholdMs && !this.submitTime && this.sendBeacon();
683
+ }
684
+ async sendBeacon() {
685
+ if (this.beaconUrl && "sendBeacon" in navigator)
686
+ try {
687
+ navigator.sendBeacon(
688
+ new URL(this.beaconUrl, location.origin),
689
+ JSON.stringify(this.data())
690
+ );
691
+ } catch {
692
+ }
693
+ }
694
+ start() {
695
+ this.startTime = Date.now();
696
+ }
697
+ trackError(e) {
698
+ this.error = e === null ? null : String(e);
699
+ }
700
+ trackFieldChange(e) {
701
+ G(this, me)[e] = (G(this, me)[e] || 0) + 1;
702
+ }
703
+ }
704
+ me = new WeakMap(), ge = new WeakMap(), Ce = new WeakMap(), Ae = new WeakMap(), xe = new WeakMap(), Le = new WeakMap();
705
+ var y = /* @__PURE__ */ ((n) => (n.ERROR = "error", n.VERIFIED = "verified", n.VERIFYING = "verifying", n.UNVERIFIED = "unverified", n.EXPIRED = "expired", n))(y || {});
706
+ function yt(n) {
707
+ let e, t, r;
481
708
  return {
482
709
  c() {
483
- e = Y("svg"), t = Y("path"), i = Y("path"), s(t, "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"), s(t, "fill", "currentColor"), s(t, "opacity", ".25"), s(i, "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"), s(i, "fill", "currentColor"), s(i, "class", "altcha-spinner"), s(e, "width", "24"), s(e, "height", "24"), s(e, "viewBox", "0 0 24 24"), s(e, "xmlns", "http://www.w3.org/2000/svg");
710
+ e = re("svg"), t = re("path"), r = re("path"), u(t, "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"), u(t, "fill", "currentColor"), u(t, "opacity", ".25"), u(r, "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"), u(r, "fill", "currentColor"), u(r, "class", "altcha-spinner"), u(e, "width", "24"), u(e, "height", "24"), u(e, "viewBox", "0 0 24 24"), u(e, "xmlns", "http://www.w3.org/2000/svg");
484
711
  },
485
- m(o, l) {
486
- F(o, e, l), p(e, t), p(e, i);
712
+ m(o, s) {
713
+ B(o, e, s), I(e, t), I(e, r);
487
714
  },
488
715
  d(o) {
489
- o && D(e);
716
+ o && S(e);
490
717
  }
491
718
  };
492
719
  }
493
- function Yt(n) {
720
+ function Sn(n) {
494
721
  let e, t = (
495
722
  /*_strings*/
496
- n[11].label + ""
497
- ), i;
723
+ n[13].label + ""
724
+ ), r;
498
725
  return {
499
726
  c() {
500
- e = M("label"), s(e, "for", i = /*name*/
727
+ e = M("label"), u(e, "for", r = /*name*/
501
728
  n[4] + "_checkbox");
502
729
  },
503
- m(o, l) {
504
- F(o, e, l), e.innerHTML = t;
730
+ m(o, s) {
731
+ B(o, e, s), e.innerHTML = t;
505
732
  },
506
- p(o, l) {
507
- l[0] & /*_strings*/
508
- 2048 && t !== (t = /*_strings*/
509
- o[11].label + "") && (e.innerHTML = t), l[0] & /*name*/
510
- 16 && i !== (i = /*name*/
511
- o[4] + "_checkbox") && s(e, "for", i);
733
+ p(o, s) {
734
+ s[0] & /*_strings*/
735
+ 8192 && t !== (t = /*_strings*/
736
+ o[13].label + "") && (e.innerHTML = t), s[0] & /*name*/
737
+ 16 && r !== (r = /*name*/
738
+ o[4] + "_checkbox") && u(e, "for", r);
512
739
  },
513
740
  d(o) {
514
- o && D(e);
741
+ o && S(e);
515
742
  }
516
743
  };
517
744
  }
518
- function Gt(n) {
745
+ function Mn(n) {
519
746
  let e, t = (
520
747
  /*_strings*/
521
- n[11].verifying + ""
748
+ n[13].verifying + ""
522
749
  );
523
750
  return {
524
751
  c() {
525
752
  e = M("span");
526
753
  },
527
- m(i, o) {
528
- F(i, e, o), e.innerHTML = t;
754
+ m(r, o) {
755
+ B(r, e, o), e.innerHTML = t;
529
756
  },
530
- p(i, o) {
757
+ p(r, o) {
531
758
  o[0] & /*_strings*/
532
- 2048 && t !== (t = /*_strings*/
533
- i[11].verifying + "") && (e.innerHTML = t);
759
+ 8192 && t !== (t = /*_strings*/
760
+ r[13].verifying + "") && (e.innerHTML = t);
534
761
  },
535
- d(i) {
536
- i && D(e);
762
+ d(r) {
763
+ r && S(e);
537
764
  }
538
765
  };
539
766
  }
540
- function Wt(n) {
767
+ function Nn(n) {
541
768
  let e, t = (
542
769
  /*_strings*/
543
- n[11].verified + ""
544
- ), i, o;
770
+ n[13].verified + ""
771
+ ), r, o, s, l, c = (
772
+ /*session*/
773
+ n[11] && wt(n)
774
+ );
545
775
  return {
546
776
  c() {
547
- e = M("span"), i = X(), o = M("input"), s(o, "type", "hidden"), s(
777
+ e = M("span"), r = Q(), o = M("input"), s = Q(), c && c.c(), l = ln(), u(o, "type", "hidden"), u(
548
778
  o,
549
779
  "name",
550
780
  /*name*/
551
781
  n[4]
552
782
  ), o.value = /*payload*/
553
- n[5];
783
+ n[6];
554
784
  },
555
- m(l, f) {
556
- F(l, e, f), e.innerHTML = t, F(l, i, f), F(l, o, f);
785
+ m(a, h) {
786
+ B(a, e, h), e.innerHTML = t, B(a, r, h), B(a, o, h), B(a, s, h), c && c.m(a, h), B(a, l, h);
557
787
  },
558
- p(l, f) {
559
- f[0] & /*_strings*/
560
- 2048 && t !== (t = /*_strings*/
561
- l[11].verified + "") && (e.innerHTML = t), f[0] & /*name*/
562
- 16 && s(
788
+ p(a, h) {
789
+ h[0] & /*_strings*/
790
+ 8192 && t !== (t = /*_strings*/
791
+ a[13].verified + "") && (e.innerHTML = t), h[0] & /*name*/
792
+ 16 && u(
563
793
  o,
564
794
  "name",
565
795
  /*name*/
566
- l[4]
567
- ), f[0] & /*payload*/
568
- 32 && (o.value = /*payload*/
569
- l[5]);
796
+ a[4]
797
+ ), h[0] & /*payload*/
798
+ 64 && (o.value = /*payload*/
799
+ a[6]), /*session*/
800
+ a[11] ? c ? c.p(a, h) : (c = wt(a), c.c(), c.m(l.parentNode, l)) : c && (c.d(1), c = null);
570
801
  },
571
- d(l) {
572
- l && (D(e), D(i), D(o));
802
+ d(a) {
803
+ a && (S(e), S(r), S(o), S(s), S(l)), c && c.d(a);
573
804
  }
574
805
  };
575
806
  }
576
- function We(n) {
577
- let e, t, i, o, l, f, c;
807
+ function wt(n) {
808
+ let e;
578
809
  return {
579
810
  c() {
580
- e = M("div"), t = M("a"), i = Y("svg"), o = Y("path"), l = Y("path"), f = Y("path"), s(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"), s(o, "fill", "currentColor"), s(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"), s(l, "fill", "currentColor"), s(f, "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"), s(f, "fill", "currentColor"), s(i, "width", "22"), s(i, "height", "22"), s(i, "viewBox", "0 0 20 20"), s(i, "fill", "none"), s(i, "xmlns", "http://www.w3.org/2000/svg"), s(t, "href", lt), s(t, "target", "_blank"), s(t, "class", "altcha-logo"), s(t, "aria-label", c = /*_strings*/
581
- n[11].ariaLinkLabel);
811
+ e = M("input"), u(e, "type", "hidden"), u(e, "name", "__session"), e.value = /*sessionPayload*/
812
+ n[12];
582
813
  },
583
- m(h, u) {
584
- F(h, e, u), p(e, t), p(t, i), p(i, o), p(i, l), p(i, f);
814
+ m(t, r) {
815
+ B(t, e, r);
585
816
  },
586
- p(h, u) {
587
- u[0] & /*_strings*/
588
- 2048 && c !== (c = /*_strings*/
589
- h[11].ariaLinkLabel) && s(t, "aria-label", c);
817
+ p(t, r) {
818
+ r[0] & /*sessionPayload*/
819
+ 4096 && (e.value = /*sessionPayload*/
820
+ t[12]);
590
821
  },
591
- d(h) {
592
- h && D(e);
822
+ d(t) {
823
+ t && S(e);
593
824
  }
594
825
  };
595
826
  }
596
- function Xe(n) {
597
- let e, t, i, o;
598
- function l(h, u) {
827
+ function _t(n) {
828
+ let e, t, r, o, s, l, c;
829
+ return {
830
+ c() {
831
+ e = M("div"), t = M("a"), r = re("svg"), o = re("path"), s = re("path"), l = re("path"), u(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"), u(o, "fill", "currentColor"), u(s, "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"), u(s, "fill", "currentColor"), u(l, "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"), u(l, "fill", "currentColor"), u(r, "width", "22"), u(r, "height", "22"), u(r, "viewBox", "0 0 20 20"), u(r, "fill", "none"), u(r, "xmlns", "http://www.w3.org/2000/svg"), u(t, "href", Vt), u(t, "target", "_blank"), u(t, "class", "altcha-logo"), u(t, "aria-label", c = /*_strings*/
832
+ n[13].ariaLinkLabel);
833
+ },
834
+ m(a, h) {
835
+ B(a, e, h), I(e, t), I(t, r), I(r, o), I(r, s), I(r, l);
836
+ },
837
+ p(a, h) {
838
+ h[0] & /*_strings*/
839
+ 8192 && c !== (c = /*_strings*/
840
+ a[13].ariaLinkLabel) && u(t, "aria-label", c);
841
+ },
842
+ d(a) {
843
+ a && S(e);
844
+ }
845
+ };
846
+ }
847
+ function Et(n) {
848
+ let e, t, r, o;
849
+ function s(a, h) {
599
850
  return (
600
851
  /*state*/
601
- h[6] === b.EXPIRED ? Jt : Xt
852
+ a[7] === y.EXPIRED ? jn : Vn
602
853
  );
603
854
  }
604
- let f = l(n), c = f(n);
855
+ let l = s(n), c = l(n);
605
856
  return {
606
857
  c() {
607
- e = M("div"), t = Y("svg"), i = Y("path"), o = X(), c.c(), s(i, "stroke-linecap", "round"), s(i, "stroke-linejoin", "round"), s(i, "d", "M6 18L18 6M6 6l12 12"), s(t, "width", "14"), s(t, "height", "14"), s(t, "xmlns", "http://www.w3.org/2000/svg"), s(t, "fill", "none"), s(t, "viewBox", "0 0 24 24"), s(t, "stroke-width", "1.5"), s(t, "stroke", "currentColor"), s(e, "class", "altcha-error");
858
+ e = M("div"), t = re("svg"), r = re("path"), o = Q(), c.c(), u(r, "stroke-linecap", "round"), u(r, "stroke-linejoin", "round"), u(r, "d", "M6 18L18 6M6 6l12 12"), u(t, "width", "14"), u(t, "height", "14"), u(t, "xmlns", "http://www.w3.org/2000/svg"), u(t, "fill", "none"), u(t, "viewBox", "0 0 24 24"), u(t, "stroke-width", "1.5"), u(t, "stroke", "currentColor"), u(e, "class", "altcha-error");
608
859
  },
609
- m(h, u) {
610
- F(h, e, u), p(e, t), p(t, i), p(e, o), c.m(e, null);
860
+ m(a, h) {
861
+ B(a, e, h), I(e, t), I(t, r), I(e, o), c.m(e, null);
611
862
  },
612
- p(h, u) {
613
- f === (f = l(h)) && c ? c.p(h, u) : (c.d(1), c = f(h), c && (c.c(), c.m(e, null)));
863
+ p(a, h) {
864
+ l === (l = s(a)) && c ? c.p(a, h) : (c.d(1), c = l(a), c && (c.c(), c.m(e, null)));
614
865
  },
615
- d(h) {
616
- h && D(e), c.d();
866
+ d(a) {
867
+ a && S(e), c.d();
617
868
  }
618
869
  };
619
870
  }
620
- function Xt(n) {
871
+ function Vn(n) {
621
872
  let e, t = (
622
873
  /*_strings*/
623
- n[11].error + ""
874
+ n[13].error + ""
624
875
  );
625
876
  return {
626
877
  c() {
627
- e = M("div"), s(
878
+ e = M("div"), u(
628
879
  e,
629
880
  "title",
630
881
  /*error*/
631
- n[10]
882
+ n[5]
632
883
  );
633
884
  },
634
- m(i, o) {
635
- F(i, e, o), e.innerHTML = t;
885
+ m(r, o) {
886
+ B(r, e, o), e.innerHTML = t;
636
887
  },
637
- p(i, o) {
888
+ p(r, o) {
638
889
  o[0] & /*_strings*/
639
- 2048 && t !== (t = /*_strings*/
640
- i[11].error + "") && (e.innerHTML = t), o[0] & /*error*/
641
- 1024 && s(
890
+ 8192 && t !== (t = /*_strings*/
891
+ r[13].error + "") && (e.innerHTML = t), o[0] & /*error*/
892
+ 32 && u(
642
893
  e,
643
894
  "title",
644
895
  /*error*/
645
- i[10]
896
+ r[5]
646
897
  );
647
898
  },
648
- d(i) {
649
- i && D(e);
899
+ d(r) {
900
+ r && S(e);
650
901
  }
651
902
  };
652
903
  }
653
- function Jt(n) {
904
+ function jn(n) {
654
905
  let e, t = (
655
906
  /*_strings*/
656
- n[11].expired + ""
907
+ n[13].expired + ""
657
908
  );
658
909
  return {
659
910
  c() {
660
- e = M("div"), s(
911
+ e = M("div"), u(
661
912
  e,
662
913
  "title",
663
914
  /*error*/
664
- n[10]
915
+ n[5]
665
916
  );
666
917
  },
667
- m(i, o) {
668
- F(i, e, o), e.innerHTML = t;
918
+ m(r, o) {
919
+ B(r, e, o), e.innerHTML = t;
669
920
  },
670
- p(i, o) {
921
+ p(r, o) {
671
922
  o[0] & /*_strings*/
672
- 2048 && t !== (t = /*_strings*/
673
- i[11].expired + "") && (e.innerHTML = t), o[0] & /*error*/
674
- 1024 && s(
923
+ 8192 && t !== (t = /*_strings*/
924
+ r[13].expired + "") && (e.innerHTML = t), o[0] & /*error*/
925
+ 32 && u(
675
926
  e,
676
927
  "title",
677
928
  /*error*/
678
- i[10]
929
+ r[5]
679
930
  );
680
931
  },
681
- d(i) {
682
- i && D(e);
932
+ d(r) {
933
+ r && S(e);
683
934
  }
684
935
  };
685
936
  }
686
- function Je(n) {
687
- let e, t, i = (
937
+ function vt(n) {
938
+ let e, t, r = (
688
939
  /*_strings*/
689
- n[11].footer + ""
940
+ n[13].footer + ""
690
941
  );
691
942
  return {
692
943
  c() {
693
- e = M("div"), t = M("div"), s(e, "class", "altcha-footer");
944
+ e = M("div"), t = M("div"), u(e, "class", "altcha-footer");
694
945
  },
695
- m(o, l) {
696
- F(o, e, l), p(e, t), t.innerHTML = i;
946
+ m(o, s) {
947
+ B(o, e, s), I(e, t), t.innerHTML = r;
697
948
  },
698
- p(o, l) {
699
- l[0] & /*_strings*/
700
- 2048 && i !== (i = /*_strings*/
701
- o[11].footer + "") && (t.innerHTML = i);
949
+ p(o, s) {
950
+ s[0] & /*_strings*/
951
+ 8192 && r !== (r = /*_strings*/
952
+ o[13].footer + "") && (t.innerHTML = r);
702
953
  },
703
954
  d(o) {
704
- o && D(e);
955
+ o && S(e);
705
956
  }
706
957
  };
707
958
  }
708
- function ze(n) {
959
+ function kt(n) {
709
960
  let e;
710
961
  return {
711
962
  c() {
712
- e = M("div"), s(e, "class", "altcha-anchor-arrow");
963
+ e = M("div"), u(e, "class", "altcha-anchor-arrow");
713
964
  },
714
- m(t, i) {
715
- F(t, e, i), n[37](e);
965
+ m(t, r) {
966
+ B(t, e, r), n[46](e);
716
967
  },
717
- p: ie,
968
+ p: Me,
718
969
  d(t) {
719
- t && D(e), n[37](null);
970
+ t && S(e), n[46](null);
720
971
  }
721
972
  };
722
973
  }
723
- function zt(n) {
724
- let e, t, i, o, l, f, c, h, u, H, S, B, P, k, G, $ = (
974
+ function Un(n) {
975
+ let e, t, r, o, s, l, c, a, h, w, x, $, k, J, H, ee, te;
976
+ const R = (
977
+ /*#slots*/
978
+ n[44].default
979
+ ), O = nn(
980
+ R,
981
+ n,
982
+ /*$$scope*/
983
+ n[43],
984
+ null
985
+ );
986
+ let N = (
725
987
  /*state*/
726
- n[6] === b.VERIFYING && Ge()
988
+ n[7] === y.VERIFYING && yt()
727
989
  );
728
- function J(d, _) {
990
+ function oe(d, C) {
729
991
  return (
730
992
  /*state*/
731
- d[6] === b.VERIFIED ? Wt : (
993
+ d[7] === y.VERIFIED ? Nn : (
732
994
  /*state*/
733
- d[6] === b.VERIFYING ? Gt : Yt
995
+ d[7] === y.VERIFYING ? Mn : Sn
734
996
  )
735
997
  );
736
998
  }
737
- let Z = J(n), N = Z(n), x = (
999
+ let ne = oe(n), Z = ne(n), L = (
738
1000
  /*hidelogo*/
739
1001
  (n[3] !== !0 || /*isFreeSaaS*/
740
- n[12]) && We(n)
741
- ), I = (
1002
+ n[14]) && _t(n)
1003
+ ), F = (
742
1004
  /*error*/
743
- (n[10] || /*state*/
744
- n[6] === b.EXPIRED) && Xe(n)
745
- ), A = (
1005
+ (n[5] || /*state*/
1006
+ n[7] === y.EXPIRED) && Et(n)
1007
+ ), p = (
746
1008
  /*_strings*/
747
- n[11].footer && /*hidefooter*/
1009
+ n[13].footer && /*hidefooter*/
748
1010
  (n[2] !== !0 || /*isFreeSaaS*/
749
- n[12]) && Je(n)
750
- ), w = (
1011
+ n[14]) && vt(n)
1012
+ ), D = (
751
1013
  /*floating*/
752
- n[1] && ze(n)
1014
+ n[1] && kt(n)
753
1015
  );
754
1016
  return {
755
1017
  c() {
756
- e = M("div"), t = M("div"), $ && $.c(), i = X(), o = M("div"), l = M("input"), h = X(), u = M("div"), N.c(), H = X(), x && x.c(), S = X(), I && I.c(), B = X(), A && A.c(), P = X(), w && w.c(), s(l, "type", "checkbox"), s(l, "id", f = /*name*/
757
- n[4] + "_checkbox"), l.required = c = /*auto*/
758
- n[0] !== "onsubmit", s(o, "class", "altcha-checkbox"), Ze(
759
- o,
1018
+ O && O.c(), e = Q(), t = M("div"), r = M("div"), N && N.c(), o = Q(), s = M("div"), l = M("input"), h = Q(), w = M("div"), Z.c(), x = Q(), L && L.c(), $ = Q(), F && F.c(), k = Q(), p && p.c(), J = Q(), D && D.c(), u(l, "type", "checkbox"), u(l, "id", c = /*name*/
1019
+ n[4] + "_checkbox"), l.required = a = /*auto*/
1020
+ n[0] !== "onsubmit", u(s, "class", "altcha-checkbox"), gt(
1021
+ s,
760
1022
  "altcha-hidden",
761
1023
  /*state*/
762
- n[6] === b.VERIFYING
763
- ), s(u, "class", "altcha-label"), s(t, "class", "altcha-main"), s(e, "class", "altcha"), s(
764
- e,
1024
+ n[7] === y.VERIFYING
1025
+ ), u(w, "class", "altcha-label"), u(r, "class", "altcha-main"), u(t, "class", "altcha"), u(
1026
+ t,
765
1027
  "data-state",
766
1028
  /*state*/
767
- n[6]
768
- ), s(
769
- e,
1029
+ n[7]
1030
+ ), u(
1031
+ t,
770
1032
  "data-floating",
771
1033
  /*floating*/
772
1034
  n[1]
773
1035
  );
774
1036
  },
775
- m(d, _) {
776
- F(d, e, _), p(e, t), $ && $.m(t, null), p(t, i), p(t, o), p(o, l), l.checked = /*checked*/
777
- n[7], p(t, h), p(t, u), N.m(u, null), p(t, H), x && x.m(t, null), p(e, S), I && I.m(e, null), p(e, B), A && A.m(e, null), p(e, P), w && w.m(e, null), n[38](e), k || (G = [
778
- pe(
1037
+ m(d, C) {
1038
+ O && O.m(d, C), B(d, e, C), B(d, t, C), I(t, r), N && N.m(r, null), I(r, o), I(r, s), I(s, l), l.checked = /*checked*/
1039
+ n[8], I(r, h), I(r, w), Z.m(w, null), I(r, x), L && L.m(r, null), I(t, $), F && F.m(t, null), I(t, k), p && p.m(t, null), I(t, J), D && D.m(t, null), n[47](t), H = !0, ee || (te = [
1040
+ Pe(
779
1041
  l,
780
1042
  "change",
781
1043
  /*input_change_handler*/
782
- n[36]
1044
+ n[45]
783
1045
  ),
784
- pe(
1046
+ Pe(
785
1047
  l,
786
1048
  "change",
787
1049
  /*onCheckedChange*/
788
- n[13]
1050
+ n[15]
789
1051
  ),
790
- pe(
1052
+ Pe(
791
1053
  l,
792
1054
  "invalid",
793
1055
  /*onInvalid*/
794
- n[14]
1056
+ n[16]
795
1057
  )
796
- ], k = !0);
1058
+ ], ee = !0);
797
1059
  },
798
- p(d, _) {
799
- /*state*/
800
- d[6] === b.VERIFYING ? $ || ($ = Ge(), $.c(), $.m(t, i)) : $ && ($.d(1), $ = null), _[0] & /*name*/
801
- 16 && f !== (f = /*name*/
802
- d[4] + "_checkbox") && s(l, "id", f), _[0] & /*auto*/
803
- 1 && c !== (c = /*auto*/
804
- d[0] !== "onsubmit") && (l.required = c), _[0] & /*checked*/
805
- 128 && (l.checked = /*checked*/
806
- d[7]), _[0] & /*state*/
807
- 64 && Ze(
808
- o,
1060
+ p(d, C) {
1061
+ O && O.p && (!H || C[1] & /*$$scope*/
1062
+ 4096) && on(
1063
+ O,
1064
+ R,
1065
+ d,
1066
+ /*$$scope*/
1067
+ d[43],
1068
+ H ? rn(
1069
+ R,
1070
+ /*$$scope*/
1071
+ d[43],
1072
+ C,
1073
+ null
1074
+ ) : sn(
1075
+ /*$$scope*/
1076
+ d[43]
1077
+ ),
1078
+ null
1079
+ ), /*state*/
1080
+ d[7] === y.VERIFYING ? N || (N = yt(), N.c(), N.m(r, o)) : N && (N.d(1), N = null), (!H || C[0] & /*name*/
1081
+ 16 && c !== (c = /*name*/
1082
+ d[4] + "_checkbox")) && u(l, "id", c), (!H || C[0] & /*auto*/
1083
+ 1 && a !== (a = /*auto*/
1084
+ d[0] !== "onsubmit")) && (l.required = a), C[0] & /*checked*/
1085
+ 256 && (l.checked = /*checked*/
1086
+ d[8]), (!H || C[0] & /*state*/
1087
+ 128) && gt(
1088
+ s,
809
1089
  "altcha-hidden",
810
1090
  /*state*/
811
- d[6] === b.VERIFYING
812
- ), Z === (Z = J(d)) && N ? N.p(d, _) : (N.d(1), N = Z(d), N && (N.c(), N.m(u, null))), /*hidelogo*/
1091
+ d[7] === y.VERIFYING
1092
+ ), ne === (ne = oe(d)) && Z ? Z.p(d, C) : (Z.d(1), Z = ne(d), Z && (Z.c(), Z.m(w, null))), /*hidelogo*/
813
1093
  d[3] !== !0 || /*isFreeSaaS*/
814
- d[12] ? x ? x.p(d, _) : (x = We(d), x.c(), x.m(t, null)) : x && (x.d(1), x = null), /*error*/
815
- d[10] || /*state*/
816
- d[6] === b.EXPIRED ? I ? I.p(d, _) : (I = Xe(d), I.c(), I.m(e, B)) : I && (I.d(1), I = null), /*_strings*/
817
- d[11].footer && /*hidefooter*/
1094
+ d[14] ? L ? L.p(d, C) : (L = _t(d), L.c(), L.m(r, null)) : L && (L.d(1), L = null), /*error*/
1095
+ d[5] || /*state*/
1096
+ d[7] === y.EXPIRED ? F ? F.p(d, C) : (F = Et(d), F.c(), F.m(t, k)) : F && (F.d(1), F = null), /*_strings*/
1097
+ d[13].footer && /*hidefooter*/
818
1098
  (d[2] !== !0 || /*isFreeSaaS*/
819
- d[12]) ? A ? A.p(d, _) : (A = Je(d), A.c(), A.m(e, P)) : A && (A.d(1), A = null), /*floating*/
820
- d[1] ? w ? w.p(d, _) : (w = ze(d), w.c(), w.m(e, null)) : w && (w.d(1), w = null), _[0] & /*state*/
821
- 64 && s(
822
- e,
1099
+ d[14]) ? p ? p.p(d, C) : (p = vt(d), p.c(), p.m(t, J)) : p && (p.d(1), p = null), /*floating*/
1100
+ d[1] ? D ? D.p(d, C) : (D = kt(d), D.c(), D.m(t, null)) : D && (D.d(1), D = null), (!H || C[0] & /*state*/
1101
+ 128) && u(
1102
+ t,
823
1103
  "data-state",
824
1104
  /*state*/
825
- d[6]
826
- ), _[0] & /*floating*/
827
- 2 && s(
828
- e,
1105
+ d[7]
1106
+ ), (!H || C[0] & /*floating*/
1107
+ 2) && u(
1108
+ t,
829
1109
  "data-floating",
830
1110
  /*floating*/
831
1111
  d[1]
832
1112
  );
833
1113
  },
834
- i: ie,
835
- o: ie,
1114
+ i(d) {
1115
+ H || (Ft(O, d), H = !0);
1116
+ },
1117
+ o(d) {
1118
+ wn(O, d), H = !1;
1119
+ },
836
1120
  d(d) {
837
- d && D(e), $ && $.d(), N.d(), x && x.d(), I && I.d(), A && A.d(), w && w.d(), n[38](null), k = !1, ue(G);
1121
+ d && (S(e), S(t)), O && O.d(d), N && N.d(), Z.d(), L && L.d(), F && F.d(), p && p.d(), D && D.d(), n[47](null), ee = !1, Ie(te);
838
1122
  }
839
1123
  };
840
1124
  }
841
- const Ke = "Visit Altcha.org", lt = "https://altcha.org/";
842
- function Qe(n) {
1125
+ const pt = "Visit Altcha.org", Vt = "https://altcha.org/";
1126
+ function Ct(n) {
843
1127
  return JSON.parse(n);
844
1128
  }
845
- function Kt() {
846
- try {
847
- return Intl.DateTimeFormat().resolvedOptions().timeZone;
848
- } catch {
849
- }
850
- }
851
- function Qt(n, e, t) {
852
- var Be, Ue;
853
- let i, o, l, f, { auto: c = void 0 } = e, { blockspam: h = void 0 } = e, { challengeurl: u = void 0 } = e, { challengejson: H = void 0 } = e, { debug: S = !1 } = e, { delay: B = 0 } = e, { expire: P = void 0 } = e, { floating: k = void 0 } = e, { floatinganchor: G = void 0 } = e, { floatingoffset: $ = void 0 } = e, { hidefooter: J = !1 } = e, { hidelogo: Z = !1 } = e, { name: N = "altcha" } = e, { maxnumber: x = 1e6 } = e, { mockerror: I = !1 } = e, { refetchonexpire: A = !0 } = e, { spamfilter: w = !1 } = e, { strings: d = void 0 } = e, { test: _ = !1 } = e, { verifyurl: z = void 0 } = e, { workers: oe = Math.min(16, navigator.hardwareConcurrency || 8) } = e, { workerurl: ae = void 0 } = e;
854
- const ye = Rt(), Ae = ["SHA-256", "SHA-384", "SHA-512"], Re = (Ue = (Be = document.documentElement.lang) == null ? void 0 : Be.split("-")) == null ? void 0 : Ue[0];
855
- let W = !1, C, K = null, he = null, m = null, ve = null, Q = null, j = b.UNVERIFIED, U = null;
856
- At(() => {
857
- m && (m.removeEventListener("submit", Me), m.removeEventListener("reset", Se), m.removeEventListener("focusin", $e), m = null), U && (clearTimeout(U), U = null), document.removeEventListener("click", je), document.removeEventListener("scroll", Ve), window.removeEventListener("resize", Pe);
858
- }), It(() => {
859
- E("mounted", "0.6.7"), E("workers", oe), _ && E("using test mode"), P && de(P), c !== void 0 && E("auto", c), k !== void 0 && He(k), m = C.closest("form"), m && (m.addEventListener("submit", Me, { capture: !0 }), m.addEventListener("reset", Se), c === "onfocus" && m.addEventListener("focusin", $e)), c === "onload" && ee(), i && (J || Z) && E("Attributes hidefooter and hidelogo ignored because usage with free API Keys require attribution.");
1129
+ function Pn(n, e, t) {
1130
+ var ct, at;
1131
+ let r, o, s, l, { $$slots: c = {}, $$scope: a } = e, { analytics: h = !1 } = e, { auto: w = void 0 } = e, { beaconurl: x = void 0 } = e, { blockspam: $ = void 0 } = e, { challengeurl: k = void 0 } = e, { challengejson: J = void 0 } = e, { debug: H = !1 } = e, { delay: ee = 0 } = e, { expire: te = void 0 } = e, { floating: R = void 0 } = e, { floatinganchor: O = void 0 } = e, { floatingoffset: N = void 0 } = e, { hidefooter: oe = !1 } = e, { hidelogo: ne = !1 } = e, { name: Z = "altcha" } = e, { maxnumber: L = 1e6 } = e, { mockerror: F = !1 } = e, { obfuscated: p = void 0 } = e, { refetchonexpire: D = !0 } = e, { spamfilter: d = !1 } = e, { strings: C = void 0 } = e, { test: X = !1 } = e, { verifyurl: se = void 0 } = e, { workers: be = Math.min(16, navigator.hardwareConcurrency || 8) } = e, { workerurl: Te = void 0 } = e;
1132
+ const Ve = dn(), Ze = ["SHA-256", "SHA-384", "SHA-512"], Ge = (at = (ct = document.documentElement.lang) == null ? void 0 : ct.split("-")) == null ? void 0 : at[0];
1133
+ let W = !1, z = null, v, le = null, Re = null, b = null, ie = null, ye = null, K = null, ce = null, q = null, Ye = null, T = y.UNVERIFIED;
1134
+ hn(() => {
1135
+ b && (b.removeEventListener("submit", We), b.removeEventListener("reset", ze), b.removeEventListener("focusin", Xe), b = null), ie && v.removeEventListener("click", Je), q && q.destroy(), K && (clearTimeout(K), K = null), document.removeEventListener("click", nt), document.removeEventListener("scroll", it), window.removeEventListener("resize", ot);
1136
+ }), un(() => {
1137
+ var i, f;
1138
+ A("mounted", "0.8.0"), A("workers", be), X && A("using test mode"), te && Fe(te), w !== void 0 && A("auto", w), R !== void 0 && st(R), b = v.closest("form"), b && (b.addEventListener("submit", We, { capture: !0 }), b.addEventListener("reset", ze), w === "onfocus" && b.addEventListener("focusin", Xe)), ie = ((i = v.parentElement) == null ? void 0 : i.querySelector("[data-clarify-button]")) || ((f = v.parentElement) == null ? void 0 : f.querySelector("button, a")), ie && ie.addEventListener("click", Je), h && $e(), w === "onload" && (p ? _e() : ae()), r && (oe || ne) && A("Attributes hidefooter and hidelogo ignored because usage with free API Keys require attribution.");
860
1139
  });
861
- function E(...r) {
862
- (S || r.some((a) => a instanceof Error)) && console[r[0] instanceof Error ? "error" : "log"]("ALTCHA", ...r);
1140
+ function A(...i) {
1141
+ (H || i.some((f) => f instanceof Error)) && console[i[0] instanceof Error ? "error" : "log"]("ALTCHA", ...i);
1142
+ }
1143
+ function Je(i) {
1144
+ i.preventDefault(), T === y.UNVERIFIED && _e();
863
1145
  }
864
- function $e(r) {
865
- j === b.UNVERIFIED && ee();
1146
+ function Xe(i) {
1147
+ T === y.UNVERIFIED && ae();
866
1148
  }
867
- function Me(r) {
868
- m && c === "onsubmit" && (j === b.UNVERIFIED ? (r.preventDefault(), r.stopPropagation(), ee().then(() => {
869
- m == null || m.requestSubmit();
870
- })) : j !== b.VERIFIED && (r.preventDefault(), r.stopPropagation(), j === b.VERIFYING && Fe()));
1149
+ function We(i) {
1150
+ b && q && T === y.VERIFIED && (q.end(), t(12, Ye = q.dataAsBase64())), b && w === "onsubmit" && (T === y.UNVERIFIED ? (i.preventDefault(), i.stopPropagation(), ae().then(() => {
1151
+ b == null || b.requestSubmit();
1152
+ })) : T !== y.VERIFIED && (i.preventDefault(), i.stopPropagation(), T === y.VERIFYING && rt()));
871
1153
  }
872
- function Se() {
873
- ge();
1154
+ function ze() {
1155
+ we();
874
1156
  }
875
- function Te(r, a) {
1157
+ function Ke(i, f) {
876
1158
  return btoa(JSON.stringify({
877
- algorithm: r.algorithm,
878
- challenge: r.challenge,
879
- number: a.number,
880
- salt: r.salt,
881
- signature: r.signature,
882
- test: _ ? !0 : void 0,
883
- took: a.took
1159
+ algorithm: i.algorithm,
1160
+ challenge: i.challenge,
1161
+ number: f.number,
1162
+ salt: i.salt,
1163
+ signature: i.signature,
1164
+ test: X ? !0 : void 0,
1165
+ took: f.took
884
1166
  }));
885
1167
  }
886
- function De(r) {
887
- if (!r.algorithm)
1168
+ function Qe(i) {
1169
+ if (!i.algorithm)
888
1170
  throw new Error("Invalid challenge. Property algorithm is missing.");
889
- if (r.signature === void 0)
1171
+ if (i.signature === void 0)
890
1172
  throw new Error("Invalid challenge. Property signature is missing.");
891
- if (!Ae.includes(r.algorithm.toUpperCase()))
892
- throw new Error(`Unknown algorithm value. Allowed values: ${Ae.join(", ")}`);
893
- if (!r.challenge || r.challenge.length < 40)
1173
+ if (!Ze.includes(i.algorithm.toUpperCase()))
1174
+ throw new Error(`Unknown algorithm value. Allowed values: ${Ze.join(", ")}`);
1175
+ if (!i.challenge || i.challenge.length < 40)
894
1176
  throw new Error("Challenge is too short. Min. 40 chars.");
895
- if (!r.salt || r.salt.length < 10)
1177
+ if (!i.salt || i.salt.length < 10)
896
1178
  throw new Error("Salt is too short. Min. 10 chars.");
897
1179
  }
898
- async function st() {
899
- var r;
900
- if (I)
901
- throw E("mocking error"), new Error("Mocked error.");
1180
+ async function jt() {
1181
+ var i;
1182
+ if (F)
1183
+ throw A("mocking error"), new Error("Mocked error.");
902
1184
  if (o)
903
- return E("using provided json data"), o;
904
- if (_)
905
- return E("generating test challenge", { test: _ }), qt(typeof _ != "boolean" ? +_ : void 0);
1185
+ return A("using provided json data"), o;
1186
+ if (X)
1187
+ return A("generating test challenge", { test: X }), Ln(typeof X != "boolean" ? +X : void 0);
906
1188
  {
907
- if (!u)
1189
+ if (!k && b) {
1190
+ const _ = b.getAttribute("action");
1191
+ _ != null && _.includes("/form/") && t(17, k = _ + "/altcha");
1192
+ }
1193
+ if (!k)
908
1194
  throw new Error("Attribute challengeurl not set.");
909
- E("fetching challenge from", u);
910
- const a = await fetch(u, {
911
- headers: {
912
- "x-altcha-spam-filter": w ? "1" : "0"
913
- }
1195
+ A("fetching challenge from", k);
1196
+ const f = await fetch(k, {
1197
+ headers: d ? { "x-altcha-spam-filter": "1" } : {}
914
1198
  });
915
- if (a.status !== 200)
916
- throw new Error(`Server responded with ${a.status}.`);
917
- const g = a.headers.get("Expires"), R = a.headers.get("X-Altcha-Config"), V = await a.json(), T = new URLSearchParams((r = V.salt.split("?")) == null ? void 0 : r[1]), q = T.get("expires") || T.get("expire");
918
- if (q) {
919
- const v = new Date(+q * 1e3), L = isNaN(v.getTime()) ? 0 : v.getTime() - Date.now();
920
- L > 0 && de(L);
1199
+ if (f.status !== 200)
1200
+ throw new Error(`Server responded with ${f.status}.`);
1201
+ const m = f.headers.get("Expires"), g = f.headers.get("X-Altcha-Config"), V = await f.json(), j = new URLSearchParams((i = V.salt.split("?")) == null ? void 0 : i[1]), U = j.get("expires") || j.get("expire");
1202
+ if (U) {
1203
+ const _ = new Date(+U * 1e3), Y = isNaN(_.getTime()) ? 0 : _.getTime() - Date.now();
1204
+ Y > 0 && Fe(Y);
921
1205
  }
922
- if (R)
1206
+ if (g)
923
1207
  try {
924
- const v = JSON.parse(R);
925
- v && typeof v == "object" && (v.verifyurl && (v.verifyurl = new URL(v.verifyurl, new URL(u)).toString()), Oe(v));
926
- } catch (v) {
927
- E("unable to configure from X-Altcha-Config", v);
1208
+ const _ = JSON.parse(g);
1209
+ _ && typeof _ == "object" && (_.verifyurl && (_.verifyurl = new URL(_.verifyurl, new URL(k)).toString()), lt(_));
1210
+ } catch (_) {
1211
+ A("unable to configure from X-Altcha-Config", _);
928
1212
  }
929
- if (!P && (g != null && g.length)) {
930
- const v = Date.parse(g);
931
- if (v) {
932
- const L = v - Date.now();
933
- L > 0 && de(L);
1213
+ if (!te && (m != null && m.length)) {
1214
+ const _ = Date.parse(m);
1215
+ if (_) {
1216
+ const Y = _ - Date.now();
1217
+ Y > 0 && Fe(Y);
934
1218
  }
935
1219
  }
936
1220
  return V;
937
1221
  }
938
1222
  }
939
- function Ne() {
940
- u && A && j === b.VERIFIED ? ee() : ge(b.EXPIRED, f.expired);
1223
+ function $e() {
1224
+ if (!q)
1225
+ if (b) {
1226
+ if (A("analytics enabled"), t(11, q = new Dn(b)), x === void 0) {
1227
+ const i = b.getAttribute("action");
1228
+ i && t(19, x = i + "/beacon");
1229
+ }
1230
+ t(11, q.beaconUrl = x || null, q);
1231
+ } else
1232
+ A("analytics cannot be enabled - form element not found");
941
1233
  }
942
- async function ft(r) {
943
- let a = null;
1234
+ function et() {
1235
+ k && D && T === y.VERIFIED ? ae() : we(y.EXPIRED, l.expired);
1236
+ }
1237
+ async function tt(i) {
1238
+ let f = null;
944
1239
  if ("Worker" in window) {
945
1240
  try {
946
- a = await ct(r.challenge, r.salt, r.algorithm, r.maxnumber);
947
- } catch (g) {
948
- E(g);
1241
+ f = await Ut(i, i.maxnumber);
1242
+ } catch (m) {
1243
+ A(m);
949
1244
  }
950
- if ((a == null ? void 0 : a.number) !== void 0)
951
- return { data: r, solution: a };
1245
+ if ((f == null ? void 0 : f.number) !== void 0 || "obfuscated" in i)
1246
+ return { data: i, solution: f };
1247
+ }
1248
+ if ("obfuscated" in i) {
1249
+ const m = await Fn(i.obfuscated, i.key, i.maxnumber);
1250
+ return { data: i, solution: await m.promise };
952
1251
  }
953
1252
  return {
954
- data: r,
955
- solution: await Zt(r.challenge, r.salt, r.algorithm, r.maxnumber || x).promise
1253
+ data: i,
1254
+ solution: await In(i.challenge, i.salt, i.algorithm, i.maxnumber || L).promise
956
1255
  };
957
1256
  }
958
- async function ct(r, a, g, R = typeof _ == "number" ? _ : x, V = Math.ceil(oe)) {
959
- const T = [];
960
- V = Math.min(16, Math.max(1, V));
961
- for (let L = 0; L < V; L++)
962
- T.push(createAltchaWorker(ae));
963
- const q = Math.ceil(R / V), v = await Promise.all(T.map((L, Ee) => {
964
- const le = Ee * q;
965
- return new Promise((me) => {
966
- L.addEventListener("message", (be) => {
967
- if (be.data)
968
- for (const se of T)
969
- se !== L && se.postMessage({ type: "abort" });
970
- me(be.data);
971
- }), L.postMessage({
972
- payload: {
973
- alg: g,
974
- challenge: r,
975
- max: le + q,
976
- salt: a,
977
- start: le
978
- },
1257
+ async function Ut(i, f = typeof X == "number" ? X : L, m = Math.ceil(be)) {
1258
+ const g = [];
1259
+ m = Math.min(16, Math.max(1, m));
1260
+ for (let U = 0; U < m; U++)
1261
+ g.push(createAltchaWorker(Te));
1262
+ const V = Math.ceil(f / m), j = await Promise.all(g.map((U, _) => {
1263
+ const Y = _ * V;
1264
+ return new Promise((Ue) => {
1265
+ U.addEventListener("message", (Ee) => {
1266
+ if (Ee.data)
1267
+ for (const ve of g)
1268
+ ve !== U && ve.postMessage({ type: "abort" });
1269
+ Ue(Ee.data);
1270
+ }), U.postMessage({
1271
+ payload: i,
1272
+ max: Y + V,
1273
+ start: Y,
979
1274
  type: "work"
980
1275
  });
981
1276
  });
982
1277
  }));
983
- for (const L of T)
984
- L.terminate();
985
- return v.find((L) => !!L) || null;
986
- }
987
- function ut() {
988
- [b.UNVERIFIED, b.ERROR, b.EXPIRED].includes(j) ? w && (m == null ? void 0 : m.reportValidity()) === !1 ? t(7, W = !1) : ee() : t(7, W = !0);
989
- }
990
- function je(r) {
991
- const a = r.target;
992
- k && a && !C.contains(a) && j === b.VERIFIED && t(8, C.style.display = "none", C);
993
- }
994
- function Ve() {
995
- k && ke();
1278
+ for (const U of g)
1279
+ U.terminate();
1280
+ return j.find((U) => !!U) || null;
1281
+ }
1282
+ function Pt() {
1283
+ [y.UNVERIFIED, y.ERROR, y.EXPIRED].includes(T) ? d && (b == null ? void 0 : b.reportValidity()) === !1 ? t(8, W = !1) : p ? _e() : ae() : t(8, W = !0);
1284
+ }
1285
+ function nt(i) {
1286
+ const f = i.target;
1287
+ R && f && !v.contains(f) && T === y.VERIFIED && t(9, v.style.display = "none", v);
1288
+ }
1289
+ function it() {
1290
+ R && je();
1291
+ }
1292
+ function rt() {
1293
+ T === y.VERIFYING && l.waitAlert && alert(l.waitAlert);
1294
+ }
1295
+ function Bt(i) {
1296
+ var f;
1297
+ if (z) {
1298
+ const m = z.match(/^(mailto|tel|sms|https?):/);
1299
+ let g;
1300
+ if (m) {
1301
+ const [V] = z.slice(z.indexOf(":") + 1).replace(/^\/\//, "").split("?");
1302
+ g = document.createElement("a"), g.href = z, g.innerHTML = V;
1303
+ } else
1304
+ g = document.createTextNode(z);
1305
+ ie && g && (ie.after(g), (f = ie.parentElement) == null || f.removeChild(ie));
1306
+ }
996
1307
  }
997
- function Fe() {
998
- j === b.VERIFYING && f.waitAlert && alert(f.waitAlert);
1308
+ function Ot(i) {
1309
+ q && q.trackError(ye);
999
1310
  }
1000
- function at(r) {
1001
- k && j !== b.UNVERIFIED && requestAnimationFrame(() => {
1002
- ke();
1311
+ function Ht(i) {
1312
+ R && T !== y.UNVERIFIED && requestAnimationFrame(() => {
1313
+ je();
1003
1314
  });
1004
1315
  }
1005
- function Pe() {
1006
- k && ke();
1316
+ function ot() {
1317
+ R && je();
1007
1318
  }
1008
- function de(r) {
1009
- E("expire", r), U && (clearTimeout(U), U = null), r < 1 ? Ne() : U = setTimeout(Ne, r);
1319
+ function Fe(i) {
1320
+ A("expire", i), K && (clearTimeout(K), K = null), i < 1 ? et() : K = setTimeout(et, i);
1010
1321
  }
1011
- function He(r) {
1012
- E("floating", r), k !== r && (t(8, C.style.left = "", C), t(8, C.style.top = "", C)), t(1, k = r === !0 || r === "" ? "auto" : r === !1 || r === "false" ? void 0 : k), k ? (c || t(0, c = "onsubmit"), document.addEventListener("scroll", Ve), document.addEventListener("click", je), window.addEventListener("resize", Pe)) : c === "onsubmit" && t(0, c = void 0);
1322
+ function st(i) {
1323
+ A("floating", i), R !== i && (t(9, v.style.left = "", v), t(9, v.style.top = "", v)), t(1, R = i === !0 || i === "" ? "auto" : i === !1 || i === "false" ? void 0 : R), R ? (w || t(0, w = "onsubmit"), document.addEventListener("scroll", it), document.addEventListener("click", nt), window.addEventListener("resize", ot)) : w === "onsubmit" && t(0, w = void 0);
1013
1324
  }
1014
- function ht(r) {
1015
- var g;
1016
- const a = m == null ? void 0 : m.querySelector(typeof r == "string" ? `input[name="${r}"]` : 'input[type="email"]:not([data-no-spamfilter])');
1017
- return ((g = a == null ? void 0 : a.value) == null ? void 0 : g.slice(a.value.indexOf("@"))) || void 0;
1325
+ function qt(i) {
1326
+ var m;
1327
+ const f = b == null ? void 0 : b.querySelector(typeof i == "string" ? `input[name="${i}"]` : 'input[type="email"]:not([data-no-spamfilter])');
1328
+ return ((m = f == null ? void 0 : f.value) == null ? void 0 : m.slice(f.value.indexOf("@"))) || void 0;
1018
1329
  }
1019
- function dt(r) {
1330
+ function Zt(i) {
1020
1331
  return [
1021
- ...(m == null ? void 0 : m.querySelectorAll(r != null && r.length ? r.map((g) => `input[name="${g}"]`).join(", ") : 'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])')) || []
1332
+ ...(b == null ? void 0 : b.querySelectorAll(i != null && i.length ? i.map((m) => `input[name="${m}"]`).join(", ") : 'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])')) || []
1022
1333
  ].reduce(
1023
- (g, R) => {
1024
- const V = R.name, T = R.value;
1025
- return V && T && (g[V] = /\n/.test(T) ? T.replace(new RegExp("(?<!\\r)\\n", "g"), `\r
1026
- `) : T), g;
1334
+ (m, g) => {
1335
+ const V = g.name, j = g.value;
1336
+ return V && j && (m[V] = /\n/.test(j) ? j.replace(new RegExp("(?<!\\r)\\n", "g"), `\r
1337
+ `) : j), m;
1027
1338
  },
1028
1339
  {}
1029
1340
  );
1030
1341
  }
1031
- async function gt(r) {
1032
- if (!z)
1342
+ async function Gt(i) {
1343
+ if (!se)
1033
1344
  throw new Error("Attribute verifyurl not set.");
1034
- E("requesting server verification from", z);
1035
- const a = { payload: r };
1036
- if (w) {
1037
- const { blockedCountries: V, classifier: T, disableRules: q, email: v, expectedLanguages: L, expectedCountries: Ee, fields: le, ipAddress: me, text: be, timeZone: se } = mt();
1038
- a.blockedCountries = V, a.classifier = T, a.disableRules = q, a.email = v === !1 ? void 0 : ht(v), a.expectedCountries = Ee, a.expectedLanguages = L || (Re ? [Re] : void 0), a.fields = le === !1 ? void 0 : dt(le), a.ipAddress = me === !1 ? void 0 : me || "auto", a.text = be, a.timeZone = se === !1 ? void 0 : se || Kt();
1345
+ A("requesting server verification from", se);
1346
+ const f = { payload: i };
1347
+ if (d) {
1348
+ const { blockedCountries: V, classifier: j, disableRules: U, email: _, expectedLanguages: Y, expectedCountries: Ue, fields: Ee, ipAddress: ve, text: zt, timeZone: ft } = Yt();
1349
+ f.blockedCountries = V, f.classifier = j, f.disableRules = U, f.email = _ === !1 ? void 0 : qt(_), f.expectedCountries = Ue, f.expectedLanguages = Y || (Ge ? [Ge] : void 0), f.fields = Ee === !1 ? void 0 : Zt(Ee), f.ipAddress = ve === !1 ? void 0 : ve || "auto", f.text = zt, f.timeZone = ft === !1 ? void 0 : ft || Nt();
1039
1350
  }
1040
- const g = await fetch(z, {
1041
- body: JSON.stringify(a),
1351
+ const m = await fetch(se, {
1352
+ body: JSON.stringify(f),
1042
1353
  headers: { "content-type": "application/json" },
1043
1354
  method: "POST"
1044
1355
  });
1045
- if (g.status !== 200)
1046
- throw new Error(`Server responded with ${g.status}.`);
1047
- const R = await g.json();
1048
- if (R != null && R.payload && t(5, Q = R.payload), ye("serververification", R), h && R.classification === "BAD")
1356
+ if (m.status !== 200)
1357
+ throw new Error(`Server responded with ${m.status}.`);
1358
+ const g = await m.json();
1359
+ if (g != null && g.payload && t(6, ce = g.payload), Ve("serververification", g), $ && g.classification === "BAD")
1049
1360
  throw new Error("SpamFilter returned negative classification.");
1050
1361
  }
1051
- function mt() {
1052
- return w === "ipAddress" ? {
1362
+ function Yt() {
1363
+ return d === "ipAddress" ? {
1053
1364
  blockedCountries: void 0,
1054
1365
  classifier: void 0,
1055
1366
  disableRules: void 0,
@@ -1060,7 +1371,7 @@ function Qt(n, e, t) {
1060
1371
  ipAddress: void 0,
1061
1372
  text: void 0,
1062
1373
  timeZone: void 0
1063
- } : typeof w == "object" ? w : {
1374
+ } : typeof d == "object" ? d : {
1064
1375
  blockedCountries: void 0,
1065
1376
  classifier: void 0,
1066
1377
  disableRules: void 0,
@@ -1073,297 +1384,350 @@ function Qt(n, e, t) {
1073
1384
  timeZone: void 0
1074
1385
  };
1075
1386
  }
1076
- function ke(r = 20) {
1077
- if (C)
1078
- if (he || (he = (G ? document.querySelector(G) : m == null ? void 0 : m.querySelector('input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])')) || m), he) {
1079
- const a = parseInt($, 10) || 12, g = he.getBoundingClientRect(), R = C.getBoundingClientRect(), V = document.documentElement.clientHeight, T = document.documentElement.clientWidth, q = k === "auto" ? g.bottom + R.height + a + r > V : k === "top", v = Math.max(r, Math.min(T - r - R.width, g.left + g.width / 2 - R.width / 2));
1080
- if (q ? t(8, C.style.top = `${g.top - (R.height + a)}px`, C) : t(8, C.style.top = `${g.bottom + a}px`, C), t(8, C.style.left = `${v}px`, C), C.setAttribute("data-floating", q ? "top" : "bottom"), K) {
1081
- const L = K.getBoundingClientRect();
1082
- t(9, K.style.left = g.left - v + g.width / 2 - L.width / 2 + "px", K);
1387
+ function je(i = 20) {
1388
+ if (v)
1389
+ if (Re || (Re = (O ? document.querySelector(O) : b == null ? void 0 : b.querySelector('input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])')) || b || ie), Re) {
1390
+ const f = parseInt(N, 10) || 12, m = Re.getBoundingClientRect(), g = v.getBoundingClientRect(), V = document.documentElement.clientHeight, j = document.documentElement.clientWidth, U = R === "auto" ? m.bottom + g.height + f + i > V : R === "top", _ = Math.max(i, Math.min(j - i - g.width, m.left + m.width / 2 - g.width / 2));
1391
+ if (U ? t(9, v.style.top = `${m.top - (g.height + f)}px`, v) : t(9, v.style.top = `${m.bottom + f}px`, v), t(9, v.style.left = `${_}px`, v), v.setAttribute("data-floating", U ? "top" : "bottom"), le) {
1392
+ const Y = le.getBoundingClientRect();
1393
+ t(10, le.style.left = m.left - _ + m.width / 2 - Y.width / 2 + "px", le);
1083
1394
  }
1084
1395
  } else
1085
- E("unable to find floating anchor element");
1086
- }
1087
- function Oe(r) {
1088
- r.auto !== void 0 && (t(0, c = r.auto), c === "onload" && ee()), r.floatinganchor !== void 0 && t(19, G = r.floatinganchor), r.delay !== void 0 && t(17, B = r.delay), r.floatingoffset !== void 0 && t(20, $ = r.floatingoffset), r.floating !== void 0 && He(r.floating), r.expire !== void 0 && (de(r.expire), t(18, P = r.expire)), r.challenge && (De(r.challenge), o = r.challenge), r.challengeurl !== void 0 && t(15, u = r.challengeurl), r.debug !== void 0 && t(16, S = !!r.debug), r.hidefooter !== void 0 && t(2, J = !!r.hidefooter), r.hidelogo !== void 0 && t(3, Z = !!r.hidelogo), r.maxnumber !== void 0 && t(21, x = +r.maxnumber), r.mockerror !== void 0 && t(22, I = !!r.mockerror), r.name !== void 0 && t(4, N = r.name), r.refetchonexpire !== void 0 && t(23, A = !!r.refetchonexpire), r.spamfilter !== void 0 && t(24, w = typeof r.spamfilter == "object" ? r.spamfilter : !!r.spamfilter), r.strings && t(35, l = r.strings), r.test !== void 0 && t(25, _ = typeof r.test == "number" ? r.test : !!r.test), r.verifyurl !== void 0 && t(26, z = r.verifyurl), r.workers !== void 0 && t(27, oe = +r.workers), r.workerurl !== void 0 && t(28, ae = r.workerurl);
1089
- }
1090
- function ge(r = b.UNVERIFIED, a = null) {
1091
- U && (clearTimeout(U), U = null), t(7, W = !1), t(10, ve = a), t(5, Q = null), t(6, j = r);
1092
- }
1093
- async function ee() {
1094
- return ge(b.VERIFYING), await new Promise((r) => setTimeout(r, B || 0)), st().then((r) => (De(r), E("challenge", r), ft(r))).then(({ data: r, solution: a }) => {
1095
- if (E("solution", a), (a == null ? void 0 : a.number) !== void 0) {
1096
- if (z)
1097
- return gt(Te(r, a));
1098
- t(5, Q = Te(r, a)), E("payload", Q);
1099
- } else
1100
- throw E("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."), new Error("Unexpected result returned.");
1396
+ A("unable to find floating anchor element");
1397
+ }
1398
+ function lt(i) {
1399
+ i.analytics && (t(18, h = i.analytics), $e()), i.obfuscated !== void 0 && t(27, p = i.obfuscated), i.auto !== void 0 && (t(0, w = i.auto), w === "onload" && (p ? _e() : ae())), i.beaconurl && (t(19, x = i.beaconurl), q && t(11, q.beaconUrl = x, q)), i.floatinganchor !== void 0 && t(23, O = i.floatinganchor), i.delay !== void 0 && t(21, ee = i.delay), i.floatingoffset !== void 0 && t(24, N = i.floatingoffset), i.floating !== void 0 && st(i.floating), i.expire !== void 0 && (Fe(i.expire), t(22, te = i.expire)), i.challenge && (Qe(i.challenge), o = i.challenge), i.challengeurl !== void 0 && t(17, k = i.challengeurl), i.debug !== void 0 && t(20, H = !!i.debug), i.hidefooter !== void 0 && t(2, oe = !!i.hidefooter), i.hidelogo !== void 0 && t(3, ne = !!i.hidelogo), i.maxnumber !== void 0 && t(25, L = +i.maxnumber), i.mockerror !== void 0 && t(26, F = !!i.mockerror), i.name !== void 0 && t(4, Z = i.name), i.refetchonexpire !== void 0 && t(28, D = !!i.refetchonexpire), i.spamfilter !== void 0 && t(29, d = typeof i.spamfilter == "object" ? i.spamfilter : !!i.spamfilter), i.strings && t(42, s = i.strings), i.test !== void 0 && t(30, X = typeof i.test == "number" ? i.test : !!i.test), i.verifyurl !== void 0 && t(31, se = i.verifyurl), i.workers !== void 0 && t(32, be = +i.workers), i.workerurl !== void 0 && t(33, Te = i.workerurl);
1400
+ }
1401
+ function we(i = y.UNVERIFIED, f = null) {
1402
+ K && (clearTimeout(K), K = null), t(8, W = !1), t(5, ye = f), t(6, ce = null), t(7, T = i);
1403
+ }
1404
+ async function ae() {
1405
+ return we(y.VERIFYING), await new Promise((i) => setTimeout(i, ee || 0)), jt().then((i) => (Qe(i), A("challenge", i), tt(i))).then(({ data: i, solution: f }) => {
1406
+ if (A("solution", f), "challenge" in i && f && !("clearText" in f))
1407
+ if ((f == null ? void 0 : f.number) !== void 0) {
1408
+ if (se)
1409
+ return Gt(Ke(i, f));
1410
+ t(6, ce = Ke(i, f)), A("payload", ce);
1411
+ } else
1412
+ throw A("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."), new Error("Unexpected result returned.");
1101
1413
  }).then(() => {
1102
- $t().then(() => {
1103
- t(6, j = b.VERIFIED), t(7, W = !0), E("verified"), ye("verified", { payload: Q });
1414
+ mn().then(() => {
1415
+ t(7, T = y.VERIFIED), t(8, W = !0), A("verified"), Ve("verified", { payload: ce });
1104
1416
  });
1105
- }).catch((r) => {
1106
- E(r), t(6, j = b.ERROR), t(7, W = !1), t(10, ve = r.message);
1417
+ }).catch((i) => {
1418
+ A(i), t(7, T = y.ERROR), t(8, W = !1), t(5, ye = i.message);
1107
1419
  });
1108
1420
  }
1109
- function bt() {
1110
- W = this.checked, t(7, W);
1421
+ async function _e() {
1422
+ if (!p) {
1423
+ t(7, T = y.ERROR);
1424
+ return;
1425
+ }
1426
+ we(y.VERIFYING), await new Promise((j) => setTimeout(j, ee || 0));
1427
+ const [i, f] = p.split("?");
1428
+ let g = new URLSearchParams(f || "").get("key") || void 0;
1429
+ if (g) {
1430
+ const j = g.match(/^\(prompt:?(.*)\)$/);
1431
+ j && (g = prompt(j[1] || "Enter Key:") || void 0);
1432
+ }
1433
+ const { solution: V } = await tt({ obfuscated: i, key: g, maxnumber: L });
1434
+ V && "clearText" in V ? (t(41, z = V.clearText), t(7, T = y.VERIFIED), t(8, W = !0), R && v && t(9, v.style.display = "none", v)) : (t(7, T = y.ERROR), t(8, W = !1), t(5, ye = "Unable to decrypt data."));
1435
+ }
1436
+ function Jt() {
1437
+ W = this.checked, t(8, W);
1111
1438
  }
1112
- function _t(r) {
1113
- we[r ? "unshift" : "push"](() => {
1114
- K = r, t(9, K);
1439
+ function Xt(i) {
1440
+ Ne[i ? "unshift" : "push"](() => {
1441
+ le = i, t(10, le);
1115
1442
  });
1116
1443
  }
1117
- function wt(r) {
1118
- we[r ? "unshift" : "push"](() => {
1119
- C = r, t(8, C);
1444
+ function Wt(i) {
1445
+ Ne[i ? "unshift" : "push"](() => {
1446
+ v = i, t(9, v);
1120
1447
  });
1121
1448
  }
1122
- return n.$$set = (r) => {
1123
- "auto" in r && t(0, c = r.auto), "blockspam" in r && t(29, h = r.blockspam), "challengeurl" in r && t(15, u = r.challengeurl), "challengejson" in r && t(30, H = r.challengejson), "debug" in r && t(16, S = r.debug), "delay" in r && t(17, B = r.delay), "expire" in r && t(18, P = r.expire), "floating" in r && t(1, k = r.floating), "floatinganchor" in r && t(19, G = r.floatinganchor), "floatingoffset" in r && t(20, $ = r.floatingoffset), "hidefooter" in r && t(2, J = r.hidefooter), "hidelogo" in r && t(3, Z = r.hidelogo), "name" in r && t(4, N = r.name), "maxnumber" in r && t(21, x = r.maxnumber), "mockerror" in r && t(22, I = r.mockerror), "refetchonexpire" in r && t(23, A = r.refetchonexpire), "spamfilter" in r && t(24, w = r.spamfilter), "strings" in r && t(31, d = r.strings), "test" in r && t(25, _ = r.test), "verifyurl" in r && t(26, z = r.verifyurl), "workers" in r && t(27, oe = r.workers), "workerurl" in r && t(28, ae = r.workerurl);
1449
+ return n.$$set = (i) => {
1450
+ "analytics" in i && t(18, h = i.analytics), "auto" in i && t(0, w = i.auto), "beaconurl" in i && t(19, x = i.beaconurl), "blockspam" in i && t(34, $ = i.blockspam), "challengeurl" in i && t(17, k = i.challengeurl), "challengejson" in i && t(35, J = i.challengejson), "debug" in i && t(20, H = i.debug), "delay" in i && t(21, ee = i.delay), "expire" in i && t(22, te = i.expire), "floating" in i && t(1, R = i.floating), "floatinganchor" in i && t(23, O = i.floatinganchor), "floatingoffset" in i && t(24, N = i.floatingoffset), "hidefooter" in i && t(2, oe = i.hidefooter), "hidelogo" in i && t(3, ne = i.hidelogo), "name" in i && t(4, Z = i.name), "maxnumber" in i && t(25, L = i.maxnumber), "mockerror" in i && t(26, F = i.mockerror), "obfuscated" in i && t(27, p = i.obfuscated), "refetchonexpire" in i && t(28, D = i.refetchonexpire), "spamfilter" in i && t(29, d = i.spamfilter), "strings" in i && t(36, C = i.strings), "test" in i && t(30, X = i.test), "verifyurl" in i && t(31, se = i.verifyurl), "workers" in i && t(32, be = i.workers), "workerurl" in i && t(33, Te = i.workerurl), "$$scope" in i && t(43, a = i.$$scope);
1124
1451
  }, n.$$.update = () => {
1125
1452
  n.$$.dirty[0] & /*challengeurl*/
1126
- 32768 && t(12, i = !!(u != null && u.includes(".altcha.org")) && !!(u != null && u.includes("apiKey=ckey_"))), n.$$.dirty[0] & /*challengejson*/
1127
- 1073741824 && (o = H ? Qe(H) : void 0), n.$$.dirty[1] & /*strings*/
1128
- 1 && t(35, l = d ? Qe(d) : {}), n.$$.dirty[1] & /*parsedStrings*/
1129
- 16 && t(11, f = {
1130
- ariaLinkLabel: Ke,
1453
+ 131072 && t(14, r = !!(k != null && k.includes(".altcha.org")) && !!(k != null && k.includes("apiKey=ckey_"))), n.$$.dirty[1] & /*challengejson*/
1454
+ 16 && (o = J ? Ct(J) : void 0), n.$$.dirty[1] & /*strings*/
1455
+ 32 && t(42, s = C ? Ct(C) : {}), n.$$.dirty[1] & /*parsedStrings*/
1456
+ 2048 && t(13, l = {
1457
+ ariaLinkLabel: pt,
1131
1458
  error: "Verification failed. Try again later.",
1132
1459
  expired: "Verification expired. Try again.",
1133
- footer: `Protected by <a href="${lt}" target="_blank" aria-label="${l.ariaLinkLabel || Ke}">ALTCHA</a>`,
1460
+ footer: `Protected by <a href="${Vt}" target="_blank" aria-label="${s.ariaLinkLabel || pt}">ALTCHA</a>`,
1134
1461
  label: "I'm not a robot",
1135
1462
  verified: "Verified",
1136
1463
  verifying: "Verifying...",
1137
1464
  waitAlert: "Verifying... please wait.",
1138
- ...l
1139
- }), n.$$.dirty[0] & /*payload, state*/
1140
- 96 && ye("statechange", { payload: Q, state: j }), n.$$.dirty[0] & /*state*/
1141
- 64 && at();
1465
+ ...s
1466
+ }), n.$$.dirty[0] & /*state, payload*/
1467
+ 192 | n.$$.dirty[1] & /*clarifiedData*/
1468
+ 1024 && Ve("statechange", z ? { clarifiedData: z, state: T } : { payload: ce, state: T }), n.$$.dirty[0] & /*error*/
1469
+ 32 && Ot(), n.$$.dirty[0] & /*state*/
1470
+ 128 && Ht(), n.$$.dirty[1] & /*clarifiedData*/
1471
+ 1024 && Bt();
1142
1472
  }, [
1143
- c,
1144
- k,
1145
- J,
1146
- Z,
1147
- N,
1148
- Q,
1149
- j,
1150
- W,
1151
- C,
1152
- K,
1153
- ve,
1154
- f,
1155
- i,
1156
- ut,
1157
- Fe,
1158
- u,
1159
- S,
1160
- B,
1161
- P,
1162
- G,
1163
- $,
1164
- x,
1165
- I,
1166
- A,
1167
1473
  w,
1168
- _,
1169
- z,
1474
+ R,
1170
1475
  oe,
1171
- ae,
1476
+ ne,
1477
+ Z,
1478
+ ye,
1479
+ ce,
1480
+ T,
1481
+ W,
1482
+ v,
1483
+ le,
1484
+ q,
1485
+ Ye,
1486
+ l,
1487
+ r,
1488
+ Pt,
1489
+ rt,
1490
+ k,
1172
1491
  h,
1492
+ x,
1173
1493
  H,
1174
- d,
1175
- Oe,
1176
- ge,
1177
1494
  ee,
1178
- l,
1179
- bt,
1180
- _t,
1181
- wt
1495
+ te,
1496
+ O,
1497
+ N,
1498
+ L,
1499
+ F,
1500
+ p,
1501
+ D,
1502
+ d,
1503
+ X,
1504
+ se,
1505
+ be,
1506
+ Te,
1507
+ $,
1508
+ J,
1509
+ C,
1510
+ lt,
1511
+ we,
1512
+ ae,
1513
+ _e,
1514
+ z,
1515
+ s,
1516
+ a,
1517
+ c,
1518
+ Jt,
1519
+ Xt,
1520
+ Wt
1182
1521
  ];
1183
1522
  }
1184
- class en extends Ht {
1523
+ class Bn extends Cn {
1185
1524
  constructor(e) {
1186
- super(), Ft(
1525
+ super(), kn(
1187
1526
  this,
1188
1527
  e,
1189
- Qt,
1190
- zt,
1191
- kt,
1528
+ Pn,
1529
+ Un,
1530
+ en,
1192
1531
  {
1532
+ analytics: 18,
1193
1533
  auto: 0,
1194
- blockspam: 29,
1195
- challengeurl: 15,
1196
- challengejson: 30,
1197
- debug: 16,
1198
- delay: 17,
1199
- expire: 18,
1534
+ beaconurl: 19,
1535
+ blockspam: 34,
1536
+ challengeurl: 17,
1537
+ challengejson: 35,
1538
+ debug: 20,
1539
+ delay: 21,
1540
+ expire: 22,
1200
1541
  floating: 1,
1201
- floatinganchor: 19,
1202
- floatingoffset: 20,
1542
+ floatinganchor: 23,
1543
+ floatingoffset: 24,
1203
1544
  hidefooter: 2,
1204
1545
  hidelogo: 3,
1205
1546
  name: 4,
1206
- maxnumber: 21,
1207
- mockerror: 22,
1208
- refetchonexpire: 23,
1209
- spamfilter: 24,
1210
- strings: 31,
1211
- test: 25,
1212
- verifyurl: 26,
1213
- workers: 27,
1214
- workerurl: 28,
1215
- configure: 32,
1216
- reset: 33,
1217
- verify: 34
1547
+ maxnumber: 25,
1548
+ mockerror: 26,
1549
+ obfuscated: 27,
1550
+ refetchonexpire: 28,
1551
+ spamfilter: 29,
1552
+ strings: 36,
1553
+ test: 30,
1554
+ verifyurl: 31,
1555
+ workers: 32,
1556
+ workerurl: 33,
1557
+ configure: 37,
1558
+ reset: 38,
1559
+ verify: 39,
1560
+ clarify: 40
1218
1561
  },
1219
1562
  null,
1220
1563
  [-1, -1, -1]
1221
1564
  );
1222
1565
  }
1566
+ get analytics() {
1567
+ return this.$$.ctx[18];
1568
+ }
1569
+ set analytics(e) {
1570
+ this.$$set({ analytics: e }), E();
1571
+ }
1223
1572
  get auto() {
1224
1573
  return this.$$.ctx[0];
1225
1574
  }
1226
1575
  set auto(e) {
1227
- this.$$set({ auto: e }), y();
1576
+ this.$$set({ auto: e }), E();
1577
+ }
1578
+ get beaconurl() {
1579
+ return this.$$.ctx[19];
1580
+ }
1581
+ set beaconurl(e) {
1582
+ this.$$set({ beaconurl: e }), E();
1228
1583
  }
1229
1584
  get blockspam() {
1230
- return this.$$.ctx[29];
1585
+ return this.$$.ctx[34];
1231
1586
  }
1232
1587
  set blockspam(e) {
1233
- this.$$set({ blockspam: e }), y();
1588
+ this.$$set({ blockspam: e }), E();
1234
1589
  }
1235
1590
  get challengeurl() {
1236
- return this.$$.ctx[15];
1591
+ return this.$$.ctx[17];
1237
1592
  }
1238
1593
  set challengeurl(e) {
1239
- this.$$set({ challengeurl: e }), y();
1594
+ this.$$set({ challengeurl: e }), E();
1240
1595
  }
1241
1596
  get challengejson() {
1242
- return this.$$.ctx[30];
1597
+ return this.$$.ctx[35];
1243
1598
  }
1244
1599
  set challengejson(e) {
1245
- this.$$set({ challengejson: e }), y();
1600
+ this.$$set({ challengejson: e }), E();
1246
1601
  }
1247
1602
  get debug() {
1248
- return this.$$.ctx[16];
1603
+ return this.$$.ctx[20];
1249
1604
  }
1250
1605
  set debug(e) {
1251
- this.$$set({ debug: e }), y();
1606
+ this.$$set({ debug: e }), E();
1252
1607
  }
1253
1608
  get delay() {
1254
- return this.$$.ctx[17];
1609
+ return this.$$.ctx[21];
1255
1610
  }
1256
1611
  set delay(e) {
1257
- this.$$set({ delay: e }), y();
1612
+ this.$$set({ delay: e }), E();
1258
1613
  }
1259
1614
  get expire() {
1260
- return this.$$.ctx[18];
1615
+ return this.$$.ctx[22];
1261
1616
  }
1262
1617
  set expire(e) {
1263
- this.$$set({ expire: e }), y();
1618
+ this.$$set({ expire: e }), E();
1264
1619
  }
1265
1620
  get floating() {
1266
1621
  return this.$$.ctx[1];
1267
1622
  }
1268
1623
  set floating(e) {
1269
- this.$$set({ floating: e }), y();
1624
+ this.$$set({ floating: e }), E();
1270
1625
  }
1271
1626
  get floatinganchor() {
1272
- return this.$$.ctx[19];
1627
+ return this.$$.ctx[23];
1273
1628
  }
1274
1629
  set floatinganchor(e) {
1275
- this.$$set({ floatinganchor: e }), y();
1630
+ this.$$set({ floatinganchor: e }), E();
1276
1631
  }
1277
1632
  get floatingoffset() {
1278
- return this.$$.ctx[20];
1633
+ return this.$$.ctx[24];
1279
1634
  }
1280
1635
  set floatingoffset(e) {
1281
- this.$$set({ floatingoffset: e }), y();
1636
+ this.$$set({ floatingoffset: e }), E();
1282
1637
  }
1283
1638
  get hidefooter() {
1284
1639
  return this.$$.ctx[2];
1285
1640
  }
1286
1641
  set hidefooter(e) {
1287
- this.$$set({ hidefooter: e }), y();
1642
+ this.$$set({ hidefooter: e }), E();
1288
1643
  }
1289
1644
  get hidelogo() {
1290
1645
  return this.$$.ctx[3];
1291
1646
  }
1292
1647
  set hidelogo(e) {
1293
- this.$$set({ hidelogo: e }), y();
1648
+ this.$$set({ hidelogo: e }), E();
1294
1649
  }
1295
1650
  get name() {
1296
1651
  return this.$$.ctx[4];
1297
1652
  }
1298
1653
  set name(e) {
1299
- this.$$set({ name: e }), y();
1654
+ this.$$set({ name: e }), E();
1300
1655
  }
1301
1656
  get maxnumber() {
1302
- return this.$$.ctx[21];
1657
+ return this.$$.ctx[25];
1303
1658
  }
1304
1659
  set maxnumber(e) {
1305
- this.$$set({ maxnumber: e }), y();
1660
+ this.$$set({ maxnumber: e }), E();
1306
1661
  }
1307
1662
  get mockerror() {
1308
- return this.$$.ctx[22];
1663
+ return this.$$.ctx[26];
1309
1664
  }
1310
1665
  set mockerror(e) {
1311
- this.$$set({ mockerror: e }), y();
1666
+ this.$$set({ mockerror: e }), E();
1667
+ }
1668
+ get obfuscated() {
1669
+ return this.$$.ctx[27];
1670
+ }
1671
+ set obfuscated(e) {
1672
+ this.$$set({ obfuscated: e }), E();
1312
1673
  }
1313
1674
  get refetchonexpire() {
1314
- return this.$$.ctx[23];
1675
+ return this.$$.ctx[28];
1315
1676
  }
1316
1677
  set refetchonexpire(e) {
1317
- this.$$set({ refetchonexpire: e }), y();
1678
+ this.$$set({ refetchonexpire: e }), E();
1318
1679
  }
1319
1680
  get spamfilter() {
1320
- return this.$$.ctx[24];
1681
+ return this.$$.ctx[29];
1321
1682
  }
1322
1683
  set spamfilter(e) {
1323
- this.$$set({ spamfilter: e }), y();
1684
+ this.$$set({ spamfilter: e }), E();
1324
1685
  }
1325
1686
  get strings() {
1326
- return this.$$.ctx[31];
1687
+ return this.$$.ctx[36];
1327
1688
  }
1328
1689
  set strings(e) {
1329
- this.$$set({ strings: e }), y();
1690
+ this.$$set({ strings: e }), E();
1330
1691
  }
1331
1692
  get test() {
1332
- return this.$$.ctx[25];
1693
+ return this.$$.ctx[30];
1333
1694
  }
1334
1695
  set test(e) {
1335
- this.$$set({ test: e }), y();
1696
+ this.$$set({ test: e }), E();
1336
1697
  }
1337
1698
  get verifyurl() {
1338
- return this.$$.ctx[26];
1699
+ return this.$$.ctx[31];
1339
1700
  }
1340
1701
  set verifyurl(e) {
1341
- this.$$set({ verifyurl: e }), y();
1702
+ this.$$set({ verifyurl: e }), E();
1342
1703
  }
1343
1704
  get workers() {
1344
- return this.$$.ctx[27];
1705
+ return this.$$.ctx[32];
1345
1706
  }
1346
1707
  set workers(e) {
1347
- this.$$set({ workers: e }), y();
1708
+ this.$$set({ workers: e }), E();
1348
1709
  }
1349
1710
  get workerurl() {
1350
- return this.$$.ctx[28];
1711
+ return this.$$.ctx[33];
1351
1712
  }
1352
1713
  set workerurl(e) {
1353
- this.$$set({ workerurl: e }), y();
1714
+ this.$$set({ workerurl: e }), E();
1354
1715
  }
1355
1716
  get configure() {
1356
- return this.$$.ctx[32];
1717
+ return this.$$.ctx[37];
1357
1718
  }
1358
1719
  get reset() {
1359
- return this.$$.ctx[33];
1720
+ return this.$$.ctx[38];
1360
1721
  }
1361
1722
  get verify() {
1362
- return this.$$.ctx[34];
1723
+ return this.$$.ctx[39];
1724
+ }
1725
+ get clarify() {
1726
+ return this.$$.ctx[40];
1363
1727
  }
1364
1728
  }
1365
- customElements.define("altcha-widget", Pt(en, { auto: {}, blockspam: {}, challengeurl: {}, challengejson: {}, debug: { type: "Boolean" }, delay: {}, expire: {}, floating: {}, floatinganchor: {}, floatingoffset: {}, hidefooter: { type: "Boolean" }, hidelogo: { type: "Boolean" }, name: {}, maxnumber: {}, mockerror: { type: "Boolean" }, refetchonexpire: { type: "Boolean" }, spamfilter: { type: "Boolean" }, strings: {}, test: { type: "Boolean" }, verifyurl: {}, workers: {}, workerurl: {} }, [], ["configure", "reset", "verify"], !1));
1729
+ customElements.define("altcha-widget", pn(Bn, { analytics: { type: "Boolean" }, auto: {}, beaconurl: {}, blockspam: {}, challengeurl: {}, challengejson: {}, debug: { type: "Boolean" }, delay: {}, expire: {}, floating: {}, floatinganchor: {}, floatingoffset: {}, hidefooter: { type: "Boolean" }, hidelogo: { type: "Boolean" }, name: {}, maxnumber: {}, mockerror: { type: "Boolean" }, obfuscated: {}, refetchonexpire: { type: "Boolean" }, spamfilter: { type: "Boolean" }, strings: {}, test: { type: "Boolean" }, verifyurl: {}, workers: {}, workerurl: {} }, ["default"], ["configure", "reset", "verify", "clarify"], !1));
1366
1730
  globalThis.createAltchaWorker = (n) => new Worker(new URL(n || "./worker.js", import.meta.url));
1367
1731
  export {
1368
- en as Altcha
1732
+ Bn as Altcha
1369
1733
  };