import _extends from "@babel/runtime/helpers/extends";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/inherits";
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
/**
 * @jsxRuntime classic
 * @jsx jsx
 */
import React from 'react';

// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic
import { css, jsx } from '@emotion/react';
import { injectIntl } from 'react-intl';

// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
import { Box, Text, xcss } from '@atlaskit/primitives';
import { messages } from './messages';
var captionWrapperStyle = css({
  marginTop: "var(--ds-space-100, 8px)",
  textAlign: 'center',
  position: 'relative',
  color: "var(--ds-text-subtle, #505258)"
});
var placeholderStyle = xcss({
  color: 'color.text.subtlest',
  position: 'absolute',
  top: 'space.0',
  width: '100%'
});
// Ignored via go/ees005
// eslint-disable-next-line @repo/internal/react/no-class-components
export var CaptionComponent = /*#__PURE__*/function (_React$Component) {
  function CaptionComponent() {
    _classCallCheck(this, CaptionComponent);
    return _callSuper(this, CaptionComponent, arguments);
  }
  _inherits(CaptionComponent, _React$Component);
  return _createClass(CaptionComponent, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
        selected = _this$props.selected,
        hasContent = _this$props.hasContent,
        children = _this$props.children,
        dataAttributes = _this$props.dataAttributes,
        formatMessage = _this$props.intl.formatMessage;
      var showPlaceholder = !selected && !hasContent;
      return jsx("div", _extends({
        "data-media-caption": true,
        "data-testid": "media-caption"
        // Ignored via go/ees005
        // eslint-disable-next-line react/jsx-props-no-spreading
      }, dataAttributes, {
        css: captionWrapperStyle
      }), showPlaceholder ? jsx(Box, {
        xcss: placeholderStyle
      }, jsx(Text, null, formatMessage(messages.placeholder))) : null, children);
    }
  }]);
}(React.Component);

// eslint-disable-next-line @typescript-eslint/ban-types
var _default_1 = injectIntl(CaptionComponent);
export default _default_1;