"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.CaptionComponent = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _react = _interopRequireDefault(require("react"));
var _react2 = require("@emotion/react");
var _reactIntl = require("react-intl");
var _primitives = require("@atlaskit/primitives");
var _messages = require("./messages");
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(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
 */ // 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
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
var captionWrapperStyle = (0, _react2.css)({
  marginTop: "var(--ds-space-100, 8px)",
  textAlign: 'center',
  position: 'relative',
  color: "var(--ds-text-subtle, #505258)"
});
var placeholderStyle = (0, _primitives.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
var CaptionComponent = exports.CaptionComponent = /*#__PURE__*/function (_React$Component) {
  function CaptionComponent() {
    (0, _classCallCheck2.default)(this, CaptionComponent);
    return _callSuper(this, CaptionComponent, arguments);
  }
  (0, _inherits2.default)(CaptionComponent, _React$Component);
  return (0, _createClass2.default)(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 (0, _react2.jsx)("div", (0, _extends2.default)({
        "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 ? (0, _react2.jsx)(_primitives.Box, {
        xcss: placeholderStyle
      }, (0, _react2.jsx)(_primitives.Text, null, formatMessage(_messages.messages.placeholder))) : null, children);
    }
  }]);
}(_react.default.Component); // eslint-disable-next-line @typescript-eslint/ban-types
var _default_1 = (0, _reactIntl.injectIntl)(CaptionComponent);
var _default = exports.default = _default_1;