"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=function(e,r){return Number.isFinite(r)?{timeout:setTimeout(e,r)}:{raf:requestAnimationFrame(e)}};exports.useThrottledCallback=function(t,u){void 0===u&&(u=0);var n=e.useRef(null),i=e.useRef([]),o=e.useRef(t);o.current=t;var c=e.useMemo((function(){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];i.current=e,n.current||(n.current=r((function(){o.current.apply(o,i.current),n.current=null}),u))}}),[]);return e.useEffect((function(){return function(){return(null==(e=n.current)?void 0:e.timeout)&&clearTimeout(e.timeout),void((null==e?void 0:e.raf)&&cancelAnimationFrame(e.raf));var e}}),[]),c};
