// source --> https://vytvarnalitomysl.cz/wp-content/plugins/content-protector/assets/public/passster-public.min.js?ver=4.2.15 
jQuery(document).ready(function(s){function a(){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 e(){return location.search?location.origin.concat(location.pathname).concat(location.hash)+location.search+"&pts="+Math.floor(Date.now()/1e3):location.origin.concat(location.pathname).concat(location.hash)+"?pts="+Math.floor(Date.now()/1e3)}function r(t){s.ajax({type:"post",dataType:"json",url:ps_ajax.ajax_url,data:{action:"hash_password",hash_nonce:ps_ajax.hash_nonce,password:t},success:function(t){Cookies.set("passster",t.password,{expires:a(),sameSite:"strict"})},async:!1})}ps_ajax.link_pass&&!ps_ajax.disable_cookie&&(ps_ajax.link_pass.length<25?r(atob(ps_ajax.link_pass)):Cookies.set("passster",ps_ajax.link_pass,{expires:a(),sameSite:"strict"}),window.location.replace(ps_ajax.permalink+"?pts="+Math.floor(Date.now()/1e3))),s(".passster-submit").on("click",function(t){t.preventDefault();var a=s(this).parent().parent();s(a)[0].checkValidity()||s(a)[0].reportValidity(),ps_id=s(this).attr("data-psid"),a=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:ps_ajax.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:function(){a.find(".ps-loader").css("display","block")},success:function(t){if(a.find(".ps-loader").css("display","none"),!0===t.success)if(ps_ajax.unlock_mode){ps_ajax.disable_cookie||r(input),a.find(".passster-error").hide();let e=t.content;e&&(s.each(ps_ajax.shortcodes,function(t,a){e=e.replace(t,a)}),s("#"+ps_id).replaceWith(e)),t.redirect&&window.location.replace(redirect)}else r(input),t.redirect?window.location.replace(redirect):window.location.href=e();else a.find(".passster-error").text(t.error),a.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:function(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:ps_ajax.nonce,token:t,post_id:ps_ajax.post_id,type:"recaptcha",protection:protection,captcha_id:ps_id,acf:acf,area:area,redirect:redirect},success:function(t){if(!0===t.success)if(ps_ajax.unlock_mode){ps_ajax.disable_cookie||Cookies.set("passster","recaptcha",{expires:a(),sameSite:"strict"}),form.find(".passster-error").hide();let e=t.content;e&&(s.each(ps_ajax.shortcodes,function(t,a){e=e.replace(t,a)}),s("#"+ps_id).replaceWith(e)),t.redirect&&window.location.replace(redirect)}else Cookies.set("passster","recaptcha",{expires:a(),sameSite:"strict"}),t.redirect?window.location.replace(redirect):window.location.href=e();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:ps_ajax.nonce,token:t,post_id:ps_ajax.post_id,type:"recaptcha",protection:protection,captcha_id:ps_id,acf:acf,area:area,redirect:redirect},success:function(t){if(!0===t.success)if(ps_ajax.unlock_mode){ps_ajax.disable_cookie||Cookies.set("passster","recaptcha",{expires:a(),sameSite:"strict"}),form.find(".passster-error").hide();let e=t.content;e&&(s.each(ps_ajax.shortcodes,function(t,a){e=e.replace(t,a)}),form.replaceWith(e)),t.redirect&&window.location.replace(redirect)}else Cookies.set("passster","recaptcha",{expires:a(),sameSite:"strict"}),t.redirect?window.location.replace(redirect):window.location.href=e();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:ps_ajax.nonce,token:t,post_id:ps_ajax.post_id,type:"recaptcha",protection:protection,captcha_id:ps_id,acf:acf,area:area,redirect:redirect},success:function(t){if(!0===t.success)if(ps_ajax.unlock_mode){ps_ajax.disable_cookie||Cookies.set("passster","recaptcha",{expires:a(),sameSite:"strict"}),form.find(".passster-error").hide();let e=t.content;e&&(s.each(ps_ajax.shortcodes,function(t,a){e=e.replace(t,a)}),form.replaceWith(e)),t.redirect&&window.location.replace(redirect)}else Cookies.set("passster","recaptcha",{expires:a(),sameSite:"strict"}),t.redirect?window.location.replace(redirect):window.location.href=e();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:function(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:ps_ajax.nonce,token:t,post_id:ps_ajax.post_id,type:"turnstile",protection:protection,captcha_id:ps_id,acf:acf,area:area,redirect:redirect},success:function(t){if(!0===t.success)if(ps_ajax.unlock_mode){ps_ajax.disable_cookie||Cookies.set("passster","turnstile",{expires:a(),sameSite:"strict"}),form.find(".passster-error").hide();let e=t.content;e&&(s.each(ps_ajax.shortcodes,function(t,a){e=e.replace(t,a)}),s("#"+ps_id).replaceWith(e)),t.redirect&&window.location.replace(redirect)}else Cookies.set("passster","turnstile",{expires:a(),sameSite:"strict"}),t.redirect?window.location.replace(redirect):window.location.href=e();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:ps_ajax.logout_nonce},success:function(t){!0===t.success&&(Cookies.set("passster","",{expires:0,sameSite:"strict"}),window.location.href=e())}})})});