const { useState: useStateRail, useEffect: useEffectRail, useRef: useRefRail } = React; // Left rail: global navigation on top, the report stepper while a report is // open, and the user card at the bottom. All navigation goes through the // setters app.jsx passes in so the hash router (buildHash) stays the single // source of truth for the URL. function Sidebar({ user, step, maxStep, steps, reportId, collapsed, onToggleCollapse, onStep, goHome, goNew, onRepository, onSettings, onBilling, onSignOut, navLocked = false, }) { const [menuOpen, setMenuOpen] = useStateRail(false); const menuRef = useRefRail(null); useEffectRail(() => { if (!menuOpen) return; const handler = (e) => { if (menuRef.current && !menuRef.current.contains(e.target)) setMenuOpen(false); }; document.addEventListener("mousedown", handler); return () => document.removeEventListener("mousedown", handler); }, [menuOpen]); const inReport = typeof step === "number"; const isHome = step === "home"; const isNew = step === 0 && !reportId; const isRepo = step === "repository" || step === "repository-upsell"; const initials = user?.initials || "?"; const name = user?.name || "Account"; const link = (label, icon, active, onClick) => ( ); return ( ); } window.Sidebar = Sidebar;