/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
import "./index.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import { getFormattedMessage } from '../../../utils';
var baseStyle = null;
var fontOverrideStyleMap = {
  'font.body': "_11c8fhey",
  'font.body.large': "_11c81d4k",
  'font.body.small': "_11c8wadc",
  'font.body.UNSAFE_small': "_11c8rymc"
};
/**
 * A base element that displays some Text.
 * @internal
 * @param {TextProps} TextProps - The props necessary for the Text element.
 * @see Title
 */
export var 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 : 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: ax(["_11c8wadc _1reo15vq _18m915vq _syazazsu _o5724jg8 _1e0ccj1k _1ul9idpf _1bto1l2s _1nmz1hna _sudp1e54", fontSize !== undefined && fontOverrideStyleMap[fontSize], "_1yyjr31u _102klxil", className]),
    style: {
      color: color,
      "--_1erfju8": ix(maxLines),
      "--_ohw86c": ix("calc(".concat(maxLines, " * 1rem)"))
    }
  }, formattedContent);
};
export default BaseTextElement;
export var toFormattedTextProps = function toFormattedTextProps(descriptor, context) {
  return context ? {
    message: {
      descriptor: descriptor,
      values: {
        context: context
      }
    },
    content: context
  } : undefined;
};
export var toTextProps = function toTextProps(content) {
  return content ? {
    content: content
  } : undefined;
};