altcha 0.6.7 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -12
- package/dist/altcha.d.ts +2 -0
- package/dist/altcha.js +851 -687
- package/dist/altcha.umd.cjs +2 -2
- package/dist_external/altcha.d.ts +2 -0
- package/dist_external/altcha.js +829 -665
- package/dist_external/altcha.umd.cjs +2 -2
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(O,D){typeof exports=="object"&&typeof module<"u"?D(exports):typeof define=="function"&&define.amd?define(["exports"],D):(O=typeof globalThis<"u"?globalThis:O||self,D(O.altcha={}))})(this,function(O){"use strict";var tn=Object.defineProperty;var nn=(O,D,q)=>D in O?tn(O,D,{enumerable:!0,configurable:!0,writable:!0,value:q}):O[D]=q;var U=(O,D,q)=>nn(O,typeof D!="symbol"?D+"":D,q);var D=typeof document<"u"?document.currentScript:null;function q(){}function $e(n){return n()}function Se(){return Object.create(null)}function se(n){n.forEach($e)}function Te(n){return typeof n=="function"}function ut(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function at(n){return Object.keys(n).length===0}function k(n,e){n.appendChild(e)}function N(n,e,t){n.insertBefore(e,t||null)}function j(n){n.parentNode&&n.parentNode.removeChild(n)}function $(n){return document.createElement(n)}function W(n){return document.createElementNS("http://www.w3.org/2000/svg",n)}function ht(n){return document.createTextNode(n)}function J(){return ht(" ")}function ke(n,e,t,r){return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}function s(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function dt(n){return Array.from(n.childNodes)}function Me(n,e,t){n.classList.toggle(e,!!t)}function gt(n,e,{bubbles:t=!1,cancelable:r=!1}={}){return new CustomEvent(n,{detail:e,bubbles:t,cancelable:r})}function mt(n){const e={};return n.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let fe;function ce(n){fe=n}function pe(){if(!fe)throw new Error("Function called outside component initialization");return fe}function bt(n){pe().$$.on_mount.push(n)}function _t(n){pe().$$.on_destroy.push(n)}function wt(){const n=pe();return(e,t,{cancelable:r=!1}={})=>{const o=n.$$.callbacks[e];if(o){const l=gt(e,t,{cancelable:r});return o.slice().forEach(f=>{f.call(n,l)}),!l.defaultPrevented}return!0}}const re=[],de=[];let oe=[];const je=[],De=Promise.resolve();let Ee=!1;function Ne(){Ee||(Ee=!0,De.then(w))}function yt(){return Ne(),De}function xe(n){oe.push(n)}const Ce=new Set;let le=0;function w(){if(le!==0)return;const n=fe;do{try{for(;le<re.length;){const e=re[le];le++,ce(e),vt(e.$$)}}catch(e){throw re.length=0,le=0,e}for(ce(null),re.length=0,le=0;de.length;)de.pop()();for(let e=0;e<oe.length;e+=1){const t=oe[e];Ce.has(t)||(Ce.add(t),t())}oe.length=0}while(re.length);for(;je.length;)je.pop()();Ee=!1,Ce.clear(),ce(n)}function vt(n){if(n.fragment!==null){n.update(),se(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(xe)}}function kt(n){const e=[],t=[];oe.forEach(r=>n.indexOf(r)===-1?e.push(r):t.push(r)),t.forEach(r=>r()),oe=e}const pt=new Set;function Et(n,e){n&&n.i&&(pt.delete(n),n.i(e))}function xt(n,e,t){const{fragment:r,after_update:o}=n.$$;r&&r.m(e,t),xe(()=>{const l=n.$$.on_mount.map($e).filter(Te);n.$$.on_destroy?n.$$.on_destroy.push(...l):se(l),n.$$.on_mount=[]}),o.forEach(xe)}function Ct(n,e){const t=n.$$;t.fragment!==null&&(kt(t.after_update),se(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Lt(n,e){n.$$.dirty[0]===-1&&(re.push(n),Ne(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function It(n,e,t,r,o,l,f=null,c=[-1]){const h=fe;ce(n);const u=n.$$={fragment:null,ctx:[],props:l,update:q,not_equal:o,bound:Se(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(h?h.$$.context:[])),callbacks:Se(),dirty:c,skip_bound:!1,root:e.target||h.$$.root};f&&f(u.root);let B=!1;if(u.ctx=t?t(n,e.props||{},(T,Z,...H)=>{const p=H.length?H[0]:Z;return u.ctx&&o(u.ctx[T],u.ctx[T]=p)&&(!u.skip_bound&&u.bound[T]&&u.bound[T](p),B&&Lt(n,T)),Z}):[],u.update(),B=!0,se(u.before_update),u.fragment=r?r(u.ctx):!1,e.target){if(e.hydrate){const T=dt(e.target);u.fragment&&u.fragment.l(T),T.forEach(j)}else u.fragment&&u.fragment.c();e.intro&&Et(n.$$.fragment),xt(n,e.target,e.anchor),w()}ce(h)}let Ve;typeof HTMLElement=="function"&&(Ve=class extends HTMLElement{constructor(e,t,r){super();U(this,"$$ctor");U(this,"$$s");U(this,"$$c");U(this,"$$cn",!1);U(this,"$$d",{});U(this,"$$r",!1);U(this,"$$p_d",{});U(this,"$$l",{});U(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,r&&this.attachShadow({mode:"open"})}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const o=this.$$c.$on(e,t);this.$$l_u.set(t,o)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){const o=this.$$l_u.get(t);o&&(o(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(l){return()=>{let f;return{c:function(){f=$("slot"),l!=="default"&&s(f,"name",l)},m:function(u,B){N(u,f,B)},d:function(u){u&&j(f)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},r=mt(this);for(const l of this.$$s)l in r&&(t[l]=[e(l)]);for(const l of this.attributes){const f=this.$$g_p(l.name);f in this.$$d||(this.$$d[f]=ge(f,l.value,this.$$p_d,"toProp"))}for(const l in this.$$p_d)!(l in this.$$d)&&this[l]!==void 0&&(this.$$d[l]=this[l],delete this[l]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$scope:{ctx:[]}}});const o=()=>{this.$$r=!0;for(const l in this.$$p_d)if(this.$$d[l]=this.$$c.$$.ctx[this.$$c.$$.props[l]],this.$$p_d[l].reflect){const f=ge(l,this.$$d[l],this.$$p_d,"toAttribute");f==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,f)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const l in this.$$l)for(const f of this.$$l[l]){const c=this.$$c.$on(l,f);this.$$l_u.set(f,c)}this.$$l={}}}attributeChangedCallback(e,t,r){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=ge(e,r,this.$$p_d,"toProp"),(o=this.$$c)==null||o.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function ge(n,e,t,r){var l;const o=(l=t[n])==null?void 0:l.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!t[n])return e;if(r==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function At(n,e,t,r,o,l){let f=class extends Ve{constructor(){super(n,t,o),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(c=>(e[c].attribute||c).toLowerCase())}};return Object.keys(e).forEach(c=>{Object.defineProperty(f.prototype,c,{get(){return this.$$c&&c in this.$$c?this.$$c[c]:this.$$d[c]},set(h){var u;h=ge(c,h,e),this.$$d[c]=h,(u=this.$$c)==null||u.$set({[c]:h})}})}),r.forEach(c=>{Object.defineProperty(f.prototype,c,{get(){var h;return(h=this.$$c)==null?void 0:h[c]}})}),n.element=f,f}class Rt{constructor(){U(this,"$$");U(this,"$$set")}$destroy(){Ct(this,1),this.$destroy=q}$on(e,t){if(!Te(t))return q;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(t),()=>{const o=r.indexOf(t);o!==-1&&r.splice(o,1)}}$set(e){this.$$set&&!at(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const $t="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add($t);const St=new TextEncoder;function Tt(n){return[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function Mt(n,e="SHA-256",t=1e5){const r=Date.now().toString(16);n||(n=Math.round(Math.random()*t));const o=await Fe(r,n,e);return{algorithm:e,challenge:o,salt:r,signature:""}}async function Fe(n,e,t){return Tt(await crypto.subtle.digest(t.toUpperCase(),St.encode(n+e)))}function jt(n,e,t="SHA-256",r=1e6,o=0){const l=new AbortController,f=Date.now();return{promise:(async()=>{for(let h=o;h<=r;h+=1){if(l.signal.aborted)return null;if(await Fe(e,h,t)===n)return{number:h,took:Date.now()-f}}return null})(),controller:l}}var m=(n=>(n.ERROR="error",n.VERIFIED="verified",n.VERIFYING="verifying",n.UNVERIFIED="unverified",n.EXPIRED="expired",n))(m||{});function Pe(n){let e,t,r;return{c(){e=W("svg"),t=W("path"),r=W("path"),s(t,"d","M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"),s(t,"fill","currentColor"),s(t,"opacity",".25"),s(r,"d","M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"),s(r,"fill","currentColor"),s(r,"class","altcha-spinner"),s(e,"width","24"),s(e,"height","24"),s(e,"viewBox","0 0 24 24"),s(e,"xmlns","http://www.w3.org/2000/svg")},m(o,l){N(o,e,l),k(e,t),k(e,r)},d(o){o&&j(e)}}}function Dt(n){let e,t=n[11].label+"",r;return{c(){e=$("label"),s(e,"for",r=n[4]+"_checkbox")},m(o,l){N(o,e,l),e.innerHTML=t},p(o,l){l[0]&2048&&t!==(t=o[11].label+"")&&(e.innerHTML=t),l[0]&16&&r!==(r=o[4]+"_checkbox")&&s(e,"for",r)},d(o){o&&j(e)}}}function Nt(n){let e,t=n[11].verifying+"";return{c(){e=$("span")},m(r,o){N(r,e,o),e.innerHTML=t},p(r,o){o[0]&2048&&t!==(t=r[11].verifying+"")&&(e.innerHTML=t)},d(r){r&&j(e)}}}function Vt(n){let e,t=n[11].verified+"",r,o;return{c(){e=$("span"),r=J(),o=$("input"),s(o,"type","hidden"),s(o,"name",n[4]),o.value=n[5]},m(l,f){N(l,e,f),e.innerHTML=t,N(l,r,f),N(l,o,f)},p(l,f){f[0]&2048&&t!==(t=l[11].verified+"")&&(e.innerHTML=t),f[0]&16&&s(o,"name",l[4]),f[0]&32&&(o.value=l[5])},d(l){l&&(j(e),j(r),j(o))}}}function He(n){let e,t,r,o,l,f,c;return{c(){e=$("div"),t=$("a"),r=W("svg"),o=W("path"),l=W("path"),f=W("path"),s(o,"d","M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"),s(o,"fill","currentColor"),s(l,"d","M3.57212 2.33956C1.65755 3.94607 0.496389 6.11731 0.12782 8.40523L2.04639 9.13961C2.26047 7.15832 3.21057 5.25375 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577L13.8302 6.78606L19.9633 9.13364C19.7929 7.15555 19.0335 5.20847 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956Z"),s(l,"fill","currentColor"),s(f,"d","M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"),s(f,"fill","currentColor"),s(r,"width","22"),s(r,"height","22"),s(r,"viewBox","0 0 20 20"),s(r,"fill","none"),s(r,"xmlns","http://www.w3.org/2000/svg"),s(t,"href",Ze),s(t,"target","_blank"),s(t,"class","altcha-logo"),s(t,"aria-label",c=n[11].ariaLinkLabel)},m(h,u){N(h,e,u),k(e,t),k(t,r),k(r,o),k(r,l),k(r,f)},p(h,u){u[0]&2048&&c!==(c=h[11].ariaLinkLabel)&&s(t,"aria-label",c)},d(h){h&&j(e)}}}function Oe(n){let e,t,r,o;function l(h,u){return h[6]===m.EXPIRED?Pt:Ft}let f=l(n),c=f(n);return{c(){e=$("div"),t=W("svg"),r=W("path"),o=J(),c.c(),s(r,"stroke-linecap","round"),s(r,"stroke-linejoin","round"),s(r,"d","M6 18L18 6M6 6l12 12"),s(t,"width","14"),s(t,"height","14"),s(t,"xmlns","http://www.w3.org/2000/svg"),s(t,"fill","none"),s(t,"viewBox","0 0 24 24"),s(t,"stroke-width","1.5"),s(t,"stroke","currentColor"),s(e,"class","altcha-error")},m(h,u){N(h,e,u),k(e,t),k(t,r),k(e,o),c.m(e,null)},p(h,u){f===(f=l(h))&&c?c.p(h,u):(c.d(1),c=f(h),c&&(c.c(),c.m(e,null)))},d(h){h&&j(e),c.d()}}}function Ft(n){let e,t=n[11].error+"";return{c(){e=$("div"),s(e,"title",n[10])},m(r,o){N(r,e,o),e.innerHTML=t},p(r,o){o[0]&2048&&t!==(t=r[11].error+"")&&(e.innerHTML=t),o[0]&1024&&s(e,"title",r[10])},d(r){r&&j(e)}}}function Pt(n){let e,t=n[11].expired+"";return{c(){e=$("div"),s(e,"title",n[10])},m(r,o){N(r,e,o),e.innerHTML=t},p(r,o){o[0]&2048&&t!==(t=r[11].expired+"")&&(e.innerHTML=t),o[0]&1024&&s(e,"title",r[10])},d(r){r&&j(e)}}}function Be(n){let e,t,r=n[11].footer+"";return{c(){e=$("div"),t=$("div"),s(e,"class","altcha-footer")},m(o,l){N(o,e,l),k(e,t),t.innerHTML=r},p(o,l){l[0]&2048&&r!==(r=o[11].footer+"")&&(t.innerHTML=r)},d(o){o&&j(e)}}}function Ue(n){let e;return{c(){e=$("div"),s(e,"class","altcha-anchor-arrow")},m(t,r){N(t,e,r),n[37](e)},p:q,d(t){t&&j(e),n[37](null)}}}function Ht(n){let e,t,r,o,l,f,c,h,u,B,T,Z,H,p,z,S=n[6]===m.VERIFYING&&Pe();function Q(d,_){return d[6]===m.VERIFIED?Vt:d[6]===m.VERIFYING?Nt:Dt}let X=Q(n),V=X(n),x=(n[3]!==!0||n[12])&&He(n),I=(n[10]||n[6]===m.EXPIRED)&&Oe(n),A=n[11].footer&&(n[2]!==!0||n[12])&&Be(n),y=n[1]&&Ue(n);return{c(){e=$("div"),t=$("div"),S&&S.c(),r=J(),o=$("div"),l=$("input"),h=J(),u=$("div"),V.c(),B=J(),x&&x.c(),T=J(),I&&I.c(),Z=J(),A&&A.c(),H=J(),y&&y.c(),s(l,"type","checkbox"),s(l,"id",f=n[4]+"_checkbox"),l.required=c=n[0]!=="onsubmit",s(o,"class","altcha-checkbox"),Me(o,"altcha-hidden",n[6]===m.VERIFYING),s(u,"class","altcha-label"),s(t,"class","altcha-main"),s(e,"class","altcha"),s(e,"data-state",n[6]),s(e,"data-floating",n[1])},m(d,_){N(d,e,_),k(e,t),S&&S.m(t,null),k(t,r),k(t,o),k(o,l),l.checked=n[7],k(t,h),k(t,u),V.m(u,null),k(t,B),x&&x.m(t,null),k(e,T),I&&I.m(e,null),k(e,Z),A&&A.m(e,null),k(e,H),y&&y.m(e,null),n[38](e),p||(z=[ke(l,"change",n[36]),ke(l,"change",n[13]),ke(l,"invalid",n[14])],p=!0)},p(d,_){d[6]===m.VERIFYING?S||(S=Pe(),S.c(),S.m(t,r)):S&&(S.d(1),S=null),_[0]&16&&f!==(f=d[4]+"_checkbox")&&s(l,"id",f),_[0]&1&&c!==(c=d[0]!=="onsubmit")&&(l.required=c),_[0]&128&&(l.checked=d[7]),_[0]&64&&Me(o,"altcha-hidden",d[6]===m.VERIFYING),X===(X=Q(d))&&V?V.p(d,_):(V.d(1),V=X(d),V&&(V.c(),V.m(u,null))),d[3]!==!0||d[12]?x?x.p(d,_):(x=He(d),x.c(),x.m(t,null)):x&&(x.d(1),x=null),d[10]||d[6]===m.EXPIRED?I?I.p(d,_):(I=Oe(d),I.c(),I.m(e,Z)):I&&(I.d(1),I=null),d[11].footer&&(d[2]!==!0||d[12])?A?A.p(d,_):(A=Be(d),A.c(),A.m(e,H)):A&&(A.d(1),A=null),d[1]?y?y.p(d,_):(y=Ue(d),y.c(),y.m(e,null)):y&&(y.d(1),y=null),_[0]&64&&s(e,"data-state",d[6]),_[0]&2&&s(e,"data-floating",d[1])},i:q,o:q,d(d){d&&j(e),S&&S.d(),V.d(),x&&x.d(),I&&I.d(),A&&A.d(),y&&y.d(),n[38](null),p=!1,se(z)}}}const qe="Visit Altcha.org",Ze="https://altcha.org/";function Ye(n){return JSON.parse(n)}function Ot(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Bt(n,e,t){var ft,ct;let r,o,l,f,{auto:c=void 0}=e,{blockspam:h=void 0}=e,{challengeurl:u=void 0}=e,{challengejson:B=void 0}=e,{debug:T=!1}=e,{delay:Z=0}=e,{expire:H=void 0}=e,{floating:p=void 0}=e,{floatinganchor:z=void 0}=e,{floatingoffset:S=void 0}=e,{hidefooter:Q=!1}=e,{hidelogo:X=!1}=e,{name:V="altcha"}=e,{maxnumber:x=1e6}=e,{mockerror:I=!1}=e,{refetchonexpire:A=!0}=e,{spamfilter:y=!1}=e,{strings:d=void 0}=e,{test:_=!1}=e,{verifyurl:ee=void 0}=e,{workers:ue=Math.min(16,navigator.hardwareConcurrency||8)}=e,{workerurl:me=void 0}=e;const Le=wt(),We=["SHA-256","SHA-384","SHA-512"],Xe=(ct=(ft=document.documentElement.lang)==null?void 0:ft.split("-"))==null?void 0:ct[0];let K=!1,C,te=null,be=null,b=null,Ie=null,ne=null,F=m.UNVERIFIED,Y=null;_t(()=>{b&&(b.removeEventListener("submit",ze),b.removeEventListener("reset",Ke),b.removeEventListener("focusin",Je),b=null),Y&&(clearTimeout(Y),Y=null),document.removeEventListener("click",nt),document.removeEventListener("scroll",it),window.removeEventListener("resize",ot)}),bt(()=>{E("mounted","0.6.7"),E("workers",ue),_&&E("using test mode"),H&&_e(H),c!==void 0&&E("auto",c),p!==void 0&<(p),b=C.closest("form"),b&&(b.addEventListener("submit",ze,{capture:!0}),b.addEventListener("reset",Ke),c==="onfocus"&&b.addEventListener("focusin",Je)),c==="onload"&&ie(),r&&(Q||X)&&E("Attributes hidefooter and hidelogo ignored because usage with free API Keys require attribution.")});function E(...i){(T||i.some(a=>a instanceof Error))&&console[i[0]instanceof Error?"error":"log"]("ALTCHA",...i)}function Je(i){F===m.UNVERIFIED&&ie()}function ze(i){b&&c==="onsubmit"&&(F===m.UNVERIFIED?(i.preventDefault(),i.stopPropagation(),ie().then(()=>{b==null||b.requestSubmit()})):F!==m.VERIFIED&&(i.preventDefault(),i.stopPropagation(),F===m.VERIFYING&&rt()))}function Ke(){we()}function Qe(i,a){return btoa(JSON.stringify({algorithm:i.algorithm,challenge:i.challenge,number:a.number,salt:i.salt,signature:i.signature,test:_?!0:void 0,took:a.took}))}function et(i){if(!i.algorithm)throw new Error("Invalid challenge. Property algorithm is missing.");if(i.signature===void 0)throw new Error("Invalid challenge. Property signature is missing.");if(!We.includes(i.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${We.join(", ")}`);if(!i.challenge||i.challenge.length<40)throw new Error("Challenge is too short. Min. 40 chars.");if(!i.salt||i.salt.length<10)throw new Error("Salt is too short. Min. 10 chars.")}async function Ut(){var i;if(I)throw E("mocking error"),new Error("Mocked error.");if(o)return E("using provided json data"),o;if(_)return E("generating test challenge",{test:_}),Mt(typeof _!="boolean"?+_:void 0);{if(!u)throw new Error("Attribute challengeurl not set.");E("fetching challenge from",u);const a=await fetch(u,{headers:{"x-altcha-spam-filter":y?"1":"0"}});if(a.status!==200)throw new Error(`Server responded with ${a.status}.`);const g=a.headers.get("Expires"),R=a.headers.get("X-Altcha-Config"),P=await a.json(),M=new URLSearchParams((i=P.salt.split("?"))==null?void 0:i[1]),G=M.get("expires")||M.get("expire");if(G){const v=new Date(+G*1e3),L=isNaN(v.getTime())?0:v.getTime()-Date.now();L>0&&_e(L)}if(R)try{const v=JSON.parse(R);v&&typeof v=="object"&&(v.verifyurl&&(v.verifyurl=new URL(v.verifyurl,new URL(u)).toString()),st(v))}catch(v){E("unable to configure from X-Altcha-Config",v)}if(!H&&(g!=null&&g.length)){const v=Date.parse(g);if(v){const L=v-Date.now();L>0&&_e(L)}}return P}}function tt(){u&&A&&F===m.VERIFIED?ie():we(m.EXPIRED,f.expired)}async function qt(i){let a=null;if("Worker"in window){try{a=await Zt(i.challenge,i.salt,i.algorithm,i.maxnumber)}catch(g){E(g)}if((a==null?void 0:a.number)!==void 0)return{data:i,solution:a}}return{data:i,solution:await jt(i.challenge,i.salt,i.algorithm,i.maxnumber||x).promise}}async function Zt(i,a,g,R=typeof _=="number"?_:x,P=Math.ceil(ue)){const M=[];P=Math.min(16,Math.max(1,P));for(let L=0;L<P;L++)M.push(createAltchaWorker(me));const G=Math.ceil(R/P),v=await Promise.all(M.map((L,Re)=>{const ae=Re*G;return new Promise(ye=>{L.addEventListener("message",ve=>{if(ve.data)for(const he of M)he!==L&&he.postMessage({type:"abort"});ye(ve.data)}),L.postMessage({payload:{alg:g,challenge:i,max:ae+G,salt:a,start:ae},type:"work"})})}));for(const L of M)L.terminate();return v.find(L=>!!L)||null}function Yt(){[m.UNVERIFIED,m.ERROR,m.EXPIRED].includes(F)?y&&(b==null?void 0:b.reportValidity())===!1?t(7,K=!1):ie():t(7,K=!0)}function nt(i){const a=i.target;p&&a&&!C.contains(a)&&F===m.VERIFIED&&t(8,C.style.display="none",C)}function it(){p&&Ae()}function rt(){F===m.VERIFYING&&f.waitAlert&&alert(f.waitAlert)}function Gt(i){p&&F!==m.UNVERIFIED&&requestAnimationFrame(()=>{Ae()})}function ot(){p&&Ae()}function _e(i){E("expire",i),Y&&(clearTimeout(Y),Y=null),i<1?tt():Y=setTimeout(tt,i)}function lt(i){E("floating",i),p!==i&&(t(8,C.style.left="",C),t(8,C.style.top="",C)),t(1,p=i===!0||i===""?"auto":i===!1||i==="false"?void 0:p),p?(c||t(0,c="onsubmit"),document.addEventListener("scroll",it),document.addEventListener("click",nt),window.addEventListener("resize",ot)):c==="onsubmit"&&t(0,c=void 0)}function Wt(i){var g;const a=b==null?void 0:b.querySelector(typeof i=="string"?`input[name="${i}"]`:'input[type="email"]:not([data-no-spamfilter])');return((g=a==null?void 0:a.value)==null?void 0:g.slice(a.value.indexOf("@")))||void 0}function Xt(i){return[...(b==null?void 0:b.querySelectorAll(i!=null&&i.length?i.map(g=>`input[name="${g}"]`).join(", "):'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])'))||[]].reduce((g,R)=>{const P=R.name,M=R.value;return P&&M&&(g[P]=/\n/.test(M)?M.replace(new RegExp("(?<!\\r)\\n","g"),`\r
|
|
2
|
-
`):
|
|
1
|
+
(function(m,v){typeof exports=="object"&&typeof module<"u"?v(exports):typeof define=="function"&&define.amd?define(["exports"],v):(m=typeof globalThis<"u"?globalThis:m||self,v(m.altcha={}))})(this,function(m){"use strict";var kn=Object.defineProperty;var Lt=m=>{throw TypeError(m)};var pn=(m,v,A)=>v in m?kn(m,v,{enumerable:!0,configurable:!0,writable:!0,value:A}):m[v]=A;var j=(m,v,A)=>pn(m,typeof v!="symbol"?v+"":v,A),It=(m,v,A)=>v.has(m)||Lt("Cannot "+A);var $=(m,v,A)=>(It(m,v,"read from private field"),A?A.call(m):v.get(m)),le=(m,v,A)=>v.has(m)?Lt("Cannot add the same private member more than once"):v instanceof WeakSet?v.add(m):v.set(m,A),xt=(m,v,A,de)=>(It(m,v,"write to private field"),de?de.call(m,A):v.set(m,A),A);var ue,he,we,_e,ye,ve;var v=typeof document<"u"?document.currentScript:null;function A(){}function de(i){return i()}function He(){return Object.create(null)}function ge(i){i.forEach(de)}function $e(i){return typeof i=="function"}function Tt(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Rt(i){return Object.keys(i).length===0}function L(i,e){i.appendChild(e)}function V(i,e,t){i.insertBefore(e,t||null)}function D(i){i.parentNode&&i.parentNode.removeChild(i)}function R(i){return document.createElement(i)}function z(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function qe(i){return document.createTextNode(i)}function K(){return qe(" ")}function Ft(){return qe("")}function De(i,e,t,r){return i.addEventListener(e,t,r),()=>i.removeEventListener(e,t,r)}function f(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function St(i){return Array.from(i.childNodes)}function Ze(i,e,t){i.classList.toggle(e,!!t)}function Mt(i,e,{bubbles:t=!1,cancelable:r=!1}={}){return new CustomEvent(i,{detail:e,bubbles:t,cancelable:r})}function Dt(i){const e={};return i.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let me;function be(i){me=i}function Ne(){if(!me)throw new Error("Function called outside component initialization");return me}function Nt(i){Ne().$$.on_mount.push(i)}function jt(i){Ne().$$.on_destroy.push(i)}function Vt(){const i=Ne();return(e,t,{cancelable:r=!1}={})=>{const o=i.$$.callbacks[e];if(o){const s=Mt(e,t,{cancelable:r});return o.slice().forEach(u=>{u.call(i,s)}),!s.defaultPrevented}return!0}}const fe=[],Ce=[];let ae=[];const Ye=[],Ge=Promise.resolve();let je=!1;function Je(){je||(je=!0,Ge.then(k))}function Ut(){return Je(),Ge}function Ve(i){ae.push(i)}const Ue=new Set;let ce=0;function k(){if(ce!==0)return;const i=me;do{try{for(;ce<fe.length;){const e=fe[ce];ce++,be(e),Pt(e.$$)}}catch(e){throw fe.length=0,ce=0,e}for(be(null),fe.length=0,ce=0;Ce.length;)Ce.pop()();for(let e=0;e<ae.length;e+=1){const t=ae[e];Ue.has(t)||(Ue.add(t),t())}ae.length=0}while(fe.length);for(;Ye.length;)Ye.pop()();je=!1,Ue.clear(),be(i)}function Pt(i){if(i.fragment!==null){i.update(),ge(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(Ve)}}function Bt(i){const e=[],t=[];ae.forEach(r=>i.indexOf(r)===-1?e.push(r):t.push(r)),t.forEach(r=>r()),ae=e}const Ot=new Set;function Ht(i,e){i&&i.i&&(Ot.delete(i),i.i(e))}function $t(i,e,t){const{fragment:r,after_update:o}=i.$$;r&&r.m(e,t),Ve(()=>{const s=i.$$.on_mount.map(de).filter($e);i.$$.on_destroy?i.$$.on_destroy.push(...s):ge(s),i.$$.on_mount=[]}),o.forEach(Ve)}function qt(i,e){const t=i.$$;t.fragment!==null&&(Bt(t.after_update),ge(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Zt(i,e){i.$$.dirty[0]===-1&&(fe.push(i),Je(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function Yt(i,e,t,r,o,s,u=null,a=[-1]){const l=me;be(i);const c=i.$$={fragment:null,ctx:[],props:s,update:A,not_equal:o,bound:He(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:He(),dirty:a,skip_bound:!1,root:e.target||l.$$.root};u&&u(c.root);let q=!1;if(c.ctx=t?t(i,e.props||{},(w,Z,...Y)=>{const G=Y.length?Y[0]:Z;return c.ctx&&o(c.ctx[w],c.ctx[w]=G)&&(!c.skip_bound&&c.bound[w]&&c.bound[w](G),q&&Zt(i,w)),Z}):[],c.update(),q=!0,ge(c.before_update),c.fragment=r?r(c.ctx):!1,e.target){if(e.hydrate){const w=St(e.target);c.fragment&&c.fragment.l(w),w.forEach(D)}else c.fragment&&c.fragment.c();e.intro&&Ht(i.$$.fragment),$t(i,e.target,e.anchor),k()}be(l)}let Xe;typeof HTMLElement=="function"&&(Xe=class extends HTMLElement{constructor(e,t,r){super();j(this,"$$ctor");j(this,"$$s");j(this,"$$c");j(this,"$$cn",!1);j(this,"$$d",{});j(this,"$$r",!1);j(this,"$$p_d",{});j(this,"$$l",{});j(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,r&&this.attachShadow({mode:"open"})}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const o=this.$$c.$on(e,t);this.$$l_u.set(t,o)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){const o=this.$$l_u.get(t);o&&(o(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(s){return()=>{let u;return{c:function(){u=R("slot"),s!=="default"&&f(u,"name",s)},m:function(c,q){V(c,u,q)},d:function(c){c&&D(u)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},r=Dt(this);for(const s of this.$$s)s in r&&(t[s]=[e(s)]);for(const s of this.attributes){const u=this.$$g_p(s.name);u in this.$$d||(this.$$d[u]=Ae(u,s.value,this.$$p_d,"toProp"))}for(const s in this.$$p_d)!(s in this.$$d)&&this[s]!==void 0&&(this.$$d[s]=this[s],delete this[s]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$scope:{ctx:[]}}});const o=()=>{this.$$r=!0;for(const s in this.$$p_d)if(this.$$d[s]=this.$$c.$$.ctx[this.$$c.$$.props[s]],this.$$p_d[s].reflect){const u=Ae(s,this.$$d[s],this.$$p_d,"toAttribute");u==null?this.removeAttribute(this.$$p_d[s].attribute||s):this.setAttribute(this.$$p_d[s].attribute||s,u)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const s in this.$$l)for(const u of this.$$l[s]){const a=this.$$c.$on(s,u);this.$$l_u.set(u,a)}this.$$l={}}}attributeChangedCallback(e,t,r){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Ae(e,r,this.$$p_d,"toProp"),(o=this.$$c)==null||o.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function Ae(i,e,t,r){var s;const o=(s=t[i])==null?void 0:s.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!t[i])return e;if(r==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function Gt(i,e,t,r,o,s){let u=class extends Xe{constructor(){super(i,t,o),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(a=>(e[a].attribute||a).toLowerCase())}};return Object.keys(e).forEach(a=>{Object.defineProperty(u.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(l){var c;l=Ae(a,l,e),this.$$d[a]=l,(c=this.$$c)==null||c.$set({[a]:l})}})}),r.forEach(a=>{Object.defineProperty(u.prototype,a,{get(){var l;return(l=this.$$c)==null?void 0:l[a]}})}),i.element=u,u}class Jt{constructor(){j(this,"$$");j(this,"$$set")}$destroy(){qt(this,1),this.$destroy=A}$on(e,t){if(!$e(t))return A;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(t),()=>{const o=r.indexOf(t);o!==-1&&r.splice(o,1)}}$set(e){this.$$set&&!Rt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Xt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Xt);const Wt=new TextEncoder;function zt(i){return[...new Uint8Array(i)].map(e=>e.toString(16).padStart(2,"0")).join("")}async function Kt(i,e="SHA-256",t=1e5){const r=Date.now().toString(16);i||(i=Math.round(Math.random()*t));const o=await We(r,i,e);return{algorithm:e,challenge:o,salt:r,signature:""}}async function We(i,e,t){return zt(await crypto.subtle.digest(t.toUpperCase(),Wt.encode(i+e)))}function Qt(i,e,t="SHA-256",r=1e6,o=0){const s=new AbortController,u=Date.now();return{promise:(async()=>{for(let l=o;l<=r;l+=1){if(s.signal.aborted)return null;if(await We(e,l,t)===i)return{number:l,took:Date.now()-u}}return null})(),controller:s}}function ze(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}class en{constructor(e){j(this,"beaconUrl",null);j(this,"error",null);j(this,"loadTime",Date.now());j(this,"submitTime",null);j(this,"startTime",null);j(this,"viewTimeThresholdMs",1500);le(this,ue,{});le(this,he,null);le(this,we,this.onFormChange.bind(this));le(this,_e,this.onFormFocus.bind(this));le(this,ye,this.onFormSubmit.bind(this));le(this,ve,this.onUnload.bind(this));this.elForm=e,window.addEventListener("unload",$(this,ve)),this.elForm.addEventListener("change",$(this,we)),this.elForm.addEventListener("focusin",$(this,_e)),this.elForm.addEventListener("submit",$(this,ye))}data(){const e=Object.entries($(this,ue));return{correction:e.length&&e.filter(([t,r])=>r>1).length/e.length||0,dropoff:!this.submitTime&&!this.error&&$(this,he)?$(this,he):null,error:this.error,mobile:this.isMobile(),start:this.startTime,submit:this.submitTime,tz:ze()}}dataAsBase64(){try{return btoa(JSON.stringify(this.data()))}catch(e){console.error("failed to encode ALTCHA session data to base64",e)}return""}destroy(){window.removeEventListener("unload",$(this,ve)),this.elForm.removeEventListener("change",$(this,we)),this.elForm.removeEventListener("focusin",$(this,_e)),this.elForm.removeEventListener("submit",$(this,ye))}end(){this.submitTime||(this.submitTime=Date.now())}getFieldName(e,t=40){const r=e.getAttribute("data-group-label"),o=e.getAttribute("name")||e.getAttribute("aria-label");return((r?r+": ":"")+o).slice(0,t)}isMobile(){const e="userAgentData"in navigator&&navigator.userAgentData?navigator.userAgentData:{};return"mobile"in e?e.mobile===!0:/Mobi/i.test(window.navigator.userAgent)}isInput(e){return["INPUT","SELECT","TEXTAREA"].includes(e.tagName)}onFormFieldChange(e){const t=this.getFieldName(e);t&&this.trackFieldChange(t)}onFormChange(e){const t=e.target;t&&this.isInput(t)&&this.onFormFieldChange(t)}onFormFocus(e){const t=e.target;if(this.startTime||this.start(),t&&this.isInput(t)){const r=this.getFieldName(t);r&&xt(this,he,r)}}onFormSubmit(){this.end()}onUnload(){this.loadTime<=Date.now()-this.viewTimeThresholdMs&&!this.submitTime&&this.sendBeacon()}async sendBeacon(){if(this.beaconUrl&&"sendBeacon"in navigator)try{navigator.sendBeacon(new URL(this.beaconUrl,location.origin),JSON.stringify(this.data()))}catch{}}start(){this.startTime=Date.now()}trackError(e){this.error=e===null?null:String(e)}trackFieldChange(e){$(this,ue)[e]=($(this,ue)[e]||0)+1}}ue=new WeakMap,he=new WeakMap,we=new WeakMap,_e=new WeakMap,ye=new WeakMap,ve=new WeakMap;var b=(i=>(i.ERROR="error",i.VERIFIED="verified",i.VERIFYING="verifying",i.UNVERIFIED="unverified",i.EXPIRED="expired",i))(b||{});function Ke(i){let e,t,r;return{c(){e=z("svg"),t=z("path"),r=z("path"),f(t,"d","M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"),f(t,"fill","currentColor"),f(t,"opacity",".25"),f(r,"d","M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"),f(r,"fill","currentColor"),f(r,"class","altcha-spinner"),f(e,"width","24"),f(e,"height","24"),f(e,"viewBox","0 0 24 24"),f(e,"xmlns","http://www.w3.org/2000/svg")},m(o,s){V(o,e,s),L(e,t),L(e,r)},d(o){o&&D(e)}}}function tn(i){let e,t=i[13].label+"",r;return{c(){e=R("label"),f(e,"for",r=i[4]+"_checkbox")},m(o,s){V(o,e,s),e.innerHTML=t},p(o,s){s[0]&8192&&t!==(t=o[13].label+"")&&(e.innerHTML=t),s[0]&16&&r!==(r=o[4]+"_checkbox")&&f(e,"for",r)},d(o){o&&D(e)}}}function nn(i){let e,t=i[13].verifying+"";return{c(){e=R("span")},m(r,o){V(r,e,o),e.innerHTML=t},p(r,o){o[0]&8192&&t!==(t=r[13].verifying+"")&&(e.innerHTML=t)},d(r){r&&D(e)}}}function rn(i){let e,t=i[13].verified+"",r,o,s,u,a=i[11]&&Qe(i);return{c(){e=R("span"),r=K(),o=R("input"),s=K(),a&&a.c(),u=Ft(),f(o,"type","hidden"),f(o,"name",i[4]),o.value=i[6]},m(l,c){V(l,e,c),e.innerHTML=t,V(l,r,c),V(l,o,c),V(l,s,c),a&&a.m(l,c),V(l,u,c)},p(l,c){c[0]&8192&&t!==(t=l[13].verified+"")&&(e.innerHTML=t),c[0]&16&&f(o,"name",l[4]),c[0]&64&&(o.value=l[6]),l[11]?a?a.p(l,c):(a=Qe(l),a.c(),a.m(u.parentNode,u)):a&&(a.d(1),a=null)},d(l){l&&(D(e),D(r),D(o),D(s),D(u)),a&&a.d(l)}}}function Qe(i){let e;return{c(){e=R("input"),f(e,"type","hidden"),f(e,"name","__session"),e.value=i[12]},m(t,r){V(t,e,r)},p(t,r){r[0]&4096&&(e.value=t[12])},d(t){t&&D(e)}}}function et(i){let e,t,r,o,s,u,a;return{c(){e=R("div"),t=R("a"),r=z("svg"),o=z("path"),s=z("path"),u=z("path"),f(o,"d","M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"),f(o,"fill","currentColor"),f(s,"d","M3.57212 2.33956C1.65755 3.94607 0.496389 6.11731 0.12782 8.40523L2.04639 9.13961C2.26047 7.15832 3.21057 5.25375 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577L13.8302 6.78606L19.9633 9.13364C19.7929 7.15555 19.0335 5.20847 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956Z"),f(s,"fill","currentColor"),f(u,"d","M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"),f(u,"fill","currentColor"),f(r,"width","22"),f(r,"height","22"),f(r,"viewBox","0 0 20 20"),f(r,"fill","none"),f(r,"xmlns","http://www.w3.org/2000/svg"),f(t,"href",ot),f(t,"target","_blank"),f(t,"class","altcha-logo"),f(t,"aria-label",a=i[13].ariaLinkLabel)},m(l,c){V(l,e,c),L(e,t),L(t,r),L(r,o),L(r,s),L(r,u)},p(l,c){c[0]&8192&&a!==(a=l[13].ariaLinkLabel)&&f(t,"aria-label",a)},d(l){l&&D(e)}}}function tt(i){let e,t,r,o;function s(l,c){return l[7]===b.EXPIRED?sn:on}let u=s(i),a=u(i);return{c(){e=R("div"),t=z("svg"),r=z("path"),o=K(),a.c(),f(r,"stroke-linecap","round"),f(r,"stroke-linejoin","round"),f(r,"d","M6 18L18 6M6 6l12 12"),f(t,"width","14"),f(t,"height","14"),f(t,"xmlns","http://www.w3.org/2000/svg"),f(t,"fill","none"),f(t,"viewBox","0 0 24 24"),f(t,"stroke-width","1.5"),f(t,"stroke","currentColor"),f(e,"class","altcha-error")},m(l,c){V(l,e,c),L(e,t),L(t,r),L(e,o),a.m(e,null)},p(l,c){u===(u=s(l))&&a?a.p(l,c):(a.d(1),a=u(l),a&&(a.c(),a.m(e,null)))},d(l){l&&D(e),a.d()}}}function on(i){let e,t=i[13].error+"";return{c(){e=R("div"),f(e,"title",i[5])},m(r,o){V(r,e,o),e.innerHTML=t},p(r,o){o[0]&8192&&t!==(t=r[13].error+"")&&(e.innerHTML=t),o[0]&32&&f(e,"title",r[5])},d(r){r&&D(e)}}}function sn(i){let e,t=i[13].expired+"";return{c(){e=R("div"),f(e,"title",i[5])},m(r,o){V(r,e,o),e.innerHTML=t},p(r,o){o[0]&8192&&t!==(t=r[13].expired+"")&&(e.innerHTML=t),o[0]&32&&f(e,"title",r[5])},d(r){r&&D(e)}}}function nt(i){let e,t,r=i[13].footer+"";return{c(){e=R("div"),t=R("div"),f(e,"class","altcha-footer")},m(o,s){V(o,e,s),L(e,t),t.innerHTML=r},p(o,s){s[0]&8192&&r!==(r=o[13].footer+"")&&(t.innerHTML=r)},d(o){o&&D(e)}}}function it(i){let e;return{c(){e=R("div"),f(e,"class","altcha-anchor-arrow")},m(t,r){V(t,e,r),i[41](e)},p:A,d(t){t&&D(e),i[41](null)}}}function ln(i){let e,t,r,o,s,u,a,l,c,q,w,Z,Y,G,Q,_=i[7]===b.VERIFYING&&Ke();function te(d,p){return d[7]===b.VERIFIED?rn:d[7]===b.VERIFYING?nn:tn}let ee=te(i),P=ee(i),F=(i[3]!==!0||i[14])&&et(i),N=(i[5]||i[7]===b.EXPIRED)&&tt(i),I=i[13].footer&&(i[2]!==!0||i[14])&&nt(i),S=i[1]&&it(i);return{c(){e=R("div"),t=R("div"),_&&_.c(),r=K(),o=R("div"),s=R("input"),l=K(),c=R("div"),P.c(),q=K(),F&&F.c(),w=K(),N&&N.c(),Z=K(),I&&I.c(),Y=K(),S&&S.c(),f(s,"type","checkbox"),f(s,"id",u=i[4]+"_checkbox"),s.required=a=i[0]!=="onsubmit",f(o,"class","altcha-checkbox"),Ze(o,"altcha-hidden",i[7]===b.VERIFYING),f(c,"class","altcha-label"),f(t,"class","altcha-main"),f(e,"class","altcha"),f(e,"data-state",i[7]),f(e,"data-floating",i[1])},m(d,p){V(d,e,p),L(e,t),_&&_.m(t,null),L(t,r),L(t,o),L(o,s),s.checked=i[8],L(t,l),L(t,c),P.m(c,null),L(t,q),F&&F.m(t,null),L(e,w),N&&N.m(e,null),L(e,Z),I&&I.m(e,null),L(e,Y),S&&S.m(e,null),i[42](e),G||(Q=[De(s,"change",i[40]),De(s,"change",i[15]),De(s,"invalid",i[16])],G=!0)},p(d,p){d[7]===b.VERIFYING?_||(_=Ke(),_.c(),_.m(t,r)):_&&(_.d(1),_=null),p[0]&16&&u!==(u=d[4]+"_checkbox")&&f(s,"id",u),p[0]&1&&a!==(a=d[0]!=="onsubmit")&&(s.required=a),p[0]&256&&(s.checked=d[8]),p[0]&128&&Ze(o,"altcha-hidden",d[7]===b.VERIFYING),ee===(ee=te(d))&&P?P.p(d,p):(P.d(1),P=ee(d),P&&(P.c(),P.m(c,null))),d[3]!==!0||d[14]?F?F.p(d,p):(F=et(d),F.c(),F.m(t,null)):F&&(F.d(1),F=null),d[5]||d[7]===b.EXPIRED?N?N.p(d,p):(N=tt(d),N.c(),N.m(e,Z)):N&&(N.d(1),N=null),d[13].footer&&(d[2]!==!0||d[14])?I?I.p(d,p):(I=nt(d),I.c(),I.m(e,Y)):I&&(I.d(1),I=null),d[1]?S?S.p(d,p):(S=it(d),S.c(),S.m(e,null)):S&&(S.d(1),S=null),p[0]&128&&f(e,"data-state",d[7]),p[0]&2&&f(e,"data-floating",d[1])},i:A,o:A,d(d){d&&D(e),_&&_.d(),P.d(),F&&F.d(),N&&N.d(),I&&I.d(),S&&S.d(),i[42](null),G=!1,ge(Q)}}}const rt="Visit Altcha.org",ot="https://altcha.org/";function st(i){return JSON.parse(i)}function fn(i,e,t){var Ct,At;let r,o,s,u,{analytics:a=!1}=e,{auto:l=void 0}=e,{beaconurl:c=void 0}=e,{blockspam:q=void 0}=e,{challengeurl:w=void 0}=e,{challengejson:Z=void 0}=e,{debug:Y=!1}=e,{delay:G=0}=e,{expire:Q=void 0}=e,{floating:_=void 0}=e,{floatinganchor:te=void 0}=e,{floatingoffset:ee=void 0}=e,{hidefooter:P=!1}=e,{hidelogo:F=!1}=e,{name:N="altcha"}=e,{maxnumber:I=1e6}=e,{mockerror:S=!1}=e,{refetchonexpire:d=!0}=e,{spamfilter:p=!1}=e,{strings:Le=void 0}=e,{test:J=!1}=e,{verifyurl:ie=void 0}=e,{workers:Ee=Math.min(16,navigator.hardwareConcurrency||8)}=e,{workerurl:Ie=void 0}=e;const Pe=Vt(),ft=["SHA-256","SHA-384","SHA-512"],at=(At=(Ct=document.documentElement.lang)==null?void 0:Ct.split("-"))==null?void 0:At[0];let ne=!1,x,re=null,xe=null,g=null,Te=null,X=null,oe=null,B=null,ct=null,O=b.UNVERIFIED;jt(()=>{g&&(g.removeEventListener("submit",ht),g.removeEventListener("reset",dt),g.removeEventListener("focusin",ut),g=null),B&&B.destroy(),X&&(clearTimeout(X),X=null),document.removeEventListener("click",_t),document.removeEventListener("scroll",yt),window.removeEventListener("resize",Et)}),Nt(()=>{C("mounted","0.7.0"),C("workers",Ee),J&&C("using test mode"),Q&&Re(Q),l!==void 0&&C("auto",l),_!==void 0&&kt(_),g=x.closest("form"),g&&(g.addEventListener("submit",ht,{capture:!0}),g.addEventListener("reset",dt),l==="onfocus"&&g.addEventListener("focusin",ut)),a&&bt(),l==="onload"&&se(),r&&(P||F)&&C("Attributes hidefooter and hidelogo ignored because usage with free API Keys require attribution.")});function C(...n){(Y||n.some(h=>h instanceof Error))&&console[n[0]instanceof Error?"error":"log"]("ALTCHA",...n)}function ut(n){O===b.UNVERIFIED&&se()}function ht(n){g&&B&&O===b.VERIFIED&&(B.end(),t(12,ct=B.dataAsBase64())),g&&l==="onsubmit"&&(O===b.UNVERIFIED?(n.preventDefault(),n.stopPropagation(),se().then(()=>{g==null||g.requestSubmit()})):O!==b.VERIFIED&&(n.preventDefault(),n.stopPropagation(),O===b.VERIFYING&&vt()))}function dt(){Fe()}function gt(n,h){return btoa(JSON.stringify({algorithm:n.algorithm,challenge:n.challenge,number:h.number,salt:n.salt,signature:n.signature,test:J?!0:void 0,took:h.took}))}function mt(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(!ft.includes(n.algorithm.toUpperCase()))throw new Error(`Unknown algorithm value. Allowed values: ${ft.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 an(){var n;if(S)throw C("mocking error"),new Error("Mocked error.");if(o)return C("using provided json data"),o;if(J)return C("generating test challenge",{test:J}),Kt(typeof J!="boolean"?+J:void 0);{if(!w&&g){const E=g.getAttribute("action");E!=null&&E.includes("/form/")&&t(17,w=E+"/altcha")}if(!w)throw new Error("Attribute challengeurl not set.");C("fetching challenge from",w);const h=await fetch(w,{headers:p?{"x-altcha-spam-filter":"1"}:{}});if(h.status!==200)throw new Error(`Server responded with ${h.status}.`);const y=h.headers.get("Expires"),M=h.headers.get("X-Altcha-Config"),H=await h.json(),U=new URLSearchParams((n=H.salt.split("?"))==null?void 0:n[1]),W=U.get("expires")||U.get("expire");if(W){const E=new Date(+W*1e3),T=isNaN(E.getTime())?0:E.getTime()-Date.now();T>0&&Re(T)}if(M)try{const E=JSON.parse(M);E&&typeof E=="object"&&(E.verifyurl&&(E.verifyurl=new URL(E.verifyurl,new URL(w)).toString()),pt(E))}catch(E){C("unable to configure from X-Altcha-Config",E)}if(!Q&&(y!=null&&y.length)){const E=Date.parse(y);if(E){const T=E-Date.now();T>0&&Re(T)}}return H}}function bt(){if(!B)if(g){if(C("analytics enabled"),t(11,B=new en(g)),c===void 0){const n=g.getAttribute("action");n&&t(19,c=n+"/beacon")}t(11,B.beaconUrl=c||null,B)}else C("analytics cannot be enabled - form element not found")}function wt(){w&&d&&O===b.VERIFIED?se():Fe(b.EXPIRED,u.expired)}async function cn(n){let h=null;if("Worker"in window){try{h=await un(n.challenge,n.salt,n.algorithm,n.maxnumber)}catch(y){C(y)}if((h==null?void 0:h.number)!==void 0)return{data:n,solution:h}}return{data:n,solution:await Qt(n.challenge,n.salt,n.algorithm,n.maxnumber||I).promise}}async function un(n,h,y,M=typeof J=="number"?J:I,H=Math.ceil(Ee)){const U=[];H=Math.min(16,Math.max(1,H));for(let T=0;T<H;T++)U.push(createAltchaWorker(Ie));const W=Math.ceil(M/H),E=await Promise.all(U.map((T,Oe)=>{const ke=Oe*W;return new Promise(Se=>{T.addEventListener("message",Me=>{if(Me.data)for(const pe of U)pe!==T&&pe.postMessage({type:"abort"});Se(Me.data)}),T.postMessage({payload:{alg:y,challenge:n,max:ke+W,salt:h,start:ke},type:"work"})})}));for(const T of U)T.terminate();return E.find(T=>!!T)||null}function hn(){[b.UNVERIFIED,b.ERROR,b.EXPIRED].includes(O)?p&&(g==null?void 0:g.reportValidity())===!1?t(8,ne=!1):se():t(8,ne=!0)}function _t(n){const h=n.target;_&&h&&!x.contains(h)&&O===b.VERIFIED&&t(9,x.style.display="none",x)}function yt(){_&&Be()}function vt(){O===b.VERIFYING&&u.waitAlert&&alert(u.waitAlert)}function dn(n){B&&B.trackError(Te)}function gn(n){_&&O!==b.UNVERIFIED&&requestAnimationFrame(()=>{Be()})}function Et(){_&&Be()}function Re(n){C("expire",n),X&&(clearTimeout(X),X=null),n<1?wt():X=setTimeout(wt,n)}function kt(n){C("floating",n),_!==n&&(t(9,x.style.left="",x),t(9,x.style.top="",x)),t(1,_=n===!0||n===""?"auto":n===!1||n==="false"?void 0:_),_?(l||t(0,l="onsubmit"),document.addEventListener("scroll",yt),document.addEventListener("click",_t),window.addEventListener("resize",Et)):l==="onsubmit"&&t(0,l=void 0)}function mn(n){var y;const h=g==null?void 0:g.querySelector(typeof n=="string"?`input[name="${n}"]`:'input[type="email"]:not([data-no-spamfilter])');return((y=h==null?void 0:h.value)==null?void 0:y.slice(h.value.indexOf("@")))||void 0}function bn(n){return[...(g==null?void 0:g.querySelectorAll(n!=null&&n.length?n.map(y=>`input[name="${y}"]`).join(", "):'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])'))||[]].reduce((y,M)=>{const H=M.name,U=M.value;return H&&U&&(y[H]=/\n/.test(U)?U.replace(new RegExp("(?<!\\r)\\n","g"),`\r
|
|
2
|
+
`):U),y},{})}async function wn(n){if(!ie)throw new Error("Attribute verifyurl not set.");C("requesting server verification from",ie);const h={payload:n};if(p){const{blockedCountries:H,classifier:U,disableRules:W,email:E,expectedLanguages:T,expectedCountries:Oe,fields:ke,ipAddress:Se,text:Me,timeZone:pe}=_n();h.blockedCountries=H,h.classifier=U,h.disableRules=W,h.email=E===!1?void 0:mn(E),h.expectedCountries=Oe,h.expectedLanguages=T||(at?[at]:void 0),h.fields=ke===!1?void 0:bn(ke),h.ipAddress=Se===!1?void 0:Se||"auto",h.text=Me,h.timeZone=pe===!1?void 0:pe||ze()}const y=await fetch(ie,{body:JSON.stringify(h),headers:{"content-type":"application/json"},method:"POST"});if(y.status!==200)throw new Error(`Server responded with ${y.status}.`);const M=await y.json();if(M!=null&&M.payload&&t(6,oe=M.payload),Pe("serververification",M),q&&M.classification==="BAD")throw new Error("SpamFilter returned negative classification.")}function _n(){return p==="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 p=="object"?p:{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 Be(n=20){if(x)if(xe||(xe=(te?document.querySelector(te):g==null?void 0:g.querySelector('input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])'))||g),xe){const h=parseInt(ee,10)||12,y=xe.getBoundingClientRect(),M=x.getBoundingClientRect(),H=document.documentElement.clientHeight,U=document.documentElement.clientWidth,W=_==="auto"?y.bottom+M.height+h+n>H:_==="top",E=Math.max(n,Math.min(U-n-M.width,y.left+y.width/2-M.width/2));if(W?t(9,x.style.top=`${y.top-(M.height+h)}px`,x):t(9,x.style.top=`${y.bottom+h}px`,x),t(9,x.style.left=`${E}px`,x),x.setAttribute("data-floating",W?"top":"bottom"),re){const T=re.getBoundingClientRect();t(10,re.style.left=y.left-E+y.width/2-T.width/2+"px",re)}}else C("unable to find floating anchor element")}function pt(n){n.analytics&&(t(18,a=n.analytics),bt()),n.auto!==void 0&&(t(0,l=n.auto),l==="onload"&&se()),n.beaconurl&&(t(19,c=n.beaconurl),B&&t(11,B.beaconUrl=c,B)),n.floatinganchor!==void 0&&t(23,te=n.floatinganchor),n.delay!==void 0&&t(21,G=n.delay),n.floatingoffset!==void 0&&t(24,ee=n.floatingoffset),n.floating!==void 0&&kt(n.floating),n.expire!==void 0&&(Re(n.expire),t(22,Q=n.expire)),n.challenge&&(mt(n.challenge),o=n.challenge),n.challengeurl!==void 0&&t(17,w=n.challengeurl),n.debug!==void 0&&t(20,Y=!!n.debug),n.hidefooter!==void 0&&t(2,P=!!n.hidefooter),n.hidelogo!==void 0&&t(3,F=!!n.hidelogo),n.maxnumber!==void 0&&t(25,I=+n.maxnumber),n.mockerror!==void 0&&t(26,S=!!n.mockerror),n.name!==void 0&&t(4,N=n.name),n.refetchonexpire!==void 0&&t(27,d=!!n.refetchonexpire),n.spamfilter!==void 0&&t(28,p=typeof n.spamfilter=="object"?n.spamfilter:!!n.spamfilter),n.strings&&t(39,s=n.strings),n.test!==void 0&&t(29,J=typeof n.test=="number"?n.test:!!n.test),n.verifyurl!==void 0&&t(30,ie=n.verifyurl),n.workers!==void 0&&t(31,Ee=+n.workers),n.workerurl!==void 0&&t(32,Ie=n.workerurl)}function Fe(n=b.UNVERIFIED,h=null){X&&(clearTimeout(X),X=null),t(8,ne=!1),t(5,Te=h),t(6,oe=null),t(7,O=n)}async function se(){return Fe(b.VERIFYING),await new Promise(n=>setTimeout(n,G||0)),an().then(n=>(mt(n),C("challenge",n),cn(n))).then(({data:n,solution:h})=>{if(C("solution",h),(h==null?void 0:h.number)!==void 0){if(ie)return wn(gt(n,h));t(6,oe=gt(n,h)),C("payload",oe)}else throw C("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."),new Error("Unexpected result returned.")}).then(()=>{Ut().then(()=>{t(7,O=b.VERIFIED),t(8,ne=!0),C("verified"),Pe("verified",{payload:oe})})}).catch(n=>{C(n),t(7,O=b.ERROR),t(8,ne=!1),t(5,Te=n.message)})}function yn(){ne=this.checked,t(8,ne)}function vn(n){Ce[n?"unshift":"push"](()=>{re=n,t(10,re)})}function En(n){Ce[n?"unshift":"push"](()=>{x=n,t(9,x)})}return i.$$set=n=>{"analytics"in n&&t(18,a=n.analytics),"auto"in n&&t(0,l=n.auto),"beaconurl"in n&&t(19,c=n.beaconurl),"blockspam"in n&&t(33,q=n.blockspam),"challengeurl"in n&&t(17,w=n.challengeurl),"challengejson"in n&&t(34,Z=n.challengejson),"debug"in n&&t(20,Y=n.debug),"delay"in n&&t(21,G=n.delay),"expire"in n&&t(22,Q=n.expire),"floating"in n&&t(1,_=n.floating),"floatinganchor"in n&&t(23,te=n.floatinganchor),"floatingoffset"in n&&t(24,ee=n.floatingoffset),"hidefooter"in n&&t(2,P=n.hidefooter),"hidelogo"in n&&t(3,F=n.hidelogo),"name"in n&&t(4,N=n.name),"maxnumber"in n&&t(25,I=n.maxnumber),"mockerror"in n&&t(26,S=n.mockerror),"refetchonexpire"in n&&t(27,d=n.refetchonexpire),"spamfilter"in n&&t(28,p=n.spamfilter),"strings"in n&&t(35,Le=n.strings),"test"in n&&t(29,J=n.test),"verifyurl"in n&&t(30,ie=n.verifyurl),"workers"in n&&t(31,Ee=n.workers),"workerurl"in n&&t(32,Ie=n.workerurl)},i.$$.update=()=>{i.$$.dirty[0]&131072&&t(14,r=!!(w!=null&&w.includes(".altcha.org"))&&!!(w!=null&&w.includes("apiKey=ckey_"))),i.$$.dirty[1]&8&&(o=Z?st(Z):void 0),i.$$.dirty[1]&16&&t(39,s=Le?st(Le):{}),i.$$.dirty[1]&256&&t(13,u={ariaLinkLabel:rt,error:"Verification failed. Try again later.",expired:"Verification expired. Try again.",footer:`Protected by <a href="${ot}" target="_blank" aria-label="${s.ariaLinkLabel||rt}">ALTCHA</a>`,label:"I'm not a robot",verified:"Verified",verifying:"Verifying...",waitAlert:"Verifying... please wait.",...s}),i.$$.dirty[0]&192&&Pe("statechange",{payload:oe,state:O}),i.$$.dirty[0]&32&&dn(),i.$$.dirty[0]&128&&gn()},[l,_,P,F,N,Te,oe,O,ne,x,re,B,ct,u,r,hn,vt,w,a,c,Y,G,Q,te,ee,I,S,d,p,J,ie,Ee,Ie,q,Z,Le,pt,Fe,se,s,yn,vn,En]}class lt extends Jt{constructor(e){super(),Yt(this,e,fn,ln,Tt,{analytics:18,auto:0,beaconurl:19,blockspam:33,challengeurl:17,challengejson:34,debug:20,delay:21,expire:22,floating:1,floatinganchor:23,floatingoffset:24,hidefooter:2,hidelogo:3,name:4,maxnumber:25,mockerror:26,refetchonexpire:27,spamfilter:28,strings:35,test:29,verifyurl:30,workers:31,workerurl:32,configure:36,reset:37,verify:38},null,[-1,-1,-1])}get analytics(){return this.$$.ctx[18]}set analytics(e){this.$$set({analytics:e}),k()}get auto(){return this.$$.ctx[0]}set auto(e){this.$$set({auto:e}),k()}get beaconurl(){return this.$$.ctx[19]}set beaconurl(e){this.$$set({beaconurl:e}),k()}get blockspam(){return this.$$.ctx[33]}set blockspam(e){this.$$set({blockspam:e}),k()}get challengeurl(){return this.$$.ctx[17]}set challengeurl(e){this.$$set({challengeurl:e}),k()}get challengejson(){return this.$$.ctx[34]}set challengejson(e){this.$$set({challengejson:e}),k()}get debug(){return this.$$.ctx[20]}set debug(e){this.$$set({debug:e}),k()}get delay(){return this.$$.ctx[21]}set delay(e){this.$$set({delay:e}),k()}get expire(){return this.$$.ctx[22]}set expire(e){this.$$set({expire:e}),k()}get floating(){return this.$$.ctx[1]}set floating(e){this.$$set({floating:e}),k()}get floatinganchor(){return this.$$.ctx[23]}set floatinganchor(e){this.$$set({floatinganchor:e}),k()}get floatingoffset(){return this.$$.ctx[24]}set floatingoffset(e){this.$$set({floatingoffset:e}),k()}get hidefooter(){return this.$$.ctx[2]}set hidefooter(e){this.$$set({hidefooter:e}),k()}get hidelogo(){return this.$$.ctx[3]}set hidelogo(e){this.$$set({hidelogo:e}),k()}get name(){return this.$$.ctx[4]}set name(e){this.$$set({name:e}),k()}get maxnumber(){return this.$$.ctx[25]}set maxnumber(e){this.$$set({maxnumber:e}),k()}get mockerror(){return this.$$.ctx[26]}set mockerror(e){this.$$set({mockerror:e}),k()}get refetchonexpire(){return this.$$.ctx[27]}set refetchonexpire(e){this.$$set({refetchonexpire:e}),k()}get spamfilter(){return this.$$.ctx[28]}set spamfilter(e){this.$$set({spamfilter:e}),k()}get strings(){return this.$$.ctx[35]}set strings(e){this.$$set({strings:e}),k()}get test(){return this.$$.ctx[29]}set test(e){this.$$set({test:e}),k()}get verifyurl(){return this.$$.ctx[30]}set verifyurl(e){this.$$set({verifyurl:e}),k()}get workers(){return this.$$.ctx[31]}set workers(e){this.$$set({workers:e}),k()}get workerurl(){return this.$$.ctx[32]}set workerurl(e){this.$$set({workerurl:e}),k()}get configure(){return this.$$.ctx[36]}get reset(){return this.$$.ctx[37]}get verify(){return this.$$.ctx[38]}}customElements.define("altcha-widget",Gt(lt,{analytics:{type:"Boolean"},auto:{},beaconurl:{},blockspam:{},challengeurl:{},challengejson:{},debug:{type:"Boolean"},delay:{},expire:{},floating:{},floatinganchor:{},floatingoffset:{},hidefooter:{type:"Boolean"},hidelogo:{type:"Boolean"},name:{},maxnumber:{},mockerror:{type:"Boolean"},refetchonexpire:{type:"Boolean"},spamfilter:{type:"Boolean"},strings:{},test:{type:"Boolean"},verifyurl:{},workers:{},workerurl:{}},[],["configure","reset","verify"],!1)),globalThis.createAltchaWorker=i=>new Worker(new URL(i||"./worker.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:v&&v.src||new URL("altcha.umd.cjs",document.baseURI).href)),m.Altcha=lt,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|