1 |
- import{ap as y,aW as F,ao as P,aY as b,bv as C}from"./index-b5a12e99.js";function W(e){return y()?(F(e),!0):!1}function w(e){return typeof e=="function"?e():C(e)}const g=typeof window<"u",m=()=>{};function D(e,i){function n(...t){return new Promise((o,r)=>{Promise.resolve(e(()=>i.apply(this,t),{fn:i,thisArg:this,args:t})).then(o).catch(r)})}return n}function j(e,i={}){let n,t,o=m;const r=u=>{clearTimeout(u),o(),o=m};return u=>{const s=w(e),a=w(i.maxWait);return n&&r(n),s<=0||a!==void 0&&a<=0?(t&&(r(t),t=null),Promise.resolve(u())):new Promise((c,p)=>{o=i.rejectOnCancel?p:c,a&&!t&&(t=setTimeout(()=>{n&&r(n),t=null,c(u())},a)),n=setTimeout(()=>{t&&r(t),t=null,c(u())},s)})}}function O(e,i=!0,n=!0,t=!1){let o=0,r,l=!0,u=m,s;const a=()=>{r&&(clearTimeout(r),r=void 0,u(),u=m)};return p=>{const f=w(e),T=Date.now()-o,d=()=>s=p();return a(),f<=0?(o=Date.now(),d()):(T>f&&(n||!l)?(o=Date.now(),d()):i&&(s=new Promise((h,x)=>{u=t?x:h,r=setTimeout(()=>{o=Date.now(),l=!0,h(d()),a()},Math.max(0,f-T))})),!n&&!r&&(r=setTimeout(()=>l=!0,f)),l=!1,s)}}function R(e,i=200,n={}){return D(j(i,n),e)}function U(e,i=200,n=!1,t=!0,o=!1){return D(O(i,n,t,o),e)}function V(e){P()&&b(e)}export{w as a,V as b,R as c,g as i,W as t,U as u};
|