index-6fa9d514-1715743749367.js 1.5 KB

1
  1. import{bT as x,ch as C,c3 as S,R as j,aV as F,bS as P}from"./index-1a13cb99-1715743749367.js";function V(e){return x()?(C(e),!0):!1}function d(e){return typeof e=="function"?e():F(e)}const G=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const m=()=>{};function y(e,r){function t(...n){return new Promise((o,i)=>{Promise.resolve(e(()=>r.apply(this,n),{fn:r,thisArg:this,args:n})).then(o).catch(i)})}return t}function g(e,r={}){let t,n,o=m;const i=u=>{clearTimeout(u),o(),o=m};return u=>{const a=d(e),l=d(r.maxWait);return t&&i(t),a<=0||l!==void 0&&l<=0?(n&&(i(n),n=null),Promise.resolve(u())):new Promise((s,T)=>{o=r.rejectOnCancel?T:s,l&&!n&&(n=setTimeout(()=>{t&&i(t),n=null,s(u())},l)),t=setTimeout(()=>{n&&i(n),n=null,s(u())},a)})}}function O(...e){let r=0,t,n=!0,o=m,i,c,u,a,l;!S(e[0])&&typeof e[0]=="object"?{delay:c,trailing:u=!0,leading:a=!0,rejectOnCancel:l=!1}=e[0]:[c,u=!0,a=!0,l=!1]=e;const s=()=>{t&&(clearTimeout(t),t=void 0,o(),o=m)};return b=>{const f=d(c),h=Date.now()-r,p=()=>i=b();return s(),f<=0?(r=Date.now(),p()):(h>f&&(a||!n)?(r=Date.now(),p()):u&&(i=new Promise((w,D)=>{o=l?D:w,t=setTimeout(()=>{r=Date.now(),n=!0,w(p()),s()},Math.max(0,f-h))})),!a&&!t&&(t=setTimeout(()=>n=!0,f)),n=!1,i)}}function R(e){return e||P()}function L(e,r=200,t={}){return y(g(r,t),e)}function U(e,r=200,t=!1,n=!0,o=!1){return y(O(r,t,n,o),e)}function k(e,r){R(r)&&j(e,r)}export{U as a,V as b,d as c,G as i,k as t,L as u};