var _excluded = ["children"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
import React from 'react';
import { addSubcomponents } from '../_utils/addSubcomponents';
import { slotify } from '../_utils/slotify';
import { StyledAssets, StyledSubtext, StyledText, StyledTitle, StyledTitleActions, StyledTitleContent, StyledTitlePill } from './Title.styles';
function isValidElement(element) {
  return Boolean(element);
}
var Title_ = /*#__PURE__*/React.forwardRef(function Title_(_ref, ref) {
  var children = _ref.children,
    props = _objectWithoutProperties(_ref, _excluded);
  var _slotify = slotify(children, {
      pills: TitlePills,
      text: TitleText,
      subtext: TitleSubtext,
      actions: TitleActions,
      assets: TitleAssets
    }),
    pills = _slotify.pills,
    text = _slotify.text,
    subtext = _slotify.subtext,
    actions = _slotify.actions,
    assets = _slotify.assets;
  var hasActions = isValidElement(actions.slotChildren);
  var hasAssets = isValidElement(assets.slotChildren);
  var hasPills = isValidElement(pills.slotChildren);
  var hasText = isValidElement(text.slotChildren);
  var hasSubtext = isValidElement(subtext.slotChildren);
  var isEmpty = [hasActions, hasAssets, hasPills, hasText, hasSubtext].every(function (el) {
    return !el;
  });
  if (isEmpty) {
    return null;
  }
  return /*#__PURE__*/React.createElement(StyledTitle, _extends({
    ref: ref
  }, props), hasAssets && /*#__PURE__*/React.createElement(StyledAssets, _extends({
    ref: assets.slotRef
  }, assets.slotProps), assets.slotChildren), /*#__PURE__*/React.createElement(StyledTitleContent, {
    $hasActions: hasActions
  }, hasText && /*#__PURE__*/React.createElement(StyledText, _extends({
    ref: text.slotRef
  }, text.slotProps), text.slotChildren), hasPills && /*#__PURE__*/React.createElement(StyledTitlePill, _extends({
    ref: pills.slotRef
  }, pills.slotProps), pills.slotChildren), hasSubtext && /*#__PURE__*/React.createElement(StyledSubtext, _extends({
    ref: subtext.slotRef
  }, subtext.slotProps, {
    color: "gray45"
  }), subtext.slotChildren)), hasActions && /*#__PURE__*/React.createElement(StyledTitleActions, _extends({
    ref: actions.slotRef
  }, actions.slotProps), actions.slotChildren));
});
var TitlePills = /*#__PURE__*/React.forwardRef(function TitlePills() {
  return /*#__PURE__*/React.createElement("div", null);
});
var TitleText = /*#__PURE__*/React.forwardRef(function TitleText() {
  return /*#__PURE__*/React.createElement("div", null);
});
var TitleSubtext = /*#__PURE__*/React.forwardRef(function TitleSubtext() {
  return /*#__PURE__*/React.createElement("div", null);
});
var TitleActions = /*#__PURE__*/React.forwardRef(function TitleActions() {
  return /*#__PURE__*/React.createElement("div", null);
});
var TitleAssets = /*#__PURE__*/React.forwardRef(function TitleAssets() {
  return /*#__PURE__*/React.createElement("div", null);
});
export var Title = addSubcomponents({
  Pills: TitlePills,
  Text: TitleText,
  Subtext: TitleSubtext,
  Actions: TitleActions,
  Assets: TitleAssets
}, Title_);
//# sourceMappingURL=Title.js.map