import { useCallback as c, useEffect as f } from "react";
const d = (e, { isBlockingModal: n, callback: t } = { isBlockingModal: !1 }) => {
  const o = c(
    (s) => {
      const r = typeof t == "function" ? t : () => ({});
      e && s.stopPropagation(), e && !n && s.key === "Escape" && r();
    },
    [t, n, e]
  );
  f(() => (window.addEventListener("keydown", o), () => {
    window.removeEventListener("keydown", o);
  }), [o, n]);
};
export {
  d as useHandleCloseOnEscape
};
//# sourceMappingURL=useHandleCloseOnEscape.es.js.map
