(()=>{"use strict";var e={d:(t,d)=>{for(var o in d)e.o(d,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:d[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};function d(e){"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",e):e())}e.d(t,{default:()=>d}),(window.wp=window.wp||{}).domReady=t.default})(); //# sourceMappingURL=index.min.js.map; const{domReady}=wp;domReady(()=>{const modal=document.querySelector('.jetpack-subscribe-modal');const modalDismissedCookie='jetpack_post_subscribe_modal_dismissed';function hasEnoughTimePassed(){const lastDismissed=localStorage.getItem(modalDismissedCookie);return lastDismissed?Date.now()-lastDismissed>Jetpack_Subscriptions.modalInterval:!0} if(!modal||!hasEnoughTimePassed()){return} const modalLoadTimeout=setTimeout(openModal,Jetpack_Subscriptions.modalLoadTime);const targetElement=(document.querySelector('.entry-content')||document.documentElement).getBoundingClientRect();function hasPassedScrollThreshold(){const scrollPosition=window.scrollY+window.innerHeight/2;const scrollPositionThreshold=targetElement.top+(targetElement.height*Jetpack_Subscriptions.modalScrollThreshold)/100;return scrollPosition>scrollPositionThreshold} function onScroll(){requestAnimationFrame(()=>{if(hasPassedScrollThreshold()){openModal()}})} window.addEventListener('scroll',onScroll,{passive:!0});function onLocalStorage(event){if(event.key===modalDismissedCookie){closeModal();removeEventListeners()}} window.addEventListener('storage',onLocalStorage);const form=modal.querySelector('form');if(form){form.addEventListener('subscription-modal-loaded',closeModal)} function onCloseButtonClick(event){event.preventDefault();closeModal()} const close=document.getElementsByClassName('jetpack-subscribe-modal__close')[0];if(close){close.addEventListener('click',onCloseButtonClick)} function closeOnWindowClick(event){if(event.target===modal){closeModal()}} function closeModalOnEscapeKeydown(event){if(event.key==='Escape'){closeModal()}} function openModal(){if(document.activeElement&&document.activeElement.tagName!=='BODY'){return} modal.classList.add('open');document.body.classList.add('jetpack-subscribe-modal-open');window.addEventListener('keydown',closeModalOnEscapeKeydown);window.addEventListener('click',closeOnWindowClick);removeEventListeners()} function closeModal(){modal.classList.remove('open');document.body.classList.remove('jetpack-subscribe-modal-open');window.removeEventListener('keydown',closeModalOnEscapeKeydown);window.removeEventListener('storage',onLocalStorage);window.removeEventListener('click',closeOnWindowClick);storeCloseTimestamp()} function removeEventListeners(){window.removeEventListener('scroll',onScroll);clearTimeout(modalLoadTimeout)} function storeCloseTimestamp(){localStorage.setItem(modalDismissedCookie,Date.now())}});