import{s as state}from"./store-4bc13420.js";const isBusy=()=>["loading","busy","redirecting"].includes(state.loading),getExitUrl=()=>{var t,e;return(null===(e=null===(t=null==state?void 0:state.checkout)||void 0===t?void 0:t.metadata)||void 0===e?void 0:e.success_url)||state.success_url||null},getUpsellRemainingTime=(t="seconds")=>{var e;const i=null===(e=state.checkout)||void 0===e?void 0:e.upsells_expire_at;if(!i)return null;const o=Date.now(),s=Math.floor((1e3*i-o)/1e3);return s<0?0:"seconds"===t?s:"minutes"===t?Math.floor(s/60):"hours"===t?Math.floor(s/60/60):void 0},formatTimeUnit=t=>t<10?`0${t}`:`${t}`,getFormattedRemainingTime=()=>{var t;if(!(null===(t=state.checkout)||void 0===t?void 0:t.upsells_expire_at))return"--:--";const e=getUpsellRemainingTime("seconds"),i=Math.floor(e/86400),o=Math.floor(e%86400/3600),s=Math.floor(e%3600/60),n=Math.floor(e%60);return i>0?`${formatTimeUnit(i)}:${formatTimeUnit(o)}:${formatTimeUnit(s)}:${formatTimeUnit(n)}`:o>0?`${formatTimeUnit(o)}:${formatTimeUnit(s)}:${formatTimeUnit(n)}`:`${formatTimeUnit(s)}:${formatTimeUnit(n)}`},isUpsellExpired=()=>{const t=getUpsellRemainingTime();return null!==getUpsellRemainingTime()&&t<=0};export{isBusy as a,getFormattedRemainingTime as b,getExitUrl as g,isUpsellExpired as i};