import { jsx as _jsx } from "react/jsx-runtime";
import { InlineTextEdit } from '../../../CommonUI/InlineTextEdit';
import { ObserveState } from '../../../CommonUI/StateManagement/ObserveState';
import { BaseSequenceTitle } from '../BaseSequenceTitle';
import { TitleDiv } from '../CommonStyles';
import { RegularSequenceTitle } from '../Regular/SequenceTitle';
export class DiagramSequenceTitle extends BaseSequenceTitle {
    render() {
        const { sequence, displayBehavior } = this.props;
        return _jsx(ObserveState, { listenTo: sequence, properties: ['steps'], control: () => {
                // empty primary renders same as Sequence mode.
                if (sequence.steps.length === 0 && sequence.isPrimary)
                    return _jsx(RegularSequenceTitle, { sequence: sequence, displayBehavior: displayBehavior }, void 0);
                // for end / error stack it always render same with base.
                if (!sequence.isNormal)
                    return _jsx(RegularSequenceTitle, { sequence: sequence, displayBehavior: displayBehavior }, void 0);
                // for MSS, render same as regular mode.
                if (sequence.steps.length !== 1)
                    return _jsx(RegularSequenceTitle, { sequence: sequence, displayBehavior: displayBehavior }, void 0);
                return _jsx(ObserveState, { listenTo: sequence.steps[0], properties: ["name"], control: () => {
                        return (_jsx(TitleDiv, Object.assign({ className: "inline-editor", content: sequence.steps[0].name, isCollapsed: true, isNormal: sequence.isNormal, styles: displayBehavior.getSequenceTitleStyle(sequence) }, { children: _jsx(InlineTextEdit, { text: sequence.steps[0].name || '', onEdit: (newValue) => this.onUpdateStackName(sequence.steps[0], newValue) }, void 0) }), void 0));
                    } }, void 0);
            } }, void 0);
    }
}
//# sourceMappingURL=SequenceTitle.js.map