/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["className", "testId"];
import "./index.compiled.css";
import { ax, ix } from "@compiled/react/runtime";
import React from 'react';
import { InternalActionName } from '../../../../../constants';
import { useFlexibleCardContext } from '../../../../../state/flexible-ui-context';
import { BaseTextElement } from '../common';
var baseStyle = null;
var isMessageDescriptor = function isMessageDescriptor(x) {
  return ! /*#__PURE__*/React.isValidElement(x);
};
var fontOverrideStyleMap = {
  'font.body': "_11c8fhey",
  'font.body.large': "_11c81d4k",
  'font.body.small': "_11c8wadc",
  'font.body.UNSAFE_small': "_11c8rymc"
};
var maxLinesCss = null;
var CustomElementByAccessType = function CustomElementByAccessType(_ref) {
  var _context$data, _props, _context$data2;
  var className = _ref.className,
    _ref$testId = _ref.testId,
    testId = _ref$testId === void 0 ? 'custom-by-access-type-element' : _ref$testId,
    props = _objectWithoutProperties(_ref, _excluded);
  var context = useFlexibleCardContext();
  var accessType = context === null || context === void 0 || (_context$data = context.data) === null || _context$data === void 0 || (_context$data = _context$data.meta) === null || _context$data === void 0 ? void 0 : _context$data.accessType;
  var contentForAccessType = (_props = props[accessType]) !== null && _props !== void 0 ? _props : props.fallback;
  if (!contentForAccessType) {
    return null;
  }
  var values = context === null || context === void 0 || (_context$data2 = context.data) === null || _context$data2 === void 0 || (_context$data2 = _context$data2.actions) === null || _context$data2 === void 0 || (_context$data2 = _context$data2[InternalActionName.UnresolvedAction]) === null || _context$data2 === void 0 ? void 0 : _context$data2.values;
  if (isMessageDescriptor(contentForAccessType)) {
    return /*#__PURE__*/React.createElement(BaseTextElement, _extends({}, props, {
      message: {
        descriptor: contentForAccessType,
        values: values
      }
      // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
      ,
      className: className,
      testId: testId,
      hideFormat: true
    }));
  }
  return /*#__PURE__*/React.createElement("span", {
    style: {
      color: props.color
    },
    "data-separator": true,
    "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", props.fontSize !== undefined && fontOverrideStyleMap[props.fontSize], "_1yyjkb7n _102k1j6v", className])
  }, contentForAccessType);
};
export default CustomElementByAccessType;