"use client";
import { jsx as _jsx } from "react/jsx-runtime";
import { memo } from "react";
import { TaskConfigForm } from "../../TaskConfigForm.js";
import { BranchConditionBuilder } from "../../BranchConditionBuilder.js";
import { ApprovalFormBuilder } from "../../ApprovalFormBuilder.js";
import { AgentCallForm } from "../forms/AgentCallForm.js";
import { HttpCallForm } from "../forms/HttpCallForm.js";
/**
 * Configure tab — the primary configuration surface for a selected task.
 *
 * Dispatches to specialized editors for `switch_case` and `human_input`,
 * or falls through to the generic schema-driven `TaskConfigForm`.
 *
 * @since T10 (Inspector Panel Refactor)
 */
export const ConfigureTab = memo(function ConfigureTab({ node, graph, descriptor, kindString, otherTaskNames, onFieldChange, mutations, }) {
    const isSwitchCase = kindString === "switch_case";
    const isHumanInput = kindString === "human_input";
    const isAgentCall = kindString === "agent_call";
    const isHttpCall = kindString === "http_call";
    if (isAgentCall) {
        return _jsx(AgentCallForm, { node: node, onFieldChange: onFieldChange });
    }
    if (isHttpCall) {
        return _jsx(HttpCallForm, { node: node, onFieldChange: onFieldChange });
    }
    if (isSwitchCase && mutations.onUpdateBranchRouting && mutations.onMigrateBranchHandle && mutations.onRemoveBranchEdges) {
        return (_jsx("div", { className: "px-3 py-3", children: _jsx(BranchConditionBuilder, { nodeId: node.id, config: node.config, edges: graph.edges, allTaskNames: otherTaskNames, onUpdateConfig: onFieldChange, onUpdateBranchRouting: (handleId, target) => mutations.onUpdateBranchRouting(node.id, handleId, target), onMigrateBranchHandle: (oldId, newId) => mutations.onMigrateBranchHandle(node.id, oldId, newId), onRemoveBranchEdges: (handleId) => mutations.onRemoveBranchEdges(node.id, handleId) }) }));
    }
    if (isHumanInput && mutations.onUpdateBranchRouting && mutations.onMigrateBranchHandle && mutations.onRemoveBranchEdges) {
        return (_jsx("div", { className: "px-3 py-3", children: _jsx(ApprovalFormBuilder, { nodeId: node.id, config: node.config, edges: graph.edges, allTaskNames: otherTaskNames, onUpdateConfig: onFieldChange, onUpdateBranchRouting: (handleId, target) => mutations.onUpdateBranchRouting(node.id, handleId, target), onMigrateBranchHandle: (oldId, newId) => mutations.onMigrateBranchHandle(node.id, oldId, newId), onRemoveBranchEdges: (handleId) => mutations.onRemoveBranchEdges(node.id, handleId) }) }));
    }
    if (descriptor && descriptor.fields.length > 0) {
        return (_jsx(TaskConfigForm, { fields: descriptor.fields, fieldGroups: descriptor.fieldGroups, config: node.config, onChange: onFieldChange }));
    }
    return (_jsx("div", { className: "px-3 py-4 text-xs text-[var(--stgm-muted-foreground,#737373)]", children: "No configurable fields for this task kind." }));
});
//# sourceMappingURL=ConfigureTab.js.map