"use strict";(self.webpackChunk_brizy_builder_free=self.webpackChunk_brizy_builder_free||[]).push([["912"],{579(e,t,l){l.r(t),l.d(t,{default:()=>n});var r=l(6513);function n(e){let t=e.get(0);if(!t)return;let l=e=>{var t,l;null==(l=e.parentNode)||null==(t=l.querySelector(".brz-protected__alert"))||t.remove()},n=(e,t)=>{var l;let r=document.createElement("div");r.className="brz-protected__alert",r.innerHTML=t,null==(l=e.parentNode)||l.appendChild(r)},o=e=>{let{messages:t}=e.dataset,l=t?(0,r.uv)(t):null;return{empty:(null==l?void 0:l.empty)||"The field should not be empty!",fail:(null==l?void 0:l.fail)||"An error has occured!",invalid:(null==l?void 0:l.invalid)||"Please insert a valid code!"}};t.querySelectorAll(".brz-protected-form").forEach(e=>{e.addEventListener("submit",t=>{t.preventDefault();let{empty:r}=o(e),a=e.querySelector(".brz-input"),d=null==a?void 0:a.value;d?((e,t)=>{l(e);let r=e.querySelector(".brz-btn");null==r||r.classList.add("brz-blocked");let a=window.location.href||"/",{fail:d,invalid:i}=o(e);return fetch(a,{method:"POST",mode:"same-origin",body:JSON.stringify({protected_page_token:t}),headers:{"Content-Type":"application/json"}}).then(t=>{null==r||r.classList.remove("brz-blocked"),l(e),t.ok?window.location.reload():404===t.status?n(e,d):n(e,i)})})(e,d):(l(e),n(e,r))})})}},6513(e,t,l){l.d(t,{$$:()=>n,uv:()=>r});let r=e=>JSON.parse(decodeURIComponent(e)),n=e=>{try{return r(e)}catch(e){}}}}]);