"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _default = function _default(children) {
  var getColumns = function getColumns(children) {
    var columns = [];
    var getCols = function getCols(children) {
      _react["default"].Children.map(children, function (item) {
        var _ref = item,
          props = _ref.props;
        if (props.children && props.children.length) {
          columns.push({
            isGroup: true,
            title: props.align ? /*#__PURE__*/_react["default"].createElement("div", {
              style: {
                textAlign: props.align
              }
            }, props.title || '') : props.title || '',
            children: getColumns(props.children)
          });
        } else {
          columns.push((0, _extends2["default"])({}, props));
        }
      });
    };
    getCols(children);
    return columns;
  };
  return getColumns(children);
};
exports["default"] = _default;