import{y as c,I as o}from"./index.js";const m=(n,a=!0,r=null)=>{const e=c(n);let v=new Date().getTime(),t=null;const s=()=>{t&&clearInterval(t),t=setInterval(()=>{const l=Math.round((new Date().getTime()-v)/1e3);v=new Date().getTime(),a?e.value=Math.max(0,e.value-l):e.value=Math.min(r??e.value+l,e.value+l),(a&&e.value<=0||!a&&r!==null&&e.value>=r)&&u()},1e3)},u=()=>{t&&(clearInterval(t),t=null)},f=(l=n)=>{e.value=l,(a&&l>0||!a&&(r===null||l<r))&&s()};return s(),o(()=>{u()}),{time:e,stopTimer:u,startTimer:s,resetTimer:f}};export{m as u};
