// source --> https://watsu.fr/wp-content/plugins/content-protector/assets/public/passster-public.min.js?ver=4.2.29 
jQuery(document).ready(function(s){let a=window.ps_ajax||{};function e(){switch(ps_ajax.cookie_duration_unit){case"days":return parseInt(ps_ajax.cookie_duration);case"hours":return new Date((new Date).getTime()+10*ps_ajax.cookie_duration*60*1e3);case"minutes":return new Date((new Date).getTime()+60*ps_ajax.cookie_duration*1e3);default:return parseInt(ps_ajax.cookie_duration)}}function r(){var t="pts="+Math.floor(Date.now()/1e3);return location.origin+location.pathname+(location.search?location.search+"&"+t:"?"+t)+(location.hash||"")}function i(t){s.ajax({type:"post",dataType:"json",url:ps_ajax.ajax_url,data:{action:"hash_password",hash_nonce:a.hash_nonce,password:t},success(t){Cookies.set("passster",t.password,{expires:e(),sameSite:"strict"})},async:!1})}fetch(ps_ajax.rest_url+"passster/v1/nonces",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"}}).then(t=>t.json()).then(t=>{a=t}).catch(()=>{}),ps_ajax.link_pass&&!ps_ajax.disable_cookie&&(ps_ajax.link_pass.length<25?i(atob(ps_ajax.link_pass)):Cookies.set("passster",ps_ajax.link_pass,{expires:e(),sameSite:"strict"}),window.location.replace(ps_ajax.permalink+"?pts="+Math.floor(Date.now()/1e3))),s(".passster-submit").on("click",function(t){t.preventDefault();let e=s(this).parent().parent();s(e)[0].checkValidity()||s(e)[0].reportValidity(),ps_id=s(this).attr("data-psid"),e=s("#"+ps_id),password=s("#"+ps_id+" .passster-password").attr("data-password"),type=s("#"+ps_id+" .passster-password").attr("data-protection-type"),list=s("#"+ps_id+" .passster-password").attr("data-list"),lists=s("#"+ps_id+" .passster-password").attr("data-lists"),area=s("#"+ps_id+" .passster-password").attr("data-area"),protection=s("#"+ps_id+" .passster-password").attr("data-protection"),redirect=s(this).attr("data-redirect"),input=s("#"+ps_id+" .passster-password").val(),acf=s(this).attr("data-acf"),s.ajax({type:"post",dataType:"json",url:ps_ajax.ajax_url,data:{action:"validate_input",nonce:a.nonce,input:input,password:password,post_id:ps_ajax.post_id,type:type,list:list,lists:lists,area:area,protection:protection,acf:acf,redirect:redirect},beforeSend(){e.find(".ps-loader").css("display","block")},success(t){if(e.find(".ps-loader").css("display","none"),!0===t.success)if(ps_ajax.unlock_mode){ps_ajax.disable_cookie||i(input),e.find(".passster-error").hide();let a=t.content;a&&(s.each(ps_ajax.shortcodes,function(t,e){a=a.replace(t,e)}),s("#"+ps_id).replaceWith(a)),t.redirect&&window.location.replace(redirect)}else i(input),t.redirect?window.location.replace(redirect):window.location.href=r();else e.find(".passster-error").text(t.error),e.find(".passster-error").show().fadeOut(3500),s("#"+ps_id+" .passster-password").val("")}})}),0<s(".recaptcha-form-v2").length&&grecaptcha.ready(function(){grecaptcha.render("ps-recaptcha-v2",{sitekey:ps_ajax.recaptcha_key,callback(t){ps_id=s(".recaptcha-v2-submit").attr("data-psid"),form=s("#"+ps_id),protection=s(".recaptcha-v2-submit").attr("data-protection"),acf=s(".recaptcha-v2-submit").attr("data-acf"),area=s("#"+ps_id).find(".recaptcha-v2-submit").attr("data-area"),redirect=s("#"+ps_id).find(".recaptcha-v2-submit").attr("data-redirect"),s.ajax({type:"post",dataType:"json",url:ps_ajax.ajax_url,data:{action:"validate_input",nonce:a.nonce,token:t,post_id:ps_ajax.post_id,type:"recaptcha",protection:protection,captcha_id:ps_id,acf:acf,area:area,redirect:redirect},success(t){if(!0===t.success)if(ps_ajax.unlock_mode){ps_ajax.disable_cookie||Cookies.set("passster","recaptcha",{expires:e(),sameSite:"strict"}),form.find(".passster-error").hide();let a=t.content;a&&(s.each(ps_ajax.shortcodes,function(t,e){a=a.replace(t,e)}),s("#"+ps_id).replaceWith(a)),t.redirect&&window.location.replace(redirect)}else Cookies.set("passster","recaptcha",{expires:e(),sameSite:"strict"}),t.redirect?window.location.replace(redirect):window.location.href=r();else form.find(".passster-error").text(t.error),form.find(".passster-error").show().fadeOut(3500)}})}})}),s(".recaptcha-form").on("submit",function(t){t.preventDefault(),ps_id=s(this).find(".passster-submit-recaptcha").attr("data-psid"),form=s("#"+ps_id),protection=s(this).find(".passster-submit-recaptcha").attr("data-protection"),acf=s(this).find(".passster-submit-recaptcha").attr("data-acf"),area=s(this).find(".passster-submit-recaptcha").attr("data-area"),redirect=s(this).find(".passster-submit-recaptcha").attr("data-redirect"),grecaptcha.ready(function(){grecaptcha.execute(ps_ajax.recaptcha_key,{action:"validate_input"}).then(function(t){form.prepend('<input type="hidden" name="token" value="'+t+'">'),form.prepend('<input type="hidden" name="action" value="validate_input">'),s.ajax({type:"post",dataType:"json",url:ps_ajax.ajax_url,data:{action:"validate_input",nonce:a.nonce,token:t,post_id:ps_ajax.post_id,type:"recaptcha",protection:protection,captcha_id:ps_id,acf:acf,area:area,redirect:redirect},success(t){if(!0===t.success)if(ps_ajax.unlock_mode){ps_ajax.disable_cookie||Cookies.set("passster","recaptcha",{expires:e(),sameSite:"strict"}),form.find(".passster-error").hide();let a=t.content;a&&(s.each(ps_ajax.shortcodes,function(t,e){a=a.replace(t,e)}),form.replaceWith(a)),t.redirect&&window.location.replace(redirect)}else Cookies.set("passster","recaptcha",{expires:e(),sameSite:"strict"}),t.redirect?window.location.replace(redirect):window.location.href=r();else form.find(".passster-error").text(t.error),form.find(".passster-error").show().fadeOut(3500)}})})})}),s(".hcaptcha-form").on("submit",function(t){t.preventDefault(),ps_id=s(this).find(".passster-submit-recaptcha").attr("data-psid"),form=s("#"+ps_id),protection=s(this).find(".passster-submit-recaptcha").attr("data-protection"),acf=s(this).find(".passster-submit-recaptcha").attr("data-acf"),area=s(this).find(".passster-submit-recaptcha").attr("data-area"),redirect=s(this).find(".passster-submit-recaptcha").attr("data-redirect"),hcaptcha.execute({async:!0}).then(({response:t})=>{s.ajax({type:"post",dataType:"json",url:ps_ajax.ajax_url,data:{action:"validate_input",nonce:a.nonce,token:t,post_id:ps_ajax.post_id,type:"recaptcha",protection:protection,captcha_id:ps_id,acf:acf,area:area,redirect:redirect},success(t){if(!0===t.success)if(ps_ajax.unlock_mode){ps_ajax.disable_cookie||Cookies.set("passster","recaptcha",{expires:e(),sameSite:"strict"}),form.find(".passster-error").hide();let a=t.content;a&&(s.each(ps_ajax.shortcodes,function(t,e){a=a.replace(t,e)}),form.replaceWith(a)),t.redirect&&window.location.replace(redirect)}else Cookies.set("passster","recaptcha",{expires:e(),sameSite:"strict"}),t.redirect?window.location.replace(redirect):window.location.href=r();else form.find(".passster-error").text(t.error),form.find(".passster-error").show().fadeOut(3500)}})}).catch(t=>{form.find(".passster-error").text(t),form.find(".passster-error").show().fadeOut(3500)})}),0<s(".turnstile-form").length&&window.turnstile.ready(function(){window.turnstile.render(".passster-turnstile",{sitekey:ps_ajax.turnstile_key,callback(t){ps_id=s(this).find(".passster-submit-turnstile").attr("data-psid"),form=s("#"+ps_id),protection=s(this).find(".passster-submit-turnstile").attr("data-protection"),acf=s(this).find(".passster-submit-turnstile").attr("data-acf"),area=s(this).find(".passster-submit-turnstile").attr("data-area"),redirect=s(this).find(".passster-submit-turnstile").attr("data-redirect"),s.ajax({type:"post",dataType:"json",url:ps_ajax.ajax_url,data:{action:"validate_input",nonce:a.nonce,token:t,post_id:ps_ajax.post_id,type:"turnstile",protection:protection,captcha_id:ps_id,acf:acf,area:area,redirect:redirect},success(t){if(!0===t.success)if(ps_ajax.unlock_mode){ps_ajax.disable_cookie||Cookies.set("passster","turnstile",{expires:e(),sameSite:"strict"}),form.find(".passster-error").hide();let a=t.content;a&&(s.each(ps_ajax.shortcodes,function(t,e){a=a.replace(t,e)}),s("#"+ps_id).replaceWith(a)),t.redirect&&window.location.replace(redirect)}else Cookies.set("passster","turnstile",{expires:e(),sameSite:"strict"}),t.redirect?window.location.replace(redirect):window.location.href=r();else form.find(".passster-error").text(t.error),form.find(".passster-error").show().fadeOut(3500)}})}})}),s(document).on("click","#ps-logout",function(){s.ajax({type:"post",dataType:"json",url:ps_ajax.ajax_url,data:{action:"handle_logout",logout_nonce:a.logout_nonce},success(t){!0===t.success&&(Cookies.set("passster","",{expires:0,sameSite:"strict"}),window.location.href=r())}})})});