import { useRef, useLayoutEffect, useEffect, useCallback } from "react";
import "../lodash.debounce/index.js";
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
function useEventCallback(fn) {
  const ref = useRef(() => {
    throw new Error("Cannot call an event handler while rendering.");
  });
  useIsomorphicLayoutEffect(() => {
    ref.current = fn;
  }, [fn]);
  return useCallback((...args) => {
    var _a;
    return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args);
  }, [ref]);
}
export {
  useEventCallback,
  useIsomorphicLayoutEffect
};
//# sourceMappingURL=dist-index.js.map
