import{r as g,au as v,af as T,ag as b,a6 as I,g as y,ao as f,W as P,Y as S,l as A}from"./CChoqk00.js";function p(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,D=e=>O.call(e)==="[object Object]",w=()=>{},k=j();function j(){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 x(e,t){function n(...i){return new Promise((r,o)=>{Promise.resolve(e(()=>t.apply(this,i),{fn:t,thisArg:this,args:i})).then(r).catch(o)})}return n}function C(e,t={}){let n,i,r=w;const o=u=>{clearTimeout(u),r(),r=w};let a;return u=>{const l=f(e),s=f(t.maxWait);return n&&o(n),l<=0||s!==void 0&&s<=0?(i&&(o(i),i=null),Promise.resolve(u())):new Promise((m,h)=>{r=t.rejectOnCancel?h:m,a=u,s&&!i&&(i=setTimeout(()=>{n&&o(n),i=null,m(a())},s)),n=setTimeout(()=>{i&&o(i),i=null,m(u())},l)})}}function W(e){return A()}function M(e){return Array.isArray(e)?e:[e]}function _(e,t=200,n={}){return x(C(t,n),e)}function G(e,t=!0,n){W()?P(e,n):t?e():S(e)}function R(e,t=1e3,n={}){const{immediate:i=!0,immediateCallback:r=!1}=n;let o=null;const a=g(!1);function c(){o&&(clearInterval(o),o=null)}function u(){a.value=!1,c()}function l(){const s=f(t);s<=0||(a.value=!0,r&&e(),c(),a.value&&(o=setInterval(e,s)))}if(i&&d&&l(),I(t)||typeof t=="function"){const s=y(t,()=>{a.value&&d&&l()});p(s)}return p(u),{isActive:a,pause:u,resume:l}}function V(e,t,n={}){const{immediate:i=!0}=n,r=g(!1);let o=null;function a(){o&&(clearTimeout(o),o=null)}function c(){r.value=!1,a()}function u(...l){a(),r.value=!0,o=setTimeout(()=>{r.value=!1,o=null,e(...l)},f(t))}return i&&(r.value=!0,d&&u()),p(c),{isPending:v(r),start:u,stop:c}}function L(e,t,n){return y(e,t,{...n,immediate:!0})}export{R as a,_ as b,p as c,D as d,G as e,d as f,k as i,w as n,M as t,V as u,L as w};
