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

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.toTextProps = exports.toFormattedTextProps = exports.default = exports.BaseTextElement = void 0;
require("./index.compiled.css");
var React = _interopRequireWildcard(require("react"));
var _runtime = require("@compiled/react/runtime");
var _utils = require("../../../utils");
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 baseStyle = null;
var fontOverrideStyleMap = {
  'font.body': "_11c8fhey",
  'font.body.large': "_11c81d4k",
  'font.body.small': "_11c8wadc"
};
/**
 * A base element that displays some Text.
 * @internal
 * @param {TextProps} TextProps - The props necessary for the Text element.
 * @see Title
 */
var BaseTextElement = exports.BaseTextElement = function BaseTextElement(_ref) {
  var content = _ref.content,
    _ref$maxLines = _ref.maxLines,
    maxLines = _ref$maxLines === void 0 ? 1 : _ref$maxLines,
    message = _ref.message,
    name = _ref.name,
    className = _ref.className,
    _ref$testId = _ref.testId,
    testId = _ref$testId === void 0 ? 'smart-element-text' : _ref$testId,
    _ref$hideFormat = _ref.hideFormat,
    hideFormat = _ref$hideFormat === void 0 ? false : _ref$hideFormat,
    color = _ref.color,
    fontSize = _ref.fontSize;
  if (!message && !content) {
    return null;
  }
  var dynamicCss = null;
  var formattedContent = hideFormat && content ? content : (0, _utils.getFormattedMessage)(message) || content;
  return /*#__PURE__*/React.createElement("span", {
    "data-separator": true,
    "data-smart-element": name,
    "data-smart-element-text": true,
    "data-testid": testId
    // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
    ,
    className: (0, _runtime.ax)(["_11c8wadc _1reo15vq _18m915vq _syazazsu _o5724jg8 _1e0ccj1k _1ul9idpf _1bto1l2s _1nmz1hna _sudp1e54", fontSize !== undefined && fontOverrideStyleMap[fontSize], "_1yyjr31u _102klxil", className]),
    style: {
      color: color,
      "--_1erfju8": (0, _runtime.ix)(maxLines),
      "--_ohw86c": (0, _runtime.ix)("calc(".concat(maxLines, " * 1rem)"))
    }
  }, formattedContent);
};
var _default = exports.default = BaseTextElement;
var toFormattedTextProps = exports.toFormattedTextProps = function toFormattedTextProps(descriptor, context) {
  return context ? {
    message: {
      descriptor: descriptor,
      values: {
        context: context
      }
    },
    content: context
  } : undefined;
};
var toTextProps = exports.toTextProps = function toTextProps(content) {
  return content ? {
    content: content
  } : undefined;
};