import { jsx as _jsx } from "react/jsx-runtime";
import { GenericToolbar } from "./GenericToolbar";
import { ReviewCommands, InsertControls, ViewportControls, ViewPanelControls, UtilityControls, CompareControls, UndoRedoControls, AgentCommandsToolbar, ContentTreeToggle, } from "./toolbar-sections";
export function createEditToolbar(editContext) {
    if (!editContext)
        return null;
    const activeSlotContext = editContext.getActiveSlotContext();
    const hasLayout = activeSlotContext?.item?.hasLayout ??
        editContext.item?.hasLayout ??
        activeSlotContext?.primaryPageViewContext.page?.item?.hasLayout;
    const isReviewsWorkspace = editContext.workspaceId === "reviews" ||
        editContext.workspaceId === "comments";
    // For items without layout (simple content editor)
    if (!hasLayout) {
        const left = [
            {
                key: "content-tree-toggle",
                component: _jsx(ContentTreeToggle, {}),
            },
            {
                key: "undo-redo-controls",
                component: _jsx(UndoRedoControls, {}),
            },
        ];
        const center = [
            {
                key: "compare",
                component: _jsx(CompareControls, {}),
            },
        ];
        return (_jsx(GenericToolbar, { left: left, center: center, right: [
                {
                    key: "agent-commands",
                    component: _jsx(AgentCommandsToolbar, {}),
                },
                {
                    key: "utility-controls",
                    component: _jsx(UtilityControls, {}),
                },
            ] }));
    }
    // For pages with layout
    const left = [];
    const right = [];
    const center = [];
    // Add review commands if in reviews view
    // Insert controls
    left.push({
        key: "content-tree-toggle",
        component: _jsx(ContentTreeToggle, {}),
    });
    left.push({
        key: "insert-controls",
        component: _jsx(InsertControls, {}),
    });
    // Undo/Redo controls
    left.push({
        key: "undo-redo-controls",
        component: _jsx(UndoRedoControls, {}),
    });
    if (isReviewsWorkspace) {
        left.push({
            key: "review-commands",
            component: _jsx(ReviewCommands, {}),
        });
    }
    // Viewport controls (desktop/mobile/form)
    center.push({
        key: "viewport-controls",
        component: _jsx(ViewportControls, {}),
    });
    // Keep the viewport/zoom/preview cluster centered; the utility/action
    // controls stay anchored on the right.
    right.push({
        key: "view-panel-controls",
        component: _jsx(ViewPanelControls, {}),
    });
    right.push({
        key: "utility-controls",
        component: _jsx(UtilityControls, {}),
    });
    right.push({
        key: "agent-commands",
        component: _jsx(AgentCommandsToolbar, {}),
    });
    return _jsx(GenericToolbar, { left: left, right: right, center: center });
}
//# sourceMappingURL=ToolbarFactory.js.map