"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),r=require("react");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=t(e),n=function(e,r){return Number.isFinite(r)?{timeout:setTimeout(e,r)}:{raf:requestAnimationFrame(e)}},i=function(e){null!=e&&e.timeout&&clearTimeout(e.timeout),null!=e&&e.raf&&cancelAnimationFrame(e.raf)};exports.useThrottledCallback=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=r.useRef(null),a=r.useRef([]),c=r.useRef(e);c.current=e;var l=r.useMemo((function(){return function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];a.current=r,o.current||(o.current=n((function(){c.current.apply(c,u.default(a.current)),o.current=null}),t))}}),[]);return r.useEffect((function(){return function(){return i(o.current)}}),[]),l};
//# sourceMappingURL=useThrottledCallback.js.map
