"use strict";(globalThis.webpackChunkblocksy_companion=globalThis.webpackChunkblocksy_companion||[]).push([[208,541],{208(e,t,n){n.d(t,{O:function(){return s},u:function(){return o}});const o=function(){const e=JSON.parse(localStorage.getItem("blocksyPastPopups"));let t={};return Array.isArray(e)?e.forEach(function(e){t[e]={closed:{reason:"cancel",timestamp:(new Date).getTime()},pages:[]}}):t=e,t=Object.keys(t||{}).reduce(function(e,n){const{isExpired:o,...s}=t[n];return{...e,[n]:{...s,...s.closed?{}:{closed:o?{reason:"cancel",timestamp:(new Date).getTime()}:null}}}},{}),t||{}},s=function(e){let t=e.id.replace("ct-popup-","");const n=o()[t];if(e.dataset.popupRelaunch){if("always"===e.dataset.popupRelaunch)return!1;if(e.dataset.popupRelaunch.indexOf("custom")>-1&&n){const t=e.dataset.popupRelaunch.split(":");let o=0,s=0;t.length>1&&(o=parseInt(t[1]),s=o),t.length>2&&(s=parseInt(t[2]));const{closed:c}=n;if(!c||!c.timestamp)return!1;const a=("cancel"===c.reason?o:s)/60/24;return!((new Date-new Date(c.timestamp))/864e5>a)}}return n&&n.closed}},541(e,t,n){n.d(t,{handleScrollModePopups:function(){return c}});var o=n(460),s=n(208);const c=function(){[...document.querySelectorAll('[data-popup-mode*="scroll"]')].filter(function(e){return!(0,s.O)(e)}).map(function(e){let t=e.dataset.popupMode.indexOf("up")>-1,n=scrollY;const s=function(){let c=e.dataset.popupMode.split(":")[1];if(c.indexOf("px")>-1&&(c=parseFloat(c)),c.toString().indexOf("%")>-1){let e=document.body,t=document.documentElement,n=Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight);c=parseFloat(c)/100*n}c.toString().indexOf("vh")>-1&&(c=parseFloat(c)/100*innerHeight),t&&(scrollY>n?n=scrollY:Math.abs(n-scrollY)>c?(e.classList.contains("active")||((0,o.openMicroPopup)(e),e.unmount=function(){window.removeEventListener("scroll",s,!0)}),-1===e.dataset.popupMode.indexOf("close-back")&&window.removeEventListener("scroll",s,!0)):e.classList.contains("active")&&(0,o.L)(e,{unmount:!1})),t||(c<=scrollY?(e.classList.contains("active")||((0,o.openMicroPopup)(e),e.unmount=function(){window.removeEventListener("scroll",s,!0)}),-1===e.dataset.popupMode.indexOf("close-back")&&window.removeEventListener("scroll",s,!0)):e.classList.contains("active")&&(0,o.L)(e,{unmount:!1}))};window.addEventListener("scroll",s,!0)})}}}]);