'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Tabs, TabsList, TabsTrigger, TabsContent } from '../ui/tabs.js';
import { PromptEditor } from './prompt-editor.js';
import { AgentGraphView } from './agent-graph-view.js';
import { AgentPlayground } from './agent-playground.js';
export function AgentEditorTabs({ agentType, prompts, graph, bundledGraph, hasGraphOverride, }) {
    const [selectedPromptId, setSelectedPromptId] = useState(prompts[0]?.promptId ?? 'evaluator.system');
    const selectedPrompt = prompts.find((p) => p.promptId === selectedPromptId);
    const { t } = useTranslation('web');
    return (_jsxs(Tabs, { defaultValue: "prompts", "data-testid": "agent-editor-tabs", children: [_jsxs(TabsList, { children: [_jsx(TabsTrigger, { value: "prompts", children: t('agentEditor.prompts') }), _jsx(TabsTrigger, { value: "graph", children: t('agentEditor.graph') }), _jsx(TabsTrigger, { value: "playground", children: t('agentEditor.playground') })] }), _jsx(TabsContent, { value: "prompts", className: "mt-4", children: _jsx(PromptEditor, { entries: prompts }) }), _jsx(TabsContent, { value: "graph", className: "mt-4", children: _jsx(AgentGraphView, { graph: graph, bundled: bundledGraph ?? null, hasOverride: hasGraphOverride ?? false }) }), _jsxs(TabsContent, { value: "playground", className: "mt-4 flex flex-col gap-3", children: [prompts.length > 1 ? (_jsxs("div", { className: "flex items-center gap-2 text-xs", children: [_jsx("label", { htmlFor: "playground-prompt-select", className: "text-muted-foreground", children: t('agentEditor.usePrompt') }), _jsx("select", { id: "playground-prompt-select", value: selectedPromptId, onChange: (e) => setSelectedPromptId(e.target.value), className: "border-border bg-background rounded border px-2 py-1 text-xs", "data-testid": "playground-prompt-select", children: prompts.map((p) => (_jsx("option", { value: p.promptId, children: p.name }, p.promptId))) })] })) : null, _jsx(AgentPlayground, { agentType: agentType, promptId: selectedPromptId, ...(selectedPrompt?.hasOverride && { inlinePromptBody: selectedPrompt.effectiveBody }) })] })] }));
}
