import { useShellStore, useWithoutShellParam } from "../stores/shellStore.mjs";
import { c } from "react-compiler-runtime";
import { useEffect, useRef } from "react";
//#region src/shell/useShellVisibility.js
/**
* Controls shell visibility based on layout flags, user presence, and route metadata.
* Returns the effective hidden state that callers should use for rendering.
*/
const useShellVisibility = (t0) => {
	const $ = c(14);
	const { hideLayout, isPublicRoute, hasUser } = t0;
	const { shellHidden, setShellHidden } = useShellStore();
	const shellHiddenBaselineRef = useRef();
	const withoutShell = useWithoutShellParam();
	let t1;
	if ($[0] !== hasUser || $[1] !== hideLayout || $[2] !== isPublicRoute || $[3] !== setShellHidden || $[4] !== shellHidden || $[5] !== withoutShell) {
		t1 = () => {
			if (hideLayout || isPublicRoute || !hasUser || withoutShell) {
				if (shellHiddenBaselineRef.current === void 0) shellHiddenBaselineRef.current = shellHidden;
				if (!shellHidden) setShellHidden(true);
			} else if (shellHiddenBaselineRef.current !== void 0) {
				if (shellHidden !== shellHiddenBaselineRef.current) setShellHidden(shellHiddenBaselineRef.current);
				else setShellHidden(false);
				shellHiddenBaselineRef.current = void 0;
			} else if (shellHidden) setShellHidden(false);
		};
		$[0] = hasUser;
		$[1] = hideLayout;
		$[2] = isPublicRoute;
		$[3] = setShellHidden;
		$[4] = shellHidden;
		$[5] = withoutShell;
		$[6] = t1;
	} else t1 = $[6];
	const syncShellHiddenWithRouteState = t1;
	let t2;
	if ($[7] !== hasUser || $[8] !== hideLayout || $[9] !== isPublicRoute || $[10] !== setShellHidden || $[11] !== shellHidden || $[12] !== withoutShell) {
		t2 = [
			hideLayout,
			isPublicRoute,
			hasUser,
			withoutShell,
			setShellHidden,
			shellHidden
		];
		$[7] = hasUser;
		$[8] = hideLayout;
		$[9] = isPublicRoute;
		$[10] = setShellHidden;
		$[11] = shellHidden;
		$[12] = withoutShell;
		$[13] = t2;
	} else t2 = $[13];
	useEffect(syncShellHiddenWithRouteState, t2);
	return shellHidden || hideLayout || isPublicRoute || !hasUser || withoutShell;
};
//#endregion
export { useShellVisibility };

//# sourceMappingURL=useShellVisibility.mjs.map