(()=>{const t={init:function(){this.bindEvents(),this.showPopup()},bindEvents:function(){const t=this;document.addEventListener("click",function(o){o.target.closest(".notifal-activation-popup-close")&&(o.preventDefault(),t.closePopup())}),document.addEventListener("click",function(o){o.target.matches(".notifal-activation-popup-overlay")&&t.closePopup()}),document.addEventListener("keydown",function(o){"Escape"===o.key&&null!==document.getElementById("notifal-activation-popup").offsetParent&&t.closePopup()}),document.addEventListener("click",function(o){if(o.target.matches(".notifal-activation-popup-button")){const n=o.target.getAttribute("data-button-id");t.trackButtonClick(n),t.closePopup(!0)}})},showPopup:function(){const t=document.querySelector(".notifal-activation-popup-overlay"),o=document.querySelector(".notifal-activation-popup-content");if(!o)return;t.style.display="block",o.style.display="block",t.classList.add("show"),o.classList.add("show"),o.setAttribute("aria-hidden","false");const n=o.querySelector(".notifal-activation-popup-close");n&&n.focus(),document.body.classList.add("notifal-activation-popup-active")},closePopup:function(t){const o=this,n=document.querySelector(".notifal-activation-popup-overlay"),e=document.querySelector(".notifal-activation-popup-content");e.classList.add("hide"),setTimeout(function(){n.classList.remove("show"),n.style.display="none",e.classList.remove("show","hide"),e.style.display="none",document.body.classList.remove("notifal-activation-popup-active"),o.dismissPopup()},300)},dismissPopup:function(){const t=new FormData;t.append("action","notifal_dismiss_activation_popup"),t.append("nonce",notifalActivationPopup.nonce),fetch(notifalActivationPopup.ajaxUrl,{method:"POST",body:t}).then(t=>t.json()).then(t=>{if(t.success&&window.history.replaceState){const t=new URL(window.location);t.searchParams.delete("notifal_activation"),window.history.replaceState(null,null,t)}}).catch(t=>{"TypeError"===t.name||t.message.includes("network")})},trackButtonClick:function(t){}};document.addEventListener("DOMContentLoaded",function(){t.init()})})();
