"use client";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { cn } from "@stigmer/theme";
/**
 * File list with change-type indicators for a multi-file diff.
 *
 * Each file shows its path, change type badge (M/A/D), and a compact
 * `+N -N` additions/deletions count. Files are keyboard-navigable.
 *
 * Zero Console dependencies — safe for platform builder embedding.
 */
export function DiffFileList({ files, selectedPath, onSelect, className, }) {
    if (files.length === 0)
        return null;
    return (_jsx("nav", { "aria-label": "Changed files", className: cn("flex flex-col overflow-auto", className), children: files.map((file) => (_jsxs("button", { type: "button", onClick: () => onSelect(file.path), "aria-current": file.path === selectedPath ? "true" : undefined, className: cn("flex items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset", file.path === selectedPath
                ? "bg-accent-hover text-foreground"
                : "text-muted-foreground hover:bg-accent-hover hover:text-foreground"), children: [_jsx(ChangeTypeBadge, { changeType: file.changeType }), _jsx("span", { className: "min-w-0 flex-1 truncate font-mono", children: file.path }), _jsx(DeltaCount, { additions: file.additions, deletions: file.deletions })] }, file.path))) }));
}
// ---------------------------------------------------------------------------
// Change type badge (M / A / D)
// ---------------------------------------------------------------------------
function ChangeTypeBadge({ changeType, }) {
    const letter = changeType === "modified" ? "M" : changeType === "added" ? "A" : "D";
    const color = changeType === "modified"
        ? "text-diff-hunk-header-fg"
        : changeType === "added"
            ? "text-diff-added-fg"
            : "text-diff-removed-fg";
    return (_jsx("span", { className: cn("shrink-0 font-mono text-[10px] font-bold", color), "aria-label": changeType, children: letter }));
}
// ---------------------------------------------------------------------------
// +N -N delta count
// ---------------------------------------------------------------------------
function DeltaCount({ additions, deletions, }) {
    return (_jsxs("span", { className: "shrink-0 font-mono text-[10px]", children: [additions > 0 && (_jsxs("span", { className: "text-diff-added-fg", children: ["+", additions] })), additions > 0 && deletions > 0 && " ", deletions > 0 && (_jsxs("span", { className: "text-diff-removed-fg", children: ["-", deletions] }))] }));
}
//# sourceMappingURL=DiffFileList.js.map