/*!
 * Built by Revolist OU ❤️
 */
import{r as t,t as r,a as n}from"./toNumber.js";var i=function(){return t.Date.now()},o=Math.max,u=Math.min;function e(t,e,a){var f,c,v,d,m,s,T=0,p=!1,h=!1,l=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function x(r){var n=f,i=c;return f=c=void 0,T=r,d=t.apply(i,n)}function w(t){var r=t-s;return void 0===s||r>=e||r<0||h&&t-T>=v}function y(){var t=i();if(w(t))return E(t);m=setTimeout(y,function(t){var r=e-(t-s);return h?u(r,v-(t-T)):r}(t))}function E(t){return m=void 0,l&&f?x(t):(f=c=void 0,d)}function M(){var t=i(),r=w(t);if(f=arguments,c=this,s=t,r){if(void 0===m)return function(t){return T=t,m=setTimeout(y,e),p?x(t):d}(s);if(h)return clearTimeout(m),m=setTimeout(y,e),x(s)}return void 0===m&&(m=setTimeout(y,e)),d}return e=r(e)||0,n(a)&&(p=!!a.leading,v=(h="maxWait"in a)?o(r(a.maxWait)||0,e):v,l="trailing"in a?!!a.trailing:l),M.cancel=function(){void 0!==m&&clearTimeout(m),T=0,f=s=c=m=void 0},M.flush=function(){return void 0===m?d:E(i())},M}export{e as d}