altcha 1.4.4 → 1.5.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.
@@ -1,10 +1,3 @@
1
- (function(C,A){typeof exports=="object"&&typeof module<"u"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):(C=typeof globalThis<"u"?globalThis:C||self,A(C.altcha={}))})(this,function(C){"use strict";var ao=Object.defineProperty;var Jn=C=>{throw TypeError(C)};var so=(C,A,V)=>A in C?ao(C,A,{enumerable:!0,configurable:!0,writable:!0,value:V}):C[A]=V;var ue=(C,A,V)=>so(C,typeof A!="symbol"?A+"":A,V),Kn=(C,A,V)=>A.has(C)||Jn("Cannot "+V);var J=(C,A,V)=>(Kn(C,A,"read from private field"),V?V.call(C):A.get(C)),ar=(C,A,V)=>A.has(C)?Jn("Cannot add the same private member more than once"):A instanceof WeakSet?A.add(C):A.set(C,V),sr=(C,A,V,wt)=>(Kn(C,A,"write to private field"),wt?wt.call(C,V):A.set(C,V),V);var hn,Ee,ne;var A=typeof document<"u"?document.currentScript:null;const V="5";typeof window<"u"&&((hn=window.__svelte??(window.__svelte={})).v??(hn.v=new Set)).add(V);const wt=1,Xn=4,Qn=8,ei=16,ti=1,ri=2,Ft="[",fr="[!",ur="]",qe={},W=Symbol(),ni="http://www.w3.org/1999/xhtml",cr=!1,oe=2,dr=4,bt=8,Mt=16,_e=32,Pe=64,yt=128,te=256,Et=512,K=1024,me=2048,Be=4096,He=8192,xt=16384,ii=32768,Ut=65536,li=1<<19,vr=1<<20,it=Symbol("$state"),hr=Symbol("legacy props"),oi=Symbol("");var gr=Array.isArray,ai=Array.prototype.indexOf,si=Array.from,$t=Object.keys,kt=Object.defineProperty,ze=Object.getOwnPropertyDescriptor,fi=Object.getOwnPropertyDescriptors,ui=Object.prototype,ci=Array.prototype,_r=Object.getPrototypeOf;function mr(e){for(var t=0;t<e.length;t++)e[t]()}const di=typeof requestIdleCallback>"u"?e=>setTimeout(e,1):requestIdleCallback;let lt=[],ot=[];function pr(){var e=lt;lt=[],mr(e)}function wr(){var e=ot;ot=[],mr(e)}function Vt(e){lt.length===0&&queueMicrotask(pr),lt.push(e)}function vi(e){ot.length===0&&di(wr),ot.push(e)}function br(){lt.length>0&&pr(),ot.length>0&&wr()}function yr(e){return e===this.v}function hi(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Er(e){return!hi(e,this.v)}function gi(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function _i(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function mi(e){throw new Error("https://svelte.dev/e/effect_orphan")}function pi(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function wi(){throw new Error("https://svelte.dev/e/hydration_failed")}function bi(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function yi(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Ei(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function xi(){throw new Error("https://svelte.dev/e/state_unsafe_local_read")}function $i(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let ki=!1;function ce(e,t){var r={f:0,v:e,reactions:null,equals:yr,rv:0,wv:0};return r}function Ye(e){return Ci(ce(e))}function xr(e,t=!1){const r=ce(e);return t||(r.equals=Er),r}function Ci(e){return R!==null&&!se&&(R.f&oe)!==0&&(de===null?Ni([e]):de.push(e)),e}function z(e,t){return R!==null&&!se&&Gr()&&(R.f&(oe|Mt))!==0&&(de===null||!de.includes(e))&&$i(),Ai(e,t)}function Ai(e,t){return e.equals(t)||(e.v,e.v=t,e.wv=Pr(),$r(e,me),T!==null&&(T.f&K)!==0&&(T.f&(_e|Pe))===0&&(be===null?Li([e]):be.push(e))),t}function $r(e,t){var r=e.reactions;if(r!==null)for(var l=r.length,i=0;i<l;i++){var o=r[i],a=o.f;(a&me)===0&&(ve(o,t),(a&(K|te))!==0&&((a&oe)!==0?$r(o,Be):Lt(o)))}}function Oe(e){var t=oe|me,r=R!==null&&(R.f&oe)!==0?R:null;return T===null||r!==null&&(r.f&te)!==0?t|=te:T.f|=vr,{ctx:H,deps:null,effects:null,equals:yr,f:t,fn:e,reactions:null,rv:0,v:null,wv:0,parent:r??T}}function kr(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r<t.length;r+=1)ye(t[r])}}function Ri(e){for(var t=e.parent;t!==null;){if((t.f&oe)===0)return t;t=t.parent}return null}function Ii(e){var t,r=T;Re(Ri(e));try{kr(e),t=Or(e)}finally{Re(r)}return t}function Cr(e){var t=Ii(e),r=(Ie||(e.f&te)!==0)&&e.deps!==null?Be:K;ve(e,r),e.equals(t)||(e.v=t,e.wv=Pr())}function Ct(e){console.warn("https://svelte.dev/e/hydration_mismatch")}let P=!1;function We(e){P=e}let O;function ke(e){if(e===null)throw Ct(),qe;return O=e}function Ze(){return ke(Ce(O))}function X(e){if(P){if(Ce(O)!==null)throw Ct(),qe;O=e}}function Si(){for(var e=0,t=O;;){if(t.nodeType===8){var r=t.data;if(r===ur){if(e===0)return t;e-=1}else(r===Ft||r===fr)&&(e+=1)}var l=Ce(t);t.remove(),t=l}}function ae(e,t=null,r){if(typeof e!="object"||e===null||it in e)return e;const l=_r(e);if(l!==ui&&l!==ci)return e;var i=new Map,o=gr(e),a=ce(0);o&&i.set("length",ce(e.length));var f;return new Proxy(e,{defineProperty(s,c,v){(!("value"in v)||v.configurable===!1||v.enumerable===!1||v.writable===!1)&&yi();var h=i.get(c);return h===void 0?(h=ce(v.value),i.set(c,h)):z(h,ae(v.value,f)),!0},deleteProperty(s,c){var v=i.get(c);if(v===void 0)c in s&&i.set(c,ce(W));else{if(o&&typeof c=="string"){var h=i.get("length"),g=Number(c);Number.isInteger(g)&&g<h.v&&z(h,g)}z(v,W),Ar(a)}return!0},get(s,c,v){var b;if(c===it)return e;var h=i.get(c),g=c in s;if(h===void 0&&(!g||(b=ze(s,c))!=null&&b.writable)&&(h=ce(ae(g?s[c]:W,f)),i.set(c,h)),h!==void 0){var m=d(h);return m===W?void 0:m}return Reflect.get(s,c,v)},getOwnPropertyDescriptor(s,c){var v=Reflect.getOwnPropertyDescriptor(s,c);if(v&&"value"in v){var h=i.get(c);h&&(v.value=d(h))}else if(v===void 0){var g=i.get(c),m=g==null?void 0:g.v;if(g!==void 0&&m!==W)return{enumerable:!0,configurable:!0,value:m,writable:!0}}return v},has(s,c){var m;if(c===it)return!0;var v=i.get(c),h=v!==void 0&&v.v!==W||Reflect.has(s,c);if(v!==void 0||T!==null&&(!h||(m=ze(s,c))!=null&&m.writable)){v===void 0&&(v=ce(h?ae(s[c],f):W),i.set(c,v));var g=d(v);if(g===W)return!1}return h},set(s,c,v,h){var j;var g=i.get(c),m=c in s;if(o&&c==="length")for(var b=v;b<g.v;b+=1){var D=i.get(b+"");D!==void 0?z(D,W):b in s&&(D=ce(W),i.set(b+"",D))}g===void 0?(!m||(j=ze(s,c))!=null&&j.writable)&&(g=ce(void 0),z(g,ae(v,f)),i.set(c,g)):(m=g.v!==W,z(g,ae(v,f)));var F=Reflect.getOwnPropertyDescriptor(s,c);if(F!=null&&F.set&&F.set.call(h,v),!m){if(o&&typeof c=="string"){var Z=i.get("length"),U=Number(c);Number.isInteger(U)&&U>=Z.v&&z(Z,U+1)}Ar(a)}return!0},ownKeys(s){d(a);var c=Reflect.ownKeys(s).filter(g=>{var m=i.get(g);return m===void 0||m.v!==W});for(var[v,h]of i)h.v!==W&&!(v in s)&&c.push(v);return c},setPrototypeOf(){Ei()}})}function Ar(e,t=1){z(e,e.v+t)}var Rr,Ir,Sr,Tr;function jt(){if(Rr===void 0){Rr=window,Ir=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype;Sr=ze(t,"firstChild").get,Tr=ze(t,"nextSibling").get,e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0,Text.prototype.__t=void 0}}function qt(e=""){return document.createTextNode(e)}function pe(e){return Sr.call(e)}function Ce(e){return Tr.call(e)}function Q(e,t){if(!P)return pe(e);var r=pe(O);return r===null&&(r=O.appendChild(qt())),ke(r),r}function Nr(e,t){if(!P){var r=pe(e);return r instanceof Comment&&r.data===""?Ce(r):r}return O}function we(e,t=1,r=!1){let l=P?O:e;for(var i;t--;)i=l,l=Ce(l);if(!P)return l;var o=l==null?void 0:l.nodeType;if(r&&o!==3){var a=qt();return l===null?i==null||i.after(a):l.before(a),ke(a),a}return ke(l),l}function Ti(e){e.textContent=""}let At=!1,Rt=!1,It=null,Fe=!1,Bt=!1;function Lr(e){Bt=e}let at=[],fo=[],R=null,se=!1;function Ae(e){R=e}let T=null;function Re(e){T=e}let de=null;function Ni(e){de=e}let B=null,ee=0,be=null;function Li(e){be=e}let Dr=1,St=0,Ie=!1;function Pr(){return++Dr}function st(e){var h;var t=e.f;if((t&me)!==0)return!0;if((t&Be)!==0){var r=e.deps,l=(t&te)!==0;if(r!==null){var i,o,a=(t&Et)!==0,f=l&&T!==null&&!Ie,s=r.length;if(a||f){var c=e,v=c.parent;for(i=0;i<s;i++)o=r[i],(a||!((h=o==null?void 0:o.reactions)!=null&&h.includes(c)))&&(o.reactions??(o.reactions=[])).push(c);a&&(c.f^=Et),f&&v!==null&&(v.f&te)===0&&(c.f^=te)}for(i=0;i<s;i++)if(o=r[i],st(o)&&Cr(o),o.wv>e.wv)return!0}(!l||T!==null&&!Ie)&&ve(e,K)}return!1}function Di(e,t){for(var r=t;r!==null;){if((r.f&yt)!==0)try{r.fn(e);return}catch{r.f^=yt}r=r.parent}throw At=!1,e}function Pi(e){return(e.f&xt)===0&&(e.parent===null||(e.parent.f&yt)===0)}function Tt(e,t,r,l){if(At){if(r===null&&(At=!1),Pi(t))throw e;return}r!==null&&(At=!0);{Di(e,t);return}}function zr(e,t,r=!0){var l=e.reactions;if(l!==null)for(var i=0;i<l.length;i++){var o=l[i];(o.f&oe)!==0?zr(o,t,!1):t===o&&(r?ve(o,me):(o.f&K)!==0&&ve(o,Be),Lt(o))}}function Or(e){var m;var t=B,r=ee,l=be,i=R,o=Ie,a=de,f=H,s=se,c=e.f;B=null,ee=0,be=null,Ie=(c&te)!==0&&(se||!Fe||R===null),R=(c&(_e|Pe))===0?e:null,de=null,Yr(e.ctx),se=!1,St++;try{var v=(0,e.fn)(),h=e.deps;if(B!==null){var g;if(Nt(e,ee),h!==null&&ee>0)for(h.length=ee+B.length,g=0;g<B.length;g++)h[ee+g]=B[g];else e.deps=h=B;if(!Ie)for(g=ee;g<h.length;g++)((m=h[g]).reactions??(m.reactions=[])).push(e)}else h!==null&&ee<h.length&&(Nt(e,ee),h.length=ee);if(Gr()&&be!==null&&!se&&h!==null&&(e.f&(oe|Be|me))===0)for(g=0;g<be.length;g++)zr(be[g],e);return i!==null&&St++,v}finally{B=t,ee=r,be=l,R=i,Ie=o,de=a,Yr(f),se=s}}function zi(e,t){let r=t.reactions;if(r!==null){var l=ai.call(r,e);if(l!==-1){var i=r.length-1;i===0?r=t.reactions=null:(r[l]=r[i],r.pop())}}r===null&&(t.f&oe)!==0&&(B===null||!B.includes(t))&&(ve(t,Be),(t.f&(te|Et))===0&&(t.f^=Et),kr(t),Nt(t,0))}function Nt(e,t){var r=e.deps;if(r!==null)for(var l=t;l<r.length;l++)zi(e,r[l])}function Ht(e){var t=e.f;if((t&xt)===0){ve(e,K);var r=T,l=H,i=Fe;T=e,Fe=!0;try{(t&Mt)!==0?Wi(e):Ur(e),Mr(e);var o=Or(e);e.teardown=typeof o=="function"?o:null,e.wv=Dr;var a=e.deps,f;cr&&ki&&e.f&me}catch(s){Tt(s,e,r,l||e.ctx)}finally{Fe=i,T=r}}}function Oi(){try{pi()}catch(e){if(It!==null)Tt(e,It,null);else throw e}}function Fr(){var e=Fe;try{var t=0;for(Fe=!0;at.length>0;){t++>1e3&&Oi();var r=at,l=r.length;at=[];for(var i=0;i<l;i++){var o=Mi(r[i]);Fi(o)}}}finally{Rt=!1,Fe=e,It=null}}function Fi(e){var t=e.length;if(t!==0)for(var r=0;r<t;r++){var l=e[r];if((l.f&(xt|He))===0)try{st(l)&&(Ht(l),l.deps===null&&l.first===null&&l.nodes_start===null&&(l.teardown===null?Vr(l):l.fn=null))}catch(i){Tt(i,l,null,l.ctx)}}}function Lt(e){Rt||(Rt=!0,queueMicrotask(Fr));for(var t=It=e;t.parent!==null;){t=t.parent;var r=t.f;if((r&(Pe|_e))!==0){if((r&K)===0)return;t.f^=K}}at.push(t)}function Mi(e){for(var t=[],r=e;r!==null;){var l=r.f,i=(l&(_e|Pe))!==0,o=i&&(l&K)!==0;if(!o&&(l&He)===0){if((l&dr)!==0)t.push(r);else if(i)r.f^=K;else{var a=R;try{R=r,st(r)&&Ht(r)}catch(c){Tt(c,r,null,r.ctx)}finally{R=a}}var f=r.first;if(f!==null){r=f;continue}}var s=r.parent;for(r=r.next;r===null&&s!==null;)r=s.next,s=s.parent}return t}function x(e){var t;for(br();at.length>0;)Rt=!0,Fr(),br();return t}async function Ui(){await Promise.resolve(),x()}function d(e){var t=e.f,r=(t&oe)!==0;if(R!==null&&!se){de!==null&&de.includes(e)&&xi();var l=R.deps;e.rv<St&&(e.rv=St,B===null&&l!==null&&l[ee]===e?ee++:B===null?B=[e]:(!Ie||!B.includes(e))&&B.push(e))}else if(r&&e.deps===null&&e.effects===null){var i=e,o=i.parent;o!==null&&(o.f&te)===0&&(i.f^=te)}return r&&(i=e,st(i)&&Cr(i)),e.v}function Ge(e){var t=se;try{return se=!0,e()}finally{se=t}}const Vi=-7169;function ve(e,t){e.f=e.f&Vi|t}function ji(e){T===null&&R===null&&mi(),R!==null&&(R.f&te)!==0&&T===null&&_i(),Bt&&gi()}function qi(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function Me(e,t,r,l=!0){var i=T,o={ctx:H,deps:null,nodes_start:null,nodes_end:null,f:e|me,first:null,fn:t,last:null,next:null,parent:i,prev:null,teardown:null,transitions:null,wv:0};if(r)try{Ht(o),o.f|=ii}catch(s){throw ye(o),s}else t!==null&&Lt(o);var a=r&&o.deps===null&&o.first===null&&o.nodes_start===null&&o.teardown===null&&(o.f&(vr|yt))===0;if(!a&&l&&(i!==null&&qi(o,i),R!==null&&(R.f&oe)!==0)){var f=R;(f.effects??(f.effects=[])).push(o)}return o}function Bi(e){const t=Me(bt,null,!1);return ve(t,K),t.teardown=e,t}function Yt(e){ji();var t=T!==null&&(T.f&_e)!==0&&H!==null&&!H.m;if(t){var r=H;(r.e??(r.e=[])).push({fn:e,effect:T,reaction:R})}else{var l=Wt(e);return l}}function Hi(e){const t=Me(Pe,e,!0);return()=>{ye(t)}}function Yi(e){const t=Me(Pe,e,!0);return(r={})=>new Promise(l=>{r.outro?Jt(t,()=>{ye(t),l(void 0)}):(ye(t),l(void 0))})}function Wt(e){return Me(dr,e,!1)}function Zt(e){return Me(bt,e,!0)}function Je(e,t=[],r=Oe){const l=t.map(r);return Gt(()=>e(...l.map(d)))}function Gt(e,t=0){return Me(bt|Mt|t,e,!0)}function Dt(e,t=!0){return Me(bt|_e,e,!0,t)}function Mr(e){var t=e.teardown;if(t!==null){const r=Bt,l=R;Lr(!0),Ae(null);try{t.call(null)}finally{Lr(r),Ae(l)}}}function Ur(e,t=!1){var r=e.first;for(e.first=e.last=null;r!==null;){var l=r.next;(r.f&Pe)!==0?r.parent=null:ye(r,t),r=l}}function Wi(e){for(var t=e.first;t!==null;){var r=t.next;(t.f&_e)===0&&ye(t),t=r}}function ye(e,t=!0){var r=!1;if((t||(e.f&li)!==0)&&e.nodes_start!==null){for(var l=e.nodes_start,i=e.nodes_end;l!==null;){var o=l===i?null:Ce(l);l.remove(),l=o}r=!0}Ur(e,t&&!r),Nt(e,0),ve(e,xt);var a=e.transitions;if(a!==null)for(const s of a)s.stop();Mr(e);var f=e.parent;f!==null&&f.first!==null&&Vr(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=null}function Vr(e){var t=e.parent,r=e.prev,l=e.next;r!==null&&(r.next=l),l!==null&&(l.prev=r),t!==null&&(t.first===e&&(t.first=l),t.last===e&&(t.last=r))}function Jt(e,t){var r=[];jr(e,r,!0),Zi(r,()=>{ye(e),t&&t()})}function Zi(e,t){var r=e.length;if(r>0){var l=()=>--r||t();for(var i of e)i.out(l)}else t()}function jr(e,t,r){if((e.f&He)===0){if(e.f^=He,e.transitions!==null)for(const a of e.transitions)(a.is_global||r)&&t.push(a);for(var l=e.first;l!==null;){var i=l.next,o=(l.f&Ut)!==0||(l.f&_e)!==0;jr(l,t,o?r:!1),l=i}}}function qr(e){Br(e,!0)}function Br(e,t){if((e.f&He)!==0){e.f^=He,(e.f&K)===0&&(e.f^=K),st(e)&&(ve(e,me),Lt(e));for(var r=e.first;r!==null;){var l=r.next,i=(r.f&Ut)!==0||(r.f&_e)!==0;Br(r,i?t:!1),r=l}if(e.transitions!==null)for(const o of e.transitions)(o.is_global||t)&&o.in()}}function Hr(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let H=null;function Yr(e){H=e}function Wr(e,t=!1,r){H={p:H,c:null,e:null,m:!1,s:e,x:null,l:null}}function Zr(e){const t=H;if(t!==null){e!==void 0&&(t.x=e);const a=t.e;if(a!==null){var r=T,l=R;t.e=null;try{for(var i=0;i<a.length;i++){var o=a[i];Re(o.effect),Ae(o.reaction),Wt(o.fn)}}finally{Re(r),Ae(l)}}H=t.p,t.m=!0}return e||{}}function Gr(){return!0}const Gi=["touchstart","touchmove"];function Ji(e){return Gi.includes(e)}let Jr=!1;function Kr(){Jr||(Jr=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const r of e.target.elements)(t=r.__on_r)==null||t.call(r)})},{capture:!0}))}function Xr(e){var t=R,r=T;Ae(null),Re(null);try{return e()}finally{Ae(t),Re(r)}}function Ki(e,t,r,l=r){e.addEventListener(t,()=>Xr(r));const i=e.__on_r;i?e.__on_r=()=>{i(),l(!0)}:e.__on_r=()=>l(!0),Kr()}const Qr=new Set,Kt=new Set;function Xi(e,t,r,l={}){function i(o){if(l.capture||ft.call(t,o),!o.cancelBubble)return Xr(()=>r==null?void 0:r.call(this,o))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Vt(()=>{t.addEventListener(e,i,l)}):t.addEventListener(e,i,l),i}function Qi(e,t,r,l,i){var o={capture:l,passive:i},a=Xi(e,t,r,o);(t===document.body||t===window||t===document)&&Bi(()=>{t.removeEventListener(e,a,o)})}function el(e){for(var t=0;t<e.length;t++)Qr.add(e[t]);for(var r of Kt)r(e)}function ft(e){var U;var t=this,r=t.ownerDocument,l=e.type,i=((U=e.composedPath)==null?void 0:U.call(e))||[],o=i[0]||e.target,a=0,f=e.__root;if(f){var s=i.indexOf(f);if(s!==-1&&(t===document||t===window)){e.__root=t;return}var c=i.indexOf(t);if(c===-1)return;s<=c&&(a=s)}if(o=i[a]||e.target,o!==t){kt(e,"currentTarget",{configurable:!0,get(){return o||r}});var v=R,h=T;Ae(null),Re(null);try{for(var g,m=[];o!==null;){var b=o.assignedSlot||o.parentNode||o.host||null;try{var D=o["__"+l];if(D!=null&&(!o.disabled||e.target===o))if(gr(D)){var[F,...Z]=D;F.apply(o,[e,...Z])}else D.call(o,e)}catch(j){g?m.push(j):g=j}if(e.cancelBubble||b===t||b===null)break;o=b}if(g){for(let j of m)queueMicrotask(()=>{throw j});throw g}}finally{e.__root=t,delete e.currentTarget,Ae(v),Re(h)}}}function Xt(e){var t=document.createElement("template");return t.innerHTML=e,t.content}function Se(e,t){var r=T;r.nodes_start===null&&(r.nodes_start=e,r.nodes_end=t)}function he(e,t){var r=(t&ti)!==0,l=(t&ri)!==0,i,o=!e.startsWith("<!>");return()=>{if(P)return Se(O,null),O;i===void 0&&(i=Xt(o?e:"<!>"+e),r||(i=pe(i)));var a=l||Ir?document.importNode(i,!0):i.cloneNode(!0);if(r){var f=pe(a),s=a.lastChild;Se(f,s)}else Se(a,a);return a}}function tl(e,t,r="svg"){var l=!e.startsWith("<!>"),i=`<${r}>${l?e:"<!>"+e}</${r}>`,o;return()=>{if(P)return Se(O,null),O;if(!o){var a=Xt(i),f=pe(a);o=pe(f)}var s=o.cloneNode(!0);return Se(s,s),s}}function re(e,t){if(P){T.nodes_end=O,Ze();return}e!==null&&e.before(t)}function en(e,t){return tn(e,t)}function rl(e,t){jt(),t.intro=t.intro??!1;const r=t.target,l=P,i=O;try{for(var o=pe(r);o&&(o.nodeType!==8||o.data!==Ft);)o=Ce(o);if(!o)throw qe;We(!0),ke(o),Ze();const a=tn(e,{...t,anchor:o});if(O===null||O.nodeType!==8||O.data!==ur)throw Ct(),qe;return We(!1),a}catch(a){if(a===qe)return t.recover===!1&&wi(),jt(),Ti(r),We(!1),en(e,t);throw a}finally{We(l),ke(i)}}const Ke=new Map;function tn(e,{target:t,anchor:r,props:l={},events:i,context:o,intro:a=!0}){jt();var f=new Set,s=h=>{for(var g=0;g<h.length;g++){var m=h[g];if(!f.has(m)){f.add(m);var b=Ji(m);t.addEventListener(m,ft,{passive:b});var D=Ke.get(m);D===void 0?(document.addEventListener(m,ft,{passive:b}),Ke.set(m,1)):Ke.set(m,D+1)}}};s(si(Qr)),Kt.add(s);var c=void 0,v=Yi(()=>{var h=r??t.appendChild(qt());return Dt(()=>{if(o){Wr({});var g=H;g.c=o}i&&(l.$$events=i),P&&Se(h,null),c=e(h,l)||{},P&&(T.nodes_end=O),o&&Zr()}),()=>{var b;for(var g of f){t.removeEventListener(g,ft);var m=Ke.get(g);--m===0?(document.removeEventListener(g,ft),Ke.delete(g)):Ke.set(g,m)}Kt.delete(s),h!==r&&((b=h.parentNode)==null||b.removeChild(h))}});return Qt.set(c,v),c}let Qt=new WeakMap;function nl(e,t){const r=Qt.get(e);return r?(Qt.delete(e),r(t)):Promise.resolve()}function Te(e,t,[r,l]=[0,0]){P&&r===0&&Ze();var i=e,o=null,a=null,f=W,s=r>0?Ut:0,c=!1;const v=(g,m=!0)=>{c=!0,h(m,g)},h=(g,m)=>{if(f===(f=g))return;let b=!1;if(P&&l!==-1){if(r===0){const F=i.data;F===Ft?l=0:F===fr?l=1/0:(l=parseInt(F.substring(1)),l!==l&&(l=f?1/0:-1))}const D=l>r;!!f===D&&(i=Si(),ke(i),We(!1),b=!0,l=-1)}f?(o?qr(o):m&&(o=Dt(()=>m(i))),a&&Jt(a,()=>{a=null})):(a?qr(a):m&&(a=Dt(()=>m(i,[r+1,l]))),o&&Jt(o,()=>{o=null})),b&&We(!0)};Gt(()=>{c=!1,t(v),c||h(null,null)},s),P&&(i=O)}function Xe(e,t,r,l,i){var o=e,a="",f;Gt(()=>{if(a===(a=t()??"")){P&&Ze();return}f!==void 0&&(ye(f),f=void 0),a!==""&&(f=Dt(()=>{if(P){O.data;for(var s=Ze(),c=s;s!==null&&(s.nodeType!==8||s.data!=="");)c=s,s=Ce(s);if(s===null)throw Ct(),qe;Se(O,c),o=ke(s);return}var v=a+"",h=Xt(v);Se(pe(h),h.lastChild),o.before(h)}))})}function il(e,t,r,l,i){var f;P&&Ze();var o=(f=t.$$slots)==null?void 0:f[r],a=!1;o===!0&&(o=t.children,a=!0),o===void 0||o(e,a?()=>l:l)}function ll(e,t){Vt(()=>{var r=e.getRootNode(),l=r.host?r:r.head??r.ownerDocument.head;if(!l.querySelector("#"+t.hash)){const i=document.createElement("style");i.id=t.hash,i.textContent=t.code,l.appendChild(i)}})}const rn=[...`
2
- \r\f \v\uFEFF`];function ol(e,t,r){var l=""+e;if(r){for(var i in r)if(r[i])l=l?l+" "+i:i;else if(l.length)for(var o=i.length,a=0;(a=l.indexOf(i,a))>=0;){var f=a+o;(a===0||rn.includes(l[a-1]))&&(f===l.length||rn.includes(l[f]))?l=(a===0?"":l.substring(0,a))+l.substring(f+1):a=f}}return l===""?null:l}function al(e,t,r,l,i,o){var a=e.__className;if(P||a!==r){var f=ol(r,l,o);(!P||f!==e.getAttribute("class"))&&(f==null?e.removeAttribute("class"):e.className=f),e.__className=r}else if(o&&i!==o)for(var s in o){var c=!!o[s];(i==null||c!==!!i[s])&&e.classList.toggle(s,c)}return o}const sl=Symbol("is custom element"),fl=Symbol("is html");function nn(e){if(P){var t=!1,r=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var l=e.value;fe(e,"value",null),e.value=l}if(e.hasAttribute("checked")){var i=e.checked;fe(e,"checked",null),e.checked=i}}};e.__on_r=r,vi(r),Kr()}}function ul(e,t){var r=ln(e);r.value===(r.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!=="PROGRESS")||(e.value=t??"")}function fe(e,t,r,l){var i=ln(e);P&&(i[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||i[t]!==(i[t]=r)&&(t==="loading"&&(e[oi]=r),r==null?e.removeAttribute(t):typeof r!="string"&&cl(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function ln(e){return e.__attributes??(e.__attributes={[sl]:e.nodeName.includes("-"),[fl]:e.namespaceURI===ni})}var on=new Map;function cl(e){var t=on.get(e.nodeName);if(t)return t;on.set(e.nodeName,t=[]);for(var r,l=e,i=Element.prototype;i!==l;){r=fi(l);for(var o in r)r[o].set&&t.push(o);l=_r(l)}return t}function dl(e,t,r=t){Ki(e,"change",l=>{var i=l?e.defaultChecked:e.checked;r(i)}),(P&&e.defaultChecked!==e.checked||Ge(t)==null)&&r(e.checked),Zt(()=>{var l=t();e.checked=!!l})}function an(e,t){return e===t||(e==null?void 0:e[it])===t}function sn(e={},t,r,l){return Wt(()=>{var i,o;return Zt(()=>{i=o,o=[],Ge(()=>{e!==r(...o)&&(t(e,...o),i&&an(r(...i),e)&&t(null,...i))})}),()=>{Vt(()=>{o&&an(r(...o),e)&&t(null,...o)})}}),e}function fn(e){H===null&&Hr(),Yt(()=>{const t=Ge(e);if(typeof t=="function")return t})}function vl(e){H===null&&Hr(),fn(()=>()=>Ge(e))}let Pt=!1;function hl(e){var t=Pt;try{return Pt=!1,[e(),Pt]}finally{Pt=t}}function I(e,t,r,l){var Ue;var i=(r&wt)!==0,o=!0,a=(r&Qn)!==0,f=(r&ei)!==0,s=!1,c;a?[c,s]=hl(()=>e[t]):c=e[t];var v=it in e||hr in e,h=a&&(((Ue=ze(e,t))==null?void 0:Ue.set)??(v&&t in e&&(M=>e[t]=M)))||void 0,g=l,m=!0,b=!1,D=()=>(b=!0,m&&(m=!1,f?g=Ge(l):g=l),g);c===void 0&&l!==void 0&&(h&&o&&bi(),c=D(),h&&h(c));var F;if(F=()=>{var M=e[t];return M===void 0?D():(m=!0,b=!1,M)},(r&Xn)===0)return F;if(h){var Z=e.$$legacy;return function(M,q){return arguments.length>0?((!q||Z||s)&&h(q?F():M),M):F()}}var U=!1,j=xr(c),G=Oe(()=>{var M=F(),q=d(j);return U?(U=!1,q):j.v=M});return i||(G.equals=Er),function(M,q){if(arguments.length>0){const xe=q?d(G):a?ae(M):M;return G.equals(xe)||(U=!0,z(j,xe),b&&g!==void 0&&(g=xe),Ge(()=>d(G))),M}return d(G)}}function gl(e){return new _l(e)}class _l{constructor(t){ar(this,Ee);ar(this,ne);var o;var r=new Map,l=(a,f)=>{var s=xr(f);return r.set(a,s),s};const i=new Proxy({...t.props||{},$$events:{}},{get(a,f){return d(r.get(f)??l(f,Reflect.get(a,f)))},has(a,f){return f===hr?!0:(d(r.get(f)??l(f,Reflect.get(a,f))),Reflect.has(a,f))},set(a,f,s){return z(r.get(f)??l(f,s),s),Reflect.set(a,f,s)}});sr(this,ne,(t.hydrate?rl:en)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:t.intro??!1,recover:t.recover})),(!((o=t==null?void 0:t.props)!=null&&o.$$host)||t.sync===!1)&&x(),sr(this,Ee,i.$$events);for(const a of Object.keys(J(this,ne)))a==="$set"||a==="$destroy"||a==="$on"||kt(this,a,{get(){return J(this,ne)[a]},set(f){J(this,ne)[a]=f},enumerable:!0});J(this,ne).$set=a=>{Object.assign(i,a)},J(this,ne).$destroy=()=>{nl(J(this,ne))}}$set(t){J(this,ne).$set(t)}$on(t,r){J(this,Ee)[t]=J(this,Ee)[t]||[];const l=(...i)=>r.call(this,...i);return J(this,Ee)[t].push(l),()=>{J(this,Ee)[t]=J(this,Ee)[t].filter(i=>i!==l)}}$destroy(){J(this,ne).$destroy()}}Ee=new WeakMap,ne=new WeakMap;let un;typeof HTMLElement=="function"&&(un=class extends HTMLElement{constructor(t,r,l){super();ue(this,"$$ctor");ue(this,"$$s");ue(this,"$$c");ue(this,"$$cn",!1);ue(this,"$$d",{});ue(this,"$$r",!1);ue(this,"$$p_d",{});ue(this,"$$l",{});ue(this,"$$l_u",new Map);ue(this,"$$me");this.$$ctor=t,this.$$s=r,l&&this.attachShadow({mode:"open"})}addEventListener(t,r,l){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(r),this.$$c){const i=this.$$c.$on(t,r);this.$$l_u.set(r,i)}super.addEventListener(t,r,l)}removeEventListener(t,r,l){if(super.removeEventListener(t,r,l),this.$$c){const i=this.$$l_u.get(r);i&&(i(),this.$$l_u.delete(r))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(i){return o=>{const a=document.createElement("slot");i!=="default"&&(a.name=i),re(o,a)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const r={},l=ml(this);for(const i of this.$$s)i in l&&(i==="default"&&!this.$$d.children?(this.$$d.children=t(i),r.default=!0):r[i]=t(i));for(const i of this.attributes){const o=this.$$g_p(i.name);o in this.$$d||(this.$$d[o]=zt(o,i.value,this.$$p_d,"toProp"))}for(const i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=gl({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:r,$$host:this}}),this.$$me=Hi(()=>{Zt(()=>{var i;this.$$r=!0;for(const o of $t(this.$$c)){if(!((i=this.$$p_d[o])!=null&&i.reflect))continue;this.$$d[o]=this.$$c[o];const a=zt(o,this.$$d[o],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[o].attribute||o):this.setAttribute(this.$$p_d[o].attribute||o,a)}this.$$r=!1})});for(const i in this.$$l)for(const o of this.$$l[i]){const a=this.$$c.$on(i,o);this.$$l_u.set(o,a)}this.$$l={}}}attributeChangedCallback(t,r,l){var i;this.$$r||(t=this.$$g_p(t),this.$$d[t]=zt(t,l,this.$$p_d,"toProp"),(i=this.$$c)==null||i.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return $t(this.$$p_d).find(r=>this.$$p_d[r].attribute===t||!this.$$p_d[r].attribute&&r.toLowerCase()===t)||t}});function zt(e,t,r,l){var o;const i=(o=r[e])==null?void 0:o.type;if(t=i==="Boolean"&&typeof t!="boolean"?t!=null:t,!l||!r[e])return t;if(l==="toAttribute")switch(i){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(i){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function ml(e){const t={};return e.childNodes.forEach(r=>{t[r.slot||"default"]=!0}),t}function pl(e,t,r,l,i,o){let a=class extends un{constructor(){super(e,r,i),this.$$p_d=t}static get observedAttributes(){return $t(t).map(f=>(t[f].attribute||f).toLowerCase())}};return $t(t).forEach(f=>{kt(a.prototype,f,{get(){return this.$$c&&f in this.$$c?this.$$c[f]:this.$$d[f]},set(s){var h;s=zt(f,s,t),this.$$d[f]=s;var c=this.$$c;if(c){var v=(h=ze(c,f))==null?void 0:h.get;v?c[f]=s:c.$set({[f]:s})}}})}),l.forEach(f=>{kt(a.prototype,f,{get(){var s;return(s=this.$$c)==null?void 0:s[f]}})}),e.element=a,a}const cn=new TextEncoder;function wl(e){return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")}async function bl(e,t="SHA-256",r=1e5){const l=Date.now().toString(16);e||(e=Math.round(Math.random()*r));const i=await dn(l,e,t);return{algorithm:t,challenge:i,salt:l,signature:""}}async function dn(e,t,r){if(typeof crypto>"u"||!("subtle"in crypto)||!("digest"in crypto.subtle))throw new Error("Web Crypto is not available. Secure context is required (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).");return wl(await crypto.subtle.digest(r.toUpperCase(),cn.encode(e+t)))}function yl(e,t,r="SHA-256",l=1e6,i=0){const o=new AbortController,a=Date.now();return{promise:(async()=>{for(let s=i;s<=l;s+=1){if(o.signal.aborted)return null;if(await dn(t,s,r)===e)return{number:s,took:Date.now()-a}}return null})(),controller:o}}function El(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function xl(e){const t=atob(e),r=new Uint8Array(t.length);for(let l=0;l<t.length;l++)r[l]=t.charCodeAt(l);return r}function $l(e,t=12){const r=new Uint8Array(t);for(let l=0;l<t;l++)r[l]=e%256,e=Math.floor(e/256);return r}async function kl(e,t="",r=1e6,l=0){const i="AES-GCM",o=new AbortController,a=Date.now(),f=async()=>{for(let v=l;v<=r;v+=1){if(o.signal.aborted||!s||!c)return null;try{const h=await crypto.subtle.decrypt({name:i,iv:$l(v)},s,c);if(h)return{clearText:new TextDecoder().decode(h),took:Date.now()-a}}catch{}}return null};let s=null,c=null;try{c=xl(e);const v=await crypto.subtle.digest("SHA-256",cn.encode(t));s=await crypto.subtle.importKey("raw",v,i,!1,["decrypt"])}catch{return{promise:Promise.reject(),controller:o}}return{promise:f(),controller:o}}var w=(e=>(e.ERROR="error",e.VERIFIED="verified",e.VERIFYING="verifying",e.UNVERIFIED="unverified",e.EXPIRED="expired",e))(w||{}),Cl=tl('<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="svelte-ddsc3z"><path 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" fill="currentColor" opacity=".25" class="svelte-ddsc3z"></path><path 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" fill="currentColor" class="altcha-spinner svelte-ddsc3z"></path></svg>'),Al=he('<span role="status" aria-live="polite" class="svelte-ddsc3z"><!></span> <input type="hidden" class="svelte-ddsc3z">',1),Rl=he('<span role="status" aria-live="polite" class="svelte-ddsc3z"><!></span>'),Il=he('<label class="svelte-ddsc3z"><!></label>'),Sl=he('<div class="svelte-ddsc3z"><a target="_blank" class="altcha-logo svelte-ddsc3z"><svg width="22" height="22" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class="svelte-ddsc3z"><path 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" fill="currentColor" class="svelte-ddsc3z"></path><path 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" fill="currentColor" class="svelte-ddsc3z"></path><path 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" fill="currentColor" class="svelte-ddsc3z"></path></svg></a></div>'),Tl=he('<div class="svelte-ddsc3z"><!></div>'),Nl=he('<div class="svelte-ddsc3z"><!></div>'),Ll=he('<div class="altcha-error svelte-ddsc3z"><svg width="14" height="14" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="svelte-ddsc3z"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" class="svelte-ddsc3z"></path></svg> <!></div>'),Dl=he('<div class="altcha-footer svelte-ddsc3z"><div class="svelte-ddsc3z"><!></div></div>'),Pl=he('<div class="altcha-anchor-arrow svelte-ddsc3z"></div>'),zl=he('<!> <div class="altcha svelte-ddsc3z"><div class="altcha-main svelte-ddsc3z"><!> <div><input type="checkbox" class="svelte-ddsc3z"></div> <div class="altcha-label svelte-ddsc3z"><!></div> <!></div> <!> <!> <!></div>',1);const Ol={hash:"svelte-ddsc3z",code:`.altcha.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:focus-within {border-color:var(--altcha-color-border-focus, currentColor);}.altcha[data-floating].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:where(.svelte-ddsc3z) {border-bottom-color:transparent;border-top-color:var(--altcha-color-border, #a0a0a0);bottom:-12px;top:auto;}.altcha[data-floating=bottom].svelte-ddsc3z:focus-within::after {border-bottom-color:var(--altcha-color-border-focus, currentColor);}.altcha[data-floating=top].svelte-ddsc3z:focus-within::after {border-top-color:var(--altcha-color-border-focus, currentColor);}.altcha[data-floating].svelte-ddsc3z:not([data-state=unverified]) {display:block;}.altcha-anchor-arrow.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 {align-items:center;display:flex;gap:0.4rem;padding:0.7rem;}.altcha-label.svelte-ddsc3z {flex-grow:1;}.altcha-label.svelte-ddsc3z label:where(.svelte-ddsc3z) {cursor:pointer;}.altcha-logo.svelte-ddsc3z {color:currentColor;opacity:0.3;}.altcha-logo.svelte-ddsc3z:hover {opacity:1;}.altcha-error.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 {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:hover {opacity:1;}.altcha-footer.svelte-ddsc3z > :where(.svelte-ddsc3z):first-child {flex-grow:1;}.altcha-footer.svelte-ddsc3z a {color:currentColor;}.altcha-checkbox.svelte-ddsc3z {display:flex;align-items:center;height:24px;width:24px;}.altcha-checkbox.svelte-ddsc3z input:where(.svelte-ddsc3z) {width:18px;height:18px;margin:0;}.altcha-hidden.svelte-ddsc3z {display:none;}.altcha-spinner.svelte-ddsc3z {
3
- animation: svelte-ddsc3z-altcha-spinner 0.75s infinite linear;transform-origin:center;}
4
-
5
- @keyframes svelte-ddsc3z-altcha-spinner {
6
- 100% {
7
- transform: rotate(360deg);
8
- }
9
- }`};function vn(e,t){var Wn,Zn;Wr(t,!0),ll(e,Ol);let r=I(t,"auto",7,void 0),l=I(t,"blockspam",7,void 0),i=I(t,"challengeurl",7,void 0),o=I(t,"challengejson",7,void 0),a=I(t,"customfetch",7,void 0),f=I(t,"debug",7,!1),s=I(t,"delay",7,0),c=I(t,"expire",7,void 0),v=I(t,"floating",7,void 0),h=I(t,"floatinganchor",7,void 0),g=I(t,"floatingoffset",7,void 0),m=I(t,"floatingpersist",7,!1),b=I(t,"hidefooter",7,!1),D=I(t,"hidelogo",7,!1),F=I(t,"id",7,void 0),Z=I(t,"name",7,"altcha"),U=I(t,"maxnumber",7,1e6),j=I(t,"mockerror",7,!1),G=I(t,"obfuscated",7,void 0),Ue=I(t,"plugins",7,void 0),M=I(t,"refetchonexpire",7,!0),q=I(t,"spamfilter",7,!1),xe=I(t,"strings",7,void 0),ie=I(t,"test",7,!1),Ne=I(t,"verifyurl",7,void 0),Qe=I(t,"workers",23,()=>Math.min(16,navigator.hardwareConcurrency||8)),ut=I(t,"workerurl",7,void 0);const gn=["SHA-256","SHA-384","SHA-512"],_n="Visit Altcha.org",mn="https://altcha.org/",ct=(n,u)=>{t.$$host.dispatchEvent(new CustomEvent(n,{detail:u}))},pn=(Zn=(Wn=document.documentElement.lang)==null?void 0:Wn.split("-"))==null?void 0:Zn[0],er=Oe(()=>{var n;return i()&&new URL(i(),location.origin).host.endsWith(".altcha.org")&&!!((n=i())!=null&&n.includes("apiKey=ckey_"))}),tr=Oe(()=>o()?Tn(o()):void 0),wn=Oe(()=>xe()?Tn(xe()):{}),le=Oe(()=>{var n;return{ariaLinkLabel:_n,error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by <a href="${mn}" target="_blank" aria-label="${((n=d(wn))==null?void 0:n.ariaLinkLabel)||_n}">ALTCHA</a>`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...d(wn)}}),bn=Oe(()=>`${F()||Z()}_checkbox`);let et=Ye(!1),S=Ye(ae(w.UNVERIFIED)),Y=Ye(void 0),dt=Ye(null),tt=null,p=null,rt=Ye(null),ge=null,Le=[],Ve=Ye(null);Yt(()=>{Hl(d(rt))}),Yt(()=>{Yl(d(S))}),vl(()=>{Fl(),p&&(p.removeEventListener("submit",An),p.removeEventListener("reset",Rn),p.removeEventListener("focusin",Cn),p=null),ge&&(clearTimeout(ge),ge=null),document.removeEventListener("click",$n),document.removeEventListener("scroll",kn),window.removeEventListener("resize",Sn)}),fn(()=>{var n;N("mounted","1.4.4"),N("workers",Qe()),ql(),N("plugins",Le.length?Le.map(u=>u.constructor.pluginName).join(", "):"none"),ie()&&N("using test mode"),c()&&rr(c()),r()!==void 0&&N("auto",r()),v()!==void 0&&Nn(v()),p=(n=d(Y))==null?void 0:n.closest("form"),p&&(p.addEventListener("submit",An,{capture:!0}),p.addEventListener("reset",Rn),(r()==="onfocus"||m()==="focus")&&p.addEventListener("focusin",Cn)),r()==="onload"&&(G()?vt():De()),d(er)&&(b()||D())&&N("Attributes hidefooter and hidelogo ignored because usage with free API Keys requires attribution."),requestAnimationFrame(()=>{ct("load")})});function yn(n,u){return btoa(JSON.stringify({algorithm:n.algorithm,challenge:n.challenge,number:u.number,salt:n.salt,signature:n.signature,test:ie()?!0:void 0,took:u.took}))}function Fl(){for(const n of Le)n.destroy()}function En(){i()&&M()&&d(S)===w.VERIFIED?De():gt(w.EXPIRED,d(le).expired)}async function Ml(){var n;if(j())throw N("mocking error"),new Error("Mocked error.");if(d(tr))return N("using provided json data"),d(tr);if(ie())return N("generating test challenge",{test:ie()}),bl(typeof ie()!="boolean"?+ie():void 0);{if(!i()&&p){const k=p.getAttribute("action");k!=null&&k.includes("/form/")&&i(k+"/altcha")}if(!i())throw new Error("Attribute challengeurl not set.");N("fetching challenge from",i());const u={headers:q()!==!1?{"x-altcha-spam-filter":"1"}:{}},_=await xn()(i(),u);if(!_||!(_ instanceof Response))throw new Error("Fetch function did not return a response.");if(_.status!==200)throw new Error(`Server responded with ${_.status}.`);const E=_.headers.get("X-Altcha-Config"),L=await _.json(),$=new URLSearchParams((n=L.salt.split("?"))==null?void 0:n[1]),y=$.get("expires")||$.get("expire");if(y){const k=new Date(+y*1e3),$e=isNaN(k.getTime())?0:k.getTime()-Date.now();$e>0&&rr($e)}if(E)try{const k=JSON.parse(E);k&&typeof k=="object"&&("sentinel"in k?alert("This version of the widget is not compatible with Sentinel. Upgrade to version 2.x.x."):(k.verifyurl&&(k.verifyurl=new URL(k.verifyurl,new URL(i())).toString()),Pn(k)))}catch(k){N("unable to configure from X-Altcha-Config",k)}return L}}function Ul(n){var _;const u=p==null?void 0:p.querySelector(typeof n=="string"?`input[name="${n}"]`:'input[type="email"]:not([data-no-spamfilter])');return((_=u==null?void 0:u.value)==null?void 0:_.slice(u.value.indexOf("@")))||void 0}function xn(){let n=fetch;if(a())if(N("using customfetch"),typeof a()=="string"){if(n=globalThis[a()]||null,!n)throw new Error(`Custom fetch function not found: ${a()}`)}else n=a();return n}function Vl(){return q()==="ipAddress"?{blockedCountries:void 0,classifier:void 0,disableRules:void 0,email:!1,expectedCountries:void 0,expectedLanguages:void 0,fields:!1,ipAddress:void 0,text:void 0,timeZone:void 0}:typeof q()=="object"?q():{blockedCountries:void 0,classifier:void 0,disableRules:void 0,email:void 0,expectedCountries:void 0,expectedLanguages:void 0,fields:void 0,ipAddress:void 0,text:void 0,timeZone:void 0}}function jl(n){return[...(p==null?void 0:p.querySelectorAll(n!=null&&n.length?n.map(_=>`input[name="${_}"]`).join(", "):'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])'))||[]].reduce((_,E)=>{const L=E.name,$=E.value;return L&&$&&(_[L]=/\n/.test($)?$.replace(new RegExp("(?<!\\r)\\n","g"),`\r
10
- `):$),_},{})}function ql(){const n=Ue()!==void 0?Ue().split(","):void 0;for(const u of globalThis.altchaPlugins)(!n||n.includes(u.pluginName))&&Le.push(new u({el:d(Y),clarify:vt,dispatch:ct,getConfiguration:zn,getFloatingAnchor:On,getState:Fn,log:N,reset:gt,solve:Dn,setState:je,setFloatingAnchor:Un,verify:De}))}function N(...n){(f()||n.some(u=>u instanceof Error))&&console[n[0]instanceof Error?"error":"log"]("ALTCHA",`[name=${Z()}]`,...n)}function Bl(){[w.UNVERIFIED,w.ERROR,w.EXPIRED].includes(d(S))?q()!==!1&&(p==null?void 0:p.reportValidity())===!1?z(et,!1):G()?vt():De():z(et,!0)}function $n(n){const u=n.target;v()&&u&&!d(Y).contains(u)&&(d(S)===w.VERIFIED&&m()===!1||d(S)===w.VERIFIED&&m()==="focus"&&!(p!=null&&p.matches(":focus-within"))||r()==="off"&&d(S)===w.UNVERIFIED)&&Mn()}function kn(){v()&&d(S)!==w.UNVERIFIED&&ht()}function Hl(n){for(const u of Le)typeof u.onErrorChange=="function"&&u.onErrorChange(d(rt))}function Cn(n){d(S)===w.UNVERIFIED?De():v()&&m()==="focus"&&d(S)===w.VERIFIED&&nr()}function An(n){p&&r()==="onsubmit"?d(S)===w.UNVERIFIED?(n.preventDefault(),n.stopPropagation(),De().then(()=>{p==null||p.requestSubmit()})):d(S)!==w.VERIFIED&&(n.preventDefault(),n.stopPropagation(),d(S)===w.VERIFYING&&In()):p&&v()&&r()==="off"&&d(S)===w.UNVERIFIED&&(n.preventDefault(),n.stopPropagation(),nr())}function Rn(){gt()}function In(){d(S)===w.VERIFYING&&d(le).waitAlert&&alert(d(le).waitAlert)}function Yl(n){for(const u of Le)typeof u.onStateChange=="function"&&u.onStateChange(d(S));v()&&d(S)!==w.UNVERIFIED&&requestAnimationFrame(()=>{ht()}),z(et,d(S)===w.VERIFIED)}function Sn(){v()&&ht()}function Tn(n){return JSON.parse(n)}async function Wl(n){if(!Ne())throw new Error("Attribute verifyurl not set.");N("requesting server verification from",Ne());const u={payload:n};if(q()!==!1){const{blockedCountries:L,classifier:$,disableRules:y,email:k,expectedLanguages:$e,expectedCountries:or,fields:mt,ipAddress:pt,text:oo,timeZone:Gn}=Vl();u.blockedCountries=L,u.classifier=$,u.disableRules=y,u.email=k===!1?void 0:Ul(k),u.expectedCountries=or,u.expectedLanguages=$e||(pn?[pn]:void 0),u.fields=mt===!1?void 0:jl(mt),u.ipAddress=pt===!1?void 0:pt||"auto",u.text=oo,u.timeZone=Gn===!1?void 0:Gn||El()}const _=await xn()(Ne(),{body:JSON.stringify(u),headers:{"content-type":"application/json"},method:"POST"});if(!_||!(_ instanceof Response))throw new Error("Fetch function did not return a response.");if(_.status!==200)throw new Error(`Server responded with ${_.status}.`);const E=await _.json();if(E!=null&&E.payload&&z(Ve,ae(E.payload)),ct("serververification",E),l()&&E.classification==="BAD")throw new Error("SpamFilter returned negative classification.")}function rr(n){N("expire",n),ge&&(clearTimeout(ge),ge=null),n<1?En():ge=setTimeout(En,n)}function Nn(n){N("floating",n),v()!==n&&(d(Y).style.left="",d(Y).style.top=""),v(n===!0||n===""?"auto":n===!1||n==="false"?void 0:v()),v()?(r()||r("onsubmit"),document.addEventListener("scroll",kn),document.addEventListener("click",$n),window.addEventListener("resize",Sn)):r()==="onsubmit"&&r(void 0)}function Ln(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(!gn.includes(n.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${gn.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 Dn(n){let u=null;if("Worker"in window){try{u=await Zl(n,n.maxNumber||n.maxnumber||U())}catch(_){N(_)}if((u==null?void 0:u.number)!==void 0||"obfuscated"in n)return{data:n,solution:u}}if("obfuscated"in n){const _=await kl(n.obfuscated,n.key,n.maxNumber||n.maxnumber);return{data:n,solution:await _.promise}}return{data:n,solution:await yl(n.challenge,n.salt,n.algorithm,n.maxNumber||n.maxnumber||U()).promise}}async function Zl(n,u=typeof ie()=="number"?ie():n.maxNumber||n.maxnumber||U(),_=Math.ceil(Qe())){const E=[];_=Math.min(16,u,Math.max(1,_));for(let y=0;y<_;y++)E.push(altchaCreateWorker(ut()));const L=Math.ceil(u/_),$=await Promise.all(E.map((y,k)=>{const $e=k*L;return new Promise(or=>{y.addEventListener("message",mt=>{if(mt.data)for(const pt of E)pt!==y&&pt.postMessage({type:"abort"});or(mt.data)}),y.postMessage({payload:n,max:$e+L,start:$e,type:"work"})})}));for(const y of E)y.terminate();return $.find(y=>!!y)||null}async function vt(){if(!G()){je(w.ERROR);return}const n=Le.find(u=>u.constructor.pluginName==="obfuscation");if(!n||!("clarify"in n)){je(w.ERROR),N("Plugin `obfuscation` not found. Import `altcha/plugins/obfuscation` to load it.");return}if("clarify"in n&&typeof n.clarify=="function")return n.clarify()}function Pn(n){n.obfuscated!==void 0&&G(n.obfuscated),n.auto!==void 0&&(r(n.auto),r()==="onload"&&(G()?vt():De())),n.blockspam!==void 0&&l(!!n.blockspam),n.customfetch!==void 0&&a(n.customfetch),n.floatinganchor!==void 0&&h(n.floatinganchor),n.delay!==void 0&&s(n.delay),n.floatingoffset!==void 0&&g(n.floatingoffset),n.floating!==void 0&&Nn(n.floating),n.expire!==void 0&&(rr(n.expire),c(n.expire)),n.challenge&&(o(typeof n.challenge=="string"?n.challenge:JSON.stringify(n.challenge)),Ln(d(tr))),n.challengeurl!==void 0&&i(n.challengeurl),n.debug!==void 0&&f(!!n.debug),n.hidefooter!==void 0&&b(!!n.hidefooter),n.hidelogo!==void 0&&D(!!n.hidelogo),n.maxnumber!==void 0&&U(+n.maxnumber),n.mockerror!==void 0&&j(!!n.mockerror),n.name!==void 0&&Z(n.name),n.refetchonexpire!==void 0&&M(!!n.refetchonexpire),n.spamfilter!==void 0&&q(typeof n.spamfilter=="object"?n.spamfilter:!!n.spamfilter),n.strings&&xe(typeof n.strings=="string"?n.strings:JSON.stringify(n.strings)),n.test!==void 0&&ie(typeof n.test=="number"?n.test:!!n.test),n.verifyurl!==void 0&&Ne(n.verifyurl),n.workers!==void 0&&Qe(+n.workers),n.workerurl!==void 0&&ut(n.workerurl)}function zn(){return{auto:r(),blockspam:l(),challengeurl:i(),debug:f(),delay:s(),expire:c(),floating:v(),floatinganchor:h(),floatingoffset:g(),hidefooter:b(),hidelogo:D(),name:Z(),maxnumber:U(),mockerror:j(),obfuscated:G(),refetchonexpire:M(),spamfilter:q(),strings:d(le),test:ie(),verifyurl:Ne(),workers:Qe(),workerurl:ut()}}function On(){return tt}function Gl(n){return Le.find(u=>u.constructor.pluginName===n)}function Fn(){return d(S)}function Mn(){d(Y).style.display="none"}function ht(n=20){if(d(Y))if(tt||(tt=(h()?document.querySelector(h()):p==null?void 0:p.querySelector('input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])'))||p),tt){const u=parseInt(g(),10)||12,_=tt.getBoundingClientRect(),E=d(Y).getBoundingClientRect(),L=document.documentElement.clientHeight,$=document.documentElement.clientWidth,y=v()==="auto"?_.bottom+E.height+u+n>L:v()==="top",k=Math.max(n,Math.min($-n-E.width,_.left+_.width/2-E.width/2));if(y?d(Y).style.top=`${_.top-(E.height+u)}px`:d(Y).style.top=`${_.bottom+u}px`,d(Y).style.left=`${k}px`,d(Y).setAttribute("data-floating",y?"top":"bottom"),d(dt)){const $e=d(dt).getBoundingClientRect();d(dt).style.left=_.left-k+_.width/2-$e.width/2+"px"}}else N("unable to find floating anchor element")}function gt(n=w.UNVERIFIED,u=null){ge&&(clearTimeout(ge),ge=null),z(et,!1),z(Ve,null),je(n,u)}function Un(n){tt=n}function je(n,u=null){z(S,ae(n)),z(rt,ae(u)),ct("statechange",{payload:d(Ve),state:d(S)})}function nr(){d(Y).style.display="block",v()&&ht()}async function De(){return gt(w.VERIFYING),await new Promise(n=>setTimeout(n,s()||0)),Ml().then(n=>(Ln(n),N("challenge",n),Dn(n))).then(({data:n,solution:u})=>{if(N("solution",u),!u||n&&"challenge"in n&&!("clearText"in u))if((u==null?void 0:u.number)!==void 0&&"challenge"in n){if(Ne())return Wl(yn(n,u));z(Ve,ae(yn(n,u))),N("payload",d(Ve))}else throw N("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."),new Error("Unexpected result returned.")}).then(()=>{je(w.VERIFIED),N("verified"),Ui().then(()=>{ct("verified",{payload:d(Ve)})})}).catch(n=>{N(n),je(w.ERROR,n.message)})}var Vn=zl(),jn=Nr(Vn);il(jn,t,"default",{});var _t=we(jn,2),ir=Q(_t),qn=Q(ir);{var Jl=n=>{var u=Cl();re(n,u)};Te(qn,n=>{d(S)===w.VERIFYING&&n(Jl)})}var Ot=we(qn,2);let Bn;var nt=Q(Ot);nn(nt),nt.__change=Bl,X(Ot);var lr=we(Ot,2),Kl=Q(lr);{var Xl=n=>{var u=Al(),_=Nr(u),E=Q(_);Xe(E,()=>d(le).verified),X(_);var L=we(_,2);nn(L),Je(()=>{fe(L,"name",Z()),ul(L,d(Ve))}),re(n,u)},Ql=(n,u)=>{{var _=L=>{var $=Rl(),y=Q($);Xe(y,()=>d(le).verifying),X($),re(L,$)},E=L=>{var $=Il(),y=Q($);Xe(y,()=>d(le).label),X($),Je(()=>fe($,"for",d(bn))),re(L,$)};Te(n,L=>{d(S)===w.VERIFYING?L(_):L(E,!1)},u)}};Te(Kl,n=>{d(S)===w.VERIFIED?n(Xl):n(Ql,!1)})}X(lr);var eo=we(lr,2);{var to=n=>{var u=Sl(),_=Q(u);fe(_,"href",mn),X(u),Je(()=>fe(_,"aria-label",d(le).ariaLinkLabel)),re(n,u)};Te(eo,n=>{(D()!==!0||d(er))&&n(to)})}X(ir);var Hn=we(ir,2);{var ro=n=>{var u=Ll(),_=we(Q(u),2);{var E=$=>{var y=Tl(),k=Q(y);Xe(k,()=>d(le).expired),X(y),Je(()=>fe(y,"title",d(rt))),re($,y)},L=$=>{var y=Nl(),k=Q(y);Xe(k,()=>d(le).error),X(y),Je(()=>fe(y,"title",d(rt))),re($,y)};Te(_,$=>{d(S)===w.EXPIRED?$(E):$(L,!1)})}X(u),re(n,u)};Te(Hn,n=>{(d(rt)||d(S)===w.EXPIRED)&&n(ro)})}var Yn=we(Hn,2);{var no=n=>{var u=Dl(),_=Q(u),E=Q(_);Xe(E,()=>d(le).footer),X(_),X(u),re(n,u)};Te(Yn,n=>{d(le).footer&&(b()!==!0||d(er))&&n(no)})}var io=we(Yn,2);{var lo=n=>{var u=Pl();sn(u,_=>z(dt,_),()=>d(dt)),re(n,u)};Te(io,n=>{v()&&n(lo)})}return X(_t),sn(_t,n=>z(Y,n),()=>d(Y)),Je(n=>{fe(_t,"data-state",d(S)),fe(_t,"data-floating",v()),Bn=al(Ot,1,"altcha-checkbox svelte-ddsc3z",null,Bn,n),fe(nt,"id",d(bn)),nt.required=r()!=="onsubmit"&&(!v()||r()!=="off")},[()=>({"altcha-hidden":d(S)===w.VERIFYING})]),Qi("invalid",nt,In),dl(nt,()=>d(et),n=>z(et,n)),re(e,Vn),Zr({clarify:vt,configure:Pn,getConfiguration:zn,getFloatingAnchor:On,getPlugin:Gl,getState:Fn,hide:Mn,repositionFloating:ht,reset:gt,setFloatingAnchor:Un,setState:je,show:nr,verify:De,get auto(){return r()},set auto(n=void 0){r(n),x()},get blockspam(){return l()},set blockspam(n=void 0){l(n),x()},get challengeurl(){return i()},set challengeurl(n=void 0){i(n),x()},get challengejson(){return o()},set challengejson(n=void 0){o(n),x()},get customfetch(){return a()},set customfetch(n=void 0){a(n),x()},get debug(){return f()},set debug(n=!1){f(n),x()},get delay(){return s()},set delay(n=0){s(n),x()},get expire(){return c()},set expire(n=void 0){c(n),x()},get floating(){return v()},set floating(n=void 0){v(n),x()},get floatinganchor(){return h()},set floatinganchor(n=void 0){h(n),x()},get floatingoffset(){return g()},set floatingoffset(n=void 0){g(n),x()},get floatingpersist(){return m()},set floatingpersist(n=!1){m(n),x()},get hidefooter(){return b()},set hidefooter(n=!1){b(n),x()},get hidelogo(){return D()},set hidelogo(n=!1){D(n),x()},get id(){return F()},set id(n=void 0){F(n),x()},get name(){return Z()},set name(n="altcha"){Z(n),x()},get maxnumber(){return U()},set maxnumber(n=1e6){U(n),x()},get mockerror(){return j()},set mockerror(n=!1){j(n),x()},get obfuscated(){return G()},set obfuscated(n=void 0){G(n),x()},get plugins(){return Ue()},set plugins(n=void 0){Ue(n),x()},get refetchonexpire(){return M()},set refetchonexpire(n=!0){M(n),x()},get spamfilter(){return q()},set spamfilter(n=!1){q(n),x()},get strings(){return xe()},set strings(n=void 0){xe(n),x()},get test(){return ie()},set test(n=!1){ie(n),x()},get verifyurl(){return Ne()},set verifyurl(n=void 0){Ne(n),x()},get workers(){return Qe()},set workers(n=Math.min(16,navigator.hardwareConcurrency||8)){Qe(n),x()},get workerurl(){return ut()},set workerurl(n=void 0){ut(n),x()}})}el(["change"]),customElements.define("altcha-widget",pl(vn,{blockspam:{type:"Boolean"},debug:{type:"Boolean"},delay:{type:"Number"},expire:{type:"Number"},floatingoffset:{type:"Number"},hidefooter:{type:"Boolean"},hidelogo:{type:"Boolean"},maxnumber:{type:"Number"},mockerror:{type:"Boolean"},refetchonexpire:{type:"Boolean"},test:{type:"Boolean"},workers:{type:"Number"},auto:{},challengeurl:{},challengejson:{},customfetch:{},floating:{},floatinganchor:{},floatingpersist:{},id:{},name:{},obfuscated:{},plugins:{},spamfilter:{},strings:{},verifyurl:{},workerurl:{}},["default"],["clarify","configure","getConfiguration","getFloatingAnchor","getPlugin","getState","hide","repositionFloating","reset","setFloatingAnchor","setState","show","verify"],!1)),globalThis.altchaCreateWorker=e=>new Worker(new URL(e||"./worker.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:A&&A.tagName.toUpperCase()==="SCRIPT"&&A.src||new URL("altcha.umd.cjs",document.baseURI).href)),globalThis.altchaPlugins=globalThis.altchaPlugins||[],C.Altcha=vn,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
1
+ (function(x,C){typeof exports=="object"&&typeof module<"u"?C(exports):typeof define=="function"&&define.amd?define(["exports"],C):(x=typeof globalThis<"u"?globalThis:x||self,C(x.altcha={}))})(this,function(x){"use strict";var uo=Object.defineProperty;var li=x=>{throw TypeError(x)};var co=(x,C,j)=>C in x?uo(x,C,{enumerable:!0,configurable:!0,writable:!0,value:j}):x[C]=j;var ve=(x,C,j)=>co(x,typeof C!="symbol"?C+"":C,j),oi=(x,C,j)=>C.has(x)||li("Cannot "+j);var Q=(x,C,j)=>(oi(x,C,"read from private field"),j?j.call(x):C.get(x)),sr=(x,C,j)=>C.has(x)?li("Cannot add the same private member more than once"):C instanceof WeakSet?C.add(x):C.set(x,j),fr=(x,C,j,yt)=>(oi(x,C,"write to private field"),yt?yt.call(x,j):C.set(x,j),j);var $n,be,ae;var C=typeof document<"u"?document.currentScript:null;const j="5";typeof window<"u"&&(($n=window.__svelte??(window.__svelte={})).v??($n.v=new Set)).add(j);const yt=1,ai=4,si=8,fi=16,ui=1,ci=2,Mt="[",ur="[!",cr="]",He={},J=Symbol(),di="http://www.w3.org/1999/xhtml",dr=!1;function vr(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}var hr=Array.isArray,vi=Array.prototype.indexOf,hi=Array.from,bt=Object.keys,Et=Object.defineProperty,Pe=Object.getOwnPropertyDescriptor,gi=Object.getOwnPropertyDescriptors,_i=Object.prototype,mi=Array.prototype,gr=Object.getPrototypeOf,_r=Object.isExtensible;function mr(e){for(var t=0;t<e.length;t++)e[t]()}const ue=2,wr=4,$t=8,Ut=16,pe=32,Fe=64,kt=128,ee=256,xt=512,K=1024,he=2048,Oe=4096,Ye=8192,Ct=16384,wi=32768,Vt=65536,pi=1<<19,pr=1<<20,jt=1<<21,rt=Symbol("$state"),yr=Symbol("legacy props"),yi=Symbol("");function bi(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ei(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function $i(e){throw new Error("https://svelte.dev/e/effect_orphan")}function ki(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function xi(){throw new Error("https://svelte.dev/e/hydration_failed")}function Ci(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function Ai(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Ii(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Ri(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function At(e){console.warn("https://svelte.dev/e/hydration_mismatch")}let P=!1;function We(e){P=e}let F;function ke(e){if(e===null)throw At(),He;return F=e}function Ze(){return ke(Ce(F))}function te(e){if(P){if(Ce(F)!==null)throw At(),He;F=e}}function Si(){for(var e=0,t=F;;){if(t.nodeType===8){var r=t.data;if(r===cr){if(e===0)return t;e-=1}else(r===Mt||r===ur)&&(e+=1)}var i=Ce(t);t.remove(),t=i}}let Ti=!1;function xe(e){if(typeof e!="object"||e===null||rt in e)return e;const t=gr(e);if(t!==_i&&t!==mi)return e;var r=new Map,i=hr(e),l=X(0),o=I,a=s=>{var f=I;_e(o);var d=s();return _e(f),d};return i&&r.set("length",X(e.length)),new Proxy(e,{defineProperty(s,f,d){(!("value"in d)||d.configurable===!1||d.enumerable===!1||d.writable===!1)&&Ai();var h=r.get(f);return h===void 0?(h=a(()=>X(d.value)),r.set(f,h)):O(h,a(()=>xe(d.value))),!0},deleteProperty(s,f){var d=r.get(f);if(d===void 0)f in s&&(r.set(f,a(()=>X(J))),qt(l));else{if(i&&typeof f=="string"){var h=r.get("length"),v=Number(f);Number.isInteger(v)&&v<h.v&&O(h,v)}O(d,J),qt(l)}return!0},get(s,f,d){var m;if(f===rt)return e;var h=r.get(f),v=f in s;if(h===void 0&&(!v||(m=Pe(s,f))!=null&&m.writable)&&(h=a(()=>X(xe(v?s[f]:J))),r.set(f,h)),h!==void 0){var g=c(h);return g===J?void 0:g}return Reflect.get(s,f,d)},getOwnPropertyDescriptor(s,f){var d=Reflect.getOwnPropertyDescriptor(s,f);if(d&&"value"in d){var h=r.get(f);h&&(d.value=c(h))}else if(d===void 0){var v=r.get(f),g=v==null?void 0:v.v;if(v!==void 0&&g!==J)return{enumerable:!0,configurable:!0,value:g,writable:!0}}return d},has(s,f){var g;if(f===rt)return!0;var d=r.get(f),h=d!==void 0&&d.v!==J||Reflect.has(s,f);if(d!==void 0||R!==null&&(!h||(g=Pe(s,f))!=null&&g.writable)){d===void 0&&(d=a(()=>X(h?xe(s[f]):J)),r.set(f,d));var v=c(d);if(v===J)return!1}return h},set(s,f,d,h){var q;var v=r.get(f),g=f in s;if(i&&f==="length")for(var m=d;m<v.v;m+=1){var A=r.get(m+"");A!==void 0?O(A,J):m in s&&(A=a(()=>X(J)),r.set(m+"",A))}v===void 0?(!g||(q=Pe(s,f))!=null&&q.writable)&&(v=a(()=>X(void 0)),O(v,a(()=>xe(d))),r.set(f,v)):(g=v.v!==J,O(v,a(()=>xe(d))));var D=Reflect.getOwnPropertyDescriptor(s,f);if(D!=null&&D.set&&D.set.call(h,d),!g){if(i&&typeof f=="string"){var U=r.get("length"),Z=Number(f);Number.isInteger(Z)&&Z>=U.v&&O(U,Z+1)}qt(l)}return!0},ownKeys(s){c(l);var f=Reflect.ownKeys(s).filter(v=>{var g=r.get(v);return g===void 0||g.v!==J});for(var[d,h]of r)h.v!==J&&!(d in s)&&f.push(d);return f},setPrototypeOf(){Ii()}})}function qt(e,t=1){O(e,e.v+t)}var br,Er,$r,kr;function Bt(){if(br===void 0){br=window,Er=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,r=Text.prototype;$r=Pe(t,"firstChild").get,kr=Pe(t,"nextSibling").get,_r(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),_r(r)&&(r.__t=void 0)}}function Ht(e=""){return document.createTextNode(e)}function ie(e){return $r.call(e)}function Ce(e){return kr.call(e)}function re(e,t){if(!P)return ie(e);var r=ie(F);return r===null&&(r=F.appendChild(Ht())),ke(r),r}function xr(e,t){if(!P){var r=ie(e);return r instanceof Comment&&r.data===""?Ce(r):r}return F}function ye(e,t=1,r=!1){let i=P?F:e;for(var l;t--;)l=i,i=Ce(i);if(!P)return i;var o=i==null?void 0:i.nodeType;if(r&&o!==3){var a=Ht();return i===null?l==null||l.after(a):i.before(a),ke(a),a}return ke(i),i}function Ni(e){e.textContent=""}function Cr(e){return e===this.v}function Li(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Ar(e){return!Li(e,this.v)}function Yt(e){var t=ue|he,r=I!==null&&(I.f&ue)!==0?I:null;return R===null||r!==null&&(r.f&ee)!==0?t|=ee:R.f|=pr,{ctx:W,deps:null,effects:null,equals:Cr,f:t,fn:e,reactions:null,rv:0,v:null,wv:0,parent:r??R}}function nt(e){const t=Yt(e);return Hr(t),t}function Ir(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r<t.length;r+=1)Ae(t[r])}}function Di(e){for(var t=e.parent;t!==null;){if((t.f&ue)===0)return t;t=t.parent}return null}function Rr(e){var t,r=R;Ie(Di(e));try{Ir(e),t=Jr(e)}finally{Ie(r)}return t}function Sr(e){var t=Rr(e),r=(Re||(e.f&ee)!==0)&&e.deps!==null?Oe:K;ce(e,r),e.equals(t)||(e.v=t,e.wv=Wr())}function Pi(e){R===null&&I===null&&$i(),I!==null&&(I.f&ee)!==0&&R===null&&Ei(),ot&&bi()}function Fi(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function Me(e,t,r,i=!0){var l=R,o={ctx:W,deps:null,nodes_start:null,nodes_end:null,f:e|he,first:null,fn:t,last:null,next:null,parent:l,prev:null,teardown:null,transitions:null,wv:0};if(r)try{Xt(o),o.f|=wi}catch(f){throw Ae(o),f}else t!==null&&Dt(o);var a=r&&o.deps===null&&o.first===null&&o.nodes_start===null&&o.teardown===null&&(o.f&(pr|kt))===0;if(!a&&i&&(l!==null&&Fi(o,l),I!==null&&(I.f&ue)!==0)){var s=I;(s.effects??(s.effects=[])).push(o)}return o}function Tr(e){const t=Me($t,null,!1);return ce(t,K),t.teardown=e,t}function Wt(e){Pi();var t=R!==null&&(R.f&pe)!==0&&W!==null&&!W.m;if(t){var r=W;(r.e??(r.e=[])).push({fn:e,effect:R,reaction:I})}else{var i=Zt(e);return i}}function Oi(e){const t=Me(Fe,e,!0);return()=>{Ae(t)}}function Mi(e){const t=Me(Fe,e,!0);return(r={})=>new Promise(i=>{r.outro?Kt(t,()=>{Ae(t),i(void 0)}):(Ae(t),i(void 0))})}function Zt(e){return Me(wr,e,!1)}function Gt(e){return Me($t,e,!0)}function Ue(e,t=[],r=Yt){const i=t.map(r);return Nr(()=>e(...i.map(c)))}function Nr(e,t=0){return Me($t|Ut|t,e,!0)}function Jt(e,t=!0){return Me($t|pe,e,!0,t)}function Lr(e){var t=e.teardown;if(t!==null){const r=ot,i=I;Br(!0),_e(null);try{t.call(null)}finally{Br(r),_e(i)}}}function Dr(e,t=!1){var r=e.first;for(e.first=e.last=null;r!==null;){var i=r.next;(r.f&Fe)!==0?r.parent=null:Ae(r,t),r=i}}function Ui(e){for(var t=e.first;t!==null;){var r=t.next;(t.f&pe)===0&&Ae(t),t=r}}function Ae(e,t=!0){var r=!1;(t||(e.f&pi)!==0)&&e.nodes_start!==null&&(Pr(e.nodes_start,e.nodes_end),r=!0),Dr(e,t&&!r),Lt(e,0),ce(e,Ct);var i=e.transitions;if(i!==null)for(const o of i)o.stop();Lr(e);var l=e.parent;l!==null&&l.first!==null&&Fr(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=null}function Pr(e,t){for(;e!==null;){var r=e===t?null:Ce(e);e.remove(),e=r}}function Fr(e){var t=e.parent,r=e.prev,i=e.next;r!==null&&(r.next=i),i!==null&&(i.prev=r),t!==null&&(t.first===e&&(t.first=i),t.last===e&&(t.last=r))}function Kt(e,t){var r=[];Or(e,r,!0),Vi(r,()=>{Ae(e),t&&t()})}function Vi(e,t){var r=e.length;if(r>0){var i=()=>--r||t();for(var l of e)l.out(i)}else t()}function Or(e,t,r){if((e.f&Ye)===0){if(e.f^=Ye,e.transitions!==null)for(const a of e.transitions)(a.is_global||r)&&t.push(a);for(var i=e.first;i!==null;){var l=i.next,o=(i.f&Vt)!==0||(i.f&pe)!==0;Or(i,t,o?r:!1),i=l}}}function Mr(e){Ur(e,!0)}function Ur(e,t){if((e.f&Ye)!==0){e.f^=Ye,(e.f&K)===0&&(e.f^=K),st(e)&&(ce(e,he),Dt(e));for(var r=e.first;r!==null;){var i=r.next,l=(r.f&Vt)!==0||(r.f&pe)!==0;Ur(r,l?t:!1),r=i}if(e.transitions!==null)for(const o of e.transitions)(o.is_global||t)&&o.in()}}const ji=typeof requestIdleCallback>"u"?e=>setTimeout(e,1):requestIdleCallback;let it=[],lt=[];function Vr(){var e=it;it=[],mr(e)}function jr(){var e=lt;lt=[],mr(e)}function qr(e){it.length===0&&queueMicrotask(Vr),it.push(e)}function qi(e){lt.length===0&&ji(jr),lt.push(e)}function Bi(){it.length>0&&Vr(),lt.length>0&&jr()}let It=!1,Rt=!1,St=null,Ve=!1,ot=!1;function Br(e){ot=e}let at=[],vo=[],I=null,ge=!1;function _e(e){I=e}let R=null;function Ie(e){R=e}let H=null;function Hr(e){I!==null&&I.f&jt&&(H===null?H=[e]:H.push(e))}let Y=null,ne=0,le=null;function Hi(e){le=e}let Yr=1,Tt=0,Re=!1;function Wr(){return++Yr}function st(e){var v;var t=e.f;if((t&he)!==0)return!0;if((t&Oe)!==0){var r=e.deps,i=(t&ee)!==0;if(r!==null){var l,o,a=(t&xt)!==0,s=i&&R!==null&&!Re,f=r.length;if(a||s){var d=e,h=d.parent;for(l=0;l<f;l++)o=r[l],(a||!((v=o==null?void 0:o.reactions)!=null&&v.includes(d)))&&(o.reactions??(o.reactions=[])).push(d);a&&(d.f^=xt),s&&h!==null&&(h.f&ee)===0&&(d.f^=ee)}for(l=0;l<f;l++)if(o=r[l],st(o)&&Sr(o),o.wv>e.wv)return!0}(!i||R!==null&&!Re)&&ce(e,K)}return!1}function Yi(e,t){for(var r=t;r!==null;){if((r.f&kt)!==0)try{r.fn(e);return}catch{r.f^=kt}r=r.parent}throw It=!1,e}function Zr(e){return(e.f&Ct)===0&&(e.parent===null||(e.parent.f&kt)===0)}function Nt(e,t,r,i){if(It){if(r===null&&(It=!1),Zr(t))throw e;return}if(r!==null&&(It=!0),Yi(e,t),Zr(t))throw e}function Gr(e,t,r=!0){var i=e.reactions;if(i!==null)for(var l=0;l<i.length;l++){var o=i[l];H!=null&&H.includes(e)||((o.f&ue)!==0?Gr(o,t,!1):t===o&&(r?ce(o,he):(o.f&K)!==0&&ce(o,Oe),Dt(o)))}}function Jr(e){var m;var t=Y,r=ne,i=le,l=I,o=Re,a=H,s=W,f=ge,d=e.f;Y=null,ne=0,le=null,Re=(d&ee)!==0&&(ge||!Ve||I===null),I=(d&(pe|Fe))===0?e:null,H=null,en(e.ctx),ge=!1,Tt++,e.f|=jt;try{var h=(0,e.fn)(),v=e.deps;if(Y!==null){var g;if(Lt(e,ne),v!==null&&ne>0)for(v.length=ne+Y.length,g=0;g<Y.length;g++)v[ne+g]=Y[g];else e.deps=v=Y;if(!Re)for(g=ne;g<v.length;g++)((m=v[g]).reactions??(m.reactions=[])).push(e)}else v!==null&&ne<v.length&&(Lt(e,ne),v.length=ne);if(nn()&&le!==null&&!ge&&v!==null&&(e.f&(ue|Oe|he))===0)for(g=0;g<le.length;g++)Gr(le[g],e);return l!==null&&l!==e&&(Tt++,le!==null&&(i===null?i=le:i.push(...le))),h}finally{Y=t,ne=r,le=i,I=l,Re=o,H=a,en(s),ge=f,e.f^=jt}}function Wi(e,t){let r=t.reactions;if(r!==null){var i=vi.call(r,e);if(i!==-1){var l=r.length-1;l===0?r=t.reactions=null:(r[i]=r[l],r.pop())}}r===null&&(t.f&ue)!==0&&(Y===null||!Y.includes(t))&&(ce(t,Oe),(t.f&(ee|xt))===0&&(t.f^=xt),Ir(t),Lt(t,0))}function Lt(e,t){var r=e.deps;if(r!==null)for(var i=t;i<r.length;i++)Wi(e,r[i])}function Xt(e){var t=e.f;if((t&Ct)===0){ce(e,K);var r=R,i=W,l=Ve;R=e,Ve=!0;try{(t&Ut)!==0?Ui(e):Dr(e),Lr(e);var o=Jr(e);e.teardown=typeof o=="function"?o:null,e.wv=Yr;var a=e.deps,s;dr&&Ti&&e.f&he}catch(f){Nt(f,e,r,i||e.ctx)}finally{Ve=l,R=r}}}function Zi(){try{ki()}catch(e){if(St!==null)Nt(e,St,null);else throw e}}function Kr(){var e=Ve;try{var t=0;for(Ve=!0;at.length>0;){t++>1e3&&Zi();var r=at,i=r.length;at=[];for(var l=0;l<i;l++){var o=Ji(r[l]);Gi(o)}ft.clear()}}finally{Rt=!1,Ve=e,St=null}}function Gi(e){var t=e.length;if(t!==0)for(var r=0;r<t;r++){var i=e[r];if((i.f&(Ct|Ye))===0)try{st(i)&&(Xt(i),i.deps===null&&i.first===null&&i.nodes_start===null&&(i.teardown===null?Fr(i):i.fn=null))}catch(l){Nt(l,i,null,i.ctx)}}}function Dt(e){Rt||(Rt=!0,queueMicrotask(Kr));for(var t=St=e;t.parent!==null;){t=t.parent;var r=t.f;if((r&(Fe|pe))!==0){if((r&K)===0)return;t.f^=K}}at.push(t)}function Ji(e){for(var t=[],r=e;r!==null;){var i=r.f,l=(i&(pe|Fe))!==0,o=l&&(i&K)!==0;if(!o&&(i&Ye)===0){if((i&wr)!==0)t.push(r);else if(l)r.f^=K;else try{st(r)&&Xt(r)}catch(f){Nt(f,r,null,r.ctx)}var a=r.first;if(a!==null){r=a;continue}}var s=r.parent;for(r=r.next;r===null&&s!==null;)r=s.next,s=s.parent}return t}function E(e){for(var t;;){if(Bi(),at.length===0)return t;Rt=!0,Kr()}}async function Ki(){await Promise.resolve(),E()}function c(e){var t=e.f,r=(t&ue)!==0;if(I!==null&&!ge){if(!(H!=null&&H.includes(e))){var i=I.deps;e.rv<Tt&&(e.rv=Tt,Y===null&&i!==null&&i[ne]===e?ne++:Y===null?Y=[e]:(!Re||!Y.includes(e))&&Y.push(e))}}else if(r&&e.deps===null&&e.effects===null){var l=e,o=l.parent;o!==null&&(o.f&ee)===0&&(l.f^=ee)}return r&&(l=e,st(l)&&Sr(l)),ot&&ft.has(e)?ft.get(e):e.v}function Ge(e){var t=ge;try{return ge=!0,e()}finally{ge=t}}const Xi=-7169;function ce(e,t){e.f=e.f&Xi|t}const ft=new Map;function Xr(e,t){var r={f:0,v:e,reactions:null,equals:Cr,rv:0,wv:0};return r}function X(e,t){const r=Xr(e);return Hr(r),r}function zr(e,t=!1){const r=Xr(e);return t||(r.equals=Ar),r}function O(e,t,r=!1){I!==null&&!ge&&nn()&&(I.f&(ue|Ut))!==0&&!(H!=null&&H.includes(e))&&Ri();let i=r?xe(t):t;return zi(e,i)}function zi(e,t){if(!e.equals(t)){var r=e.v;ot?ft.set(e,t):ft.set(e,r),e.v=t,(e.f&ue)!==0&&((e.f&he)!==0&&Rr(e),ce(e,(e.f&ee)===0?K:Oe)),e.wv=Wr(),Qr(e,he),R!==null&&(R.f&K)!==0&&(R.f&(pe|Fe))===0&&(le===null?Hi([e]):le.push(e))}return t}function Qr(e,t){var r=e.reactions;if(r!==null)for(var i=r.length,l=0;l<i;l++){var o=r[l],a=o.f;(a&he)===0&&(ce(o,t),(a&(K|ee))!==0&&((a&ue)!==0?Qr(o,Oe):Dt(o)))}}let W=null;function en(e){W=e}function tn(e,t=!1,r){var i=W={p:W,c:null,d:!1,e:null,m:!1,s:e,x:null,l:null};Tr(()=>{i.d=!0})}function rn(e){const t=W;if(t!==null){e!==void 0&&(t.x=e);const a=t.e;if(a!==null){var r=R,i=I;t.e=null;try{for(var l=0;l<a.length;l++){var o=a[l];Ie(o.effect),_e(o.reaction),Zt(o.fn)}}finally{Ie(r),_e(i)}}W=t.p,t.m=!0}return e||{}}function nn(){return!0}const Qi=["touchstart","touchmove"];function el(e){return Qi.includes(e)}let ln=!1;function on(){ln||(ln=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const r of e.target.elements)(t=r.__on_r)==null||t.call(r)})},{capture:!0}))}function an(e){var t=I,r=R;_e(null),Ie(null);try{return e()}finally{_e(t),Ie(r)}}function tl(e,t,r,i=r){e.addEventListener(t,()=>an(r));const l=e.__on_r;l?e.__on_r=()=>{l(),i(!0)}:e.__on_r=()=>i(!0),on()}const sn=new Set,zt=new Set;function rl(e,t,r,i={}){function l(o){if(i.capture||ut.call(t,o),!o.cancelBubble)return an(()=>r==null?void 0:r.call(this,o))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?qr(()=>{t.addEventListener(e,l,i)}):t.addEventListener(e,l,i),l}function nl(e,t,r,i,l){var o={capture:i,passive:l},a=rl(e,t,r,o);(t===document.body||t===window||t===document)&&Tr(()=>{t.removeEventListener(e,a,o)})}function il(e){for(var t=0;t<e.length;t++)sn.add(e[t]);for(var r of zt)r(e)}function ut(e){var q;var t=this,r=t.ownerDocument,i=e.type,l=((q=e.composedPath)==null?void 0:q.call(e))||[],o=l[0]||e.target,a=0,s=e.__root;if(s){var f=l.indexOf(s);if(f!==-1&&(t===document||t===window)){e.__root=t;return}var d=l.indexOf(t);if(d===-1)return;f<=d&&(a=f)}if(o=l[a]||e.target,o!==t){Et(e,"currentTarget",{configurable:!0,get(){return o||r}});var h=I,v=R;_e(null),Ie(null);try{for(var g,m=[];o!==null;){var A=o.assignedSlot||o.parentNode||o.host||null;try{var D=o["__"+i];if(D!=null&&(!o.disabled||e.target===o))if(hr(D)){var[U,...Z]=D;U.apply(o,[e,...Z])}else D.call(o,e)}catch(z){g?m.push(z):g=z}if(e.cancelBubble||A===t||A===null)break;o=A}if(g){for(let z of m)queueMicrotask(()=>{throw z});throw g}}finally{e.__root=t,delete e.currentTarget,_e(h),Ie(v)}}}function Qt(e){var t=document.createElement("template");return t.innerHTML=e,t.content}function Se(e,t){var r=R;r.nodes_start===null&&(r.nodes_start=e,r.nodes_end=t)}function me(e,t){var r=(t&ui)!==0,i=(t&ci)!==0,l,o=!e.startsWith("<!>");return()=>{if(P)return Se(F,null),F;l===void 0&&(l=Qt(o?e:"<!>"+e),r||(l=ie(l)));var a=i||Er?document.importNode(l,!0):l.cloneNode(!0);if(r){var s=ie(a),f=a.lastChild;Se(s,f)}else Se(a,a);return a}}function ll(e,t,r="svg"){var i=!e.startsWith("<!>"),l=`<${r}>${i?e:"<!>"+e}</${r}>`,o;return()=>{if(P)return Se(F,null),F;if(!o){var a=Qt(l),s=ie(a);o=ie(s)}var f=o.cloneNode(!0);return Se(f,f),f}}function oe(e,t){if(P){R.nodes_end=F,Ze();return}e!==null&&e.before(t)}function fn(e,t){return un(e,t)}function ol(e,t){Bt(),t.intro=t.intro??!1;const r=t.target,i=P,l=F;try{for(var o=ie(r);o&&(o.nodeType!==8||o.data!==Mt);)o=Ce(o);if(!o)throw He;We(!0),ke(o),Ze();const a=un(e,{...t,anchor:o});if(F===null||F.nodeType!==8||F.data!==cr)throw At(),He;return We(!1),a}catch(a){if(a===He)return t.recover===!1&&xi(),Bt(),Ni(r),We(!1),fn(e,t);throw a}finally{We(i),ke(l)}}const Je=new Map;function un(e,{target:t,anchor:r,props:i={},events:l,context:o,intro:a=!0}){Bt();var s=new Set,f=v=>{for(var g=0;g<v.length;g++){var m=v[g];if(!s.has(m)){s.add(m);var A=el(m);t.addEventListener(m,ut,{passive:A});var D=Je.get(m);D===void 0?(document.addEventListener(m,ut,{passive:A}),Je.set(m,1)):Je.set(m,D+1)}}};f(hi(sn)),zt.add(f);var d=void 0,h=Mi(()=>{var v=r??t.appendChild(Ht());return Jt(()=>{if(o){tn({});var g=W;g.c=o}l&&(i.$$events=l),P&&Se(v,null),d=e(v,i)||{},P&&(R.nodes_end=F),o&&rn()}),()=>{var A;for(var g of s){t.removeEventListener(g,ut);var m=Je.get(g);--m===0?(document.removeEventListener(g,ut),Je.delete(g)):Je.set(g,m)}zt.delete(f),v!==r&&((A=v.parentNode)==null||A.removeChild(v))}});return er.set(d,h),d}let er=new WeakMap;function al(e,t){const r=er.get(e);return r?(er.delete(e),r(t)):Promise.resolve()}function Te(e,t,[r,i]=[0,0]){P&&r===0&&Ze();var l=e,o=null,a=null,s=J,f=r>0?Vt:0,d=!1;const h=(g,m=!0)=>{d=!0,v(m,g)},v=(g,m)=>{if(s===(s=g))return;let A=!1;if(P&&i!==-1){if(r===0){const U=l.data;U===Mt?i=0:U===ur?i=1/0:(i=parseInt(U.substring(1)),i!==i&&(i=s?1/0:-1))}const D=i>r;!!s===D&&(l=Si(),ke(l),We(!1),A=!0,i=-1)}s?(o?Mr(o):m&&(o=Jt(()=>m(l))),a&&Kt(a,()=>{a=null})):(a?Mr(a):m&&(a=Jt(()=>m(l,[r+1,i]))),o&&Kt(o,()=>{o=null})),A&&We(!0)};Nr(()=>{d=!1,t(h),d||v(null,null)},f),P&&(l=F)}function Ke(e,t,r=!1,i=!1,l=!1){var o=e,a="";Ue(()=>{var s=R;if(a===(a=t()??"")){P&&Ze();return}if(s.nodes_start!==null&&(Pr(s.nodes_start,s.nodes_end),s.nodes_start=s.nodes_end=null),a!==""){if(P){F.data;for(var f=Ze(),d=f;f!==null&&(f.nodeType!==8||f.data!=="");)d=f,f=Ce(f);if(f===null)throw At(),He;Se(F,d),o=ke(f);return}var h=a+"";r?h=`<svg>${h}</svg>`:i&&(h=`<math>${h}</math>`);var v=Qt(h);if((r||i)&&(v=ie(v)),Se(ie(v),v.lastChild),r||i)for(;ie(v);)o.before(ie(v));else o.before(v)}})}function sl(e,t,r,i,l){var s;P&&Ze();var o=(s=t.$$slots)==null?void 0:s[r],a=!1;o===!0&&(o=t.children,a=!0),o===void 0||o(e,a?()=>i:i)}const cn=[...`
2
+ \r\f \v\uFEFF`];function fl(e,t,r){var i=""+e;if(r){for(var l in r)if(r[l])i=i?i+" "+l:l;else if(i.length)for(var o=l.length,a=0;(a=i.indexOf(l,a))>=0;){var s=a+o;(a===0||cn.includes(i[a-1]))&&(s===i.length||cn.includes(i[s]))?i=(a===0?"":i.substring(0,a))+i.substring(s+1):a=s}}return i===""?null:i}function ul(e,t,r,i,l,o){var a=e.__className;if(P||a!==r||a===void 0){var s=fl(r,i,o);(!P||s!==e.getAttribute("class"))&&(s==null?e.removeAttribute("class"):e.className=s),e.__className=r}else if(o&&l!==o)for(var f in o){var d=!!o[f];(l==null||d!==!!l[f])&&e.classList.toggle(f,d)}return o}const cl=Symbol("is custom element"),dl=Symbol("is html");function dn(e){if(P){var t=!1,r=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var i=e.value;de(e,"value",null),e.value=i}if(e.hasAttribute("checked")){var l=e.checked;de(e,"checked",null),e.checked=l}}};e.__on_r=r,qi(r),on()}}function vl(e,t){var r=vn(e);r.value===(r.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!=="PROGRESS")||(e.value=t??"")}function de(e,t,r,i){var l=vn(e);P&&(l[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||l[t]!==(l[t]=r)&&(t==="loading"&&(e[yi]=r),r==null?e.removeAttribute(t):typeof r!="string"&&hl(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function vn(e){return e.__attributes??(e.__attributes={[cl]:e.nodeName.includes("-"),[dl]:e.namespaceURI===di})}var hn=new Map;function hl(e){var t=hn.get(e.nodeName);if(t)return t;hn.set(e.nodeName,t=[]);for(var r,i=e,l=Element.prototype;l!==i;){r=gi(i);for(var o in r)r[o].set&&t.push(o);i=gr(i)}return t}function gl(e,t,r=t){tl(e,"change",i=>{var l=i?e.defaultChecked:e.checked;r(l)}),(P&&e.defaultChecked!==e.checked||Ge(t)==null)&&r(e.checked),Gt(()=>{var i=t();e.checked=!!i})}function gn(e,t){return e===t||(e==null?void 0:e[rt])===t}function _n(e={},t,r,i){return Zt(()=>{var l,o;return Gt(()=>{l=o,o=[],Ge(()=>{e!==r(...o)&&(t(e,...o),l&&gn(r(...l),e)&&t(null,...l))})}),()=>{qr(()=>{o&&gn(r(...o),e)&&t(null,...o)})}}),e}function mn(e){W===null&&vr(),Wt(()=>{const t=Ge(e);if(typeof t=="function")return t})}function _l(e){W===null&&vr(),mn(()=>()=>Ge(e))}let Pt=!1;function ml(e){var t=Pt;try{return Pt=!1,[e(),Pt]}finally{Pt=t}}function wn(e){var t;return((t=e.ctx)==null?void 0:t.d)??!1}function S(e,t,r,i){var je;var l=(r&yt)!==0,o=!0,a=(r&si)!==0,s=(r&fi)!==0,f=!1,d;a?[d,f]=ml(()=>e[t]):d=e[t];var h=rt in e||yr in e,v=a&&(((je=Pe(e,t))==null?void 0:je.set)??(h&&t in e&&(M=>e[t]=M)))||void 0,g=i,m=!0,A=!1,D=()=>(A=!0,m&&(m=!1,s?g=Ge(i):g=i),g);d===void 0&&i!==void 0&&(v&&o&&Ci(),d=D(),v&&v(d));var U;if(U=()=>{var M=e[t];return M===void 0?D():(m=!0,A=!1,M)},(r&ai)===0)return U;if(v){var Z=e.$$legacy;return function(M,B){return arguments.length>0?((!B||Z||f)&&v(B?U():M),M):U()}}var q=!1,z=zr(d),V=Yt(()=>{var M=U(),B=c(z);return q?(q=!1,B):z.v=M});return a&&c(V),l||(V.equals=Ar),function(M,B){if(arguments.length>0){const Ee=B?c(V):a?xe(M):M;if(!V.equals(Ee)){if(q=!0,O(z,Ee),A&&g!==void 0&&(g=Ee),wn(V))return M;Ge(()=>c(V))}return M}return wn(V)?V.v:c(V)}}function wl(e){return new pl(e)}class pl{constructor(t){sr(this,be);sr(this,ae);var o;var r=new Map,i=(a,s)=>{var f=zr(s);return r.set(a,f),f};const l=new Proxy({...t.props||{},$$events:{}},{get(a,s){return c(r.get(s)??i(s,Reflect.get(a,s)))},has(a,s){return s===yr?!0:(c(r.get(s)??i(s,Reflect.get(a,s))),Reflect.has(a,s))},set(a,s,f){return O(r.get(s)??i(s,f),f),Reflect.set(a,s,f)}});fr(this,ae,(t.hydrate?ol:fn)(t.component,{target:t.target,anchor:t.anchor,props:l,context:t.context,intro:t.intro??!1,recover:t.recover})),(!((o=t==null?void 0:t.props)!=null&&o.$$host)||t.sync===!1)&&E(),fr(this,be,l.$$events);for(const a of Object.keys(Q(this,ae)))a==="$set"||a==="$destroy"||a==="$on"||Et(this,a,{get(){return Q(this,ae)[a]},set(s){Q(this,ae)[a]=s},enumerable:!0});Q(this,ae).$set=a=>{Object.assign(l,a)},Q(this,ae).$destroy=()=>{al(Q(this,ae))}}$set(t){Q(this,ae).$set(t)}$on(t,r){Q(this,be)[t]=Q(this,be)[t]||[];const i=(...l)=>r.call(this,...l);return Q(this,be)[t].push(i),()=>{Q(this,be)[t]=Q(this,be)[t].filter(l=>l!==i)}}$destroy(){Q(this,ae).$destroy()}}be=new WeakMap,ae=new WeakMap;let pn;typeof HTMLElement=="function"&&(pn=class extends HTMLElement{constructor(t,r,i){super();ve(this,"$$ctor");ve(this,"$$s");ve(this,"$$c");ve(this,"$$cn",!1);ve(this,"$$d",{});ve(this,"$$r",!1);ve(this,"$$p_d",{});ve(this,"$$l",{});ve(this,"$$l_u",new Map);ve(this,"$$me");this.$$ctor=t,this.$$s=r,i&&this.attachShadow({mode:"open"})}addEventListener(t,r,i){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(r),this.$$c){const l=this.$$c.$on(t,r);this.$$l_u.set(r,l)}super.addEventListener(t,r,i)}removeEventListener(t,r,i){if(super.removeEventListener(t,r,i),this.$$c){const l=this.$$l_u.get(r);l&&(l(),this.$$l_u.delete(r))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(l){return o=>{const a=document.createElement("slot");l!=="default"&&(a.name=l),oe(o,a)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const r={},i=yl(this);for(const l of this.$$s)l in i&&(l==="default"&&!this.$$d.children?(this.$$d.children=t(l),r.default=!0):r[l]=t(l));for(const l of this.attributes){const o=this.$$g_p(l.name);o in this.$$d||(this.$$d[o]=Ft(o,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=wl({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:r,$$host:this}}),this.$$me=Oi(()=>{Gt(()=>{var l;this.$$r=!0;for(const o of bt(this.$$c)){if(!((l=this.$$p_d[o])!=null&&l.reflect))continue;this.$$d[o]=this.$$c[o];const a=Ft(o,this.$$d[o],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[o].attribute||o):this.setAttribute(this.$$p_d[o].attribute||o,a)}this.$$r=!1})});for(const l in this.$$l)for(const o of this.$$l[l]){const a=this.$$c.$on(l,o);this.$$l_u.set(o,a)}this.$$l={}}}attributeChangedCallback(t,r,i){var l;this.$$r||(t=this.$$g_p(t),this.$$d[t]=Ft(t,i,this.$$p_d,"toProp"),(l=this.$$c)==null||l.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return bt(this.$$p_d).find(r=>this.$$p_d[r].attribute===t||!this.$$p_d[r].attribute&&r.toLowerCase()===t)||t}});function Ft(e,t,r,i){var o;const l=(o=r[e])==null?void 0:o.type;if(t=l==="Boolean"&&typeof t!="boolean"?t!=null:t,!i||!r[e])return t;if(i==="toAttribute")switch(l){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(l){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function yl(e){const t={};return e.childNodes.forEach(r=>{t[r.slot||"default"]=!0}),t}function bl(e,t,r,i,l,o){let a=class extends pn{constructor(){super(e,r,l),this.$$p_d=t}static get observedAttributes(){return bt(t).map(s=>(t[s].attribute||s).toLowerCase())}};return bt(t).forEach(s=>{Et(a.prototype,s,{get(){return this.$$c&&s in this.$$c?this.$$c[s]:this.$$d[s]},set(f){var v;f=Ft(s,f,t),this.$$d[s]=f;var d=this.$$c;if(d){var h=(v=Pe(d,s))==null?void 0:v.get;h?d[s]=f:d.$set({[s]:f})}}})}),i.forEach(s=>{Et(a.prototype,s,{get(){var f;return(f=this.$$c)==null?void 0:f[s]}})}),e.element=a,a}const yn=new TextEncoder;function El(e){return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")}async function $l(e,t="SHA-256",r=1e5){const i=Date.now().toString(16);e||(e=Math.round(Math.random()*r));const l=await bn(i,e,t);return{algorithm:t,challenge:l,salt:i,signature:""}}async function bn(e,t,r){if(typeof crypto>"u"||!("subtle"in crypto)||!("digest"in crypto.subtle))throw new Error("Web Crypto is not available. Secure context is required (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).");return El(await crypto.subtle.digest(r.toUpperCase(),yn.encode(e+t)))}function kl(e,t,r="SHA-256",i=1e6,l=0){const o=new AbortController,a=Date.now();return{promise:(async()=>{for(let f=l;f<=i;f+=1){if(o.signal.aborted)return null;if(await bn(t,f,r)===e)return{number:f,took:Date.now()-a}}return null})(),controller:o}}function xl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Cl(e){const t=atob(e),r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r}function Al(e,t=12){const r=new Uint8Array(t);for(let i=0;i<t;i++)r[i]=e%256,e=Math.floor(e/256);return r}async function Il(e,t="",r=1e6,i=0){const l="AES-GCM",o=new AbortController,a=Date.now(),s=async()=>{for(let h=i;h<=r;h+=1){if(o.signal.aborted||!f||!d)return null;try{const v=await crypto.subtle.decrypt({name:l,iv:Al(h)},f,d);if(v)return{clearText:new TextDecoder().decode(v),took:Date.now()-a}}catch{}}return null};let f=null,d=null;try{d=Cl(e);const h=await crypto.subtle.digest("SHA-256",yn.encode(t));f=await crypto.subtle.importKey("raw",h,l,!1,["decrypt"])}catch{return{promise:Promise.reject(),controller:o}}return{promise:s(),controller:o}}var p=(e=>(e.ERROR="error",e.VERIFIED="verified",e.VERIFYING="verifying",e.UNVERIFIED="unverified",e.EXPIRED="expired",e))(p||{}),Rl=ll('<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path 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" fill="currentColor" opacity=".25"></path><path 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" fill="currentColor" class="altcha-spinner"></path></svg>'),Sl=me('<span role="status" aria-live="polite"><!></span> <input type="hidden">',1),Tl=me('<span role="status" aria-live="polite"><!></span>'),Nl=me("<label><!></label>"),Ll=me('<div><a target="_blank" class="altcha-logo"><svg width="22" height="22" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path 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" fill="currentColor"></path><path 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" fill="currentColor"></path><path 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" fill="currentColor"></path></svg></a></div>'),Dl=me("<div><!></div>"),Pl=me("<div><!></div>"),Fl=me('<div class="altcha-error"><svg width="14" height="14" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"></path></svg> <!></div>'),Ol=me('<div class="altcha-footer"><div><!></div></div>'),Ml=me('<div class="altcha-anchor-arrow"></div>'),Ul=me('<!> <div class="altcha"><div class="altcha-main"><!> <div><input type="checkbox"></div> <div class="altcha-label"><!></div> <!></div> <!> <!> <!></div>',1);function En(e,t){var ri,ni;tn(t,!0);let r=S(t,"auto",7,void 0),i=S(t,"blockspam",7,void 0),l=S(t,"challengeurl",7,void 0),o=S(t,"challengejson",7,void 0),a=S(t,"customfetch",7,void 0),s=S(t,"debug",7,!1),f=S(t,"delay",7,0),d=S(t,"expire",7,void 0),h=S(t,"floating",7,void 0),v=S(t,"floatinganchor",7,void 0),g=S(t,"floatingoffset",7,void 0),m=S(t,"floatingpersist",7,!1),A=S(t,"hidefooter",7,!1),D=S(t,"hidelogo",7,!1),U=S(t,"id",7,void 0),Z=S(t,"name",7,"altcha"),q=S(t,"maxnumber",7,1e6),z=S(t,"mockerror",7,!1),V=S(t,"obfuscated",7,void 0),je=S(t,"plugins",7,void 0),M=S(t,"refetchonexpire",7,!0),B=S(t,"spamfilter",7,!1),Ee=S(t,"strings",7,void 0),se=S(t,"test",7,!1),Ne=S(t,"verifyurl",7,void 0),Xe=S(t,"workers",23,()=>Math.min(16,navigator.hardwareConcurrency||8)),ct=S(t,"workerurl",7,void 0);const kn=["SHA-256","SHA-384","SHA-512"],xn="Visit Altcha.org",Cn="https://altcha.org/",dt=(n,u)=>{t.$$host.dispatchEvent(new CustomEvent(n,{detail:u}))},An=(ni=(ri=document.documentElement.lang)==null?void 0:ri.split("-"))==null?void 0:ni[0],tr=nt(()=>{var n;return l()&&new URL(l(),location.origin).host.endsWith(".altcha.org")&&!!((n=l())!=null&&n.includes("apiKey=ckey_"))}),rr=nt(()=>o()?Vn(o()):void 0),In=nt(()=>Ee()?Vn(Ee()):{}),fe=nt(()=>{var n;return{ariaLinkLabel:xn,error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by <a href="${Cn}" target="_blank" aria-label="${((n=c(In))==null?void 0:n.ariaLinkLabel)||xn}">ALTCHA</a>`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...c(In)}}),Rn=nt(()=>`${U()||Z()}_checkbox`);let ze=X(!1),T=X(xe(p.UNVERIFIED)),G=X(void 0),vt=X(null),Qe=null,w=null,et=X(null),we=null,Le=[],qe=X(null);Wt(()=>{Zl(c(et))}),Wt(()=>{Gl(c(T))}),_l(()=>{Vl(),w&&(w.removeEventListener("submit",Fn),w.removeEventListener("reset",On),w.removeEventListener("focusin",Pn),w=null),we&&(clearTimeout(we),we=null),document.removeEventListener("click",Ln),document.removeEventListener("scroll",Dn),window.removeEventListener("resize",Un)}),mn(()=>{var n;N("mounted","1.5.1"),N("workers",Xe()),Yl(),N("plugins",Le.length?Le.map(u=>u.constructor.pluginName).join(", "):"none"),se()&&N("using test mode"),d()&&nr(d()),r()!==void 0&&N("auto",r()),h()!==void 0&&jn(h()),w=(n=c(G))==null?void 0:n.closest("form"),w&&(w.addEventListener("submit",Fn,{capture:!0}),w.addEventListener("reset",On),(r()==="onfocus"||m()==="focus")&&w.addEventListener("focusin",Pn)),r()==="onload"&&(V()?ht():De()),c(tr)&&(A()||D())&&N("Attributes hidefooter and hidelogo ignored because usage with free API Keys requires attribution."),requestAnimationFrame(()=>{dt("load")})});function Sn(n,u){return btoa(JSON.stringify({algorithm:n.algorithm,challenge:n.challenge,number:u.number,salt:n.salt,signature:n.signature,test:se()?!0:void 0,took:u.took}))}function Vl(){for(const n of Le)n.destroy()}function Tn(){l()&&M()&&c(T)===p.VERIFIED?De():_t(p.EXPIRED,c(fe).expired)}async function jl(){var n;if(z())throw N("mocking error"),new Error("Mocked error.");if(c(rr))return N("using provided json data"),c(rr);if(se())return N("generating test challenge",{test:se()}),$l(typeof se()!="boolean"?+se():void 0);{if(!l()&&w){const k=w.getAttribute("action");k!=null&&k.includes("/form/")&&l(k+"/altcha")}if(!l())throw new Error("Attribute challengeurl not set.");N("fetching challenge from",l());const u={headers:B()!==!1?{"x-altcha-spam-filter":"1"}:{}},_=await Nn()(l(),u);if(!_||!(_ instanceof Response))throw new Error("Fetch function did not return a response.");if(_.status!==200)throw new Error(`Server responded with ${_.status}.`);const b=_.headers.get("X-Altcha-Config"),L=await _.json(),$=new URLSearchParams((n=L.salt.split("?"))==null?void 0:n[1]),y=$.get("expires")||$.get("expire");if(y){const k=new Date(+y*1e3),$e=isNaN(k.getTime())?0:k.getTime()-Date.now();$e>0&&nr($e)}if(b)try{const k=JSON.parse(b);k&&typeof k=="object"&&("sentinel"in k?alert("This version of the widget is not compatible with Sentinel. Upgrade to version 2.x.x."):(k.verifyurl&&(k.verifyurl=new URL(k.verifyurl,new URL(l())).toString()),Hn(k)))}catch(k){N("unable to configure from X-Altcha-Config",k)}return L}}function ql(n){var _;const u=w==null?void 0:w.querySelector(typeof n=="string"?`input[name="${n}"]`:'input[type="email"]:not([data-no-spamfilter])');return((_=u==null?void 0:u.value)==null?void 0:_.slice(u.value.indexOf("@")))||void 0}function Nn(){let n=fetch;if(a())if(N("using customfetch"),typeof a()=="string"){if(n=globalThis[a()]||null,!n)throw new Error(`Custom fetch function not found: ${a()}`)}else n=a();return n}function Bl(){return B()==="ipAddress"?{blockedCountries:void 0,classifier:void 0,disableRules:void 0,email:!1,expectedCountries:void 0,expectedLanguages:void 0,fields:!1,ipAddress:void 0,text:void 0,timeZone:void 0}:typeof B()=="object"?B():{blockedCountries:void 0,classifier:void 0,disableRules:void 0,email:void 0,expectedCountries:void 0,expectedLanguages:void 0,fields:void 0,ipAddress:void 0,text:void 0,timeZone:void 0}}function Hl(n){return[...(w==null?void 0:w.querySelectorAll(n!=null&&n.length?n.map(_=>`input[name="${_}"]`).join(", "):'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])'))||[]].reduce((_,b)=>{const L=b.name,$=b.value;return L&&$&&(_[L]=/\n/.test($)?$.replace(new RegExp("(?<!\\r)\\n","g"),`\r
3
+ `):$),_},{})}function Yl(){const n=je()!==void 0?je().split(","):void 0;for(const u of globalThis.altchaPlugins)(!n||n.includes(u.pluginName))&&Le.push(new u({el:c(G),clarify:ht,dispatch:dt,getConfiguration:Yn,getFloatingAnchor:Wn,getState:Zn,log:N,reset:_t,solve:Bn,setState:Be,setFloatingAnchor:Jn,verify:De}))}function N(...n){(s()||n.some(u=>u instanceof Error))&&console[n[0]instanceof Error?"error":"log"]("ALTCHA",`[name=${Z()}]`,...n)}function Wl(){[p.UNVERIFIED,p.ERROR,p.EXPIRED].includes(c(T))?B()!==!1&&(w==null?void 0:w.reportValidity())===!1?O(ze,!1):V()?ht():De():O(ze,!0)}function Ln(n){const u=n.target;h()&&u&&!c(G).contains(u)&&(c(T)===p.VERIFIED&&m()===!1||c(T)===p.VERIFIED&&m()==="focus"&&!(w!=null&&w.matches(":focus-within"))||r()==="off"&&c(T)===p.UNVERIFIED)&&Gn()}function Dn(){h()&&c(T)!==p.UNVERIFIED&&gt()}function Zl(n){for(const u of Le)typeof u.onErrorChange=="function"&&u.onErrorChange(c(et))}function Pn(n){c(T)===p.UNVERIFIED?De():h()&&m()==="focus"&&c(T)===p.VERIFIED&&ir()}function Fn(n){w&&r()==="onsubmit"?c(T)===p.UNVERIFIED?(n.preventDefault(),n.stopPropagation(),De().then(()=>{Kl()})):c(T)!==p.VERIFIED&&(n.preventDefault(),n.stopPropagation(),c(T)===p.VERIFYING&&Mn()):w&&h()&&r()==="off"&&c(T)===p.UNVERIFIED&&(n.preventDefault(),n.stopPropagation(),ir())}function On(){_t()}function Mn(){c(T)===p.VERIFYING&&c(fe).waitAlert&&alert(c(fe).waitAlert)}function Gl(n){for(const u of Le)typeof u.onStateChange=="function"&&u.onStateChange(c(T));h()&&c(T)!==p.UNVERIFIED&&requestAnimationFrame(()=>{gt()}),O(ze,c(T)===p.VERIFIED)}function Un(){h()&&gt()}function Vn(n){return JSON.parse(n)}async function Jl(n){if(!Ne())throw new Error("Attribute verifyurl not set.");N("requesting server verification from",Ne());const u={payload:n};if(B()!==!1){const{blockedCountries:L,classifier:$,disableRules:y,email:k,expectedLanguages:$e,expectedCountries:ar,fields:wt,ipAddress:pt,text:fo,timeZone:ii}=Bl();u.blockedCountries=L,u.classifier=$,u.disableRules=y,u.email=k===!1?void 0:ql(k),u.expectedCountries=ar,u.expectedLanguages=$e||(An?[An]:void 0),u.fields=wt===!1?void 0:Hl(wt),u.ipAddress=pt===!1?void 0:pt||"auto",u.text=fo,u.timeZone=ii===!1?void 0:ii||xl()}const _=await Nn()(Ne(),{body:JSON.stringify(u),headers:{"content-type":"application/json"},method:"POST"});if(!_||!(_ instanceof Response))throw new Error("Fetch function did not return a response.");if(_.status!==200)throw new Error(`Server responded with ${_.status}.`);const b=await _.json();if(b!=null&&b.payload&&O(qe,b.payload,!0),dt("serververification",b),i()&&b.classification==="BAD")throw new Error("SpamFilter returned negative classification.")}function Kl(){w&&"requestSubmit"in w?w.requestSubmit():w!=null&&w.reportValidity()&&w.submit()}function nr(n){N("expire",n),we&&(clearTimeout(we),we=null),n<1?Tn():we=setTimeout(Tn,n)}function jn(n){N("floating",n),h()!==n&&(c(G).style.left="",c(G).style.top=""),h(n===!0||n===""?"auto":n===!1||n==="false"?void 0:h()),h()?(r()||r("onsubmit"),document.addEventListener("scroll",Dn),document.addEventListener("click",Ln),window.addEventListener("resize",Un)):r()==="onsubmit"&&r(void 0)}function qn(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(!kn.includes(n.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${kn.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 Bn(n){let u=null;if("Worker"in window){try{u=await Xl(n,n.maxNumber||n.maxnumber||q())}catch(_){N(_)}if((u==null?void 0:u.number)!==void 0||"obfuscated"in n)return{data:n,solution:u}}if("obfuscated"in n){const _=await Il(n.obfuscated,n.key,n.maxNumber||n.maxnumber);return{data:n,solution:await _.promise}}return{data:n,solution:await kl(n.challenge,n.salt,n.algorithm,n.maxNumber||n.maxnumber||q()).promise}}async function Xl(n,u=typeof se()=="number"?se():n.maxNumber||n.maxnumber||q(),_=Math.ceil(Xe())){const b=[];_=Math.min(16,u,Math.max(1,_));for(let y=0;y<_;y++)b.push(altchaCreateWorker(ct()));const L=Math.ceil(u/_),$=await Promise.all(b.map((y,k)=>{const $e=k*L;return new Promise(ar=>{y.addEventListener("message",wt=>{if(wt.data)for(const pt of b)pt!==y&&pt.postMessage({type:"abort"});ar(wt.data)}),y.postMessage({payload:n,max:$e+L,start:$e,type:"work"})})}));for(const y of b)y.terminate();return $.find(y=>!!y)||null}async function ht(){if(!V()){Be(p.ERROR);return}const n=Le.find(u=>u.constructor.pluginName==="obfuscation");if(!n||!("clarify"in n)){Be(p.ERROR),N("Plugin `obfuscation` not found. Import `altcha/plugins/obfuscation` to load it.");return}if("clarify"in n&&typeof n.clarify=="function")return n.clarify()}function Hn(n){n.obfuscated!==void 0&&V(n.obfuscated),n.auto!==void 0&&(r(n.auto),r()==="onload"&&(V()?ht():De())),n.blockspam!==void 0&&i(!!n.blockspam),n.customfetch!==void 0&&a(n.customfetch),n.floatinganchor!==void 0&&v(n.floatinganchor),n.delay!==void 0&&f(n.delay),n.floatingoffset!==void 0&&g(n.floatingoffset),n.floating!==void 0&&jn(n.floating),n.expire!==void 0&&(nr(n.expire),d(n.expire)),n.challenge&&(o(typeof n.challenge=="string"?n.challenge:JSON.stringify(n.challenge)),qn(c(rr))),n.challengeurl!==void 0&&l(n.challengeurl),n.debug!==void 0&&s(!!n.debug),n.hidefooter!==void 0&&A(!!n.hidefooter),n.hidelogo!==void 0&&D(!!n.hidelogo),n.maxnumber!==void 0&&q(+n.maxnumber),n.mockerror!==void 0&&z(!!n.mockerror),n.name!==void 0&&Z(n.name),n.refetchonexpire!==void 0&&M(!!n.refetchonexpire),n.spamfilter!==void 0&&B(typeof n.spamfilter=="object"?n.spamfilter:!!n.spamfilter),n.strings&&Ee(typeof n.strings=="string"?n.strings:JSON.stringify(n.strings)),n.test!==void 0&&se(typeof n.test=="number"?n.test:!!n.test),n.verifyurl!==void 0&&Ne(n.verifyurl),n.workers!==void 0&&Xe(+n.workers),n.workerurl!==void 0&&ct(n.workerurl)}function Yn(){return{auto:r(),blockspam:i(),challengeurl:l(),debug:s(),delay:f(),expire:d(),floating:h(),floatinganchor:v(),floatingoffset:g(),hidefooter:A(),hidelogo:D(),name:Z(),maxnumber:q(),mockerror:z(),obfuscated:V(),refetchonexpire:M(),spamfilter:B(),strings:c(fe),test:se(),verifyurl:Ne(),workers:Xe(),workerurl:ct()}}function Wn(){return Qe}function zl(n){return Le.find(u=>u.constructor.pluginName===n)}function Zn(){return c(T)}function Gn(){c(G).style.display="none"}function gt(n=20){if(c(G))if(Qe||(Qe=(v()?document.querySelector(v()):w==null?void 0:w.querySelector('input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])'))||w),Qe){const u=parseInt(g(),10)||12,_=Qe.getBoundingClientRect(),b=c(G).getBoundingClientRect(),L=document.documentElement.clientHeight,$=document.documentElement.clientWidth,y=h()==="auto"?_.bottom+b.height+u+n>L:h()==="top",k=Math.max(n,Math.min($-n-b.width,_.left+_.width/2-b.width/2));if(y?c(G).style.top=`${_.top-(b.height+u)}px`:c(G).style.top=`${_.bottom+u}px`,c(G).style.left=`${k}px`,c(G).setAttribute("data-floating",y?"top":"bottom"),c(vt)){const $e=c(vt).getBoundingClientRect();c(vt).style.left=_.left-k+_.width/2-$e.width/2+"px"}}else N("unable to find floating anchor element")}function _t(n=p.UNVERIFIED,u=null){we&&(clearTimeout(we),we=null),O(ze,!1),O(qe,null),Be(n,u)}function Jn(n){Qe=n}function Be(n,u=null){O(T,n,!0),O(et,u,!0),dt("statechange",{payload:c(qe),state:c(T)})}function ir(){c(G).style.display="block",h()&&gt()}async function De(){return _t(p.VERIFYING),await new Promise(n=>setTimeout(n,f()||0)),jl().then(n=>(qn(n),N("challenge",n),Bn(n))).then(({data:n,solution:u})=>{if(N("solution",u),!u||n&&"challenge"in n&&!("clearText"in u))if((u==null?void 0:u.number)!==void 0&&"challenge"in n){if(Ne())return Jl(Sn(n,u));O(qe,Sn(n,u),!0),N("payload",c(qe))}else throw N("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."),new Error("Unexpected result returned.")}).then(()=>{Be(p.VERIFIED),N("verified"),Ki().then(()=>{dt("verified",{payload:c(qe)})})}).catch(n=>{N(n),Be(p.ERROR,n.message)})}var Kn=Ul(),Xn=xr(Kn);sl(Xn,t,"default",{});var mt=ye(Xn,2),lr=re(mt),zn=re(lr);{var Ql=n=>{var u=Rl();oe(n,u)};Te(zn,n=>{c(T)===p.VERIFYING&&n(Ql)})}var Ot=ye(zn,2);let Qn;var tt=re(Ot);dn(tt),tt.__change=Wl,te(Ot);var or=ye(Ot,2),eo=re(or);{var to=n=>{var u=Sl(),_=xr(u),b=re(_);Ke(b,()=>c(fe).verified),te(_);var L=ye(_,2);dn(L),Ue(()=>{de(L,"name",Z()),vl(L,c(qe))}),oe(n,u)},ro=(n,u)=>{{var _=L=>{var $=Tl(),y=re($);Ke(y,()=>c(fe).verifying),te($),oe(L,$)},b=L=>{var $=Nl(),y=re($);Ke(y,()=>c(fe).label),te($),Ue(()=>de($,"for",c(Rn))),oe(L,$)};Te(n,L=>{c(T)===p.VERIFYING?L(_):L(b,!1)},u)}};Te(eo,n=>{c(T)===p.VERIFIED?n(to):n(ro,!1)})}te(or);var no=ye(or,2);{var io=n=>{var u=Ll(),_=re(u);de(_,"href",Cn),te(u),Ue(()=>de(_,"aria-label",c(fe).ariaLinkLabel)),oe(n,u)};Te(no,n=>{(D()!==!0||c(tr))&&n(io)})}te(lr);var ei=ye(lr,2);{var lo=n=>{var u=Fl(),_=ye(re(u),2);{var b=$=>{var y=Dl(),k=re(y);Ke(k,()=>c(fe).expired),te(y),Ue(()=>de(y,"title",c(et))),oe($,y)},L=$=>{var y=Pl(),k=re(y);Ke(k,()=>c(fe).error),te(y),Ue(()=>de(y,"title",c(et))),oe($,y)};Te(_,$=>{c(T)===p.EXPIRED?$(b):$(L,!1)})}te(u),oe(n,u)};Te(ei,n=>{(c(et)||c(T)===p.EXPIRED)&&n(lo)})}var ti=ye(ei,2);{var oo=n=>{var u=Ol(),_=re(u),b=re(_);Ke(b,()=>c(fe).footer),te(_),te(u),oe(n,u)};Te(ti,n=>{c(fe).footer&&(A()!==!0||c(tr))&&n(oo)})}var ao=ye(ti,2);{var so=n=>{var u=Ml();_n(u,_=>O(vt,_),()=>c(vt)),oe(n,u)};Te(ao,n=>{h()&&n(so)})}return te(mt),_n(mt,n=>O(G,n),()=>c(G)),Ue(n=>{de(mt,"data-state",c(T)),de(mt,"data-floating",h()),Qn=ul(Ot,1,"altcha-checkbox",null,Qn,n),de(tt,"id",c(Rn)),tt.required=r()!=="onsubmit"&&(!h()||r()!=="off")},[()=>({"altcha-hidden":c(T)===p.VERIFYING})]),nl("invalid",tt,Mn),gl(tt,()=>c(ze),n=>O(ze,n)),oe(e,Kn),rn({clarify:ht,configure:Hn,getConfiguration:Yn,getFloatingAnchor:Wn,getPlugin:zl,getState:Zn,hide:Gn,repositionFloating:gt,reset:_t,setFloatingAnchor:Jn,setState:Be,show:ir,verify:De,get auto(){return r()},set auto(n=void 0){r(n),E()},get blockspam(){return i()},set blockspam(n=void 0){i(n),E()},get challengeurl(){return l()},set challengeurl(n=void 0){l(n),E()},get challengejson(){return o()},set challengejson(n=void 0){o(n),E()},get customfetch(){return a()},set customfetch(n=void 0){a(n),E()},get debug(){return s()},set debug(n=!1){s(n),E()},get delay(){return f()},set delay(n=0){f(n),E()},get expire(){return d()},set expire(n=void 0){d(n),E()},get floating(){return h()},set floating(n=void 0){h(n),E()},get floatinganchor(){return v()},set floatinganchor(n=void 0){v(n),E()},get floatingoffset(){return g()},set floatingoffset(n=void 0){g(n),E()},get floatingpersist(){return m()},set floatingpersist(n=!1){m(n),E()},get hidefooter(){return A()},set hidefooter(n=!1){A(n),E()},get hidelogo(){return D()},set hidelogo(n=!1){D(n),E()},get id(){return U()},set id(n=void 0){U(n),E()},get name(){return Z()},set name(n="altcha"){Z(n),E()},get maxnumber(){return q()},set maxnumber(n=1e6){q(n),E()},get mockerror(){return z()},set mockerror(n=!1){z(n),E()},get obfuscated(){return V()},set obfuscated(n=void 0){V(n),E()},get plugins(){return je()},set plugins(n=void 0){je(n),E()},get refetchonexpire(){return M()},set refetchonexpire(n=!0){M(n),E()},get spamfilter(){return B()},set spamfilter(n=!1){B(n),E()},get strings(){return Ee()},set strings(n=void 0){Ee(n),E()},get test(){return se()},set test(n=!1){se(n),E()},get verifyurl(){return Ne()},set verifyurl(n=void 0){Ne(n),E()},get workers(){return Xe()},set workers(n=Math.min(16,navigator.hardwareConcurrency||8)){Xe(n),E()},get workerurl(){return ct()},set workerurl(n=void 0){ct(n),E()}})}il(["change"]),customElements.define("altcha-widget",bl(En,{blockspam:{type:"Boolean"},debug:{type:"Boolean"},delay:{type:"Number"},expire:{type:"Number"},floatingoffset:{type:"Number"},hidefooter:{type:"Boolean"},hidelogo:{type:"Boolean"},maxnumber:{type:"Number"},mockerror:{type:"Boolean"},refetchonexpire:{type:"Boolean"},test:{type:"Boolean"},workers:{type:"Number"},auto:{},challengeurl:{},challengejson:{},customfetch:{},floating:{},floatinganchor:{},floatingpersist:{},id:{},name:{},obfuscated:{},plugins:{},spamfilter:{},strings:{},verifyurl:{},workerurl:{}},["default"],["clarify","configure","getConfiguration","getFloatingAnchor","getPlugin","getState","hide","repositionFloating","reset","setFloatingAnchor","setState","show","verify"],!1)),globalThis.altchaCreateWorker=e=>new Worker(new URL(e||"./worker.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:C&&C.tagName.toUpperCase()==="SCRIPT"&&C.src||new URL("altcha.umd.cjs",document.baseURI).href)),globalThis.altchaPlugins=globalThis.altchaPlugins||[],x.Altcha=En,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "altcha",
3
3
  "description": "GDPR compliant, self-hosted CAPTCHA alternative.",
4
- "version": "1.4.4",
4
+ "version": "1.5.1",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Daniel Regeci",
@@ -83,19 +83,21 @@
83
83
  "@playwright/test": "^1.49.1",
84
84
  "@sveltejs/vite-plugin-svelte": "^5.0.3",
85
85
  "@tsconfig/svelte": "^5.0.4",
86
+ "@types/csso": "^5.0.4",
86
87
  "@types/node": "^20.16.3",
87
88
  "@types/react": "^19.0.12",
89
+ "csso": "^5.0.5",
88
90
  "husky": "^9.1.5",
89
91
  "prettier": "3.2.5",
90
92
  "prettier-plugin-svelte": "^3.2.6",
91
93
  "rimraf": "^6.0.1",
92
- "rollup-plugin-css-only": "^4.5.2",
93
94
  "sass": "^1.77.8",
94
- "svelte": "^5.22.6",
95
+ "svelte": "^5.28.6",
95
96
  "svelte-check": "^4.0.0",
96
97
  "tslib": "^2.7.0",
97
98
  "typescript": "^5.5.4",
98
- "vite": "^6.2.1",
99
+ "vite": "^6.3.5",
100
+ "vite-plugin-string": "^1.2.3",
99
101
  "vitest": "^3.0.8"
100
102
  },
101
103
  "dependencies": {