/* main.tsx generated by @compiled/babel-plugin v0.38.1 */
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.AutomationModalHeader = void 0;
require("./main.compiled.css");
var React = _interopRequireWildcard(require("react"));
var _runtime = require("@compiled/react/runtime");
var _reactIntlNext = require("react-intl-next");
var _heading = _interopRequireDefault(require("@atlaskit/heading"));
var _automation = _interopRequireDefault(require("@atlaskit/icon/core/automation"));
var _modalDialog = require("@atlaskit/modal-dialog");
var _compiled = require("@atlaskit/primitives/compiled");
var _menuContext = require("../../menu-context");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var styles = {
  iconStyle: "_2rko12b0 _18zr1b66 _1rjcv77o _2hwxutpp",
  modalDescriptionStyle: "_19pkutpp"
};
var i18n = (0, _reactIntlNext.defineMessages)({
  modalHeaderIconLabel: {
    id: 'automation-menu.modal.header.icon.label',
    defaultMessage: 'Automation modal header icon',
    description: 'A label for the icon in the header of the automation modal.'
  }
});
var AutomationModalHeader = exports.AutomationModalHeader = function AutomationModalHeader(_ref) {
  var modalTitle = _ref.modalTitle,
    modalDescription = _ref.modalDescription;
  var _useIntl = (0, _reactIntlNext.useIntl)(),
    formatMessage = _useIntl.formatMessage;
  var _useAutomationMenu = (0, _menuContext.useAutomationMenu)(),
    initialised = _useAutomationMenu.initialised,
    rules = _useAutomationMenu.rules;
  var _useModal = (0, _modalDialog.useModal)(),
    titleId = _useModal.titleId;
  var showDescription = initialised && rules.length > 0 && !!modalDescription;
  return /*#__PURE__*/React.createElement(_modalDialog.ModalHeader, {
    hasCloseButton: true
  }, /*#__PURE__*/React.createElement(_compiled.Stack, null, /*#__PURE__*/React.createElement(_compiled.Inline, {
    alignBlock: "center"
  }, /*#__PURE__*/React.createElement(_compiled.Box, {
    xcss: styles.iconStyle
    // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
    ,
    backgroundColor: "color.background.accent.green.subtlest"
  }, /*#__PURE__*/React.createElement(_automation.default, {
    size: "small",
    label: formatMessage(i18n.modalHeaderIconLabel),
    color: "var(--ds-icon-accent-green, #22A06B)",
    spacing: "compact"
  })), /*#__PURE__*/React.createElement(_heading.default, {
    size: "medium",
    id: titleId
  }, modalTitle)), showDescription && /*#__PURE__*/React.createElement(_compiled.Box, {
    xcss: styles.modalDescriptionStyle
  }, modalDescription)));
};