function t(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}var n="object"==typeof global&&global&&global.Object===Object&&global,r="object"==typeof self&&self&&self.Object===Object&&self,e=n||r||Function("return this")(),o=function(){return e.Date.now()},i=/\s/;var u=/^\s+/;function a(t){return t?t.slice(0,function(t){for(var n=t.length;n--&&i.test(t.charAt(n)););return n}(t)+1).replace(u,""):t}var c=e.Symbol,f=Object.prototype,l=f.hasOwnProperty,v=f.toString,s=c?c.toStringTag:void 0;var b=Object.prototype.toString;var p=c?c.toStringTag:void 0;function d(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":p&&p in Object(t)?function(t){var n=l.call(t,s),r=t[s];try{t[s]=void 0;var e=!0}catch(i){}var o=v.call(t);return e&&(n?t[s]=r:delete t[s]),o}(t):function(t){return b.call(t)}(t)}var y=/^[-+]0x[0-9a-f]+$/i,g=/^0b[01]+$/i,j=/^0o[0-7]+$/i,m=parseInt;function h(n){if("number"==typeof n)return n;if(function(t){return"symbol"==typeof t||function(t){return null!=t&&"object"==typeof t}(t)&&"[object Symbol]"==d(t)}(n))return NaN;if(t(n)){var r="function"==typeof n.valueOf?n.valueOf():n;n=t(r)?r+"":r}if("string"!=typeof n)return 0===n?n:+n;n=a(n);var e=g.test(n);return e||j.test(n)?m(n.slice(2),e?2:8):y.test(n)?NaN:+n}var O=Math.max,T=Math.min;function x(n,r,e){var i,u,a,c,f,l,v=0,s=!1,b=!1,p=!0;if("function"!=typeof n)throw new TypeError("Expected a function");function d(t){var r=i,e=u;return i=u=void 0,v=t,c=n.apply(e,r)}function y(t){return v=t,f=setTimeout(j,r),s?d(t):c}function g(t){var n=t-l;return void 0===l||n>=r||n<0||b&&t-v>=a}function j(){var t=o();if(g(t))return m(t);f=setTimeout(j,function(t){var n=r-(t-l);return b?T(n,a-(t-v)):n}(t))}function m(t){return f=void 0,p&&i?d(t):(i=u=void 0,c)}function x(){var t=o(),n=g(t);if(i=arguments,u=this,l=t,n){if(void 0===f)return y(l);if(b)return clearTimeout(f),f=setTimeout(j,r),d(l)}return void 0===f&&(f=setTimeout(j,r)),c}return r=h(r)||0,t(e)&&(s=!!e.leading,a=(b="maxWait"in e)?O(h(e.maxWait)||0,r):a,p="trailing"in e?!!e.trailing:p),x.cancel=function(){void 0!==f&&clearTimeout(f),v=0,i=l=u=f=void 0},x.flush=function(){return void 0===f?c:m(o())},x}export{x as d};
