altcha-1.0.0/modules/altcha_obfuscate/assets/vendor/altcha/obfuscation.min.js
modules/altcha_obfuscate/assets/vendor/altcha/obfuscation.min.js
/**
* Minified by jsDelivr using Terser v5.37.0.
* Original file: /gh/altcha-org/altcha@1.0.6/dist_plugins/obfuscation.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
var D=Object.defineProperty,B=t=>{throw TypeError(t)},V=(t,e,a)=>e in t?D(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,f=(t,e,a)=>V(t,"symbol"!=typeof e?e+"":e,a),b=(t,e,a)=>e.has(t)||B("Cannot "+a),p=(t,e,a)=>(b(t,e,"read from private field"),a?a.call(t):e.get(t)),g=(t,e,a)=>e.has(t)?B("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,a),E=(t,e,a)=>(b(t,e,"access private method"),a);class y{constructor(t){this.context=t}static register(t){"object"!=typeof globalThis.altchaPlugins&&(globalThis.altchaPlugins=[]),globalThis.altchaPlugins.includes(t)||globalThis.altchaPlugins.push(t)}destroy(){}onErrorChange(t){}onStateChange(t){}}f(y,"pluginName");var r,a,I,x,l=(t=>(t.ERROR="error",t.VERIFIED="verified",t.VERIFYING="verifying",t.UNVERIFIED="unverified",t.EXPIRED="expired",t))(l||{});class v extends y{constructor(t){var e,n;super(t),g(this,a),f(this,"elButton"),g(this,r,E(this,a,I).bind(this));const i=t.el;this.elButton=(null==(e=i.parentElement)?void 0:e.querySelector("[data-clarify-button]"))||(null==(n=i.parentElement)?void 0:n.querySelector("button, a")),this.elButton&&this.elButton.addEventListener("click",p(this,r))}destroy(){this.elButton&&this.elButton.removeEventListener("click",p(this,r))}async clarify(){const{el:t,getConfiguration:e,getFloatingAnchor:n,setFloatingAnchor:i,reset:o,solve:s,setState:r}=this.context,{delay:c,floating:u,maxnumber:h,obfuscated:d}=e();if(this.elButton&&!n()&&i(this.elButton),!d)return void r(l.ERROR);o(l.VERIFYING),await new Promise((t=>setTimeout(t,c||0)));const[f,p]=d.split("?");let m=new URLSearchParams(p||"").get("key")||void 0;if(m){const t=m.match(/^\(prompt:?(.*)\)$/);t&&(m=prompt(t[1]||"Enter Key:")||void 0)}const{solution:g}=await s({obfuscated:f,key:m,maxnumber:h});g&&"clearText"in g?(E(this,a,x).call(this,g.clearText),r(l.VERIFIED),this.context.dispatch("cleartext",g.clearText),u&&t&&(t.style.display="none")):r(l.ERROR,"Unable to decrypt data.")}}r=new WeakMap,a=new WeakSet,I=function(t){t.preventDefault();const{auto:e}=this.context.getConfiguration();"off"===e||this.clarify()},x=function(t){var e;let a;if(t.match(/^(mailto|tel|sms|https?):/)){const[e]=t.slice(t.indexOf(":")+1).replace(/^\/\//,"").split("?");a=document.createElement("a"),a.href=t,a.innerHTML=e}else a=document.createTextNode(t);this.elButton&&a&&(this.elButton.after(a),null==(e=this.elButton.parentElement)||e.removeChild(this.elButton))},f(v,"pluginName","obfuscation"),y.register(v);export{v as PluginObfuscation};
//# sourceMappingURL=/sm/57171168c9280c8f2be7636e1d7e734fe3ec1b47a2e48b4da6400cb97e547f73.map
