import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { needsAgentAttention } from "../editor/services/agentStatus";
import { MessageSquare, X } from "lucide-react";
import { AgentCard, getInboxAttentionPriority } from "./AgentCard";
/**
 * Helper to check if an agent needs attention
 * Includes: waitingForApproval, waitingForInput, costLimitReached, error, idle, completed (ready for next prompt)
 */
export function agentNeedsAttention(agent) {
    return needsAgentAttention(agent.status);
}
/**
 * Inbox view showing agents that need user attention.
 * Displays agents with statuses: waitingForApproval, costLimitReached, error, idle
 */
export function AgentsInbox({ agents, onOpenAgent, onDismissAgent, onCloseAll, formatDateTime, loading, selectedAgentId, }) {
    // Filter and sort agents by priority
    const inboxAgents = agents
        .filter(agentNeedsAttention)
        .sort((a, b) => getInboxAttentionPriority(a) - getInboxAttentionPriority(b));
    if (loading) {
        return (_jsx("div", { className: "flex h-64 items-center justify-center", children: _jsx("div", { className: "text-sm text-gray-500", children: "Loading..." }) }));
    }
    if (inboxAgents.length === 0) {
        return (_jsxs("div", { className: "flex h-[400px] flex-col items-center justify-center p-6 text-center", children: [_jsxs("div", { className: "relative mb-6", children: [_jsx("div", { className: "absolute inset-0 scale-150 rounded-full bg-green-400 opacity-20 blur-3xl" }), _jsx("div", { className: "relative flex h-20 w-20 items-center justify-center rounded-full bg-green-50 shadow-[0_0_40px_rgba(74,222,128,0.15)] ring-1 ring-green-100", children: _jsx(MessageSquare, { className: "size-10 text-green-500", strokeWidth: 1 }) })] }), _jsx("h3", { className: "mb-2 text-xl font-bold tracking-tight text-gray-900", children: "All caught up!" }), _jsx("p", { className: "max-w-[240px] text-[15px] leading-relaxed text-gray-500", children: "No agents need your attention right now. You're doing great!" })] }));
    }
    return (_jsxs("div", { className: "flex flex-col gap-6 p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-lg font-semibold tracking-tight text-gray-900", children: "Action Required" }), _jsxs("p", { className: "text-[13px] text-gray-500", children: [inboxAgents.length, " agent", inboxAgents.length !== 1 ? "s" : "", " need attention"] })] }), onCloseAll && inboxAgents.length > 1 && (_jsxs("button", { onClick: onCloseAll, className: "flex items-center gap-2 rounded-full border border-gray-200 bg-white px-3 py-1.5 text-xs font-medium text-gray-600 transition-all hover:bg-gray-50 hover:text-gray-900", children: [_jsx(X, { className: "size-3.5", strokeWidth: 2 }), "Close All"] }))] }), _jsx("div", { className: "grid gap-4", children: inboxAgents.map((agent) => (_jsx(AgentCard, { agent: agent, onClick: onOpenAgent, onDismiss: onDismissAgent, formatDateTime: formatDateTime, selected: selectedAgentId === agent.id }, agent.id))) })] }));
}
//# sourceMappingURL=AgentsInbox.js.map