import { useRouteRegistry } from "./routeRegistryStore.mjs";
import { c } from "react-compiler-runtime";
import { useEffect } from "react";
import { useLocation } from "react-router-dom";
//#region src/routes/useRegisterRoute.ts
/**
* Registers the current route in the registry and keeps the current path in sync.
* Returns the current location so callers can reuse it without calling useLocation again.
*/
const useRegisterRoute = (t0) => {
	const $ = c(12);
	const { isPublic, attemptSilentAuth } = t0;
	const location = useLocation();
	const registerRoute = useRouteRegistry(_temp);
	const setPath = useRouteRegistry(_temp2);
	let t1;
	if ($[0] !== attemptSilentAuth || $[1] !== isPublic || $[2] !== location.pathname || $[3] !== registerRoute || $[4] !== setPath) {
		t1 = () => {
			const path = location.pathname;
			setPath(path);
			registerRoute(path, {
				isPublic,
				...attemptSilentAuth !== void 0 ? { attemptSilentAuth } : {}
			});
		};
		$[0] = attemptSilentAuth;
		$[1] = isPublic;
		$[2] = location.pathname;
		$[3] = registerRoute;
		$[4] = setPath;
		$[5] = t1;
	} else t1 = $[5];
	const syncRouteRegistration = t1;
	let t2;
	if ($[6] !== attemptSilentAuth || $[7] !== isPublic || $[8] !== location.pathname || $[9] !== registerRoute || $[10] !== setPath) {
		t2 = [
			attemptSilentAuth,
			isPublic,
			location.pathname,
			registerRoute,
			setPath
		];
		$[6] = attemptSilentAuth;
		$[7] = isPublic;
		$[8] = location.pathname;
		$[9] = registerRoute;
		$[10] = setPath;
		$[11] = t2;
	} else t2 = $[11];
	useEffect(syncRouteRegistration, t2);
	return location;
};
function _temp(state) {
	return state.registerRoute;
}
function _temp2(state_0) {
	return state_0.setPath;
}
//#endregion
export { useRegisterRoute };

//# sourceMappingURL=useRegisterRoute.mjs.map