import _extends from "@babel/runtime/helpers/extends";
// Copyright 1999-2020. Plesk International GmbH. All rights reserved.
import React, { cloneElement, isValidElement, Children } from 'react';
import classNames from 'classnames';
import { CLS_PREFIX } from '../../constants';

/**
 * Auxiliary Actions component is used for executing additional (not primary) actions.
 * @since 0.4.1
 */
const AuxiliaryActions = ({
  baseClassName = "".concat(CLS_PREFIX, "auxiliary-actions"),
  className,
  separator = /*#__PURE__*/React.createElement("span", {
    className: "".concat(baseClassName, "__separator")
  }, ' | '),
  children,
  ...props
}) => /*#__PURE__*/React.createElement("span", _extends({
  className: classNames(baseClassName, className)
}, props), Children.toArray(children).reduce((accu, elem, index) => accu.length === 0 ? [elem] : [...accu, /*#__PURE__*/isValidElement(separator) ? /*#__PURE__*/cloneElement(separator, {
  key: index
}) : separator, elem], []));

export default AuxiliaryActions;