Build 576754stable
Module 111956
926 characters · in 25536.0ec29f5a59959fec.jsDependencies
Source Raw
function(e,t,n){var r=n(646344),o=n(714163),a=n(681447),i=Math.max,u=Math.min;e.exports=function(e,t,n){var l,s,c,f,d,h,p=0,v=!1,y=!1,m=!0;if("function"!=typeof e)throw TypeError("Expected a function");function g(t){var n=l,r=s;return l=s=void 0,p=t,f=e.apply(r,n)}function b(e){var n=e-h,r=e-p;return void 0===h||n>=t||n<0||y&&r>=c}function w(){var e,n,r,a=o();if(b(a))return _(a);d=setTimeout(w,(e=a-h,n=a-p,r=t-e,y?u(r,c-n):r))}function _(e){return(d=void 0,m&&l)?g(e):(l=s=void 0,f)}function D(){var e,n=o(),r=b(n);if(l=arguments,s=this,h=n,r){if(void 0===d)return p=e=h,d=setTimeout(w,t),v?g(e):f;if(y)return clearTimeout(d),d=setTimeout(w,t),g(h)}return void 0===d&&(d=setTimeout(w,t)),f}return t=a(t)||0,r(n)&&(v=!!n.leading,c=(y="maxWait"in n)?i(a(n.maxWait)||0,t):c,m="trailing"in n?!!n.trailing:m),D.cancel=function(){void 0!==d&&clearTimeout(d),p=0,l=h=s=d=void 0},D.flush=function(){return void 0===d?f:_(o())},D}}