import _extends from "@babel/runtime/helpers/extends";
import React from 'react';
import { ElementName } from '../../../../../constants';
import { messages } from '../../../../../messages';
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
import { BaseTextElement, toFormattedTextProps } from '../common';
const MAX_TEAM_MEMBER_LIMIT = 50;
const TeamMemberCountElement = props => {
  var _context$teamMemberCo;
  const context = useFlexibleUiContext();
  if (!(context !== null && context !== void 0 && context.teamMemberCount)) {
    return null;
  }
  const count = context !== null && context !== void 0 && context.teamMemberCount && (context === null || context === void 0 ? void 0 : context.teamMemberCount) > MAX_TEAM_MEMBER_LIMIT ? `${MAX_TEAM_MEMBER_LIMIT}+` : context === null || context === void 0 ? void 0 : (_context$teamMemberCo = context.teamMemberCount) === null || _context$teamMemberCo === void 0 ? void 0 : _context$teamMemberCo.toString();
  const data = count ? toFormattedTextProps(messages.team_members_count, count) : null;
  return data ? /*#__PURE__*/React.createElement(BaseTextElement, _extends({}, data, props, {
    name: ElementName.TeamMemberCount
  })) : null;
};
export default TeamMemberCountElement;