import { Router as e } from "../../services/router.js";
import { useCallback as t, useEffect as n, useMemo as r, useState as i } from "react";
//#region src/react/hooks/useRouter.ts
function a(a) {
	let o = r(() => new e(a), [a]), [s, c] = i(() => typeof window < "u" ? window.location.pathname : "/");
	return n(() => {
		o.start();
		let e = o.on("navigate", (e) => {
			c(e.path);
		});
		return () => {
			e(), o.destroy();
		};
	}, [o]), {
		router: o,
		pathname: s,
		navigate: t((e) => {
			o.navigate(e);
		}, [o])
	};
}
//#endregion
export { a as useRouter };

//# sourceMappingURL=useRouter.js.map