/* jshint esversion: 6, sub:true */ function triggerloginlink(eotpareadyform=null){if(window.emailotpauthn_jsvariables.allowloginlinks==0)return true;const urlParams=new URLSearchParams(window.location.search);const normalizedParams=new URLSearchParams(Array.from(urlParams,([eotaprmkey,eotaprmvalue])=>[eotaprmkey.toLowerCase(),eotaprmvalue]));if(eotpareadyform){let eotpaemailid=normalizedParams.get("eotpaemailid");if(eotpaemailid){eotpaemailid=eotpa_decode_urlparams(eotpaemailid).trim();if(eotpa_validate_urlparams(eotpaemailid,true)){if(isElementVisible(eotpareadyform)){setqueryelemattr(eotpareadyform,"#emailotpauthn-form #email",2,eotpaemailid);const generetotp=eotpareadyform.querySelector("#generateOtp");if(generetotp){window.eotpa_generetotp_clicked=true;window.emailotpauthn_is_autotriggered=true;generetotp.click();}}}}}else{let eotpardrcturl=normalizedParams.get("eotpardrcturl");if(eotpardrcturl){eotpardrcturl=eotpa_decode_urlparams(eotpardrcturl).trim();if(eotpa_validate_urlparams(eotpardrcturl,false)){eotpardrcturl=new URL(eotpardrcturl,window.location.origin).href;emailotpauthn_redirect_to_url(eotpardrcturl);return false;}}
return true;}}
function eotpa_decode_urlparams(urlparam){if(typeof urlparam!=="string")return"";for(let i=0;i<3;i++){try{let decoded=decodeURIComponent(urlparam);if(decoded===urlparam)break;urlparam=decoded;}catch{}
try{let decoded=atob(urlparam);if(decoded===urlparam)break;urlparam=decoded;}catch{}}
return urlparam;}
function eotpa_validate_urlparams(entryvalue,is_email){if(!entryvalue)return false;entryvalue=entryvalue.trim();entryvalue=entryvalue.replace(/[\n\r]/g,"");if(is_email){if(entryvalue.length>250)return false;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(entryvalue);}
try{if(entryvalue.length>500)return false;if(entryvalue.length>1&&((entryvalue.charCodeAt(0)==47&&entryvalue.charCodeAt(1)==47)||(entryvalue.charCodeAt(0)==92&&entryvalue.charCodeAt(1)==92)))return false;let uentry=new URL(entryvalue,window.location.origin);if(uentry.protocol!=="http:"&&uentry.protocol!=="https:")return false;return uentry.origin===window.location.origin;}catch{return false;}}