import { useCallback as e, useEffect as t, useState as n } from "react";
//#region src/features/workbench/hooks/useAutoScrollBottom.ts
function r(r = 50) {
	let [i, a] = n(!1), o = e(() => {
		let e = document.documentElement;
		a(e.scrollHeight - e.scrollTop - e.clientHeight > r);
	}, [r]), s = e(() => {
		window.scrollTo({
			top: document.documentElement.scrollHeight,
			behavior: "smooth"
		});
	}, []);
	return t(() => {
		window.addEventListener("scroll", o, { passive: !0 }), o();
		let e = setInterval(o, 500);
		return () => {
			window.removeEventListener("scroll", o), clearInterval(e);
		};
	}, [o]), {
		canScrollDown: i,
		scrollToBottom: s
	};
}
//#endregion
export { r as useScrollToBottom };
