import{r as g,au as y,af as T,ag as b,a6 as h,g as v,ao as f,W as P,Y as S,l as A}from"./CibDhUcP.js";function m(e){return T()?(b(e),!0):!1}const d=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const O=Object.prototype.toString,F=e=>O.call(e)==="[object Object]",p=()=>{},D=I();function I(){var e,t;return d&&((e=window==null?void 0:window.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window==null?void 0:window.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function j(e,t){function o(...n){return new Promise((r,i)=>{Promise.resolve(e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})).then(r).catch(i)})}return o}function x(e,t={}){let o,n,r=p;const i=a=>{clearTimeout(a),r(),r=p};return a=>{const l=f(e),u=f(t.maxWait);return o&&i(o),l<=0||u!==void 0&&u<=0?(n&&(i(n),n=null),Promise.resolve(a())):new Promise((c,w)=>{r=t.rejectOnCancel?w:c,u&&!n&&(n=setTimeout(()=>{o&&i(o),n=null,c(a())},u)),o=setTimeout(()=>{n&&i(n),n=null,c(a())},l)})}}function C(e){return A()}function M(e){return Array.isArray(e)?e:[e]}function _(e,t=200,o={}){return j(x(t,o),e)}function k(e,t=!0,o){C()?P(e,o):t?e():S(e)}function G(e,t=1e3,o={}){const{immediate:n=!0,immediateCallback:r=!1}=o;let i=null;const s=g(!1);function a(){i&&(clearInterval(i),i=null)}function l(){s.value=!1,a()}function u(){const c=f(t);c<=0||(s.value=!0,r&&e(),a(),s.value&&(i=setInterval(e,c)))}if(n&&d&&u(),h(t)||typeof t=="function"){const c=v(t,()=>{s.value&&d&&u()});m(c)}return m(l),{isActive:s,pause:l,resume:u}}function R(e,t,o={}){const{immediate:n=!0}=o,r=g(!1);let i=null;function s(){i&&(clearTimeout(i),i=null)}function a(){r.value=!1,s()}function l(...u){s(),r.value=!0,i=setTimeout(()=>{r.value=!1,i=null,e(...u)},f(t))}return n&&(r.value=!0,d&&l()),m(a),{isPending:y(r),start:l,stop:a}}export{G as a,_ as b,D as c,k as d,d as e,M as f,F as i,p as n,m as t,R as u};
