import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
import Typography from '../../Typography/Typography.js';

const MachineInstances = ({ getChildNodeComponent, parentNodeIndex, parentNodeData, verticalLineHeight, datasetHeight, curveHeights, itemRefs, datasetRef, isReadOnlyMode, hideNodeAtLast, }) => {
    return (jsx(Fragment, { children: parentNodeData?.machineInstances?.length === 0 ? (jsx(Fragment, { children: !isReadOnlyMode && (jsxs(Fragment, { children: [jsx("div", { className: "ff-selectedMachines-connecting-line", children: jsxs("div", { className: "ff-line", children: [jsx("div", { className: "ff-left-icon ff-left-icon-aligned" }), jsx("div", { className: "ff-right-icon" })] }) }), jsx("div", { className: "ff-machine-instance ff-machine-env-button", children: getChildNodeComponent({
                            isButton: true,
                            parentNodeData,
                            parentNodeIndex,
                        }) })] })) })) : (parentNodeData?.machineInstances?.map((childNodeData, childNodeIndex) => {
            const isFirstLine = childNodeIndex === 0;
            return (jsxs("div", { className: "ff-machine-instance-row", children: [jsxs("div", { className: `ff-selectedMachines-connecting-line ${!isFirstLine ? 'ff-second-line' : ''}`, children: [jsxs("div", { className: "ff-line", children: [jsx("div", { className: `ff-left-icon ${isFirstLine ? 'ff-left-icon-aligned' : ''}` }), jsx("div", { className: "ff-right-icon" })] }), isFirstLine && (jsx("div", { className: "ff-vertical-line", style: { height: `${verticalLineHeight}px` } }))] }), jsx("div", { className: "ff-machine-instance", children: childNodeData?.runLevelExecutionDataSets?.map((runLevelExecutionDataSet, runLevelExecutionDataSetIndex) => (jsx("div", { className: "ff-run-level-execution-dataset", ref: runLevelExecutionDataSetIndex === 0
                                ? datasetRef
                                : null, children: jsxs("div", { className: "ff-execution-item", ref: (element) => (itemRefs.current[runLevelExecutionDataSetIndex] =
                                    element), children: [jsx("div", { className: "ff-curved-connector", style: { top: `${-datasetHeight}px` }, children: jsxs("div", { className: `ff-curve ff-connector-${runLevelExecutionDataSetIndex}`, style: {
                                                height: `${curveHeights[runLevelExecutionDataSetIndex]}px`,
                                            }, children: [jsx("div", { className: `ff-curve-right-icon ff-curve-right-icon-${runLevelExecutionDataSetIndex}` }), Number(childNodeData?.runScriptCount) ? (jsx("div", { className: "ff-selectedMachines-connecting-line-text", children: jsx(Typography, { fontSize: 8, fontWeight: "regular", children: `${![0, '0', null].includes(childNodeData.runScriptCount)
                                                            ? childNodeData.runScriptCount
                                                            : ''} Script${childNodeData.runScriptCount !== 1
                                                            ? 's'
                                                            : ''}` }) })) : (jsx(Fragment, {}))] }) }), jsx("div", { className: "ff-run-data-box", children: getChildNodeComponent({
                                            isButton: false,
                                            childNodeData,
                                            childNodeIndex,
                                            runLevelExecutionDataSet,
                                            runLevelExecutionDataSetIndex,
                                            parentNodeData,
                                            parentNodeIndex,
                                        }) })] }) }, runLevelExecutionDataSet?.runLevelExecutionDataSetId))) }), childNodeIndex ===
                        parentNodeData?.machineInstances.length - 1 &&
                        !hideNodeAtLast && (jsx(Fragment, { children: !isReadOnlyMode && (jsxs(Fragment, { children: [jsx("div", { className: "ff-selectedMachines-connecting-line ff-second-line", children: jsxs("div", { className: "ff-line", children: [jsx("div", { className: "ff-left-icon" }), jsx("div", { className: "ff-right-icon" })] }) }), jsx("div", { className: "ff-machine-instance ff-machine-env-button", children: getChildNodeComponent({
                                        isButton: true,
                                        parentNodeData,
                                        parentNodeIndex,
                                        childNodeIndex: childNodeIndex + 1,
                                    }) })] })) }))] }, childNodeIndex));
        })) }));
};

export { MachineInstances as default };
//# sourceMappingURL=MachineInstances.js.map
