1import{L as i}from"./ListenerManager-B9zmCDZv.js";import{p as s}from"./politeAnnounce-jTdKCmrb.js";const n=()=>({storageKey:"seen-nl-signup",storageValue:"y",popupTimeout:null,htmlEl:document.documentElement,listenerBoss:new i,isVisible:!1,hasTriggered:!1,prefersReducedMotion:window.matchMedia("(prefers-reduced-motion: reduce)").matches,init(){return()=>this.mounted()},mounted(){if(!this.shouldShow()){this.isVisible=!1;return}this.prefersReducedMotion||this.scheduleTrigger(),this.listenerBoss.register(window,"keydown",e=>{this.handleKeydown(e)})},destroy(){this.listenerBoss.removeAll(),this.popupTimeout!==null&&(window.clearTimeout(this.popupTimeout),this.popupTimeout=null)},close(){this.rememberDismissal(),this.isVisible=!1},shouldShow(){try{return localStorage.getItem(this.storageKey)!==this.storageValue}catch{return!0}},scheduleTrigger(){if(window.innerHeight*2<=this.getDocumentHeight()){this.listenerBoss.register(window,"optimizedScroll",()=>{!this.hasTriggered&&this.amountScrolled()>=75&&this.triggerSignup()});return}this.hasTriggered||(this.popupTimeout=window.setTimeout(()=>{this.triggerSignup()},3e3))},handleKeydown(e){e.key!=="Escape"||!this.isVisible||(e.preventDefault(),this.close())},amountScrolled(){const e=this.htmlEl.scrollTop,t=this.getDocumentHeight()-window.innerHeight;return t<=0?0:Math.floor(e/t*100)},getDocumentHeight(){return Math.max(document.body?.scrollHeight??0,document.documentElement.scrollHeight,document.documentElement.clientHeight)},triggerSignup(){this.popupTimeout!==null&&(window.clearTimeout(this.popupTimeout),this.popupTimeout=null),this.hasTriggered=!0,this.isVisible=!0;const e=this.$el?.querySelector(".msg__heading")?.textContent?.trim();s(e?`${e} sign-up`:"Newsletter sign-up")},rememberDismissal(){try{localStorage.setItem(this.storageKey,this.storageValue)}catch{}}});export{n as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.