/* index.tsx generated by @compiled/babel-plugin v0.38.1 */
import _extends from "@babel/runtime/helpers/extends";
import "./index.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import { fg } from '@atlaskit/platform-feature-flags';
import { Box } from '@atlaskit/primitives/compiled';
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkWidth } from '../../../../../../constants';
import { LinkIcon } from '../../../elements';
import Block from '../../block';
import ElementGroup from '../../element-group';
import { renderElementItems } from '../../utils';
const style = null;
const 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
 */
const TitleBlockResolvedView = ({
  actionGroup,
  metadata = [],
  position,
  subtitle = [],
  testId,
  text,
  icon,
  title,
  metadataPosition,
  hideIcon,
  CompetitorPrompt,
  url,
  hideIconLoadingSkeleton,
  ...blockProps
}) => {
  const {
    size
  } = blockProps;
  const metadataElements = renderElementItems(metadata);
  const subtitleElements = renderElementItems(subtitle);
  return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
    testId: `${testId}-resolved-view`
  }), !hideIcon && /*#__PURE__*/React.createElement(LinkIcon, {
    overrideIcon: icon,
    position: position,
    size: size,
    hideLoadingSkeleton: hideIconLoadingSkeleton
  }), /*#__PURE__*/React.createElement(ElementGroup, {
    direction: SmartLinkDirection.Vertical,
    width: SmartLinkWidth.Flexible,
    size: blockProps.size,
    className: ax(["_zulp1b66"])
  }, CompetitorPrompt && url && fg('prompt_whiteboard_competitor_link_gate') ? /*#__PURE__*/React.createElement(Box, {
    xcss: styles.titleBox
  }, title, /*#__PURE__*/React.createElement(CompetitorPrompt, {
    sourceUrl: url,
    linkType: 'card'
  })) : title, subtitleElements && /*#__PURE__*/React.createElement(ElementGroup, {
    direction: SmartLinkDirection.Horizontal
  }, subtitleElements)), metadataElements && /*#__PURE__*/React.createElement(ElementGroup, {
    direction: SmartLinkDirection.Horizontal,
    align: SmartLinkAlignment.Right,
    position: metadataPosition !== null && metadataPosition !== void 0 ? metadataPosition : SmartLinkPosition.Center,
    size: blockProps.size
  }, metadataElements), actionGroup);
};
export default TitleBlockResolvedView;