{"version":3,"file":"SidebarEntry.cjs","names":[],"sources":["../../../src/components/Sidebar/SidebarEntry.tsx"],"sourcesContent":["import { cn } from \"@/utils/cn\";\n\nimport type { SidebarItem } from \"./Sidebar\";\nimport styles from \"./Sidebar.module.css\";\n\n/**\n * One navigation entry: an anchor when it carries an `href`, a button otherwise.\n *\n * A link that navigates has to be a link — middle-click, \"open in new tab\" and\n * the status bar preview all come from the element, not from the handler. A\n * disabled entry falls back to the button, because a disabled anchor does not\n * exist in HTML.\n */\nexport function SidebarEntry({\n    item,\n    active,\n    collapsed,\n    onSelect,\n}: {\n    item: SidebarItem;\n    active: boolean;\n    collapsed: boolean;\n    onSelect?: (key: string) => void;\n}) {\n    const title = collapsed && typeof item.label === \"string\" ? item.label : undefined;\n    const body = (\n        <>\n            {item.icon && <span className={styles.icon}>{item.icon}</span>}\n            {!collapsed && <span className={styles.label}>{item.label}</span>}\n            {!collapsed && item.badge !== undefined && (\n                <span className={styles.badge}>{item.badge}</span>\n            )}\n        </>\n    );\n\n    if (item.href && !item.disabled) {\n        return (\n            <a\n                href={item.href}\n                className={cn(styles.item, active && styles.active)}\n                aria-current={active ? \"page\" : undefined}\n                onClick={() => onSelect?.(item.key)}\n                title={title}\n            >\n                {body}\n            </a>\n        );\n    }\n\n    return (\n        <button\n            type=\"button\"\n            className={cn(styles.item, active && styles.active)}\n            aria-current={active ? \"page\" : undefined}\n            disabled={item.disabled}\n            onClick={() => onSelect?.(item.key)}\n            title={title}\n        >\n            {body}\n        </button>\n    );\n}\n"],"mappings":"2GAaA,SAAgB,EAAa,CACzB,OACA,SACA,YACA,YAMD,CACC,IAAM,EAAQ,GAAa,OAAO,EAAK,OAAU,SAAW,EAAK,MAAQ,IAAA,GACnE,GACF,EAAA,EAAA,KAAA,CAAA,EAAA,SAAA,CAAA,SAAA,CACK,EAAK,OAAQ,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAW,EAAA,QAAO,KAAO,SAAA,EAAK,IAAW,CAAA,EAC5D,CAAC,IAAa,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAW,EAAA,QAAO,MAAQ,SAAA,EAAK,KAAY,CAAA,EAC/D,CAAC,GAAa,EAAK,QAAU,IAAA,KAC1B,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAW,EAAA,QAAO,MAAQ,SAAA,EAAK,KAAY,CAAA,CAEvD,CAAA,CAAA,EAiBN,OAdI,EAAK,MAAQ,CAAC,EAAK,UAEf,EAAA,EAAA,IAAA,CAAC,IAAD,CACI,KAAM,EAAK,KACX,UAAW,EAAA,GAAG,EAAA,QAAO,KAAM,GAAU,EAAA,QAAO,MAAM,EAClD,eAAc,EAAS,OAAS,IAAA,GAChC,YAAe,IAAW,EAAK,GAAG,EAC3B,QAEN,SAAA,CACF,CAAA,GAKP,EAAA,EAAA,IAAA,CAAC,SAAD,CACI,KAAK,SACL,UAAW,EAAA,GAAG,EAAA,QAAO,KAAM,GAAU,EAAA,QAAO,MAAM,EAClD,eAAc,EAAS,OAAS,IAAA,GAChC,SAAU,EAAK,SACf,YAAe,IAAW,EAAK,GAAG,EAC3B,QAEN,SAAA,CACG,CAAA,CAEhB"}