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