diff --git a/dist/altcha.d.ts b/dist/altcha.d.ts index fab5709..4eea955 100644 --- a/dist/altcha.d.ts +++ b/dist/altcha.d.ts @@ -3,9 +3,60 @@ export {}; declare module 'altcha'; declare global { + type AltchaState = 'error' | 'expired' | 'verified' | 'verifying' | 'unverified'; + + interface AltchaStateChangeEvent extends CustomEvent<{ + payload?: string; + state: AltchaState; + }> {} + + interface AltchaVerifiedEvent extends CustomEvent<{ + payload: string; + }> {} + + interface AltchaServerVerificationEvent extends CustomEvent> {} + + interface AltchaWidget { + auto?: 'onfocus' | 'onload' | 'onsubmit'; + blockspam?: boolean; + challengeurl?: string; + challengejson?: string; + debug?: boolean; + delay?: number; + expire?: number; + floating?: 'auto' | 'top' | 'bottom' | 'false' | '' | boolean; + floatinganchor?: string; + floatingoffset?: number; + hidefooter?: boolean; + hidelogo?: boolean; + name?: string; + maxnumber?: number; + mockerror?: boolean; + refetchonexpire?: boolean; + spamfilter?: boolean | 'ipAddress'; + strings?: string; + test?: boolean | number; + verifyurl?: string; + workers?: number; + workerurl?: string; + } + + declare namespace svelteHTML { + interface IntrinsicElements { + 'altcha-widget': AltchaWidgetSvelte; + } + + interface AltchaWidgetSvelte extends AltchaWidget { + 'on:statechange'?: (event: AltchaStateChangeEvent) => void; + 'on:serververification'?: (event: AltchaServerVerificationEvent) => void; + 'on:verified'?: (event: AltchaVerifiedEvent) => void; + style?: string; + } + } + namespace JSX { interface IntrinsicElements { - 'altcha-widget': AltchaWidget; + 'altcha-widget': AltchaWidgetReact; } interface AltchaWidgetCSSProperties extends React.CSSProperties { @@ -20,31 +71,9 @@ declare global { '--altcha-max-width'?: string; } - interface AltchaWidget extends React.HTMLAttributes { - auto?: 'onfocus' | 'onload' | 'onsubmit'; - blockspam?: boolean; - challengeurl?: string; - challengejson?: string; - debug?: boolean; - delay?: number; - expire?: number; - floating?: 'auto' | 'top' | 'bottom' | 'false' | '' | boolean; - floatinganchor?: string; - floatingoffset?: number; - hidefooter?: boolean; - hidelogo?: boolean; - name?: string; - maxnumber?: number; - mockerror?: boolean; + interface AltchaWidgetReact extends AltchaWidget extends React.HTMLAttributes { ref?: React.RefObject; - refetchonexpire?: boolean; - spamfilter?: boolean | 'ipAddress'; - strings?: string; style?: AltchaWidgetCSSProperties; - test?: boolean | number; - verifyurl?: string; - workers?: number; - workerurl?: string; } } } \ No newline at end of file diff --git a/dist/altcha.js b/dist/altcha.js index 2e5f5f5..fb5edfd 100644 --- a/dist/altcha.js +++ b/dist/altcha.js @@ -1,16 +1,16 @@ var _t = Object.defineProperty; var kt = (r, e, t) => e in r ? _t(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t; var U = (r, e, t) => kt(r, typeof e != "symbol" ? e + "" : e, t); -const tt = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGQoZSl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KGUpXS5tYXAodD0+dC50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBwKGUsdCxvKXtyZXR1cm4gZChhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUoZSt0KSkpfWZ1bmN0aW9uIGcoZSx0LG89IlNIQS0yNTYiLGw9MWU2LGM9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyLGk9RGF0ZS5ub3coKTtyZXR1cm57cHJvbWlzZTooYXN5bmMoKT0+e2ZvcihsZXQgbj1jO248PWw7bis9MSl7aWYoYS5zaWduYWwuYWJvcnRlZClyZXR1cm4gbnVsbDtpZihhd2FpdCBwKHQsbixvKT09PWUpcmV0dXJue251bWJlcjpuLHRvb2s6RGF0ZS5ub3coKS1pfX1yZXR1cm4gbnVsbH0pKCksY29udHJvbGxlcjphfX1sZXQgcjtvbm1lc3NhZ2U9YXN5bmMgZT0+e2NvbnN0e3R5cGU6dCxwYXlsb2FkOm99PWUuZGF0YTtpZih0PT09ImFib3J0IilyPT1udWxsfHxyLmFib3J0KCkscj12b2lkIDA7ZWxzZSBpZih0PT09IndvcmsiKXtjb25zdHthbGc6bCxjaGFsbGVuZ2U6YyxtYXg6YSxzYWx0Omksc3RhcnQ6dX09b3x8e30sbj1nKGMsaSxsLGEsdSk7cj1uLmNvbnRyb2xsZXIsbi5wcm9taXNlLnRoZW4ocz0+e3NlbGYucG9zdE1lc3NhZ2UocyYmey4uLnMsd29ya2VyOiEwfSl9KX19fSkoKTsK", xt = (r) => Uint8Array.from(atob(r), (e) => e.charCodeAt(0)), Be = typeof window < "u" && window.Blob && new Blob([xt(tt)], { type: "text/javascript;charset=utf-8" }); +const tt = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGQoZSl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KGUpXS5tYXAodD0+dC50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBwKGUsdCxvKXtyZXR1cm4gZChhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUoZSt0KSkpfWZ1bmN0aW9uIGcoZSx0LG89IlNIQS0yNTYiLGw9MWU2LGM9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyLGk9RGF0ZS5ub3coKTtyZXR1cm57cHJvbWlzZTooYXN5bmMoKT0+e2ZvcihsZXQgbj1jO248PWw7bis9MSl7aWYoYS5zaWduYWwuYWJvcnRlZClyZXR1cm4gbnVsbDtpZihhd2FpdCBwKHQsbixvKT09PWUpcmV0dXJue251bWJlcjpuLHRvb2s6RGF0ZS5ub3coKS1pfX1yZXR1cm4gbnVsbH0pKCksY29udHJvbGxlcjphfX1sZXQgcjtvbm1lc3NhZ2U9YXN5bmMgZT0+e2NvbnN0e3R5cGU6dCxwYXlsb2FkOm99PWUuZGF0YTtpZih0PT09ImFib3J0IilyPT1udWxsfHxyLmFib3J0KCkscj12b2lkIDA7ZWxzZSBpZih0PT09IndvcmsiKXtjb25zdHthbGc6bCxjaGFsbGVuZ2U6YyxtYXg6YSxzYWx0Omksc3RhcnQ6dX09b3x8e30sbj1nKGMsaSxsLGEsdSk7cj1uLmNvbnRyb2xsZXIsbi5wcm9taXNlLnRoZW4ocz0+e3NlbGYucG9zdE1lc3NhZ2UocyYmey4uLnMsd29ya2VyOiEwfSl9KX19fSkoKTsK", xt = (r) => Uint8Array.from(atob(r), (e) => e.charCodeAt(0)), Be = typeof self < "u" && self.Blob && new Blob([xt(tt)], { type: "text/javascript;charset=utf-8" }); function Et(r) { let e; try { - if (e = Be && (window.URL || window.webkitURL).createObjectURL(Be), !e) throw ""; + if (e = Be && (self.URL || self.webkitURL).createObjectURL(Be), !e) throw ""; const t = new Worker(e, { name: r == null ? void 0 : r.name }); return t.addEventListener("error", () => { - (window.URL || window.webkitURL).revokeObjectURL(e); + (self.URL || self.webkitURL).revokeObjectURL(e); }), t; } catch { return new Worker( @@ -20,7 +20,7 @@ function Et(r) { } ); } finally { - e && (window.URL || window.webkitURL).revokeObjectURL(e); + e && (self.URL || self.webkitURL).revokeObjectURL(e); } } function ie() { @@ -69,7 +69,7 @@ function zt(r, e) { e ), e.sheet; } -function D(r, e, t) { +function $(r, e, t) { r.insertBefore(e, t || null); } function j(r) { @@ -166,7 +166,7 @@ function y() { try { for (; te < re.length; ) { const e = re[te]; - te++, ce(e), Dt(e.$$); + te++, ce(e), $t(e.$$); } } catch (e) { throw re.length = 0, te = 0, e; @@ -182,20 +182,20 @@ function y() { We.pop()(); Ce = !1, Ee.clear(), ce(r); } -function Dt(r) { +function $t(r) { if (r.fragment !== null) { r.update(), fe(r.before_update); const e = r.dirty; r.dirty = [-1], r.fragment && r.fragment.p(r.ctx, e), r.after_update.forEach(Le); } } -function Ft(r) { +function Dt(r) { const e = [], t = []; ne.forEach((i) => r.indexOf(i) === -1 ? e.push(i) : t.push(i)), t.forEach((i) => i()), ne = e; } -const $t = /* @__PURE__ */ new Set(); +const Ft = /* @__PURE__ */ new Set(); function Ut(r, e) { - r && r.i && ($t.delete(r), r.i(e)); + r && r.i && (Ft.delete(r), r.i(e)); } function Gt(r, e, t) { const { fragment: i, after_update: o } = r.$$; @@ -206,7 +206,7 @@ function Gt(r, e, t) { } function Xt(r, e) { const t = r.$$; - t.fragment !== null && (Ft(t.after_update), fe(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []); + t.fragment !== null && (Dt(t.after_update), fe(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []); } function Bt(r, e) { r.$$.dirty[0] === -1 && (re.push(r), ot(), r.$$.dirty.fill(0)), r.$$.dirty[e / 31 | 0] |= 1 << e % 31; @@ -236,11 +236,11 @@ function Ht(r, e, t, i, o, l, c = null, a = [-1]) { root: e.target || d.$$.root }; c && c(f.root); - let $ = !1; - if (f.ctx = t ? t(r, e.props || {}, (N, G, ...F) => { - const k = F.length ? F[0] : G; - return f.ctx && o(f.ctx[N], f.ctx[N] = k) && (!f.skip_bound && f.bound[N] && f.bound[N](k), $ && Bt(r, N)), G; - }) : [], f.update(), $ = !0, fe(f.before_update), f.fragment = i ? i(f.ctx) : !1, e.target) { + let F = !1; + if (f.ctx = t ? t(r, e.props || {}, (N, G, ...D) => { + const k = D.length ? D[0] : G; + return f.ctx && o(f.ctx[N], f.ctx[N] = k) && (!f.skip_bound && f.bound[N] && f.bound[N](k), F && Bt(r, N)), G; + }) : [], f.update(), F = !0, fe(f.before_update), f.fragment = i ? i(f.ctx) : !1, e.target) { if (e.hydrate) { const N = St(e.target); f.fragment && f.fragment.l(N), N.forEach(j); @@ -300,8 +300,8 @@ typeof HTMLElement == "function" && (lt = class extends HTMLElement { * @param {HTMLElement} target * @param {HTMLElement} [anchor] */ - m: function(f, $) { - D(f, c, $); + m: function(f, F) { + $(f, c, F); }, d: function(f) { f && j(c); @@ -361,7 +361,7 @@ typeof HTMLElement == "function" && (lt = class extends HTMLElement { } disconnectedCallback() { this.$$cn = !1, Promise.resolve().then(() => { - this.$$cn || (this.$$c.$destroy(), this.$$c = void 0); + !this.$$cn && this.$$c && (this.$$c.$destroy(), this.$$c = void 0); }); } $$g_p(e) { @@ -428,7 +428,7 @@ function Ot(r, e, t, i, o, l) { return (d = this.$$c) == null ? void 0 : d[a]; } }); - }), l && (c = l(c)), r.element = /** @type {any} */ + }), r.element = /** @type {any} */ c, c; } class Wt { @@ -531,7 +531,7 @@ function Pe(r) { e = O("svg"), t = O("path"), i = O("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 svelte-ddsc3z"), s(e, "width", "24"), s(e, "height", "24"), s(e, "viewBox", "0 0 24 24"), s(e, "xmlns", "http://www.w3.org/2000/svg"); }, m(o, l) { - D(o, e, l), _(e, t), _(e, i); + $(o, e, l), _(e, t), _(e, i); }, d(o) { o && j(e); @@ -549,7 +549,7 @@ function er(r) { r[4] + "_checkbox"), s(e, "class", "svelte-ddsc3z"); }, m(o, l) { - D(o, e, l), e.innerHTML = t; + $(o, e, l), e.innerHTML = t; }, p(o, l) { l[0] & /*_strings*/ @@ -573,7 +573,7 @@ function tr(r) { e = A("span"); }, m(i, o) { - D(i, e, o), e.innerHTML = t; + $(i, e, o), e.innerHTML = t; }, p(i, o) { o[0] & /*_strings*/ @@ -601,7 +601,7 @@ function rr(r) { r[5]; }, m(l, c) { - D(l, e, c), e.innerHTML = t, D(l, i, c), D(l, o, c); + $(l, e, c), e.innerHTML = t, $(l, i, c), $(l, o, c); }, p(l, c) { c[0] & /*_strings*/ @@ -629,7 +629,7 @@ function Ye(r) { r[11].ariaLinkLabel); }, m(d, f) { - D(d, e, f), _(e, t), _(t, i), _(i, o), _(i, l), _(i, c); + $(d, e, f), _(e, t), _(t, i), _(i, o), _(i, l), _(i, c); }, p(d, f) { f[0] & /*_strings*/ @@ -655,7 +655,7 @@ function Ke(r) { e = A("div"), t = O("svg"), i = O("path"), o = Y(), a.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 svelte-ddsc3z"); }, m(d, f) { - D(d, e, f), _(e, t), _(t, i), _(e, o), a.m(e, null); + $(d, e, f), _(e, t), _(t, i), _(e, o), a.m(e, null); }, p(d, f) { c === (c = l(d)) && a ? a.p(d, f) : (a.d(1), a = c(d), a && (a.c(), a.m(e, null))); @@ -680,7 +680,7 @@ function nr(r) { ); }, m(i, o) { - D(i, e, o), e.innerHTML = t; + $(i, e, o), e.innerHTML = t; }, p(i, o) { o[0] & /*_strings*/ @@ -713,7 +713,7 @@ function ir(r) { ); }, m(i, o) { - D(i, e, o), e.innerHTML = t; + $(i, e, o), e.innerHTML = t; }, p(i, o) { o[0] & /*_strings*/ @@ -741,7 +741,7 @@ function Je(r) { e = A("div"), t = A("div"), s(t, "class", "svelte-ddsc3z"), s(e, "class", "altcha-footer svelte-ddsc3z"); }, m(o, l) { - D(o, e, l), _(e, t), t.innerHTML = i; + $(o, e, l), _(e, t), t.innerHTML = i; }, p(o, l) { l[0] & /*_strings*/ @@ -760,7 +760,7 @@ function qe(r) { e = A("div"), s(e, "class", "altcha-anchor-arrow svelte-ddsc3z"); }, m(t, i) { - D(t, e, i), r[37](e); + $(t, e, i), r[37](e); }, p: ie, d(t) { @@ -769,7 +769,7 @@ function qe(r) { }; } function or(r) { - let e, t, i, o, l, c, a, d, f, $, N, G, F, k, W, S = ( + let e, t, i, o, l, c, a, d, f, F, N, G, D, k, W, S = ( /*state*/ r[6] === b.VERIFYING && Pe() ); @@ -801,7 +801,7 @@ function or(r) { ); return { c() { - e = A("div"), t = A("div"), S && S.c(), i = Y(), o = A("div"), l = A("input"), d = Y(), f = A("div"), M.c(), $ = Y(), E && E.c(), N = Y(), R && R.c(), G = Y(), I && I.c(), F = Y(), w && w.c(), s(l, "type", "checkbox"), s(l, "id", c = /*name*/ + e = A("div"), t = A("div"), S && S.c(), i = Y(), o = A("div"), l = A("input"), d = Y(), f = A("div"), M.c(), F = Y(), E && E.c(), N = Y(), R && R.c(), G = Y(), I && I.c(), D = Y(), w && w.c(), s(l, "type", "checkbox"), s(l, "id", c = /*name*/ r[4] + "_checkbox"), l.required = a = /*auto*/ r[0] !== "onsubmit", s(l, "class", "svelte-ddsc3z"), s(o, "class", "altcha-checkbox svelte-ddsc3z"), Oe( o, @@ -821,8 +821,8 @@ function or(r) { ); }, m(h, v) { - D(h, e, v), _(e, t), S && S.m(t, null), _(t, i), _(t, o), _(o, l), l.checked = /*checked*/ - r[7], _(t, d), _(t, f), M.m(f, null), _(t, $), E && E.m(t, null), _(e, N), R && R.m(e, null), _(e, G), I && I.m(e, null), _(e, F), w && w.m(e, null), r[38](e), k || (W = [ + $(h, e, v), _(e, t), S && S.m(t, null), _(t, i), _(t, o), _(o, l), l.checked = /*checked*/ + r[7], _(t, d), _(t, f), M.m(f, null), _(t, F), E && E.m(t, null), _(e, N), R && R.m(e, null), _(e, G), I && I.m(e, null), _(e, D), w && w.m(e, null), r[38](e), k || (W = [ xe( l, "change", @@ -864,7 +864,7 @@ function or(r) { h[6] === b.EXPIRED ? R ? R.p(h, v) : (R = Ke(h), R.c(), R.m(e, G)) : R && (R.d(1), R = null), /*_strings*/ h[11].footer && /*hidefooter*/ (h[2] !== !0 || /*isFreeSaaS*/ - h[12]) ? I ? I.p(h, v) : (I = Je(h), I.c(), I.m(e, F)) : I && (I.d(1), I = null), /*floating*/ + h[12]) ? I ? I.p(h, v) : (I = Je(h), I.c(), I.m(e, D)) : I && (I.d(1), I = null), /*floating*/ h[1] ? w ? w.p(h, v) : (w = qe(h), w.c(), w.m(e, null)) : w && (w.d(1), w = null), v[0] & /*state*/ 64 && s( e, @@ -898,13 +898,13 @@ function lr() { } function sr(r, e, t) { var Ge, Xe; - let i, o, l, c, { auto: a = void 0 } = e, { blockspam: d = void 0 } = e, { challengeurl: f = void 0 } = e, { challengejson: $ = void 0 } = e, { debug: N = !1 } = e, { delay: G = 0 } = e, { expire: F = void 0 } = e, { floating: k = void 0 } = e, { floatinganchor: W = void 0 } = e, { floatingoffset: S = void 0 } = e, { hidefooter: K = !1 } = e, { hidelogo: H = !1 } = e, { name: M = "altcha" } = e, { maxnumber: E = 1e6 } = e, { mockerror: R = !1 } = e, { refetchonexpire: I = !0 } = e, { spamfilter: w = !1 } = e, { strings: h = void 0 } = e, { test: v = !1 } = e, { verifyurl: J = void 0 } = e, { workers: oe = Math.min(16, navigator.hardwareConcurrency || 8) } = e, { workerurl: ue = void 0 } = e; + let i, o, l, c, { auto: a = void 0 } = e, { blockspam: d = void 0 } = e, { challengeurl: f = void 0 } = e, { challengejson: F = void 0 } = e, { debug: N = !1 } = e, { delay: G = 0 } = e, { expire: D = void 0 } = e, { floating: k = void 0 } = e, { floatinganchor: W = void 0 } = e, { floatingoffset: S = void 0 } = e, { hidefooter: K = !1 } = e, { hidelogo: H = !1 } = e, { name: M = "altcha" } = e, { maxnumber: E = 1e6 } = e, { mockerror: R = !1 } = e, { refetchonexpire: I = !0 } = e, { spamfilter: w = !1 } = e, { strings: h = void 0 } = e, { test: v = !1 } = e, { verifyurl: J = void 0 } = e, { workers: oe = Math.min(16, navigator.hardwareConcurrency || 8) } = e, { workerurl: ue = void 0 } = e; const ye = Tt(), Ie = ["SHA-256", "SHA-384", "SHA-512"], ze = (Xe = (Ge = document.documentElement.lang) == null ? void 0 : Ge.split("-")) == null ? void 0 : Xe[0]; let P = !1, C, q = null, de = null, m = null, pe = null, Q = null, T = b.UNVERIFIED, X = null; Mt(() => { - m && (m.removeEventListener("submit", Se), m.removeEventListener("reset", Ne), m.removeEventListener("focusin", Ae), m = null), X && (clearTimeout(X), X = null), document.removeEventListener("click", Te), document.removeEventListener("scroll", Ve), window.removeEventListener("resize", Fe); + m && (m.removeEventListener("submit", Se), m.removeEventListener("reset", Ne), m.removeEventListener("focusin", Ae), m = null), X && (clearTimeout(X), X = null), document.removeEventListener("click", Te), document.removeEventListener("scroll", Ve), window.removeEventListener("resize", De); }), jt(() => { - x("mounted", "0.6.6"), x("workers", oe), v && x("using test mode"), F && he(F), a !== void 0 && x("auto", a), k !== void 0 && $e(k), m = C.closest("form"), m && (m.addEventListener("submit", Se, { capture: !0 }), m.addEventListener("reset", Ne), a === "onfocus" && m.addEventListener("focusin", Ae)), a === "onload" && ee(), i && (K || H) && x("Attributes hidefooter and hidelogo ignored because usage with free API Keys require attribution."); + x("mounted", "0.6.7"), x("workers", oe), v && x("using test mode"), D && he(D), a !== void 0 && x("auto", a), k !== void 0 && Fe(k), m = C.closest("form"), m && (m.addEventListener("submit", Se, { capture: !0 }), m.addEventListener("reset", Ne), a === "onfocus" && m.addEventListener("focusin", Ae)), a === "onload" && ee(), i && (K || H) && x("Attributes hidefooter and hidelogo ignored because usage with free API Keys require attribution."); }); function x(...n) { (N || n.some((u) => u instanceof Error)) && console[n[0] instanceof Error ? "error" : "log"]("ALTCHA", ...n); @@ -915,7 +915,7 @@ function sr(r, e, t) { function Se(n) { m && a === "onsubmit" && (T === b.UNVERIFIED ? (n.preventDefault(), n.stopPropagation(), ee().then(() => { m == null || m.requestSubmit(); - })) : T !== b.VERIFIED && (n.preventDefault(), n.stopPropagation(), T === b.VERIFYING && De())); + })) : T !== b.VERIFIED && (n.preventDefault(), n.stopPropagation(), T === b.VERIFYING && $e())); } function Ne() { ge(); @@ -974,7 +974,7 @@ function sr(r, e, t) { } catch (p) { x("unable to configure from X-Altcha-Config", p); } - if (!F && (g != null && g.length)) { + if (!D && (g != null && g.length)) { const p = Date.parse(g); if (p) { const L = p - Date.now(); @@ -1042,7 +1042,7 @@ function sr(r, e, t) { function Ve() { k && _e(); } - function De() { + function $e() { T === b.VERIFYING && c.waitAlert && alert(c.waitAlert); } function ht(n) { @@ -1050,14 +1050,14 @@ function sr(r, e, t) { _e(); }); } - function Fe() { + function De() { k && _e(); } function he(n) { x("expire", n), X && (clearTimeout(X), X = null), n < 1 ? Me() : X = setTimeout(Me, n); } - function $e(n) { - x("floating", n), k !== n && (t(8, C.style.left = "", C), t(8, C.style.top = "", C)), t(1, k = n === !0 || n === "" ? "auto" : n === !1 || n === "false" ? void 0 : k), k ? (a || t(0, a = "onsubmit"), document.addEventListener("scroll", Ve), document.addEventListener("click", Te), window.addEventListener("resize", Fe)) : a === "onsubmit" && t(0, a = void 0); + function Fe(n) { + x("floating", n), k !== n && (t(8, C.style.left = "", C), t(8, C.style.top = "", C)), t(1, k = n === !0 || n === "" ? "auto" : n === !1 || n === "false" ? void 0 : k), k ? (a || t(0, a = "onsubmit"), document.addEventListener("scroll", Ve), document.addEventListener("click", Te), window.addEventListener("resize", De)) : a === "onsubmit" && t(0, a = void 0); } function gt(n) { var g; @@ -1133,7 +1133,7 @@ function sr(r, e, t) { x("unable to find floating anchor element"); } function Ue(n) { - n.auto !== void 0 && (t(0, a = n.auto), a === "onload" && ee()), n.floatinganchor !== void 0 && t(19, W = n.floatinganchor), n.delay !== void 0 && t(17, G = n.delay), n.floatingoffset !== void 0 && t(20, S = n.floatingoffset), n.floating !== void 0 && $e(n.floating), n.expire !== void 0 && (he(n.expire), t(18, F = n.expire)), n.challenge && (je(n.challenge), o = n.challenge), n.challengeurl !== void 0 && t(15, f = n.challengeurl), n.debug !== void 0 && t(16, N = !!n.debug), n.hidefooter !== void 0 && t(2, K = !!n.hidefooter), n.hidelogo !== void 0 && t(3, H = !!n.hidelogo), n.maxnumber !== void 0 && t(21, E = +n.maxnumber), n.mockerror !== void 0 && t(22, R = !!n.mockerror), n.name !== void 0 && t(4, M = n.name), n.refetchonexpire !== void 0 && t(23, I = !!n.refetchonexpire), n.spamfilter !== void 0 && t(24, w = typeof n.spamfilter == "object" ? n.spamfilter : !!n.spamfilter), n.strings && t(35, l = n.strings), n.test !== void 0 && t(25, v = typeof n.test == "number" ? n.test : !!n.test), n.verifyurl !== void 0 && t(26, J = n.verifyurl), n.workers !== void 0 && t(27, oe = +n.workers), n.workerurl !== void 0 && t(28, ue = n.workerurl); + n.auto !== void 0 && (t(0, a = n.auto), a === "onload" && ee()), n.floatinganchor !== void 0 && t(19, W = n.floatinganchor), n.delay !== void 0 && t(17, G = n.delay), n.floatingoffset !== void 0 && t(20, S = n.floatingoffset), n.floating !== void 0 && Fe(n.floating), n.expire !== void 0 && (he(n.expire), t(18, D = n.expire)), n.challenge && (je(n.challenge), o = n.challenge), n.challengeurl !== void 0 && t(15, f = n.challengeurl), n.debug !== void 0 && t(16, N = !!n.debug), n.hidefooter !== void 0 && t(2, K = !!n.hidefooter), n.hidelogo !== void 0 && t(3, H = !!n.hidelogo), n.maxnumber !== void 0 && t(21, E = +n.maxnumber), n.mockerror !== void 0 && t(22, R = !!n.mockerror), n.name !== void 0 && t(4, M = n.name), n.refetchonexpire !== void 0 && t(23, I = !!n.refetchonexpire), n.spamfilter !== void 0 && t(24, w = typeof n.spamfilter == "object" ? n.spamfilter : !!n.spamfilter), n.strings && t(35, l = n.strings), n.test !== void 0 && t(25, v = typeof n.test == "number" ? n.test : !!n.test), n.verifyurl !== void 0 && t(26, J = n.verifyurl), n.workers !== void 0 && t(27, oe = +n.workers), n.workerurl !== void 0 && t(28, ue = n.workerurl); } function ge(n = b.UNVERIFIED, u = null) { X && (clearTimeout(X), X = null), t(7, P = !1), t(10, pe = u), t(5, Q = null), t(6, T = n); @@ -1168,11 +1168,11 @@ function sr(r, e, t) { }); } return r.$$set = (n) => { - "auto" in n && t(0, a = n.auto), "blockspam" in n && t(29, d = n.blockspam), "challengeurl" in n && t(15, f = n.challengeurl), "challengejson" in n && t(30, $ = n.challengejson), "debug" in n && t(16, N = n.debug), "delay" in n && t(17, G = n.delay), "expire" in n && t(18, F = n.expire), "floating" in n && t(1, k = n.floating), "floatinganchor" in n && t(19, W = n.floatinganchor), "floatingoffset" in n && t(20, S = n.floatingoffset), "hidefooter" in n && t(2, K = n.hidefooter), "hidelogo" in n && t(3, H = n.hidelogo), "name" in n && t(4, M = n.name), "maxnumber" in n && t(21, E = n.maxnumber), "mockerror" in n && t(22, R = n.mockerror), "refetchonexpire" in n && t(23, I = n.refetchonexpire), "spamfilter" in n && t(24, w = n.spamfilter), "strings" in n && t(31, h = n.strings), "test" in n && t(25, v = n.test), "verifyurl" in n && t(26, J = n.verifyurl), "workers" in n && t(27, oe = n.workers), "workerurl" in n && t(28, ue = n.workerurl); + "auto" in n && t(0, a = n.auto), "blockspam" in n && t(29, d = n.blockspam), "challengeurl" in n && t(15, f = n.challengeurl), "challengejson" in n && t(30, F = n.challengejson), "debug" in n && t(16, N = n.debug), "delay" in n && t(17, G = n.delay), "expire" in n && t(18, D = n.expire), "floating" in n && t(1, k = n.floating), "floatinganchor" in n && t(19, W = n.floatinganchor), "floatingoffset" in n && t(20, S = n.floatingoffset), "hidefooter" in n && t(2, K = n.hidefooter), "hidelogo" in n && t(3, H = n.hidelogo), "name" in n && t(4, M = n.name), "maxnumber" in n && t(21, E = n.maxnumber), "mockerror" in n && t(22, R = n.mockerror), "refetchonexpire" in n && t(23, I = n.refetchonexpire), "spamfilter" in n && t(24, w = n.spamfilter), "strings" in n && t(31, h = n.strings), "test" in n && t(25, v = n.test), "verifyurl" in n && t(26, J = n.verifyurl), "workers" in n && t(27, oe = n.workers), "workerurl" in n && t(28, ue = n.workerurl); }, r.$$.update = () => { r.$$.dirty[0] & /*challengeurl*/ 32768 && t(12, i = !!(f != null && f.includes(".altcha.org")) && !!(f != null && f.includes("apiKey=ckey_"))), r.$$.dirty[0] & /*challengejson*/ - 1073741824 && (o = $ ? et($) : void 0), r.$$.dirty[1] & /*strings*/ + 1073741824 && (o = F ? et(F) : void 0), r.$$.dirty[1] & /*strings*/ 1 && t(35, l = h ? et(h) : {}), r.$$.dirty[1] & /*parsedStrings*/ 16 && t(11, c = { ariaLinkLabel: Qe, @@ -1202,11 +1202,11 @@ function sr(r, e, t) { c, i, dt, - De, + $e, f, N, G, - F, + D, W, S, E, @@ -1218,7 +1218,7 @@ function sr(r, e, t) { oe, ue, d, - $, + F, h, Ue, ge, diff --git a/dist/altcha.umd.cjs b/dist/altcha.umd.cjs index 3ee5f19..7fdbac5 100644 --- a/dist/altcha.umd.cjs +++ b/dist/altcha.umd.cjs @@ -1,2 +1,2 @@ -(function(U,Z){typeof exports=="object"&&typeof module<"u"?Z(exports):typeof define=="function"&&define.amd?define(["exports"],Z):(U=typeof globalThis<"u"?globalThis:U||self,Z(U.altcha={}))})(this,function(U){"use strict";var cr=Object.defineProperty;var ar=(U,Z,ne)=>Z in U?cr(U,Z,{enumerable:!0,configurable:!0,writable:!0,value:ne}):U[Z]=ne;var O=(U,Z,ne)=>ar(U,typeof Z!="symbol"?Z+"":Z,ne);const Z="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGQoZSl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KGUpXS5tYXAodD0+dC50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBwKGUsdCxvKXtyZXR1cm4gZChhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUoZSt0KSkpfWZ1bmN0aW9uIGcoZSx0LG89IlNIQS0yNTYiLGw9MWU2LGM9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyLGk9RGF0ZS5ub3coKTtyZXR1cm57cHJvbWlzZTooYXN5bmMoKT0+e2ZvcihsZXQgbj1jO248PWw7bis9MSl7aWYoYS5zaWduYWwuYWJvcnRlZClyZXR1cm4gbnVsbDtpZihhd2FpdCBwKHQsbixvKT09PWUpcmV0dXJue251bWJlcjpuLHRvb2s6RGF0ZS5ub3coKS1pfX1yZXR1cm4gbnVsbH0pKCksY29udHJvbGxlcjphfX1sZXQgcjtvbm1lc3NhZ2U9YXN5bmMgZT0+e2NvbnN0e3R5cGU6dCxwYXlsb2FkOm99PWUuZGF0YTtpZih0PT09ImFib3J0IilyPT1udWxsfHxyLmFib3J0KCkscj12b2lkIDA7ZWxzZSBpZih0PT09IndvcmsiKXtjb25zdHthbGc6bCxjaGFsbGVuZ2U6YyxtYXg6YSxzYWx0Omksc3RhcnQ6dX09b3x8e30sbj1nKGMsaSxsLGEsdSk7cj1uLmNvbnRyb2xsZXIsbi5wcm9taXNlLnRoZW4ocz0+e3NlbGYucG9zdE1lc3NhZ2UocyYmey4uLnMsd29ya2VyOiEwfSl9KX19fSkoKTsK",ne=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0)),Se=typeof window<"u"&&window.Blob&&new Blob([ne(Z)],{type:"text/javascript;charset=utf-8"});function dt(r){let e;try{if(e=Se&&(window.URL||window.webkitURL).createObjectURL(Se),!e)throw"";const t=new Worker(e,{name:r==null?void 0:r.name});return t.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+Z,{name:r==null?void 0:r.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}function ie(){}function Ne(r){return r()}function je(){return Object.create(null)}function ce(r){r.forEach(Ne)}function Te(r){return typeof r=="function"}function ht(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function gt(r){return Object.keys(r).length===0}function p(r,e){r.appendChild(e)}function mt(r,e,t){const i=bt(r);if(!i.getElementById(e)){const o=R("style");o.id=e,o.textContent=t,vt(i,o)}}function bt(r){if(!r)return document;const e=r.getRootNode?r.getRootNode():r.ownerDocument;return e&&e.host?e:r.ownerDocument}function vt(r,e){return p(r.head||r,e),e.sheet}function M(r,e,t){r.insertBefore(e,t||null)}function T(r){r.parentNode&&r.parentNode.removeChild(r)}function R(r){return document.createElement(r)}function P(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function wt(r){return document.createTextNode(r)}function Y(){return wt(" ")}function ke(r,e,t,i){return r.addEventListener(e,t,i),()=>r.removeEventListener(e,t,i)}function s(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function yt(r){return Array.from(r.childNodes)}function Ze(r,e,t){r.classList.toggle(e,!!t)}function pt(r,e,{bubbles:t=!1,cancelable:i=!1}={}){return new CustomEvent(r,{detail:e,bubbles:t,cancelable:i})}function _t(r){const e={};return r.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let ae;function fe(r){ae=r}function xe(){if(!ae)throw new Error("Function called outside component initialization");return ae}function kt(r){xe().$$.on_mount.push(r)}function xt(r){xe().$$.on_destroy.push(r)}function Et(){const r=xe();return(e,t,{cancelable:i=!1}={})=>{const o=r.$$.callbacks[e];if(o){const l=pt(e,t,{cancelable:i});return o.slice().forEach(c=>{c.call(r,l)}),!l.defaultPrevented}return!0}}const oe=[],ge=[];let le=[];const Me=[],Ve=Promise.resolve();let Ee=!1;function De(){Ee||(Ee=!0,Ve.then(w))}function Ct(){return De(),Ve}function Ce(r){le.push(r)}const Le=new Set;let se=0;function w(){if(se!==0)return;const r=ae;do{try{for(;ser.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),le=e}const It=new Set;function zt(r,e){r&&r.i&&(It.delete(r),r.i(e))}function At(r,e,t){const{fragment:i,after_update:o}=r.$$;i&&i.m(e,t),Ce(()=>{const l=r.$$.on_mount.map(Ne).filter(Te);r.$$.on_destroy?r.$$.on_destroy.push(...l):ce(l),r.$$.on_mount=[]}),o.forEach(Ce)}function St(r,e){const t=r.$$;t.fragment!==null&&(Rt(t.after_update),ce(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Nt(r,e){r.$$.dirty[0]===-1&&(oe.push(r),De(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<{const k=$.length?$[0]:X;return f.ctx&&o(f.ctx[N],f.ctx[N]=k)&&(!f.skip_bound&&f.bound[N]&&f.bound[N](k),G&&Nt(r,N)),X}):[],f.update(),G=!0,ce(f.before_update),f.fragment=i?i(f.ctx):!1,e.target){if(e.hydrate){const N=yt(e.target);f.fragment&&f.fragment.l(N),N.forEach(T)}else f.fragment&&f.fragment.c();e.intro&&zt(r.$$.fragment),At(r,e.target,e.anchor),w()}fe(d)}let Fe;typeof HTMLElement=="function"&&(Fe=class extends HTMLElement{constructor(e,t,i){super();O(this,"$$ctor");O(this,"$$s");O(this,"$$c");O(this,"$$cn",!1);O(this,"$$d",{});O(this,"$$r",!1);O(this,"$$p_d",{});O(this,"$$l",{});O(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,i&&this.attachShadow({mode:"open"})}addEventListener(e,t,i){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const o=this.$$c.$on(e,t);this.$$l_u.set(t,o)}super.addEventListener(e,t,i)}removeEventListener(e,t,i){if(super.removeEventListener(e,t,i),this.$$c){const o=this.$$l_u.get(t);o&&(o(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(l){return()=>{let c;return{c:function(){c=R("slot"),l!=="default"&&s(c,"name",l)},m:function(f,G){M(f,c,G)},d:function(f){f&&T(c)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},i=_t(this);for(const l of this.$$s)l in i&&(t[l]=[e(l)]);for(const l of this.attributes){const c=this.$$g_p(l.name);c in this.$$d||(this.$$d[c]=me(c,l.value,this.$$p_d,"toProp"))}for(const l in this.$$p_d)!(l in this.$$d)&&this[l]!==void 0&&(this.$$d[l]=this[l],delete this[l]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$scope:{ctx:[]}}});const o=()=>{this.$$r=!0;for(const l in this.$$p_d)if(this.$$d[l]=this.$$c.$$.ctx[this.$$c.$$.props[l]],this.$$p_d[l].reflect){const c=me(l,this.$$d[l],this.$$p_d,"toAttribute");c==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,c)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const l in this.$$l)for(const c of this.$$l[l]){const a=this.$$c.$on(l,c);this.$$l_u.set(c,a)}this.$$l={}}}attributeChangedCallback(e,t,i){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=me(e,i,this.$$p_d,"toProp"),(o=this.$$c)==null||o.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function me(r,e,t,i){var l;const o=(l=t[r])==null?void 0:l.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!i||!t[r])return e;if(i==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function Tt(r,e,t,i,o,l){let c=class extends Fe{constructor(){super(r,t,o),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(a=>(e[a].attribute||a).toLowerCase())}};return Object.keys(e).forEach(a=>{Object.defineProperty(c.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(d){var f;d=me(a,d,e),this.$$d[a]=d,(f=this.$$c)==null||f.$set({[a]:d})}})}),i.forEach(a=>{Object.defineProperty(c.prototype,a,{get(){var d;return(d=this.$$c)==null?void 0:d[a]}})}),l&&(c=l(c)),r.element=c,c}class Zt{constructor(){O(this,"$$");O(this,"$$set")}$destroy(){St(this,1),this.$destroy=ie}$on(e,t){if(!Te(t))return ie;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}$set(e){this.$$set&&!gt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Mt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Mt);const Vt=new TextEncoder;function Dt(r){return[...new Uint8Array(r)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function Ft(r,e="SHA-256",t=1e5){const i=Date.now().toString(16);r||(r=Math.round(Math.random()*t));const o=await $e(i,r,e);return{algorithm:e,challenge:o,salt:i,signature:""}}async function $e(r,e,t){return Dt(await crypto.subtle.digest(t.toUpperCase(),Vt.encode(r+e)))}function $t(r,e,t="SHA-256",i=1e6,o=0){const l=new AbortController,c=Date.now();return{promise:(async()=>{for(let d=o;d<=i;d+=1){if(l.signal.aborted)return null;if(await $e(e,d,t)===r)return{number:d,took:Date.now()-c}}return null})(),controller:l}}var m=(r=>(r.ERROR="error",r.VERIFIED="verified",r.VERIFYING="verifying",r.UNVERIFIED="unverified",r.EXPIRED="expired",r))(m||{});function Ut(r){mt(r,"svelte-ddsc3z",'.altcha.svelte-ddsc3z.svelte-ddsc3z{background:var(--altcha-color-base, transparent);border:var(--altcha-border-width, 1px) solid var(--altcha-color-border, #a0a0a0);border-radius:var(--altcha-border-radius, 3px);color:var(--altcha-color-text, currentColor);display:flex;flex-direction:column;max-width:var(--altcha-max-width, 260px);position:relative;text-align:left}.altcha.svelte-ddsc3z.svelte-ddsc3z:focus-within{border-color:var(--altcha-color-border-focus, currentColor)}.altcha[data-floating].svelte-ddsc3z.svelte-ddsc3z{background:var(--altcha-color-base, white);display:none;filter:drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.2));left:-100%;position:fixed;top:-100%;width:var(--altcha-max-width, 260px);z-index:999999}.altcha[data-floating=top].svelte-ddsc3z .altcha-anchor-arrow.svelte-ddsc3z{border-bottom-color:transparent;border-top-color:var(--altcha-color-border, #a0a0a0);bottom:-12px;top:auto}.altcha[data-floating=bottom].svelte-ddsc3z.svelte-ddsc3z:focus-within::after{border-bottom-color:var(--altcha-color-border-focus, currentColor)}.altcha[data-floating=top].svelte-ddsc3z.svelte-ddsc3z:focus-within::after{border-top-color:var(--altcha-color-border-focus, currentColor)}.altcha[data-floating].svelte-ddsc3z.svelte-ddsc3z:not([data-state=unverified]){display:block}.altcha-anchor-arrow.svelte-ddsc3z.svelte-ddsc3z{border:6px solid transparent;border-bottom-color:var(--altcha-color-border, #a0a0a0);content:"";height:0;left:12px;position:absolute;top:-12px;width:0}.altcha-main.svelte-ddsc3z.svelte-ddsc3z{align-items:center;display:flex;gap:0.4rem;padding:0.7rem}.altcha-label.svelte-ddsc3z.svelte-ddsc3z{flex-grow:1}.altcha-label.svelte-ddsc3z label.svelte-ddsc3z{cursor:pointer}.altcha-logo.svelte-ddsc3z.svelte-ddsc3z{color:currentColor;opacity:0.3}.altcha-logo.svelte-ddsc3z.svelte-ddsc3z:hover{opacity:1}.altcha-error.svelte-ddsc3z.svelte-ddsc3z{color:var(--altcha-color-error-text, #f23939);display:flex;font-size:0.85rem;gap:0.3rem;padding:0 0.7rem 0.7rem}.altcha-footer.svelte-ddsc3z.svelte-ddsc3z{align-items:center;background-color:var(--altcha-color-footer-bg, transparent);display:flex;font-size:0.75rem;opacity:0.4;padding:0.2rem 0.7rem;text-align:right}.altcha-footer.svelte-ddsc3z.svelte-ddsc3z:hover{opacity:1}.altcha-footer.svelte-ddsc3z>.svelte-ddsc3z:first-child{flex-grow:1}.altcha-footer.svelte-ddsc3z a{color:currentColor}.altcha-checkbox.svelte-ddsc3z.svelte-ddsc3z{display:flex;align-items:center;height:24px;width:24px}.altcha-checkbox.svelte-ddsc3z input.svelte-ddsc3z{width:18px;height:18px;margin:0}.altcha-hidden.svelte-ddsc3z.svelte-ddsc3z{display:none}.altcha-spinner.svelte-ddsc3z.svelte-ddsc3z{animation:svelte-ddsc3z-altcha-spinner 0.75s infinite linear;transform-origin:center}@keyframes svelte-ddsc3z-altcha-spinner{100%{transform:rotate(360deg)}}')}function Ue(r){let e,t,i;return{c(){e=P("svg"),t=P("path"),i=P("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 svelte-ddsc3z"),s(e,"width","24"),s(e,"height","24"),s(e,"viewBox","0 0 24 24"),s(e,"xmlns","http://www.w3.org/2000/svg")},m(o,l){M(o,e,l),p(e,t),p(e,i)},d(o){o&&T(e)}}}function Gt(r){let e,t=r[11].label+"",i;return{c(){e=R("label"),s(e,"for",i=r[4]+"_checkbox"),s(e,"class","svelte-ddsc3z")},m(o,l){M(o,e,l),e.innerHTML=t},p(o,l){l[0]&2048&&t!==(t=o[11].label+"")&&(e.innerHTML=t),l[0]&16&&i!==(i=o[4]+"_checkbox")&&s(e,"for",i)},d(o){o&&T(e)}}}function Ot(r){let e,t=r[11].verifying+"";return{c(){e=R("span")},m(i,o){M(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].verifying+"")&&(e.innerHTML=t)},d(i){i&&T(e)}}}function Xt(r){let e,t=r[11].verified+"",i,o;return{c(){e=R("span"),i=Y(),o=R("input"),s(o,"type","hidden"),s(o,"name",r[4]),o.value=r[5]},m(l,c){M(l,e,c),e.innerHTML=t,M(l,i,c),M(l,o,c)},p(l,c){c[0]&2048&&t!==(t=l[11].verified+"")&&(e.innerHTML=t),c[0]&16&&s(o,"name",l[4]),c[0]&32&&(o.value=l[5])},d(l){l&&(T(e),T(i),T(o))}}}function Ge(r){let e,t,i,o,l,c,a;return{c(){e=R("div"),t=R("a"),i=P("svg"),o=P("path"),l=P("path"),c=P("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(c,"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(c,"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",Pe),s(t,"target","_blank"),s(t,"class","altcha-logo svelte-ddsc3z"),s(t,"aria-label",a=r[11].ariaLinkLabel)},m(d,f){M(d,e,f),p(e,t),p(t,i),p(i,o),p(i,l),p(i,c)},p(d,f){f[0]&2048&&a!==(a=d[11].ariaLinkLabel)&&s(t,"aria-label",a)},d(d){d&&T(e)}}}function Oe(r){let e,t,i,o;function l(d,f){return d[6]===m.EXPIRED?Ht:Bt}let c=l(r),a=c(r);return{c(){e=R("div"),t=P("svg"),i=P("path"),o=Y(),a.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 svelte-ddsc3z")},m(d,f){M(d,e,f),p(e,t),p(t,i),p(e,o),a.m(e,null)},p(d,f){c===(c=l(d))&&a?a.p(d,f):(a.d(1),a=c(d),a&&(a.c(),a.m(e,null)))},d(d){d&&T(e),a.d()}}}function Bt(r){let e,t=r[11].error+"";return{c(){e=R("div"),s(e,"title",r[10])},m(i,o){M(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].error+"")&&(e.innerHTML=t),o[0]&1024&&s(e,"title",i[10])},d(i){i&&T(e)}}}function Ht(r){let e,t=r[11].expired+"";return{c(){e=R("div"),s(e,"title",r[10])},m(i,o){M(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].expired+"")&&(e.innerHTML=t),o[0]&1024&&s(e,"title",i[10])},d(i){i&&T(e)}}}function Xe(r){let e,t,i=r[11].footer+"";return{c(){e=R("div"),t=R("div"),s(t,"class","svelte-ddsc3z"),s(e,"class","altcha-footer svelte-ddsc3z")},m(o,l){M(o,e,l),p(e,t),t.innerHTML=i},p(o,l){l[0]&2048&&i!==(i=o[11].footer+"")&&(t.innerHTML=i)},d(o){o&&T(e)}}}function Be(r){let e;return{c(){e=R("div"),s(e,"class","altcha-anchor-arrow svelte-ddsc3z")},m(t,i){M(t,e,i),r[37](e)},p:ie,d(t){t&&T(e),r[37](null)}}}function Pt(r){let e,t,i,o,l,c,a,d,f,G,N,X,$,k,K,S=r[6]===m.VERIFYING&&Ue();function q(h,v){return h[6]===m.VERIFIED?Xt:h[6]===m.VERIFYING?Ot:Gt}let W=q(r),V=W(r),E=(r[3]!==!0||r[12])&&Ge(r),I=(r[10]||r[6]===m.EXPIRED)&&Oe(r),z=r[11].footer&&(r[2]!==!0||r[12])&&Xe(r),y=r[1]&&Be(r);return{c(){e=R("div"),t=R("div"),S&&S.c(),i=Y(),o=R("div"),l=R("input"),d=Y(),f=R("div"),V.c(),G=Y(),E&&E.c(),N=Y(),I&&I.c(),X=Y(),z&&z.c(),$=Y(),y&&y.c(),s(l,"type","checkbox"),s(l,"id",c=r[4]+"_checkbox"),l.required=a=r[0]!=="onsubmit",s(l,"class","svelte-ddsc3z"),s(o,"class","altcha-checkbox svelte-ddsc3z"),Ze(o,"altcha-hidden",r[6]===m.VERIFYING),s(f,"class","altcha-label svelte-ddsc3z"),s(t,"class","altcha-main svelte-ddsc3z"),s(e,"class","altcha svelte-ddsc3z"),s(e,"data-state",r[6]),s(e,"data-floating",r[1])},m(h,v){M(h,e,v),p(e,t),S&&S.m(t,null),p(t,i),p(t,o),p(o,l),l.checked=r[7],p(t,d),p(t,f),V.m(f,null),p(t,G),E&&E.m(t,null),p(e,N),I&&I.m(e,null),p(e,X),z&&z.m(e,null),p(e,$),y&&y.m(e,null),r[38](e),k||(K=[ke(l,"change",r[36]),ke(l,"change",r[13]),ke(l,"invalid",r[14])],k=!0)},p(h,v){h[6]===m.VERIFYING?S||(S=Ue(),S.c(),S.m(t,i)):S&&(S.d(1),S=null),v[0]&16&&c!==(c=h[4]+"_checkbox")&&s(l,"id",c),v[0]&1&&a!==(a=h[0]!=="onsubmit")&&(l.required=a),v[0]&128&&(l.checked=h[7]),v[0]&64&&Ze(o,"altcha-hidden",h[6]===m.VERIFYING),W===(W=q(h))&&V?V.p(h,v):(V.d(1),V=W(h),V&&(V.c(),V.m(f,null))),h[3]!==!0||h[12]?E?E.p(h,v):(E=Ge(h),E.c(),E.m(t,null)):E&&(E.d(1),E=null),h[10]||h[6]===m.EXPIRED?I?I.p(h,v):(I=Oe(h),I.c(),I.m(e,X)):I&&(I.d(1),I=null),h[11].footer&&(h[2]!==!0||h[12])?z?z.p(h,v):(z=Xe(h),z.c(),z.m(e,$)):z&&(z.d(1),z=null),h[1]?y?y.p(h,v):(y=Be(h),y.c(),y.m(e,null)):y&&(y.d(1),y=null),v[0]&64&&s(e,"data-state",h[6]),v[0]&2&&s(e,"data-floating",h[1])},i:ie,o:ie,d(h){h&&T(e),S&&S.d(),V.d(),E&&E.d(),I&&I.d(),z&&z.d(),y&&y.d(),r[38](null),k=!1,ce(K)}}}const He="Visit Altcha.org",Pe="https://altcha.org/";function We(r){return JSON.parse(r)}function Wt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Yt(r,e,t){var ft,ut;let i,o,l,c,{auto:a=void 0}=e,{blockspam:d=void 0}=e,{challengeurl:f=void 0}=e,{challengejson:G=void 0}=e,{debug:N=!1}=e,{delay:X=0}=e,{expire:$=void 0}=e,{floating:k=void 0}=e,{floatinganchor:K=void 0}=e,{floatingoffset:S=void 0}=e,{hidefooter:q=!1}=e,{hidelogo:W=!1}=e,{name:V="altcha"}=e,{maxnumber:E=1e6}=e,{mockerror:I=!1}=e,{refetchonexpire:z=!0}=e,{spamfilter:y=!1}=e,{strings:h=void 0}=e,{test:v=!1}=e,{verifyurl:Q=void 0}=e,{workers:ue=Math.min(16,navigator.hardwareConcurrency||8)}=e,{workerurl:be=void 0}=e;const Re=Et(),Ke=["SHA-256","SHA-384","SHA-512"],Je=(ut=(ft=document.documentElement.lang)==null?void 0:ft.split("-"))==null?void 0:ut[0];let J=!1,C,ee=null,ve=null,b=null,Ie=null,te=null,D=m.UNVERIFIED,B=null;xt(()=>{b&&(b.removeEventListener("submit",Qe),b.removeEventListener("reset",et),b.removeEventListener("focusin",qe),b=null),B&&(clearTimeout(B),B=null),document.removeEventListener("click",it),document.removeEventListener("scroll",ot),window.removeEventListener("resize",st)}),kt(()=>{x("mounted","0.6.6"),x("workers",ue),v&&x("using test mode"),$&&we($),a!==void 0&&x("auto",a),k!==void 0&&ct(k),b=C.closest("form"),b&&(b.addEventListener("submit",Qe,{capture:!0}),b.addEventListener("reset",et),a==="onfocus"&&b.addEventListener("focusin",qe)),a==="onload"&&re(),i&&(q||W)&&x("Attributes hidefooter and hidelogo ignored because usage with free API Keys require attribution.")});function x(...n){(N||n.some(u=>u instanceof Error))&&console[n[0]instanceof Error?"error":"log"]("ALTCHA",...n)}function qe(n){D===m.UNVERIFIED&&re()}function Qe(n){b&&a==="onsubmit"&&(D===m.UNVERIFIED?(n.preventDefault(),n.stopPropagation(),re().then(()=>{b==null||b.requestSubmit()})):D!==m.VERIFIED&&(n.preventDefault(),n.stopPropagation(),D===m.VERIFYING&<()))}function et(){ye()}function tt(n,u){return btoa(JSON.stringify({algorithm:n.algorithm,challenge:n.challenge,number:u.number,salt:n.salt,signature:n.signature,test:v?!0:void 0,took:u.took}))}function rt(n){if(!n.algorithm)throw new Error("Invalid challenge. Property algorithm is missing.");if(n.signature===void 0)throw new Error("Invalid challenge. Property signature is missing.");if(!Ke.includes(n.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${Ke.join(", ")}`);if(!n.challenge||n.challenge.length<40)throw new Error("Challenge is too short. Min. 40 chars.");if(!n.salt||n.salt.length<10)throw new Error("Salt is too short. Min. 10 chars.")}async function Kt(){var n;if(I)throw x("mocking error"),new Error("Mocked error.");if(o)return x("using provided json data"),o;if(v)return x("generating test challenge",{test:v}),Ft(typeof v!="boolean"?+v:void 0);{if(!f)throw new Error("Attribute challengeurl not set.");x("fetching challenge from",f);const u=await fetch(f,{headers:{"x-altcha-spam-filter":y?"1":"0"}});if(u.status!==200)throw new Error(`Server responded with ${u.status}.`);const g=u.headers.get("Expires"),A=u.headers.get("X-Altcha-Config"),F=await u.json(),j=new URLSearchParams((n=F.salt.split("?"))==null?void 0:n[1]),H=j.get("expires")||j.get("expire");if(H){const _=new Date(+H*1e3),L=isNaN(_.getTime())?0:_.getTime()-Date.now();L>0&&we(L)}if(A)try{const _=JSON.parse(A);_&&typeof _=="object"&&(_.verifyurl&&(_.verifyurl=new URL(_.verifyurl,new URL(f)).toString()),at(_))}catch(_){x("unable to configure from X-Altcha-Config",_)}if(!$&&(g!=null&&g.length)){const _=Date.parse(g);if(_){const L=_-Date.now();L>0&&we(L)}}return F}}function nt(){f&&z&&D===m.VERIFIED?re():ye(m.EXPIRED,c.expired)}async function Jt(n){let u=null;if("Worker"in window){try{u=await qt(n.challenge,n.salt,n.algorithm,n.maxnumber)}catch(g){x(g)}if((u==null?void 0:u.number)!==void 0)return{data:n,solution:u}}return{data:n,solution:await $t(n.challenge,n.salt,n.algorithm,n.maxnumber||E).promise}}async function qt(n,u,g,A=typeof v=="number"?v:E,F=Math.ceil(ue)){const j=[];F=Math.min(16,Math.max(1,F));for(let L=0;L{const de=Ae*H;return new Promise(pe=>{L.addEventListener("message",_e=>{if(_e.data)for(const he of j)he!==L&&he.postMessage({type:"abort"});pe(_e.data)}),L.postMessage({payload:{alg:g,challenge:n,max:de+H,salt:u,start:de},type:"work"})})}));for(const L of j)L.terminate();return _.find(L=>!!L)||null}function Qt(){[m.UNVERIFIED,m.ERROR,m.EXPIRED].includes(D)?y&&(b==null?void 0:b.reportValidity())===!1?t(7,J=!1):re():t(7,J=!0)}function it(n){const u=n.target;k&&u&&!C.contains(u)&&D===m.VERIFIED&&t(8,C.style.display="none",C)}function ot(){k&&ze()}function lt(){D===m.VERIFYING&&c.waitAlert&&alert(c.waitAlert)}function er(n){k&&D!==m.UNVERIFIED&&requestAnimationFrame(()=>{ze()})}function st(){k&&ze()}function we(n){x("expire",n),B&&(clearTimeout(B),B=null),n<1?nt():B=setTimeout(nt,n)}function ct(n){x("floating",n),k!==n&&(t(8,C.style.left="",C),t(8,C.style.top="",C)),t(1,k=n===!0||n===""?"auto":n===!1||n==="false"?void 0:k),k?(a||t(0,a="onsubmit"),document.addEventListener("scroll",ot),document.addEventListener("click",it),window.addEventListener("resize",st)):a==="onsubmit"&&t(0,a=void 0)}function tr(n){var g;const u=b==null?void 0:b.querySelector(typeof n=="string"?`input[name="${n}"]`:'input[type="email"]:not([data-no-spamfilter])');return((g=u==null?void 0:u.value)==null?void 0:g.slice(u.value.indexOf("@")))||void 0}function rr(n){return[...(b==null?void 0:b.querySelectorAll(n!=null&&n.length?n.map(g=>`input[name="${g}"]`).join(", "):'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])'))||[]].reduce((g,A)=>{const F=A.name,j=A.value;return F&&j&&(g[F]=/\n/.test(j)?j.replace(new RegExp("(?F:k==="top",_=Math.max(n,Math.min(j-n-A.width,g.left+g.width/2-A.width/2));if(H?t(8,C.style.top=`${g.top-(A.height+u)}px`,C):t(8,C.style.top=`${g.bottom+u}px`,C),t(8,C.style.left=`${_}px`,C),C.setAttribute("data-floating",H?"top":"bottom"),ee){const L=ee.getBoundingClientRect();t(9,ee.style.left=g.left-_+g.width/2-L.width/2+"px",ee)}}else x("unable to find floating anchor element")}function at(n){n.auto!==void 0&&(t(0,a=n.auto),a==="onload"&&re()),n.floatinganchor!==void 0&&t(19,K=n.floatinganchor),n.delay!==void 0&&t(17,X=n.delay),n.floatingoffset!==void 0&&t(20,S=n.floatingoffset),n.floating!==void 0&&ct(n.floating),n.expire!==void 0&&(we(n.expire),t(18,$=n.expire)),n.challenge&&(rt(n.challenge),o=n.challenge),n.challengeurl!==void 0&&t(15,f=n.challengeurl),n.debug!==void 0&&t(16,N=!!n.debug),n.hidefooter!==void 0&&t(2,q=!!n.hidefooter),n.hidelogo!==void 0&&t(3,W=!!n.hidelogo),n.maxnumber!==void 0&&t(21,E=+n.maxnumber),n.mockerror!==void 0&&t(22,I=!!n.mockerror),n.name!==void 0&&t(4,V=n.name),n.refetchonexpire!==void 0&&t(23,z=!!n.refetchonexpire),n.spamfilter!==void 0&&t(24,y=typeof n.spamfilter=="object"?n.spamfilter:!!n.spamfilter),n.strings&&t(35,l=n.strings),n.test!==void 0&&t(25,v=typeof n.test=="number"?n.test:!!n.test),n.verifyurl!==void 0&&t(26,Q=n.verifyurl),n.workers!==void 0&&t(27,ue=+n.workers),n.workerurl!==void 0&&t(28,be=n.workerurl)}function ye(n=m.UNVERIFIED,u=null){B&&(clearTimeout(B),B=null),t(7,J=!1),t(10,Ie=u),t(5,te=null),t(6,D=n)}async function re(){return ye(m.VERIFYING),await new Promise(n=>setTimeout(n,X||0)),Kt().then(n=>(rt(n),x("challenge",n),Jt(n))).then(({data:n,solution:u})=>{if(x("solution",u),(u==null?void 0:u.number)!==void 0){if(Q)return nr(tt(n,u));t(5,te=tt(n,u)),x("payload",te)}else throw x("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."),new Error("Unexpected result returned.")}).then(()=>{Ct().then(()=>{t(6,D=m.VERIFIED),t(7,J=!0),x("verified"),Re("verified",{payload:te})})}).catch(n=>{x(n),t(6,D=m.ERROR),t(7,J=!1),t(10,Ie=n.message)})}function or(){J=this.checked,t(7,J)}function lr(n){ge[n?"unshift":"push"](()=>{ee=n,t(9,ee)})}function sr(n){ge[n?"unshift":"push"](()=>{C=n,t(8,C)})}return r.$$set=n=>{"auto"in n&&t(0,a=n.auto),"blockspam"in n&&t(29,d=n.blockspam),"challengeurl"in n&&t(15,f=n.challengeurl),"challengejson"in n&&t(30,G=n.challengejson),"debug"in n&&t(16,N=n.debug),"delay"in n&&t(17,X=n.delay),"expire"in n&&t(18,$=n.expire),"floating"in n&&t(1,k=n.floating),"floatinganchor"in n&&t(19,K=n.floatinganchor),"floatingoffset"in n&&t(20,S=n.floatingoffset),"hidefooter"in n&&t(2,q=n.hidefooter),"hidelogo"in n&&t(3,W=n.hidelogo),"name"in n&&t(4,V=n.name),"maxnumber"in n&&t(21,E=n.maxnumber),"mockerror"in n&&t(22,I=n.mockerror),"refetchonexpire"in n&&t(23,z=n.refetchonexpire),"spamfilter"in n&&t(24,y=n.spamfilter),"strings"in n&&t(31,h=n.strings),"test"in n&&t(25,v=n.test),"verifyurl"in n&&t(26,Q=n.verifyurl),"workers"in n&&t(27,ue=n.workers),"workerurl"in n&&t(28,be=n.workerurl)},r.$$.update=()=>{r.$$.dirty[0]&32768&&t(12,i=!!(f!=null&&f.includes(".altcha.org"))&&!!(f!=null&&f.includes("apiKey=ckey_"))),r.$$.dirty[0]&1073741824&&(o=G?We(G):void 0),r.$$.dirty[1]&1&&t(35,l=h?We(h):{}),r.$$.dirty[1]&16&&t(11,c={ariaLinkLabel:He,error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by ALTCHA`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...l}),r.$$.dirty[0]&96&&Re("statechange",{payload:te,state:D}),r.$$.dirty[0]&64&&er()},[a,k,q,W,V,te,D,J,C,ee,Ie,c,i,Qt,lt,f,N,X,$,K,S,E,I,z,y,v,Q,ue,be,d,G,h,at,ye,re,l,or,lr,sr]}class Ye extends Zt{constructor(e){super(),jt(this,e,Yt,Pt,ht,{auto:0,blockspam:29,challengeurl:15,challengejson:30,debug:16,delay:17,expire:18,floating:1,floatinganchor:19,floatingoffset:20,hidefooter:2,hidelogo:3,name:4,maxnumber:21,mockerror:22,refetchonexpire:23,spamfilter:24,strings:31,test:25,verifyurl:26,workers:27,workerurl:28,configure:32,reset:33,verify:34},Ut,[-1,-1,-1])}get auto(){return this.$$.ctx[0]}set auto(e){this.$$set({auto:e}),w()}get blockspam(){return this.$$.ctx[29]}set blockspam(e){this.$$set({blockspam:e}),w()}get challengeurl(){return this.$$.ctx[15]}set challengeurl(e){this.$$set({challengeurl:e}),w()}get challengejson(){return this.$$.ctx[30]}set challengejson(e){this.$$set({challengejson:e}),w()}get debug(){return this.$$.ctx[16]}set debug(e){this.$$set({debug:e}),w()}get delay(){return this.$$.ctx[17]}set delay(e){this.$$set({delay:e}),w()}get expire(){return this.$$.ctx[18]}set expire(e){this.$$set({expire:e}),w()}get floating(){return this.$$.ctx[1]}set floating(e){this.$$set({floating:e}),w()}get floatinganchor(){return this.$$.ctx[19]}set floatinganchor(e){this.$$set({floatinganchor:e}),w()}get floatingoffset(){return this.$$.ctx[20]}set floatingoffset(e){this.$$set({floatingoffset:e}),w()}get hidefooter(){return this.$$.ctx[2]}set hidefooter(e){this.$$set({hidefooter:e}),w()}get hidelogo(){return this.$$.ctx[3]}set hidelogo(e){this.$$set({hidelogo:e}),w()}get name(){return this.$$.ctx[4]}set name(e){this.$$set({name:e}),w()}get maxnumber(){return this.$$.ctx[21]}set maxnumber(e){this.$$set({maxnumber:e}),w()}get mockerror(){return this.$$.ctx[22]}set mockerror(e){this.$$set({mockerror:e}),w()}get refetchonexpire(){return this.$$.ctx[23]}set refetchonexpire(e){this.$$set({refetchonexpire:e}),w()}get spamfilter(){return this.$$.ctx[24]}set spamfilter(e){this.$$set({spamfilter:e}),w()}get strings(){return this.$$.ctx[31]}set strings(e){this.$$set({strings:e}),w()}get test(){return this.$$.ctx[25]}set test(e){this.$$set({test:e}),w()}get verifyurl(){return this.$$.ctx[26]}set verifyurl(e){this.$$set({verifyurl:e}),w()}get workers(){return this.$$.ctx[27]}set workers(e){this.$$set({workers:e}),w()}get workerurl(){return this.$$.ctx[28]}set workerurl(e){this.$$set({workerurl:e}),w()}get configure(){return this.$$.ctx[32]}get reset(){return this.$$.ctx[33]}get verify(){return this.$$.ctx[34]}}customElements.define("altcha-widget",Tt(Ye,{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)),globalThis.createAltchaWorker=r=>r?new Worker(new URL(r)):new dt,U.Altcha=Ye,Object.defineProperty(U,Symbol.toStringTag,{value:"Module"})}); +(function(U,Z){typeof exports=="object"&&typeof module<"u"?Z(exports):typeof define=="function"&&define.amd?define(["exports"],Z):(U=typeof globalThis<"u"?globalThis:U||self,Z(U.altcha={}))})(this,function(U){"use strict";var cr=Object.defineProperty;var ar=(U,Z,ne)=>Z in U?cr(U,Z,{enumerable:!0,configurable:!0,writable:!0,value:ne}):U[Z]=ne;var O=(U,Z,ne)=>ar(U,typeof Z!="symbol"?Z+"":Z,ne);const Z="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGQoZSl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KGUpXS5tYXAodD0+dC50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBwKGUsdCxvKXtyZXR1cm4gZChhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUoZSt0KSkpfWZ1bmN0aW9uIGcoZSx0LG89IlNIQS0yNTYiLGw9MWU2LGM9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyLGk9RGF0ZS5ub3coKTtyZXR1cm57cHJvbWlzZTooYXN5bmMoKT0+e2ZvcihsZXQgbj1jO248PWw7bis9MSl7aWYoYS5zaWduYWwuYWJvcnRlZClyZXR1cm4gbnVsbDtpZihhd2FpdCBwKHQsbixvKT09PWUpcmV0dXJue251bWJlcjpuLHRvb2s6RGF0ZS5ub3coKS1pfX1yZXR1cm4gbnVsbH0pKCksY29udHJvbGxlcjphfX1sZXQgcjtvbm1lc3NhZ2U9YXN5bmMgZT0+e2NvbnN0e3R5cGU6dCxwYXlsb2FkOm99PWUuZGF0YTtpZih0PT09ImFib3J0IilyPT1udWxsfHxyLmFib3J0KCkscj12b2lkIDA7ZWxzZSBpZih0PT09IndvcmsiKXtjb25zdHthbGc6bCxjaGFsbGVuZ2U6YyxtYXg6YSxzYWx0Omksc3RhcnQ6dX09b3x8e30sbj1nKGMsaSxsLGEsdSk7cj1uLmNvbnRyb2xsZXIsbi5wcm9taXNlLnRoZW4ocz0+e3NlbGYucG9zdE1lc3NhZ2UocyYmey4uLnMsd29ya2VyOiEwfSl9KX19fSkoKTsK",ne=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0)),Se=typeof self<"u"&&self.Blob&&new Blob([ne(Z)],{type:"text/javascript;charset=utf-8"});function dt(r){let e;try{if(e=Se&&(self.URL||self.webkitURL).createObjectURL(Se),!e)throw"";const t=new Worker(e,{name:r==null?void 0:r.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+Z,{name:r==null?void 0:r.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}function ie(){}function Ne(r){return r()}function je(){return Object.create(null)}function ce(r){r.forEach(Ne)}function Te(r){return typeof r=="function"}function ht(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function gt(r){return Object.keys(r).length===0}function p(r,e){r.appendChild(e)}function mt(r,e,t){const i=bt(r);if(!i.getElementById(e)){const o=R("style");o.id=e,o.textContent=t,vt(i,o)}}function bt(r){if(!r)return document;const e=r.getRootNode?r.getRootNode():r.ownerDocument;return e&&e.host?e:r.ownerDocument}function vt(r,e){return p(r.head||r,e),e.sheet}function M(r,e,t){r.insertBefore(e,t||null)}function T(r){r.parentNode&&r.parentNode.removeChild(r)}function R(r){return document.createElement(r)}function P(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function wt(r){return document.createTextNode(r)}function Y(){return wt(" ")}function ke(r,e,t,i){return r.addEventListener(e,t,i),()=>r.removeEventListener(e,t,i)}function s(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function yt(r){return Array.from(r.childNodes)}function Ze(r,e,t){r.classList.toggle(e,!!t)}function pt(r,e,{bubbles:t=!1,cancelable:i=!1}={}){return new CustomEvent(r,{detail:e,bubbles:t,cancelable:i})}function _t(r){const e={};return r.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let ae;function fe(r){ae=r}function xe(){if(!ae)throw new Error("Function called outside component initialization");return ae}function kt(r){xe().$$.on_mount.push(r)}function xt(r){xe().$$.on_destroy.push(r)}function Et(){const r=xe();return(e,t,{cancelable:i=!1}={})=>{const o=r.$$.callbacks[e];if(o){const l=pt(e,t,{cancelable:i});return o.slice().forEach(c=>{c.call(r,l)}),!l.defaultPrevented}return!0}}const oe=[],ge=[];let le=[];const Me=[],Ve=Promise.resolve();let Ee=!1;function $e(){Ee||(Ee=!0,Ve.then(w))}function Ct(){return $e(),Ve}function Ce(r){le.push(r)}const Le=new Set;let se=0;function w(){if(se!==0)return;const r=ae;do{try{for(;ser.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),le=e}const It=new Set;function zt(r,e){r&&r.i&&(It.delete(r),r.i(e))}function At(r,e,t){const{fragment:i,after_update:o}=r.$$;i&&i.m(e,t),Ce(()=>{const l=r.$$.on_mount.map(Ne).filter(Te);r.$$.on_destroy?r.$$.on_destroy.push(...l):ce(l),r.$$.on_mount=[]}),o.forEach(Ce)}function St(r,e){const t=r.$$;t.fragment!==null&&(Rt(t.after_update),ce(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Nt(r,e){r.$$.dirty[0]===-1&&(oe.push(r),$e(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<{const k=F.length?F[0]:X;return f.ctx&&o(f.ctx[N],f.ctx[N]=k)&&(!f.skip_bound&&f.bound[N]&&f.bound[N](k),G&&Nt(r,N)),X}):[],f.update(),G=!0,ce(f.before_update),f.fragment=i?i(f.ctx):!1,e.target){if(e.hydrate){const N=yt(e.target);f.fragment&&f.fragment.l(N),N.forEach(T)}else f.fragment&&f.fragment.c();e.intro&&zt(r.$$.fragment),At(r,e.target,e.anchor),w()}fe(d)}let De;typeof HTMLElement=="function"&&(De=class extends HTMLElement{constructor(e,t,i){super();O(this,"$$ctor");O(this,"$$s");O(this,"$$c");O(this,"$$cn",!1);O(this,"$$d",{});O(this,"$$r",!1);O(this,"$$p_d",{});O(this,"$$l",{});O(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,i&&this.attachShadow({mode:"open"})}addEventListener(e,t,i){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const o=this.$$c.$on(e,t);this.$$l_u.set(t,o)}super.addEventListener(e,t,i)}removeEventListener(e,t,i){if(super.removeEventListener(e,t,i),this.$$c){const o=this.$$l_u.get(t);o&&(o(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(l){return()=>{let c;return{c:function(){c=R("slot"),l!=="default"&&s(c,"name",l)},m:function(f,G){M(f,c,G)},d:function(f){f&&T(c)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},i=_t(this);for(const l of this.$$s)l in i&&(t[l]=[e(l)]);for(const l of this.attributes){const c=this.$$g_p(l.name);c in this.$$d||(this.$$d[c]=me(c,l.value,this.$$p_d,"toProp"))}for(const l in this.$$p_d)!(l in this.$$d)&&this[l]!==void 0&&(this.$$d[l]=this[l],delete this[l]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$scope:{ctx:[]}}});const o=()=>{this.$$r=!0;for(const l in this.$$p_d)if(this.$$d[l]=this.$$c.$$.ctx[this.$$c.$$.props[l]],this.$$p_d[l].reflect){const c=me(l,this.$$d[l],this.$$p_d,"toAttribute");c==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,c)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const l in this.$$l)for(const c of this.$$l[l]){const a=this.$$c.$on(l,c);this.$$l_u.set(c,a)}this.$$l={}}}attributeChangedCallback(e,t,i){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=me(e,i,this.$$p_d,"toProp"),(o=this.$$c)==null||o.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function me(r,e,t,i){var l;const o=(l=t[r])==null?void 0:l.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!i||!t[r])return e;if(i==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function Tt(r,e,t,i,o,l){let c=class extends De{constructor(){super(r,t,o),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(a=>(e[a].attribute||a).toLowerCase())}};return Object.keys(e).forEach(a=>{Object.defineProperty(c.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(d){var f;d=me(a,d,e),this.$$d[a]=d,(f=this.$$c)==null||f.$set({[a]:d})}})}),i.forEach(a=>{Object.defineProperty(c.prototype,a,{get(){var d;return(d=this.$$c)==null?void 0:d[a]}})}),r.element=c,c}class Zt{constructor(){O(this,"$$");O(this,"$$set")}$destroy(){St(this,1),this.$destroy=ie}$on(e,t){if(!Te(t))return ie;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}$set(e){this.$$set&&!gt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Mt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Mt);const Vt=new TextEncoder;function $t(r){return[...new Uint8Array(r)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function Dt(r,e="SHA-256",t=1e5){const i=Date.now().toString(16);r||(r=Math.round(Math.random()*t));const o=await Fe(i,r,e);return{algorithm:e,challenge:o,salt:i,signature:""}}async function Fe(r,e,t){return $t(await crypto.subtle.digest(t.toUpperCase(),Vt.encode(r+e)))}function Ft(r,e,t="SHA-256",i=1e6,o=0){const l=new AbortController,c=Date.now();return{promise:(async()=>{for(let d=o;d<=i;d+=1){if(l.signal.aborted)return null;if(await Fe(e,d,t)===r)return{number:d,took:Date.now()-c}}return null})(),controller:l}}var m=(r=>(r.ERROR="error",r.VERIFIED="verified",r.VERIFYING="verifying",r.UNVERIFIED="unverified",r.EXPIRED="expired",r))(m||{});function Ut(r){mt(r,"svelte-ddsc3z",'.altcha.svelte-ddsc3z.svelte-ddsc3z{background:var(--altcha-color-base, transparent);border:var(--altcha-border-width, 1px) solid var(--altcha-color-border, #a0a0a0);border-radius:var(--altcha-border-radius, 3px);color:var(--altcha-color-text, currentColor);display:flex;flex-direction:column;max-width:var(--altcha-max-width, 260px);position:relative;text-align:left}.altcha.svelte-ddsc3z.svelte-ddsc3z:focus-within{border-color:var(--altcha-color-border-focus, currentColor)}.altcha[data-floating].svelte-ddsc3z.svelte-ddsc3z{background:var(--altcha-color-base, white);display:none;filter:drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.2));left:-100%;position:fixed;top:-100%;width:var(--altcha-max-width, 260px);z-index:999999}.altcha[data-floating=top].svelte-ddsc3z .altcha-anchor-arrow.svelte-ddsc3z{border-bottom-color:transparent;border-top-color:var(--altcha-color-border, #a0a0a0);bottom:-12px;top:auto}.altcha[data-floating=bottom].svelte-ddsc3z.svelte-ddsc3z:focus-within::after{border-bottom-color:var(--altcha-color-border-focus, currentColor)}.altcha[data-floating=top].svelte-ddsc3z.svelte-ddsc3z:focus-within::after{border-top-color:var(--altcha-color-border-focus, currentColor)}.altcha[data-floating].svelte-ddsc3z.svelte-ddsc3z:not([data-state=unverified]){display:block}.altcha-anchor-arrow.svelte-ddsc3z.svelte-ddsc3z{border:6px solid transparent;border-bottom-color:var(--altcha-color-border, #a0a0a0);content:"";height:0;left:12px;position:absolute;top:-12px;width:0}.altcha-main.svelte-ddsc3z.svelte-ddsc3z{align-items:center;display:flex;gap:0.4rem;padding:0.7rem}.altcha-label.svelte-ddsc3z.svelte-ddsc3z{flex-grow:1}.altcha-label.svelte-ddsc3z label.svelte-ddsc3z{cursor:pointer}.altcha-logo.svelte-ddsc3z.svelte-ddsc3z{color:currentColor;opacity:0.3}.altcha-logo.svelte-ddsc3z.svelte-ddsc3z:hover{opacity:1}.altcha-error.svelte-ddsc3z.svelte-ddsc3z{color:var(--altcha-color-error-text, #f23939);display:flex;font-size:0.85rem;gap:0.3rem;padding:0 0.7rem 0.7rem}.altcha-footer.svelte-ddsc3z.svelte-ddsc3z{align-items:center;background-color:var(--altcha-color-footer-bg, transparent);display:flex;font-size:0.75rem;opacity:0.4;padding:0.2rem 0.7rem;text-align:right}.altcha-footer.svelte-ddsc3z.svelte-ddsc3z:hover{opacity:1}.altcha-footer.svelte-ddsc3z>.svelte-ddsc3z:first-child{flex-grow:1}.altcha-footer.svelte-ddsc3z a{color:currentColor}.altcha-checkbox.svelte-ddsc3z.svelte-ddsc3z{display:flex;align-items:center;height:24px;width:24px}.altcha-checkbox.svelte-ddsc3z input.svelte-ddsc3z{width:18px;height:18px;margin:0}.altcha-hidden.svelte-ddsc3z.svelte-ddsc3z{display:none}.altcha-spinner.svelte-ddsc3z.svelte-ddsc3z{animation:svelte-ddsc3z-altcha-spinner 0.75s infinite linear;transform-origin:center}@keyframes svelte-ddsc3z-altcha-spinner{100%{transform:rotate(360deg)}}')}function Ue(r){let e,t,i;return{c(){e=P("svg"),t=P("path"),i=P("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 svelte-ddsc3z"),s(e,"width","24"),s(e,"height","24"),s(e,"viewBox","0 0 24 24"),s(e,"xmlns","http://www.w3.org/2000/svg")},m(o,l){M(o,e,l),p(e,t),p(e,i)},d(o){o&&T(e)}}}function Gt(r){let e,t=r[11].label+"",i;return{c(){e=R("label"),s(e,"for",i=r[4]+"_checkbox"),s(e,"class","svelte-ddsc3z")},m(o,l){M(o,e,l),e.innerHTML=t},p(o,l){l[0]&2048&&t!==(t=o[11].label+"")&&(e.innerHTML=t),l[0]&16&&i!==(i=o[4]+"_checkbox")&&s(e,"for",i)},d(o){o&&T(e)}}}function Ot(r){let e,t=r[11].verifying+"";return{c(){e=R("span")},m(i,o){M(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].verifying+"")&&(e.innerHTML=t)},d(i){i&&T(e)}}}function Xt(r){let e,t=r[11].verified+"",i,o;return{c(){e=R("span"),i=Y(),o=R("input"),s(o,"type","hidden"),s(o,"name",r[4]),o.value=r[5]},m(l,c){M(l,e,c),e.innerHTML=t,M(l,i,c),M(l,o,c)},p(l,c){c[0]&2048&&t!==(t=l[11].verified+"")&&(e.innerHTML=t),c[0]&16&&s(o,"name",l[4]),c[0]&32&&(o.value=l[5])},d(l){l&&(T(e),T(i),T(o))}}}function Ge(r){let e,t,i,o,l,c,a;return{c(){e=R("div"),t=R("a"),i=P("svg"),o=P("path"),l=P("path"),c=P("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(c,"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(c,"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",Pe),s(t,"target","_blank"),s(t,"class","altcha-logo svelte-ddsc3z"),s(t,"aria-label",a=r[11].ariaLinkLabel)},m(d,f){M(d,e,f),p(e,t),p(t,i),p(i,o),p(i,l),p(i,c)},p(d,f){f[0]&2048&&a!==(a=d[11].ariaLinkLabel)&&s(t,"aria-label",a)},d(d){d&&T(e)}}}function Oe(r){let e,t,i,o;function l(d,f){return d[6]===m.EXPIRED?Ht:Bt}let c=l(r),a=c(r);return{c(){e=R("div"),t=P("svg"),i=P("path"),o=Y(),a.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 svelte-ddsc3z")},m(d,f){M(d,e,f),p(e,t),p(t,i),p(e,o),a.m(e,null)},p(d,f){c===(c=l(d))&&a?a.p(d,f):(a.d(1),a=c(d),a&&(a.c(),a.m(e,null)))},d(d){d&&T(e),a.d()}}}function Bt(r){let e,t=r[11].error+"";return{c(){e=R("div"),s(e,"title",r[10])},m(i,o){M(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].error+"")&&(e.innerHTML=t),o[0]&1024&&s(e,"title",i[10])},d(i){i&&T(e)}}}function Ht(r){let e,t=r[11].expired+"";return{c(){e=R("div"),s(e,"title",r[10])},m(i,o){M(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].expired+"")&&(e.innerHTML=t),o[0]&1024&&s(e,"title",i[10])},d(i){i&&T(e)}}}function Xe(r){let e,t,i=r[11].footer+"";return{c(){e=R("div"),t=R("div"),s(t,"class","svelte-ddsc3z"),s(e,"class","altcha-footer svelte-ddsc3z")},m(o,l){M(o,e,l),p(e,t),t.innerHTML=i},p(o,l){l[0]&2048&&i!==(i=o[11].footer+"")&&(t.innerHTML=i)},d(o){o&&T(e)}}}function Be(r){let e;return{c(){e=R("div"),s(e,"class","altcha-anchor-arrow svelte-ddsc3z")},m(t,i){M(t,e,i),r[37](e)},p:ie,d(t){t&&T(e),r[37](null)}}}function Pt(r){let e,t,i,o,l,c,a,d,f,G,N,X,F,k,K,S=r[6]===m.VERIFYING&&Ue();function q(h,v){return h[6]===m.VERIFIED?Xt:h[6]===m.VERIFYING?Ot:Gt}let W=q(r),V=W(r),E=(r[3]!==!0||r[12])&&Ge(r),I=(r[10]||r[6]===m.EXPIRED)&&Oe(r),z=r[11].footer&&(r[2]!==!0||r[12])&&Xe(r),y=r[1]&&Be(r);return{c(){e=R("div"),t=R("div"),S&&S.c(),i=Y(),o=R("div"),l=R("input"),d=Y(),f=R("div"),V.c(),G=Y(),E&&E.c(),N=Y(),I&&I.c(),X=Y(),z&&z.c(),F=Y(),y&&y.c(),s(l,"type","checkbox"),s(l,"id",c=r[4]+"_checkbox"),l.required=a=r[0]!=="onsubmit",s(l,"class","svelte-ddsc3z"),s(o,"class","altcha-checkbox svelte-ddsc3z"),Ze(o,"altcha-hidden",r[6]===m.VERIFYING),s(f,"class","altcha-label svelte-ddsc3z"),s(t,"class","altcha-main svelte-ddsc3z"),s(e,"class","altcha svelte-ddsc3z"),s(e,"data-state",r[6]),s(e,"data-floating",r[1])},m(h,v){M(h,e,v),p(e,t),S&&S.m(t,null),p(t,i),p(t,o),p(o,l),l.checked=r[7],p(t,d),p(t,f),V.m(f,null),p(t,G),E&&E.m(t,null),p(e,N),I&&I.m(e,null),p(e,X),z&&z.m(e,null),p(e,F),y&&y.m(e,null),r[38](e),k||(K=[ke(l,"change",r[36]),ke(l,"change",r[13]),ke(l,"invalid",r[14])],k=!0)},p(h,v){h[6]===m.VERIFYING?S||(S=Ue(),S.c(),S.m(t,i)):S&&(S.d(1),S=null),v[0]&16&&c!==(c=h[4]+"_checkbox")&&s(l,"id",c),v[0]&1&&a!==(a=h[0]!=="onsubmit")&&(l.required=a),v[0]&128&&(l.checked=h[7]),v[0]&64&&Ze(o,"altcha-hidden",h[6]===m.VERIFYING),W===(W=q(h))&&V?V.p(h,v):(V.d(1),V=W(h),V&&(V.c(),V.m(f,null))),h[3]!==!0||h[12]?E?E.p(h,v):(E=Ge(h),E.c(),E.m(t,null)):E&&(E.d(1),E=null),h[10]||h[6]===m.EXPIRED?I?I.p(h,v):(I=Oe(h),I.c(),I.m(e,X)):I&&(I.d(1),I=null),h[11].footer&&(h[2]!==!0||h[12])?z?z.p(h,v):(z=Xe(h),z.c(),z.m(e,F)):z&&(z.d(1),z=null),h[1]?y?y.p(h,v):(y=Be(h),y.c(),y.m(e,null)):y&&(y.d(1),y=null),v[0]&64&&s(e,"data-state",h[6]),v[0]&2&&s(e,"data-floating",h[1])},i:ie,o:ie,d(h){h&&T(e),S&&S.d(),V.d(),E&&E.d(),I&&I.d(),z&&z.d(),y&&y.d(),r[38](null),k=!1,ce(K)}}}const He="Visit Altcha.org",Pe="https://altcha.org/";function We(r){return JSON.parse(r)}function Wt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Yt(r,e,t){var ft,ut;let i,o,l,c,{auto:a=void 0}=e,{blockspam:d=void 0}=e,{challengeurl:f=void 0}=e,{challengejson:G=void 0}=e,{debug:N=!1}=e,{delay:X=0}=e,{expire:F=void 0}=e,{floating:k=void 0}=e,{floatinganchor:K=void 0}=e,{floatingoffset:S=void 0}=e,{hidefooter:q=!1}=e,{hidelogo:W=!1}=e,{name:V="altcha"}=e,{maxnumber:E=1e6}=e,{mockerror:I=!1}=e,{refetchonexpire:z=!0}=e,{spamfilter:y=!1}=e,{strings:h=void 0}=e,{test:v=!1}=e,{verifyurl:Q=void 0}=e,{workers:ue=Math.min(16,navigator.hardwareConcurrency||8)}=e,{workerurl:be=void 0}=e;const Re=Et(),Ke=["SHA-256","SHA-384","SHA-512"],Je=(ut=(ft=document.documentElement.lang)==null?void 0:ft.split("-"))==null?void 0:ut[0];let J=!1,C,ee=null,ve=null,b=null,Ie=null,te=null,$=m.UNVERIFIED,B=null;xt(()=>{b&&(b.removeEventListener("submit",Qe),b.removeEventListener("reset",et),b.removeEventListener("focusin",qe),b=null),B&&(clearTimeout(B),B=null),document.removeEventListener("click",it),document.removeEventListener("scroll",ot),window.removeEventListener("resize",st)}),kt(()=>{x("mounted","0.6.7"),x("workers",ue),v&&x("using test mode"),F&&we(F),a!==void 0&&x("auto",a),k!==void 0&&ct(k),b=C.closest("form"),b&&(b.addEventListener("submit",Qe,{capture:!0}),b.addEventListener("reset",et),a==="onfocus"&&b.addEventListener("focusin",qe)),a==="onload"&&re(),i&&(q||W)&&x("Attributes hidefooter and hidelogo ignored because usage with free API Keys require attribution.")});function x(...n){(N||n.some(u=>u instanceof Error))&&console[n[0]instanceof Error?"error":"log"]("ALTCHA",...n)}function qe(n){$===m.UNVERIFIED&&re()}function Qe(n){b&&a==="onsubmit"&&($===m.UNVERIFIED?(n.preventDefault(),n.stopPropagation(),re().then(()=>{b==null||b.requestSubmit()})):$!==m.VERIFIED&&(n.preventDefault(),n.stopPropagation(),$===m.VERIFYING&<()))}function et(){ye()}function tt(n,u){return btoa(JSON.stringify({algorithm:n.algorithm,challenge:n.challenge,number:u.number,salt:n.salt,signature:n.signature,test:v?!0:void 0,took:u.took}))}function rt(n){if(!n.algorithm)throw new Error("Invalid challenge. Property algorithm is missing.");if(n.signature===void 0)throw new Error("Invalid challenge. Property signature is missing.");if(!Ke.includes(n.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${Ke.join(", ")}`);if(!n.challenge||n.challenge.length<40)throw new Error("Challenge is too short. Min. 40 chars.");if(!n.salt||n.salt.length<10)throw new Error("Salt is too short. Min. 10 chars.")}async function Kt(){var n;if(I)throw x("mocking error"),new Error("Mocked error.");if(o)return x("using provided json data"),o;if(v)return x("generating test challenge",{test:v}),Dt(typeof v!="boolean"?+v:void 0);{if(!f)throw new Error("Attribute challengeurl not set.");x("fetching challenge from",f);const u=await fetch(f,{headers:{"x-altcha-spam-filter":y?"1":"0"}});if(u.status!==200)throw new Error(`Server responded with ${u.status}.`);const g=u.headers.get("Expires"),A=u.headers.get("X-Altcha-Config"),D=await u.json(),j=new URLSearchParams((n=D.salt.split("?"))==null?void 0:n[1]),H=j.get("expires")||j.get("expire");if(H){const _=new Date(+H*1e3),L=isNaN(_.getTime())?0:_.getTime()-Date.now();L>0&&we(L)}if(A)try{const _=JSON.parse(A);_&&typeof _=="object"&&(_.verifyurl&&(_.verifyurl=new URL(_.verifyurl,new URL(f)).toString()),at(_))}catch(_){x("unable to configure from X-Altcha-Config",_)}if(!F&&(g!=null&&g.length)){const _=Date.parse(g);if(_){const L=_-Date.now();L>0&&we(L)}}return D}}function nt(){f&&z&&$===m.VERIFIED?re():ye(m.EXPIRED,c.expired)}async function Jt(n){let u=null;if("Worker"in window){try{u=await qt(n.challenge,n.salt,n.algorithm,n.maxnumber)}catch(g){x(g)}if((u==null?void 0:u.number)!==void 0)return{data:n,solution:u}}return{data:n,solution:await Ft(n.challenge,n.salt,n.algorithm,n.maxnumber||E).promise}}async function qt(n,u,g,A=typeof v=="number"?v:E,D=Math.ceil(ue)){const j=[];D=Math.min(16,Math.max(1,D));for(let L=0;L{const de=Ae*H;return new Promise(pe=>{L.addEventListener("message",_e=>{if(_e.data)for(const he of j)he!==L&&he.postMessage({type:"abort"});pe(_e.data)}),L.postMessage({payload:{alg:g,challenge:n,max:de+H,salt:u,start:de},type:"work"})})}));for(const L of j)L.terminate();return _.find(L=>!!L)||null}function Qt(){[m.UNVERIFIED,m.ERROR,m.EXPIRED].includes($)?y&&(b==null?void 0:b.reportValidity())===!1?t(7,J=!1):re():t(7,J=!0)}function it(n){const u=n.target;k&&u&&!C.contains(u)&&$===m.VERIFIED&&t(8,C.style.display="none",C)}function ot(){k&&ze()}function lt(){$===m.VERIFYING&&c.waitAlert&&alert(c.waitAlert)}function er(n){k&&$!==m.UNVERIFIED&&requestAnimationFrame(()=>{ze()})}function st(){k&&ze()}function we(n){x("expire",n),B&&(clearTimeout(B),B=null),n<1?nt():B=setTimeout(nt,n)}function ct(n){x("floating",n),k!==n&&(t(8,C.style.left="",C),t(8,C.style.top="",C)),t(1,k=n===!0||n===""?"auto":n===!1||n==="false"?void 0:k),k?(a||t(0,a="onsubmit"),document.addEventListener("scroll",ot),document.addEventListener("click",it),window.addEventListener("resize",st)):a==="onsubmit"&&t(0,a=void 0)}function tr(n){var g;const u=b==null?void 0:b.querySelector(typeof n=="string"?`input[name="${n}"]`:'input[type="email"]:not([data-no-spamfilter])');return((g=u==null?void 0:u.value)==null?void 0:g.slice(u.value.indexOf("@")))||void 0}function rr(n){return[...(b==null?void 0:b.querySelectorAll(n!=null&&n.length?n.map(g=>`input[name="${g}"]`).join(", "):'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])'))||[]].reduce((g,A)=>{const D=A.name,j=A.value;return D&&j&&(g[D]=/\n/.test(j)?j.replace(new RegExp("(?D:k==="top",_=Math.max(n,Math.min(j-n-A.width,g.left+g.width/2-A.width/2));if(H?t(8,C.style.top=`${g.top-(A.height+u)}px`,C):t(8,C.style.top=`${g.bottom+u}px`,C),t(8,C.style.left=`${_}px`,C),C.setAttribute("data-floating",H?"top":"bottom"),ee){const L=ee.getBoundingClientRect();t(9,ee.style.left=g.left-_+g.width/2-L.width/2+"px",ee)}}else x("unable to find floating anchor element")}function at(n){n.auto!==void 0&&(t(0,a=n.auto),a==="onload"&&re()),n.floatinganchor!==void 0&&t(19,K=n.floatinganchor),n.delay!==void 0&&t(17,X=n.delay),n.floatingoffset!==void 0&&t(20,S=n.floatingoffset),n.floating!==void 0&&ct(n.floating),n.expire!==void 0&&(we(n.expire),t(18,F=n.expire)),n.challenge&&(rt(n.challenge),o=n.challenge),n.challengeurl!==void 0&&t(15,f=n.challengeurl),n.debug!==void 0&&t(16,N=!!n.debug),n.hidefooter!==void 0&&t(2,q=!!n.hidefooter),n.hidelogo!==void 0&&t(3,W=!!n.hidelogo),n.maxnumber!==void 0&&t(21,E=+n.maxnumber),n.mockerror!==void 0&&t(22,I=!!n.mockerror),n.name!==void 0&&t(4,V=n.name),n.refetchonexpire!==void 0&&t(23,z=!!n.refetchonexpire),n.spamfilter!==void 0&&t(24,y=typeof n.spamfilter=="object"?n.spamfilter:!!n.spamfilter),n.strings&&t(35,l=n.strings),n.test!==void 0&&t(25,v=typeof n.test=="number"?n.test:!!n.test),n.verifyurl!==void 0&&t(26,Q=n.verifyurl),n.workers!==void 0&&t(27,ue=+n.workers),n.workerurl!==void 0&&t(28,be=n.workerurl)}function ye(n=m.UNVERIFIED,u=null){B&&(clearTimeout(B),B=null),t(7,J=!1),t(10,Ie=u),t(5,te=null),t(6,$=n)}async function re(){return ye(m.VERIFYING),await new Promise(n=>setTimeout(n,X||0)),Kt().then(n=>(rt(n),x("challenge",n),Jt(n))).then(({data:n,solution:u})=>{if(x("solution",u),(u==null?void 0:u.number)!==void 0){if(Q)return nr(tt(n,u));t(5,te=tt(n,u)),x("payload",te)}else throw x("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."),new Error("Unexpected result returned.")}).then(()=>{Ct().then(()=>{t(6,$=m.VERIFIED),t(7,J=!0),x("verified"),Re("verified",{payload:te})})}).catch(n=>{x(n),t(6,$=m.ERROR),t(7,J=!1),t(10,Ie=n.message)})}function or(){J=this.checked,t(7,J)}function lr(n){ge[n?"unshift":"push"](()=>{ee=n,t(9,ee)})}function sr(n){ge[n?"unshift":"push"](()=>{C=n,t(8,C)})}return r.$$set=n=>{"auto"in n&&t(0,a=n.auto),"blockspam"in n&&t(29,d=n.blockspam),"challengeurl"in n&&t(15,f=n.challengeurl),"challengejson"in n&&t(30,G=n.challengejson),"debug"in n&&t(16,N=n.debug),"delay"in n&&t(17,X=n.delay),"expire"in n&&t(18,F=n.expire),"floating"in n&&t(1,k=n.floating),"floatinganchor"in n&&t(19,K=n.floatinganchor),"floatingoffset"in n&&t(20,S=n.floatingoffset),"hidefooter"in n&&t(2,q=n.hidefooter),"hidelogo"in n&&t(3,W=n.hidelogo),"name"in n&&t(4,V=n.name),"maxnumber"in n&&t(21,E=n.maxnumber),"mockerror"in n&&t(22,I=n.mockerror),"refetchonexpire"in n&&t(23,z=n.refetchonexpire),"spamfilter"in n&&t(24,y=n.spamfilter),"strings"in n&&t(31,h=n.strings),"test"in n&&t(25,v=n.test),"verifyurl"in n&&t(26,Q=n.verifyurl),"workers"in n&&t(27,ue=n.workers),"workerurl"in n&&t(28,be=n.workerurl)},r.$$.update=()=>{r.$$.dirty[0]&32768&&t(12,i=!!(f!=null&&f.includes(".altcha.org"))&&!!(f!=null&&f.includes("apiKey=ckey_"))),r.$$.dirty[0]&1073741824&&(o=G?We(G):void 0),r.$$.dirty[1]&1&&t(35,l=h?We(h):{}),r.$$.dirty[1]&16&&t(11,c={ariaLinkLabel:He,error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by ALTCHA`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...l}),r.$$.dirty[0]&96&&Re("statechange",{payload:te,state:$}),r.$$.dirty[0]&64&&er()},[a,k,q,W,V,te,$,J,C,ee,Ie,c,i,Qt,lt,f,N,X,F,K,S,E,I,z,y,v,Q,ue,be,d,G,h,at,ye,re,l,or,lr,sr]}class Ye extends Zt{constructor(e){super(),jt(this,e,Yt,Pt,ht,{auto:0,blockspam:29,challengeurl:15,challengejson:30,debug:16,delay:17,expire:18,floating:1,floatinganchor:19,floatingoffset:20,hidefooter:2,hidelogo:3,name:4,maxnumber:21,mockerror:22,refetchonexpire:23,spamfilter:24,strings:31,test:25,verifyurl:26,workers:27,workerurl:28,configure:32,reset:33,verify:34},Ut,[-1,-1,-1])}get auto(){return this.$$.ctx[0]}set auto(e){this.$$set({auto:e}),w()}get blockspam(){return this.$$.ctx[29]}set blockspam(e){this.$$set({blockspam:e}),w()}get challengeurl(){return this.$$.ctx[15]}set challengeurl(e){this.$$set({challengeurl:e}),w()}get challengejson(){return this.$$.ctx[30]}set challengejson(e){this.$$set({challengejson:e}),w()}get debug(){return this.$$.ctx[16]}set debug(e){this.$$set({debug:e}),w()}get delay(){return this.$$.ctx[17]}set delay(e){this.$$set({delay:e}),w()}get expire(){return this.$$.ctx[18]}set expire(e){this.$$set({expire:e}),w()}get floating(){return this.$$.ctx[1]}set floating(e){this.$$set({floating:e}),w()}get floatinganchor(){return this.$$.ctx[19]}set floatinganchor(e){this.$$set({floatinganchor:e}),w()}get floatingoffset(){return this.$$.ctx[20]}set floatingoffset(e){this.$$set({floatingoffset:e}),w()}get hidefooter(){return this.$$.ctx[2]}set hidefooter(e){this.$$set({hidefooter:e}),w()}get hidelogo(){return this.$$.ctx[3]}set hidelogo(e){this.$$set({hidelogo:e}),w()}get name(){return this.$$.ctx[4]}set name(e){this.$$set({name:e}),w()}get maxnumber(){return this.$$.ctx[21]}set maxnumber(e){this.$$set({maxnumber:e}),w()}get mockerror(){return this.$$.ctx[22]}set mockerror(e){this.$$set({mockerror:e}),w()}get refetchonexpire(){return this.$$.ctx[23]}set refetchonexpire(e){this.$$set({refetchonexpire:e}),w()}get spamfilter(){return this.$$.ctx[24]}set spamfilter(e){this.$$set({spamfilter:e}),w()}get strings(){return this.$$.ctx[31]}set strings(e){this.$$set({strings:e}),w()}get test(){return this.$$.ctx[25]}set test(e){this.$$set({test:e}),w()}get verifyurl(){return this.$$.ctx[26]}set verifyurl(e){this.$$set({verifyurl:e}),w()}get workers(){return this.$$.ctx[27]}set workers(e){this.$$set({workers:e}),w()}get workerurl(){return this.$$.ctx[28]}set workerurl(e){this.$$set({workerurl:e}),w()}get configure(){return this.$$.ctx[32]}get reset(){return this.$$.ctx[33]}get verify(){return this.$$.ctx[34]}}customElements.define("altcha-widget",Tt(Ye,{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)),globalThis.createAltchaWorker=r=>r?new Worker(new URL(r)):new dt,U.Altcha=Ye,Object.defineProperty(U,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist_external/altcha.d.ts b/dist_external/altcha.d.ts index fab5709..4eea955 100644 --- a/dist_external/altcha.d.ts +++ b/dist_external/altcha.d.ts @@ -3,9 +3,60 @@ export {}; declare module 'altcha'; declare global { + type AltchaState = 'error' | 'expired' | 'verified' | 'verifying' | 'unverified'; + + interface AltchaStateChangeEvent extends CustomEvent<{ + payload?: string; + state: AltchaState; + }> {} + + interface AltchaVerifiedEvent extends CustomEvent<{ + payload: string; + }> {} + + interface AltchaServerVerificationEvent extends CustomEvent> {} + + interface AltchaWidget { + auto?: 'onfocus' | 'onload' | 'onsubmit'; + blockspam?: boolean; + challengeurl?: string; + challengejson?: string; + debug?: boolean; + delay?: number; + expire?: number; + floating?: 'auto' | 'top' | 'bottom' | 'false' | '' | boolean; + floatinganchor?: string; + floatingoffset?: number; + hidefooter?: boolean; + hidelogo?: boolean; + name?: string; + maxnumber?: number; + mockerror?: boolean; + refetchonexpire?: boolean; + spamfilter?: boolean | 'ipAddress'; + strings?: string; + test?: boolean | number; + verifyurl?: string; + workers?: number; + workerurl?: string; + } + + declare namespace svelteHTML { + interface IntrinsicElements { + 'altcha-widget': AltchaWidgetSvelte; + } + + interface AltchaWidgetSvelte extends AltchaWidget { + 'on:statechange'?: (event: AltchaStateChangeEvent) => void; + 'on:serververification'?: (event: AltchaServerVerificationEvent) => void; + 'on:verified'?: (event: AltchaVerifiedEvent) => void; + style?: string; + } + } + namespace JSX { interface IntrinsicElements { - 'altcha-widget': AltchaWidget; + 'altcha-widget': AltchaWidgetReact; } interface AltchaWidgetCSSProperties extends React.CSSProperties { @@ -20,31 +71,9 @@ declare global { '--altcha-max-width'?: string; } - interface AltchaWidget extends React.HTMLAttributes { - auto?: 'onfocus' | 'onload' | 'onsubmit'; - blockspam?: boolean; - challengeurl?: string; - challengejson?: string; - debug?: boolean; - delay?: number; - expire?: number; - floating?: 'auto' | 'top' | 'bottom' | 'false' | '' | boolean; - floatinganchor?: string; - floatingoffset?: number; - hidefooter?: boolean; - hidelogo?: boolean; - name?: string; - maxnumber?: number; - mockerror?: boolean; + interface AltchaWidgetReact extends AltchaWidget extends React.HTMLAttributes { ref?: React.RefObject; - refetchonexpire?: boolean; - spamfilter?: boolean | 'ipAddress'; - strings?: string; style?: AltchaWidgetCSSProperties; - test?: boolean | number; - verifyurl?: string; - workers?: number; - workerurl?: string; } } } \ No newline at end of file diff --git a/dist_external/altcha.js b/dist_external/altcha.js index d91a5ab..0eaea2e 100644 --- a/dist_external/altcha.js +++ b/dist_external/altcha.js @@ -83,17 +83,17 @@ function At(n) { function Rt() { const n = Ie(); return (e, t, { cancelable: i = !1 } = {}) => { - const l = n.$$.callbacks[e]; - if (l) { - const o = Ct( + const o = n.$$.callbacks[e]; + if (o) { + const l = Ct( /** @type {string} */ e, t, { cancelable: i } ); - return l.slice().forEach((f) => { - f.call(n, o); - }), !o.defaultPrevented; + return o.slice().forEach((f) => { + f.call(n, l); + }), !l.defaultPrevented; } return !0; }; @@ -153,11 +153,11 @@ function Dt(n, e) { n && n.i && (Tt.delete(n), n.i(e)); } function Nt(n, e, t) { - const { fragment: i, after_update: l } = n.$$; + const { fragment: i, after_update: o } = n.$$; i && i.m(e, t), Le(() => { - const o = n.$$.on_mount.map(et).filter(tt); - n.$$.on_destroy ? n.$$.on_destroy.push(...o) : ue(o), n.$$.on_mount = []; - }), l.forEach(Le); + const l = n.$$.on_mount.map(et).filter(tt); + n.$$.on_destroy ? n.$$.on_destroy.push(...l) : ue(l), n.$$.on_mount = []; + }), o.forEach(Le); } function jt(n, e) { const t = n.$$; @@ -166,16 +166,16 @@ function jt(n, e) { function Vt(n, e) { n.$$.dirty[0] === -1 && (ne.push(n), rt(), n.$$.dirty.fill(0)), n.$$.dirty[e / 31 | 0] |= 1 << e % 31; } -function Ft(n, e, t, i, l, o, f = null, c = [-1]) { +function Ft(n, e, t, i, o, l, f = null, c = [-1]) { const h = ce; fe(n); const u = n.$$ = { fragment: null, ctx: [], // state - props: o, + props: l, update: ie, - not_equal: l, + not_equal: o, bound: qe(), // lifecycle on_mount: [], @@ -194,7 +194,7 @@ function Ft(n, e, t, i, l, o, f = null, c = [-1]) { let H = !1; if (u.ctx = t ? t(n, e.props || {}, (S, B, ...P) => { const k = P.length ? P[0] : B; - return u.ctx && l(u.ctx[S], u.ctx[S] = k) && (!u.skip_bound && u.bound[S] && u.bound[S](k), H && Vt(n, S)), B; + 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; }) : [], u.update(), H = !0, ue(u.before_update), u.fragment = i ? i(u.ctx) : !1, e.target) { if (e.hydrate) { const S = xt(e.target); @@ -231,25 +231,25 @@ typeof HTMLElement == "function" && (it = class extends HTMLElement { } addEventListener(e, t, i) { if (this.$$l[e] = this.$$l[e] || [], this.$$l[e].push(t), this.$$c) { - const l = this.$$c.$on(e, t); - this.$$l_u.set(t, l); + const o = this.$$c.$on(e, t); + this.$$l_u.set(t, o); } super.addEventListener(e, t, i); } removeEventListener(e, t, i) { if (super.removeEventListener(e, t, i), this.$$c) { - const l = this.$$l_u.get(t); - l && (l(), this.$$l_u.delete(t)); + const o = this.$$l_u.get(t); + o && (o(), this.$$l_u.delete(t)); } } async connectedCallback() { if (this.$$cn = !0, !this.$$c) { - let e = function(o) { + let e = function(l) { return () => { let f; return { c: function() { - f = M("slot"), o !== "default" && s(f, "name", o); + f = M("slot"), l !== "default" && s(f, "name", l); }, /** * @param {HTMLElement} target @@ -267,14 +267,14 @@ typeof HTMLElement == "function" && (it = class extends HTMLElement { if (await Promise.resolve(), !this.$$cn || this.$$c) return; const t = {}, i = Lt(this); - for (const o of this.$$s) - o in i && (t[o] = [e(o)]); - for (const o of this.attributes) { - const f = this.$$g_p(o.name); - f in this.$$d || (this.$$d[f] = _e(f, o.value, this.$$p_d, "toProp")); + for (const l of this.$$s) + l in i && (t[l] = [e(l)]); + for (const l of this.attributes) { + const f = this.$$g_p(l.name); + f in this.$$d || (this.$$d[f] = _e(f, l.value, this.$$p_d, "toProp")); } - for (const o in this.$$p_d) - !(o in this.$$d) && this[o] !== void 0 && (this.$$d[o] = this[o], delete this[o]); + for (const l in this.$$p_d) + !(l in this.$$d) && this[l] !== void 0 && (this.$$d[l] = this[l], delete this[l]); this.$$c = new this.$$ctor({ target: this.shadowRoot || this, props: { @@ -285,24 +285,24 @@ typeof HTMLElement == "function" && (it = class extends HTMLElement { } } }); - const l = () => { + const o = () => { this.$$r = !0; - for (const o in this.$$p_d) - if (this.$$d[o] = this.$$c.$$.ctx[this.$$c.$$.props[o]], this.$$p_d[o].reflect) { + for (const l in this.$$p_d) + if (this.$$d[l] = this.$$c.$$.ctx[this.$$c.$$.props[l]], this.$$p_d[l].reflect) { const f = _e( - o, - this.$$d[o], + l, + this.$$d[l], this.$$p_d, "toAttribute" ); - f == null ? this.removeAttribute(this.$$p_d[o].attribute || o) : this.setAttribute(this.$$p_d[o].attribute || o, f); + f == null ? this.removeAttribute(this.$$p_d[l].attribute || l) : this.setAttribute(this.$$p_d[l].attribute || l, f); } this.$$r = !1; }; - this.$$c.$$.after_update.push(l), l(); - for (const o in this.$$l) - for (const f of this.$$l[o]) { - const c = this.$$c.$on(o, f); + this.$$c.$$.after_update.push(o), o(); + for (const l in this.$$l) + for (const f of this.$$l[l]) { + const c = this.$$c.$on(l, f); this.$$l_u.set(f, c); } this.$$l = {}; @@ -311,12 +311,12 @@ typeof HTMLElement == "function" && (it = class extends HTMLElement { // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte // and setting attributes through setAttribute etc, this is helpful attributeChangedCallback(e, t, i) { - var l; - this.$$r || (e = this.$$g_p(e), this.$$d[e] = _e(e, i, this.$$p_d, "toProp"), (l = this.$$c) == null || l.$set({ [e]: this.$$d[e] })); + var o; + 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] })); } disconnectedCallback() { this.$$cn = !1, Promise.resolve().then(() => { - this.$$cn || (this.$$c.$destroy(), this.$$c = void 0); + !this.$$cn && this.$$c && (this.$$c.$destroy(), this.$$c = void 0); }); } $$g_p(e) { @@ -326,12 +326,12 @@ typeof HTMLElement == "function" && (it = class extends HTMLElement { } }); function _e(n, e, t, i) { - var o; - const l = (o = t[n]) == null ? void 0 : o.type; - if (e = l === "Boolean" && typeof e != "boolean" ? e != null : e, !i || !t[n]) + var l; + const o = (l = t[n]) == null ? void 0 : l.type; + if (e = o === "Boolean" && typeof e != "boolean" ? e != null : e, !i || !t[n]) return e; if (i === "toAttribute") - switch (l) { + switch (o) { case "Object": case "Array": return e == null ? null : JSON.stringify(e); @@ -343,7 +343,7 @@ function _e(n, e, t, i) { return e; } else - switch (l) { + switch (o) { case "Object": case "Array": return e && JSON.parse(e); @@ -355,10 +355,10 @@ function _e(n, e, t, i) { return e; } } -function Pt(n, e, t, i, l, o) { +function Pt(n, e, t, i, o, l) { let f = class extends it { constructor() { - super(n, t, l), this.$$p_d = e; + super(n, t, o), this.$$p_d = e; } static get observedAttributes() { return Object.keys(e).map( @@ -383,7 +383,7 @@ function Pt(n, e, t, i, l, o) { return (h = this.$$c) == null ? void 0 : h[c]; } }); - }), o && (f = o(f)), n.element = /** @type {any} */ + }), n.element = /** @type {any} */ f, f; } class Ht { @@ -420,8 +420,8 @@ class Ht { return ie; const i = this.$$.callbacks[e] || (this.$$.callbacks[e] = []); return i.push(t), () => { - const l = i.indexOf(t); - l !== -1 && i.splice(l, 1); + const o = i.indexOf(t); + o !== -1 && i.splice(o, 1); }; } /** @@ -441,10 +441,10 @@ function Ut(n) { async function qt(n, e = "SHA-256", t = 1e5) { const i = Date.now().toString(16); n || (n = Math.round(Math.random() * t)); - const l = await ot(i, n, e); + const o = await ot(i, n, e); return { algorithm: e, - challenge: l, + challenge: o, salt: i, signature: "" }; @@ -457,12 +457,12 @@ async function ot(n, e, t) { ) ); } -function Zt(n, e, t = "SHA-256", i = 1e6, l = 0) { - const o = new AbortController(), f = Date.now(); +function Zt(n, e, t = "SHA-256", i = 1e6, o = 0) { + const l = new AbortController(), f = Date.now(); return { promise: (async () => { - for (let h = l; h <= i; h += 1) { - if (o.signal.aborted) + for (let h = o; h <= i; h += 1) { + if (l.signal.aborted) return null; if (await ot(e, h, t) === n) return { @@ -472,7 +472,7 @@ function Zt(n, e, t = "SHA-256", i = 1e6, l = 0) { } return null; })(), - controller: o + controller: l }; } var b = /* @__PURE__ */ ((n) => (n.ERROR = "error", n.VERIFIED = "verified", n.VERIFYING = "verifying", n.UNVERIFIED = "unverified", n.EXPIRED = "expired", n))(b || {}); @@ -482,11 +482,11 @@ function Ge(n) { c() { 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"); }, - m(l, o) { - F(l, e, o), p(e, t), p(e, i); + m(o, l) { + F(o, e, l), p(e, t), p(e, i); }, - d(l) { - l && D(e); + d(o) { + o && D(e); } }; } @@ -500,18 +500,18 @@ function Yt(n) { e = M("label"), s(e, "for", i = /*name*/ n[4] + "_checkbox"); }, - m(l, o) { - F(l, e, o), e.innerHTML = t; + m(o, l) { + F(o, e, l), e.innerHTML = t; }, - p(l, o) { - o[0] & /*_strings*/ + p(o, l) { + l[0] & /*_strings*/ 2048 && t !== (t = /*_strings*/ - l[11].label + "") && (e.innerHTML = t), o[0] & /*name*/ + o[11].label + "") && (e.innerHTML = t), l[0] & /*name*/ 16 && i !== (i = /*name*/ - l[4] + "_checkbox") && s(e, "for", i); + o[4] + "_checkbox") && s(e, "for", i); }, - d(l) { - l && D(e); + d(o) { + o && D(e); } }; } @@ -524,11 +524,11 @@ function Gt(n) { c() { e = M("span"); }, - m(i, l) { - F(i, e, l), e.innerHTML = t; + m(i, o) { + F(i, e, o), e.innerHTML = t; }, - p(i, l) { - l[0] & /*_strings*/ + p(i, o) { + o[0] & /*_strings*/ 2048 && t !== (t = /*_strings*/ i[11].verifying + "") && (e.innerHTML = t); }, @@ -541,47 +541,47 @@ function Wt(n) { let e, t = ( /*_strings*/ n[11].verified + "" - ), i, l; + ), i, o; return { c() { - e = M("span"), i = X(), l = M("input"), s(l, "type", "hidden"), s( - l, + e = M("span"), i = X(), o = M("input"), s(o, "type", "hidden"), s( + o, "name", /*name*/ n[4] - ), l.value = /*payload*/ + ), o.value = /*payload*/ n[5]; }, - m(o, f) { - F(o, e, f), e.innerHTML = t, F(o, i, f), F(o, l, f); + m(l, f) { + F(l, e, f), e.innerHTML = t, F(l, i, f), F(l, o, f); }, - p(o, f) { + p(l, f) { f[0] & /*_strings*/ 2048 && t !== (t = /*_strings*/ - o[11].verified + "") && (e.innerHTML = t), f[0] & /*name*/ + l[11].verified + "") && (e.innerHTML = t), f[0] & /*name*/ 16 && s( - l, + o, "name", /*name*/ - o[4] + l[4] ), f[0] & /*payload*/ - 32 && (l.value = /*payload*/ - o[5]); + 32 && (o.value = /*payload*/ + l[5]); }, - d(o) { - o && (D(e), D(i), D(l)); + d(l) { + l && (D(e), D(i), D(o)); } }; } function We(n) { - let e, t, i, l, o, f, c; + let e, t, i, o, l, f, c; return { c() { - e = M("div"), t = M("a"), i = Y("svg"), l = Y("path"), o = Y("path"), f = Y("path"), s(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"), s(l, "fill", "currentColor"), s(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"), s(o, "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*/ + 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*/ n[11].ariaLinkLabel); }, m(h, u) { - F(h, e, u), p(e, t), p(t, i), p(i, l), p(i, o), p(i, f); + F(h, e, u), p(e, t), p(t, i), p(i, o), p(i, l), p(i, f); }, p(h, u) { u[0] & /*_strings*/ @@ -594,23 +594,23 @@ function We(n) { }; } function Xe(n) { - let e, t, i, l; - function o(h, u) { + let e, t, i, o; + function l(h, u) { return ( /*state*/ h[6] === b.EXPIRED ? Jt : Xt ); } - let f = o(n), c = f(n); + let f = l(n), c = f(n); return { c() { - e = M("div"), t = Y("svg"), i = Y("path"), l = 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"); + 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"); }, m(h, u) { - F(h, e, u), p(e, t), p(t, i), p(e, l), c.m(e, null); + F(h, e, u), p(e, t), p(t, i), p(e, o), c.m(e, null); }, p(h, u) { - f === (f = o(h)) && c ? c.p(h, u) : (c.d(1), c = f(h), c && (c.c(), c.m(e, null))); + f === (f = l(h)) && c ? c.p(h, u) : (c.d(1), c = f(h), c && (c.c(), c.m(e, null))); }, d(h) { h && D(e), c.d(); @@ -631,13 +631,13 @@ function Xt(n) { n[10] ); }, - m(i, l) { - F(i, e, l), e.innerHTML = t; + m(i, o) { + F(i, e, o), e.innerHTML = t; }, - p(i, l) { - l[0] & /*_strings*/ + p(i, o) { + o[0] & /*_strings*/ 2048 && t !== (t = /*_strings*/ - i[11].error + "") && (e.innerHTML = t), l[0] & /*error*/ + i[11].error + "") && (e.innerHTML = t), o[0] & /*error*/ 1024 && s( e, "title", @@ -664,13 +664,13 @@ function Jt(n) { n[10] ); }, - m(i, l) { - F(i, e, l), e.innerHTML = t; + m(i, o) { + F(i, e, o), e.innerHTML = t; }, - p(i, l) { - l[0] & /*_strings*/ + p(i, o) { + o[0] & /*_strings*/ 2048 && t !== (t = /*_strings*/ - i[11].expired + "") && (e.innerHTML = t), l[0] & /*error*/ + i[11].expired + "") && (e.innerHTML = t), o[0] & /*error*/ 1024 && s( e, "title", @@ -692,16 +692,16 @@ function Je(n) { c() { e = M("div"), t = M("div"), s(e, "class", "altcha-footer"); }, - m(l, o) { - F(l, e, o), p(e, t), t.innerHTML = i; + m(o, l) { + F(o, e, l), p(e, t), t.innerHTML = i; }, - p(l, o) { - o[0] & /*_strings*/ + p(o, l) { + l[0] & /*_strings*/ 2048 && i !== (i = /*_strings*/ - l[11].footer + "") && (t.innerHTML = i); + o[11].footer + "") && (t.innerHTML = i); }, - d(l) { - l && D(e); + d(o) { + o && D(e); } }; } @@ -721,7 +721,7 @@ function ze(n) { }; } function zt(n) { - let e, t, i, l, o, f, c, h, u, H, S, B, P, k, G, $ = ( + let e, t, i, o, l, f, c, h, u, H, S, B, P, k, G, $ = ( /*state*/ n[6] === b.VERIFYING && Ge() ); @@ -753,10 +753,10 @@ function zt(n) { ); return { c() { - e = M("div"), t = M("div"), $ && $.c(), i = X(), l = M("div"), o = 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(o, "type", "checkbox"), s(o, "id", f = /*name*/ - n[4] + "_checkbox"), o.required = c = /*auto*/ - n[0] !== "onsubmit", s(l, "class", "altcha-checkbox"), Ze( - l, + 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*/ + n[4] + "_checkbox"), l.required = c = /*auto*/ + n[0] !== "onsubmit", s(o, "class", "altcha-checkbox"), Ze( + o, "altcha-hidden", /*state*/ n[6] === b.VERIFYING @@ -773,22 +773,22 @@ function zt(n) { ); }, m(d, _) { - F(d, e, _), p(e, t), $ && $.m(t, null), p(t, i), p(t, l), p(l, o), o.checked = /*checked*/ + F(d, e, _), p(e, t), $ && $.m(t, null), p(t, i), p(t, o), p(o, l), l.checked = /*checked*/ 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 = [ pe( - o, + l, "change", /*input_change_handler*/ n[36] ), pe( - o, + l, "change", /*onCheckedChange*/ n[13] ), pe( - o, + l, "invalid", /*onInvalid*/ n[14] @@ -799,13 +799,13 @@ function zt(n) { /*state*/ d[6] === b.VERIFYING ? $ || ($ = Ge(), $.c(), $.m(t, i)) : $ && ($.d(1), $ = null), _[0] & /*name*/ 16 && f !== (f = /*name*/ - d[4] + "_checkbox") && s(o, "id", f), _[0] & /*auto*/ + d[4] + "_checkbox") && s(l, "id", f), _[0] & /*auto*/ 1 && c !== (c = /*auto*/ - d[0] !== "onsubmit") && (o.required = c), _[0] & /*checked*/ - 128 && (o.checked = /*checked*/ + d[0] !== "onsubmit") && (l.required = c), _[0] & /*checked*/ + 128 && (l.checked = /*checked*/ d[7]), _[0] & /*state*/ 64 && Ze( - l, + o, "altcha-hidden", /*state*/ d[6] === b.VERIFYING @@ -850,13 +850,13 @@ function Kt() { } function Qt(n, e, t) { var Be, Ue; - let i, l, o, 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; + 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; 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]; let W = !1, C, K = null, he = null, m = null, ve = null, Q = null, j = b.UNVERIFIED, U = null; At(() => { 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); }), It(() => { - E("mounted", "0.6.6"), 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."); + 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."); }); function E(...r) { (S || r.some((a) => a instanceof Error)) && console[r[0] instanceof Error ? "error" : "log"]("ALTCHA", ...r); @@ -899,8 +899,8 @@ function Qt(n, e, t) { var r; if (I) throw E("mocking error"), new Error("Mocked error."); - if (l) - return E("using provided json data"), l; + if (o) + return E("using provided json data"), o; if (_) return E("generating test challenge", { test: _ }), qt(typeof _ != "boolean" ? +_ : void 0); { @@ -1085,7 +1085,7 @@ function Qt(n, e, t) { E("unable to find floating anchor element"); } function Oe(r) { - 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), l = 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, o = 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); + 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); } function ge(r = b.UNVERIFIED, a = null) { U && (clearTimeout(U), U = null), t(7, W = !1), t(10, ve = a), t(5, Q = null), t(6, j = r); @@ -1124,18 +1124,18 @@ function Qt(n, e, t) { }, n.$$.update = () => { n.$$.dirty[0] & /*challengeurl*/ 32768 && t(12, i = !!(u != null && u.includes(".altcha.org")) && !!(u != null && u.includes("apiKey=ckey_"))), n.$$.dirty[0] & /*challengejson*/ - 1073741824 && (l = H ? Qe(H) : void 0), n.$$.dirty[1] & /*strings*/ - 1 && t(35, o = d ? Qe(d) : {}), n.$$.dirty[1] & /*parsedStrings*/ + 1073741824 && (o = H ? Qe(H) : void 0), n.$$.dirty[1] & /*strings*/ + 1 && t(35, l = d ? Qe(d) : {}), n.$$.dirty[1] & /*parsedStrings*/ 16 && t(11, f = { ariaLinkLabel: Ke, error: "Verification failed. Try again later.", expired: "Verification expired. Try again.", - footer: `Protected by ALTCHA`, + footer: `Protected by ALTCHA`, label: "I'm not a robot", verified: "Verified", verifying: "Verifying...", waitAlert: "Verifying... please wait.", - ...o + ...l }), n.$$.dirty[0] & /*payload, state*/ 96 && ye("statechange", { payload: Q, state: j }), n.$$.dirty[0] & /*state*/ 64 && at(); @@ -1175,7 +1175,7 @@ function Qt(n, e, t) { Oe, ge, ee, - o, + l, bt, _t, wt diff --git a/dist_external/altcha.umd.cjs b/dist_external/altcha.umd.cjs index 33ab10e..d5972dc 100644 --- a/dist_external/altcha.umd.cjs +++ b/dist_external/altcha.umd.cjs @@ -1,2 +1,2 @@ -(function(O,D){typeof exports=="object"&&typeof module<"u"?D(exports):typeof define=="function"&&define.amd?define(["exports"],D):(O=typeof globalThis<"u"?globalThis:O||self,D(O.altcha={}))})(this,function(O){"use strict";var tn=Object.defineProperty;var nn=(O,D,q)=>D in O?tn(O,D,{enumerable:!0,configurable:!0,writable:!0,value:q}):O[D]=q;var U=(O,D,q)=>nn(O,typeof D!="symbol"?D+"":D,q);var D=typeof document<"u"?document.currentScript:null;function q(){}function Se(n){return n()}function $e(){return Object.create(null)}function se(n){n.forEach(Se)}function Te(n){return typeof n=="function"}function ut(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function at(n){return Object.keys(n).length===0}function k(n,e){n.appendChild(e)}function N(n,e,t){n.insertBefore(e,t||null)}function j(n){n.parentNode&&n.parentNode.removeChild(n)}function S(n){return document.createElement(n)}function W(n){return document.createElementNS("http://www.w3.org/2000/svg",n)}function ht(n){return document.createTextNode(n)}function J(){return ht(" ")}function ke(n,e,t,r){return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}function s(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function dt(n){return Array.from(n.childNodes)}function Me(n,e,t){n.classList.toggle(e,!!t)}function gt(n,e,{bubbles:t=!1,cancelable:r=!1}={}){return new CustomEvent(n,{detail:e,bubbles:t,cancelable:r})}function mt(n){const e={};return n.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let fe;function ce(n){fe=n}function pe(){if(!fe)throw new Error("Function called outside component initialization");return fe}function bt(n){pe().$$.on_mount.push(n)}function _t(n){pe().$$.on_destroy.push(n)}function wt(){const n=pe();return(e,t,{cancelable:r=!1}={})=>{const l=n.$$.callbacks[e];if(l){const o=gt(e,t,{cancelable:r});return l.slice().forEach(f=>{f.call(n,o)}),!o.defaultPrevented}return!0}}const re=[],de=[];let oe=[];const je=[],De=Promise.resolve();let Ee=!1;function Ne(){Ee||(Ee=!0,De.then(w))}function yt(){return Ne(),De}function xe(n){oe.push(n)}const Ce=new Set;let le=0;function w(){if(le!==0)return;const n=fe;do{try{for(;len.indexOf(r)===-1?e.push(r):t.push(r)),t.forEach(r=>r()),oe=e}const pt=new Set;function Et(n,e){n&&n.i&&(pt.delete(n),n.i(e))}function xt(n,e,t){const{fragment:r,after_update:l}=n.$$;r&&r.m(e,t),xe(()=>{const o=n.$$.on_mount.map(Se).filter(Te);n.$$.on_destroy?n.$$.on_destroy.push(...o):se(o),n.$$.on_mount=[]}),l.forEach(xe)}function Ct(n,e){const t=n.$$;t.fragment!==null&&(kt(t.after_update),se(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Lt(n,e){n.$$.dirty[0]===-1&&(re.push(n),Ne(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<{const p=H.length?H[0]:Z;return u.ctx&&l(u.ctx[T],u.ctx[T]=p)&&(!u.skip_bound&&u.bound[T]&&u.bound[T](p),B&&Lt(n,T)),Z}):[],u.update(),B=!0,se(u.before_update),u.fragment=r?r(u.ctx):!1,e.target){if(e.hydrate){const T=dt(e.target);u.fragment&&u.fragment.l(T),T.forEach(j)}else u.fragment&&u.fragment.c();e.intro&&Et(n.$$.fragment),xt(n,e.target,e.anchor),w()}ce(h)}let Ve;typeof HTMLElement=="function"&&(Ve=class extends HTMLElement{constructor(e,t,r){super();U(this,"$$ctor");U(this,"$$s");U(this,"$$c");U(this,"$$cn",!1);U(this,"$$d",{});U(this,"$$r",!1);U(this,"$$p_d",{});U(this,"$$l",{});U(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,r&&this.attachShadow({mode:"open"})}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const l=this.$$c.$on(e,t);this.$$l_u.set(t,l)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){const l=this.$$l_u.get(t);l&&(l(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(o){return()=>{let f;return{c:function(){f=S("slot"),o!=="default"&&s(f,"name",o)},m:function(u,B){N(u,f,B)},d:function(u){u&&j(f)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},r=mt(this);for(const o of this.$$s)o in r&&(t[o]=[e(o)]);for(const o of this.attributes){const f=this.$$g_p(o.name);f in this.$$d||(this.$$d[f]=ge(f,o.value,this.$$p_d,"toProp"))}for(const o in this.$$p_d)!(o in this.$$d)&&this[o]!==void 0&&(this.$$d[o]=this[o],delete this[o]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$scope:{ctx:[]}}});const l=()=>{this.$$r=!0;for(const o in this.$$p_d)if(this.$$d[o]=this.$$c.$$.ctx[this.$$c.$$.props[o]],this.$$p_d[o].reflect){const f=ge(o,this.$$d[o],this.$$p_d,"toAttribute");f==null?this.removeAttribute(this.$$p_d[o].attribute||o):this.setAttribute(this.$$p_d[o].attribute||o,f)}this.$$r=!1};this.$$c.$$.after_update.push(l),l();for(const o in this.$$l)for(const f of this.$$l[o]){const c=this.$$c.$on(o,f);this.$$l_u.set(f,c)}this.$$l={}}}attributeChangedCallback(e,t,r){var l;this.$$r||(e=this.$$g_p(e),this.$$d[e]=ge(e,r,this.$$p_d,"toProp"),(l=this.$$c)==null||l.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function ge(n,e,t,r){var o;const l=(o=t[n])==null?void 0:o.type;if(e=l==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!t[n])return e;if(r==="toAttribute")switch(l){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(l){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function At(n,e,t,r,l,o){let f=class extends Ve{constructor(){super(n,t,l),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(c=>(e[c].attribute||c).toLowerCase())}};return Object.keys(e).forEach(c=>{Object.defineProperty(f.prototype,c,{get(){return this.$$c&&c in this.$$c?this.$$c[c]:this.$$d[c]},set(h){var u;h=ge(c,h,e),this.$$d[c]=h,(u=this.$$c)==null||u.$set({[c]:h})}})}),r.forEach(c=>{Object.defineProperty(f.prototype,c,{get(){var h;return(h=this.$$c)==null?void 0:h[c]}})}),o&&(f=o(f)),n.element=f,f}class Rt{constructor(){U(this,"$$");U(this,"$$set")}$destroy(){Ct(this,1),this.$destroy=q}$on(e,t){if(!Te(t))return q;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(t),()=>{const l=r.indexOf(t);l!==-1&&r.splice(l,1)}}$set(e){this.$$set&&!at(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const St="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(St);const $t=new TextEncoder;function Tt(n){return[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function Mt(n,e="SHA-256",t=1e5){const r=Date.now().toString(16);n||(n=Math.round(Math.random()*t));const l=await Fe(r,n,e);return{algorithm:e,challenge:l,salt:r,signature:""}}async function Fe(n,e,t){return Tt(await crypto.subtle.digest(t.toUpperCase(),$t.encode(n+e)))}function jt(n,e,t="SHA-256",r=1e6,l=0){const o=new AbortController,f=Date.now();return{promise:(async()=>{for(let h=l;h<=r;h+=1){if(o.signal.aborted)return null;if(await Fe(e,h,t)===n)return{number:h,took:Date.now()-f}}return null})(),controller:o}}var m=(n=>(n.ERROR="error",n.VERIFIED="verified",n.VERIFYING="verifying",n.UNVERIFIED="unverified",n.EXPIRED="expired",n))(m||{});function Pe(n){let e,t,r;return{c(){e=W("svg"),t=W("path"),r=W("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(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"),s(r,"fill","currentColor"),s(r,"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")},m(l,o){N(l,e,o),k(e,t),k(e,r)},d(l){l&&j(e)}}}function Dt(n){let e,t=n[11].label+"",r;return{c(){e=S("label"),s(e,"for",r=n[4]+"_checkbox")},m(l,o){N(l,e,o),e.innerHTML=t},p(l,o){o[0]&2048&&t!==(t=l[11].label+"")&&(e.innerHTML=t),o[0]&16&&r!==(r=l[4]+"_checkbox")&&s(e,"for",r)},d(l){l&&j(e)}}}function Nt(n){let e,t=n[11].verifying+"";return{c(){e=S("span")},m(r,l){N(r,e,l),e.innerHTML=t},p(r,l){l[0]&2048&&t!==(t=r[11].verifying+"")&&(e.innerHTML=t)},d(r){r&&j(e)}}}function Vt(n){let e,t=n[11].verified+"",r,l;return{c(){e=S("span"),r=J(),l=S("input"),s(l,"type","hidden"),s(l,"name",n[4]),l.value=n[5]},m(o,f){N(o,e,f),e.innerHTML=t,N(o,r,f),N(o,l,f)},p(o,f){f[0]&2048&&t!==(t=o[11].verified+"")&&(e.innerHTML=t),f[0]&16&&s(l,"name",o[4]),f[0]&32&&(l.value=o[5])},d(o){o&&(j(e),j(r),j(l))}}}function He(n){let e,t,r,l,o,f,c;return{c(){e=S("div"),t=S("a"),r=W("svg"),l=W("path"),o=W("path"),f=W("path"),s(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"),s(l,"fill","currentColor"),s(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"),s(o,"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(r,"width","22"),s(r,"height","22"),s(r,"viewBox","0 0 20 20"),s(r,"fill","none"),s(r,"xmlns","http://www.w3.org/2000/svg"),s(t,"href",Ze),s(t,"target","_blank"),s(t,"class","altcha-logo"),s(t,"aria-label",c=n[11].ariaLinkLabel)},m(h,u){N(h,e,u),k(e,t),k(t,r),k(r,l),k(r,o),k(r,f)},p(h,u){u[0]&2048&&c!==(c=h[11].ariaLinkLabel)&&s(t,"aria-label",c)},d(h){h&&j(e)}}}function Oe(n){let e,t,r,l;function o(h,u){return h[6]===m.EXPIRED?Pt:Ft}let f=o(n),c=f(n);return{c(){e=S("div"),t=W("svg"),r=W("path"),l=J(),c.c(),s(r,"stroke-linecap","round"),s(r,"stroke-linejoin","round"),s(r,"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")},m(h,u){N(h,e,u),k(e,t),k(t,r),k(e,l),c.m(e,null)},p(h,u){f===(f=o(h))&&c?c.p(h,u):(c.d(1),c=f(h),c&&(c.c(),c.m(e,null)))},d(h){h&&j(e),c.d()}}}function Ft(n){let e,t=n[11].error+"";return{c(){e=S("div"),s(e,"title",n[10])},m(r,l){N(r,e,l),e.innerHTML=t},p(r,l){l[0]&2048&&t!==(t=r[11].error+"")&&(e.innerHTML=t),l[0]&1024&&s(e,"title",r[10])},d(r){r&&j(e)}}}function Pt(n){let e,t=n[11].expired+"";return{c(){e=S("div"),s(e,"title",n[10])},m(r,l){N(r,e,l),e.innerHTML=t},p(r,l){l[0]&2048&&t!==(t=r[11].expired+"")&&(e.innerHTML=t),l[0]&1024&&s(e,"title",r[10])},d(r){r&&j(e)}}}function Be(n){let e,t,r=n[11].footer+"";return{c(){e=S("div"),t=S("div"),s(e,"class","altcha-footer")},m(l,o){N(l,e,o),k(e,t),t.innerHTML=r},p(l,o){o[0]&2048&&r!==(r=l[11].footer+"")&&(t.innerHTML=r)},d(l){l&&j(e)}}}function Ue(n){let e;return{c(){e=S("div"),s(e,"class","altcha-anchor-arrow")},m(t,r){N(t,e,r),n[37](e)},p:q,d(t){t&&j(e),n[37](null)}}}function Ht(n){let e,t,r,l,o,f,c,h,u,B,T,Z,H,p,z,$=n[6]===m.VERIFYING&&Pe();function Q(d,_){return d[6]===m.VERIFIED?Vt:d[6]===m.VERIFYING?Nt:Dt}let X=Q(n),V=X(n),x=(n[3]!==!0||n[12])&&He(n),I=(n[10]||n[6]===m.EXPIRED)&&Oe(n),A=n[11].footer&&(n[2]!==!0||n[12])&&Be(n),y=n[1]&&Ue(n);return{c(){e=S("div"),t=S("div"),$&&$.c(),r=J(),l=S("div"),o=S("input"),h=J(),u=S("div"),V.c(),B=J(),x&&x.c(),T=J(),I&&I.c(),Z=J(),A&&A.c(),H=J(),y&&y.c(),s(o,"type","checkbox"),s(o,"id",f=n[4]+"_checkbox"),o.required=c=n[0]!=="onsubmit",s(l,"class","altcha-checkbox"),Me(l,"altcha-hidden",n[6]===m.VERIFYING),s(u,"class","altcha-label"),s(t,"class","altcha-main"),s(e,"class","altcha"),s(e,"data-state",n[6]),s(e,"data-floating",n[1])},m(d,_){N(d,e,_),k(e,t),$&&$.m(t,null),k(t,r),k(t,l),k(l,o),o.checked=n[7],k(t,h),k(t,u),V.m(u,null),k(t,B),x&&x.m(t,null),k(e,T),I&&I.m(e,null),k(e,Z),A&&A.m(e,null),k(e,H),y&&y.m(e,null),n[38](e),p||(z=[ke(o,"change",n[36]),ke(o,"change",n[13]),ke(o,"invalid",n[14])],p=!0)},p(d,_){d[6]===m.VERIFYING?$||($=Pe(),$.c(),$.m(t,r)):$&&($.d(1),$=null),_[0]&16&&f!==(f=d[4]+"_checkbox")&&s(o,"id",f),_[0]&1&&c!==(c=d[0]!=="onsubmit")&&(o.required=c),_[0]&128&&(o.checked=d[7]),_[0]&64&&Me(l,"altcha-hidden",d[6]===m.VERIFYING),X===(X=Q(d))&&V?V.p(d,_):(V.d(1),V=X(d),V&&(V.c(),V.m(u,null))),d[3]!==!0||d[12]?x?x.p(d,_):(x=He(d),x.c(),x.m(t,null)):x&&(x.d(1),x=null),d[10]||d[6]===m.EXPIRED?I?I.p(d,_):(I=Oe(d),I.c(),I.m(e,Z)):I&&(I.d(1),I=null),d[11].footer&&(d[2]!==!0||d[12])?A?A.p(d,_):(A=Be(d),A.c(),A.m(e,H)):A&&(A.d(1),A=null),d[1]?y?y.p(d,_):(y=Ue(d),y.c(),y.m(e,null)):y&&(y.d(1),y=null),_[0]&64&&s(e,"data-state",d[6]),_[0]&2&&s(e,"data-floating",d[1])},i:q,o:q,d(d){d&&j(e),$&&$.d(),V.d(),x&&x.d(),I&&I.d(),A&&A.d(),y&&y.d(),n[38](null),p=!1,se(z)}}}const qe="Visit Altcha.org",Ze="https://altcha.org/";function Ye(n){return JSON.parse(n)}function Ot(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Bt(n,e,t){var ft,ct;let r,l,o,f,{auto:c=void 0}=e,{blockspam:h=void 0}=e,{challengeurl:u=void 0}=e,{challengejson:B=void 0}=e,{debug:T=!1}=e,{delay:Z=0}=e,{expire:H=void 0}=e,{floating:p=void 0}=e,{floatinganchor:z=void 0}=e,{floatingoffset:$=void 0}=e,{hidefooter:Q=!1}=e,{hidelogo:X=!1}=e,{name:V="altcha"}=e,{maxnumber:x=1e6}=e,{mockerror:I=!1}=e,{refetchonexpire:A=!0}=e,{spamfilter:y=!1}=e,{strings:d=void 0}=e,{test:_=!1}=e,{verifyurl:ee=void 0}=e,{workers:ue=Math.min(16,navigator.hardwareConcurrency||8)}=e,{workerurl:me=void 0}=e;const Le=wt(),We=["SHA-256","SHA-384","SHA-512"],Xe=(ct=(ft=document.documentElement.lang)==null?void 0:ft.split("-"))==null?void 0:ct[0];let K=!1,C,te=null,be=null,b=null,Ie=null,ne=null,F=m.UNVERIFIED,Y=null;_t(()=>{b&&(b.removeEventListener("submit",ze),b.removeEventListener("reset",Ke),b.removeEventListener("focusin",Je),b=null),Y&&(clearTimeout(Y),Y=null),document.removeEventListener("click",nt),document.removeEventListener("scroll",it),window.removeEventListener("resize",ot)}),bt(()=>{E("mounted","0.6.6"),E("workers",ue),_&&E("using test mode"),H&&_e(H),c!==void 0&&E("auto",c),p!==void 0&<(p),b=C.closest("form"),b&&(b.addEventListener("submit",ze,{capture:!0}),b.addEventListener("reset",Ke),c==="onfocus"&&b.addEventListener("focusin",Je)),c==="onload"&&ie(),r&&(Q||X)&&E("Attributes hidefooter and hidelogo ignored because usage with free API Keys require attribution.")});function E(...i){(T||i.some(a=>a instanceof Error))&&console[i[0]instanceof Error?"error":"log"]("ALTCHA",...i)}function Je(i){F===m.UNVERIFIED&&ie()}function ze(i){b&&c==="onsubmit"&&(F===m.UNVERIFIED?(i.preventDefault(),i.stopPropagation(),ie().then(()=>{b==null||b.requestSubmit()})):F!==m.VERIFIED&&(i.preventDefault(),i.stopPropagation(),F===m.VERIFYING&&rt()))}function Ke(){we()}function Qe(i,a){return btoa(JSON.stringify({algorithm:i.algorithm,challenge:i.challenge,number:a.number,salt:i.salt,signature:i.signature,test:_?!0:void 0,took:a.took}))}function et(i){if(!i.algorithm)throw new Error("Invalid challenge. Property algorithm is missing.");if(i.signature===void 0)throw new Error("Invalid challenge. Property signature is missing.");if(!We.includes(i.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${We.join(", ")}`);if(!i.challenge||i.challenge.length<40)throw new Error("Challenge is too short. Min. 40 chars.");if(!i.salt||i.salt.length<10)throw new Error("Salt is too short. Min. 10 chars.")}async function Ut(){var i;if(I)throw E("mocking error"),new Error("Mocked error.");if(l)return E("using provided json data"),l;if(_)return E("generating test challenge",{test:_}),Mt(typeof _!="boolean"?+_:void 0);{if(!u)throw new Error("Attribute challengeurl not set.");E("fetching challenge from",u);const a=await fetch(u,{headers:{"x-altcha-spam-filter":y?"1":"0"}});if(a.status!==200)throw new Error(`Server responded with ${a.status}.`);const g=a.headers.get("Expires"),R=a.headers.get("X-Altcha-Config"),P=await a.json(),M=new URLSearchParams((i=P.salt.split("?"))==null?void 0:i[1]),G=M.get("expires")||M.get("expire");if(G){const v=new Date(+G*1e3),L=isNaN(v.getTime())?0:v.getTime()-Date.now();L>0&&_e(L)}if(R)try{const v=JSON.parse(R);v&&typeof v=="object"&&(v.verifyurl&&(v.verifyurl=new URL(v.verifyurl,new URL(u)).toString()),st(v))}catch(v){E("unable to configure from X-Altcha-Config",v)}if(!H&&(g!=null&&g.length)){const v=Date.parse(g);if(v){const L=v-Date.now();L>0&&_e(L)}}return P}}function tt(){u&&A&&F===m.VERIFIED?ie():we(m.EXPIRED,f.expired)}async function qt(i){let a=null;if("Worker"in window){try{a=await Zt(i.challenge,i.salt,i.algorithm,i.maxnumber)}catch(g){E(g)}if((a==null?void 0:a.number)!==void 0)return{data:i,solution:a}}return{data:i,solution:await jt(i.challenge,i.salt,i.algorithm,i.maxnumber||x).promise}}async function Zt(i,a,g,R=typeof _=="number"?_:x,P=Math.ceil(ue)){const M=[];P=Math.min(16,Math.max(1,P));for(let L=0;L{const ae=Re*G;return new Promise(ye=>{L.addEventListener("message",ve=>{if(ve.data)for(const he of M)he!==L&&he.postMessage({type:"abort"});ye(ve.data)}),L.postMessage({payload:{alg:g,challenge:i,max:ae+G,salt:a,start:ae},type:"work"})})}));for(const L of M)L.terminate();return v.find(L=>!!L)||null}function Yt(){[m.UNVERIFIED,m.ERROR,m.EXPIRED].includes(F)?y&&(b==null?void 0:b.reportValidity())===!1?t(7,K=!1):ie():t(7,K=!0)}function nt(i){const a=i.target;p&&a&&!C.contains(a)&&F===m.VERIFIED&&t(8,C.style.display="none",C)}function it(){p&&Ae()}function rt(){F===m.VERIFYING&&f.waitAlert&&alert(f.waitAlert)}function Gt(i){p&&F!==m.UNVERIFIED&&requestAnimationFrame(()=>{Ae()})}function ot(){p&&Ae()}function _e(i){E("expire",i),Y&&(clearTimeout(Y),Y=null),i<1?tt():Y=setTimeout(tt,i)}function lt(i){E("floating",i),p!==i&&(t(8,C.style.left="",C),t(8,C.style.top="",C)),t(1,p=i===!0||i===""?"auto":i===!1||i==="false"?void 0:p),p?(c||t(0,c="onsubmit"),document.addEventListener("scroll",it),document.addEventListener("click",nt),window.addEventListener("resize",ot)):c==="onsubmit"&&t(0,c=void 0)}function Wt(i){var g;const a=b==null?void 0:b.querySelector(typeof i=="string"?`input[name="${i}"]`:'input[type="email"]:not([data-no-spamfilter])');return((g=a==null?void 0:a.value)==null?void 0:g.slice(a.value.indexOf("@")))||void 0}function Xt(i){return[...(b==null?void 0:b.querySelectorAll(i!=null&&i.length?i.map(g=>`input[name="${g}"]`).join(", "):'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])'))||[]].reduce((g,R)=>{const P=R.name,M=R.value;return P&&M&&(g[P]=/\n/.test(M)?M.replace(new RegExp("(?P:p==="top",v=Math.max(i,Math.min(M-i-R.width,g.left+g.width/2-R.width/2));if(G?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",G?"top":"bottom"),te){const L=te.getBoundingClientRect();t(9,te.style.left=g.left-v+g.width/2-L.width/2+"px",te)}}else E("unable to find floating anchor element")}function st(i){i.auto!==void 0&&(t(0,c=i.auto),c==="onload"&&ie()),i.floatinganchor!==void 0&&t(19,z=i.floatinganchor),i.delay!==void 0&&t(17,Z=i.delay),i.floatingoffset!==void 0&&t(20,$=i.floatingoffset),i.floating!==void 0&<(i.floating),i.expire!==void 0&&(_e(i.expire),t(18,H=i.expire)),i.challenge&&(et(i.challenge),l=i.challenge),i.challengeurl!==void 0&&t(15,u=i.challengeurl),i.debug!==void 0&&t(16,T=!!i.debug),i.hidefooter!==void 0&&t(2,Q=!!i.hidefooter),i.hidelogo!==void 0&&t(3,X=!!i.hidelogo),i.maxnumber!==void 0&&t(21,x=+i.maxnumber),i.mockerror!==void 0&&t(22,I=!!i.mockerror),i.name!==void 0&&t(4,V=i.name),i.refetchonexpire!==void 0&&t(23,A=!!i.refetchonexpire),i.spamfilter!==void 0&&t(24,y=typeof i.spamfilter=="object"?i.spamfilter:!!i.spamfilter),i.strings&&t(35,o=i.strings),i.test!==void 0&&t(25,_=typeof i.test=="number"?i.test:!!i.test),i.verifyurl!==void 0&&t(26,ee=i.verifyurl),i.workers!==void 0&&t(27,ue=+i.workers),i.workerurl!==void 0&&t(28,me=i.workerurl)}function we(i=m.UNVERIFIED,a=null){Y&&(clearTimeout(Y),Y=null),t(7,K=!1),t(10,Ie=a),t(5,ne=null),t(6,F=i)}async function ie(){return we(m.VERIFYING),await new Promise(i=>setTimeout(i,Z||0)),Ut().then(i=>(et(i),E("challenge",i),qt(i))).then(({data:i,solution:a})=>{if(E("solution",a),(a==null?void 0:a.number)!==void 0){if(ee)return Jt(Qe(i,a));t(5,ne=Qe(i,a)),E("payload",ne)}else throw E("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."),new Error("Unexpected result returned.")}).then(()=>{yt().then(()=>{t(6,F=m.VERIFIED),t(7,K=!0),E("verified"),Le("verified",{payload:ne})})}).catch(i=>{E(i),t(6,F=m.ERROR),t(7,K=!1),t(10,Ie=i.message)})}function Kt(){K=this.checked,t(7,K)}function Qt(i){de[i?"unshift":"push"](()=>{te=i,t(9,te)})}function en(i){de[i?"unshift":"push"](()=>{C=i,t(8,C)})}return n.$$set=i=>{"auto"in i&&t(0,c=i.auto),"blockspam"in i&&t(29,h=i.blockspam),"challengeurl"in i&&t(15,u=i.challengeurl),"challengejson"in i&&t(30,B=i.challengejson),"debug"in i&&t(16,T=i.debug),"delay"in i&&t(17,Z=i.delay),"expire"in i&&t(18,H=i.expire),"floating"in i&&t(1,p=i.floating),"floatinganchor"in i&&t(19,z=i.floatinganchor),"floatingoffset"in i&&t(20,$=i.floatingoffset),"hidefooter"in i&&t(2,Q=i.hidefooter),"hidelogo"in i&&t(3,X=i.hidelogo),"name"in i&&t(4,V=i.name),"maxnumber"in i&&t(21,x=i.maxnumber),"mockerror"in i&&t(22,I=i.mockerror),"refetchonexpire"in i&&t(23,A=i.refetchonexpire),"spamfilter"in i&&t(24,y=i.spamfilter),"strings"in i&&t(31,d=i.strings),"test"in i&&t(25,_=i.test),"verifyurl"in i&&t(26,ee=i.verifyurl),"workers"in i&&t(27,ue=i.workers),"workerurl"in i&&t(28,me=i.workerurl)},n.$$.update=()=>{n.$$.dirty[0]&32768&&t(12,r=!!(u!=null&&u.includes(".altcha.org"))&&!!(u!=null&&u.includes("apiKey=ckey_"))),n.$$.dirty[0]&1073741824&&(l=B?Ye(B):void 0),n.$$.dirty[1]&1&&t(35,o=d?Ye(d):{}),n.$$.dirty[1]&16&&t(11,f={ariaLinkLabel:qe,error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by ALTCHA`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...o}),n.$$.dirty[0]&96&&Le("statechange",{payload:ne,state:F}),n.$$.dirty[0]&64&&Gt()},[c,p,Q,X,V,ne,F,K,C,te,Ie,f,r,Yt,rt,u,T,Z,H,z,$,x,I,A,y,_,ee,ue,me,h,B,d,st,we,ie,o,Kt,Qt,en]}class Ge extends Rt{constructor(e){super(),It(this,e,Bt,Ht,ut,{auto:0,blockspam:29,challengeurl:15,challengejson:30,debug:16,delay:17,expire:18,floating:1,floatinganchor:19,floatingoffset:20,hidefooter:2,hidelogo:3,name:4,maxnumber:21,mockerror:22,refetchonexpire:23,spamfilter:24,strings:31,test:25,verifyurl:26,workers:27,workerurl:28,configure:32,reset:33,verify:34},null,[-1,-1,-1])}get auto(){return this.$$.ctx[0]}set auto(e){this.$$set({auto:e}),w()}get blockspam(){return this.$$.ctx[29]}set blockspam(e){this.$$set({blockspam:e}),w()}get challengeurl(){return this.$$.ctx[15]}set challengeurl(e){this.$$set({challengeurl:e}),w()}get challengejson(){return this.$$.ctx[30]}set challengejson(e){this.$$set({challengejson:e}),w()}get debug(){return this.$$.ctx[16]}set debug(e){this.$$set({debug:e}),w()}get delay(){return this.$$.ctx[17]}set delay(e){this.$$set({delay:e}),w()}get expire(){return this.$$.ctx[18]}set expire(e){this.$$set({expire:e}),w()}get floating(){return this.$$.ctx[1]}set floating(e){this.$$set({floating:e}),w()}get floatinganchor(){return this.$$.ctx[19]}set floatinganchor(e){this.$$set({floatinganchor:e}),w()}get floatingoffset(){return this.$$.ctx[20]}set floatingoffset(e){this.$$set({floatingoffset:e}),w()}get hidefooter(){return this.$$.ctx[2]}set hidefooter(e){this.$$set({hidefooter:e}),w()}get hidelogo(){return this.$$.ctx[3]}set hidelogo(e){this.$$set({hidelogo:e}),w()}get name(){return this.$$.ctx[4]}set name(e){this.$$set({name:e}),w()}get maxnumber(){return this.$$.ctx[21]}set maxnumber(e){this.$$set({maxnumber:e}),w()}get mockerror(){return this.$$.ctx[22]}set mockerror(e){this.$$set({mockerror:e}),w()}get refetchonexpire(){return this.$$.ctx[23]}set refetchonexpire(e){this.$$set({refetchonexpire:e}),w()}get spamfilter(){return this.$$.ctx[24]}set spamfilter(e){this.$$set({spamfilter:e}),w()}get strings(){return this.$$.ctx[31]}set strings(e){this.$$set({strings:e}),w()}get test(){return this.$$.ctx[25]}set test(e){this.$$set({test:e}),w()}get verifyurl(){return this.$$.ctx[26]}set verifyurl(e){this.$$set({verifyurl:e}),w()}get workers(){return this.$$.ctx[27]}set workers(e){this.$$set({workers:e}),w()}get workerurl(){return this.$$.ctx[28]}set workerurl(e){this.$$set({workerurl:e}),w()}get configure(){return this.$$.ctx[32]}get reset(){return this.$$.ctx[33]}get verify(){return this.$$.ctx[34]}}customElements.define("altcha-widget",At(Ge,{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)),globalThis.createAltchaWorker=n=>new Worker(new URL(n||"./worker.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:D&&D.src||new URL("altcha.umd.cjs",document.baseURI).href)),O.Altcha=Ge,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})}); +(function(O,D){typeof exports=="object"&&typeof module<"u"?D(exports):typeof define=="function"&&define.amd?define(["exports"],D):(O=typeof globalThis<"u"?globalThis:O||self,D(O.altcha={}))})(this,function(O){"use strict";var tn=Object.defineProperty;var nn=(O,D,q)=>D in O?tn(O,D,{enumerable:!0,configurable:!0,writable:!0,value:q}):O[D]=q;var U=(O,D,q)=>nn(O,typeof D!="symbol"?D+"":D,q);var D=typeof document<"u"?document.currentScript:null;function q(){}function $e(n){return n()}function Se(){return Object.create(null)}function se(n){n.forEach($e)}function Te(n){return typeof n=="function"}function ut(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function at(n){return Object.keys(n).length===0}function k(n,e){n.appendChild(e)}function N(n,e,t){n.insertBefore(e,t||null)}function j(n){n.parentNode&&n.parentNode.removeChild(n)}function $(n){return document.createElement(n)}function W(n){return document.createElementNS("http://www.w3.org/2000/svg",n)}function ht(n){return document.createTextNode(n)}function J(){return ht(" ")}function ke(n,e,t,r){return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}function s(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function dt(n){return Array.from(n.childNodes)}function Me(n,e,t){n.classList.toggle(e,!!t)}function gt(n,e,{bubbles:t=!1,cancelable:r=!1}={}){return new CustomEvent(n,{detail:e,bubbles:t,cancelable:r})}function mt(n){const e={};return n.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let fe;function ce(n){fe=n}function pe(){if(!fe)throw new Error("Function called outside component initialization");return fe}function bt(n){pe().$$.on_mount.push(n)}function _t(n){pe().$$.on_destroy.push(n)}function wt(){const n=pe();return(e,t,{cancelable:r=!1}={})=>{const o=n.$$.callbacks[e];if(o){const l=gt(e,t,{cancelable:r});return o.slice().forEach(f=>{f.call(n,l)}),!l.defaultPrevented}return!0}}const re=[],de=[];let oe=[];const je=[],De=Promise.resolve();let Ee=!1;function Ne(){Ee||(Ee=!0,De.then(w))}function yt(){return Ne(),De}function xe(n){oe.push(n)}const Ce=new Set;let le=0;function w(){if(le!==0)return;const n=fe;do{try{for(;len.indexOf(r)===-1?e.push(r):t.push(r)),t.forEach(r=>r()),oe=e}const pt=new Set;function Et(n,e){n&&n.i&&(pt.delete(n),n.i(e))}function xt(n,e,t){const{fragment:r,after_update:o}=n.$$;r&&r.m(e,t),xe(()=>{const l=n.$$.on_mount.map($e).filter(Te);n.$$.on_destroy?n.$$.on_destroy.push(...l):se(l),n.$$.on_mount=[]}),o.forEach(xe)}function Ct(n,e){const t=n.$$;t.fragment!==null&&(kt(t.after_update),se(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Lt(n,e){n.$$.dirty[0]===-1&&(re.push(n),Ne(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<{const p=H.length?H[0]:Z;return u.ctx&&o(u.ctx[T],u.ctx[T]=p)&&(!u.skip_bound&&u.bound[T]&&u.bound[T](p),B&&Lt(n,T)),Z}):[],u.update(),B=!0,se(u.before_update),u.fragment=r?r(u.ctx):!1,e.target){if(e.hydrate){const T=dt(e.target);u.fragment&&u.fragment.l(T),T.forEach(j)}else u.fragment&&u.fragment.c();e.intro&&Et(n.$$.fragment),xt(n,e.target,e.anchor),w()}ce(h)}let Ve;typeof HTMLElement=="function"&&(Ve=class extends HTMLElement{constructor(e,t,r){super();U(this,"$$ctor");U(this,"$$s");U(this,"$$c");U(this,"$$cn",!1);U(this,"$$d",{});U(this,"$$r",!1);U(this,"$$p_d",{});U(this,"$$l",{});U(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,r&&this.attachShadow({mode:"open"})}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const o=this.$$c.$on(e,t);this.$$l_u.set(t,o)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){const o=this.$$l_u.get(t);o&&(o(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(l){return()=>{let f;return{c:function(){f=$("slot"),l!=="default"&&s(f,"name",l)},m:function(u,B){N(u,f,B)},d:function(u){u&&j(f)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},r=mt(this);for(const l of this.$$s)l in r&&(t[l]=[e(l)]);for(const l of this.attributes){const f=this.$$g_p(l.name);f in this.$$d||(this.$$d[f]=ge(f,l.value,this.$$p_d,"toProp"))}for(const l in this.$$p_d)!(l in this.$$d)&&this[l]!==void 0&&(this.$$d[l]=this[l],delete this[l]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$scope:{ctx:[]}}});const o=()=>{this.$$r=!0;for(const l in this.$$p_d)if(this.$$d[l]=this.$$c.$$.ctx[this.$$c.$$.props[l]],this.$$p_d[l].reflect){const f=ge(l,this.$$d[l],this.$$p_d,"toAttribute");f==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,f)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const l in this.$$l)for(const f of this.$$l[l]){const c=this.$$c.$on(l,f);this.$$l_u.set(f,c)}this.$$l={}}}attributeChangedCallback(e,t,r){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=ge(e,r,this.$$p_d,"toProp"),(o=this.$$c)==null||o.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function ge(n,e,t,r){var l;const o=(l=t[n])==null?void 0:l.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!t[n])return e;if(r==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function At(n,e,t,r,o,l){let f=class extends Ve{constructor(){super(n,t,o),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(c=>(e[c].attribute||c).toLowerCase())}};return Object.keys(e).forEach(c=>{Object.defineProperty(f.prototype,c,{get(){return this.$$c&&c in this.$$c?this.$$c[c]:this.$$d[c]},set(h){var u;h=ge(c,h,e),this.$$d[c]=h,(u=this.$$c)==null||u.$set({[c]:h})}})}),r.forEach(c=>{Object.defineProperty(f.prototype,c,{get(){var h;return(h=this.$$c)==null?void 0:h[c]}})}),n.element=f,f}class Rt{constructor(){U(this,"$$");U(this,"$$set")}$destroy(){Ct(this,1),this.$destroy=q}$on(e,t){if(!Te(t))return q;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(t),()=>{const o=r.indexOf(t);o!==-1&&r.splice(o,1)}}$set(e){this.$$set&&!at(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const $t="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add($t);const St=new TextEncoder;function Tt(n){return[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function Mt(n,e="SHA-256",t=1e5){const r=Date.now().toString(16);n||(n=Math.round(Math.random()*t));const o=await Fe(r,n,e);return{algorithm:e,challenge:o,salt:r,signature:""}}async function Fe(n,e,t){return Tt(await crypto.subtle.digest(t.toUpperCase(),St.encode(n+e)))}function jt(n,e,t="SHA-256",r=1e6,o=0){const l=new AbortController,f=Date.now();return{promise:(async()=>{for(let h=o;h<=r;h+=1){if(l.signal.aborted)return null;if(await Fe(e,h,t)===n)return{number:h,took:Date.now()-f}}return null})(),controller:l}}var m=(n=>(n.ERROR="error",n.VERIFIED="verified",n.VERIFYING="verifying",n.UNVERIFIED="unverified",n.EXPIRED="expired",n))(m||{});function Pe(n){let e,t,r;return{c(){e=W("svg"),t=W("path"),r=W("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(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"),s(r,"fill","currentColor"),s(r,"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")},m(o,l){N(o,e,l),k(e,t),k(e,r)},d(o){o&&j(e)}}}function Dt(n){let e,t=n[11].label+"",r;return{c(){e=$("label"),s(e,"for",r=n[4]+"_checkbox")},m(o,l){N(o,e,l),e.innerHTML=t},p(o,l){l[0]&2048&&t!==(t=o[11].label+"")&&(e.innerHTML=t),l[0]&16&&r!==(r=o[4]+"_checkbox")&&s(e,"for",r)},d(o){o&&j(e)}}}function Nt(n){let e,t=n[11].verifying+"";return{c(){e=$("span")},m(r,o){N(r,e,o),e.innerHTML=t},p(r,o){o[0]&2048&&t!==(t=r[11].verifying+"")&&(e.innerHTML=t)},d(r){r&&j(e)}}}function Vt(n){let e,t=n[11].verified+"",r,o;return{c(){e=$("span"),r=J(),o=$("input"),s(o,"type","hidden"),s(o,"name",n[4]),o.value=n[5]},m(l,f){N(l,e,f),e.innerHTML=t,N(l,r,f),N(l,o,f)},p(l,f){f[0]&2048&&t!==(t=l[11].verified+"")&&(e.innerHTML=t),f[0]&16&&s(o,"name",l[4]),f[0]&32&&(o.value=l[5])},d(l){l&&(j(e),j(r),j(o))}}}function He(n){let e,t,r,o,l,f,c;return{c(){e=$("div"),t=$("a"),r=W("svg"),o=W("path"),l=W("path"),f=W("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(r,"width","22"),s(r,"height","22"),s(r,"viewBox","0 0 20 20"),s(r,"fill","none"),s(r,"xmlns","http://www.w3.org/2000/svg"),s(t,"href",Ze),s(t,"target","_blank"),s(t,"class","altcha-logo"),s(t,"aria-label",c=n[11].ariaLinkLabel)},m(h,u){N(h,e,u),k(e,t),k(t,r),k(r,o),k(r,l),k(r,f)},p(h,u){u[0]&2048&&c!==(c=h[11].ariaLinkLabel)&&s(t,"aria-label",c)},d(h){h&&j(e)}}}function Oe(n){let e,t,r,o;function l(h,u){return h[6]===m.EXPIRED?Pt:Ft}let f=l(n),c=f(n);return{c(){e=$("div"),t=W("svg"),r=W("path"),o=J(),c.c(),s(r,"stroke-linecap","round"),s(r,"stroke-linejoin","round"),s(r,"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")},m(h,u){N(h,e,u),k(e,t),k(t,r),k(e,o),c.m(e,null)},p(h,u){f===(f=l(h))&&c?c.p(h,u):(c.d(1),c=f(h),c&&(c.c(),c.m(e,null)))},d(h){h&&j(e),c.d()}}}function Ft(n){let e,t=n[11].error+"";return{c(){e=$("div"),s(e,"title",n[10])},m(r,o){N(r,e,o),e.innerHTML=t},p(r,o){o[0]&2048&&t!==(t=r[11].error+"")&&(e.innerHTML=t),o[0]&1024&&s(e,"title",r[10])},d(r){r&&j(e)}}}function Pt(n){let e,t=n[11].expired+"";return{c(){e=$("div"),s(e,"title",n[10])},m(r,o){N(r,e,o),e.innerHTML=t},p(r,o){o[0]&2048&&t!==(t=r[11].expired+"")&&(e.innerHTML=t),o[0]&1024&&s(e,"title",r[10])},d(r){r&&j(e)}}}function Be(n){let e,t,r=n[11].footer+"";return{c(){e=$("div"),t=$("div"),s(e,"class","altcha-footer")},m(o,l){N(o,e,l),k(e,t),t.innerHTML=r},p(o,l){l[0]&2048&&r!==(r=o[11].footer+"")&&(t.innerHTML=r)},d(o){o&&j(e)}}}function Ue(n){let e;return{c(){e=$("div"),s(e,"class","altcha-anchor-arrow")},m(t,r){N(t,e,r),n[37](e)},p:q,d(t){t&&j(e),n[37](null)}}}function Ht(n){let e,t,r,o,l,f,c,h,u,B,T,Z,H,p,z,S=n[6]===m.VERIFYING&&Pe();function Q(d,_){return d[6]===m.VERIFIED?Vt:d[6]===m.VERIFYING?Nt:Dt}let X=Q(n),V=X(n),x=(n[3]!==!0||n[12])&&He(n),I=(n[10]||n[6]===m.EXPIRED)&&Oe(n),A=n[11].footer&&(n[2]!==!0||n[12])&&Be(n),y=n[1]&&Ue(n);return{c(){e=$("div"),t=$("div"),S&&S.c(),r=J(),o=$("div"),l=$("input"),h=J(),u=$("div"),V.c(),B=J(),x&&x.c(),T=J(),I&&I.c(),Z=J(),A&&A.c(),H=J(),y&&y.c(),s(l,"type","checkbox"),s(l,"id",f=n[4]+"_checkbox"),l.required=c=n[0]!=="onsubmit",s(o,"class","altcha-checkbox"),Me(o,"altcha-hidden",n[6]===m.VERIFYING),s(u,"class","altcha-label"),s(t,"class","altcha-main"),s(e,"class","altcha"),s(e,"data-state",n[6]),s(e,"data-floating",n[1])},m(d,_){N(d,e,_),k(e,t),S&&S.m(t,null),k(t,r),k(t,o),k(o,l),l.checked=n[7],k(t,h),k(t,u),V.m(u,null),k(t,B),x&&x.m(t,null),k(e,T),I&&I.m(e,null),k(e,Z),A&&A.m(e,null),k(e,H),y&&y.m(e,null),n[38](e),p||(z=[ke(l,"change",n[36]),ke(l,"change",n[13]),ke(l,"invalid",n[14])],p=!0)},p(d,_){d[6]===m.VERIFYING?S||(S=Pe(),S.c(),S.m(t,r)):S&&(S.d(1),S=null),_[0]&16&&f!==(f=d[4]+"_checkbox")&&s(l,"id",f),_[0]&1&&c!==(c=d[0]!=="onsubmit")&&(l.required=c),_[0]&128&&(l.checked=d[7]),_[0]&64&&Me(o,"altcha-hidden",d[6]===m.VERIFYING),X===(X=Q(d))&&V?V.p(d,_):(V.d(1),V=X(d),V&&(V.c(),V.m(u,null))),d[3]!==!0||d[12]?x?x.p(d,_):(x=He(d),x.c(),x.m(t,null)):x&&(x.d(1),x=null),d[10]||d[6]===m.EXPIRED?I?I.p(d,_):(I=Oe(d),I.c(),I.m(e,Z)):I&&(I.d(1),I=null),d[11].footer&&(d[2]!==!0||d[12])?A?A.p(d,_):(A=Be(d),A.c(),A.m(e,H)):A&&(A.d(1),A=null),d[1]?y?y.p(d,_):(y=Ue(d),y.c(),y.m(e,null)):y&&(y.d(1),y=null),_[0]&64&&s(e,"data-state",d[6]),_[0]&2&&s(e,"data-floating",d[1])},i:q,o:q,d(d){d&&j(e),S&&S.d(),V.d(),x&&x.d(),I&&I.d(),A&&A.d(),y&&y.d(),n[38](null),p=!1,se(z)}}}const qe="Visit Altcha.org",Ze="https://altcha.org/";function Ye(n){return JSON.parse(n)}function Ot(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Bt(n,e,t){var ft,ct;let r,o,l,f,{auto:c=void 0}=e,{blockspam:h=void 0}=e,{challengeurl:u=void 0}=e,{challengejson:B=void 0}=e,{debug:T=!1}=e,{delay:Z=0}=e,{expire:H=void 0}=e,{floating:p=void 0}=e,{floatinganchor:z=void 0}=e,{floatingoffset:S=void 0}=e,{hidefooter:Q=!1}=e,{hidelogo:X=!1}=e,{name:V="altcha"}=e,{maxnumber:x=1e6}=e,{mockerror:I=!1}=e,{refetchonexpire:A=!0}=e,{spamfilter:y=!1}=e,{strings:d=void 0}=e,{test:_=!1}=e,{verifyurl:ee=void 0}=e,{workers:ue=Math.min(16,navigator.hardwareConcurrency||8)}=e,{workerurl:me=void 0}=e;const Le=wt(),We=["SHA-256","SHA-384","SHA-512"],Xe=(ct=(ft=document.documentElement.lang)==null?void 0:ft.split("-"))==null?void 0:ct[0];let K=!1,C,te=null,be=null,b=null,Ie=null,ne=null,F=m.UNVERIFIED,Y=null;_t(()=>{b&&(b.removeEventListener("submit",ze),b.removeEventListener("reset",Ke),b.removeEventListener("focusin",Je),b=null),Y&&(clearTimeout(Y),Y=null),document.removeEventListener("click",nt),document.removeEventListener("scroll",it),window.removeEventListener("resize",ot)}),bt(()=>{E("mounted","0.6.7"),E("workers",ue),_&&E("using test mode"),H&&_e(H),c!==void 0&&E("auto",c),p!==void 0&<(p),b=C.closest("form"),b&&(b.addEventListener("submit",ze,{capture:!0}),b.addEventListener("reset",Ke),c==="onfocus"&&b.addEventListener("focusin",Je)),c==="onload"&&ie(),r&&(Q||X)&&E("Attributes hidefooter and hidelogo ignored because usage with free API Keys require attribution.")});function E(...i){(T||i.some(a=>a instanceof Error))&&console[i[0]instanceof Error?"error":"log"]("ALTCHA",...i)}function Je(i){F===m.UNVERIFIED&&ie()}function ze(i){b&&c==="onsubmit"&&(F===m.UNVERIFIED?(i.preventDefault(),i.stopPropagation(),ie().then(()=>{b==null||b.requestSubmit()})):F!==m.VERIFIED&&(i.preventDefault(),i.stopPropagation(),F===m.VERIFYING&&rt()))}function Ke(){we()}function Qe(i,a){return btoa(JSON.stringify({algorithm:i.algorithm,challenge:i.challenge,number:a.number,salt:i.salt,signature:i.signature,test:_?!0:void 0,took:a.took}))}function et(i){if(!i.algorithm)throw new Error("Invalid challenge. Property algorithm is missing.");if(i.signature===void 0)throw new Error("Invalid challenge. Property signature is missing.");if(!We.includes(i.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${We.join(", ")}`);if(!i.challenge||i.challenge.length<40)throw new Error("Challenge is too short. Min. 40 chars.");if(!i.salt||i.salt.length<10)throw new Error("Salt is too short. Min. 10 chars.")}async function Ut(){var i;if(I)throw E("mocking error"),new Error("Mocked error.");if(o)return E("using provided json data"),o;if(_)return E("generating test challenge",{test:_}),Mt(typeof _!="boolean"?+_:void 0);{if(!u)throw new Error("Attribute challengeurl not set.");E("fetching challenge from",u);const a=await fetch(u,{headers:{"x-altcha-spam-filter":y?"1":"0"}});if(a.status!==200)throw new Error(`Server responded with ${a.status}.`);const g=a.headers.get("Expires"),R=a.headers.get("X-Altcha-Config"),P=await a.json(),M=new URLSearchParams((i=P.salt.split("?"))==null?void 0:i[1]),G=M.get("expires")||M.get("expire");if(G){const v=new Date(+G*1e3),L=isNaN(v.getTime())?0:v.getTime()-Date.now();L>0&&_e(L)}if(R)try{const v=JSON.parse(R);v&&typeof v=="object"&&(v.verifyurl&&(v.verifyurl=new URL(v.verifyurl,new URL(u)).toString()),st(v))}catch(v){E("unable to configure from X-Altcha-Config",v)}if(!H&&(g!=null&&g.length)){const v=Date.parse(g);if(v){const L=v-Date.now();L>0&&_e(L)}}return P}}function tt(){u&&A&&F===m.VERIFIED?ie():we(m.EXPIRED,f.expired)}async function qt(i){let a=null;if("Worker"in window){try{a=await Zt(i.challenge,i.salt,i.algorithm,i.maxnumber)}catch(g){E(g)}if((a==null?void 0:a.number)!==void 0)return{data:i,solution:a}}return{data:i,solution:await jt(i.challenge,i.salt,i.algorithm,i.maxnumber||x).promise}}async function Zt(i,a,g,R=typeof _=="number"?_:x,P=Math.ceil(ue)){const M=[];P=Math.min(16,Math.max(1,P));for(let L=0;L{const ae=Re*G;return new Promise(ye=>{L.addEventListener("message",ve=>{if(ve.data)for(const he of M)he!==L&&he.postMessage({type:"abort"});ye(ve.data)}),L.postMessage({payload:{alg:g,challenge:i,max:ae+G,salt:a,start:ae},type:"work"})})}));for(const L of M)L.terminate();return v.find(L=>!!L)||null}function Yt(){[m.UNVERIFIED,m.ERROR,m.EXPIRED].includes(F)?y&&(b==null?void 0:b.reportValidity())===!1?t(7,K=!1):ie():t(7,K=!0)}function nt(i){const a=i.target;p&&a&&!C.contains(a)&&F===m.VERIFIED&&t(8,C.style.display="none",C)}function it(){p&&Ae()}function rt(){F===m.VERIFYING&&f.waitAlert&&alert(f.waitAlert)}function Gt(i){p&&F!==m.UNVERIFIED&&requestAnimationFrame(()=>{Ae()})}function ot(){p&&Ae()}function _e(i){E("expire",i),Y&&(clearTimeout(Y),Y=null),i<1?tt():Y=setTimeout(tt,i)}function lt(i){E("floating",i),p!==i&&(t(8,C.style.left="",C),t(8,C.style.top="",C)),t(1,p=i===!0||i===""?"auto":i===!1||i==="false"?void 0:p),p?(c||t(0,c="onsubmit"),document.addEventListener("scroll",it),document.addEventListener("click",nt),window.addEventListener("resize",ot)):c==="onsubmit"&&t(0,c=void 0)}function Wt(i){var g;const a=b==null?void 0:b.querySelector(typeof i=="string"?`input[name="${i}"]`:'input[type="email"]:not([data-no-spamfilter])');return((g=a==null?void 0:a.value)==null?void 0:g.slice(a.value.indexOf("@")))||void 0}function Xt(i){return[...(b==null?void 0:b.querySelectorAll(i!=null&&i.length?i.map(g=>`input[name="${g}"]`).join(", "):'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])'))||[]].reduce((g,R)=>{const P=R.name,M=R.value;return P&&M&&(g[P]=/\n/.test(M)?M.replace(new RegExp("(?P:p==="top",v=Math.max(i,Math.min(M-i-R.width,g.left+g.width/2-R.width/2));if(G?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",G?"top":"bottom"),te){const L=te.getBoundingClientRect();t(9,te.style.left=g.left-v+g.width/2-L.width/2+"px",te)}}else E("unable to find floating anchor element")}function st(i){i.auto!==void 0&&(t(0,c=i.auto),c==="onload"&&ie()),i.floatinganchor!==void 0&&t(19,z=i.floatinganchor),i.delay!==void 0&&t(17,Z=i.delay),i.floatingoffset!==void 0&&t(20,S=i.floatingoffset),i.floating!==void 0&<(i.floating),i.expire!==void 0&&(_e(i.expire),t(18,H=i.expire)),i.challenge&&(et(i.challenge),o=i.challenge),i.challengeurl!==void 0&&t(15,u=i.challengeurl),i.debug!==void 0&&t(16,T=!!i.debug),i.hidefooter!==void 0&&t(2,Q=!!i.hidefooter),i.hidelogo!==void 0&&t(3,X=!!i.hidelogo),i.maxnumber!==void 0&&t(21,x=+i.maxnumber),i.mockerror!==void 0&&t(22,I=!!i.mockerror),i.name!==void 0&&t(4,V=i.name),i.refetchonexpire!==void 0&&t(23,A=!!i.refetchonexpire),i.spamfilter!==void 0&&t(24,y=typeof i.spamfilter=="object"?i.spamfilter:!!i.spamfilter),i.strings&&t(35,l=i.strings),i.test!==void 0&&t(25,_=typeof i.test=="number"?i.test:!!i.test),i.verifyurl!==void 0&&t(26,ee=i.verifyurl),i.workers!==void 0&&t(27,ue=+i.workers),i.workerurl!==void 0&&t(28,me=i.workerurl)}function we(i=m.UNVERIFIED,a=null){Y&&(clearTimeout(Y),Y=null),t(7,K=!1),t(10,Ie=a),t(5,ne=null),t(6,F=i)}async function ie(){return we(m.VERIFYING),await new Promise(i=>setTimeout(i,Z||0)),Ut().then(i=>(et(i),E("challenge",i),qt(i))).then(({data:i,solution:a})=>{if(E("solution",a),(a==null?void 0:a.number)!==void 0){if(ee)return Jt(Qe(i,a));t(5,ne=Qe(i,a)),E("payload",ne)}else throw E("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."),new Error("Unexpected result returned.")}).then(()=>{yt().then(()=>{t(6,F=m.VERIFIED),t(7,K=!0),E("verified"),Le("verified",{payload:ne})})}).catch(i=>{E(i),t(6,F=m.ERROR),t(7,K=!1),t(10,Ie=i.message)})}function Kt(){K=this.checked,t(7,K)}function Qt(i){de[i?"unshift":"push"](()=>{te=i,t(9,te)})}function en(i){de[i?"unshift":"push"](()=>{C=i,t(8,C)})}return n.$$set=i=>{"auto"in i&&t(0,c=i.auto),"blockspam"in i&&t(29,h=i.blockspam),"challengeurl"in i&&t(15,u=i.challengeurl),"challengejson"in i&&t(30,B=i.challengejson),"debug"in i&&t(16,T=i.debug),"delay"in i&&t(17,Z=i.delay),"expire"in i&&t(18,H=i.expire),"floating"in i&&t(1,p=i.floating),"floatinganchor"in i&&t(19,z=i.floatinganchor),"floatingoffset"in i&&t(20,S=i.floatingoffset),"hidefooter"in i&&t(2,Q=i.hidefooter),"hidelogo"in i&&t(3,X=i.hidelogo),"name"in i&&t(4,V=i.name),"maxnumber"in i&&t(21,x=i.maxnumber),"mockerror"in i&&t(22,I=i.mockerror),"refetchonexpire"in i&&t(23,A=i.refetchonexpire),"spamfilter"in i&&t(24,y=i.spamfilter),"strings"in i&&t(31,d=i.strings),"test"in i&&t(25,_=i.test),"verifyurl"in i&&t(26,ee=i.verifyurl),"workers"in i&&t(27,ue=i.workers),"workerurl"in i&&t(28,me=i.workerurl)},n.$$.update=()=>{n.$$.dirty[0]&32768&&t(12,r=!!(u!=null&&u.includes(".altcha.org"))&&!!(u!=null&&u.includes("apiKey=ckey_"))),n.$$.dirty[0]&1073741824&&(o=B?Ye(B):void 0),n.$$.dirty[1]&1&&t(35,l=d?Ye(d):{}),n.$$.dirty[1]&16&&t(11,f={ariaLinkLabel:qe,error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by ALTCHA`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...l}),n.$$.dirty[0]&96&&Le("statechange",{payload:ne,state:F}),n.$$.dirty[0]&64&&Gt()},[c,p,Q,X,V,ne,F,K,C,te,Ie,f,r,Yt,rt,u,T,Z,H,z,S,x,I,A,y,_,ee,ue,me,h,B,d,st,we,ie,l,Kt,Qt,en]}class Ge extends Rt{constructor(e){super(),It(this,e,Bt,Ht,ut,{auto:0,blockspam:29,challengeurl:15,challengejson:30,debug:16,delay:17,expire:18,floating:1,floatinganchor:19,floatingoffset:20,hidefooter:2,hidelogo:3,name:4,maxnumber:21,mockerror:22,refetchonexpire:23,spamfilter:24,strings:31,test:25,verifyurl:26,workers:27,workerurl:28,configure:32,reset:33,verify:34},null,[-1,-1,-1])}get auto(){return this.$$.ctx[0]}set auto(e){this.$$set({auto:e}),w()}get blockspam(){return this.$$.ctx[29]}set blockspam(e){this.$$set({blockspam:e}),w()}get challengeurl(){return this.$$.ctx[15]}set challengeurl(e){this.$$set({challengeurl:e}),w()}get challengejson(){return this.$$.ctx[30]}set challengejson(e){this.$$set({challengejson:e}),w()}get debug(){return this.$$.ctx[16]}set debug(e){this.$$set({debug:e}),w()}get delay(){return this.$$.ctx[17]}set delay(e){this.$$set({delay:e}),w()}get expire(){return this.$$.ctx[18]}set expire(e){this.$$set({expire:e}),w()}get floating(){return this.$$.ctx[1]}set floating(e){this.$$set({floating:e}),w()}get floatinganchor(){return this.$$.ctx[19]}set floatinganchor(e){this.$$set({floatinganchor:e}),w()}get floatingoffset(){return this.$$.ctx[20]}set floatingoffset(e){this.$$set({floatingoffset:e}),w()}get hidefooter(){return this.$$.ctx[2]}set hidefooter(e){this.$$set({hidefooter:e}),w()}get hidelogo(){return this.$$.ctx[3]}set hidelogo(e){this.$$set({hidelogo:e}),w()}get name(){return this.$$.ctx[4]}set name(e){this.$$set({name:e}),w()}get maxnumber(){return this.$$.ctx[21]}set maxnumber(e){this.$$set({maxnumber:e}),w()}get mockerror(){return this.$$.ctx[22]}set mockerror(e){this.$$set({mockerror:e}),w()}get refetchonexpire(){return this.$$.ctx[23]}set refetchonexpire(e){this.$$set({refetchonexpire:e}),w()}get spamfilter(){return this.$$.ctx[24]}set spamfilter(e){this.$$set({spamfilter:e}),w()}get strings(){return this.$$.ctx[31]}set strings(e){this.$$set({strings:e}),w()}get test(){return this.$$.ctx[25]}set test(e){this.$$set({test:e}),w()}get verifyurl(){return this.$$.ctx[26]}set verifyurl(e){this.$$set({verifyurl:e}),w()}get workers(){return this.$$.ctx[27]}set workers(e){this.$$set({workers:e}),w()}get workerurl(){return this.$$.ctx[28]}set workerurl(e){this.$$set({workerurl:e}),w()}get configure(){return this.$$.ctx[32]}get reset(){return this.$$.ctx[33]}get verify(){return this.$$.ctx[34]}}customElements.define("altcha-widget",At(Ge,{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)),globalThis.createAltchaWorker=n=>new Worker(new URL(n||"./worker.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:D&&D.src||new URL("altcha.umd.cjs",document.baseURI).href)),O.Altcha=Ge,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})}); diff --git a/package-lock.json b/package-lock.json index 598288f..ca4816c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "altcha", - "version": "0.6.6", + "version": "0.6.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "altcha", - "version": "0.6.6", + "version": "0.6.7", "license": "MIT", "devDependencies": { "@playwright/test": "^1.44.1", @@ -30,13 +30,13 @@ } }, "node_modules/@ampproject/remapping": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", - "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", "dev": true, "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" @@ -423,14 +423,14 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", "dev": true, "dependencies": { - "@jridgewell/set-array": "^1.0.1", + "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" @@ -446,78 +446,43 @@ } }, "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.22", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", - "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/@playwright/test": { - "version": "1.44.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.44.1.tgz", - "integrity": "sha512-1hZ4TNvD5z9VuhNJ/walIjvMVvYkZKf71axoF/uiAqpntQJXpG64dlXhoDXE3OczPuTuvjf/M5KWFg5VAVUS3Q==", + "version": "1.45.3", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.45.3.tgz", + "integrity": "sha512-UKF4XsBfy+u3MFWEH44hva1Q8Da28G6RFtR2+5saw+jgAFQV5yYnB1fu68Mz7fO+5GJF3wgwAIs0UelU8TxFrA==", "dev": true, "dependencies": { - "playwright": "1.44.1" + "playwright": "1.45.3" }, "bin": { "playwright": "cli.js" }, "engines": { - "node": ">=16" + "node": ">=18" } }, "node_modules/@rollup/pluginutils": { @@ -542,16 +507,10 @@ } } }, - "node_modules/@rollup/pluginutils/node_modules/estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "dev": true - }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.14.3.tgz", - "integrity": "sha512-X9alQ3XM6I9IlSlmC8ddAvMSyG1WuHk5oUnXGw+yUBs3BFoTizmG1La/Gr8fVJvDWAq+zlYTZ9DBgrlKRVY06g==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.19.1.tgz", + "integrity": "sha512-XzqSg714++M+FXhHfXpS1tDnNZNpgxxuGZWlRG/jSj+VEPmZ0yg6jV4E0AL3uyBKxO8mO3xtOsP5mQ+XLfrlww==", "cpu": [ "arm" ], @@ -562,9 +521,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.14.3.tgz", - "integrity": "sha512-eQK5JIi+POhFpzk+LnjKIy4Ks+pwJ+NXmPxOCSvOKSNRPONzKuUvWE+P9JxGZVxrtzm6BAYMaL50FFuPe0oWMQ==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.19.1.tgz", + "integrity": "sha512-thFUbkHteM20BGShD6P08aungq4irbIZKUNbG70LN8RkO7YztcGPiKTTGZS7Kw+x5h8hOXs0i4OaHwFxlpQN6A==", "cpu": [ "arm64" ], @@ -575,9 +534,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.14.3.tgz", - "integrity": "sha512-Od4vE6f6CTT53yM1jgcLqNfItTsLt5zE46fdPaEmeFHvPs5SjZYlLpHrSiHEKR1+HdRfxuzXHjDOIxQyC3ptBA==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.19.1.tgz", + "integrity": "sha512-8o6eqeFZzVLia2hKPUZk4jdE3zW7LCcZr+MD18tXkgBBid3lssGVAYuox8x6YHoEPDdDa9ixTaStcmx88lio5Q==", "cpu": [ "arm64" ], @@ -588,9 +547,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.14.3.tgz", - "integrity": "sha512-0IMAO21axJeNIrvS9lSe/PGthc8ZUS+zC53O0VhF5gMxfmcKAP4ESkKOCwEi6u2asUrt4mQv2rjY8QseIEb1aw==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.19.1.tgz", + "integrity": "sha512-4T42heKsnbjkn7ovYiAdDVRRWZLU9Kmhdt6HafZxFcUdpjlBlxj4wDrt1yFWLk7G4+E+8p2C9tcmSu0KA6auGA==", "cpu": [ "x64" ], @@ -601,9 +560,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.14.3.tgz", - "integrity": "sha512-ge2DC7tHRHa3caVEoSbPRJpq7azhG+xYsd6u2MEnJ6XzPSzQsTKyXvh6iWjXRf7Rt9ykIUWHtl0Uz3T6yXPpKw==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.19.1.tgz", + "integrity": "sha512-MXg1xp+e5GhZ3Vit1gGEyoC+dyQUBy2JgVQ+3hUrD9wZMkUw/ywgkpK7oZgnB6kPpGrxJ41clkPPnsknuD6M2Q==", "cpu": [ "arm" ], @@ -614,9 +573,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.14.3.tgz", - "integrity": "sha512-ljcuiDI4V3ySuc7eSk4lQ9wU8J8r8KrOUvB2U+TtK0TiW6OFDmJ+DdIjjwZHIw9CNxzbmXY39wwpzYuFDwNXuw==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.19.1.tgz", + "integrity": "sha512-DZNLwIY4ftPSRVkJEaxYkq7u2zel7aah57HESuNkUnz+3bZHxwkCUkrfS2IWC1sxK6F2QNIR0Qr/YXw7nkF3Pw==", "cpu": [ "arm" ], @@ -627,9 +586,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.14.3.tgz", - "integrity": "sha512-Eci2us9VTHm1eSyn5/eEpaC7eP/mp5n46gTRB3Aar3BgSvDQGJZuicyq6TsH4HngNBgVqC5sDYxOzTExSU+NjA==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.19.1.tgz", + "integrity": "sha512-C7evongnjyxdngSDRRSQv5GvyfISizgtk9RM+z2biV5kY6S/NF/wta7K+DanmktC5DkuaJQgoKGf7KUDmA7RUw==", "cpu": [ "arm64" ], @@ -640,9 +599,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.14.3.tgz", - "integrity": "sha512-UrBoMLCq4E92/LCqlh+blpqMz5h1tJttPIniwUgOFJyjWI1qrtrDhhpHPuFxULlUmjFHfloWdixtDhSxJt5iKw==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.19.1.tgz", + "integrity": "sha512-89tFWqxfxLLHkAthAcrTs9etAoBFRduNfWdl2xUs/yLV+7XDrJ5yuXMHptNqf1Zw0UCA3cAutkAiAokYCkaPtw==", "cpu": [ "arm64" ], @@ -653,9 +612,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.14.3.tgz", - "integrity": "sha512-5aRjvsS8q1nWN8AoRfrq5+9IflC3P1leMoy4r2WjXyFqf3qcqsxRCfxtZIV58tCxd+Yv7WELPcO9mY9aeQyAmw==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.19.1.tgz", + "integrity": "sha512-PromGeV50sq+YfaisG8W3fd+Cl6mnOOiNv2qKKqKCpiiEke2KiKVyDqG/Mb9GWKbYMHj5a01fq/qlUR28PFhCQ==", "cpu": [ "ppc64" ], @@ -666,9 +625,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.14.3.tgz", - "integrity": "sha512-sk/Qh1j2/RJSX7FhEpJn8n0ndxy/uf0kI/9Zc4b1ELhqULVdTfN6HL31CDaTChiBAOgLcsJ1sgVZjWv8XNEsAQ==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.19.1.tgz", + "integrity": "sha512-/1BmHYh+iz0cNCP0oHCuF8CSiNj0JOGf0jRlSo3L/FAyZyG2rGBuKpkZVH9YF+x58r1jgWxvm1aRg3DHrLDt6A==", "cpu": [ "riscv64" ], @@ -679,9 +638,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.14.3.tgz", - "integrity": "sha512-jOO/PEaDitOmY9TgkxF/TQIjXySQe5KVYB57H/8LRP/ux0ZoO8cSHCX17asMSv3ruwslXW/TLBcxyaUzGRHcqg==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.19.1.tgz", + "integrity": "sha512-0cYP5rGkQWRZKy9/HtsWVStLXzCF3cCBTRI+qRL8Z+wkYlqN7zrSYm6FuY5Kd5ysS5aH0q5lVgb/WbG4jqXN1Q==", "cpu": [ "s390x" ], @@ -692,9 +651,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.14.3.tgz", - "integrity": "sha512-8ybV4Xjy59xLMyWo3GCfEGqtKV5M5gCSrZlxkPGvEPCGDLNla7v48S662HSGwRd6/2cSneMQWiv+QzcttLrrOA==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.19.1.tgz", + "integrity": "sha512-XUXeI9eM8rMP8aGvii/aOOiMvTs7xlCosq9xCjcqI9+5hBxtjDpD+7Abm1ZhVIFE1J2h2VIg0t2DX/gjespC2Q==", "cpu": [ "x64" ], @@ -705,9 +664,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.14.3.tgz", - "integrity": "sha512-s+xf1I46trOY10OqAtZ5Rm6lzHre/UiLA1J2uOhCFXWkbZrJRkYBPO6FhvGfHmdtQ3Bx793MNa7LvoWFAm93bg==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.19.1.tgz", + "integrity": "sha512-V7cBw/cKXMfEVhpSvVZhC+iGifD6U1zJ4tbibjjN+Xi3blSXaj/rJynAkCFFQfoG6VZrAiP7uGVzL440Q6Me2Q==", "cpu": [ "x64" ], @@ -718,9 +677,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.14.3.tgz", - "integrity": "sha512-+4h2WrGOYsOumDQ5S2sYNyhVfrue+9tc9XcLWLh+Kw3UOxAvrfOrSMFon60KspcDdytkNDh7K2Vs6eMaYImAZg==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.19.1.tgz", + "integrity": "sha512-88brja2vldW/76jWATlBqHEoGjJLRnP0WOEKAUbMcXaAZnemNhlAHSyj4jIwMoP2T750LE9lblvD4e2jXleZsA==", "cpu": [ "arm64" ], @@ -731,9 +690,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.14.3.tgz", - "integrity": "sha512-T1l7y/bCeL/kUwh9OD4PQT4aM7Bq43vX05htPJJ46RTI4r5KNt6qJRzAfNfM+OYMNEVBWQzR2Gyk+FXLZfogGw==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.19.1.tgz", + "integrity": "sha512-LdxxcqRVSXi6k6JUrTah1rHuaupoeuiv38du8Mt4r4IPer3kwlTo+RuvfE8KzZ/tL6BhaPlzJ3835i6CxrFIRQ==", "cpu": [ "ia32" ], @@ -744,9 +703,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.14.3.tgz", - "integrity": "sha512-/BypzV0H1y1HzgYpxqRaXGBRqfodgoBBCcsrujT6QRcakDQdfU+Lq9PENPh5jB4I44YWq+0C2eHsHya+nZY1sA==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.19.1.tgz", + "integrity": "sha512-2bIrL28PcK3YCqD9anGxDxamxdiJAxA+l7fWIwM5o8UqNy1t3d1NdAweO2XhA0KTDJ5aH1FsuiT5+7VhtHliXg==", "cpu": [ "x64" ], @@ -763,17 +722,17 @@ "dev": true }, "node_modules/@sveltejs/vite-plugin-svelte": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-3.0.2.tgz", - "integrity": "sha512-MpmF/cju2HqUls50WyTHQBZUV3ovV/Uk8k66AN2gwHogNAG8wnW8xtZDhzNBsFJJuvmq1qnzA5kE7YfMJNFv2Q==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-3.1.1.tgz", + "integrity": "sha512-rimpFEAboBBHIlzISibg94iP09k/KYdHgVhJlcsTfn7KMBhc70jFX/GRWkRdFCc2fdnk+4+Bdfej23cMDnJS6A==", "dev": true, "dependencies": { - "@sveltejs/vite-plugin-svelte-inspector": "^2.0.0", + "@sveltejs/vite-plugin-svelte-inspector": "^2.1.0", "debug": "^4.3.4", "deepmerge": "^4.3.1", "kleur": "^4.1.5", - "magic-string": "^0.30.5", - "svelte-hmr": "^0.15.3", + "magic-string": "^0.30.10", + "svelte-hmr": "^0.16.0", "vitefu": "^0.2.5" }, "engines": { @@ -785,9 +744,9 @@ } }, "node_modules/@sveltejs/vite-plugin-svelte-inspector": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte-inspector/-/vite-plugin-svelte-inspector-2.0.0.tgz", - "integrity": "sha512-gjr9ZFg1BSlIpfZ4PRewigrvYmHWbDrq2uvvPB1AmTWKuM+dI1JXQSUu2pIrYLb/QncyiIGkFDFKTwJ0XqQZZg==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte-inspector/-/vite-plugin-svelte-inspector-2.1.0.tgz", + "integrity": "sha512-9QX28IymvBlSCqsCll5t0kQVxipsfhFFL+L2t3nTWfXnddYwxBuAEtTtlaVQpRz9c37BhJjltSeY4AJSC03SSg==", "dev": true, "dependencies": { "debug": "^4.3.4" @@ -802,15 +761,15 @@ } }, "node_modules/@tsconfig/svelte": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@tsconfig/svelte/-/svelte-5.0.2.tgz", - "integrity": "sha512-BRbo1fOtyVbhfLyuCWw6wAWp+U8UQle+ZXu84MYYWzYSEB28dyfnRBIE99eoG+qdAC0po6L2ScIEivcT07UaMA==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/svelte/-/svelte-5.0.4.tgz", + "integrity": "sha512-BV9NplVgLmSi4mwKzD8BD/NQ8erOY/nUE/GpgWe2ckx+wIQF5RyRirn/QsSSCPeulVpc3RA/iJt6DpfTIZps0Q==", "dev": true }, "node_modules/@types/chai": { - "version": "4.3.11", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.11.tgz", - "integrity": "sha512-qQR1dr2rGIHYlJulmr8Ioq3De0Le9E4MJ5AiaeAETJJpndT1uUNHsGFK3L/UIu+rbkQSdj8J/w2bCsBZc/Y5fQ==", + "version": "4.3.16", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.16.tgz", + "integrity": "sha512-PatH4iOdyh3MyWtmHVFXLWCCIhUbopaltqddG9BzB+gMIzee2MJrvd+jouii9Z3wzQJruGWAm7WOMjgfG8hQlQ==", "dev": true }, "node_modules/@types/chai-subset": { @@ -829,9 +788,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", - "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "version": "20.14.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.13.tgz", + "integrity": "sha512-+bHoGiZb8UiQ0+WEtmph2IWQCjIqg8MDZMAV+ppRRhUZnquF5mQkP/9vpSwJClEiSM/C7fZZExPzfU0vJTyp8w==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -925,9 +884,9 @@ } }, "node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -937,10 +896,13 @@ } }, "node_modules/acorn-walk": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", - "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", + "version": "8.3.3", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.3.tgz", + "integrity": "sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==", "dev": true, + "dependencies": { + "acorn": "^8.11.0" + }, "engines": { "node": ">=0.4.0" } @@ -995,12 +957,12 @@ } }, "node_modules/axobject-query": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.0.0.tgz", - "integrity": "sha512-+60uv1hiVFhHZeO+Lz0RYzsVHy5Wr1ayX0mwda9KPDVLNJgZ1T9Ny7VmFbLDzxsH0D87I86vgj3gFrjTJUYznw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", + "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", "dev": true, - "dependencies": { - "dequal": "^2.0.3" + "engines": { + "node": ">= 0.4" } }, "node_modules/balanced-match": { @@ -1010,12 +972,15 @@ "dev": true }, "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", "dev": true, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/body-parser": { @@ -1080,12 +1045,12 @@ } }, "node_modules/buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-1.0.0.tgz", + "integrity": "sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==", "dev": true, "engines": { - "node": "*" + "node": ">=8.0.0" } }, "node_modules/bytes": { @@ -1125,19 +1090,10 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/chai": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", - "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz", + "integrity": "sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==", "dev": true, "dependencies": { "assertion-error": "^1.1.0", @@ -1146,7 +1102,7 @@ "get-func-name": "^2.0.2", "loupe": "^2.3.6", "pathval": "^1.1.1", - "type-detect": "^4.0.8" + "type-detect": "^4.1.0" }, "engines": { "node": ">=4" @@ -1201,12 +1157,27 @@ "periscopic": "^3.1.0" } }, + "node_modules/code-red/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "dependencies": { + "@types/estree": "^1.0.0" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/confbox": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.7.tgz", + "integrity": "sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==", + "dev": true + }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -1270,9 +1241,9 @@ } }, "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", + "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -1287,9 +1258,9 @@ } }, "node_modules/deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz", + "integrity": "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==", "dev": true, "dependencies": { "type-detect": "^4.0.0" @@ -1457,13 +1428,10 @@ "dev": true }, "node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "dev": true, - "dependencies": { - "@types/estree": "^1.0.0" - } + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true }, "node_modules/etag": { "version": "1.8.1", @@ -1531,31 +1499,6 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "dev": true }, - "node_modules/fast-glob": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", - "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fastq": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", - "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", - "dev": true, - "dependencies": { - "reusify": "^1.0.4" - } - }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -1626,9 +1569,9 @@ "dev": true }, "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, "hasInstallScript": true, "optional": true, @@ -1680,6 +1623,7 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", @@ -1763,9 +1707,9 @@ } }, "node_modules/hasown": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.1.tgz", - "integrity": "sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "dev": true, "dependencies": { "function-bind": "^1.1.2" @@ -1791,12 +1735,12 @@ } }, "node_modules/husky": { - "version": "9.0.11", - "resolved": "https://registry.npmjs.org/husky/-/husky-9.0.11.tgz", - "integrity": "sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==", + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.4.tgz", + "integrity": "sha512-bho94YyReb4JV7LYWRWxZ/xr6TtOTt8cMfmQ39MQYJ7f/YE268s3GdghGwi+y4zAeqewE5zYLvuhV0M0ijsDEA==", "dev": true, "bin": { - "husky": "bin.mjs" + "husky": "bin.js" }, "engines": { "node": ">=18" @@ -1818,31 +1762,16 @@ } }, "node_modules/immutable": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.5.tgz", - "integrity": "sha512-8eabxkth9gZatlwl5TBuJnCsoTADlL6ftEr7A4qgdaTsPyreilDSnUk57SO+jfKcNtxPa22U5KK6DSeAYhpBJw==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.7.tgz", + "integrity": "sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw==", "dev": true }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", "dev": true, "dependencies": { "once": "^1.3.0", @@ -1915,12 +1844,6 @@ "@types/estree": "*" } }, - "node_modules/jsonc-parser": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", - "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", - "dev": true - }, "node_modules/kleur": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", @@ -1958,15 +1881,12 @@ } }, "node_modules/magic-string": { - "version": "0.30.7", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.7.tgz", - "integrity": "sha512-8vBuFF/I/+OSLRmdf2wwFCJCz+nSn0m6DPvGH1fS/KiQoSaR+sETbov0eIk9KhEKy8CYqIkIAnbohxT/4H0kuA==", + "version": "0.30.11", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.11.tgz", + "integrity": "sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==", "dev": true, "dependencies": { - "@jridgewell/sourcemap-codec": "^1.4.15" - }, - "engines": { - "node": ">=12" + "@jridgewell/sourcemap-codec": "^1.5.0" } }, "node_modules/mdn-data": { @@ -1990,15 +1910,6 @@ "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==", "dev": true }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, "node_modules/methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -2008,19 +1919,6 @@ "node": ">= 0.6" } }, - "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, "node_modules/mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", @@ -2097,15 +1995,15 @@ } }, "node_modules/mlly": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.6.0.tgz", - "integrity": "sha512-YOvg9hfYQmnaB56Yb+KrJE2u0Yzz5zR+sLejEvF4fzwzV1Al6hkf2vyHTwqCRyv0hCi9rVCqVoXpyYevQIRwLQ==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.1.tgz", + "integrity": "sha512-rrVRZRELyQzrIUAVMHxP97kv+G786pHmOKzuFII8zDYahFBS7qnHh2AlYSl1GAHhaMPCz6/oHjVMcfFYgFYHgA==", "dev": true, "dependencies": { "acorn": "^8.11.3", "pathe": "^1.1.2", - "pkg-types": "^1.0.3", - "ufo": "^1.3.2" + "pkg-types": "^1.1.1", + "ufo": "^1.5.3" } }, "node_modules/mri": { @@ -2169,10 +2067,13 @@ } }, "node_modules/object-inspect": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", - "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", "dev": true, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -2213,18 +2114,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -2275,10 +2164,19 @@ "is-reference": "^3.0.0" } }, + "node_modules/periscopic/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "dependencies": { + "@types/estree": "^1.0.0" + } + }, "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", "dev": true }, "node_modules/picomatch": { @@ -2294,64 +2192,50 @@ } }, "node_modules/pkg-types": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", - "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.1.3.tgz", + "integrity": "sha512-+JrgthZG6m3ckicaOB74TwQ+tBWsFl3qVQg7mN8ulwSOElJ7gBhKzj2VkCPnZ4NlF6kEquYU+RIYNVAvzd54UA==", "dev": true, "dependencies": { - "jsonc-parser": "^3.2.0", - "mlly": "^1.2.0", - "pathe": "^1.1.0" + "confbox": "^0.1.7", + "mlly": "^1.7.1", + "pathe": "^1.1.2" } }, "node_modules/playwright": { - "version": "1.44.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.44.1.tgz", - "integrity": "sha512-qr/0UJ5CFAtloI3avF95Y0L1xQo6r3LQArLIg/z/PoGJ6xa+EwzrwO5lpNr/09STxdHuUoP2mvuELJS+hLdtgg==", + "version": "1.45.3", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.45.3.tgz", + "integrity": "sha512-QhVaS+lpluxCaioejDZ95l4Y4jSFCsBvl2UZkpeXlzxmqS+aABr5c82YmfMHrL6x27nvrvykJAFpkzT2eWdJww==", "dev": true, "dependencies": { - "playwright-core": "1.44.1" + "playwright-core": "1.45.3" }, "bin": { "playwright": "cli.js" }, "engines": { - "node": ">=16" + "node": ">=18" }, "optionalDependencies": { "fsevents": "2.3.2" } }, "node_modules/playwright-core": { - "version": "1.44.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.44.1.tgz", - "integrity": "sha512-wh0JWtYTrhv1+OSsLPgFzGzt67Y7BE/ZS3jEqgGBlp2ppp1ZDj8c+9IARNW4dwf1poq5MgHreEM2KV/GuR4cFA==", + "version": "1.45.3", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.45.3.tgz", + "integrity": "sha512-+ym0jNbcjikaOwwSZycFbwkWgfruWvYlJfThKYAlImbxUgdWFO2oW70ojPm4OpE4t6TAo2FY/smM+hpVTtkhDA==", "dev": true, "bin": { "playwright-core": "cli.js" }, "engines": { - "node": ">=16" - } - }, - "node_modules/playwright/node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + "node": ">=18" } }, "node_modules/postcss": { - "version": "8.4.38", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", - "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==", + "version": "8.4.40", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.40.tgz", + "integrity": "sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==", "dev": true, "funding": [ { @@ -2369,7 +2253,7 @@ ], "dependencies": { "nanoid": "^3.3.7", - "picocolors": "^1.0.0", + "picocolors": "^1.0.1", "source-map-js": "^1.2.0" }, "engines": { @@ -2392,9 +2276,9 @@ } }, "node_modules/prettier-plugin-svelte": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-3.2.3.tgz", - "integrity": "sha512-wJq8RunyFlWco6U0WJV5wNCM7zpBFakS76UBSbmzMGpncpK98NZABaE+s7n8/APDCEVNHXC5Mpq+MLebQtsRlg==", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-3.2.6.tgz", + "integrity": "sha512-Y1XWLw7vXUQQZmgv1JAEiLcErqUniAF2wO7QJsw8BVMvpLET2dI5WpEIEJx1r11iHVdSMzQxivyfrH9On9t2IQ==", "dev": true, "peerDependencies": { "prettier": "^3.0.0", @@ -2443,26 +2327,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", @@ -2488,9 +2352,9 @@ } }, "node_modules/react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", "dev": true }, "node_modules/readdirp": { @@ -2505,29 +2369,11 @@ "node": ">=8.10.0" } }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, "node_modules/rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", "dev": true, "dependencies": { "glob": "^7.1.3" @@ -2537,9 +2383,9 @@ } }, "node_modules/rollup": { - "version": "4.14.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.14.3.tgz", - "integrity": "sha512-ag5tTQKYsj1bhrFC9+OEWqb5O6VYgtQDO9hPDBMmIbePwhfSr+ExlcU741t8Dhw5DkPCQf6noz0jb36D6W9/hw==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.19.1.tgz", + "integrity": "sha512-K5vziVlg7hTpYfFBI+91zHBEMo6jafYXpkMlqZjg7/zhIG9iHqazBf4xz9AVdjS9BruRn280ROqLI7G3OFRIlw==", "dev": true, "dependencies": { "@types/estree": "1.0.5" @@ -2552,22 +2398,22 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.14.3", - "@rollup/rollup-android-arm64": "4.14.3", - "@rollup/rollup-darwin-arm64": "4.14.3", - "@rollup/rollup-darwin-x64": "4.14.3", - "@rollup/rollup-linux-arm-gnueabihf": "4.14.3", - "@rollup/rollup-linux-arm-musleabihf": "4.14.3", - "@rollup/rollup-linux-arm64-gnu": "4.14.3", - "@rollup/rollup-linux-arm64-musl": "4.14.3", - "@rollup/rollup-linux-powerpc64le-gnu": "4.14.3", - "@rollup/rollup-linux-riscv64-gnu": "4.14.3", - "@rollup/rollup-linux-s390x-gnu": "4.14.3", - "@rollup/rollup-linux-x64-gnu": "4.14.3", - "@rollup/rollup-linux-x64-musl": "4.14.3", - "@rollup/rollup-win32-arm64-msvc": "4.14.3", - "@rollup/rollup-win32-ia32-msvc": "4.14.3", - "@rollup/rollup-win32-x64-msvc": "4.14.3", + "@rollup/rollup-android-arm-eabi": "4.19.1", + "@rollup/rollup-android-arm64": "4.19.1", + "@rollup/rollup-darwin-arm64": "4.19.1", + "@rollup/rollup-darwin-x64": "4.19.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.19.1", + "@rollup/rollup-linux-arm-musleabihf": "4.19.1", + "@rollup/rollup-linux-arm64-gnu": "4.19.1", + "@rollup/rollup-linux-arm64-musl": "4.19.1", + "@rollup/rollup-linux-powerpc64le-gnu": "4.19.1", + "@rollup/rollup-linux-riscv64-gnu": "4.19.1", + "@rollup/rollup-linux-s390x-gnu": "4.19.1", + "@rollup/rollup-linux-x64-gnu": "4.19.1", + "@rollup/rollup-linux-x64-musl": "4.19.1", + "@rollup/rollup-win32-arm64-msvc": "4.19.1", + "@rollup/rollup-win32-ia32-msvc": "4.19.1", + "@rollup/rollup-win32-x64-msvc": "4.19.1", "fsevents": "~2.3.2" } }, @@ -2586,29 +2432,6 @@ "rollup": "<5" } }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, "node_modules/sade": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", @@ -2660,9 +2483,9 @@ } }, "node_modules/sass": { - "version": "1.71.1", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.71.1.tgz", - "integrity": "sha512-wovtnV2PxzteLlfNzbgm1tFXPLoZILYAMJtvoXXkD7/+1uP41eKkIt1ypWq5/q2uT94qHjXehEYfmjKOvjL9sg==", + "version": "1.77.8", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.77.8.tgz", + "integrity": "sha512-4UHg6prsrycW20fqLGPShtEvo/WyHRVRHwOP4DzkUrObWoWI05QBSfzU71TVB7PFaL104TwNaHpjlWXAZbQiNQ==", "dev": true, "dependencies": { "chokidar": ">=3.0.0 <4.0.0", @@ -2737,17 +2560,17 @@ } }, "node_modules/set-function-length": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.1.tgz", - "integrity": "sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", "dev": true, "dependencies": { - "define-data-property": "^1.1.2", + "define-data-property": "^1.1.4", "es-errors": "^1.3.0", "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.3", + "get-intrinsic": "^1.2.4", "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.1" + "has-property-descriptors": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -2760,12 +2583,12 @@ "dev": true }, "node_modules/side-channel": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.5.tgz", - "integrity": "sha512-QcgiIWV4WV7qWExbN5llt6frQB/lBven9pqliLXfGPB+K9ZYXxDozp0wLkHS24kWCm+6YXH/f0HhnObZnZOBnQ==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dev": true, "dependencies": { - "call-bind": "^1.0.6", + "call-bind": "^1.0.7", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.4", "object-inspect": "^1.13.1" @@ -2784,13 +2607,13 @@ "dev": true }, "node_modules/sorcery": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/sorcery/-/sorcery-0.11.0.tgz", - "integrity": "sha512-J69LQ22xrQB1cIFJhPfgtLuI6BpWRiWu1Y3vSsIwK/eAScqJxd/+CJlUuHQRdX2C9NGFamq+KqNywGgaThwfHw==", + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/sorcery/-/sorcery-0.11.1.tgz", + "integrity": "sha512-o7npfeJE6wi6J9l0/5LKshFzZ2rMatRiCDwYeDQaOzqdzRJwALhX7mk/A/ecg6wjMu7wdZbmXfD2S/vpOg0bdQ==", "dev": true, "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.14", - "buffer-crc32": "^0.2.5", + "buffer-crc32": "^1.0.0", "minimist": "^1.2.0", "sander": "^0.5.0" }, @@ -2853,9 +2676,9 @@ } }, "node_modules/svelte": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/svelte/-/svelte-4.2.11.tgz", - "integrity": "sha512-YIQk3J4X89wOLhjsqIW8tqY3JHPuBdtdOIkASP2PZeAMcSW9RsIjQzMesCrxOF3gdWYC0mKknlKF7OqmLM+Zqg==", + "version": "4.2.18", + "resolved": "https://registry.npmjs.org/svelte/-/svelte-4.2.18.tgz", + "integrity": "sha512-d0FdzYIiAePqRJEb90WlJDkjUEx42xhivxN8muUBmfZnP+tzUgz12DJ2hRJi8sIHCME7jeK1PTMgKPSfTd8JrA==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.1", @@ -2878,18 +2701,16 @@ } }, "node_modules/svelte-check": { - "version": "3.6.4", - "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-3.6.4.tgz", - "integrity": "sha512-mY/dqucqm46p72M8yZmn81WPZx9mN6uuw8UVfR3ZKQeLxQg5HDGO3HHm5AZuWZPYNMLJ+TRMn+TeN53HfQ/vsw==", + "version": "3.8.4", + "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-3.8.4.tgz", + "integrity": "sha512-61aHMkdinWyH8BkkTX9jPLYxYzaAAz/FK/VQqdr2FiCQQ/q04WCwDlpGbHff1GdrMYTmW8chlTFvRWL9k0A8vg==", "dev": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.17", "chokidar": "^3.4.1", - "fast-glob": "^3.2.7", - "import-fresh": "^3.2.1", "picocolors": "^1.0.0", "sade": "^1.7.4", - "svelte-preprocess": "^5.1.0", + "svelte-preprocess": "^5.1.3", "typescript": "^5.0.3" }, "bin": { @@ -2900,9 +2721,9 @@ } }, "node_modules/svelte-hmr": { - "version": "0.15.3", - "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.15.3.tgz", - "integrity": "sha512-41snaPswvSf8TJUhlkoJBekRrABDXDMdpNpT2tfHIv4JuhgvHqLMhEPGtaQn0BmbNSTkuz2Ed20DF2eHw0SmBQ==", + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.16.0.tgz", + "integrity": "sha512-Gyc7cOS3VJzLlfj7wKS0ZnzDVdv3Pn2IuVeJPk9m2skfhcu5bq3wtIZyQGggr7/Iim5rH5cncyQft/kRLupcnA==", "dev": true, "engines": { "node": "^12.20 || ^14.13.1 || >= 16" @@ -2912,9 +2733,9 @@ } }, "node_modules/svelte-preprocess": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-5.1.3.tgz", - "integrity": "sha512-xxAkmxGHT+J/GourS5mVJeOXZzne1FR5ljeOUAMXUkfEhkLEllRreXpbl3dIYJlcJRfL1LO1uIAPpBpBfiqGPw==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-5.1.4.tgz", + "integrity": "sha512-IvnbQ6D6Ao3Gg6ftiM5tdbR6aAETwjhHV+UKGf5bHGYR69RQvF1ho0JKPcbUON4vy4R7zom13jPjgdOWCQ5hDA==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -2925,8 +2746,7 @@ "strip-indent": "^3.0.0" }, "engines": { - "node": ">= 16.0.0", - "pnpm": "^8.0.0" + "node": ">= 16.0.0" }, "peerDependencies": { "@babel/core": "^7.10.2", @@ -2974,10 +2794,19 @@ } } }, + "node_modules/svelte/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "dependencies": { + "@types/estree": "^1.0.0" + } + }, "node_modules/tinybench": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.6.0.tgz", - "integrity": "sha512-N8hW3PG/3aOoZAN5V/NSAEDz0ZixDSSt5b/a05iqtpgfLWMSVuCo7w0k2vVvEjdrIoeGqZzweX2WlyioNIHchA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.8.0.tgz", + "integrity": "sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==", "dev": true }, "node_modules/tinypool": { @@ -3020,15 +2849,15 @@ } }, "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", "dev": true }, "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", + "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", "dev": true, "engines": { "node": ">=4" @@ -3048,9 +2877,9 @@ } }, "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", + "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -3061,9 +2890,9 @@ } }, "node_modules/ufo": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.4.0.tgz", - "integrity": "sha512-Hhy+BhRBleFjpJ2vchUNN40qgkh0366FWJGqVLYBHev0vpHTrXSA0ryT+74UiW6KWsldNurQMKGqCm1M2zBciQ==", + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.4.tgz", + "integrity": "sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==", "dev": true }, "node_modules/undici-types": { @@ -3100,13 +2929,13 @@ } }, "node_modules/vite": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.3.0.tgz", - "integrity": "sha512-hA6vAVK977NyW1Qw+fLvqSo7xDPej7von7C3DwwqPRmnnnK36XEBC/J3j1V5lP8fbt7y0TgTKJbpNGSwM+Bdeg==", + "version": "5.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.3.5.tgz", + "integrity": "sha512-MdjglKR6AQXQb9JGiS7Rc2wC6uMjcm7Go/NHNO63EwiJXfuk9PgqiP/n5IDJCziMkfw9n4Ubp7lttNwz+8ZVKA==", "dev": true, "dependencies": { "esbuild": "^0.21.3", - "postcss": "^8.4.38", + "postcss": "^8.4.39", "rollup": "^4.13.0" }, "bin": { @@ -3177,6 +3006,20 @@ "url": "https://opencollective.com/vitest" } }, + "node_modules/vite/node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/vitefu": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-0.2.5.tgz", @@ -3269,9 +3112,9 @@ } }, "node_modules/why-is-node-running": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", - "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", "dev": true, "dependencies": { "siginfo": "^2.0.0", @@ -3291,9 +3134,9 @@ "dev": true }, "node_modules/yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.1.1.tgz", + "integrity": "sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==", "dev": true, "engines": { "node": ">=12.20" diff --git a/package.json b/package.json index c94e1b9..0f88825 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "altcha", "description": "GDPR compliant, self-hosted CAPTCHA alternative.", - "version": "0.6.6", + "version": "0.6.7", "license": "MIT", "author": { "name": "Daniel Regeci", diff --git a/src/declarations.d.ts b/src/declarations.d.ts index fab5709..4eea955 100644 --- a/src/declarations.d.ts +++ b/src/declarations.d.ts @@ -3,9 +3,60 @@ export {}; declare module 'altcha'; declare global { + type AltchaState = 'error' | 'expired' | 'verified' | 'verifying' | 'unverified'; + + interface AltchaStateChangeEvent extends CustomEvent<{ + payload?: string; + state: AltchaState; + }> {} + + interface AltchaVerifiedEvent extends CustomEvent<{ + payload: string; + }> {} + + interface AltchaServerVerificationEvent extends CustomEvent> {} + + interface AltchaWidget { + auto?: 'onfocus' | 'onload' | 'onsubmit'; + blockspam?: boolean; + challengeurl?: string; + challengejson?: string; + debug?: boolean; + delay?: number; + expire?: number; + floating?: 'auto' | 'top' | 'bottom' | 'false' | '' | boolean; + floatinganchor?: string; + floatingoffset?: number; + hidefooter?: boolean; + hidelogo?: boolean; + name?: string; + maxnumber?: number; + mockerror?: boolean; + refetchonexpire?: boolean; + spamfilter?: boolean | 'ipAddress'; + strings?: string; + test?: boolean | number; + verifyurl?: string; + workers?: number; + workerurl?: string; + } + + declare namespace svelteHTML { + interface IntrinsicElements { + 'altcha-widget': AltchaWidgetSvelte; + } + + interface AltchaWidgetSvelte extends AltchaWidget { + 'on:statechange'?: (event: AltchaStateChangeEvent) => void; + 'on:serververification'?: (event: AltchaServerVerificationEvent) => void; + 'on:verified'?: (event: AltchaVerifiedEvent) => void; + style?: string; + } + } + namespace JSX { interface IntrinsicElements { - 'altcha-widget': AltchaWidget; + 'altcha-widget': AltchaWidgetReact; } interface AltchaWidgetCSSProperties extends React.CSSProperties { @@ -20,31 +71,9 @@ declare global { '--altcha-max-width'?: string; } - interface AltchaWidget extends React.HTMLAttributes { - auto?: 'onfocus' | 'onload' | 'onsubmit'; - blockspam?: boolean; - challengeurl?: string; - challengejson?: string; - debug?: boolean; - delay?: number; - expire?: number; - floating?: 'auto' | 'top' | 'bottom' | 'false' | '' | boolean; - floatinganchor?: string; - floatingoffset?: number; - hidefooter?: boolean; - hidelogo?: boolean; - name?: string; - maxnumber?: number; - mockerror?: boolean; + interface AltchaWidgetReact extends AltchaWidget extends React.HTMLAttributes { ref?: React.RefObject; - refetchonexpire?: boolean; - spamfilter?: boolean | 'ipAddress'; - strings?: string; style?: AltchaWidgetCSSProperties; - test?: boolean | number; - verifyurl?: string; - workers?: number; - workerurl?: string; } } } \ No newline at end of file