1/* @license GPL-2.0-or-later https://www.drupal.org/licensing/faq */ 2(function(Drupal,once,cookies){'use strict';const COOKIE_NAME='ls_exit_modal_dismissed';const COOKIE_EXPIRATION_DAYS=30;const COOKIE_PATH='/';function isDrupalModalVisible(){const modal=document.getElementById('drupal-modal');if(!modal)return false;const style=window.getComputedStyle(modal);if(style.display==='none')return false;return true;}function isDismissed(){return cookies.get(COOKIE_NAME)==='true';}function setDismissed(){cookies.set(COOKIE_NAME,'true',{expires:COOKIE_EXPIRATION_DAYS,path:COOKIE_PATH});}function isProbablyMobile(){return window.matchMedia&&window.matchMedia('(pointer: coarse)').matches;}function trackContentInViewEvent(element){const contentInViewEvent=new CustomEvent('analytics:contentInView',{detail:{component:{name:element.querySelector('.ls-exit-modal__title')?.textContent.trim()||'Exit Modal',type:'Exit Intent Modal'},identity:{prompt:'true',title:'Identity: Sign-up/Sign-in Prompt'},clickedToView:false},bubbles:true});document.dispatchEvent(contentInViewEvent);}Drupal.behaviors.lsExitModal={async attach(context){const isAuthenticated=await Drupal.isIdentityAuthenticated();if(isAuthenticated||isDismissed())return;const elements=once('ls-exit-modal','#js-exit-modal',context);if(!elements.length)return;const backdrop=elements[0];const closeButton=backdrop.querySelector('.js-exit-modal-close');let modalShown=false;const aborter=new AbortController();const {signal}=aborter;backdrop.__lsExitModalAborter=aborter;let lastPathAndSearch=`${window.location.pathname}${window.location.search}`;const SENSITIVITY=20;const MIN_VELOCITY=0.5;let lastMouseY=null;let lastMouseTime=null;document.documentElement.addEventListener('mousemove',(e)=>{lastMouseY=e.clientY;lastMouseTime=Date.now();},{signal,passive:true});document.documentElement.addEventListener('mouseleave',(e)=>{if(e.clientY>SENSITIVITY||isDismissed()||modalShown)return;if(lastMouseY!==null&&lastMouseTime!==null){const timeDelta=Date.now()-lastMouseTime;const distanceDelta=Math.abs(lastMouseY-e.clientY);const velocity=timeDelta>0?distanceDelta/timeDelta:0;if(velocity>=MIN_VELOCITY&&!isDrupalModalVisible()){showModal();modalShown=true;}}else{if(!isDrupalModalVisible()){showModal();modalShown=true;}}},{signal});function showModal(){backdrop.showModal();backdrop.setAttribute('aria-hidden','false');closeButton.classList.add('js-programmatic-focus');closeButton.focus();document.dispatchEvent(new CustomEvent('ls_exit_modal:opened'));trackContentInViewEvent(backdrop);const cleanup=(e)=>{if(e.type==='blur'||(e.type==='keydown'&&e.key==='Tab')){closeButton.classList.remove('js-programmatic-focus');closeButton.removeEventListener('blur',cleanup);document.removeEventListener('keydown',cleanup);}};closeButton.addEventListener('blur',cleanup);document.addEventListener('keydown',cleanup);document.body.classList.add('no-scroll');}function hideModal(){backdrop.close();backdrop.setAttribute('aria-hidden','true');document.body.classList.remove('no-scroll');}function dismissAndClose(){setDismissed();hideModal();aborter.abort();}const onVisibilityChange=()=>{if(isDrupalModalVisible())return;if(document.hidden&&!isDismissed()&&!modalShown){showModal();modalShown=true;}};document.addEventListener('visibilitychange',onVisibilityChange,{signal});if(isProbablyMobile()){const SCROLL_CONFIG={MIN_SCROLL_DEPTH:300,MIN_VIEWPORT_PERCENTAGE:0.5,MIN_SHARP_VELOCITY:-6,MAX_TIME_DELTA:100,MIN_UPWARD_DISTANCE:250,THROTTLE_DELAY:50,TRIGGER_COOLDOWN:3000};const scrollState={previousY:0,previousTime:Date.now(),peakScrollY:0,isEngaged:false,lastTriggerTime:0};const getMinScrollDepth=()=>{const viewportHeight=window.innerHeight;const fiftyPercentViewport=viewportHeight*SCROLL_CONFIG.MIN_VIEWPORT_PERCENTAGE;return Math.min(SCROLL_CONFIG.MIN_SCROLL_DEPTH,fiftyPercentViewport);};const canTrigger=()=>{const now=Date.now();return (now-scrollState.lastTriggerTime>=SCROLL_CONFIG.TRIGGER_COOLDOWN);};let scrollTimeout=null;const handleScroll=()=>{if(scrollTimeout)return;scrollTimeout=setTimeout(()=>{scrollTimeout=null;const currentY=window.scrollY||window.pageYOffset;
2const currentTime=Date.now();const timeDelta=currentTime-scrollState.previousTime;if(!scrollState.isEngaged){if(currentY>scrollState.peakScrollY)scrollState.peakScrollY=currentY;const minDepth=getMinScrollDepth();if(scrollState.peakScrollY>=minDepth)scrollState.isEngaged=true;}if(scrollState.isEngaged&&timeDelta>0&&timeDelta<SCROLL_CONFIG.MAX_TIME_DELTA){const scrollDistance=currentY-scrollState.previousY;const velocity=scrollDistance/timeDelta;if(velocity<=SCROLL_CONFIG.MIN_SHARP_VELOCITY&&Math.abs(scrollDistance)>=SCROLL_CONFIG.MIN_UPWARD_DISTANCE&&!isDismissed()&&!modalShown&&!isDrupalModalVisible()&&canTrigger()){showModal();modalShown=true;scrollState.lastTriggerTime=currentTime;}}scrollState.previousY=currentY;scrollState.previousTime=currentTime;},SCROLL_CONFIG.THROTTLE_DELAY);};window.addEventListener('scroll',handleScroll,{signal,passive:true});}const onKeyDown=(e)=>{if(e.key==='Escape')dismissAndClose();};document.addEventListener('keydown',onKeyDown,{signal});backdrop.addEventListener('click',(e)=>{if(e.target===backdrop)dismissAndClose();},{signal});if(closeButton)closeButton.addEventListener('click',(e)=>{e.preventDefault();dismissAndClose();},{signal});const onPopState=()=>{const currentPathAndSearch=`${window.location.pathname}${window.location.search}`;const isHashOnlyChange=currentPathAndSearch===lastPathAndSearch;lastPathAndSearch=currentPathAndSearch;if(isHashOnlyChange)return;if(isDrupalModalVisible()||isDismissed()||modalShown)return;showModal();modalShown=true;};window.addEventListener('popstate',onPopState,{signal});const handleLoginEvent=()=>{if(!modalShown){aborter.abort();backdrop.remove();}};document.addEventListener('ls_identity_state_tracker:login',handleLoginEvent,{signal});},detach(context,settings,trigger){if(trigger!=='unload')return;const modal=context.querySelector&&context.querySelector('#js-exit-modal');if(modal&&modal.__lsExitModalAborter){modal.__lsExitModalAborter.abort();delete modal.__lsExitModalAborter;}}};})(Drupal,once,window.Cookies);;
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.