index-1f639c9e.js 909 B

1
  1. import{H as e,b7 as t,j as n,b8 as a,b9 as o,ba as u}from"./index-d31722d5.js";function c(e){return!!a()&&(o(e),!0)}function i(e){return"function"==typeof e?e():u(e)}const s="undefined"!=typeof window&&"undefined"!=typeof document,l=Object.prototype.toString,r=e=>"[object Object]"===l.call(e),f=()=>{};function m(a,o=1e3,u={}){const{immediate:l=!0,immediateCallback:r=!1}=u;let f=null;const m=e(!1);function d(){f&&(clearInterval(f),f=null)}function b(){m.value=!1,d()}function p(){const e=i(o);e<=0||(m.value=!0,r&&a(),d(),f=setInterval(a,e))}return l&&s&&p(),(t(o)||"function"==typeof o)&&c(n(o,(()=>{m.value&&s&&p()}))),c(b),{isActive:m,pause:b,resume:p}}function d(t=1e3,n={}){const{controls:a=!1,immediate:o=!0,callback:u}=n,c=e(0),i=()=>c.value+=1,s=m(u?()=>{i(),u(c.value)}:i,t,{immediate:o});return a?{counter:c,reset:()=>{c.value=0},...s}:c}export{m as a,r as b,i as c,s as i,f as n,c as t,d as u};