import{Fn as e,Vn as t}from"./style-QAnagFj5.js";import{u as n}from"./style-aJpPAPRc.js";var r=function(){return t.Date.now()},i=`Expected a function`,a=Math.max,o=Math.min;function s(t,s,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof t!=`function`)throw TypeError(i);s=n(s)||0,e(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?a(n(c.maxWait)||0,s):d,v=`trailing`in c?!!c.trailing:v);function y(e){var n=l,r=u;return l=u=void 0,h=e,f=t.apply(r,n),f}function b(e){return h=e,p=setTimeout(C,s),g?y(e):f}function x(e){var t=e-m,n=e-h,r=s-t;return _?o(r,d-n):r}function S(e){var t=e-m,n=e-h;return m===void 0||t>=s||t<0||_&&n>=d}function C(){var e=r();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(r())}function D(){var e=r(),t=S(e);if(l=arguments,u=this,m=e,t){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,s),y(m)}return p===void 0&&(p=setTimeout(C,s)),f}return D.cancel=T,D.flush=E,D}export{s as t};