altcha 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/altcha.js +2 -2
- package/dist/altcha.umd.cjs +1 -1
- package/dist_external/altcha.js +136 -136
- package/dist_external/altcha.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/altcha.js
CHANGED
|
@@ -900,7 +900,7 @@ function or(r, e, t) {
|
|
|
900
900
|
jt(() => {
|
|
901
901
|
m && (m.removeEventListener("submit", Le), m.removeEventListener("reset", Re), m.removeEventListener("focusin", Ce), m = null), W && (clearTimeout(W), W = null), document.removeEventListener("click", Ne), document.removeEventListener("scroll", Se), window.removeEventListener("resize", Te);
|
|
902
902
|
}), St(() => {
|
|
903
|
-
C("mounted", "0.6.
|
|
903
|
+
C("mounted", "0.6.1"), C("workers", ie), h && C("using test mode"), D && ae(D), s !== void 0 && C("auto", s), k !== void 0 && Ze(k), m = E.closest("form"), m && (m.addEventListener("submit", Le, { capture: !0 }), m.addEventListener("reset", Re), s === "onfocus" && m.addEventListener("focusin", Ce)), s === "onload" && q();
|
|
904
904
|
});
|
|
905
905
|
function C(...n) {
|
|
906
906
|
(U || n.some((f) => f instanceof Error)) && console[n[0] instanceof Error ? "error" : "log"]("ALTCHA", ...n);
|
|
@@ -1042,7 +1042,7 @@ function or(r, e, t) {
|
|
|
1042
1042
|
k && we();
|
|
1043
1043
|
}
|
|
1044
1044
|
function je() {
|
|
1045
|
-
M === b.VERIFYING && alert(l.waitAlert);
|
|
1045
|
+
M === b.VERIFYING && l.waitAlert && alert(l.waitAlert);
|
|
1046
1046
|
}
|
|
1047
1047
|
function ut(n) {
|
|
1048
1048
|
k && M !== b.UNVERIFIED && requestAnimationFrame(() => {
|
package/dist/altcha.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(F,M){typeof exports=="object"&&typeof module<"u"?M(exports):typeof define=="function"&&define.amd?define(["exports"],M):(F=typeof globalThis<"u"?globalThis:F||self,M(F.altcha={}))})(this,function(F){"use strict";var lr=Object.defineProperty;var sr=(F,M,te)=>M in F?lr(F,M,{enumerable:!0,configurable:!0,writable:!0,value:te}):F[M]=te;var X=(F,M,te)=>sr(F,typeof M!="symbol"?M+"":M,te);const M="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGQoZSl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KGUpXS5tYXAodD0+dC50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBwKGUsdCxvKXtyZXR1cm4gZChhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUoZSt0KSkpfWZ1bmN0aW9uIGcoZSx0LG89IlNIQS0yNTYiLGw9MWU2LGM9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyLGk9RGF0ZS5ub3coKTtyZXR1cm57cHJvbWlzZTooYXN5bmMoKT0+e2ZvcihsZXQgbj1jO248PWw7bis9MSl7aWYoYS5zaWduYWwuYWJvcnRlZClyZXR1cm4gbnVsbDtpZihhd2FpdCBwKHQsbixvKT09PWUpcmV0dXJue251bWJlcjpuLHRvb2s6RGF0ZS5ub3coKS1pfX1yZXR1cm4gbnVsbH0pKCksY29udHJvbGxlcjphfX1sZXQgcjtvbm1lc3NhZ2U9YXN5bmMgZT0+e2NvbnN0e3R5cGU6dCxwYXlsb2FkOm99PWUuZGF0YTtpZih0PT09ImFib3J0IilyPT1udWxsfHxyLmFib3J0KCkscj12b2lkIDA7ZWxzZSBpZih0PT09IndvcmsiKXtjb25zdHthbGc6bCxjaGFsbGVuZ2U6YyxtYXg6YSxzYWx0Omksc3RhcnQ6dX09b3x8e30sbj1nKGMsaSxsLGEsdSk7cj1uLmNvbnRyb2xsZXIsbi5wcm9taXNlLnRoZW4ocz0+e3NlbGYucG9zdE1lc3NhZ2UocyYmey4uLnMsd29ya2VyOiEwfSl9KX19fSkoKTsK",te=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0)),Le=typeof window<"u"&&window.Blob&&new Blob([te(M)],{type:"text/javascript;charset=utf-8"});function ft(r){let e;try{if(e=Le&&(window.URL||window.webkitURL).createObjectURL(Le),!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,"+M,{name:r==null?void 0:r.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}function re(){}function Re(r){return r()}function ze(){return Object.create(null)}function se(r){r.forEach(Re)}function Ie(r){return typeof r=="function"}function ut(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function dt(r){return Object.keys(r).length===0}function y(r,e){r.appendChild(e)}function ht(r,e,t){const i=gt(r);if(!i.getElementById(e)){const o=L("style");o.id=e,o.textContent=t,mt(i,o)}}function gt(r){if(!r)return document;const e=r.getRootNode?r.getRootNode():r.ownerDocument;return e&&e.host?e:r.ownerDocument}function mt(r,e){return y(r.head||r,e),e.sheet}function V(r,e,t){r.insertBefore(e,t||null)}function j(r){r.parentNode&&r.parentNode.removeChild(r)}function L(r){return document.createElement(r)}function O(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function bt(r){return document.createTextNode(r)}function P(){return bt(" ")}function we(r,e,t,i){return r.addEventListener(e,t,i),()=>r.removeEventListener(e,t,i)}function c(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function wt(r){return Array.from(r.childNodes)}function Ae(r,e,t){r.classList.toggle(e,!!t)}function vt(r,e,{bubbles:t=!1,cancelable:i=!1}={}){return new CustomEvent(r,{detail:e,bubbles:t,cancelable:i})}function yt(r){const e={};return r.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let ce;function ae(r){ce=r}function ve(){if(!ce)throw new Error("Function called outside component initialization");return ce}function pt(r){ve().$$.on_mount.push(r)}function _t(r){ve().$$.on_destroy.push(r)}function kt(){const r=ve();return(e,t,{cancelable:i=!1}={})=>{const o=r.$$.callbacks[e];if(o){const l=vt(e,t,{cancelable:i});return o.slice().forEach(s=>{s.call(r,l)}),!l.defaultPrevented}return!0}}const ne=[],ue=[];let ie=[];const Ne=[],Se=Promise.resolve();let ye=!1;function Te(){ye||(ye=!0,Se.then(w))}function xt(){return Te(),Se}function pe(r){ie.push(r)}const _e=new Set;let oe=0;function w(){if(oe!==0)return;const r=ce;do{try{for(;oe<ne.length;){const e=ne[oe];oe++,ae(e),Et(e.$$)}}catch(e){throw ne.length=0,oe=0,e}for(ae(null),ne.length=0,oe=0;ue.length;)ue.pop()();for(let e=0;e<ie.length;e+=1){const t=ie[e];_e.has(t)||(_e.add(t),t())}ie.length=0}while(ne.length);for(;Ne.length;)Ne.pop()();ye=!1,_e.clear(),ae(r)}function Et(r){if(r.fragment!==null){r.update(),se(r.before_update);const e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(pe)}}function Ct(r){const e=[],t=[];ie.forEach(i=>r.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),ie=e}const Lt=new Set;function Rt(r,e){r&&r.i&&(Lt.delete(r),r.i(e))}function zt(r,e,t){const{fragment:i,after_update:o}=r.$$;i&&i.m(e,t),pe(()=>{const l=r.$$.on_mount.map(Re).filter(Ie);r.$$.on_destroy?r.$$.on_destroy.push(...l):se(l),r.$$.on_mount=[]}),o.forEach(pe)}function It(r,e){const t=r.$$;t.fragment!==null&&(Ct(t.after_update),se(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function At(r,e){r.$$.dirty[0]===-1&&(ne.push(r),Te(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<<e%31}function Nt(r,e,t,i,o,l,s=null,u=[-1]){const a=ce;ae(r);const d=r.$$={fragment:null,ctx:[],props:l,update:re,not_equal:o,bound:ze(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:ze(),dirty:u,skip_bound:!1,root:e.target||a.$$.root};s&&s(d.root);let G=!1;if(d.ctx=t?t(r,e.props||{},(S,U,...k)=>{const W=k.length?k[0]:U;return d.ctx&&o(d.ctx[S],d.ctx[S]=W)&&(!d.skip_bound&&d.bound[S]&&d.bound[S](W),G&&At(r,S)),U}):[],d.update(),G=!0,se(d.before_update),d.fragment=i?i(d.ctx):!1,e.target){if(e.hydrate){const S=wt(e.target);d.fragment&&d.fragment.l(S),S.forEach(j)}else d.fragment&&d.fragment.c();e.intro&&Rt(r.$$.fragment),zt(r,e.target,e.anchor),w()}ae(a)}let je;typeof HTMLElement=="function"&&(je=class extends HTMLElement{constructor(e,t,i){super();X(this,"$$ctor");X(this,"$$s");X(this,"$$c");X(this,"$$cn",!1);X(this,"$$d",{});X(this,"$$r",!1);X(this,"$$p_d",{});X(this,"$$l",{});X(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 s;return{c:function(){s=L("slot"),l!=="default"&&c(s,"name",l)},m:function(d,G){V(d,s,G)},d:function(d){d&&j(s)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},i=yt(this);for(const l of this.$$s)l in i&&(t[l]=[e(l)]);for(const l of this.attributes){const s=this.$$g_p(l.name);s in this.$$d||(this.$$d[s]=de(s,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 s=de(l,this.$$d[l],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,s)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const l in this.$$l)for(const s of this.$$l[l]){const u=this.$$c.$on(l,s);this.$$l_u.set(s,u)}this.$$l={}}}attributeChangedCallback(e,t,i){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=de(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 de(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 St(r,e,t,i,o,l){let s=class extends je{constructor(){super(r,t,o),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(u=>(e[u].attribute||u).toLowerCase())}};return Object.keys(e).forEach(u=>{Object.defineProperty(s.prototype,u,{get(){return this.$$c&&u in this.$$c?this.$$c[u]:this.$$d[u]},set(a){var d;a=de(u,a,e),this.$$d[u]=a,(d=this.$$c)==null||d.$set({[u]:a})}})}),i.forEach(u=>{Object.defineProperty(s.prototype,u,{get(){var a;return(a=this.$$c)==null?void 0:a[u]}})}),l&&(s=l(s)),r.element=s,s}class Tt{constructor(){X(this,"$$");X(this,"$$set")}$destroy(){It(this,1),this.$destroy=re}$on(e,t){if(!Ie(t))return re;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&&!dt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const jt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(jt);const Zt=new TextEncoder;function Mt(r){return[...new Uint8Array(r)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function Vt(r,e="SHA-256",t=1e5){const i=Date.now().toString(16);r||(r=Math.round(Math.random()*t));const o=await Ze(i,r,e);return{algorithm:e,challenge:o,salt:i,signature:""}}async function Ze(r,e,t){return Mt(await crypto.subtle.digest(t.toUpperCase(),Zt.encode(r+e)))}function $t(r,e,t="SHA-256",i=1e6,o=0){const l=new AbortController,s=Date.now();return{promise:(async()=>{for(let a=o;a<=i;a+=1){if(l.signal.aborted)return null;if(await Ze(e,a,t)===r)return{number:a,took:Date.now()-s}}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 Dt(r){ht(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 Me(r){let e,t,i;return{c(){e=O("svg"),t=O("path"),i=O("path"),c(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"),c(t,"fill","currentColor"),c(t,"opacity",".25"),c(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"),c(i,"fill","currentColor"),c(i,"class","altcha-spinner svelte-ddsc3z"),c(e,"width","24"),c(e,"height","24"),c(e,"viewBox","0 0 24 24"),c(e,"xmlns","http://www.w3.org/2000/svg")},m(o,l){V(o,e,l),y(e,t),y(e,i)},d(o){o&&j(e)}}}function Ut(r){let e,t=r[11].label+"",i;return{c(){e=L("label"),c(e,"for",i=r[4]+"_checkbox"),c(e,"class","svelte-ddsc3z")},m(o,l){V(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")&&c(e,"for",i)},d(o){o&&j(e)}}}function Ft(r){let e,t=r[11].verifying+"";return{c(){e=L("span")},m(i,o){V(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].verifying+"")&&(e.innerHTML=t)},d(i){i&&j(e)}}}function Gt(r){let e,t=r[11].verified+"",i,o;return{c(){e=L("span"),i=P(),o=L("input"),c(o,"type","hidden"),c(o,"name",r[4]),o.value=r[5]},m(l,s){V(l,e,s),e.innerHTML=t,V(l,i,s),V(l,o,s)},p(l,s){s[0]&2048&&t!==(t=l[11].verified+"")&&(e.innerHTML=t),s[0]&16&&c(o,"name",l[4]),s[0]&32&&(o.value=l[5])},d(l){l&&(j(e),j(i),j(o))}}}function Ve(r){let e,t,i,o,l,s,u;return{c(){e=L("div"),t=L("a"),i=O("svg"),o=O("path"),l=O("path"),s=O("path"),c(o,"d","M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"),c(o,"fill","currentColor"),c(l,"d","M3.57212 2.33956C1.65755 3.94607 0.496389 6.11731 0.12782 8.40523L2.04639 9.13961C2.26047 7.15832 3.21057 5.25375 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577L13.8302 6.78606L19.9633 9.13364C19.7929 7.15555 19.0335 5.20847 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956Z"),c(l,"fill","currentColor"),c(s,"d","M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"),c(s,"fill","currentColor"),c(i,"width","22"),c(i,"height","22"),c(i,"viewBox","0 0 20 20"),c(i,"fill","none"),c(i,"xmlns","http://www.w3.org/2000/svg"),c(t,"href",Ge),c(t,"target","_blank"),c(t,"class","altcha-logo svelte-ddsc3z"),c(t,"aria-label",u=r[11].ariaLinkLabel)},m(a,d){V(a,e,d),y(e,t),y(t,i),y(i,o),y(i,l),y(i,s)},p(a,d){d[0]&2048&&u!==(u=a[11].ariaLinkLabel)&&c(t,"aria-label",u)},d(a){a&&j(e)}}}function $e(r){let e,t,i,o;function l(a,d){return a[6]===m.EXPIRED?Xt:Wt}let s=l(r),u=s(r);return{c(){e=L("div"),t=O("svg"),i=O("path"),o=P(),u.c(),c(i,"stroke-linecap","round"),c(i,"stroke-linejoin","round"),c(i,"d","M6 18L18 6M6 6l12 12"),c(t,"width","14"),c(t,"height","14"),c(t,"xmlns","http://www.w3.org/2000/svg"),c(t,"fill","none"),c(t,"viewBox","0 0 24 24"),c(t,"stroke-width","1.5"),c(t,"stroke","currentColor"),c(e,"class","altcha-error svelte-ddsc3z")},m(a,d){V(a,e,d),y(e,t),y(t,i),y(e,o),u.m(e,null)},p(a,d){s===(s=l(a))&&u?u.p(a,d):(u.d(1),u=s(a),u&&(u.c(),u.m(e,null)))},d(a){a&&j(e),u.d()}}}function Wt(r){let e,t=r[11].error+"";return{c(){e=L("div"),c(e,"title",r[10])},m(i,o){V(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].error+"")&&(e.innerHTML=t),o[0]&1024&&c(e,"title",i[10])},d(i){i&&j(e)}}}function Xt(r){let e,t=r[11].expired+"";return{c(){e=L("div"),c(e,"title",r[10])},m(i,o){V(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].expired+"")&&(e.innerHTML=t),o[0]&1024&&c(e,"title",i[10])},d(i){i&&j(e)}}}function De(r){let e,t,i=r[11].footer+"";return{c(){e=L("div"),t=L("div"),c(t,"class","svelte-ddsc3z"),c(e,"class","altcha-footer svelte-ddsc3z")},m(o,l){V(o,e,l),y(e,t),t.innerHTML=i},p(o,l){l[0]&2048&&i!==(i=o[11].footer+"")&&(t.innerHTML=i)},d(o){o&&j(e)}}}function Ue(r){let e;return{c(){e=L("div"),c(e,"class","altcha-anchor-arrow svelte-ddsc3z")},m(t,i){V(t,e,i),r[36](e)},p:re,d(t){t&&j(e),r[36](null)}}}function Bt(r){let e,t,i,o,l,s,u,a,d,G,S,U,k,W,J,N=r[6]===m.VERIFYING&&Me();function le(h,p){return h[6]===m.VERIFIED?Gt:h[6]===m.VERIFYING?Ft:Ut}let Y=le(r),T=Y(r),R=r[3]!==!0&&Ve(r),z=(r[10]||r[6]===m.EXPIRED)&&$e(r),v=r[11].footer&&r[2]!==!0&&De(r),I=r[1]&&Ue(r);return{c(){e=L("div"),t=L("div"),N&&N.c(),i=P(),o=L("div"),l=L("input"),a=P(),d=L("div"),T.c(),G=P(),R&&R.c(),S=P(),z&&z.c(),U=P(),v&&v.c(),k=P(),I&&I.c(),c(l,"type","checkbox"),c(l,"id",s=r[4]+"_checkbox"),l.required=u=r[0]!=="onsubmit",c(l,"class","svelte-ddsc3z"),c(o,"class","altcha-checkbox svelte-ddsc3z"),Ae(o,"altcha-hidden",r[6]===m.VERIFYING),c(d,"class","altcha-label svelte-ddsc3z"),c(t,"class","altcha-main svelte-ddsc3z"),c(e,"class","altcha svelte-ddsc3z"),c(e,"data-state",r[6]),c(e,"data-floating",r[1])},m(h,p){V(h,e,p),y(e,t),N&&N.m(t,null),y(t,i),y(t,o),y(o,l),l.checked=r[7],y(t,a),y(t,d),T.m(d,null),y(t,G),R&&R.m(t,null),y(e,S),z&&z.m(e,null),y(e,U),v&&v.m(e,null),y(e,k),I&&I.m(e,null),r[37](e),W||(J=[we(l,"change",r[35]),we(l,"change",r[12]),we(l,"invalid",r[13])],W=!0)},p(h,p){h[6]===m.VERIFYING?N||(N=Me(),N.c(),N.m(t,i)):N&&(N.d(1),N=null),p[0]&16&&s!==(s=h[4]+"_checkbox")&&c(l,"id",s),p[0]&1&&u!==(u=h[0]!=="onsubmit")&&(l.required=u),p[0]&128&&(l.checked=h[7]),p[0]&64&&Ae(o,"altcha-hidden",h[6]===m.VERIFYING),Y===(Y=le(h))&&T?T.p(h,p):(T.d(1),T=Y(h),T&&(T.c(),T.m(d,null))),h[3]!==!0?R?R.p(h,p):(R=Ve(h),R.c(),R.m(t,null)):R&&(R.d(1),R=null),h[10]||h[6]===m.EXPIRED?z?z.p(h,p):(z=$e(h),z.c(),z.m(e,U)):z&&(z.d(1),z=null),h[11].footer&&h[2]!==!0?v?v.p(h,p):(v=De(h),v.c(),v.m(e,k)):v&&(v.d(1),v=null),h[1]?I?I.p(h,p):(I=Ue(h),I.c(),I.m(e,null)):I&&(I.d(1),I=null),p[0]&64&&c(e,"data-state",h[6]),p[0]&2&&c(e,"data-floating",h[1])},i:re,o:re,d(h){h&&j(e),N&&N.d(),T.d(),R&&R.d(),z&&z.d(),v&&v.d(),I&&I.d(),r[37](null),W=!1,se(J)}}}const Fe="Visit Altcha.org",Ge="https://altcha.org/";function We(r){return JSON.parse(r)}function Ht(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Ot(r,e,t){var ot,lt;let i,o,l,{auto:s=void 0}=e,{blockspam:u=void 0}=e,{challengeurl:a=void 0}=e,{challengejson:d=void 0}=e,{debug:G=!1}=e,{delay:S=0}=e,{expire:U=void 0}=e,{floating:k=void 0}=e,{floatinganchor:W=void 0}=e,{floatingoffset:J=void 0}=e,{hidefooter:N=!1}=e,{hidelogo:le=!1}=e,{name:Y="altcha"}=e,{maxnumber:T=1e6}=e,{mockerror:R=!1}=e,{refetchonexpire:z=!0}=e,{spamfilter:v=!1}=e,{strings:I=void 0}=e,{test:h=!1}=e,{verifyurl:p=void 0}=e,{workers:fe=Math.min(16,navigator.hardwareConcurrency||8)}=e,{workerurl:ke=void 0}=e;const xe=kt(),Be=["SHA-256","SHA-384","SHA-512"],He=(lt=(ot=document.documentElement.lang)==null?void 0:ot.split("-"))==null?void 0:lt[0];let K=!1,E,q=null,he=null,b=null,Ee=null,Q=null,$=m.UNVERIFIED,B=null;_t(()=>{b&&(b.removeEventListener("submit",Pe),b.removeEventListener("reset",Ye),b.removeEventListener("focusin",Oe),b=null),B&&(clearTimeout(B),B=null),document.removeEventListener("click",Qe),document.removeEventListener("scroll",et),window.removeEventListener("resize",rt)}),pt(()=>{C("mounted","0.6.0"),C("workers",fe),h&&C("using test mode"),U&&ge(U),s!==void 0&&C("auto",s),k!==void 0&&nt(k),b=E.closest("form"),b&&(b.addEventListener("submit",Pe,{capture:!0}),b.addEventListener("reset",Ye),s==="onfocus"&&b.addEventListener("focusin",Oe)),s==="onload"&&ee()});function C(...n){(G||n.some(f=>f instanceof Error))&&console[n[0]instanceof Error?"error":"log"]("ALTCHA",...n)}function Oe(n){$===m.UNVERIFIED&&ee()}function Pe(n){b&&s==="onsubmit"&&($===m.UNVERIFIED?(n.preventDefault(),n.stopPropagation(),ee().then(()=>{b==null||b.requestSubmit()})):$!==m.VERIFIED&&(n.preventDefault(),n.stopPropagation(),$===m.VERIFYING&&tt()))}function Ye(){me()}function Ke(n,f){return btoa(JSON.stringify({algorithm:n.algorithm,challenge:n.challenge,number:f.number,salt:n.salt,signature:n.signature,test:h?!0:void 0,took:f.took}))}function Je(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(!Be.includes(n.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${Be.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 Pt(){var n;if(R)throw C("mocking error"),new Error("Mocked error.");if(i)return C("using provided json data"),i;if(h)return C("generating test challenge",{test:h}),Vt(typeof h!="boolean"?+h:void 0);{if(!a)throw new Error("Attribute challengeurl not set.");C("fetching challenge from",a);const f=await fetch(a,{headers:{"x-altcha-spam-filter":v?"1":"0"}});if(f.status!==200)throw new Error(`Server responded with ${f.status}.`);const g=f.headers.get("Expires"),A=f.headers.get("X-Altcha-Config"),Z=await f.json(),D=new URLSearchParams((n=Z.salt.split("?"))==null?void 0:n[1]),H=D.get("expires")||D.get("expire");if(H){const _=new Date(+H*1e3),x=isNaN(_.getTime())?0:_.getTime()-Date.now();x>0&&ge(x)}if(A)try{const _=JSON.parse(A);_&&typeof _=="object"&&(_.verifyurl&&(_.verifyurl=new URL(_.verifyurl,new URL(a)).toString()),it(_))}catch(_){C("unable to configure from X-Altcha-Config",_)}if(!U&&(g!=null&&g.length)){const _=Date.parse(g);if(_){const x=_-Date.now();x>0&&ge(x)}}return Z}}function qe(){a&&z&&$===m.VERIFIED?ee():me(m.EXPIRED,l.expired)}async function Yt(n){let f=null;if("Worker"in window){try{f=await Kt(n.challenge,n.salt,n.algorithm,n.maxnumber)}catch(g){C(g)}if((f==null?void 0:f.number)!==void 0)return{data:n,solution:f}}return{data:n,solution:await $t(n.challenge,n.salt,n.algorithm,n.maxnumber||T).promise}}async function Kt(n,f,g,A=typeof h=="number"?h:T,Z=Math.ceil(fe)){const D=[];if(Z<1)throw new Error("Wrong number of workers configured.");if(Z>16)throw new Error("Too many workers. Max. 16 allowed workers.");for(let x=0;x<Z;x++)D.push(createAltchaWorker(ke));const H=Math.ceil(A/Z),_=await Promise.all(D.map((x,be)=>{const st=be*H;return new Promise(or=>{x.addEventListener("message",ct=>{if(ct.data)for(const at of D)at!==x&&at.postMessage({type:"abort"});or(ct.data)}),x.postMessage({payload:{alg:g,challenge:n,max:st+H,salt:f,start:st},type:"work"})})}));for(const x of D)x.terminate();return _.find(x=>!!x)||null}function Jt(){[m.UNVERIFIED,m.ERROR,m.EXPIRED].includes($)?v&&(b==null?void 0:b.reportValidity())===!1?t(7,K=!1):ee():t(7,K=!0)}function Qe(n){const f=n.target;k&&f&&!E.contains(f)&&$===m.VERIFIED&&t(8,E.style.display="none",E)}function et(){k&&Ce()}function tt(){$===m.VERIFYING&&alert(l.waitAlert)}function qt(n){k&&$!==m.UNVERIFIED&&requestAnimationFrame(()=>{Ce()})}function rt(){k&&Ce()}function ge(n){C("expire",n),B&&(clearTimeout(B),B=null),n<1?qe():B=setTimeout(qe,n)}function nt(n){C("floating",n),k!==n&&(t(8,E.style.left="",E),t(8,E.style.top="",E)),t(1,k=n===!0||n===""?"auto":n===!1||n==="false"?void 0:k),k?(s||t(0,s="onsubmit"),document.addEventListener("scroll",et),document.addEventListener("click",Qe),window.addEventListener("resize",rt)):s==="onsubmit"&&t(0,s=void 0)}function Qt(n){var g;const f=b==null?void 0:b.querySelector(typeof n=="string"?`input[name="${n}"]`:'input[type="email"]:not([data-no-spamfilter])');return((g=f==null?void 0:f.value)==null?void 0:g.slice(f.value.indexOf("@")))||void 0}function er(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 Z=A.name,D=A.value.trim();return Z&&D&&(g[Z]=D),g},{})}async function tr(n){if(!p)throw new Error("Attribute verifyurl not set.");C("requesting server verification from",p);const f={payload:n};if(v){const{email:Z,expectedLanguages:D,expectedCountries:H,fields:_,ipAddress:x,timeZone:be}=typeof v=="object"?v:{email:void 0,expectedCountries:void 0,expectedLanguages:void 0,fields:void 0,ipAddress:void 0,timeZone:void 0};f.ipAddress=x===!1?void 0:x||"auto",f.email=Z===!1?void 0:Qt(Z),f.fields=_===!1?void 0:er(_),f.timeZone=be===!1?void 0:be||Ht(),f.expectedCountries=H,f.expectedLanguages=D||(He?[He]:void 0)}const g=await fetch(p,{body:JSON.stringify(f),headers:{"content-type":"application/json"},method:"POST"});if(g.status!==200)throw new Error(`Server responded with ${g.status}.`);const A=await g.json();if(A!=null&&A.payload&&t(5,Q=A.payload),xe("serververification",A),u&&A.classification==="BAD")throw new Error("SpamFilter returned negative classification.")}function Ce(n=20){if(E)if(he||(he=(W?document.querySelector(W):b==null?void 0:b.querySelector('input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])'))||b),he){const f=parseInt(J,10)||12,g=he.getBoundingClientRect(),A=E.getBoundingClientRect(),Z=document.documentElement.clientHeight,D=document.documentElement.clientWidth,H=k==="auto"?g.bottom+A.height+f+n>Z:k==="top",_=Math.max(n,Math.min(D-n-A.width,g.left+g.width/2-A.width/2));if(H?t(8,E.style.top=`${g.top-(A.height+f)}px`,E):t(8,E.style.top=`${g.bottom+f}px`,E),t(8,E.style.left=`${_}px`,E),E.setAttribute("data-floating",H?"top":"bottom"),q){const x=q.getBoundingClientRect();t(9,q.style.left=g.left-_+g.width/2-x.width/2+"px",q)}}else C("unable to find floating anchor element")}function it(n){n.auto!==void 0&&(t(0,s=n.auto),s==="onload"&&ee()),n.floatinganchor!==void 0&&t(18,W=n.floatinganchor),n.delay!==void 0&&t(16,S=n.delay),n.floatingoffset!==void 0&&t(19,J=n.floatingoffset),n.floating!==void 0&&nt(n.floating),n.expire!==void 0&&(ge(n.expire),t(17,U=n.expire)),n.challenge&&(Je(n.challenge),i=n.challenge),n.challengeurl!==void 0&&t(14,a=n.challengeurl),n.debug!==void 0&&t(15,G=!!n.debug),n.hidefooter!==void 0&&t(2,N=!!n.hidefooter),n.hidelogo!==void 0&&t(3,le=!!n.hidelogo),n.maxnumber!==void 0&&t(20,T=+n.maxnumber),n.mockerror!==void 0&&t(21,R=!!n.mockerror),n.name!==void 0&&t(4,Y=n.name),n.refetchonexpire!==void 0&&t(22,z=!!n.refetchonexpire),n.spamfilter!==void 0&&t(23,v=typeof n.spamfilter=="object"?n.spamfilter:!!n.spamfilter),n.strings&&t(34,o=n.strings),n.test!==void 0&&t(24,h=typeof n.test=="number"?n.test:!!n.test),n.verifyurl!==void 0&&t(25,p=n.verifyurl),n.workers!==void 0&&t(26,fe=+n.workers)}function me(n=m.UNVERIFIED,f=null){B&&(clearTimeout(B),B=null),t(7,K=!1),t(10,Ee=f),t(5,Q=null),t(6,$=n)}async function ee(){return me(m.VERIFYING),await new Promise(n=>setTimeout(n,S||0)),Pt().then(n=>(Je(n),C("challenge",n),Yt(n))).then(({data:n,solution:f})=>{if(C("solution",f),(f==null?void 0:f.number)!==void 0){if(p)return tr(Ke(n,f));t(5,Q=Ke(n,f)),C("payload",Q)}else throw C("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."),new Error("Unexpected result returned.")}).then(()=>{xt().then(()=>{t(6,$=m.VERIFIED),t(7,K=!0),C("verified"),xe("verified",{payload:Q})})}).catch(n=>{C(n),t(6,$=m.ERROR),t(7,K=!1),t(10,Ee=n.message)})}function rr(){K=this.checked,t(7,K)}function nr(n){ue[n?"unshift":"push"](()=>{q=n,t(9,q)})}function ir(n){ue[n?"unshift":"push"](()=>{E=n,t(8,E)})}return r.$$set=n=>{"auto"in n&&t(0,s=n.auto),"blockspam"in n&&t(27,u=n.blockspam),"challengeurl"in n&&t(14,a=n.challengeurl),"challengejson"in n&&t(28,d=n.challengejson),"debug"in n&&t(15,G=n.debug),"delay"in n&&t(16,S=n.delay),"expire"in n&&t(17,U=n.expire),"floating"in n&&t(1,k=n.floating),"floatinganchor"in n&&t(18,W=n.floatinganchor),"floatingoffset"in n&&t(19,J=n.floatingoffset),"hidefooter"in n&&t(2,N=n.hidefooter),"hidelogo"in n&&t(3,le=n.hidelogo),"name"in n&&t(4,Y=n.name),"maxnumber"in n&&t(20,T=n.maxnumber),"mockerror"in n&&t(21,R=n.mockerror),"refetchonexpire"in n&&t(22,z=n.refetchonexpire),"spamfilter"in n&&t(23,v=n.spamfilter),"strings"in n&&t(29,I=n.strings),"test"in n&&t(24,h=n.test),"verifyurl"in n&&t(25,p=n.verifyurl),"workers"in n&&t(26,fe=n.workers),"workerurl"in n&&t(30,ke=n.workerurl)},r.$$.update=()=>{r.$$.dirty[0]&268435456&&(i=d?We(d):void 0),r.$$.dirty[0]&536870912&&t(34,o=I?We(I):{}),r.$$.dirty[1]&8&&t(11,l={ariaLinkLabel:Fe,error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by <a href="${Ge}" target="_blank" aria-label="${o.ariaLinkLabel||Fe}">ALTCHA</a>`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...o}),r.$$.dirty[0]&96&&xe("statechange",{payload:Q,state:$}),r.$$.dirty[0]&64&&qt()},[s,k,N,le,Y,Q,$,K,E,q,Ee,l,Jt,tt,a,G,S,U,W,J,T,R,z,v,h,p,fe,u,d,I,ke,it,me,ee,o,rr,nr,ir]}class Xe extends Tt{constructor(e){super(),Nt(this,e,Ot,Bt,ut,{auto:0,blockspam:27,challengeurl:14,challengejson:28,debug:15,delay:16,expire:17,floating:1,floatinganchor:18,floatingoffset:19,hidefooter:2,hidelogo:3,name:4,maxnumber:20,mockerror:21,refetchonexpire:22,spamfilter:23,strings:29,test:24,verifyurl:25,workers:26,workerurl:30,configure:31,reset:32,verify:33},Dt,[-1,-1,-1])}get auto(){return this.$$.ctx[0]}set auto(e){this.$$set({auto:e}),w()}get blockspam(){return this.$$.ctx[27]}set blockspam(e){this.$$set({blockspam:e}),w()}get challengeurl(){return this.$$.ctx[14]}set challengeurl(e){this.$$set({challengeurl:e}),w()}get challengejson(){return this.$$.ctx[28]}set challengejson(e){this.$$set({challengejson:e}),w()}get debug(){return this.$$.ctx[15]}set debug(e){this.$$set({debug:e}),w()}get delay(){return this.$$.ctx[16]}set delay(e){this.$$set({delay:e}),w()}get expire(){return this.$$.ctx[17]}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[18]}set floatinganchor(e){this.$$set({floatinganchor:e}),w()}get floatingoffset(){return this.$$.ctx[19]}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[20]}set maxnumber(e){this.$$set({maxnumber:e}),w()}get mockerror(){return this.$$.ctx[21]}set mockerror(e){this.$$set({mockerror:e}),w()}get refetchonexpire(){return this.$$.ctx[22]}set refetchonexpire(e){this.$$set({refetchonexpire:e}),w()}get spamfilter(){return this.$$.ctx[23]}set spamfilter(e){this.$$set({spamfilter:e}),w()}get strings(){return this.$$.ctx[29]}set strings(e){this.$$set({strings:e}),w()}get test(){return this.$$.ctx[24]}set test(e){this.$$set({test:e}),w()}get verifyurl(){return this.$$.ctx[25]}set verifyurl(e){this.$$set({verifyurl:e}),w()}get workers(){return this.$$.ctx[26]}set workers(e){this.$$set({workers:e}),w()}get workerurl(){return this.$$.ctx[30]}set workerurl(e){this.$$set({workerurl:e}),w()}get configure(){return this.$$.ctx[31]}get reset(){return this.$$.ctx[32]}get verify(){return this.$$.ctx[33]}}customElements.define("altcha-widget",St(Xe,{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 ft,F.Altcha=Xe,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(F,M){typeof exports=="object"&&typeof module<"u"?M(exports):typeof define=="function"&&define.amd?define(["exports"],M):(F=typeof globalThis<"u"?globalThis:F||self,M(F.altcha={}))})(this,function(F){"use strict";var lr=Object.defineProperty;var sr=(F,M,te)=>M in F?lr(F,M,{enumerable:!0,configurable:!0,writable:!0,value:te}):F[M]=te;var X=(F,M,te)=>sr(F,typeof M!="symbol"?M+"":M,te);const M="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGQoZSl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KGUpXS5tYXAodD0+dC50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBwKGUsdCxvKXtyZXR1cm4gZChhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUoZSt0KSkpfWZ1bmN0aW9uIGcoZSx0LG89IlNIQS0yNTYiLGw9MWU2LGM9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyLGk9RGF0ZS5ub3coKTtyZXR1cm57cHJvbWlzZTooYXN5bmMoKT0+e2ZvcihsZXQgbj1jO248PWw7bis9MSl7aWYoYS5zaWduYWwuYWJvcnRlZClyZXR1cm4gbnVsbDtpZihhd2FpdCBwKHQsbixvKT09PWUpcmV0dXJue251bWJlcjpuLHRvb2s6RGF0ZS5ub3coKS1pfX1yZXR1cm4gbnVsbH0pKCksY29udHJvbGxlcjphfX1sZXQgcjtvbm1lc3NhZ2U9YXN5bmMgZT0+e2NvbnN0e3R5cGU6dCxwYXlsb2FkOm99PWUuZGF0YTtpZih0PT09ImFib3J0IilyPT1udWxsfHxyLmFib3J0KCkscj12b2lkIDA7ZWxzZSBpZih0PT09IndvcmsiKXtjb25zdHthbGc6bCxjaGFsbGVuZ2U6YyxtYXg6YSxzYWx0Omksc3RhcnQ6dX09b3x8e30sbj1nKGMsaSxsLGEsdSk7cj1uLmNvbnRyb2xsZXIsbi5wcm9taXNlLnRoZW4ocz0+e3NlbGYucG9zdE1lc3NhZ2UocyYmey4uLnMsd29ya2VyOiEwfSl9KX19fSkoKTsK",te=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0)),Le=typeof window<"u"&&window.Blob&&new Blob([te(M)],{type:"text/javascript;charset=utf-8"});function ft(r){let e;try{if(e=Le&&(window.URL||window.webkitURL).createObjectURL(Le),!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,"+M,{name:r==null?void 0:r.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}function re(){}function Re(r){return r()}function ze(){return Object.create(null)}function se(r){r.forEach(Re)}function Ie(r){return typeof r=="function"}function ut(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function dt(r){return Object.keys(r).length===0}function y(r,e){r.appendChild(e)}function ht(r,e,t){const i=gt(r);if(!i.getElementById(e)){const o=L("style");o.id=e,o.textContent=t,mt(i,o)}}function gt(r){if(!r)return document;const e=r.getRootNode?r.getRootNode():r.ownerDocument;return e&&e.host?e:r.ownerDocument}function mt(r,e){return y(r.head||r,e),e.sheet}function V(r,e,t){r.insertBefore(e,t||null)}function j(r){r.parentNode&&r.parentNode.removeChild(r)}function L(r){return document.createElement(r)}function O(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function bt(r){return document.createTextNode(r)}function P(){return bt(" ")}function we(r,e,t,i){return r.addEventListener(e,t,i),()=>r.removeEventListener(e,t,i)}function c(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function wt(r){return Array.from(r.childNodes)}function Ae(r,e,t){r.classList.toggle(e,!!t)}function vt(r,e,{bubbles:t=!1,cancelable:i=!1}={}){return new CustomEvent(r,{detail:e,bubbles:t,cancelable:i})}function yt(r){const e={};return r.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let ce;function ae(r){ce=r}function ve(){if(!ce)throw new Error("Function called outside component initialization");return ce}function pt(r){ve().$$.on_mount.push(r)}function _t(r){ve().$$.on_destroy.push(r)}function kt(){const r=ve();return(e,t,{cancelable:i=!1}={})=>{const o=r.$$.callbacks[e];if(o){const l=vt(e,t,{cancelable:i});return o.slice().forEach(s=>{s.call(r,l)}),!l.defaultPrevented}return!0}}const ne=[],ue=[];let ie=[];const Ne=[],Se=Promise.resolve();let ye=!1;function Te(){ye||(ye=!0,Se.then(w))}function xt(){return Te(),Se}function pe(r){ie.push(r)}const _e=new Set;let oe=0;function w(){if(oe!==0)return;const r=ce;do{try{for(;oe<ne.length;){const e=ne[oe];oe++,ae(e),Et(e.$$)}}catch(e){throw ne.length=0,oe=0,e}for(ae(null),ne.length=0,oe=0;ue.length;)ue.pop()();for(let e=0;e<ie.length;e+=1){const t=ie[e];_e.has(t)||(_e.add(t),t())}ie.length=0}while(ne.length);for(;Ne.length;)Ne.pop()();ye=!1,_e.clear(),ae(r)}function Et(r){if(r.fragment!==null){r.update(),se(r.before_update);const e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(pe)}}function Ct(r){const e=[],t=[];ie.forEach(i=>r.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),ie=e}const Lt=new Set;function Rt(r,e){r&&r.i&&(Lt.delete(r),r.i(e))}function zt(r,e,t){const{fragment:i,after_update:o}=r.$$;i&&i.m(e,t),pe(()=>{const l=r.$$.on_mount.map(Re).filter(Ie);r.$$.on_destroy?r.$$.on_destroy.push(...l):se(l),r.$$.on_mount=[]}),o.forEach(pe)}function It(r,e){const t=r.$$;t.fragment!==null&&(Ct(t.after_update),se(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function At(r,e){r.$$.dirty[0]===-1&&(ne.push(r),Te(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<<e%31}function Nt(r,e,t,i,o,l,s=null,u=[-1]){const a=ce;ae(r);const d=r.$$={fragment:null,ctx:[],props:l,update:re,not_equal:o,bound:ze(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:ze(),dirty:u,skip_bound:!1,root:e.target||a.$$.root};s&&s(d.root);let G=!1;if(d.ctx=t?t(r,e.props||{},(S,U,...k)=>{const W=k.length?k[0]:U;return d.ctx&&o(d.ctx[S],d.ctx[S]=W)&&(!d.skip_bound&&d.bound[S]&&d.bound[S](W),G&&At(r,S)),U}):[],d.update(),G=!0,se(d.before_update),d.fragment=i?i(d.ctx):!1,e.target){if(e.hydrate){const S=wt(e.target);d.fragment&&d.fragment.l(S),S.forEach(j)}else d.fragment&&d.fragment.c();e.intro&&Rt(r.$$.fragment),zt(r,e.target,e.anchor),w()}ae(a)}let je;typeof HTMLElement=="function"&&(je=class extends HTMLElement{constructor(e,t,i){super();X(this,"$$ctor");X(this,"$$s");X(this,"$$c");X(this,"$$cn",!1);X(this,"$$d",{});X(this,"$$r",!1);X(this,"$$p_d",{});X(this,"$$l",{});X(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 s;return{c:function(){s=L("slot"),l!=="default"&&c(s,"name",l)},m:function(d,G){V(d,s,G)},d:function(d){d&&j(s)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},i=yt(this);for(const l of this.$$s)l in i&&(t[l]=[e(l)]);for(const l of this.attributes){const s=this.$$g_p(l.name);s in this.$$d||(this.$$d[s]=de(s,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 s=de(l,this.$$d[l],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,s)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const l in this.$$l)for(const s of this.$$l[l]){const u=this.$$c.$on(l,s);this.$$l_u.set(s,u)}this.$$l={}}}attributeChangedCallback(e,t,i){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=de(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 de(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 St(r,e,t,i,o,l){let s=class extends je{constructor(){super(r,t,o),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(u=>(e[u].attribute||u).toLowerCase())}};return Object.keys(e).forEach(u=>{Object.defineProperty(s.prototype,u,{get(){return this.$$c&&u in this.$$c?this.$$c[u]:this.$$d[u]},set(a){var d;a=de(u,a,e),this.$$d[u]=a,(d=this.$$c)==null||d.$set({[u]:a})}})}),i.forEach(u=>{Object.defineProperty(s.prototype,u,{get(){var a;return(a=this.$$c)==null?void 0:a[u]}})}),l&&(s=l(s)),r.element=s,s}class Tt{constructor(){X(this,"$$");X(this,"$$set")}$destroy(){It(this,1),this.$destroy=re}$on(e,t){if(!Ie(t))return re;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&&!dt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const jt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(jt);const Zt=new TextEncoder;function Mt(r){return[...new Uint8Array(r)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function Vt(r,e="SHA-256",t=1e5){const i=Date.now().toString(16);r||(r=Math.round(Math.random()*t));const o=await Ze(i,r,e);return{algorithm:e,challenge:o,salt:i,signature:""}}async function Ze(r,e,t){return Mt(await crypto.subtle.digest(t.toUpperCase(),Zt.encode(r+e)))}function $t(r,e,t="SHA-256",i=1e6,o=0){const l=new AbortController,s=Date.now();return{promise:(async()=>{for(let a=o;a<=i;a+=1){if(l.signal.aborted)return null;if(await Ze(e,a,t)===r)return{number:a,took:Date.now()-s}}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 Dt(r){ht(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 Me(r){let e,t,i;return{c(){e=O("svg"),t=O("path"),i=O("path"),c(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"),c(t,"fill","currentColor"),c(t,"opacity",".25"),c(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"),c(i,"fill","currentColor"),c(i,"class","altcha-spinner svelte-ddsc3z"),c(e,"width","24"),c(e,"height","24"),c(e,"viewBox","0 0 24 24"),c(e,"xmlns","http://www.w3.org/2000/svg")},m(o,l){V(o,e,l),y(e,t),y(e,i)},d(o){o&&j(e)}}}function Ut(r){let e,t=r[11].label+"",i;return{c(){e=L("label"),c(e,"for",i=r[4]+"_checkbox"),c(e,"class","svelte-ddsc3z")},m(o,l){V(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")&&c(e,"for",i)},d(o){o&&j(e)}}}function Ft(r){let e,t=r[11].verifying+"";return{c(){e=L("span")},m(i,o){V(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].verifying+"")&&(e.innerHTML=t)},d(i){i&&j(e)}}}function Gt(r){let e,t=r[11].verified+"",i,o;return{c(){e=L("span"),i=P(),o=L("input"),c(o,"type","hidden"),c(o,"name",r[4]),o.value=r[5]},m(l,s){V(l,e,s),e.innerHTML=t,V(l,i,s),V(l,o,s)},p(l,s){s[0]&2048&&t!==(t=l[11].verified+"")&&(e.innerHTML=t),s[0]&16&&c(o,"name",l[4]),s[0]&32&&(o.value=l[5])},d(l){l&&(j(e),j(i),j(o))}}}function Ve(r){let e,t,i,o,l,s,u;return{c(){e=L("div"),t=L("a"),i=O("svg"),o=O("path"),l=O("path"),s=O("path"),c(o,"d","M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"),c(o,"fill","currentColor"),c(l,"d","M3.57212 2.33956C1.65755 3.94607 0.496389 6.11731 0.12782 8.40523L2.04639 9.13961C2.26047 7.15832 3.21057 5.25375 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577L13.8302 6.78606L19.9633 9.13364C19.7929 7.15555 19.0335 5.20847 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956Z"),c(l,"fill","currentColor"),c(s,"d","M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"),c(s,"fill","currentColor"),c(i,"width","22"),c(i,"height","22"),c(i,"viewBox","0 0 20 20"),c(i,"fill","none"),c(i,"xmlns","http://www.w3.org/2000/svg"),c(t,"href",Ge),c(t,"target","_blank"),c(t,"class","altcha-logo svelte-ddsc3z"),c(t,"aria-label",u=r[11].ariaLinkLabel)},m(a,d){V(a,e,d),y(e,t),y(t,i),y(i,o),y(i,l),y(i,s)},p(a,d){d[0]&2048&&u!==(u=a[11].ariaLinkLabel)&&c(t,"aria-label",u)},d(a){a&&j(e)}}}function $e(r){let e,t,i,o;function l(a,d){return a[6]===m.EXPIRED?Xt:Wt}let s=l(r),u=s(r);return{c(){e=L("div"),t=O("svg"),i=O("path"),o=P(),u.c(),c(i,"stroke-linecap","round"),c(i,"stroke-linejoin","round"),c(i,"d","M6 18L18 6M6 6l12 12"),c(t,"width","14"),c(t,"height","14"),c(t,"xmlns","http://www.w3.org/2000/svg"),c(t,"fill","none"),c(t,"viewBox","0 0 24 24"),c(t,"stroke-width","1.5"),c(t,"stroke","currentColor"),c(e,"class","altcha-error svelte-ddsc3z")},m(a,d){V(a,e,d),y(e,t),y(t,i),y(e,o),u.m(e,null)},p(a,d){s===(s=l(a))&&u?u.p(a,d):(u.d(1),u=s(a),u&&(u.c(),u.m(e,null)))},d(a){a&&j(e),u.d()}}}function Wt(r){let e,t=r[11].error+"";return{c(){e=L("div"),c(e,"title",r[10])},m(i,o){V(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].error+"")&&(e.innerHTML=t),o[0]&1024&&c(e,"title",i[10])},d(i){i&&j(e)}}}function Xt(r){let e,t=r[11].expired+"";return{c(){e=L("div"),c(e,"title",r[10])},m(i,o){V(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].expired+"")&&(e.innerHTML=t),o[0]&1024&&c(e,"title",i[10])},d(i){i&&j(e)}}}function De(r){let e,t,i=r[11].footer+"";return{c(){e=L("div"),t=L("div"),c(t,"class","svelte-ddsc3z"),c(e,"class","altcha-footer svelte-ddsc3z")},m(o,l){V(o,e,l),y(e,t),t.innerHTML=i},p(o,l){l[0]&2048&&i!==(i=o[11].footer+"")&&(t.innerHTML=i)},d(o){o&&j(e)}}}function Ue(r){let e;return{c(){e=L("div"),c(e,"class","altcha-anchor-arrow svelte-ddsc3z")},m(t,i){V(t,e,i),r[36](e)},p:re,d(t){t&&j(e),r[36](null)}}}function Bt(r){let e,t,i,o,l,s,u,a,d,G,S,U,k,W,J,N=r[6]===m.VERIFYING&&Me();function le(h,p){return h[6]===m.VERIFIED?Gt:h[6]===m.VERIFYING?Ft:Ut}let Y=le(r),T=Y(r),R=r[3]!==!0&&Ve(r),z=(r[10]||r[6]===m.EXPIRED)&&$e(r),v=r[11].footer&&r[2]!==!0&&De(r),I=r[1]&&Ue(r);return{c(){e=L("div"),t=L("div"),N&&N.c(),i=P(),o=L("div"),l=L("input"),a=P(),d=L("div"),T.c(),G=P(),R&&R.c(),S=P(),z&&z.c(),U=P(),v&&v.c(),k=P(),I&&I.c(),c(l,"type","checkbox"),c(l,"id",s=r[4]+"_checkbox"),l.required=u=r[0]!=="onsubmit",c(l,"class","svelte-ddsc3z"),c(o,"class","altcha-checkbox svelte-ddsc3z"),Ae(o,"altcha-hidden",r[6]===m.VERIFYING),c(d,"class","altcha-label svelte-ddsc3z"),c(t,"class","altcha-main svelte-ddsc3z"),c(e,"class","altcha svelte-ddsc3z"),c(e,"data-state",r[6]),c(e,"data-floating",r[1])},m(h,p){V(h,e,p),y(e,t),N&&N.m(t,null),y(t,i),y(t,o),y(o,l),l.checked=r[7],y(t,a),y(t,d),T.m(d,null),y(t,G),R&&R.m(t,null),y(e,S),z&&z.m(e,null),y(e,U),v&&v.m(e,null),y(e,k),I&&I.m(e,null),r[37](e),W||(J=[we(l,"change",r[35]),we(l,"change",r[12]),we(l,"invalid",r[13])],W=!0)},p(h,p){h[6]===m.VERIFYING?N||(N=Me(),N.c(),N.m(t,i)):N&&(N.d(1),N=null),p[0]&16&&s!==(s=h[4]+"_checkbox")&&c(l,"id",s),p[0]&1&&u!==(u=h[0]!=="onsubmit")&&(l.required=u),p[0]&128&&(l.checked=h[7]),p[0]&64&&Ae(o,"altcha-hidden",h[6]===m.VERIFYING),Y===(Y=le(h))&&T?T.p(h,p):(T.d(1),T=Y(h),T&&(T.c(),T.m(d,null))),h[3]!==!0?R?R.p(h,p):(R=Ve(h),R.c(),R.m(t,null)):R&&(R.d(1),R=null),h[10]||h[6]===m.EXPIRED?z?z.p(h,p):(z=$e(h),z.c(),z.m(e,U)):z&&(z.d(1),z=null),h[11].footer&&h[2]!==!0?v?v.p(h,p):(v=De(h),v.c(),v.m(e,k)):v&&(v.d(1),v=null),h[1]?I?I.p(h,p):(I=Ue(h),I.c(),I.m(e,null)):I&&(I.d(1),I=null),p[0]&64&&c(e,"data-state",h[6]),p[0]&2&&c(e,"data-floating",h[1])},i:re,o:re,d(h){h&&j(e),N&&N.d(),T.d(),R&&R.d(),z&&z.d(),v&&v.d(),I&&I.d(),r[37](null),W=!1,se(J)}}}const Fe="Visit Altcha.org",Ge="https://altcha.org/";function We(r){return JSON.parse(r)}function Ht(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Ot(r,e,t){var ot,lt;let i,o,l,{auto:s=void 0}=e,{blockspam:u=void 0}=e,{challengeurl:a=void 0}=e,{challengejson:d=void 0}=e,{debug:G=!1}=e,{delay:S=0}=e,{expire:U=void 0}=e,{floating:k=void 0}=e,{floatinganchor:W=void 0}=e,{floatingoffset:J=void 0}=e,{hidefooter:N=!1}=e,{hidelogo:le=!1}=e,{name:Y="altcha"}=e,{maxnumber:T=1e6}=e,{mockerror:R=!1}=e,{refetchonexpire:z=!0}=e,{spamfilter:v=!1}=e,{strings:I=void 0}=e,{test:h=!1}=e,{verifyurl:p=void 0}=e,{workers:fe=Math.min(16,navigator.hardwareConcurrency||8)}=e,{workerurl:ke=void 0}=e;const xe=kt(),Be=["SHA-256","SHA-384","SHA-512"],He=(lt=(ot=document.documentElement.lang)==null?void 0:ot.split("-"))==null?void 0:lt[0];let K=!1,E,q=null,he=null,b=null,Ee=null,Q=null,$=m.UNVERIFIED,B=null;_t(()=>{b&&(b.removeEventListener("submit",Pe),b.removeEventListener("reset",Ye),b.removeEventListener("focusin",Oe),b=null),B&&(clearTimeout(B),B=null),document.removeEventListener("click",Qe),document.removeEventListener("scroll",et),window.removeEventListener("resize",rt)}),pt(()=>{C("mounted","0.6.1"),C("workers",fe),h&&C("using test mode"),U&&ge(U),s!==void 0&&C("auto",s),k!==void 0&&nt(k),b=E.closest("form"),b&&(b.addEventListener("submit",Pe,{capture:!0}),b.addEventListener("reset",Ye),s==="onfocus"&&b.addEventListener("focusin",Oe)),s==="onload"&&ee()});function C(...n){(G||n.some(f=>f instanceof Error))&&console[n[0]instanceof Error?"error":"log"]("ALTCHA",...n)}function Oe(n){$===m.UNVERIFIED&&ee()}function Pe(n){b&&s==="onsubmit"&&($===m.UNVERIFIED?(n.preventDefault(),n.stopPropagation(),ee().then(()=>{b==null||b.requestSubmit()})):$!==m.VERIFIED&&(n.preventDefault(),n.stopPropagation(),$===m.VERIFYING&&tt()))}function Ye(){me()}function Ke(n,f){return btoa(JSON.stringify({algorithm:n.algorithm,challenge:n.challenge,number:f.number,salt:n.salt,signature:n.signature,test:h?!0:void 0,took:f.took}))}function Je(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(!Be.includes(n.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${Be.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 Pt(){var n;if(R)throw C("mocking error"),new Error("Mocked error.");if(i)return C("using provided json data"),i;if(h)return C("generating test challenge",{test:h}),Vt(typeof h!="boolean"?+h:void 0);{if(!a)throw new Error("Attribute challengeurl not set.");C("fetching challenge from",a);const f=await fetch(a,{headers:{"x-altcha-spam-filter":v?"1":"0"}});if(f.status!==200)throw new Error(`Server responded with ${f.status}.`);const g=f.headers.get("Expires"),A=f.headers.get("X-Altcha-Config"),Z=await f.json(),D=new URLSearchParams((n=Z.salt.split("?"))==null?void 0:n[1]),H=D.get("expires")||D.get("expire");if(H){const _=new Date(+H*1e3),x=isNaN(_.getTime())?0:_.getTime()-Date.now();x>0&&ge(x)}if(A)try{const _=JSON.parse(A);_&&typeof _=="object"&&(_.verifyurl&&(_.verifyurl=new URL(_.verifyurl,new URL(a)).toString()),it(_))}catch(_){C("unable to configure from X-Altcha-Config",_)}if(!U&&(g!=null&&g.length)){const _=Date.parse(g);if(_){const x=_-Date.now();x>0&&ge(x)}}return Z}}function qe(){a&&z&&$===m.VERIFIED?ee():me(m.EXPIRED,l.expired)}async function Yt(n){let f=null;if("Worker"in window){try{f=await Kt(n.challenge,n.salt,n.algorithm,n.maxnumber)}catch(g){C(g)}if((f==null?void 0:f.number)!==void 0)return{data:n,solution:f}}return{data:n,solution:await $t(n.challenge,n.salt,n.algorithm,n.maxnumber||T).promise}}async function Kt(n,f,g,A=typeof h=="number"?h:T,Z=Math.ceil(fe)){const D=[];if(Z<1)throw new Error("Wrong number of workers configured.");if(Z>16)throw new Error("Too many workers. Max. 16 allowed workers.");for(let x=0;x<Z;x++)D.push(createAltchaWorker(ke));const H=Math.ceil(A/Z),_=await Promise.all(D.map((x,be)=>{const st=be*H;return new Promise(or=>{x.addEventListener("message",ct=>{if(ct.data)for(const at of D)at!==x&&at.postMessage({type:"abort"});or(ct.data)}),x.postMessage({payload:{alg:g,challenge:n,max:st+H,salt:f,start:st},type:"work"})})}));for(const x of D)x.terminate();return _.find(x=>!!x)||null}function Jt(){[m.UNVERIFIED,m.ERROR,m.EXPIRED].includes($)?v&&(b==null?void 0:b.reportValidity())===!1?t(7,K=!1):ee():t(7,K=!0)}function Qe(n){const f=n.target;k&&f&&!E.contains(f)&&$===m.VERIFIED&&t(8,E.style.display="none",E)}function et(){k&&Ce()}function tt(){$===m.VERIFYING&&l.waitAlert&&alert(l.waitAlert)}function qt(n){k&&$!==m.UNVERIFIED&&requestAnimationFrame(()=>{Ce()})}function rt(){k&&Ce()}function ge(n){C("expire",n),B&&(clearTimeout(B),B=null),n<1?qe():B=setTimeout(qe,n)}function nt(n){C("floating",n),k!==n&&(t(8,E.style.left="",E),t(8,E.style.top="",E)),t(1,k=n===!0||n===""?"auto":n===!1||n==="false"?void 0:k),k?(s||t(0,s="onsubmit"),document.addEventListener("scroll",et),document.addEventListener("click",Qe),window.addEventListener("resize",rt)):s==="onsubmit"&&t(0,s=void 0)}function Qt(n){var g;const f=b==null?void 0:b.querySelector(typeof n=="string"?`input[name="${n}"]`:'input[type="email"]:not([data-no-spamfilter])');return((g=f==null?void 0:f.value)==null?void 0:g.slice(f.value.indexOf("@")))||void 0}function er(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 Z=A.name,D=A.value.trim();return Z&&D&&(g[Z]=D),g},{})}async function tr(n){if(!p)throw new Error("Attribute verifyurl not set.");C("requesting server verification from",p);const f={payload:n};if(v){const{email:Z,expectedLanguages:D,expectedCountries:H,fields:_,ipAddress:x,timeZone:be}=typeof v=="object"?v:{email:void 0,expectedCountries:void 0,expectedLanguages:void 0,fields:void 0,ipAddress:void 0,timeZone:void 0};f.ipAddress=x===!1?void 0:x||"auto",f.email=Z===!1?void 0:Qt(Z),f.fields=_===!1?void 0:er(_),f.timeZone=be===!1?void 0:be||Ht(),f.expectedCountries=H,f.expectedLanguages=D||(He?[He]:void 0)}const g=await fetch(p,{body:JSON.stringify(f),headers:{"content-type":"application/json"},method:"POST"});if(g.status!==200)throw new Error(`Server responded with ${g.status}.`);const A=await g.json();if(A!=null&&A.payload&&t(5,Q=A.payload),xe("serververification",A),u&&A.classification==="BAD")throw new Error("SpamFilter returned negative classification.")}function Ce(n=20){if(E)if(he||(he=(W?document.querySelector(W):b==null?void 0:b.querySelector('input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])'))||b),he){const f=parseInt(J,10)||12,g=he.getBoundingClientRect(),A=E.getBoundingClientRect(),Z=document.documentElement.clientHeight,D=document.documentElement.clientWidth,H=k==="auto"?g.bottom+A.height+f+n>Z:k==="top",_=Math.max(n,Math.min(D-n-A.width,g.left+g.width/2-A.width/2));if(H?t(8,E.style.top=`${g.top-(A.height+f)}px`,E):t(8,E.style.top=`${g.bottom+f}px`,E),t(8,E.style.left=`${_}px`,E),E.setAttribute("data-floating",H?"top":"bottom"),q){const x=q.getBoundingClientRect();t(9,q.style.left=g.left-_+g.width/2-x.width/2+"px",q)}}else C("unable to find floating anchor element")}function it(n){n.auto!==void 0&&(t(0,s=n.auto),s==="onload"&&ee()),n.floatinganchor!==void 0&&t(18,W=n.floatinganchor),n.delay!==void 0&&t(16,S=n.delay),n.floatingoffset!==void 0&&t(19,J=n.floatingoffset),n.floating!==void 0&&nt(n.floating),n.expire!==void 0&&(ge(n.expire),t(17,U=n.expire)),n.challenge&&(Je(n.challenge),i=n.challenge),n.challengeurl!==void 0&&t(14,a=n.challengeurl),n.debug!==void 0&&t(15,G=!!n.debug),n.hidefooter!==void 0&&t(2,N=!!n.hidefooter),n.hidelogo!==void 0&&t(3,le=!!n.hidelogo),n.maxnumber!==void 0&&t(20,T=+n.maxnumber),n.mockerror!==void 0&&t(21,R=!!n.mockerror),n.name!==void 0&&t(4,Y=n.name),n.refetchonexpire!==void 0&&t(22,z=!!n.refetchonexpire),n.spamfilter!==void 0&&t(23,v=typeof n.spamfilter=="object"?n.spamfilter:!!n.spamfilter),n.strings&&t(34,o=n.strings),n.test!==void 0&&t(24,h=typeof n.test=="number"?n.test:!!n.test),n.verifyurl!==void 0&&t(25,p=n.verifyurl),n.workers!==void 0&&t(26,fe=+n.workers)}function me(n=m.UNVERIFIED,f=null){B&&(clearTimeout(B),B=null),t(7,K=!1),t(10,Ee=f),t(5,Q=null),t(6,$=n)}async function ee(){return me(m.VERIFYING),await new Promise(n=>setTimeout(n,S||0)),Pt().then(n=>(Je(n),C("challenge",n),Yt(n))).then(({data:n,solution:f})=>{if(C("solution",f),(f==null?void 0:f.number)!==void 0){if(p)return tr(Ke(n,f));t(5,Q=Ke(n,f)),C("payload",Q)}else throw C("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."),new Error("Unexpected result returned.")}).then(()=>{xt().then(()=>{t(6,$=m.VERIFIED),t(7,K=!0),C("verified"),xe("verified",{payload:Q})})}).catch(n=>{C(n),t(6,$=m.ERROR),t(7,K=!1),t(10,Ee=n.message)})}function rr(){K=this.checked,t(7,K)}function nr(n){ue[n?"unshift":"push"](()=>{q=n,t(9,q)})}function ir(n){ue[n?"unshift":"push"](()=>{E=n,t(8,E)})}return r.$$set=n=>{"auto"in n&&t(0,s=n.auto),"blockspam"in n&&t(27,u=n.blockspam),"challengeurl"in n&&t(14,a=n.challengeurl),"challengejson"in n&&t(28,d=n.challengejson),"debug"in n&&t(15,G=n.debug),"delay"in n&&t(16,S=n.delay),"expire"in n&&t(17,U=n.expire),"floating"in n&&t(1,k=n.floating),"floatinganchor"in n&&t(18,W=n.floatinganchor),"floatingoffset"in n&&t(19,J=n.floatingoffset),"hidefooter"in n&&t(2,N=n.hidefooter),"hidelogo"in n&&t(3,le=n.hidelogo),"name"in n&&t(4,Y=n.name),"maxnumber"in n&&t(20,T=n.maxnumber),"mockerror"in n&&t(21,R=n.mockerror),"refetchonexpire"in n&&t(22,z=n.refetchonexpire),"spamfilter"in n&&t(23,v=n.spamfilter),"strings"in n&&t(29,I=n.strings),"test"in n&&t(24,h=n.test),"verifyurl"in n&&t(25,p=n.verifyurl),"workers"in n&&t(26,fe=n.workers),"workerurl"in n&&t(30,ke=n.workerurl)},r.$$.update=()=>{r.$$.dirty[0]&268435456&&(i=d?We(d):void 0),r.$$.dirty[0]&536870912&&t(34,o=I?We(I):{}),r.$$.dirty[1]&8&&t(11,l={ariaLinkLabel:Fe,error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by <a href="${Ge}" target="_blank" aria-label="${o.ariaLinkLabel||Fe}">ALTCHA</a>`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...o}),r.$$.dirty[0]&96&&xe("statechange",{payload:Q,state:$}),r.$$.dirty[0]&64&&qt()},[s,k,N,le,Y,Q,$,K,E,q,Ee,l,Jt,tt,a,G,S,U,W,J,T,R,z,v,h,p,fe,u,d,I,ke,it,me,ee,o,rr,nr,ir]}class Xe extends Tt{constructor(e){super(),Nt(this,e,Ot,Bt,ut,{auto:0,blockspam:27,challengeurl:14,challengejson:28,debug:15,delay:16,expire:17,floating:1,floatinganchor:18,floatingoffset:19,hidefooter:2,hidelogo:3,name:4,maxnumber:20,mockerror:21,refetchonexpire:22,spamfilter:23,strings:29,test:24,verifyurl:25,workers:26,workerurl:30,configure:31,reset:32,verify:33},Dt,[-1,-1,-1])}get auto(){return this.$$.ctx[0]}set auto(e){this.$$set({auto:e}),w()}get blockspam(){return this.$$.ctx[27]}set blockspam(e){this.$$set({blockspam:e}),w()}get challengeurl(){return this.$$.ctx[14]}set challengeurl(e){this.$$set({challengeurl:e}),w()}get challengejson(){return this.$$.ctx[28]}set challengejson(e){this.$$set({challengejson:e}),w()}get debug(){return this.$$.ctx[15]}set debug(e){this.$$set({debug:e}),w()}get delay(){return this.$$.ctx[16]}set delay(e){this.$$set({delay:e}),w()}get expire(){return this.$$.ctx[17]}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[18]}set floatinganchor(e){this.$$set({floatinganchor:e}),w()}get floatingoffset(){return this.$$.ctx[19]}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[20]}set maxnumber(e){this.$$set({maxnumber:e}),w()}get mockerror(){return this.$$.ctx[21]}set mockerror(e){this.$$set({mockerror:e}),w()}get refetchonexpire(){return this.$$.ctx[22]}set refetchonexpire(e){this.$$set({refetchonexpire:e}),w()}get spamfilter(){return this.$$.ctx[23]}set spamfilter(e){this.$$set({spamfilter:e}),w()}get strings(){return this.$$.ctx[29]}set strings(e){this.$$set({strings:e}),w()}get test(){return this.$$.ctx[24]}set test(e){this.$$set({test:e}),w()}get verifyurl(){return this.$$.ctx[25]}set verifyurl(e){this.$$set({verifyurl:e}),w()}get workers(){return this.$$.ctx[26]}set workers(e){this.$$set({workers:e}),w()}get workerurl(){return this.$$.ctx[30]}set workerurl(e){this.$$set({workerurl:e}),w()}get configure(){return this.$$.ctx[31]}get reset(){return this.$$.ctx[32]}get verify(){return this.$$.ctx[33]}}customElements.define("altcha-widget",St(Xe,{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 ft,F.Altcha=Xe,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
|
package/dist_external/altcha.js
CHANGED
|
@@ -83,17 +83,17 @@ function Lt(n) {
|
|
|
83
83
|
function It() {
|
|
84
84
|
const n = ve();
|
|
85
85
|
return (e, t, { cancelable: i = !1 } = {}) => {
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
const
|
|
86
|
+
const l = n.$$.callbacks[e];
|
|
87
|
+
if (l) {
|
|
88
|
+
const o = pt(
|
|
89
89
|
/** @type {string} */
|
|
90
90
|
e,
|
|
91
91
|
t,
|
|
92
92
|
{ cancelable: i }
|
|
93
93
|
);
|
|
94
|
-
return
|
|
95
|
-
s.call(n,
|
|
96
|
-
}), !
|
|
94
|
+
return l.slice().forEach((s) => {
|
|
95
|
+
s.call(n, o);
|
|
96
|
+
}), !o.defaultPrevented;
|
|
97
97
|
}
|
|
98
98
|
return !0;
|
|
99
99
|
};
|
|
@@ -153,11 +153,11 @@ function Tt(n, e) {
|
|
|
153
153
|
n && n.i && (Mt.delete(n), n.i(e));
|
|
154
154
|
}
|
|
155
155
|
function St(n, e, t) {
|
|
156
|
-
const { fragment: i, after_update:
|
|
156
|
+
const { fragment: i, after_update: l } = n.$$;
|
|
157
157
|
i && i.m(e, t), Ee(() => {
|
|
158
|
-
const
|
|
159
|
-
n.$$.on_destroy ? n.$$.on_destroy.push(...
|
|
160
|
-
}),
|
|
158
|
+
const o = n.$$.on_mount.map(Ke).filter(Qe);
|
|
159
|
+
n.$$.on_destroy ? n.$$.on_destroy.push(...o) : se(o), n.$$.on_mount = [];
|
|
160
|
+
}), l.forEach(Ee);
|
|
161
161
|
}
|
|
162
162
|
function Dt(n, e) {
|
|
163
163
|
const t = n.$$;
|
|
@@ -166,16 +166,16 @@ function Dt(n, e) {
|
|
|
166
166
|
function Nt(n, e) {
|
|
167
167
|
n.$$.dirty[0] === -1 && (te.push(n), tt(), n.$$.dirty.fill(0)), n.$$.dirty[e / 31 | 0] |= 1 << e % 31;
|
|
168
168
|
}
|
|
169
|
-
function jt(n, e, t, i,
|
|
169
|
+
function jt(n, e, t, i, l, o, s = null, a = [-1]) {
|
|
170
170
|
const c = le;
|
|
171
171
|
oe(n);
|
|
172
172
|
const h = n.$$ = {
|
|
173
173
|
fragment: null,
|
|
174
174
|
ctx: [],
|
|
175
175
|
// state
|
|
176
|
-
props:
|
|
176
|
+
props: o,
|
|
177
177
|
update: re,
|
|
178
|
-
not_equal:
|
|
178
|
+
not_equal: l,
|
|
179
179
|
bound: Be(),
|
|
180
180
|
// lifecycle
|
|
181
181
|
on_mount: [],
|
|
@@ -194,7 +194,7 @@ function jt(n, e, t, i, o, l, s = null, a = [-1]) {
|
|
|
194
194
|
let H = !1;
|
|
195
195
|
if (h.ctx = t ? t(n, e.props || {}, (T, F, ...E) => {
|
|
196
196
|
const O = E.length ? E[0] : F;
|
|
197
|
-
return h.ctx &&
|
|
197
|
+
return h.ctx && l(h.ctx[T], h.ctx[T] = O) && (!h.skip_bound && h.bound[T] && h.bound[T](O), H && Nt(n, T)), F;
|
|
198
198
|
}) : [], h.update(), H = !0, se(h.before_update), h.fragment = i ? i(h.ctx) : !1, e.target) {
|
|
199
199
|
if (e.hydrate) {
|
|
200
200
|
const T = vt(e.target);
|
|
@@ -231,25 +231,25 @@ typeof HTMLElement == "function" && (nt = class extends HTMLElement {
|
|
|
231
231
|
}
|
|
232
232
|
addEventListener(e, t, i) {
|
|
233
233
|
if (this.$$l[e] = this.$$l[e] || [], this.$$l[e].push(t), this.$$c) {
|
|
234
|
-
const
|
|
235
|
-
this.$$l_u.set(t,
|
|
234
|
+
const l = this.$$c.$on(e, t);
|
|
235
|
+
this.$$l_u.set(t, l);
|
|
236
236
|
}
|
|
237
237
|
super.addEventListener(e, t, i);
|
|
238
238
|
}
|
|
239
239
|
removeEventListener(e, t, i) {
|
|
240
240
|
if (super.removeEventListener(e, t, i), this.$$c) {
|
|
241
|
-
const
|
|
242
|
-
|
|
241
|
+
const l = this.$$l_u.get(t);
|
|
242
|
+
l && (l(), this.$$l_u.delete(t));
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
async connectedCallback() {
|
|
246
246
|
if (this.$$cn = !0, !this.$$c) {
|
|
247
|
-
let e = function(
|
|
247
|
+
let e = function(o) {
|
|
248
248
|
return () => {
|
|
249
249
|
let s;
|
|
250
250
|
return {
|
|
251
251
|
c: function() {
|
|
252
|
-
s = $("slot"),
|
|
252
|
+
s = $("slot"), o !== "default" && f(s, "name", o);
|
|
253
253
|
},
|
|
254
254
|
/**
|
|
255
255
|
* @param {HTMLElement} target
|
|
@@ -267,14 +267,14 @@ typeof HTMLElement == "function" && (nt = class extends HTMLElement {
|
|
|
267
267
|
if (await Promise.resolve(), !this.$$cn || this.$$c)
|
|
268
268
|
return;
|
|
269
269
|
const t = {}, i = xt(this);
|
|
270
|
-
for (const
|
|
271
|
-
|
|
272
|
-
for (const
|
|
273
|
-
const s = this.$$g_p(
|
|
274
|
-
s in this.$$d || (this.$$d[s] = he(s,
|
|
270
|
+
for (const o of this.$$s)
|
|
271
|
+
o in i && (t[o] = [e(o)]);
|
|
272
|
+
for (const o of this.attributes) {
|
|
273
|
+
const s = this.$$g_p(o.name);
|
|
274
|
+
s in this.$$d || (this.$$d[s] = he(s, o.value, this.$$p_d, "toProp"));
|
|
275
275
|
}
|
|
276
|
-
for (const
|
|
277
|
-
!(
|
|
276
|
+
for (const o in this.$$p_d)
|
|
277
|
+
!(o in this.$$d) && this[o] !== void 0 && (this.$$d[o] = this[o], delete this[o]);
|
|
278
278
|
this.$$c = new this.$$ctor({
|
|
279
279
|
target: this.shadowRoot || this,
|
|
280
280
|
props: {
|
|
@@ -285,24 +285,24 @@ typeof HTMLElement == "function" && (nt = class extends HTMLElement {
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
});
|
|
288
|
-
const
|
|
288
|
+
const l = () => {
|
|
289
289
|
this.$$r = !0;
|
|
290
|
-
for (const
|
|
291
|
-
if (this.$$d[
|
|
290
|
+
for (const o in this.$$p_d)
|
|
291
|
+
if (this.$$d[o] = this.$$c.$$.ctx[this.$$c.$$.props[o]], this.$$p_d[o].reflect) {
|
|
292
292
|
const s = he(
|
|
293
|
-
|
|
294
|
-
this.$$d[
|
|
293
|
+
o,
|
|
294
|
+
this.$$d[o],
|
|
295
295
|
this.$$p_d,
|
|
296
296
|
"toAttribute"
|
|
297
297
|
);
|
|
298
|
-
s == null ? this.removeAttribute(this.$$p_d[
|
|
298
|
+
s == null ? this.removeAttribute(this.$$p_d[o].attribute || o) : this.setAttribute(this.$$p_d[o].attribute || o, s);
|
|
299
299
|
}
|
|
300
300
|
this.$$r = !1;
|
|
301
301
|
};
|
|
302
|
-
this.$$c.$$.after_update.push(
|
|
303
|
-
for (const
|
|
304
|
-
for (const s of this.$$l[
|
|
305
|
-
const a = this.$$c.$on(
|
|
302
|
+
this.$$c.$$.after_update.push(l), l();
|
|
303
|
+
for (const o in this.$$l)
|
|
304
|
+
for (const s of this.$$l[o]) {
|
|
305
|
+
const a = this.$$c.$on(o, s);
|
|
306
306
|
this.$$l_u.set(s, a);
|
|
307
307
|
}
|
|
308
308
|
this.$$l = {};
|
|
@@ -311,8 +311,8 @@ typeof HTMLElement == "function" && (nt = class extends HTMLElement {
|
|
|
311
311
|
// We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
|
|
312
312
|
// and setting attributes through setAttribute etc, this is helpful
|
|
313
313
|
attributeChangedCallback(e, t, i) {
|
|
314
|
-
var
|
|
315
|
-
this.$$r || (e = this.$$g_p(e), this.$$d[e] = he(e, i, this.$$p_d, "toProp"), (
|
|
314
|
+
var l;
|
|
315
|
+
this.$$r || (e = this.$$g_p(e), this.$$d[e] = he(e, i, this.$$p_d, "toProp"), (l = this.$$c) == null || l.$set({ [e]: this.$$d[e] }));
|
|
316
316
|
}
|
|
317
317
|
disconnectedCallback() {
|
|
318
318
|
this.$$cn = !1, Promise.resolve().then(() => {
|
|
@@ -326,12 +326,12 @@ typeof HTMLElement == "function" && (nt = class extends HTMLElement {
|
|
|
326
326
|
}
|
|
327
327
|
});
|
|
328
328
|
function he(n, e, t, i) {
|
|
329
|
-
var
|
|
330
|
-
const
|
|
331
|
-
if (e =
|
|
329
|
+
var o;
|
|
330
|
+
const l = (o = t[n]) == null ? void 0 : o.type;
|
|
331
|
+
if (e = l === "Boolean" && typeof e != "boolean" ? e != null : e, !i || !t[n])
|
|
332
332
|
return e;
|
|
333
333
|
if (i === "toAttribute")
|
|
334
|
-
switch (
|
|
334
|
+
switch (l) {
|
|
335
335
|
case "Object":
|
|
336
336
|
case "Array":
|
|
337
337
|
return e == null ? null : JSON.stringify(e);
|
|
@@ -343,7 +343,7 @@ function he(n, e, t, i) {
|
|
|
343
343
|
return e;
|
|
344
344
|
}
|
|
345
345
|
else
|
|
346
|
-
switch (
|
|
346
|
+
switch (l) {
|
|
347
347
|
case "Object":
|
|
348
348
|
case "Array":
|
|
349
349
|
return e && JSON.parse(e);
|
|
@@ -355,10 +355,10 @@ function he(n, e, t, i) {
|
|
|
355
355
|
return e;
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
function Vt(n, e, t, i,
|
|
358
|
+
function Vt(n, e, t, i, l, o) {
|
|
359
359
|
let s = class extends nt {
|
|
360
360
|
constructor() {
|
|
361
|
-
super(n, t,
|
|
361
|
+
super(n, t, l), this.$$p_d = e;
|
|
362
362
|
}
|
|
363
363
|
static get observedAttributes() {
|
|
364
364
|
return Object.keys(e).map(
|
|
@@ -383,7 +383,7 @@ function Vt(n, e, t, i, o, l) {
|
|
|
383
383
|
return (c = this.$$c) == null ? void 0 : c[a];
|
|
384
384
|
}
|
|
385
385
|
});
|
|
386
|
-
}),
|
|
386
|
+
}), o && (s = o(s)), n.element = /** @type {any} */
|
|
387
387
|
s, s;
|
|
388
388
|
}
|
|
389
389
|
class Pt {
|
|
@@ -420,8 +420,8 @@ class Pt {
|
|
|
420
420
|
return re;
|
|
421
421
|
const i = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
|
|
422
422
|
return i.push(t), () => {
|
|
423
|
-
const
|
|
424
|
-
|
|
423
|
+
const l = i.indexOf(t);
|
|
424
|
+
l !== -1 && i.splice(l, 1);
|
|
425
425
|
};
|
|
426
426
|
}
|
|
427
427
|
/**
|
|
@@ -441,10 +441,10 @@ function Ot(n) {
|
|
|
441
441
|
async function Bt(n, e = "SHA-256", t = 1e5) {
|
|
442
442
|
const i = Date.now().toString(16);
|
|
443
443
|
n || (n = Math.round(Math.random() * t));
|
|
444
|
-
const
|
|
444
|
+
const l = await rt(i, n, e);
|
|
445
445
|
return {
|
|
446
446
|
algorithm: e,
|
|
447
|
-
challenge:
|
|
447
|
+
challenge: l,
|
|
448
448
|
salt: i,
|
|
449
449
|
signature: ""
|
|
450
450
|
};
|
|
@@ -457,12 +457,12 @@ async function rt(n, e, t) {
|
|
|
457
457
|
)
|
|
458
458
|
);
|
|
459
459
|
}
|
|
460
|
-
function Ut(n, e, t = "SHA-256", i = 1e6,
|
|
461
|
-
const
|
|
460
|
+
function Ut(n, e, t = "SHA-256", i = 1e6, l = 0) {
|
|
461
|
+
const o = new AbortController(), s = Date.now();
|
|
462
462
|
return {
|
|
463
463
|
promise: (async () => {
|
|
464
|
-
for (let c =
|
|
465
|
-
if (
|
|
464
|
+
for (let c = l; c <= i; c += 1) {
|
|
465
|
+
if (o.signal.aborted)
|
|
466
466
|
return null;
|
|
467
467
|
if (await rt(e, c, t) === n)
|
|
468
468
|
return {
|
|
@@ -472,7 +472,7 @@ function Ut(n, e, t = "SHA-256", i = 1e6, o = 0) {
|
|
|
472
472
|
}
|
|
473
473
|
return null;
|
|
474
474
|
})(),
|
|
475
|
-
controller:
|
|
475
|
+
controller: o
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
478
|
var b = /* @__PURE__ */ ((n) => (n.ERROR = "error", n.VERIFIED = "verified", n.VERIFYING = "verifying", n.UNVERIFIED = "unverified", n.EXPIRED = "expired", n))(b || {});
|
|
@@ -482,11 +482,11 @@ function Ze(n) {
|
|
|
482
482
|
c() {
|
|
483
483
|
e = Z("svg"), t = Z("path"), i = Z("path"), f(t, "d", "M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"), f(t, "fill", "currentColor"), f(t, "opacity", ".25"), f(i, "d", "M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"), f(i, "fill", "currentColor"), f(i, "class", "altcha-spinner"), f(e, "width", "24"), f(e, "height", "24"), f(e, "viewBox", "0 0 24 24"), f(e, "xmlns", "http://www.w3.org/2000/svg");
|
|
484
484
|
},
|
|
485
|
-
m(
|
|
486
|
-
P(
|
|
485
|
+
m(l, o) {
|
|
486
|
+
P(l, e, o), p(e, t), p(e, i);
|
|
487
487
|
},
|
|
488
|
-
d(
|
|
489
|
-
|
|
488
|
+
d(l) {
|
|
489
|
+
l && N(e);
|
|
490
490
|
}
|
|
491
491
|
};
|
|
492
492
|
}
|
|
@@ -500,18 +500,18 @@ function qt(n) {
|
|
|
500
500
|
e = $("label"), f(e, "for", i = /*name*/
|
|
501
501
|
n[4] + "_checkbox");
|
|
502
502
|
},
|
|
503
|
-
m(
|
|
504
|
-
P(
|
|
503
|
+
m(l, o) {
|
|
504
|
+
P(l, e, o), e.innerHTML = t;
|
|
505
505
|
},
|
|
506
|
-
p(
|
|
507
|
-
|
|
506
|
+
p(l, o) {
|
|
507
|
+
o[0] & /*_strings*/
|
|
508
508
|
2048 && t !== (t = /*_strings*/
|
|
509
|
-
|
|
509
|
+
l[11].label + "") && (e.innerHTML = t), o[0] & /*name*/
|
|
510
510
|
16 && i !== (i = /*name*/
|
|
511
|
-
|
|
511
|
+
l[4] + "_checkbox") && f(e, "for", i);
|
|
512
512
|
},
|
|
513
|
-
d(
|
|
514
|
-
|
|
513
|
+
d(l) {
|
|
514
|
+
l && N(e);
|
|
515
515
|
}
|
|
516
516
|
};
|
|
517
517
|
}
|
|
@@ -524,11 +524,11 @@ function Zt(n) {
|
|
|
524
524
|
c() {
|
|
525
525
|
e = $("span");
|
|
526
526
|
},
|
|
527
|
-
m(i,
|
|
528
|
-
P(i, e,
|
|
527
|
+
m(i, l) {
|
|
528
|
+
P(i, e, l), e.innerHTML = t;
|
|
529
529
|
},
|
|
530
|
-
p(i,
|
|
531
|
-
|
|
530
|
+
p(i, l) {
|
|
531
|
+
l[0] & /*_strings*/
|
|
532
532
|
2048 && t !== (t = /*_strings*/
|
|
533
533
|
i[11].verifying + "") && (e.innerHTML = t);
|
|
534
534
|
},
|
|
@@ -541,47 +541,47 @@ function Yt(n) {
|
|
|
541
541
|
let e, t = (
|
|
542
542
|
/*_strings*/
|
|
543
543
|
n[11].verified + ""
|
|
544
|
-
), i,
|
|
544
|
+
), i, l;
|
|
545
545
|
return {
|
|
546
546
|
c() {
|
|
547
|
-
e = $("span"), i = W(),
|
|
548
|
-
|
|
547
|
+
e = $("span"), i = W(), l = $("input"), f(l, "type", "hidden"), f(
|
|
548
|
+
l,
|
|
549
549
|
"name",
|
|
550
550
|
/*name*/
|
|
551
551
|
n[4]
|
|
552
|
-
),
|
|
552
|
+
), l.value = /*payload*/
|
|
553
553
|
n[5];
|
|
554
554
|
},
|
|
555
|
-
m(
|
|
556
|
-
P(
|
|
555
|
+
m(o, s) {
|
|
556
|
+
P(o, e, s), e.innerHTML = t, P(o, i, s), P(o, l, s);
|
|
557
557
|
},
|
|
558
|
-
p(
|
|
558
|
+
p(o, s) {
|
|
559
559
|
s[0] & /*_strings*/
|
|
560
560
|
2048 && t !== (t = /*_strings*/
|
|
561
|
-
|
|
561
|
+
o[11].verified + "") && (e.innerHTML = t), s[0] & /*name*/
|
|
562
562
|
16 && f(
|
|
563
|
-
|
|
563
|
+
l,
|
|
564
564
|
"name",
|
|
565
565
|
/*name*/
|
|
566
|
-
|
|
566
|
+
o[4]
|
|
567
567
|
), s[0] & /*payload*/
|
|
568
|
-
32 && (
|
|
569
|
-
|
|
568
|
+
32 && (l.value = /*payload*/
|
|
569
|
+
o[5]);
|
|
570
570
|
},
|
|
571
|
-
d(
|
|
572
|
-
|
|
571
|
+
d(o) {
|
|
572
|
+
o && (N(e), N(i), N(l));
|
|
573
573
|
}
|
|
574
574
|
};
|
|
575
575
|
}
|
|
576
576
|
function Ye(n) {
|
|
577
|
-
let e, t, i,
|
|
577
|
+
let e, t, i, l, o, s, a;
|
|
578
578
|
return {
|
|
579
579
|
c() {
|
|
580
|
-
e = $("div"), t = $("a"), i = Z("svg"),
|
|
580
|
+
e = $("div"), t = $("a"), i = Z("svg"), l = Z("path"), o = Z("path"), s = Z("path"), f(l, "d", "M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"), f(l, "fill", "currentColor"), f(o, "d", "M3.57212 2.33956C1.65755 3.94607 0.496389 6.11731 0.12782 8.40523L2.04639 9.13961C2.26047 7.15832 3.21057 5.25375 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577L13.8302 6.78606L19.9633 9.13364C19.7929 7.15555 19.0335 5.20847 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956Z"), f(o, "fill", "currentColor"), f(s, "d", "M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"), f(s, "fill", "currentColor"), f(i, "width", "22"), f(i, "height", "22"), f(i, "viewBox", "0 0 20 20"), f(i, "fill", "none"), f(i, "xmlns", "http://www.w3.org/2000/svg"), f(t, "href", it), f(t, "target", "_blank"), f(t, "class", "altcha-logo"), f(t, "aria-label", a = /*_strings*/
|
|
581
581
|
n[11].ariaLinkLabel);
|
|
582
582
|
},
|
|
583
583
|
m(c, h) {
|
|
584
|
-
P(c, e, h), p(e, t), p(t, i), p(i,
|
|
584
|
+
P(c, e, h), p(e, t), p(t, i), p(i, l), p(i, o), p(i, s);
|
|
585
585
|
},
|
|
586
586
|
p(c, h) {
|
|
587
587
|
h[0] & /*_strings*/
|
|
@@ -594,23 +594,23 @@ function Ye(n) {
|
|
|
594
594
|
};
|
|
595
595
|
}
|
|
596
596
|
function Ge(n) {
|
|
597
|
-
let e, t, i,
|
|
598
|
-
function
|
|
597
|
+
let e, t, i, l;
|
|
598
|
+
function o(c, h) {
|
|
599
599
|
return (
|
|
600
600
|
/*state*/
|
|
601
601
|
c[6] === b.EXPIRED ? Wt : Gt
|
|
602
602
|
);
|
|
603
603
|
}
|
|
604
|
-
let s =
|
|
604
|
+
let s = o(n), a = s(n);
|
|
605
605
|
return {
|
|
606
606
|
c() {
|
|
607
|
-
e = $("div"), t = Z("svg"), i = Z("path"),
|
|
607
|
+
e = $("div"), t = Z("svg"), i = Z("path"), l = W(), a.c(), f(i, "stroke-linecap", "round"), f(i, "stroke-linejoin", "round"), f(i, "d", "M6 18L18 6M6 6l12 12"), f(t, "width", "14"), f(t, "height", "14"), f(t, "xmlns", "http://www.w3.org/2000/svg"), f(t, "fill", "none"), f(t, "viewBox", "0 0 24 24"), f(t, "stroke-width", "1.5"), f(t, "stroke", "currentColor"), f(e, "class", "altcha-error");
|
|
608
608
|
},
|
|
609
609
|
m(c, h) {
|
|
610
|
-
P(c, e, h), p(e, t), p(t, i), p(e,
|
|
610
|
+
P(c, e, h), p(e, t), p(t, i), p(e, l), a.m(e, null);
|
|
611
611
|
},
|
|
612
612
|
p(c, h) {
|
|
613
|
-
s === (s =
|
|
613
|
+
s === (s = o(c)) && a ? a.p(c, h) : (a.d(1), a = s(c), a && (a.c(), a.m(e, null)));
|
|
614
614
|
},
|
|
615
615
|
d(c) {
|
|
616
616
|
c && N(e), a.d();
|
|
@@ -631,13 +631,13 @@ function Gt(n) {
|
|
|
631
631
|
n[10]
|
|
632
632
|
);
|
|
633
633
|
},
|
|
634
|
-
m(i,
|
|
635
|
-
P(i, e,
|
|
634
|
+
m(i, l) {
|
|
635
|
+
P(i, e, l), e.innerHTML = t;
|
|
636
636
|
},
|
|
637
|
-
p(i,
|
|
638
|
-
|
|
637
|
+
p(i, l) {
|
|
638
|
+
l[0] & /*_strings*/
|
|
639
639
|
2048 && t !== (t = /*_strings*/
|
|
640
|
-
i[11].error + "") && (e.innerHTML = t),
|
|
640
|
+
i[11].error + "") && (e.innerHTML = t), l[0] & /*error*/
|
|
641
641
|
1024 && f(
|
|
642
642
|
e,
|
|
643
643
|
"title",
|
|
@@ -664,13 +664,13 @@ function Wt(n) {
|
|
|
664
664
|
n[10]
|
|
665
665
|
);
|
|
666
666
|
},
|
|
667
|
-
m(i,
|
|
668
|
-
P(i, e,
|
|
667
|
+
m(i, l) {
|
|
668
|
+
P(i, e, l), e.innerHTML = t;
|
|
669
669
|
},
|
|
670
|
-
p(i,
|
|
671
|
-
|
|
670
|
+
p(i, l) {
|
|
671
|
+
l[0] & /*_strings*/
|
|
672
672
|
2048 && t !== (t = /*_strings*/
|
|
673
|
-
i[11].expired + "") && (e.innerHTML = t),
|
|
673
|
+
i[11].expired + "") && (e.innerHTML = t), l[0] & /*error*/
|
|
674
674
|
1024 && f(
|
|
675
675
|
e,
|
|
676
676
|
"title",
|
|
@@ -692,16 +692,16 @@ function We(n) {
|
|
|
692
692
|
c() {
|
|
693
693
|
e = $("div"), t = $("div"), f(e, "class", "altcha-footer");
|
|
694
694
|
},
|
|
695
|
-
m(
|
|
696
|
-
P(
|
|
695
|
+
m(l, o) {
|
|
696
|
+
P(l, e, o), p(e, t), t.innerHTML = i;
|
|
697
697
|
},
|
|
698
|
-
p(
|
|
699
|
-
|
|
698
|
+
p(l, o) {
|
|
699
|
+
o[0] & /*_strings*/
|
|
700
700
|
2048 && i !== (i = /*_strings*/
|
|
701
|
-
|
|
701
|
+
l[11].footer + "") && (t.innerHTML = i);
|
|
702
702
|
},
|
|
703
|
-
d(
|
|
704
|
-
|
|
703
|
+
d(l) {
|
|
704
|
+
l && N(e);
|
|
705
705
|
}
|
|
706
706
|
};
|
|
707
707
|
}
|
|
@@ -721,7 +721,7 @@ function Xe(n) {
|
|
|
721
721
|
};
|
|
722
722
|
}
|
|
723
723
|
function Xt(n) {
|
|
724
|
-
let e, t, i,
|
|
724
|
+
let e, t, i, l, o, s, a, c, h, H, T, F, E, O, X, M = (
|
|
725
725
|
/*state*/
|
|
726
726
|
n[6] === b.VERIFYING && Ze()
|
|
727
727
|
);
|
|
@@ -751,10 +751,10 @@ function Xt(n) {
|
|
|
751
751
|
);
|
|
752
752
|
return {
|
|
753
753
|
c() {
|
|
754
|
-
e = $("div"), t = $("div"), M && M.c(), i = W(),
|
|
755
|
-
n[4] + "_checkbox"),
|
|
756
|
-
n[0] !== "onsubmit", f(
|
|
757
|
-
|
|
754
|
+
e = $("div"), t = $("div"), M && M.c(), i = W(), l = $("div"), o = $("input"), c = W(), h = $("div"), S.c(), H = W(), L && L.c(), T = W(), I && I.c(), F = W(), _ && _.c(), E = W(), A && A.c(), f(o, "type", "checkbox"), f(o, "id", s = /*name*/
|
|
755
|
+
n[4] + "_checkbox"), o.required = a = /*auto*/
|
|
756
|
+
n[0] !== "onsubmit", f(l, "class", "altcha-checkbox"), Ue(
|
|
757
|
+
l,
|
|
758
758
|
"altcha-hidden",
|
|
759
759
|
/*state*/
|
|
760
760
|
n[6] === b.VERIFYING
|
|
@@ -771,22 +771,22 @@ function Xt(n) {
|
|
|
771
771
|
);
|
|
772
772
|
},
|
|
773
773
|
m(d, y) {
|
|
774
|
-
P(d, e, y), p(e, t), M && M.m(t, null), p(t, i), p(t,
|
|
774
|
+
P(d, e, y), p(e, t), M && M.m(t, null), p(t, i), p(t, l), p(l, o), o.checked = /*checked*/
|
|
775
775
|
n[7], p(t, c), p(t, h), S.m(h, null), p(t, H), L && L.m(t, null), p(e, T), I && I.m(e, null), p(e, F), _ && _.m(e, null), p(e, E), A && A.m(e, null), n[37](e), O || (X = [
|
|
776
776
|
_e(
|
|
777
|
-
|
|
777
|
+
o,
|
|
778
778
|
"change",
|
|
779
779
|
/*input_change_handler*/
|
|
780
780
|
n[35]
|
|
781
781
|
),
|
|
782
782
|
_e(
|
|
783
|
-
|
|
783
|
+
o,
|
|
784
784
|
"change",
|
|
785
785
|
/*onCheckedChange*/
|
|
786
786
|
n[12]
|
|
787
787
|
),
|
|
788
788
|
_e(
|
|
789
|
-
|
|
789
|
+
o,
|
|
790
790
|
"invalid",
|
|
791
791
|
/*onInvalid*/
|
|
792
792
|
n[13]
|
|
@@ -797,13 +797,13 @@ function Xt(n) {
|
|
|
797
797
|
/*state*/
|
|
798
798
|
d[6] === b.VERIFYING ? M || (M = Ze(), M.c(), M.m(t, i)) : M && (M.d(1), M = null), y[0] & /*name*/
|
|
799
799
|
16 && s !== (s = /*name*/
|
|
800
|
-
d[4] + "_checkbox") && f(
|
|
800
|
+
d[4] + "_checkbox") && f(o, "id", s), y[0] & /*auto*/
|
|
801
801
|
1 && a !== (a = /*auto*/
|
|
802
|
-
d[0] !== "onsubmit") && (
|
|
803
|
-
128 && (
|
|
802
|
+
d[0] !== "onsubmit") && (o.required = a), y[0] & /*checked*/
|
|
803
|
+
128 && (o.checked = /*checked*/
|
|
804
804
|
d[7]), y[0] & /*state*/
|
|
805
805
|
64 && Ue(
|
|
806
|
-
|
|
806
|
+
l,
|
|
807
807
|
"altcha-hidden",
|
|
808
808
|
/*state*/
|
|
809
809
|
d[6] === b.VERIFYING
|
|
@@ -846,13 +846,13 @@ function Jt() {
|
|
|
846
846
|
}
|
|
847
847
|
function zt(n, e, t) {
|
|
848
848
|
var Ve, Pe;
|
|
849
|
-
let i,
|
|
849
|
+
let i, l, o, { auto: s = void 0 } = e, { blockspam: a = void 0 } = e, { challengeurl: c = void 0 } = e, { challengejson: h = void 0 } = e, { debug: H = !1 } = e, { delay: T = 0 } = e, { expire: F = void 0 } = e, { floating: E = void 0 } = e, { floatinganchor: O = void 0 } = e, { floatingoffset: X = void 0 } = e, { hidefooter: M = !1 } = e, { hidelogo: Q = !1 } = e, { name: Y = "altcha" } = e, { maxnumber: S = 1e6 } = e, { mockerror: L = !1 } = e, { refetchonexpire: I = !0 } = e, { spamfilter: _ = !1 } = e, { strings: A = void 0 } = e, { test: d = !1 } = e, { verifyurl: y = void 0 } = e, { workers: ie = Math.min(16, navigator.hardwareConcurrency || 8) } = e, { workerurl: ge = void 0 } = e;
|
|
850
850
|
const me = It(), pe = ["SHA-256", "SHA-384", "SHA-512"], xe = (Pe = (Ve = document.documentElement.lang) == null ? void 0 : Ve.split("-")) == null ? void 0 : Pe[0];
|
|
851
851
|
let G = !1, x, J = null, fe = null, m = null, be = null, z = null, j = b.UNVERIFIED, U = null;
|
|
852
852
|
Lt(() => {
|
|
853
853
|
m && (m.removeEventListener("submit", Le), m.removeEventListener("reset", Ie), m.removeEventListener("focusin", Ce), m = null), U && (clearTimeout(U), U = null), document.removeEventListener("click", Me), document.removeEventListener("scroll", Te), window.removeEventListener("resize", De);
|
|
854
854
|
}), Ct(() => {
|
|
855
|
-
C("mounted", "0.6.
|
|
855
|
+
C("mounted", "0.6.1"), C("workers", ie), d && C("using test mode"), F && ce(F), s !== void 0 && C("auto", s), E !== void 0 && Ne(E), m = x.closest("form"), m && (m.addEventListener("submit", Le, { capture: !0 }), m.addEventListener("reset", Ie), s === "onfocus" && m.addEventListener("focusin", Ce)), s === "onload" && K();
|
|
856
856
|
});
|
|
857
857
|
function C(...r) {
|
|
858
858
|
(H || r.some((u) => u instanceof Error)) && console[r[0] instanceof Error ? "error" : "log"]("ALTCHA", ...r);
|
|
@@ -933,7 +933,7 @@ function zt(n, e, t) {
|
|
|
933
933
|
}
|
|
934
934
|
}
|
|
935
935
|
function $e() {
|
|
936
|
-
c && I && j === b.VERIFIED ? K() : ue(b.EXPIRED,
|
|
936
|
+
c && I && j === b.VERIFIED ? K() : ue(b.EXPIRED, o.expired);
|
|
937
937
|
}
|
|
938
938
|
async function lt(r) {
|
|
939
939
|
let u = null;
|
|
@@ -994,7 +994,7 @@ function zt(n, e, t) {
|
|
|
994
994
|
E && we();
|
|
995
995
|
}
|
|
996
996
|
function Se() {
|
|
997
|
-
j === b.VERIFYING && alert(
|
|
997
|
+
j === b.VERIFYING && o.waitAlert && alert(o.waitAlert);
|
|
998
998
|
}
|
|
999
999
|
function ct(r) {
|
|
1000
1000
|
E && j !== b.UNVERIFIED && requestAnimationFrame(() => {
|
|
@@ -1065,7 +1065,7 @@ function zt(n, e, t) {
|
|
|
1065
1065
|
C("unable to find floating anchor element");
|
|
1066
1066
|
}
|
|
1067
1067
|
function je(r) {
|
|
1068
|
-
r.auto !== void 0 && (t(0, s = r.auto), s === "onload" && K()), r.floatinganchor !== void 0 && t(18, O = r.floatinganchor), r.delay !== void 0 && t(16, T = r.delay), r.floatingoffset !== void 0 && t(19, X = r.floatingoffset), r.floating !== void 0 && Ne(r.floating), r.expire !== void 0 && (ce(r.expire), t(17, F = r.expire)), r.challenge && (Re(r.challenge), i = r.challenge), r.challengeurl !== void 0 && t(14, c = r.challengeurl), r.debug !== void 0 && t(15, H = !!r.debug), r.hidefooter !== void 0 && t(2, M = !!r.hidefooter), r.hidelogo !== void 0 && t(3, Q = !!r.hidelogo), r.maxnumber !== void 0 && t(20, S = +r.maxnumber), r.mockerror !== void 0 && t(21, L = !!r.mockerror), r.name !== void 0 && t(4, Y = r.name), r.refetchonexpire !== void 0 && t(22, I = !!r.refetchonexpire), r.spamfilter !== void 0 && t(23, _ = typeof r.spamfilter == "object" ? r.spamfilter : !!r.spamfilter), r.strings && t(34,
|
|
1068
|
+
r.auto !== void 0 && (t(0, s = r.auto), s === "onload" && K()), r.floatinganchor !== void 0 && t(18, O = r.floatinganchor), r.delay !== void 0 && t(16, T = r.delay), r.floatingoffset !== void 0 && t(19, X = r.floatingoffset), r.floating !== void 0 && Ne(r.floating), r.expire !== void 0 && (ce(r.expire), t(17, F = r.expire)), r.challenge && (Re(r.challenge), i = r.challenge), r.challengeurl !== void 0 && t(14, c = r.challengeurl), r.debug !== void 0 && t(15, H = !!r.debug), r.hidefooter !== void 0 && t(2, M = !!r.hidefooter), r.hidelogo !== void 0 && t(3, Q = !!r.hidelogo), r.maxnumber !== void 0 && t(20, S = +r.maxnumber), r.mockerror !== void 0 && t(21, L = !!r.mockerror), r.name !== void 0 && t(4, Y = r.name), r.refetchonexpire !== void 0 && t(22, I = !!r.refetchonexpire), r.spamfilter !== void 0 && t(23, _ = typeof r.spamfilter == "object" ? r.spamfilter : !!r.spamfilter), r.strings && t(34, l = r.strings), r.test !== void 0 && t(24, d = typeof r.test == "number" ? r.test : !!r.test), r.verifyurl !== void 0 && t(25, y = r.verifyurl), r.workers !== void 0 && t(26, ie = +r.workers);
|
|
1069
1069
|
}
|
|
1070
1070
|
function ue(r = b.UNVERIFIED, u = null) {
|
|
1071
1071
|
U && (clearTimeout(U), U = null), t(7, G = !1), t(10, be = u), t(5, z = null), t(6, j = r);
|
|
@@ -1104,17 +1104,17 @@ function zt(n, e, t) {
|
|
|
1104
1104
|
}, n.$$.update = () => {
|
|
1105
1105
|
n.$$.dirty[0] & /*challengejson*/
|
|
1106
1106
|
268435456 && (i = h ? ze(h) : void 0), n.$$.dirty[0] & /*strings*/
|
|
1107
|
-
536870912 && t(34,
|
|
1108
|
-
8 && t(11,
|
|
1107
|
+
536870912 && t(34, l = A ? ze(A) : {}), n.$$.dirty[1] & /*parsedStrings*/
|
|
1108
|
+
8 && t(11, o = {
|
|
1109
1109
|
ariaLinkLabel: Je,
|
|
1110
1110
|
error: "Verification failed. Try again later.",
|
|
1111
1111
|
expired: "Verification expired. Try again.",
|
|
1112
|
-
footer: `Protected by <a href="${it}" target="_blank" aria-label="${
|
|
1112
|
+
footer: `Protected by <a href="${it}" target="_blank" aria-label="${l.ariaLinkLabel || Je}">ALTCHA</a>`,
|
|
1113
1113
|
label: "I'm not a robot",
|
|
1114
1114
|
verified: "Verified",
|
|
1115
1115
|
verifying: "Verifying...",
|
|
1116
1116
|
waitAlert: "Verifying... please wait.",
|
|
1117
|
-
...
|
|
1117
|
+
...l
|
|
1118
1118
|
}), n.$$.dirty[0] & /*payload, state*/
|
|
1119
1119
|
96 && me("statechange", { payload: z, state: j }), n.$$.dirty[0] & /*state*/
|
|
1120
1120
|
64 && ct();
|
|
@@ -1130,7 +1130,7 @@ function zt(n, e, t) {
|
|
|
1130
1130
|
x,
|
|
1131
1131
|
J,
|
|
1132
1132
|
be,
|
|
1133
|
-
|
|
1133
|
+
o,
|
|
1134
1134
|
ft,
|
|
1135
1135
|
Se,
|
|
1136
1136
|
c,
|
|
@@ -1153,7 +1153,7 @@ function zt(n, e, t) {
|
|
|
1153
1153
|
je,
|
|
1154
1154
|
ue,
|
|
1155
1155
|
K,
|
|
1156
|
-
|
|
1156
|
+
l,
|
|
1157
1157
|
dt,
|
|
1158
1158
|
gt,
|
|
1159
1159
|
mt
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(O,N){typeof exports=="object"&&typeof module<"u"?N(exports):typeof define=="function"&&define.amd?define(["exports"],N):(O=typeof globalThis<"u"?globalThis:O||self,N(O.altcha={}))})(this,function(O){"use strict";var Qt=Object.defineProperty;var en=(O,N,Z)=>N in O?Qt(O,N,{enumerable:!0,configurable:!0,writable:!0,value:Z}):O[N]=Z;var q=(O,N,Z)=>en(O,typeof N!="symbol"?N+"":N,Z);var N=typeof document<"u"?document.currentScript:null;function Z(){}function Ce(n){return n()}function Le(){return Object.create(null)}function le(n){n.forEach(Ce)}function Ie(n){return typeof n=="function"}function ft(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function ct(n){return Object.keys(n).length===0}function v(n,e){n.appendChild(e)}function V(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 ut(n){return document.createTextNode(n)}function X(){return ut(" ")}function be(n,e,t,i){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}function f(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function at(n){return Array.from(n.childNodes)}function Ae(n,e,t){n.classList.toggle(e,!!t)}function ht(n,e,{bubbles:t=!1,cancelable:i=!1}={}){return new CustomEvent(n,{detail:e,bubbles:t,cancelable:i})}function dt(n){const e={};return n.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let se;function fe(n){se=n}function we(){if(!se)throw new Error("Function called outside component initialization");return se}function gt(n){we().$$.on_mount.push(n)}function mt(n){we().$$.on_destroy.push(n)}function bt(){const n=we();return(e,t,{cancelable:i=!1}={})=>{const o=n.$$.callbacks[e];if(o){const l=ht(e,t,{cancelable:i});return o.slice().forEach(s=>{s.call(n,l)}),!l.defaultPrevented}return!0}}const ne=[],ue=[];let re=[];const Re=[],$e=Promise.resolve();let _e=!1;function Te(){_e||(_e=!0,$e.then(w))}function wt(){return Te(),$e}function ye(n){re.push(n)}const ke=new Set;let ie=0;function w(){if(ie!==0)return;const n=se;do{try{for(;ie<ne.length;){const e=ne[ie];ie++,fe(e),_t(e.$$)}}catch(e){throw ne.length=0,ie=0,e}for(fe(null),ne.length=0,ie=0;ue.length;)ue.pop()();for(let e=0;e<re.length;e+=1){const t=re[e];ke.has(t)||(ke.add(t),t())}re.length=0}while(ne.length);for(;Re.length;)Re.pop()();_e=!1,ke.clear(),fe(n)}function _t(n){if(n.fragment!==null){n.update(),le(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(ye)}}function yt(n){const e=[],t=[];re.forEach(i=>n.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),re=e}const kt=new Set;function vt(n,e){n&&n.i&&(kt.delete(n),n.i(e))}function Et(n,e,t){const{fragment:i,after_update:o}=n.$$;i&&i.m(e,t),ye(()=>{const l=n.$$.on_mount.map(Ce).filter(Ie);n.$$.on_destroy?n.$$.on_destroy.push(...l):le(l),n.$$.on_mount=[]}),o.forEach(ye)}function pt(n,e){const t=n.$$;t.fragment!==null&&(yt(t.after_update),le(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function xt(n,e){n.$$.dirty[0]===-1&&(ne.push(n),Te(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function Ct(n,e,t,i,o,l,s=null,a=[-1]){const c=se;fe(n);const h=n.$$={fragment:null,ctx:[],props:l,update:Z,not_equal:o,bound:Le(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Le(),dirty:a,skip_bound:!1,root:e.target||c.$$.root};s&&s(h.root);let B=!1;if(h.ctx=t?t(n,e.props||{},(S,H,...E)=>{const U=E.length?E[0]:H;return h.ctx&&o(h.ctx[S],h.ctx[S]=U)&&(!h.skip_bound&&h.bound[S]&&h.bound[S](U),B&&xt(n,S)),H}):[],h.update(),B=!0,le(h.before_update),h.fragment=i?i(h.ctx):!1,e.target){if(e.hydrate){const S=at(e.target);h.fragment&&h.fragment.l(S),S.forEach(j)}else h.fragment&&h.fragment.c();e.intro&&vt(n.$$.fragment),Et(n,e.target,e.anchor),w()}fe(c)}let Se;typeof HTMLElement=="function"&&(Se=class extends HTMLElement{constructor(e,t,i){super();q(this,"$$ctor");q(this,"$$s");q(this,"$$c");q(this,"$$cn",!1);q(this,"$$d",{});q(this,"$$r",!1);q(this,"$$p_d",{});q(this,"$$l",{});q(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 s;return{c:function(){s=$("slot"),l!=="default"&&f(s,"name",l)},m:function(h,B){V(h,s,B)},d:function(h){h&&j(s)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},i=dt(this);for(const l of this.$$s)l in i&&(t[l]=[e(l)]);for(const l of this.attributes){const s=this.$$g_p(l.name);s in this.$$d||(this.$$d[s]=ae(s,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 s=ae(l,this.$$d[l],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,s)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const l in this.$$l)for(const s of this.$$l[l]){const a=this.$$c.$on(l,s);this.$$l_u.set(s,a)}this.$$l={}}}attributeChangedCallback(e,t,i){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=ae(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 ae(n,e,t,i){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(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 Lt(n,e,t,i,o,l){let s=class extends Se{constructor(){super(n,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(s.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(c){var h;c=ae(a,c,e),this.$$d[a]=c,(h=this.$$c)==null||h.$set({[a]:c})}})}),i.forEach(a=>{Object.defineProperty(s.prototype,a,{get(){var c;return(c=this.$$c)==null?void 0:c[a]}})}),l&&(s=l(s)),n.element=s,s}class It{constructor(){q(this,"$$");q(this,"$$set")}$destroy(){pt(this,1),this.$destroy=Z}$on(e,t){if(!Ie(t))return Z;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&&!ct(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const At="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(At);const Rt=new TextEncoder;function $t(n){return[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function Tt(n,e="SHA-256",t=1e5){const i=Date.now().toString(16);n||(n=Math.round(Math.random()*t));const o=await Me(i,n,e);return{algorithm:e,challenge:o,salt:i,signature:""}}async function Me(n,e,t){return $t(await crypto.subtle.digest(t.toUpperCase(),Rt.encode(n+e)))}function St(n,e,t="SHA-256",i=1e6,o=0){const l=new AbortController,s=Date.now();return{promise:(async()=>{for(let c=o;c<=i;c+=1){if(l.signal.aborted)return null;if(await Me(e,c,t)===n)return{number:c,took:Date.now()-s}}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 je(n){let e,t,i;return{c(){e=W("svg"),t=W("path"),i=W("path"),f(t,"d","M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"),f(t,"fill","currentColor"),f(t,"opacity",".25"),f(i,"d","M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"),f(i,"fill","currentColor"),f(i,"class","altcha-spinner"),f(e,"width","24"),f(e,"height","24"),f(e,"viewBox","0 0 24 24"),f(e,"xmlns","http://www.w3.org/2000/svg")},m(o,l){V(o,e,l),v(e,t),v(e,i)},d(o){o&&j(e)}}}function Mt(n){let e,t=n[11].label+"",i;return{c(){e=$("label"),f(e,"for",i=n[4]+"_checkbox")},m(o,l){V(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")&&f(e,"for",i)},d(o){o&&j(e)}}}function jt(n){let e,t=n[11].verifying+"";return{c(){e=$("span")},m(i,o){V(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].verifying+"")&&(e.innerHTML=t)},d(i){i&&j(e)}}}function Dt(n){let e,t=n[11].verified+"",i,o;return{c(){e=$("span"),i=X(),o=$("input"),f(o,"type","hidden"),f(o,"name",n[4]),o.value=n[5]},m(l,s){V(l,e,s),e.innerHTML=t,V(l,i,s),V(l,o,s)},p(l,s){s[0]&2048&&t!==(t=l[11].verified+"")&&(e.innerHTML=t),s[0]&16&&f(o,"name",l[4]),s[0]&32&&(o.value=l[5])},d(l){l&&(j(e),j(i),j(o))}}}function De(n){let e,t,i,o,l,s,a;return{c(){e=$("div"),t=$("a"),i=W("svg"),o=W("path"),l=W("path"),s=W("path"),f(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"),f(o,"fill","currentColor"),f(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"),f(l,"fill","currentColor"),f(s,"d","M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"),f(s,"fill","currentColor"),f(i,"width","22"),f(i,"height","22"),f(i,"viewBox","0 0 20 20"),f(i,"fill","none"),f(i,"xmlns","http://www.w3.org/2000/svg"),f(t,"href",He),f(t,"target","_blank"),f(t,"class","altcha-logo"),f(t,"aria-label",a=n[11].ariaLinkLabel)},m(c,h){V(c,e,h),v(e,t),v(t,i),v(i,o),v(i,l),v(i,s)},p(c,h){h[0]&2048&&a!==(a=c[11].ariaLinkLabel)&&f(t,"aria-label",a)},d(c){c&&j(e)}}}function Ne(n){let e,t,i,o;function l(c,h){return c[6]===m.EXPIRED?Vt:Nt}let s=l(n),a=s(n);return{c(){e=$("div"),t=W("svg"),i=W("path"),o=X(),a.c(),f(i,"stroke-linecap","round"),f(i,"stroke-linejoin","round"),f(i,"d","M6 18L18 6M6 6l12 12"),f(t,"width","14"),f(t,"height","14"),f(t,"xmlns","http://www.w3.org/2000/svg"),f(t,"fill","none"),f(t,"viewBox","0 0 24 24"),f(t,"stroke-width","1.5"),f(t,"stroke","currentColor"),f(e,"class","altcha-error")},m(c,h){V(c,e,h),v(e,t),v(t,i),v(e,o),a.m(e,null)},p(c,h){s===(s=l(c))&&a?a.p(c,h):(a.d(1),a=s(c),a&&(a.c(),a.m(e,null)))},d(c){c&&j(e),a.d()}}}function Nt(n){let e,t=n[11].error+"";return{c(){e=$("div"),f(e,"title",n[10])},m(i,o){V(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].error+"")&&(e.innerHTML=t),o[0]&1024&&f(e,"title",i[10])},d(i){i&&j(e)}}}function Vt(n){let e,t=n[11].expired+"";return{c(){e=$("div"),f(e,"title",n[10])},m(i,o){V(i,e,o),e.innerHTML=t},p(i,o){o[0]&2048&&t!==(t=i[11].expired+"")&&(e.innerHTML=t),o[0]&1024&&f(e,"title",i[10])},d(i){i&&j(e)}}}function Ve(n){let e,t,i=n[11].footer+"";return{c(){e=$("div"),t=$("div"),f(e,"class","altcha-footer")},m(o,l){V(o,e,l),v(e,t),t.innerHTML=i},p(o,l){l[0]&2048&&i!==(i=o[11].footer+"")&&(t.innerHTML=i)},d(o){o&&j(e)}}}function Pe(n){let e;return{c(){e=$("div"),f(e,"class","altcha-anchor-arrow")},m(t,i){V(t,e,i),n[36](e)},p:Z,d(t){t&&j(e),n[36](null)}}}function Pt(n){let e,t,i,o,l,s,a,c,h,B,S,H,E,U,K,T=n[6]===m.VERIFYING&&je();function oe(d,y){return d[6]===m.VERIFIED?Dt:d[6]===m.VERIFYING?jt:Mt}let J=oe(n),M=J(n),L=n[3]!==!0&&De(n),I=(n[10]||n[6]===m.EXPIRED)&&Ne(n),_=n[11].footer&&n[2]!==!0&&Ve(n),A=n[1]&&Pe(n);return{c(){e=$("div"),t=$("div"),T&&T.c(),i=X(),o=$("div"),l=$("input"),c=X(),h=$("div"),M.c(),B=X(),L&&L.c(),S=X(),I&&I.c(),H=X(),_&&_.c(),E=X(),A&&A.c(),f(l,"type","checkbox"),f(l,"id",s=n[4]+"_checkbox"),l.required=a=n[0]!=="onsubmit",f(o,"class","altcha-checkbox"),Ae(o,"altcha-hidden",n[6]===m.VERIFYING),f(h,"class","altcha-label"),f(t,"class","altcha-main"),f(e,"class","altcha"),f(e,"data-state",n[6]),f(e,"data-floating",n[1])},m(d,y){V(d,e,y),v(e,t),T&&T.m(t,null),v(t,i),v(t,o),v(o,l),l.checked=n[7],v(t,c),v(t,h),M.m(h,null),v(t,B),L&&L.m(t,null),v(e,S),I&&I.m(e,null),v(e,H),_&&_.m(e,null),v(e,E),A&&A.m(e,null),n[37](e),U||(K=[be(l,"change",n[35]),be(l,"change",n[12]),be(l,"invalid",n[13])],U=!0)},p(d,y){d[6]===m.VERIFYING?T||(T=je(),T.c(),T.m(t,i)):T&&(T.d(1),T=null),y[0]&16&&s!==(s=d[4]+"_checkbox")&&f(l,"id",s),y[0]&1&&a!==(a=d[0]!=="onsubmit")&&(l.required=a),y[0]&128&&(l.checked=d[7]),y[0]&64&&Ae(o,"altcha-hidden",d[6]===m.VERIFYING),J===(J=oe(d))&&M?M.p(d,y):(M.d(1),M=J(d),M&&(M.c(),M.m(h,null))),d[3]!==!0?L?L.p(d,y):(L=De(d),L.c(),L.m(t,null)):L&&(L.d(1),L=null),d[10]||d[6]===m.EXPIRED?I?I.p(d,y):(I=Ne(d),I.c(),I.m(e,H)):I&&(I.d(1),I=null),d[11].footer&&d[2]!==!0?_?_.p(d,y):(_=Ve(d),_.c(),_.m(e,E)):_&&(_.d(1),_=null),d[1]?A?A.p(d,y):(A=Pe(d),A.c(),A.m(e,null)):A&&(A.d(1),A=null),y[0]&64&&f(e,"data-state",d[6]),y[0]&2&&f(e,"data-floating",d[1])},i:Z,o:Z,d(d){d&&j(e),T&&T.d(),M.d(),L&&L.d(),I&&I.d(),_&&_.d(),A&&A.d(),n[37](null),U=!1,le(K)}}}const Fe="Visit Altcha.org",He="https://altcha.org/";function Oe(n){return JSON.parse(n)}function Ft(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Ht(n,e,t){var rt,it;let i,o,l,{auto:s=void 0}=e,{blockspam:a=void 0}=e,{challengeurl:c=void 0}=e,{challengejson:h=void 0}=e,{debug:B=!1}=e,{delay:S=0}=e,{expire:H=void 0}=e,{floating:E=void 0}=e,{floatinganchor:U=void 0}=e,{floatingoffset:K=void 0}=e,{hidefooter:T=!1}=e,{hidelogo:oe=!1}=e,{name:J="altcha"}=e,{maxnumber:M=1e6}=e,{mockerror:L=!1}=e,{refetchonexpire:I=!0}=e,{spamfilter:_=!1}=e,{strings:A=void 0}=e,{test:d=!1}=e,{verifyurl:y=void 0}=e,{workers:ce=Math.min(16,navigator.hardwareConcurrency||8)}=e,{workerurl:ve=void 0}=e;const Ee=bt(),Ue=["SHA-256","SHA-384","SHA-512"],qe=(it=(rt=document.documentElement.lang)==null?void 0:rt.split("-"))==null?void 0:it[0];let z=!1,x,Q=null,he=null,b=null,pe=null,ee=null,P=m.UNVERIFIED,Y=null;mt(()=>{b&&(b.removeEventListener("submit",Ye),b.removeEventListener("reset",Ge),b.removeEventListener("focusin",Ze),b=null),Y&&(clearTimeout(Y),Y=null),document.removeEventListener("click",ze),document.removeEventListener("scroll",Ke),window.removeEventListener("resize",et)}),gt(()=>{C("mounted","0.6.0"),C("workers",ce),d&&C("using test mode"),H&&de(H),s!==void 0&&C("auto",s),E!==void 0&&tt(E),b=x.closest("form"),b&&(b.addEventListener("submit",Ye,{capture:!0}),b.addEventListener("reset",Ge),s==="onfocus"&&b.addEventListener("focusin",Ze)),s==="onload"&&te()});function C(...r){(B||r.some(u=>u instanceof Error))&&console[r[0]instanceof Error?"error":"log"]("ALTCHA",...r)}function Ze(r){P===m.UNVERIFIED&&te()}function Ye(r){b&&s==="onsubmit"&&(P===m.UNVERIFIED?(r.preventDefault(),r.stopPropagation(),te().then(()=>{b==null||b.requestSubmit()})):P!==m.VERIFIED&&(r.preventDefault(),r.stopPropagation(),P===m.VERIFYING&&Qe()))}function Ge(){ge()}function We(r,u){return btoa(JSON.stringify({algorithm:r.algorithm,challenge:r.challenge,number:u.number,salt:r.salt,signature:r.signature,test:d?!0:void 0,took:u.took}))}function Xe(r){if(!r.algorithm)throw new Error("Invalid challenge. Property algorithm is missing.");if(r.signature===void 0)throw new Error("Invalid challenge. Property signature is missing.");if(!Ue.includes(r.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${Ue.join(", ")}`);if(!r.challenge||r.challenge.length<40)throw new Error("Challenge is too short. Min. 40 chars.");if(!r.salt||r.salt.length<10)throw new Error("Salt is too short. Min. 10 chars.")}async function Ot(){var r;if(L)throw C("mocking error"),new Error("Mocked error.");if(i)return C("using provided json data"),i;if(d)return C("generating test challenge",{test:d}),Tt(typeof d!="boolean"?+d:void 0);{if(!c)throw new Error("Attribute challengeurl not set.");C("fetching challenge from",c);const u=await fetch(c,{headers:{"x-altcha-spam-filter":_?"1":"0"}});if(u.status!==200)throw new Error(`Server responded with ${u.status}.`);const g=u.headers.get("Expires"),R=u.headers.get("X-Altcha-Config"),D=await u.json(),F=new URLSearchParams((r=D.salt.split("?"))==null?void 0:r[1]),G=F.get("expires")||F.get("expire");if(G){const k=new Date(+G*1e3),p=isNaN(k.getTime())?0:k.getTime()-Date.now();p>0&&de(p)}if(R)try{const k=JSON.parse(R);k&&typeof k=="object"&&(k.verifyurl&&(k.verifyurl=new URL(k.verifyurl,new URL(c)).toString()),nt(k))}catch(k){C("unable to configure from X-Altcha-Config",k)}if(!H&&(g!=null&&g.length)){const k=Date.parse(g);if(k){const p=k-Date.now();p>0&&de(p)}}return D}}function Je(){c&&I&&P===m.VERIFIED?te():ge(m.EXPIRED,l.expired)}async function Bt(r){let u=null;if("Worker"in window){try{u=await Ut(r.challenge,r.salt,r.algorithm,r.maxnumber)}catch(g){C(g)}if((u==null?void 0:u.number)!==void 0)return{data:r,solution:u}}return{data:r,solution:await St(r.challenge,r.salt,r.algorithm,r.maxnumber||M).promise}}async function Ut(r,u,g,R=typeof d=="number"?d:M,D=Math.ceil(ce)){const F=[];if(D<1)throw new Error("Wrong number of workers configured.");if(D>16)throw new Error("Too many workers. Max. 16 allowed workers.");for(let p=0;p<D;p++)F.push(createAltchaWorker(ve));const G=Math.ceil(R/D),k=await Promise.all(F.map((p,me)=>{const ot=me*G;return new Promise(Kt=>{p.addEventListener("message",lt=>{if(lt.data)for(const st of F)st!==p&&st.postMessage({type:"abort"});Kt(lt.data)}),p.postMessage({payload:{alg:g,challenge:r,max:ot+G,salt:u,start:ot},type:"work"})})}));for(const p of F)p.terminate();return k.find(p=>!!p)||null}function qt(){[m.UNVERIFIED,m.ERROR,m.EXPIRED].includes(P)?_&&(b==null?void 0:b.reportValidity())===!1?t(7,z=!1):te():t(7,z=!0)}function ze(r){const u=r.target;E&&u&&!x.contains(u)&&P===m.VERIFIED&&t(8,x.style.display="none",x)}function Ke(){E&&xe()}function Qe(){P===m.VERIFYING&&alert(l.waitAlert)}function Zt(r){E&&P!==m.UNVERIFIED&&requestAnimationFrame(()=>{xe()})}function et(){E&&xe()}function de(r){C("expire",r),Y&&(clearTimeout(Y),Y=null),r<1?Je():Y=setTimeout(Je,r)}function tt(r){C("floating",r),E!==r&&(t(8,x.style.left="",x),t(8,x.style.top="",x)),t(1,E=r===!0||r===""?"auto":r===!1||r==="false"?void 0:E),E?(s||t(0,s="onsubmit"),document.addEventListener("scroll",Ke),document.addEventListener("click",ze),window.addEventListener("resize",et)):s==="onsubmit"&&t(0,s=void 0)}function Yt(r){var g;const u=b==null?void 0:b.querySelector(typeof r=="string"?`input[name="${r}"]`:'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 Gt(r){return[...(b==null?void 0:b.querySelectorAll(r!=null&&r.length?r.map(g=>`input[name="${g}"]`).join(", "):'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])'))||[]].reduce((g,R)=>{const D=R.name,F=R.value.trim();return D&&F&&(g[D]=F),g},{})}async function Wt(r){if(!y)throw new Error("Attribute verifyurl not set.");C("requesting server verification from",y);const u={payload:r};if(_){const{email:D,expectedLanguages:F,expectedCountries:G,fields:k,ipAddress:p,timeZone:me}=typeof _=="object"?_:{email:void 0,expectedCountries:void 0,expectedLanguages:void 0,fields:void 0,ipAddress:void 0,timeZone:void 0};u.ipAddress=p===!1?void 0:p||"auto",u.email=D===!1?void 0:Yt(D),u.fields=k===!1?void 0:Gt(k),u.timeZone=me===!1?void 0:me||Ft(),u.expectedCountries=G,u.expectedLanguages=F||(qe?[qe]:void 0)}const g=await fetch(y,{body:JSON.stringify(u),headers:{"content-type":"application/json"},method:"POST"});if(g.status!==200)throw new Error(`Server responded with ${g.status}.`);const R=await g.json();if(R!=null&&R.payload&&t(5,ee=R.payload),Ee("serververification",R),a&&R.classification==="BAD")throw new Error("SpamFilter returned negative classification.")}function xe(r=20){if(x)if(he||(he=(U?document.querySelector(U):b==null?void 0:b.querySelector('input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])'))||b),he){const u=parseInt(K,10)||12,g=he.getBoundingClientRect(),R=x.getBoundingClientRect(),D=document.documentElement.clientHeight,F=document.documentElement.clientWidth,G=E==="auto"?g.bottom+R.height+u+r>D:E==="top",k=Math.max(r,Math.min(F-r-R.width,g.left+g.width/2-R.width/2));if(G?t(8,x.style.top=`${g.top-(R.height+u)}px`,x):t(8,x.style.top=`${g.bottom+u}px`,x),t(8,x.style.left=`${k}px`,x),x.setAttribute("data-floating",G?"top":"bottom"),Q){const p=Q.getBoundingClientRect();t(9,Q.style.left=g.left-k+g.width/2-p.width/2+"px",Q)}}else C("unable to find floating anchor element")}function nt(r){r.auto!==void 0&&(t(0,s=r.auto),s==="onload"&&te()),r.floatinganchor!==void 0&&t(18,U=r.floatinganchor),r.delay!==void 0&&t(16,S=r.delay),r.floatingoffset!==void 0&&t(19,K=r.floatingoffset),r.floating!==void 0&&tt(r.floating),r.expire!==void 0&&(de(r.expire),t(17,H=r.expire)),r.challenge&&(Xe(r.challenge),i=r.challenge),r.challengeurl!==void 0&&t(14,c=r.challengeurl),r.debug!==void 0&&t(15,B=!!r.debug),r.hidefooter!==void 0&&t(2,T=!!r.hidefooter),r.hidelogo!==void 0&&t(3,oe=!!r.hidelogo),r.maxnumber!==void 0&&t(20,M=+r.maxnumber),r.mockerror!==void 0&&t(21,L=!!r.mockerror),r.name!==void 0&&t(4,J=r.name),r.refetchonexpire!==void 0&&t(22,I=!!r.refetchonexpire),r.spamfilter!==void 0&&t(23,_=typeof r.spamfilter=="object"?r.spamfilter:!!r.spamfilter),r.strings&&t(34,o=r.strings),r.test!==void 0&&t(24,d=typeof r.test=="number"?r.test:!!r.test),r.verifyurl!==void 0&&t(25,y=r.verifyurl),r.workers!==void 0&&t(26,ce=+r.workers)}function ge(r=m.UNVERIFIED,u=null){Y&&(clearTimeout(Y),Y=null),t(7,z=!1),t(10,pe=u),t(5,ee=null),t(6,P=r)}async function te(){return ge(m.VERIFYING),await new Promise(r=>setTimeout(r,S||0)),Ot().then(r=>(Xe(r),C("challenge",r),Bt(r))).then(({data:r,solution:u})=>{if(C("solution",u),(u==null?void 0:u.number)!==void 0){if(y)return Wt(We(r,u));t(5,ee=We(r,u)),C("payload",ee)}else throw C("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."),new Error("Unexpected result returned.")}).then(()=>{wt().then(()=>{t(6,P=m.VERIFIED),t(7,z=!0),C("verified"),Ee("verified",{payload:ee})})}).catch(r=>{C(r),t(6,P=m.ERROR),t(7,z=!1),t(10,pe=r.message)})}function Xt(){z=this.checked,t(7,z)}function Jt(r){ue[r?"unshift":"push"](()=>{Q=r,t(9,Q)})}function zt(r){ue[r?"unshift":"push"](()=>{x=r,t(8,x)})}return n.$$set=r=>{"auto"in r&&t(0,s=r.auto),"blockspam"in r&&t(27,a=r.blockspam),"challengeurl"in r&&t(14,c=r.challengeurl),"challengejson"in r&&t(28,h=r.challengejson),"debug"in r&&t(15,B=r.debug),"delay"in r&&t(16,S=r.delay),"expire"in r&&t(17,H=r.expire),"floating"in r&&t(1,E=r.floating),"floatinganchor"in r&&t(18,U=r.floatinganchor),"floatingoffset"in r&&t(19,K=r.floatingoffset),"hidefooter"in r&&t(2,T=r.hidefooter),"hidelogo"in r&&t(3,oe=r.hidelogo),"name"in r&&t(4,J=r.name),"maxnumber"in r&&t(20,M=r.maxnumber),"mockerror"in r&&t(21,L=r.mockerror),"refetchonexpire"in r&&t(22,I=r.refetchonexpire),"spamfilter"in r&&t(23,_=r.spamfilter),"strings"in r&&t(29,A=r.strings),"test"in r&&t(24,d=r.test),"verifyurl"in r&&t(25,y=r.verifyurl),"workers"in r&&t(26,ce=r.workers),"workerurl"in r&&t(30,ve=r.workerurl)},n.$$.update=()=>{n.$$.dirty[0]&268435456&&(i=h?Oe(h):void 0),n.$$.dirty[0]&536870912&&t(34,o=A?Oe(A):{}),n.$$.dirty[1]&8&&t(11,l={ariaLinkLabel:Fe,error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by <a href="${He}" target="_blank" aria-label="${o.ariaLinkLabel||Fe}">ALTCHA</a>`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...o}),n.$$.dirty[0]&96&&Ee("statechange",{payload:ee,state:P}),n.$$.dirty[0]&64&&Zt()},[s,E,T,oe,J,ee,P,z,x,Q,pe,l,qt,Qe,c,B,S,H,U,K,M,L,I,_,d,y,ce,a,h,A,ve,nt,ge,te,o,Xt,Jt,zt]}class Be extends It{constructor(e){super(),Ct(this,e,Ht,Pt,ft,{auto:0,blockspam:27,challengeurl:14,challengejson:28,debug:15,delay:16,expire:17,floating:1,floatinganchor:18,floatingoffset:19,hidefooter:2,hidelogo:3,name:4,maxnumber:20,mockerror:21,refetchonexpire:22,spamfilter:23,strings:29,test:24,verifyurl:25,workers:26,workerurl:30,configure:31,reset:32,verify:33},null,[-1,-1,-1])}get auto(){return this.$$.ctx[0]}set auto(e){this.$$set({auto:e}),w()}get blockspam(){return this.$$.ctx[27]}set blockspam(e){this.$$set({blockspam:e}),w()}get challengeurl(){return this.$$.ctx[14]}set challengeurl(e){this.$$set({challengeurl:e}),w()}get challengejson(){return this.$$.ctx[28]}set challengejson(e){this.$$set({challengejson:e}),w()}get debug(){return this.$$.ctx[15]}set debug(e){this.$$set({debug:e}),w()}get delay(){return this.$$.ctx[16]}set delay(e){this.$$set({delay:e}),w()}get expire(){return this.$$.ctx[17]}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[18]}set floatinganchor(e){this.$$set({floatinganchor:e}),w()}get floatingoffset(){return this.$$.ctx[19]}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[20]}set maxnumber(e){this.$$set({maxnumber:e}),w()}get mockerror(){return this.$$.ctx[21]}set mockerror(e){this.$$set({mockerror:e}),w()}get refetchonexpire(){return this.$$.ctx[22]}set refetchonexpire(e){this.$$set({refetchonexpire:e}),w()}get spamfilter(){return this.$$.ctx[23]}set spamfilter(e){this.$$set({spamfilter:e}),w()}get strings(){return this.$$.ctx[29]}set strings(e){this.$$set({strings:e}),w()}get test(){return this.$$.ctx[24]}set test(e){this.$$set({test:e}),w()}get verifyurl(){return this.$$.ctx[25]}set verifyurl(e){this.$$set({verifyurl:e}),w()}get workers(){return this.$$.ctx[26]}set workers(e){this.$$set({workers:e}),w()}get workerurl(){return this.$$.ctx[30]}set workerurl(e){this.$$set({workerurl:e}),w()}get configure(){return this.$$.ctx[31]}get reset(){return this.$$.ctx[32]}get verify(){return this.$$.ctx[33]}}customElements.define("altcha-widget",Lt(Be,{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:N&&N.src||new URL("altcha.umd.cjs",document.baseURI).href)),O.Altcha=Be,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(O,N){typeof exports=="object"&&typeof module<"u"?N(exports):typeof define=="function"&&define.amd?define(["exports"],N):(O=typeof globalThis<"u"?globalThis:O||self,N(O.altcha={}))})(this,function(O){"use strict";var Qt=Object.defineProperty;var en=(O,N,Z)=>N in O?Qt(O,N,{enumerable:!0,configurable:!0,writable:!0,value:Z}):O[N]=Z;var q=(O,N,Z)=>en(O,typeof N!="symbol"?N+"":N,Z);var N=typeof document<"u"?document.currentScript:null;function Z(){}function Ce(n){return n()}function Le(){return Object.create(null)}function le(n){n.forEach(Ce)}function Ie(n){return typeof n=="function"}function ft(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function ct(n){return Object.keys(n).length===0}function v(n,e){n.appendChild(e)}function V(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 ut(n){return document.createTextNode(n)}function X(){return ut(" ")}function be(n,e,t,i){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}function f(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function at(n){return Array.from(n.childNodes)}function Ae(n,e,t){n.classList.toggle(e,!!t)}function ht(n,e,{bubbles:t=!1,cancelable:i=!1}={}){return new CustomEvent(n,{detail:e,bubbles:t,cancelable:i})}function dt(n){const e={};return n.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let se;function fe(n){se=n}function we(){if(!se)throw new Error("Function called outside component initialization");return se}function gt(n){we().$$.on_mount.push(n)}function mt(n){we().$$.on_destroy.push(n)}function bt(){const n=we();return(e,t,{cancelable:i=!1}={})=>{const l=n.$$.callbacks[e];if(l){const o=ht(e,t,{cancelable:i});return l.slice().forEach(s=>{s.call(n,o)}),!o.defaultPrevented}return!0}}const ne=[],ue=[];let re=[];const Re=[],$e=Promise.resolve();let _e=!1;function Te(){_e||(_e=!0,$e.then(w))}function wt(){return Te(),$e}function ye(n){re.push(n)}const ke=new Set;let ie=0;function w(){if(ie!==0)return;const n=se;do{try{for(;ie<ne.length;){const e=ne[ie];ie++,fe(e),_t(e.$$)}}catch(e){throw ne.length=0,ie=0,e}for(fe(null),ne.length=0,ie=0;ue.length;)ue.pop()();for(let e=0;e<re.length;e+=1){const t=re[e];ke.has(t)||(ke.add(t),t())}re.length=0}while(ne.length);for(;Re.length;)Re.pop()();_e=!1,ke.clear(),fe(n)}function _t(n){if(n.fragment!==null){n.update(),le(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(ye)}}function yt(n){const e=[],t=[];re.forEach(i=>n.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),re=e}const kt=new Set;function vt(n,e){n&&n.i&&(kt.delete(n),n.i(e))}function Et(n,e,t){const{fragment:i,after_update:l}=n.$$;i&&i.m(e,t),ye(()=>{const o=n.$$.on_mount.map(Ce).filter(Ie);n.$$.on_destroy?n.$$.on_destroy.push(...o):le(o),n.$$.on_mount=[]}),l.forEach(ye)}function pt(n,e){const t=n.$$;t.fragment!==null&&(yt(t.after_update),le(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function xt(n,e){n.$$.dirty[0]===-1&&(ne.push(n),Te(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function Ct(n,e,t,i,l,o,s=null,a=[-1]){const c=se;fe(n);const h=n.$$={fragment:null,ctx:[],props:o,update:Z,not_equal:l,bound:Le(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Le(),dirty:a,skip_bound:!1,root:e.target||c.$$.root};s&&s(h.root);let B=!1;if(h.ctx=t?t(n,e.props||{},(S,H,...E)=>{const U=E.length?E[0]:H;return h.ctx&&l(h.ctx[S],h.ctx[S]=U)&&(!h.skip_bound&&h.bound[S]&&h.bound[S](U),B&&xt(n,S)),H}):[],h.update(),B=!0,le(h.before_update),h.fragment=i?i(h.ctx):!1,e.target){if(e.hydrate){const S=at(e.target);h.fragment&&h.fragment.l(S),S.forEach(j)}else h.fragment&&h.fragment.c();e.intro&&vt(n.$$.fragment),Et(n,e.target,e.anchor),w()}fe(c)}let Se;typeof HTMLElement=="function"&&(Se=class extends HTMLElement{constructor(e,t,i){super();q(this,"$$ctor");q(this,"$$s");q(this,"$$c");q(this,"$$cn",!1);q(this,"$$d",{});q(this,"$$r",!1);q(this,"$$p_d",{});q(this,"$$l",{});q(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 l=this.$$c.$on(e,t);this.$$l_u.set(t,l)}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))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(o){return()=>{let s;return{c:function(){s=$("slot"),o!=="default"&&f(s,"name",o)},m:function(h,B){V(h,s,B)},d:function(h){h&&j(s)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},i=dt(this);for(const o of this.$$s)o in i&&(t[o]=[e(o)]);for(const o of this.attributes){const s=this.$$g_p(o.name);s in this.$$d||(this.$$d[s]=ae(s,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 s=ae(o,this.$$d[o],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[o].attribute||o):this.setAttribute(this.$$p_d[o].attribute||o,s)}this.$$r=!1};this.$$c.$$.after_update.push(l),l();for(const o in this.$$l)for(const s of this.$$l[o]){const a=this.$$c.$on(o,s);this.$$l_u.set(s,a)}this.$$l={}}}attributeChangedCallback(e,t,i){var l;this.$$r||(e=this.$$g_p(e),this.$$d[e]=ae(e,i,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 ae(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])return e;if(i==="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 Lt(n,e,t,i,l,o){let s=class extends Se{constructor(){super(n,t,l),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(s.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(c){var h;c=ae(a,c,e),this.$$d[a]=c,(h=this.$$c)==null||h.$set({[a]:c})}})}),i.forEach(a=>{Object.defineProperty(s.prototype,a,{get(){var c;return(c=this.$$c)==null?void 0:c[a]}})}),o&&(s=o(s)),n.element=s,s}class It{constructor(){q(this,"$$");q(this,"$$set")}$destroy(){pt(this,1),this.$destroy=Z}$on(e,t){if(!Ie(t))return Z;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const l=i.indexOf(t);l!==-1&&i.splice(l,1)}}$set(e){this.$$set&&!ct(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const At="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(At);const Rt=new TextEncoder;function $t(n){return[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function Tt(n,e="SHA-256",t=1e5){const i=Date.now().toString(16);n||(n=Math.round(Math.random()*t));const l=await Me(i,n,e);return{algorithm:e,challenge:l,salt:i,signature:""}}async function Me(n,e,t){return $t(await crypto.subtle.digest(t.toUpperCase(),Rt.encode(n+e)))}function St(n,e,t="SHA-256",i=1e6,l=0){const o=new AbortController,s=Date.now();return{promise:(async()=>{for(let c=l;c<=i;c+=1){if(o.signal.aborted)return null;if(await Me(e,c,t)===n)return{number:c,took:Date.now()-s}}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 je(n){let e,t,i;return{c(){e=W("svg"),t=W("path"),i=W("path"),f(t,"d","M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"),f(t,"fill","currentColor"),f(t,"opacity",".25"),f(i,"d","M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"),f(i,"fill","currentColor"),f(i,"class","altcha-spinner"),f(e,"width","24"),f(e,"height","24"),f(e,"viewBox","0 0 24 24"),f(e,"xmlns","http://www.w3.org/2000/svg")},m(l,o){V(l,e,o),v(e,t),v(e,i)},d(l){l&&j(e)}}}function Mt(n){let e,t=n[11].label+"",i;return{c(){e=$("label"),f(e,"for",i=n[4]+"_checkbox")},m(l,o){V(l,e,o),e.innerHTML=t},p(l,o){o[0]&2048&&t!==(t=l[11].label+"")&&(e.innerHTML=t),o[0]&16&&i!==(i=l[4]+"_checkbox")&&f(e,"for",i)},d(l){l&&j(e)}}}function jt(n){let e,t=n[11].verifying+"";return{c(){e=$("span")},m(i,l){V(i,e,l),e.innerHTML=t},p(i,l){l[0]&2048&&t!==(t=i[11].verifying+"")&&(e.innerHTML=t)},d(i){i&&j(e)}}}function Dt(n){let e,t=n[11].verified+"",i,l;return{c(){e=$("span"),i=X(),l=$("input"),f(l,"type","hidden"),f(l,"name",n[4]),l.value=n[5]},m(o,s){V(o,e,s),e.innerHTML=t,V(o,i,s),V(o,l,s)},p(o,s){s[0]&2048&&t!==(t=o[11].verified+"")&&(e.innerHTML=t),s[0]&16&&f(l,"name",o[4]),s[0]&32&&(l.value=o[5])},d(o){o&&(j(e),j(i),j(l))}}}function De(n){let e,t,i,l,o,s,a;return{c(){e=$("div"),t=$("a"),i=W("svg"),l=W("path"),o=W("path"),s=W("path"),f(l,"d","M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"),f(l,"fill","currentColor"),f(o,"d","M3.57212 2.33956C1.65755 3.94607 0.496389 6.11731 0.12782 8.40523L2.04639 9.13961C2.26047 7.15832 3.21057 5.25375 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577L13.8302 6.78606L19.9633 9.13364C19.7929 7.15555 19.0335 5.20847 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956Z"),f(o,"fill","currentColor"),f(s,"d","M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"),f(s,"fill","currentColor"),f(i,"width","22"),f(i,"height","22"),f(i,"viewBox","0 0 20 20"),f(i,"fill","none"),f(i,"xmlns","http://www.w3.org/2000/svg"),f(t,"href",He),f(t,"target","_blank"),f(t,"class","altcha-logo"),f(t,"aria-label",a=n[11].ariaLinkLabel)},m(c,h){V(c,e,h),v(e,t),v(t,i),v(i,l),v(i,o),v(i,s)},p(c,h){h[0]&2048&&a!==(a=c[11].ariaLinkLabel)&&f(t,"aria-label",a)},d(c){c&&j(e)}}}function Ne(n){let e,t,i,l;function o(c,h){return c[6]===m.EXPIRED?Vt:Nt}let s=o(n),a=s(n);return{c(){e=$("div"),t=W("svg"),i=W("path"),l=X(),a.c(),f(i,"stroke-linecap","round"),f(i,"stroke-linejoin","round"),f(i,"d","M6 18L18 6M6 6l12 12"),f(t,"width","14"),f(t,"height","14"),f(t,"xmlns","http://www.w3.org/2000/svg"),f(t,"fill","none"),f(t,"viewBox","0 0 24 24"),f(t,"stroke-width","1.5"),f(t,"stroke","currentColor"),f(e,"class","altcha-error")},m(c,h){V(c,e,h),v(e,t),v(t,i),v(e,l),a.m(e,null)},p(c,h){s===(s=o(c))&&a?a.p(c,h):(a.d(1),a=s(c),a&&(a.c(),a.m(e,null)))},d(c){c&&j(e),a.d()}}}function Nt(n){let e,t=n[11].error+"";return{c(){e=$("div"),f(e,"title",n[10])},m(i,l){V(i,e,l),e.innerHTML=t},p(i,l){l[0]&2048&&t!==(t=i[11].error+"")&&(e.innerHTML=t),l[0]&1024&&f(e,"title",i[10])},d(i){i&&j(e)}}}function Vt(n){let e,t=n[11].expired+"";return{c(){e=$("div"),f(e,"title",n[10])},m(i,l){V(i,e,l),e.innerHTML=t},p(i,l){l[0]&2048&&t!==(t=i[11].expired+"")&&(e.innerHTML=t),l[0]&1024&&f(e,"title",i[10])},d(i){i&&j(e)}}}function Ve(n){let e,t,i=n[11].footer+"";return{c(){e=$("div"),t=$("div"),f(e,"class","altcha-footer")},m(l,o){V(l,e,o),v(e,t),t.innerHTML=i},p(l,o){o[0]&2048&&i!==(i=l[11].footer+"")&&(t.innerHTML=i)},d(l){l&&j(e)}}}function Pe(n){let e;return{c(){e=$("div"),f(e,"class","altcha-anchor-arrow")},m(t,i){V(t,e,i),n[36](e)},p:Z,d(t){t&&j(e),n[36](null)}}}function Pt(n){let e,t,i,l,o,s,a,c,h,B,S,H,E,U,K,T=n[6]===m.VERIFYING&&je();function oe(d,y){return d[6]===m.VERIFIED?Dt:d[6]===m.VERIFYING?jt:Mt}let J=oe(n),M=J(n),L=n[3]!==!0&&De(n),I=(n[10]||n[6]===m.EXPIRED)&&Ne(n),_=n[11].footer&&n[2]!==!0&&Ve(n),A=n[1]&&Pe(n);return{c(){e=$("div"),t=$("div"),T&&T.c(),i=X(),l=$("div"),o=$("input"),c=X(),h=$("div"),M.c(),B=X(),L&&L.c(),S=X(),I&&I.c(),H=X(),_&&_.c(),E=X(),A&&A.c(),f(o,"type","checkbox"),f(o,"id",s=n[4]+"_checkbox"),o.required=a=n[0]!=="onsubmit",f(l,"class","altcha-checkbox"),Ae(l,"altcha-hidden",n[6]===m.VERIFYING),f(h,"class","altcha-label"),f(t,"class","altcha-main"),f(e,"class","altcha"),f(e,"data-state",n[6]),f(e,"data-floating",n[1])},m(d,y){V(d,e,y),v(e,t),T&&T.m(t,null),v(t,i),v(t,l),v(l,o),o.checked=n[7],v(t,c),v(t,h),M.m(h,null),v(t,B),L&&L.m(t,null),v(e,S),I&&I.m(e,null),v(e,H),_&&_.m(e,null),v(e,E),A&&A.m(e,null),n[37](e),U||(K=[be(o,"change",n[35]),be(o,"change",n[12]),be(o,"invalid",n[13])],U=!0)},p(d,y){d[6]===m.VERIFYING?T||(T=je(),T.c(),T.m(t,i)):T&&(T.d(1),T=null),y[0]&16&&s!==(s=d[4]+"_checkbox")&&f(o,"id",s),y[0]&1&&a!==(a=d[0]!=="onsubmit")&&(o.required=a),y[0]&128&&(o.checked=d[7]),y[0]&64&&Ae(l,"altcha-hidden",d[6]===m.VERIFYING),J===(J=oe(d))&&M?M.p(d,y):(M.d(1),M=J(d),M&&(M.c(),M.m(h,null))),d[3]!==!0?L?L.p(d,y):(L=De(d),L.c(),L.m(t,null)):L&&(L.d(1),L=null),d[10]||d[6]===m.EXPIRED?I?I.p(d,y):(I=Ne(d),I.c(),I.m(e,H)):I&&(I.d(1),I=null),d[11].footer&&d[2]!==!0?_?_.p(d,y):(_=Ve(d),_.c(),_.m(e,E)):_&&(_.d(1),_=null),d[1]?A?A.p(d,y):(A=Pe(d),A.c(),A.m(e,null)):A&&(A.d(1),A=null),y[0]&64&&f(e,"data-state",d[6]),y[0]&2&&f(e,"data-floating",d[1])},i:Z,o:Z,d(d){d&&j(e),T&&T.d(),M.d(),L&&L.d(),I&&I.d(),_&&_.d(),A&&A.d(),n[37](null),U=!1,le(K)}}}const Fe="Visit Altcha.org",He="https://altcha.org/";function Oe(n){return JSON.parse(n)}function Ft(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Ht(n,e,t){var rt,it;let i,l,o,{auto:s=void 0}=e,{blockspam:a=void 0}=e,{challengeurl:c=void 0}=e,{challengejson:h=void 0}=e,{debug:B=!1}=e,{delay:S=0}=e,{expire:H=void 0}=e,{floating:E=void 0}=e,{floatinganchor:U=void 0}=e,{floatingoffset:K=void 0}=e,{hidefooter:T=!1}=e,{hidelogo:oe=!1}=e,{name:J="altcha"}=e,{maxnumber:M=1e6}=e,{mockerror:L=!1}=e,{refetchonexpire:I=!0}=e,{spamfilter:_=!1}=e,{strings:A=void 0}=e,{test:d=!1}=e,{verifyurl:y=void 0}=e,{workers:ce=Math.min(16,navigator.hardwareConcurrency||8)}=e,{workerurl:ve=void 0}=e;const Ee=bt(),Ue=["SHA-256","SHA-384","SHA-512"],qe=(it=(rt=document.documentElement.lang)==null?void 0:rt.split("-"))==null?void 0:it[0];let z=!1,x,Q=null,he=null,b=null,pe=null,ee=null,P=m.UNVERIFIED,Y=null;mt(()=>{b&&(b.removeEventListener("submit",Ye),b.removeEventListener("reset",Ge),b.removeEventListener("focusin",Ze),b=null),Y&&(clearTimeout(Y),Y=null),document.removeEventListener("click",ze),document.removeEventListener("scroll",Ke),window.removeEventListener("resize",et)}),gt(()=>{C("mounted","0.6.1"),C("workers",ce),d&&C("using test mode"),H&&de(H),s!==void 0&&C("auto",s),E!==void 0&&tt(E),b=x.closest("form"),b&&(b.addEventListener("submit",Ye,{capture:!0}),b.addEventListener("reset",Ge),s==="onfocus"&&b.addEventListener("focusin",Ze)),s==="onload"&&te()});function C(...r){(B||r.some(u=>u instanceof Error))&&console[r[0]instanceof Error?"error":"log"]("ALTCHA",...r)}function Ze(r){P===m.UNVERIFIED&&te()}function Ye(r){b&&s==="onsubmit"&&(P===m.UNVERIFIED?(r.preventDefault(),r.stopPropagation(),te().then(()=>{b==null||b.requestSubmit()})):P!==m.VERIFIED&&(r.preventDefault(),r.stopPropagation(),P===m.VERIFYING&&Qe()))}function Ge(){ge()}function We(r,u){return btoa(JSON.stringify({algorithm:r.algorithm,challenge:r.challenge,number:u.number,salt:r.salt,signature:r.signature,test:d?!0:void 0,took:u.took}))}function Xe(r){if(!r.algorithm)throw new Error("Invalid challenge. Property algorithm is missing.");if(r.signature===void 0)throw new Error("Invalid challenge. Property signature is missing.");if(!Ue.includes(r.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${Ue.join(", ")}`);if(!r.challenge||r.challenge.length<40)throw new Error("Challenge is too short. Min. 40 chars.");if(!r.salt||r.salt.length<10)throw new Error("Salt is too short. Min. 10 chars.")}async function Ot(){var r;if(L)throw C("mocking error"),new Error("Mocked error.");if(i)return C("using provided json data"),i;if(d)return C("generating test challenge",{test:d}),Tt(typeof d!="boolean"?+d:void 0);{if(!c)throw new Error("Attribute challengeurl not set.");C("fetching challenge from",c);const u=await fetch(c,{headers:{"x-altcha-spam-filter":_?"1":"0"}});if(u.status!==200)throw new Error(`Server responded with ${u.status}.`);const g=u.headers.get("Expires"),R=u.headers.get("X-Altcha-Config"),D=await u.json(),F=new URLSearchParams((r=D.salt.split("?"))==null?void 0:r[1]),G=F.get("expires")||F.get("expire");if(G){const k=new Date(+G*1e3),p=isNaN(k.getTime())?0:k.getTime()-Date.now();p>0&&de(p)}if(R)try{const k=JSON.parse(R);k&&typeof k=="object"&&(k.verifyurl&&(k.verifyurl=new URL(k.verifyurl,new URL(c)).toString()),nt(k))}catch(k){C("unable to configure from X-Altcha-Config",k)}if(!H&&(g!=null&&g.length)){const k=Date.parse(g);if(k){const p=k-Date.now();p>0&&de(p)}}return D}}function Je(){c&&I&&P===m.VERIFIED?te():ge(m.EXPIRED,o.expired)}async function Bt(r){let u=null;if("Worker"in window){try{u=await Ut(r.challenge,r.salt,r.algorithm,r.maxnumber)}catch(g){C(g)}if((u==null?void 0:u.number)!==void 0)return{data:r,solution:u}}return{data:r,solution:await St(r.challenge,r.salt,r.algorithm,r.maxnumber||M).promise}}async function Ut(r,u,g,R=typeof d=="number"?d:M,D=Math.ceil(ce)){const F=[];if(D<1)throw new Error("Wrong number of workers configured.");if(D>16)throw new Error("Too many workers. Max. 16 allowed workers.");for(let p=0;p<D;p++)F.push(createAltchaWorker(ve));const G=Math.ceil(R/D),k=await Promise.all(F.map((p,me)=>{const ot=me*G;return new Promise(Kt=>{p.addEventListener("message",lt=>{if(lt.data)for(const st of F)st!==p&&st.postMessage({type:"abort"});Kt(lt.data)}),p.postMessage({payload:{alg:g,challenge:r,max:ot+G,salt:u,start:ot},type:"work"})})}));for(const p of F)p.terminate();return k.find(p=>!!p)||null}function qt(){[m.UNVERIFIED,m.ERROR,m.EXPIRED].includes(P)?_&&(b==null?void 0:b.reportValidity())===!1?t(7,z=!1):te():t(7,z=!0)}function ze(r){const u=r.target;E&&u&&!x.contains(u)&&P===m.VERIFIED&&t(8,x.style.display="none",x)}function Ke(){E&&xe()}function Qe(){P===m.VERIFYING&&o.waitAlert&&alert(o.waitAlert)}function Zt(r){E&&P!==m.UNVERIFIED&&requestAnimationFrame(()=>{xe()})}function et(){E&&xe()}function de(r){C("expire",r),Y&&(clearTimeout(Y),Y=null),r<1?Je():Y=setTimeout(Je,r)}function tt(r){C("floating",r),E!==r&&(t(8,x.style.left="",x),t(8,x.style.top="",x)),t(1,E=r===!0||r===""?"auto":r===!1||r==="false"?void 0:E),E?(s||t(0,s="onsubmit"),document.addEventListener("scroll",Ke),document.addEventListener("click",ze),window.addEventListener("resize",et)):s==="onsubmit"&&t(0,s=void 0)}function Yt(r){var g;const u=b==null?void 0:b.querySelector(typeof r=="string"?`input[name="${r}"]`:'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 Gt(r){return[...(b==null?void 0:b.querySelectorAll(r!=null&&r.length?r.map(g=>`input[name="${g}"]`).join(", "):'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])'))||[]].reduce((g,R)=>{const D=R.name,F=R.value.trim();return D&&F&&(g[D]=F),g},{})}async function Wt(r){if(!y)throw new Error("Attribute verifyurl not set.");C("requesting server verification from",y);const u={payload:r};if(_){const{email:D,expectedLanguages:F,expectedCountries:G,fields:k,ipAddress:p,timeZone:me}=typeof _=="object"?_:{email:void 0,expectedCountries:void 0,expectedLanguages:void 0,fields:void 0,ipAddress:void 0,timeZone:void 0};u.ipAddress=p===!1?void 0:p||"auto",u.email=D===!1?void 0:Yt(D),u.fields=k===!1?void 0:Gt(k),u.timeZone=me===!1?void 0:me||Ft(),u.expectedCountries=G,u.expectedLanguages=F||(qe?[qe]:void 0)}const g=await fetch(y,{body:JSON.stringify(u),headers:{"content-type":"application/json"},method:"POST"});if(g.status!==200)throw new Error(`Server responded with ${g.status}.`);const R=await g.json();if(R!=null&&R.payload&&t(5,ee=R.payload),Ee("serververification",R),a&&R.classification==="BAD")throw new Error("SpamFilter returned negative classification.")}function xe(r=20){if(x)if(he||(he=(U?document.querySelector(U):b==null?void 0:b.querySelector('input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])'))||b),he){const u=parseInt(K,10)||12,g=he.getBoundingClientRect(),R=x.getBoundingClientRect(),D=document.documentElement.clientHeight,F=document.documentElement.clientWidth,G=E==="auto"?g.bottom+R.height+u+r>D:E==="top",k=Math.max(r,Math.min(F-r-R.width,g.left+g.width/2-R.width/2));if(G?t(8,x.style.top=`${g.top-(R.height+u)}px`,x):t(8,x.style.top=`${g.bottom+u}px`,x),t(8,x.style.left=`${k}px`,x),x.setAttribute("data-floating",G?"top":"bottom"),Q){const p=Q.getBoundingClientRect();t(9,Q.style.left=g.left-k+g.width/2-p.width/2+"px",Q)}}else C("unable to find floating anchor element")}function nt(r){r.auto!==void 0&&(t(0,s=r.auto),s==="onload"&&te()),r.floatinganchor!==void 0&&t(18,U=r.floatinganchor),r.delay!==void 0&&t(16,S=r.delay),r.floatingoffset!==void 0&&t(19,K=r.floatingoffset),r.floating!==void 0&&tt(r.floating),r.expire!==void 0&&(de(r.expire),t(17,H=r.expire)),r.challenge&&(Xe(r.challenge),i=r.challenge),r.challengeurl!==void 0&&t(14,c=r.challengeurl),r.debug!==void 0&&t(15,B=!!r.debug),r.hidefooter!==void 0&&t(2,T=!!r.hidefooter),r.hidelogo!==void 0&&t(3,oe=!!r.hidelogo),r.maxnumber!==void 0&&t(20,M=+r.maxnumber),r.mockerror!==void 0&&t(21,L=!!r.mockerror),r.name!==void 0&&t(4,J=r.name),r.refetchonexpire!==void 0&&t(22,I=!!r.refetchonexpire),r.spamfilter!==void 0&&t(23,_=typeof r.spamfilter=="object"?r.spamfilter:!!r.spamfilter),r.strings&&t(34,l=r.strings),r.test!==void 0&&t(24,d=typeof r.test=="number"?r.test:!!r.test),r.verifyurl!==void 0&&t(25,y=r.verifyurl),r.workers!==void 0&&t(26,ce=+r.workers)}function ge(r=m.UNVERIFIED,u=null){Y&&(clearTimeout(Y),Y=null),t(7,z=!1),t(10,pe=u),t(5,ee=null),t(6,P=r)}async function te(){return ge(m.VERIFYING),await new Promise(r=>setTimeout(r,S||0)),Ot().then(r=>(Xe(r),C("challenge",r),Bt(r))).then(({data:r,solution:u})=>{if(C("solution",u),(u==null?void 0:u.number)!==void 0){if(y)return Wt(We(r,u));t(5,ee=We(r,u)),C("payload",ee)}else throw C("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."),new Error("Unexpected result returned.")}).then(()=>{wt().then(()=>{t(6,P=m.VERIFIED),t(7,z=!0),C("verified"),Ee("verified",{payload:ee})})}).catch(r=>{C(r),t(6,P=m.ERROR),t(7,z=!1),t(10,pe=r.message)})}function Xt(){z=this.checked,t(7,z)}function Jt(r){ue[r?"unshift":"push"](()=>{Q=r,t(9,Q)})}function zt(r){ue[r?"unshift":"push"](()=>{x=r,t(8,x)})}return n.$$set=r=>{"auto"in r&&t(0,s=r.auto),"blockspam"in r&&t(27,a=r.blockspam),"challengeurl"in r&&t(14,c=r.challengeurl),"challengejson"in r&&t(28,h=r.challengejson),"debug"in r&&t(15,B=r.debug),"delay"in r&&t(16,S=r.delay),"expire"in r&&t(17,H=r.expire),"floating"in r&&t(1,E=r.floating),"floatinganchor"in r&&t(18,U=r.floatinganchor),"floatingoffset"in r&&t(19,K=r.floatingoffset),"hidefooter"in r&&t(2,T=r.hidefooter),"hidelogo"in r&&t(3,oe=r.hidelogo),"name"in r&&t(4,J=r.name),"maxnumber"in r&&t(20,M=r.maxnumber),"mockerror"in r&&t(21,L=r.mockerror),"refetchonexpire"in r&&t(22,I=r.refetchonexpire),"spamfilter"in r&&t(23,_=r.spamfilter),"strings"in r&&t(29,A=r.strings),"test"in r&&t(24,d=r.test),"verifyurl"in r&&t(25,y=r.verifyurl),"workers"in r&&t(26,ce=r.workers),"workerurl"in r&&t(30,ve=r.workerurl)},n.$$.update=()=>{n.$$.dirty[0]&268435456&&(i=h?Oe(h):void 0),n.$$.dirty[0]&536870912&&t(34,l=A?Oe(A):{}),n.$$.dirty[1]&8&&t(11,o={ariaLinkLabel:Fe,error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by <a href="${He}" target="_blank" aria-label="${l.ariaLinkLabel||Fe}">ALTCHA</a>`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...l}),n.$$.dirty[0]&96&&Ee("statechange",{payload:ee,state:P}),n.$$.dirty[0]&64&&Zt()},[s,E,T,oe,J,ee,P,z,x,Q,pe,o,qt,Qe,c,B,S,H,U,K,M,L,I,_,d,y,ce,a,h,A,ve,nt,ge,te,l,Xt,Jt,zt]}class Be extends It{constructor(e){super(),Ct(this,e,Ht,Pt,ft,{auto:0,blockspam:27,challengeurl:14,challengejson:28,debug:15,delay:16,expire:17,floating:1,floatinganchor:18,floatingoffset:19,hidefooter:2,hidelogo:3,name:4,maxnumber:20,mockerror:21,refetchonexpire:22,spamfilter:23,strings:29,test:24,verifyurl:25,workers:26,workerurl:30,configure:31,reset:32,verify:33},null,[-1,-1,-1])}get auto(){return this.$$.ctx[0]}set auto(e){this.$$set({auto:e}),w()}get blockspam(){return this.$$.ctx[27]}set blockspam(e){this.$$set({blockspam:e}),w()}get challengeurl(){return this.$$.ctx[14]}set challengeurl(e){this.$$set({challengeurl:e}),w()}get challengejson(){return this.$$.ctx[28]}set challengejson(e){this.$$set({challengejson:e}),w()}get debug(){return this.$$.ctx[15]}set debug(e){this.$$set({debug:e}),w()}get delay(){return this.$$.ctx[16]}set delay(e){this.$$set({delay:e}),w()}get expire(){return this.$$.ctx[17]}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[18]}set floatinganchor(e){this.$$set({floatinganchor:e}),w()}get floatingoffset(){return this.$$.ctx[19]}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[20]}set maxnumber(e){this.$$set({maxnumber:e}),w()}get mockerror(){return this.$$.ctx[21]}set mockerror(e){this.$$set({mockerror:e}),w()}get refetchonexpire(){return this.$$.ctx[22]}set refetchonexpire(e){this.$$set({refetchonexpire:e}),w()}get spamfilter(){return this.$$.ctx[23]}set spamfilter(e){this.$$set({spamfilter:e}),w()}get strings(){return this.$$.ctx[29]}set strings(e){this.$$set({strings:e}),w()}get test(){return this.$$.ctx[24]}set test(e){this.$$set({test:e}),w()}get verifyurl(){return this.$$.ctx[25]}set verifyurl(e){this.$$set({verifyurl:e}),w()}get workers(){return this.$$.ctx[26]}set workers(e){this.$$set({workers:e}),w()}get workerurl(){return this.$$.ctx[30]}set workerurl(e){this.$$set({workerurl:e}),w()}get configure(){return this.$$.ctx[31]}get reset(){return this.$$.ctx[32]}get verify(){return this.$$.ctx[33]}}customElements.define("altcha-widget",Lt(Be,{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:N&&N.src||new URL("altcha.umd.cjs",document.baseURI).href)),O.Altcha=Be,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
|