@limetech/lime-elements
Version:
1 lines • 1.02 kB
JavaScript
import{r as t,i as r}from"./p-BJQylLSL.js";import{t as i}from"./p-D6dCQvwl.js";var n=function(){return t.Date.now()},o=Math.max,u=Math.min;function e(t,e,f){var a,v,c,d,m,s,p=0,T=!1,l=!1,h=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function w(r){var i=a,n=v;return a=v=void 0,p=r,d=t.apply(n,i)}function x(t){var r=t-s;return void 0===s||r>=e||r<0||l&&t-p>=c}function y(){var t=n();if(x(t))return j(t);m=setTimeout(y,function(t){var r=e-(t-s);return l?u(r,c-(t-p)):r}(t))}function j(t){return m=void 0,h&&a?w(t):(a=v=void 0,d)}function E(){var t=n(),r=x(t);if(a=arguments,v=this,s=t,r){if(void 0===m)return function(t){return p=t,m=setTimeout(y,e),T?w(t):d}(s);if(l)return clearTimeout(m),m=setTimeout(y,e),w(s)}return void 0===m&&(m=setTimeout(y,e)),d}return e=i(e)||0,r(f)&&(T=!!f.leading,c=(l="maxWait"in f)?o(i(f.maxWait)||0,e):c,h="trailing"in f?!!f.trailing:h),E.cancel=function(){void 0!==m&&clearTimeout(m),p=0,a=s=v=m=void 0},E.flush=function(){return void 0===m?d:j(n())},E}export{e as d}