"use client"; import { useEffect, useSyncExternalStore } from "react"; import { loadingBus } from "@/lib/loadingBus"; /** * Heavy-load hooks (formerly the entry LoadingOverlay). The entry/route * curtain orchestration now lives in RouteTransitionOverlay (the original * module 34841 drives BOTH flows from one pinhole curtain); this file keeps * only the readiness plumbing other components consume. */ /** Stable server snapshot (must be cached — a fresh object would loop). */ const SERVER_SNAPSHOT = { progress: 0, ready: false }; export function useHeavyLoad() { return useSyncExternalStore( loadingBusSubscribe, loadingBusGetSnapshot, () => SERVER_SNAPSHOT ); } const loadingBusSubscribe = loadingBus.subscribe; const loadingBusGetSnapshot = loadingBus.getSnapshot; /** * Heavy-asset readiness for the camera intro dolly (original cV's `p`: * models + image layers ready — fonts are NOT part of this gate). */ export function useAppReady(): boolean { const heavy = useHeavyLoad(); // Safety valve: a stalled asset must never soft-lock the page. useEffect(() => { const safety = window.setTimeout(() => loadingBus.forceReady(), 6000); return () => window.clearTimeout(safety); }, []); return heavy.ready; }