"use client";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { memo } from "react";
import { cn } from "@stigmer/theme";
import { formatDuration, formatMicroUsd, formatTokenCount } from "../format-utils";
const BIGINT_ZERO = BigInt(0);
/**
 * Tooltip content for a waterfall bar hover.
 *
 * Shows task name, kind, status, duration, cost, and tokens in a
 * compact layout. Designed to be placed in a popover/tooltip container
 * by the parent component.
 */
export const WaterfallTooltip = memo(function WaterfallTooltip({ entry, nowMs, className, }) {
    const effectiveDuration = entry.endMs != null
        ? entry.endMs - entry.startMs
        : nowMs - entry.startMs;
    return (_jsxs("div", { className: cn("space-y-1 text-[11px]", className), children: [_jsx("div", { className: "font-medium text-[var(--stgm-popover-foreground,#171717)]", children: entry.taskName }), _jsxs("div", { className: "text-[var(--stgm-muted-foreground,#737373)]", children: [entry.status, entry.attempts.length > 1 && ` (${entry.attempts.length} attempts)`] }), entry.status !== "skipped" && entry.status !== "not_reached" && (_jsx("div", { className: "tabular-nums text-[var(--stgm-popover-foreground,#171717)]", children: formatDuration(entry.durationMs || effectiveDuration) })), entry.costMicros > BIGINT_ZERO && (_jsx("div", { className: "tabular-nums text-[var(--stgm-popover-foreground,#171717)]", children: formatMicroUsd(entry.costMicros) })), entry.tokensUsed > BIGINT_ZERO && (_jsxs("div", { className: "tabular-nums text-[var(--stgm-popover-foreground,#171717)]", children: [formatTokenCount(entry.tokensUsed), " tokens"] })), entry.approvalWaitMs != null && entry.approvalWaitMs > 0 && (_jsxs("div", { className: "text-[var(--stgm-warning,#f59e0b)]", children: ["Approval wait: ", formatDuration(entry.approvalWaitMs)] })), entry.children.length > 0 && (_jsxs("div", { className: "text-[var(--stgm-muted-foreground,#737373)]", children: [entry.children.length, " agent call", entry.children.length > 1 ? "s" : ""] }))] }));
});
//# sourceMappingURL=WaterfallTooltip.js.map