altcha 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/dist/altcha.js +289 -285
- package/dist/altcha.umd.cjs +1 -1
- package/dist_external/altcha.js +271 -267
- package/dist_external/altcha.umd.cjs +1 -1
- package/package.json +1 -1
package/dist_external/altcha.js
CHANGED
|
@@ -3,16 +3,16 @@ var _t = (n, e, t) => e in n ? wt(n, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var B = (n, e, t) => _t(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
function re() {
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function Qe(n) {
|
|
7
7
|
return n();
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function Ue() {
|
|
10
10
|
return /* @__PURE__ */ Object.create(null);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
n.forEach(
|
|
12
|
+
function ce(n) {
|
|
13
|
+
n.forEach(Qe);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function et(n) {
|
|
16
16
|
return typeof n == "function";
|
|
17
17
|
}
|
|
18
18
|
function yt(n, e) {
|
|
@@ -21,13 +21,13 @@ function yt(n, e) {
|
|
|
21
21
|
function kt(n) {
|
|
22
22
|
return Object.keys(n).length === 0;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function E(n, e) {
|
|
25
25
|
n.appendChild(e);
|
|
26
26
|
}
|
|
27
27
|
function P(n, e, t) {
|
|
28
28
|
n.insertBefore(e, t || null);
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function D(n) {
|
|
31
31
|
n.parentNode && n.parentNode.removeChild(n);
|
|
32
32
|
}
|
|
33
33
|
function $(n) {
|
|
@@ -36,22 +36,22 @@ function $(n) {
|
|
|
36
36
|
function Z(n) {
|
|
37
37
|
return document.createElementNS("http://www.w3.org/2000/svg", n);
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function vt(n) {
|
|
40
40
|
return document.createTextNode(n);
|
|
41
41
|
}
|
|
42
42
|
function W() {
|
|
43
|
-
return
|
|
43
|
+
return vt(" ");
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function Ee(n, e, t, i) {
|
|
46
46
|
return n.addEventListener(e, t, i), () => n.removeEventListener(e, t, i);
|
|
47
47
|
}
|
|
48
48
|
function f(n, e, t) {
|
|
49
49
|
t == null ? n.removeAttribute(e) : n.getAttribute(e) !== t && n.setAttribute(e, t);
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function Et(n) {
|
|
52
52
|
return Array.from(n.childNodes);
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function qe(n, e, t) {
|
|
55
55
|
n.classList.toggle(e, !!t);
|
|
56
56
|
}
|
|
57
57
|
function pt(n, e, { bubbles: t = !1, cancelable: i = !1 } = {}) {
|
|
@@ -66,22 +66,22 @@ function xt(n) {
|
|
|
66
66
|
}
|
|
67
67
|
), e;
|
|
68
68
|
}
|
|
69
|
-
let
|
|
70
|
-
function
|
|
71
|
-
|
|
69
|
+
let fe;
|
|
70
|
+
function se(n) {
|
|
71
|
+
fe = n;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
if (!
|
|
75
|
-
return
|
|
73
|
+
function Le() {
|
|
74
|
+
if (!fe) throw new Error("Function called outside component initialization");
|
|
75
|
+
return fe;
|
|
76
76
|
}
|
|
77
77
|
function Ct(n) {
|
|
78
|
-
|
|
78
|
+
Le().$$.on_mount.push(n);
|
|
79
79
|
}
|
|
80
80
|
function Lt(n) {
|
|
81
|
-
|
|
81
|
+
Le().$$.on_destroy.push(n);
|
|
82
82
|
}
|
|
83
83
|
function It() {
|
|
84
|
-
const n =
|
|
84
|
+
const n = Le();
|
|
85
85
|
return (e, t, { cancelable: i = !1 } = {}) => {
|
|
86
86
|
const l = n.$$.callbacks[e];
|
|
87
87
|
if (l) {
|
|
@@ -98,50 +98,50 @@ function It() {
|
|
|
98
98
|
return !0;
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
const te = [],
|
|
101
|
+
const te = [], be = [];
|
|
102
102
|
let ne = [];
|
|
103
|
-
const
|
|
104
|
-
let
|
|
105
|
-
function
|
|
106
|
-
|
|
103
|
+
const Ze = [], tt = /* @__PURE__ */ Promise.resolve();
|
|
104
|
+
let xe = !1;
|
|
105
|
+
function nt() {
|
|
106
|
+
xe || (xe = !0, tt.then(w));
|
|
107
107
|
}
|
|
108
108
|
function At() {
|
|
109
|
-
return
|
|
109
|
+
return nt(), tt;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function Ce(n) {
|
|
112
112
|
ne.push(n);
|
|
113
113
|
}
|
|
114
|
-
const
|
|
114
|
+
const pe = /* @__PURE__ */ new Set();
|
|
115
115
|
let ee = 0;
|
|
116
116
|
function w() {
|
|
117
117
|
if (ee !== 0)
|
|
118
118
|
return;
|
|
119
|
-
const n =
|
|
119
|
+
const n = fe;
|
|
120
120
|
do {
|
|
121
121
|
try {
|
|
122
122
|
for (; ee < te.length; ) {
|
|
123
123
|
const e = te[ee];
|
|
124
|
-
ee++,
|
|
124
|
+
ee++, se(e), Rt(e.$$);
|
|
125
125
|
}
|
|
126
126
|
} catch (e) {
|
|
127
127
|
throw te.length = 0, ee = 0, e;
|
|
128
128
|
}
|
|
129
|
-
for (
|
|
129
|
+
for (se(null), te.length = 0, ee = 0; be.length; ) be.pop()();
|
|
130
130
|
for (let e = 0; e < ne.length; e += 1) {
|
|
131
131
|
const t = ne[e];
|
|
132
|
-
|
|
132
|
+
pe.has(t) || (pe.add(t), t());
|
|
133
133
|
}
|
|
134
134
|
ne.length = 0;
|
|
135
135
|
} while (te.length);
|
|
136
|
-
for (;
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
for (; Ze.length; )
|
|
137
|
+
Ze.pop()();
|
|
138
|
+
xe = !1, pe.clear(), se(n);
|
|
139
139
|
}
|
|
140
140
|
function Rt(n) {
|
|
141
141
|
if (n.fragment !== null) {
|
|
142
|
-
n.update(),
|
|
142
|
+
n.update(), ce(n.before_update);
|
|
143
143
|
const e = n.dirty;
|
|
144
|
-
n.dirty = [-1], n.fragment && n.fragment.p(n.ctx, e), n.after_update.forEach(
|
|
144
|
+
n.dirty = [-1], n.fragment && n.fragment.p(n.ctx, e), n.after_update.forEach(Ce);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
function $t(n) {
|
|
@@ -154,21 +154,21 @@ function Tt(n, e) {
|
|
|
154
154
|
}
|
|
155
155
|
function St(n, e, t) {
|
|
156
156
|
const { fragment: i, after_update: l } = n.$$;
|
|
157
|
-
i && i.m(e, t),
|
|
158
|
-
const o = n.$$.on_mount.map(
|
|
159
|
-
n.$$.on_destroy ? n.$$.on_destroy.push(...o) :
|
|
160
|
-
}), l.forEach(
|
|
157
|
+
i && i.m(e, t), Ce(() => {
|
|
158
|
+
const o = n.$$.on_mount.map(Qe).filter(et);
|
|
159
|
+
n.$$.on_destroy ? n.$$.on_destroy.push(...o) : ce(o), n.$$.on_mount = [];
|
|
160
|
+
}), l.forEach(Ce);
|
|
161
161
|
}
|
|
162
162
|
function Dt(n, e) {
|
|
163
163
|
const t = n.$$;
|
|
164
|
-
t.fragment !== null && ($t(t.after_update),
|
|
164
|
+
t.fragment !== null && ($t(t.after_update), ce(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
|
|
165
165
|
}
|
|
166
166
|
function Nt(n, e) {
|
|
167
|
-
n.$$.dirty[0] === -1 && (te.push(n),
|
|
167
|
+
n.$$.dirty[0] === -1 && (te.push(n), nt(), n.$$.dirty.fill(0)), n.$$.dirty[e / 31 | 0] |= 1 << e % 31;
|
|
168
168
|
}
|
|
169
169
|
function jt(n, e, t, i, l, o, s = null, a = [-1]) {
|
|
170
|
-
const
|
|
171
|
-
|
|
170
|
+
const u = fe;
|
|
171
|
+
se(n);
|
|
172
172
|
const h = n.$$ = {
|
|
173
173
|
fragment: null,
|
|
174
174
|
ctx: [],
|
|
@@ -176,37 +176,37 @@ function jt(n, e, t, i, l, o, s = null, a = [-1]) {
|
|
|
176
176
|
props: o,
|
|
177
177
|
update: re,
|
|
178
178
|
not_equal: l,
|
|
179
|
-
bound:
|
|
179
|
+
bound: Ue(),
|
|
180
180
|
// lifecycle
|
|
181
181
|
on_mount: [],
|
|
182
182
|
on_destroy: [],
|
|
183
183
|
on_disconnect: [],
|
|
184
184
|
before_update: [],
|
|
185
185
|
after_update: [],
|
|
186
|
-
context: new Map(e.context || (
|
|
186
|
+
context: new Map(e.context || (u ? u.$$.context : [])),
|
|
187
187
|
// everything else
|
|
188
|
-
callbacks:
|
|
188
|
+
callbacks: Ue(),
|
|
189
189
|
dirty: a,
|
|
190
190
|
skip_bound: !1,
|
|
191
|
-
root: e.target ||
|
|
191
|
+
root: e.target || u.$$.root
|
|
192
192
|
};
|
|
193
193
|
s && s(h.root);
|
|
194
194
|
let H = !1;
|
|
195
|
-
if (h.ctx = t ? t(n, e.props || {}, (T, F, ...
|
|
196
|
-
const O =
|
|
195
|
+
if (h.ctx = t ? t(n, e.props || {}, (T, F, ...v) => {
|
|
196
|
+
const O = v.length ? v[0] : F;
|
|
197
197
|
return h.ctx && l(h.ctx[T], h.ctx[T] = O) && (!h.skip_bound && h.bound[T] && h.bound[T](O), H && Nt(n, T)), F;
|
|
198
|
-
}) : [], h.update(), H = !0,
|
|
198
|
+
}) : [], h.update(), H = !0, ce(h.before_update), h.fragment = i ? i(h.ctx) : !1, e.target) {
|
|
199
199
|
if (e.hydrate) {
|
|
200
|
-
const T =
|
|
201
|
-
h.fragment && h.fragment.l(T), T.forEach(
|
|
200
|
+
const T = Et(e.target);
|
|
201
|
+
h.fragment && h.fragment.l(T), T.forEach(D);
|
|
202
202
|
} else
|
|
203
203
|
h.fragment && h.fragment.c();
|
|
204
204
|
e.intro && Tt(n.$$.fragment), St(n, e.target, e.anchor), w();
|
|
205
205
|
}
|
|
206
|
-
|
|
206
|
+
se(u);
|
|
207
207
|
}
|
|
208
|
-
let
|
|
209
|
-
typeof HTMLElement == "function" && (
|
|
208
|
+
let rt;
|
|
209
|
+
typeof HTMLElement == "function" && (rt = class extends HTMLElement {
|
|
210
210
|
constructor(e, t, i) {
|
|
211
211
|
super();
|
|
212
212
|
/** The Svelte component constructor */
|
|
@@ -259,7 +259,7 @@ typeof HTMLElement == "function" && (nt = class extends HTMLElement {
|
|
|
259
259
|
P(h, s, H);
|
|
260
260
|
},
|
|
261
261
|
d: function(h) {
|
|
262
|
-
h &&
|
|
262
|
+
h && D(s);
|
|
263
263
|
}
|
|
264
264
|
};
|
|
265
265
|
};
|
|
@@ -271,7 +271,7 @@ typeof HTMLElement == "function" && (nt = class extends HTMLElement {
|
|
|
271
271
|
o in i && (t[o] = [e(o)]);
|
|
272
272
|
for (const o of this.attributes) {
|
|
273
273
|
const s = this.$$g_p(o.name);
|
|
274
|
-
s in this.$$d || (this.$$d[s] =
|
|
274
|
+
s in this.$$d || (this.$$d[s] = me(s, o.value, this.$$p_d, "toProp"));
|
|
275
275
|
}
|
|
276
276
|
for (const o in this.$$p_d)
|
|
277
277
|
!(o in this.$$d) && this[o] !== void 0 && (this.$$d[o] = this[o], delete this[o]);
|
|
@@ -289,7 +289,7 @@ typeof HTMLElement == "function" && (nt = class extends HTMLElement {
|
|
|
289
289
|
this.$$r = !0;
|
|
290
290
|
for (const o in this.$$p_d)
|
|
291
291
|
if (this.$$d[o] = this.$$c.$$.ctx[this.$$c.$$.props[o]], this.$$p_d[o].reflect) {
|
|
292
|
-
const s =
|
|
292
|
+
const s = me(
|
|
293
293
|
o,
|
|
294
294
|
this.$$d[o],
|
|
295
295
|
this.$$p_d,
|
|
@@ -312,7 +312,7 @@ typeof HTMLElement == "function" && (nt = class extends HTMLElement {
|
|
|
312
312
|
// and setting attributes through setAttribute etc, this is helpful
|
|
313
313
|
attributeChangedCallback(e, t, i) {
|
|
314
314
|
var l;
|
|
315
|
-
this.$$r || (e = this.$$g_p(e), this.$$d[e] =
|
|
315
|
+
this.$$r || (e = this.$$g_p(e), this.$$d[e] = me(e, i, this.$$p_d, "toProp"), (l = this.$$c) == null || l.$set({ [e]: this.$$d[e] }));
|
|
316
316
|
}
|
|
317
317
|
disconnectedCallback() {
|
|
318
318
|
this.$$cn = !1, Promise.resolve().then(() => {
|
|
@@ -325,7 +325,7 @@ typeof HTMLElement == "function" && (nt = class extends HTMLElement {
|
|
|
325
325
|
) || e;
|
|
326
326
|
}
|
|
327
327
|
});
|
|
328
|
-
function
|
|
328
|
+
function me(n, e, t, i) {
|
|
329
329
|
var o;
|
|
330
330
|
const l = (o = t[n]) == null ? void 0 : o.type;
|
|
331
331
|
if (e = l === "Boolean" && typeof e != "boolean" ? e != null : e, !i || !t[n])
|
|
@@ -356,7 +356,7 @@ function he(n, e, t, i) {
|
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
function Vt(n, e, t, i, l, o) {
|
|
359
|
-
let s = class extends
|
|
359
|
+
let s = class extends rt {
|
|
360
360
|
constructor() {
|
|
361
361
|
super(n, t, l), this.$$p_d = e;
|
|
362
362
|
}
|
|
@@ -371,16 +371,16 @@ function Vt(n, e, t, i, l, o) {
|
|
|
371
371
|
get() {
|
|
372
372
|
return this.$$c && a in this.$$c ? this.$$c[a] : this.$$d[a];
|
|
373
373
|
},
|
|
374
|
-
set(
|
|
374
|
+
set(u) {
|
|
375
375
|
var h;
|
|
376
|
-
|
|
376
|
+
u = me(a, u, e), this.$$d[a] = u, (h = this.$$c) == null || h.$set({ [a]: u });
|
|
377
377
|
}
|
|
378
378
|
});
|
|
379
379
|
}), i.forEach((a) => {
|
|
380
380
|
Object.defineProperty(s.prototype, a, {
|
|
381
381
|
get() {
|
|
382
|
-
var
|
|
383
|
-
return (
|
|
382
|
+
var u;
|
|
383
|
+
return (u = this.$$c) == null ? void 0 : u[a];
|
|
384
384
|
}
|
|
385
385
|
});
|
|
386
386
|
}), o && (s = o(s)), n.element = /** @type {any} */
|
|
@@ -416,7 +416,7 @@ class Pt {
|
|
|
416
416
|
* @returns {() => void}
|
|
417
417
|
*/
|
|
418
418
|
$on(e, t) {
|
|
419
|
-
if (!
|
|
419
|
+
if (!et(t))
|
|
420
420
|
return re;
|
|
421
421
|
const i = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
|
|
422
422
|
return i.push(t), () => {
|
|
@@ -441,7 +441,7 @@ function Ot(n) {
|
|
|
441
441
|
async function Bt(n, e = "SHA-256", t = 1e5) {
|
|
442
442
|
const i = Date.now().toString(16);
|
|
443
443
|
n || (n = Math.round(Math.random() * t));
|
|
444
|
-
const l = await
|
|
444
|
+
const l = await it(i, n, e);
|
|
445
445
|
return {
|
|
446
446
|
algorithm: e,
|
|
447
447
|
challenge: l,
|
|
@@ -449,7 +449,7 @@ async function Bt(n, e = "SHA-256", t = 1e5) {
|
|
|
449
449
|
signature: ""
|
|
450
450
|
};
|
|
451
451
|
}
|
|
452
|
-
async function
|
|
452
|
+
async function it(n, e, t) {
|
|
453
453
|
return Ot(
|
|
454
454
|
await crypto.subtle.digest(
|
|
455
455
|
t.toUpperCase(),
|
|
@@ -461,12 +461,12 @@ function Ut(n, e, t = "SHA-256", i = 1e6, l = 0) {
|
|
|
461
461
|
const o = new AbortController(), s = Date.now();
|
|
462
462
|
return {
|
|
463
463
|
promise: (async () => {
|
|
464
|
-
for (let
|
|
464
|
+
for (let u = l; u <= i; u += 1) {
|
|
465
465
|
if (o.signal.aborted)
|
|
466
466
|
return null;
|
|
467
|
-
if (await
|
|
467
|
+
if (await it(e, u, t) === n)
|
|
468
468
|
return {
|
|
469
|
-
number:
|
|
469
|
+
number: u,
|
|
470
470
|
took: Date.now() - s
|
|
471
471
|
};
|
|
472
472
|
}
|
|
@@ -476,17 +476,17 @@ function Ut(n, e, t = "SHA-256", i = 1e6, l = 0) {
|
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
478
|
var b = /* @__PURE__ */ ((n) => (n.ERROR = "error", n.VERIFIED = "verified", n.VERIFYING = "verifying", n.UNVERIFIED = "unverified", n.EXPIRED = "expired", n))(b || {});
|
|
479
|
-
function
|
|
479
|
+
function Ye(n) {
|
|
480
480
|
let e, t, i;
|
|
481
481
|
return {
|
|
482
482
|
c() {
|
|
483
483
|
e = Z("svg"), t = Z("path"), i = Z("path"), f(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"), f(t, "fill", "currentColor"), f(t, "opacity", ".25"), f(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"), f(i, "fill", "currentColor"), f(i, "class", "altcha-spinner"), f(e, "width", "24"), f(e, "height", "24"), f(e, "viewBox", "0 0 24 24"), f(e, "xmlns", "http://www.w3.org/2000/svg");
|
|
484
484
|
},
|
|
485
485
|
m(l, o) {
|
|
486
|
-
P(l, e, o),
|
|
486
|
+
P(l, e, o), E(e, t), E(e, i);
|
|
487
487
|
},
|
|
488
488
|
d(l) {
|
|
489
|
-
l &&
|
|
489
|
+
l && D(e);
|
|
490
490
|
}
|
|
491
491
|
};
|
|
492
492
|
}
|
|
@@ -511,7 +511,7 @@ function qt(n) {
|
|
|
511
511
|
l[4] + "_checkbox") && f(e, "for", i);
|
|
512
512
|
},
|
|
513
513
|
d(l) {
|
|
514
|
-
l &&
|
|
514
|
+
l && D(e);
|
|
515
515
|
}
|
|
516
516
|
};
|
|
517
517
|
}
|
|
@@ -533,7 +533,7 @@ function Zt(n) {
|
|
|
533
533
|
i[11].verifying + "") && (e.innerHTML = t);
|
|
534
534
|
},
|
|
535
535
|
d(i) {
|
|
536
|
-
i &&
|
|
536
|
+
i && D(e);
|
|
537
537
|
}
|
|
538
538
|
};
|
|
539
539
|
}
|
|
@@ -569,36 +569,36 @@ function Yt(n) {
|
|
|
569
569
|
o[5]);
|
|
570
570
|
},
|
|
571
571
|
d(o) {
|
|
572
|
-
o && (
|
|
572
|
+
o && (D(e), D(i), D(l));
|
|
573
573
|
}
|
|
574
574
|
};
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function Ge(n) {
|
|
577
577
|
let e, t, i, l, o, s, a;
|
|
578
578
|
return {
|
|
579
579
|
c() {
|
|
580
|
-
e = $("div"), t = $("a"), i = Z("svg"), l = Z("path"), o = Z("path"), s = Z("path"), f(l, "d", "M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"), f(l, "fill", "currentColor"), f(o, "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"), f(o, "fill", "currentColor"), f(s, "d", "M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"), f(s, "fill", "currentColor"), f(i, "width", "22"), f(i, "height", "22"), f(i, "viewBox", "0 0 20 20"), f(i, "fill", "none"), f(i, "xmlns", "http://www.w3.org/2000/svg"), f(t, "href",
|
|
580
|
+
e = $("div"), t = $("a"), i = Z("svg"), l = Z("path"), o = Z("path"), s = Z("path"), f(l, "d", "M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"), f(l, "fill", "currentColor"), f(o, "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"), f(o, "fill", "currentColor"), f(s, "d", "M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"), f(s, "fill", "currentColor"), f(i, "width", "22"), f(i, "height", "22"), f(i, "viewBox", "0 0 20 20"), f(i, "fill", "none"), f(i, "xmlns", "http://www.w3.org/2000/svg"), f(t, "href", ot), f(t, "target", "_blank"), f(t, "class", "altcha-logo"), f(t, "aria-label", a = /*_strings*/
|
|
581
581
|
n[11].ariaLinkLabel);
|
|
582
582
|
},
|
|
583
|
-
m(
|
|
584
|
-
P(
|
|
583
|
+
m(u, h) {
|
|
584
|
+
P(u, e, h), E(e, t), E(t, i), E(i, l), E(i, o), E(i, s);
|
|
585
585
|
},
|
|
586
|
-
p(
|
|
586
|
+
p(u, h) {
|
|
587
587
|
h[0] & /*_strings*/
|
|
588
588
|
2048 && a !== (a = /*_strings*/
|
|
589
|
-
|
|
589
|
+
u[11].ariaLinkLabel) && f(t, "aria-label", a);
|
|
590
590
|
},
|
|
591
|
-
d(
|
|
592
|
-
|
|
591
|
+
d(u) {
|
|
592
|
+
u && D(e);
|
|
593
593
|
}
|
|
594
594
|
};
|
|
595
595
|
}
|
|
596
|
-
function
|
|
596
|
+
function We(n) {
|
|
597
597
|
let e, t, i, l;
|
|
598
|
-
function o(
|
|
598
|
+
function o(u, h) {
|
|
599
599
|
return (
|
|
600
600
|
/*state*/
|
|
601
|
-
|
|
601
|
+
u[6] === b.EXPIRED ? Wt : Gt
|
|
602
602
|
);
|
|
603
603
|
}
|
|
604
604
|
let s = o(n), a = s(n);
|
|
@@ -606,14 +606,14 @@ function Ge(n) {
|
|
|
606
606
|
c() {
|
|
607
607
|
e = $("div"), t = Z("svg"), i = Z("path"), l = W(), a.c(), f(i, "stroke-linecap", "round"), f(i, "stroke-linejoin", "round"), f(i, "d", "M6 18L18 6M6 6l12 12"), f(t, "width", "14"), f(t, "height", "14"), f(t, "xmlns", "http://www.w3.org/2000/svg"), f(t, "fill", "none"), f(t, "viewBox", "0 0 24 24"), f(t, "stroke-width", "1.5"), f(t, "stroke", "currentColor"), f(e, "class", "altcha-error");
|
|
608
608
|
},
|
|
609
|
-
m(
|
|
610
|
-
P(
|
|
609
|
+
m(u, h) {
|
|
610
|
+
P(u, e, h), E(e, t), E(t, i), E(e, l), a.m(e, null);
|
|
611
611
|
},
|
|
612
|
-
p(
|
|
613
|
-
s === (s = o(
|
|
612
|
+
p(u, h) {
|
|
613
|
+
s === (s = o(u)) && a ? a.p(u, h) : (a.d(1), a = s(u), a && (a.c(), a.m(e, null)));
|
|
614
614
|
},
|
|
615
|
-
d(
|
|
616
|
-
|
|
615
|
+
d(u) {
|
|
616
|
+
u && D(e), a.d();
|
|
617
617
|
}
|
|
618
618
|
};
|
|
619
619
|
}
|
|
@@ -646,7 +646,7 @@ function Gt(n) {
|
|
|
646
646
|
);
|
|
647
647
|
},
|
|
648
648
|
d(i) {
|
|
649
|
-
i &&
|
|
649
|
+
i && D(e);
|
|
650
650
|
}
|
|
651
651
|
};
|
|
652
652
|
}
|
|
@@ -679,11 +679,11 @@ function Wt(n) {
|
|
|
679
679
|
);
|
|
680
680
|
},
|
|
681
681
|
d(i) {
|
|
682
|
-
i &&
|
|
682
|
+
i && D(e);
|
|
683
683
|
}
|
|
684
684
|
};
|
|
685
685
|
}
|
|
686
|
-
function
|
|
686
|
+
function Xe(n) {
|
|
687
687
|
let e, t, i = (
|
|
688
688
|
/*_strings*/
|
|
689
689
|
n[11].footer + ""
|
|
@@ -693,7 +693,7 @@ function We(n) {
|
|
|
693
693
|
e = $("div"), t = $("div"), f(e, "class", "altcha-footer");
|
|
694
694
|
},
|
|
695
695
|
m(l, o) {
|
|
696
|
-
P(l, e, o),
|
|
696
|
+
P(l, e, o), E(e, t), t.innerHTML = i;
|
|
697
697
|
},
|
|
698
698
|
p(l, o) {
|
|
699
699
|
o[0] & /*_strings*/
|
|
@@ -701,11 +701,11 @@ function We(n) {
|
|
|
701
701
|
l[11].footer + "") && (t.innerHTML = i);
|
|
702
702
|
},
|
|
703
703
|
d(l) {
|
|
704
|
-
l &&
|
|
704
|
+
l && D(e);
|
|
705
705
|
}
|
|
706
706
|
};
|
|
707
707
|
}
|
|
708
|
-
function
|
|
708
|
+
function Je(n) {
|
|
709
709
|
let e;
|
|
710
710
|
return {
|
|
711
711
|
c() {
|
|
@@ -716,14 +716,14 @@ function Xe(n) {
|
|
|
716
716
|
},
|
|
717
717
|
p: re,
|
|
718
718
|
d(t) {
|
|
719
|
-
t &&
|
|
719
|
+
t && D(e), n[36](null);
|
|
720
720
|
}
|
|
721
721
|
};
|
|
722
722
|
}
|
|
723
723
|
function Xt(n) {
|
|
724
|
-
let e, t, i, l, o, s, a,
|
|
724
|
+
let e, t, i, l, o, s, a, u, h, H, T, F, v, O, X, M = (
|
|
725
725
|
/*state*/
|
|
726
|
-
n[6] === b.VERIFYING &&
|
|
726
|
+
n[6] === b.VERIFYING && Ye()
|
|
727
727
|
);
|
|
728
728
|
function Q(d, y) {
|
|
729
729
|
return (
|
|
@@ -736,24 +736,24 @@ function Xt(n) {
|
|
|
736
736
|
}
|
|
737
737
|
let Y = Q(n), S = Y(n), L = (
|
|
738
738
|
/*hidelogo*/
|
|
739
|
-
n[3] !== !0 &&
|
|
739
|
+
n[3] !== !0 && Ge(n)
|
|
740
740
|
), I = (
|
|
741
741
|
/*error*/
|
|
742
742
|
(n[10] || /*state*/
|
|
743
|
-
n[6] === b.EXPIRED) &&
|
|
743
|
+
n[6] === b.EXPIRED) && We(n)
|
|
744
744
|
), _ = (
|
|
745
745
|
/*_strings*/
|
|
746
746
|
n[11].footer && /*hidefooter*/
|
|
747
|
-
n[2] !== !0 &&
|
|
747
|
+
n[2] !== !0 && Xe(n)
|
|
748
748
|
), A = (
|
|
749
749
|
/*floating*/
|
|
750
|
-
n[1] &&
|
|
750
|
+
n[1] && Je(n)
|
|
751
751
|
);
|
|
752
752
|
return {
|
|
753
753
|
c() {
|
|
754
|
-
e = $("div"), t = $("div"), M && M.c(), i = W(), l = $("div"), o = $("input"),
|
|
754
|
+
e = $("div"), t = $("div"), M && M.c(), i = W(), l = $("div"), o = $("input"), u = W(), h = $("div"), S.c(), H = W(), L && L.c(), T = W(), I && I.c(), F = W(), _ && _.c(), v = W(), A && A.c(), f(o, "type", "checkbox"), f(o, "id", s = /*name*/
|
|
755
755
|
n[4] + "_checkbox"), o.required = a = /*auto*/
|
|
756
|
-
n[0] !== "onsubmit", f(l, "class", "altcha-checkbox"),
|
|
756
|
+
n[0] !== "onsubmit", f(l, "class", "altcha-checkbox"), qe(
|
|
757
757
|
l,
|
|
758
758
|
"altcha-hidden",
|
|
759
759
|
/*state*/
|
|
@@ -771,21 +771,21 @@ function Xt(n) {
|
|
|
771
771
|
);
|
|
772
772
|
},
|
|
773
773
|
m(d, y) {
|
|
774
|
-
P(d, e, y),
|
|
775
|
-
n[7],
|
|
776
|
-
|
|
774
|
+
P(d, e, y), E(e, t), M && M.m(t, null), E(t, i), E(t, l), E(l, o), o.checked = /*checked*/
|
|
775
|
+
n[7], E(t, u), E(t, h), S.m(h, null), E(t, H), L && L.m(t, null), E(e, T), I && I.m(e, null), E(e, F), _ && _.m(e, null), E(e, v), A && A.m(e, null), n[37](e), O || (X = [
|
|
776
|
+
Ee(
|
|
777
777
|
o,
|
|
778
778
|
"change",
|
|
779
779
|
/*input_change_handler*/
|
|
780
780
|
n[35]
|
|
781
781
|
),
|
|
782
|
-
|
|
782
|
+
Ee(
|
|
783
783
|
o,
|
|
784
784
|
"change",
|
|
785
785
|
/*onCheckedChange*/
|
|
786
786
|
n[12]
|
|
787
787
|
),
|
|
788
|
-
|
|
788
|
+
Ee(
|
|
789
789
|
o,
|
|
790
790
|
"invalid",
|
|
791
791
|
/*onInvalid*/
|
|
@@ -795,25 +795,25 @@ function Xt(n) {
|
|
|
795
795
|
},
|
|
796
796
|
p(d, y) {
|
|
797
797
|
/*state*/
|
|
798
|
-
d[6] === b.VERIFYING ? M || (M =
|
|
798
|
+
d[6] === b.VERIFYING ? M || (M = Ye(), M.c(), M.m(t, i)) : M && (M.d(1), M = null), y[0] & /*name*/
|
|
799
799
|
16 && s !== (s = /*name*/
|
|
800
800
|
d[4] + "_checkbox") && f(o, "id", s), y[0] & /*auto*/
|
|
801
801
|
1 && a !== (a = /*auto*/
|
|
802
802
|
d[0] !== "onsubmit") && (o.required = a), y[0] & /*checked*/
|
|
803
803
|
128 && (o.checked = /*checked*/
|
|
804
804
|
d[7]), y[0] & /*state*/
|
|
805
|
-
64 &&
|
|
805
|
+
64 && qe(
|
|
806
806
|
l,
|
|
807
807
|
"altcha-hidden",
|
|
808
808
|
/*state*/
|
|
809
809
|
d[6] === b.VERIFYING
|
|
810
810
|
), Y === (Y = Q(d)) && S ? S.p(d, y) : (S.d(1), S = Y(d), S && (S.c(), S.m(h, null))), /*hidelogo*/
|
|
811
|
-
d[3] !== !0 ? L ? L.p(d, y) : (L =
|
|
811
|
+
d[3] !== !0 ? L ? L.p(d, y) : (L = Ge(d), L.c(), L.m(t, null)) : L && (L.d(1), L = null), /*error*/
|
|
812
812
|
d[10] || /*state*/
|
|
813
|
-
d[6] === b.EXPIRED ? I ? I.p(d, y) : (I =
|
|
813
|
+
d[6] === b.EXPIRED ? I ? I.p(d, y) : (I = We(d), I.c(), I.m(e, F)) : I && (I.d(1), I = null), /*_strings*/
|
|
814
814
|
d[11].footer && /*hidefooter*/
|
|
815
|
-
d[2] !== !0 ? _ ? _.p(d, y) : (_ =
|
|
816
|
-
d[1] ? A ? A.p(d, y) : (A =
|
|
815
|
+
d[2] !== !0 ? _ ? _.p(d, y) : (_ = Xe(d), _.c(), _.m(e, v)) : _ && (_.d(1), _ = null), /*floating*/
|
|
816
|
+
d[1] ? A ? A.p(d, y) : (A = Je(d), A.c(), A.m(e, null)) : A && (A.d(1), A = null), y[0] & /*state*/
|
|
817
817
|
64 && f(
|
|
818
818
|
e,
|
|
819
819
|
"data-state",
|
|
@@ -830,12 +830,12 @@ function Xt(n) {
|
|
|
830
830
|
i: re,
|
|
831
831
|
o: re,
|
|
832
832
|
d(d) {
|
|
833
|
-
d &&
|
|
833
|
+
d && D(e), M && M.d(), S.d(), L && L.d(), I && I.d(), _ && _.d(), A && A.d(), n[37](null), O = !1, ce(X);
|
|
834
834
|
}
|
|
835
835
|
};
|
|
836
836
|
}
|
|
837
|
-
const
|
|
838
|
-
function
|
|
837
|
+
const ze = "Visit Altcha.org", ot = "https://altcha.org/";
|
|
838
|
+
function Ke(n) {
|
|
839
839
|
return JSON.parse(n);
|
|
840
840
|
}
|
|
841
841
|
function Jt() {
|
|
@@ -845,295 +845,299 @@ function Jt() {
|
|
|
845
845
|
}
|
|
846
846
|
}
|
|
847
847
|
function zt(n, e, t) {
|
|
848
|
-
var
|
|
849
|
-
let i, l, o, { auto: s = void 0 } = e, { blockspam: a = void 0 } = e, { challengeurl:
|
|
850
|
-
const
|
|
851
|
-
let G = !1,
|
|
848
|
+
var Oe, Be;
|
|
849
|
+
let i, l, o, { auto: s = void 0 } = e, { blockspam: a = void 0 } = e, { challengeurl: u = void 0 } = e, { challengejson: h = void 0 } = e, { debug: H = !1 } = e, { delay: T = 0 } = e, { expire: F = void 0 } = e, { floating: v = void 0 } = e, { floatinganchor: O = void 0 } = e, { floatingoffset: X = void 0 } = e, { hidefooter: M = !1 } = e, { hidelogo: Q = !1 } = e, { name: Y = "altcha" } = e, { maxnumber: S = 1e6 } = e, { mockerror: L = !1 } = e, { refetchonexpire: I = !0 } = e, { spamfilter: _ = !1 } = e, { strings: A = void 0 } = e, { test: d = !1 } = e, { verifyurl: y = void 0 } = e, { workers: ie = Math.min(16, navigator.hardwareConcurrency || 8) } = e, { workerurl: we = void 0 } = e;
|
|
850
|
+
const _e = It(), Ie = ["SHA-256", "SHA-384", "SHA-512"], Ae = (Be = (Oe = document.documentElement.lang) == null ? void 0 : Oe.split("-")) == null ? void 0 : Be[0];
|
|
851
|
+
let G = !1, p, J = null, ue = null, m = null, ye = null, z = null, N = b.UNVERIFIED, U = null;
|
|
852
852
|
Lt(() => {
|
|
853
|
-
m && (m.removeEventListener("submit",
|
|
853
|
+
m && (m.removeEventListener("submit", $e), m.removeEventListener("reset", Me), m.removeEventListener("focusin", Re), m = null), U && (clearTimeout(U), U = null), document.removeEventListener("click", Ne), document.removeEventListener("scroll", je), window.removeEventListener("resize", Pe);
|
|
854
854
|
}), Ct(() => {
|
|
855
|
-
|
|
855
|
+
x("mounted", "0.6.2"), x("workers", ie), d && x("using test mode"), F && ae(F), s !== void 0 && x("auto", s), v !== void 0 && Fe(v), m = p.closest("form"), m && (m.addEventListener("submit", $e, { capture: !0 }), m.addEventListener("reset", Me), s === "onfocus" && m.addEventListener("focusin", Re)), s === "onload" && K();
|
|
856
856
|
});
|
|
857
|
-
function
|
|
858
|
-
(H || r.some((
|
|
857
|
+
function x(...r) {
|
|
858
|
+
(H || r.some((c) => c instanceof Error)) && console[r[0] instanceof Error ? "error" : "log"]("ALTCHA", ...r);
|
|
859
859
|
}
|
|
860
|
-
function
|
|
861
|
-
|
|
860
|
+
function Re(r) {
|
|
861
|
+
N === b.UNVERIFIED && K();
|
|
862
862
|
}
|
|
863
|
-
function
|
|
864
|
-
m && s === "onsubmit" && (
|
|
863
|
+
function $e(r) {
|
|
864
|
+
m && s === "onsubmit" && (N === b.UNVERIFIED ? (r.preventDefault(), r.stopPropagation(), K().then(() => {
|
|
865
865
|
m == null || m.requestSubmit();
|
|
866
|
-
})) :
|
|
866
|
+
})) : N !== b.VERIFIED && (r.preventDefault(), r.stopPropagation(), N === b.VERIFYING && Ve()));
|
|
867
867
|
}
|
|
868
|
-
function
|
|
869
|
-
|
|
868
|
+
function Me() {
|
|
869
|
+
he();
|
|
870
870
|
}
|
|
871
|
-
function
|
|
871
|
+
function Te(r, c) {
|
|
872
872
|
return btoa(JSON.stringify({
|
|
873
873
|
algorithm: r.algorithm,
|
|
874
874
|
challenge: r.challenge,
|
|
875
|
-
number:
|
|
875
|
+
number: c.number,
|
|
876
876
|
salt: r.salt,
|
|
877
877
|
signature: r.signature,
|
|
878
878
|
test: d ? !0 : void 0,
|
|
879
|
-
took:
|
|
879
|
+
took: c.took
|
|
880
880
|
}));
|
|
881
881
|
}
|
|
882
|
-
function
|
|
882
|
+
function Se(r) {
|
|
883
883
|
if (!r.algorithm)
|
|
884
884
|
throw new Error("Invalid challenge. Property algorithm is missing.");
|
|
885
885
|
if (r.signature === void 0)
|
|
886
886
|
throw new Error("Invalid challenge. Property signature is missing.");
|
|
887
|
-
if (!
|
|
888
|
-
throw new Error(`Unknown algorithm value. Allowed values: ${
|
|
887
|
+
if (!Ie.includes(r.algorithm.toUpperCase()))
|
|
888
|
+
throw new Error(`Unknown algorithm value. Allowed values: ${Ie.join(", ")}`);
|
|
889
889
|
if (!r.challenge || r.challenge.length < 40)
|
|
890
890
|
throw new Error("Challenge is too short. Min. 40 chars.");
|
|
891
891
|
if (!r.salt || r.salt.length < 10)
|
|
892
892
|
throw new Error("Salt is too short. Min. 10 chars.");
|
|
893
893
|
}
|
|
894
|
-
async function
|
|
894
|
+
async function lt() {
|
|
895
895
|
var r;
|
|
896
896
|
if (L)
|
|
897
|
-
throw
|
|
897
|
+
throw x("mocking error"), new Error("Mocked error.");
|
|
898
898
|
if (i)
|
|
899
|
-
return
|
|
899
|
+
return x("using provided json data"), i;
|
|
900
900
|
if (d)
|
|
901
|
-
return
|
|
901
|
+
return x("generating test challenge", { test: d }), Bt(typeof d != "boolean" ? +d : void 0);
|
|
902
902
|
{
|
|
903
|
-
if (!
|
|
903
|
+
if (!u)
|
|
904
904
|
throw new Error("Attribute challengeurl not set.");
|
|
905
|
-
|
|
906
|
-
const
|
|
905
|
+
x("fetching challenge from", u);
|
|
906
|
+
const c = await fetch(u, {
|
|
907
907
|
headers: {
|
|
908
908
|
"x-altcha-spam-filter": _ ? "1" : "0"
|
|
909
909
|
}
|
|
910
910
|
});
|
|
911
|
-
if (
|
|
912
|
-
throw new Error(`Server responded with ${
|
|
913
|
-
const g =
|
|
911
|
+
if (c.status !== 200)
|
|
912
|
+
throw new Error(`Server responded with ${c.status}.`);
|
|
913
|
+
const g = c.headers.get("Expires"), R = c.headers.get("X-Altcha-Config"), j = await c.json(), V = new URLSearchParams((r = j.salt.split("?")) == null ? void 0 : r[1]), q = V.get("expires") || V.get("expire");
|
|
914
914
|
if (q) {
|
|
915
|
-
const k = new Date(+q * 1e3),
|
|
916
|
-
|
|
915
|
+
const k = new Date(+q * 1e3), C = isNaN(k.getTime()) ? 0 : k.getTime() - Date.now();
|
|
916
|
+
C > 0 && ae(C);
|
|
917
917
|
}
|
|
918
918
|
if (R)
|
|
919
919
|
try {
|
|
920
920
|
const k = JSON.parse(R);
|
|
921
|
-
k && typeof k == "object" && (k.verifyurl && (k.verifyurl = new URL(k.verifyurl, new URL(
|
|
921
|
+
k && typeof k == "object" && (k.verifyurl && (k.verifyurl = new URL(k.verifyurl, new URL(u)).toString()), He(k));
|
|
922
922
|
} catch (k) {
|
|
923
|
-
|
|
923
|
+
x("unable to configure from X-Altcha-Config", k);
|
|
924
924
|
}
|
|
925
925
|
if (!F && (g != null && g.length)) {
|
|
926
926
|
const k = Date.parse(g);
|
|
927
927
|
if (k) {
|
|
928
|
-
const
|
|
929
|
-
|
|
928
|
+
const C = k - Date.now();
|
|
929
|
+
C > 0 && ae(C);
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
|
-
return
|
|
932
|
+
return j;
|
|
933
933
|
}
|
|
934
934
|
}
|
|
935
|
-
function
|
|
936
|
-
|
|
935
|
+
function De() {
|
|
936
|
+
u && I && N === b.VERIFIED ? K() : he(b.EXPIRED, o.expired);
|
|
937
937
|
}
|
|
938
|
-
async function
|
|
939
|
-
let
|
|
938
|
+
async function st(r) {
|
|
939
|
+
let c = null;
|
|
940
940
|
if ("Worker" in window) {
|
|
941
941
|
try {
|
|
942
|
-
|
|
942
|
+
c = await ft(r.challenge, r.salt, r.algorithm, r.maxnumber);
|
|
943
943
|
} catch (g) {
|
|
944
|
-
|
|
944
|
+
x(g);
|
|
945
945
|
}
|
|
946
|
-
if ((
|
|
947
|
-
return { data: r, solution:
|
|
946
|
+
if ((c == null ? void 0 : c.number) !== void 0)
|
|
947
|
+
return { data: r, solution: c };
|
|
948
948
|
}
|
|
949
949
|
return {
|
|
950
950
|
data: r,
|
|
951
951
|
solution: await Ut(r.challenge, r.salt, r.algorithm, r.maxnumber || S).promise
|
|
952
952
|
};
|
|
953
953
|
}
|
|
954
|
-
async function
|
|
954
|
+
async function ft(r, c, g, R = typeof d == "number" ? d : S, j = Math.ceil(ie)) {
|
|
955
955
|
const V = [];
|
|
956
|
-
if (
|
|
956
|
+
if (j < 1)
|
|
957
957
|
throw new Error("Wrong number of workers configured.");
|
|
958
|
-
if (
|
|
958
|
+
if (j > 16)
|
|
959
959
|
throw new Error("Too many workers. Max. 16 allowed workers.");
|
|
960
|
-
for (let
|
|
961
|
-
V.push(createAltchaWorker(
|
|
962
|
-
const q = Math.ceil(R /
|
|
963
|
-
const
|
|
964
|
-
return new Promise((
|
|
965
|
-
|
|
966
|
-
if (
|
|
967
|
-
for (const
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
}),
|
|
960
|
+
for (let C = 0; C < j; C++)
|
|
961
|
+
V.push(createAltchaWorker(we));
|
|
962
|
+
const q = Math.ceil(R / j), k = await Promise.all(V.map((C, ve) => {
|
|
963
|
+
const oe = ve * q;
|
|
964
|
+
return new Promise((de) => {
|
|
965
|
+
C.addEventListener("message", (ge) => {
|
|
966
|
+
if (ge.data)
|
|
967
|
+
for (const le of V)
|
|
968
|
+
le !== C && le.postMessage({ type: "abort" });
|
|
969
|
+
de(ge.data);
|
|
970
|
+
}), C.postMessage({
|
|
971
971
|
payload: {
|
|
972
972
|
alg: g,
|
|
973
973
|
challenge: r,
|
|
974
|
-
max:
|
|
975
|
-
salt:
|
|
976
|
-
start:
|
|
974
|
+
max: oe + q,
|
|
975
|
+
salt: c,
|
|
976
|
+
start: oe
|
|
977
977
|
},
|
|
978
978
|
type: "work"
|
|
979
979
|
});
|
|
980
980
|
});
|
|
981
981
|
}));
|
|
982
|
-
for (const
|
|
983
|
-
|
|
984
|
-
return k.find((
|
|
982
|
+
for (const C of V)
|
|
983
|
+
C.terminate();
|
|
984
|
+
return k.find((C) => !!C) || null;
|
|
985
985
|
}
|
|
986
|
-
function
|
|
987
|
-
[b.UNVERIFIED, b.ERROR, b.EXPIRED].includes(
|
|
986
|
+
function ct() {
|
|
987
|
+
[b.UNVERIFIED, b.ERROR, b.EXPIRED].includes(N) ? _ && (m == null ? void 0 : m.reportValidity()) === !1 ? t(7, G = !1) : K() : t(7, G = !0);
|
|
988
988
|
}
|
|
989
|
-
function
|
|
990
|
-
const
|
|
991
|
-
|
|
989
|
+
function Ne(r) {
|
|
990
|
+
const c = r.target;
|
|
991
|
+
v && c && !p.contains(c) && N === b.VERIFIED && t(8, p.style.display = "none", p);
|
|
992
992
|
}
|
|
993
|
-
function
|
|
994
|
-
|
|
993
|
+
function je() {
|
|
994
|
+
v && ke();
|
|
995
995
|
}
|
|
996
|
-
function
|
|
997
|
-
|
|
996
|
+
function Ve() {
|
|
997
|
+
N === b.VERIFYING && o.waitAlert && alert(o.waitAlert);
|
|
998
998
|
}
|
|
999
|
-
function
|
|
1000
|
-
|
|
1001
|
-
|
|
999
|
+
function ut(r) {
|
|
1000
|
+
v && N !== b.UNVERIFIED && requestAnimationFrame(() => {
|
|
1001
|
+
ke();
|
|
1002
1002
|
});
|
|
1003
1003
|
}
|
|
1004
|
-
function
|
|
1005
|
-
|
|
1004
|
+
function Pe() {
|
|
1005
|
+
v && ke();
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1008
|
-
|
|
1007
|
+
function ae(r) {
|
|
1008
|
+
x("expire", r), U && (clearTimeout(U), U = null), r < 1 ? De() : U = setTimeout(De, r);
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1011
|
-
|
|
1010
|
+
function Fe(r) {
|
|
1011
|
+
x("floating", r), v !== r && (t(8, p.style.left = "", p), t(8, p.style.top = "", p)), t(1, v = r === !0 || r === "" ? "auto" : r === !1 || r === "false" ? void 0 : v), v ? (s || t(0, s = "onsubmit"), document.addEventListener("scroll", je), document.addEventListener("click", Ne), window.addEventListener("resize", Pe)) : s === "onsubmit" && t(0, s = void 0);
|
|
1012
1012
|
}
|
|
1013
|
-
function
|
|
1013
|
+
function at(r) {
|
|
1014
1014
|
var g;
|
|
1015
|
-
const
|
|
1016
|
-
return ((g =
|
|
1015
|
+
const c = m == null ? void 0 : m.querySelector(typeof r == "string" ? `input[name="${r}"]` : 'input[type="email"]:not([data-no-spamfilter])');
|
|
1016
|
+
return ((g = c == null ? void 0 : c.value) == null ? void 0 : g.slice(c.value.indexOf("@"))) || void 0;
|
|
1017
1017
|
}
|
|
1018
|
-
function
|
|
1018
|
+
function ht(r) {
|
|
1019
1019
|
return [
|
|
1020
1020
|
...(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])')) || []
|
|
1021
1021
|
].reduce(
|
|
1022
1022
|
(g, R) => {
|
|
1023
|
-
const
|
|
1024
|
-
return
|
|
1023
|
+
const j = R.name, V = R.value.trim();
|
|
1024
|
+
return j && V && (g[j] = V), g;
|
|
1025
1025
|
},
|
|
1026
1026
|
{}
|
|
1027
1027
|
);
|
|
1028
1028
|
}
|
|
1029
|
-
async function
|
|
1029
|
+
async function dt(r) {
|
|
1030
1030
|
if (!y)
|
|
1031
1031
|
throw new Error("Attribute verifyurl not set.");
|
|
1032
|
-
|
|
1033
|
-
const
|
|
1032
|
+
x("requesting server verification from", y);
|
|
1033
|
+
const c = { payload: r };
|
|
1034
1034
|
if (_) {
|
|
1035
|
-
const { email:
|
|
1035
|
+
const { blockedCountries: j, classifier: V, disableRules: q, email: k, expectedLanguages: C, expectedCountries: ve, fields: oe, ipAddress: de, text: ge, timeZone: le } = typeof _ == "object" ? _ : {
|
|
1036
|
+
blockedCountries: void 0,
|
|
1037
|
+
classifier: void 0,
|
|
1038
|
+
disableRules: void 0,
|
|
1036
1039
|
email: void 0,
|
|
1037
1040
|
expectedCountries: void 0,
|
|
1038
1041
|
expectedLanguages: void 0,
|
|
1039
1042
|
fields: void 0,
|
|
1040
1043
|
ipAddress: void 0,
|
|
1044
|
+
text: void 0,
|
|
1041
1045
|
timeZone: void 0
|
|
1042
1046
|
};
|
|
1043
|
-
|
|
1047
|
+
c.blockedCountries = j, c.classifier = V, c.disableRules = q, c.email = k === !1 ? void 0 : at(k), c.expectedCountries = ve, c.expectedLanguages = C || (Ae ? [Ae] : void 0), c.fields = oe === !1 ? void 0 : ht(oe), c.ipAddress = de === !1 ? void 0 : de || "auto", c.text = ge, c.timeZone = le === !1 ? void 0 : le || Jt();
|
|
1044
1048
|
}
|
|
1045
1049
|
const g = await fetch(y, {
|
|
1046
|
-
body: JSON.stringify(
|
|
1050
|
+
body: JSON.stringify(c),
|
|
1047
1051
|
headers: { "content-type": "application/json" },
|
|
1048
1052
|
method: "POST"
|
|
1049
1053
|
});
|
|
1050
1054
|
if (g.status !== 200)
|
|
1051
1055
|
throw new Error(`Server responded with ${g.status}.`);
|
|
1052
1056
|
const R = await g.json();
|
|
1053
|
-
if (R != null && R.payload && t(5, z = R.payload),
|
|
1057
|
+
if (R != null && R.payload && t(5, z = R.payload), _e("serververification", R), a && R.classification === "BAD")
|
|
1054
1058
|
throw new Error("SpamFilter returned negative classification.");
|
|
1055
1059
|
}
|
|
1056
|
-
function
|
|
1057
|
-
if (
|
|
1058
|
-
if (
|
|
1059
|
-
const
|
|
1060
|
-
if (q ? t(8,
|
|
1061
|
-
const
|
|
1062
|
-
t(9, J.style.left = g.left - k + g.width / 2 -
|
|
1060
|
+
function ke(r = 20) {
|
|
1061
|
+
if (p)
|
|
1062
|
+
if (ue || (ue = (O ? document.querySelector(O) : m == null ? void 0 : m.querySelector('input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])')) || m), ue) {
|
|
1063
|
+
const c = parseInt(X, 10) || 12, g = ue.getBoundingClientRect(), R = p.getBoundingClientRect(), j = document.documentElement.clientHeight, V = document.documentElement.clientWidth, q = v === "auto" ? g.bottom + R.height + c + r > j : v === "top", k = Math.max(r, Math.min(V - r - R.width, g.left + g.width / 2 - R.width / 2));
|
|
1064
|
+
if (q ? t(8, p.style.top = `${g.top - (R.height + c)}px`, p) : t(8, p.style.top = `${g.bottom + c}px`, p), t(8, p.style.left = `${k}px`, p), p.setAttribute("data-floating", q ? "top" : "bottom"), J) {
|
|
1065
|
+
const C = J.getBoundingClientRect();
|
|
1066
|
+
t(9, J.style.left = g.left - k + g.width / 2 - C.width / 2 + "px", J);
|
|
1063
1067
|
}
|
|
1064
1068
|
} else
|
|
1065
|
-
|
|
1069
|
+
x("unable to find floating anchor element");
|
|
1066
1070
|
}
|
|
1067
|
-
function
|
|
1068
|
-
r.auto !== void 0 && (t(0, s = r.auto), s === "onload" && K()), r.floatinganchor !== void 0 && t(18, O = r.floatinganchor), r.delay !== void 0 && t(16, T = r.delay), r.floatingoffset !== void 0 && t(19, X = r.floatingoffset), r.floating !== void 0 &&
|
|
1071
|
+
function He(r) {
|
|
1072
|
+
r.auto !== void 0 && (t(0, s = r.auto), s === "onload" && K()), r.floatinganchor !== void 0 && t(18, O = r.floatinganchor), r.delay !== void 0 && t(16, T = r.delay), r.floatingoffset !== void 0 && t(19, X = r.floatingoffset), r.floating !== void 0 && Fe(r.floating), r.expire !== void 0 && (ae(r.expire), t(17, F = r.expire)), r.challenge && (Se(r.challenge), i = r.challenge), r.challengeurl !== void 0 && t(14, u = r.challengeurl), r.debug !== void 0 && t(15, H = !!r.debug), r.hidefooter !== void 0 && t(2, M = !!r.hidefooter), r.hidelogo !== void 0 && t(3, Q = !!r.hidelogo), r.maxnumber !== void 0 && t(20, S = +r.maxnumber), r.mockerror !== void 0 && t(21, L = !!r.mockerror), r.name !== void 0 && t(4, Y = r.name), r.refetchonexpire !== void 0 && t(22, I = !!r.refetchonexpire), r.spamfilter !== void 0 && t(23, _ = typeof r.spamfilter == "object" ? r.spamfilter : !!r.spamfilter), r.strings && t(34, l = r.strings), r.test !== void 0 && t(24, d = typeof r.test == "number" ? r.test : !!r.test), r.verifyurl !== void 0 && t(25, y = r.verifyurl), r.workers !== void 0 && t(26, ie = +r.workers);
|
|
1069
1073
|
}
|
|
1070
|
-
function
|
|
1071
|
-
U && (clearTimeout(U), U = null), t(7, G = !1), t(10,
|
|
1074
|
+
function he(r = b.UNVERIFIED, c = null) {
|
|
1075
|
+
U && (clearTimeout(U), U = null), t(7, G = !1), t(10, ye = c), t(5, z = null), t(6, N = r);
|
|
1072
1076
|
}
|
|
1073
1077
|
async function K() {
|
|
1074
|
-
return
|
|
1075
|
-
if (
|
|
1078
|
+
return he(b.VERIFYING), await new Promise((r) => setTimeout(r, T || 0)), lt().then((r) => (Se(r), x("challenge", r), st(r))).then(({ data: r, solution: c }) => {
|
|
1079
|
+
if (x("solution", c), (c == null ? void 0 : c.number) !== void 0) {
|
|
1076
1080
|
if (y)
|
|
1077
|
-
return
|
|
1078
|
-
t(5, z =
|
|
1081
|
+
return dt(Te(r, c));
|
|
1082
|
+
t(5, z = Te(r, c)), x("payload", z);
|
|
1079
1083
|
} else
|
|
1080
|
-
throw
|
|
1084
|
+
throw x("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."), new Error("Unexpected result returned.");
|
|
1081
1085
|
}).then(() => {
|
|
1082
1086
|
At().then(() => {
|
|
1083
|
-
t(6,
|
|
1087
|
+
t(6, N = b.VERIFIED), t(7, G = !0), x("verified"), _e("verified", { payload: z });
|
|
1084
1088
|
});
|
|
1085
1089
|
}).catch((r) => {
|
|
1086
|
-
|
|
1090
|
+
x(r), t(6, N = b.ERROR), t(7, G = !1), t(10, ye = r.message);
|
|
1087
1091
|
});
|
|
1088
1092
|
}
|
|
1089
|
-
function
|
|
1093
|
+
function gt() {
|
|
1090
1094
|
G = this.checked, t(7, G);
|
|
1091
1095
|
}
|
|
1092
|
-
function
|
|
1093
|
-
|
|
1096
|
+
function mt(r) {
|
|
1097
|
+
be[r ? "unshift" : "push"](() => {
|
|
1094
1098
|
J = r, t(9, J);
|
|
1095
1099
|
});
|
|
1096
1100
|
}
|
|
1097
|
-
function
|
|
1098
|
-
|
|
1099
|
-
|
|
1101
|
+
function bt(r) {
|
|
1102
|
+
be[r ? "unshift" : "push"](() => {
|
|
1103
|
+
p = r, t(8, p);
|
|
1100
1104
|
});
|
|
1101
1105
|
}
|
|
1102
1106
|
return n.$$set = (r) => {
|
|
1103
|
-
"auto" in r && t(0, s = r.auto), "blockspam" in r && t(27, a = r.blockspam), "challengeurl" in r && t(14,
|
|
1107
|
+
"auto" in r && t(0, s = r.auto), "blockspam" in r && t(27, a = r.blockspam), "challengeurl" in r && t(14, u = r.challengeurl), "challengejson" in r && t(28, h = r.challengejson), "debug" in r && t(15, H = r.debug), "delay" in r && t(16, T = r.delay), "expire" in r && t(17, F = r.expire), "floating" in r && t(1, v = r.floating), "floatinganchor" in r && t(18, O = r.floatinganchor), "floatingoffset" in r && t(19, X = r.floatingoffset), "hidefooter" in r && t(2, M = r.hidefooter), "hidelogo" in r && t(3, Q = r.hidelogo), "name" in r && t(4, Y = r.name), "maxnumber" in r && t(20, S = r.maxnumber), "mockerror" in r && t(21, L = r.mockerror), "refetchonexpire" in r && t(22, I = r.refetchonexpire), "spamfilter" in r && t(23, _ = r.spamfilter), "strings" in r && t(29, A = r.strings), "test" in r && t(24, d = r.test), "verifyurl" in r && t(25, y = r.verifyurl), "workers" in r && t(26, ie = r.workers), "workerurl" in r && t(30, we = r.workerurl);
|
|
1104
1108
|
}, n.$$.update = () => {
|
|
1105
1109
|
n.$$.dirty[0] & /*challengejson*/
|
|
1106
|
-
268435456 && (i = h ?
|
|
1107
|
-
536870912 && t(34, l = A ?
|
|
1110
|
+
268435456 && (i = h ? Ke(h) : void 0), n.$$.dirty[0] & /*strings*/
|
|
1111
|
+
536870912 && t(34, l = A ? Ke(A) : {}), n.$$.dirty[1] & /*parsedStrings*/
|
|
1108
1112
|
8 && t(11, o = {
|
|
1109
|
-
ariaLinkLabel:
|
|
1113
|
+
ariaLinkLabel: ze,
|
|
1110
1114
|
error: "Verification failed. Try again later.",
|
|
1111
1115
|
expired: "Verification expired. Try again.",
|
|
1112
|
-
footer: `Protected by <a href="${
|
|
1116
|
+
footer: `Protected by <a href="${ot}" target="_blank" aria-label="${l.ariaLinkLabel || ze}">ALTCHA</a>`,
|
|
1113
1117
|
label: "I'm not a robot",
|
|
1114
1118
|
verified: "Verified",
|
|
1115
1119
|
verifying: "Verifying...",
|
|
1116
1120
|
waitAlert: "Verifying... please wait.",
|
|
1117
1121
|
...l
|
|
1118
1122
|
}), n.$$.dirty[0] & /*payload, state*/
|
|
1119
|
-
96 &&
|
|
1120
|
-
64 &&
|
|
1123
|
+
96 && _e("statechange", { payload: z, state: N }), n.$$.dirty[0] & /*state*/
|
|
1124
|
+
64 && ut();
|
|
1121
1125
|
}, [
|
|
1122
1126
|
s,
|
|
1123
|
-
|
|
1127
|
+
v,
|
|
1124
1128
|
M,
|
|
1125
1129
|
Q,
|
|
1126
1130
|
Y,
|
|
1127
1131
|
z,
|
|
1128
|
-
|
|
1132
|
+
N,
|
|
1129
1133
|
G,
|
|
1130
|
-
|
|
1134
|
+
p,
|
|
1131
1135
|
J,
|
|
1132
|
-
|
|
1136
|
+
ye,
|
|
1133
1137
|
o,
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1138
|
+
ct,
|
|
1139
|
+
Ve,
|
|
1140
|
+
u,
|
|
1137
1141
|
H,
|
|
1138
1142
|
T,
|
|
1139
1143
|
F,
|
|
@@ -1149,14 +1153,14 @@ function zt(n, e, t) {
|
|
|
1149
1153
|
a,
|
|
1150
1154
|
h,
|
|
1151
1155
|
A,
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1156
|
+
we,
|
|
1157
|
+
He,
|
|
1158
|
+
he,
|
|
1155
1159
|
K,
|
|
1156
1160
|
l,
|
|
1157
|
-
dt,
|
|
1158
1161
|
gt,
|
|
1159
|
-
mt
|
|
1162
|
+
mt,
|
|
1163
|
+
bt
|
|
1160
1164
|
];
|
|
1161
1165
|
}
|
|
1162
1166
|
class Kt extends Pt {
|