/*!
 * Copyright (c) Microsoft. All rights reserved.
 * Licensed under the MIT license. See LICENSE file in the project.
 */ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { CommandBar, MessageBar, MessageBarType } from '@fluentui/react';
import { memo, useState } from 'react';
import { useOnUpdateWorkflowJson, useProjectManagementCommands } from './ProjectManagementCommandBar.hooks.js';
export const ProjectManagementCommandBar = /*#__PURE__*/ memo(function ProjectManagementCommandBar({ workflow , tables , outputTables , onUpdateWorkflow , onUpdateTables , itemProps , ...props }) {
    const [error, setError] = useState('');
    const onUpdateWorkflowJson = useOnUpdateWorkflowJson(onUpdateWorkflow);
    const commands = useProjectManagementCommands(workflow, tables, outputTables, itemProps, onUpdateWorkflowJson, onUpdateTables, setError);
    return /*#__PURE__*/ _jsxs(_Fragment, {
        children: [
            error ? /*#__PURE__*/ _jsx(MessageBar, {
                messageBarType: MessageBarType.error,
                isMultiline: false,
                onDismiss: ()=>setError(''),
                dismissButtonAriaLabel: "Close",
                children: error
            }) : null,
            /*#__PURE__*/ _jsx(CommandBar, {
                items: commands,
                ...props
            })
        ]
    });
});
