import React from 'react';
import { registerWidget, Value } from '../Value';
import { IndentLevelContext, indent } from '../widgetUtils';
registerWidget('callExpression', function (_a) {
    var value = _a.value;
    var level = React.useContext(IndentLevelContext);
    return (React.createElement(React.Fragment, null,
        value.name && React.createElement(Value, { value: value.name }),
        React.createElement("span", { className: "token punctuation" }, "("),
        React.createElement(React.Fragment, null, value.parameters.map(function (p, index) { return (React.createElement(React.Fragment, { key: index },
            index !== 0 && React.createElement("span", { className: "token punctuation" }, ", "),
            value.parameters.length > 1 && (React.createElement(React.Fragment, null,
                React.createElement("br", null),
                indent(level + 1))),
            value.parameters.length > 1 ? (React.createElement(IndentLevelContext.Provider, { value: level + 1 },
                React.createElement(Value, { value: p }))) : (React.createElement(Value, { value: p })),
            index === value.parameters.length - 1 && index > 0 && (React.createElement(React.Fragment, null,
                React.createElement("br", null),
                indent(level))))); })),
        React.createElement("span", { className: "token punctuation" }, ")")));
});
