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

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
require("./index.compiled.css");
var React = _interopRequireWildcard(require("react"));
var _runtime = require("@compiled/react/runtime");
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _compiled = require("@atlaskit/primitives/compiled");
var _constants = require("../../../../../../constants");
var _elements = require("../../../elements");
var _block = _interopRequireDefault(require("../../block"));
var _elementGroup = _interopRequireDefault(require("../../element-group"));
var _utils = require("../../utils");
var _excluded = ["actionGroup", "metadata", "position", "subtitle", "testId", "text", "icon", "title", "metadataPosition", "hideIcon", "CompetitorPrompt", "url", "hideIconLoadingSkeleton"];
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 style = null;
var styles = {
  titleBox: "_1e0c1txw _2lx2vrvc _4cvr1h6o _1bsb1osq"
};

/**
 * This renders a fully resolved TitleBlock.
 * This should render when a Smart Link returns a valid response.
 * @see TitleBlock
 */
var TitleBlockResolvedView = function TitleBlockResolvedView(_ref) {
  var actionGroup = _ref.actionGroup,
    _ref$metadata = _ref.metadata,
    metadata = _ref$metadata === void 0 ? [] : _ref$metadata,
    position = _ref.position,
    _ref$subtitle = _ref.subtitle,
    subtitle = _ref$subtitle === void 0 ? [] : _ref$subtitle,
    testId = _ref.testId,
    _text = _ref.text,
    icon = _ref.icon,
    title = _ref.title,
    metadataPosition = _ref.metadataPosition,
    hideIcon = _ref.hideIcon,
    CompetitorPrompt = _ref.CompetitorPrompt,
    url = _ref.url,
    hideIconLoadingSkeleton = _ref.hideIconLoadingSkeleton,
    blockProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var size = blockProps.size;
  var metadataElements = (0, _utils.renderElementItems)(metadata);
  var subtitleElements = (0, _utils.renderElementItems)(subtitle);
  return /*#__PURE__*/React.createElement(_block.default, (0, _extends2.default)({}, blockProps, {
    testId: "".concat(testId, "-resolved-view")
  }), !hideIcon && /*#__PURE__*/React.createElement(_elements.LinkIcon, {
    overrideIcon: icon,
    position: position,
    size: size,
    hideLoadingSkeleton: hideIconLoadingSkeleton
  }), /*#__PURE__*/React.createElement(_elementGroup.default, {
    direction: _constants.SmartLinkDirection.Vertical,
    width: _constants.SmartLinkWidth.Flexible,
    size: blockProps.size,
    className: (0, _runtime.ax)(["_zulp1b66"])
  }, CompetitorPrompt && url ? /*#__PURE__*/React.createElement(_compiled.Box, {
    xcss: styles.titleBox
  }, title, /*#__PURE__*/React.createElement(CompetitorPrompt, {
    sourceUrl: url,
    linkType: 'card'
  })) : title, subtitleElements && /*#__PURE__*/React.createElement(_elementGroup.default, {
    direction: _constants.SmartLinkDirection.Horizontal
  }, subtitleElements)), metadataElements && /*#__PURE__*/React.createElement(_elementGroup.default, {
    direction: _constants.SmartLinkDirection.Horizontal,
    align: _constants.SmartLinkAlignment.Right,
    position: metadataPosition !== null && metadataPosition !== void 0 ? metadataPosition : _constants.SmartLinkPosition.Center,
    size: blockProps.size
  }, metadataElements), actionGroup);
};
var _default = exports.default = TitleBlockResolvedView;