function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import { Text, View } from 'react-native';
import { memo } from 'react';
import ImageElement from '../CommonElements/ImageElement';
import { useStyles } from './styles';
import { useUser } from '../../hooks/objects';
import { isModerator, useAmityElement } from '../../hooks';
import { ComponentID, ElementID, PageID } from '../../enums';
const ModeratorBadgeElement = ({
  pageID = PageID.WildCardPage,
  componentID = ComponentID.WildCardComponent,
  userId,
  communityId,
  ...props
}) => {
  const {
    user
  } = useUser({
    userId
  });
  const elementID = ElementID.moderator_badge;
  const {
    isExcluded,
    config,
    accessibilityId,
    themeStyles
  } = useAmityElement({
    pageId: pageID,
    componentId: componentID,
    elementId: elementID
  });
  const styles = useStyles(themeStyles);
  if (isExcluded) return null;
  if (!isModerator(user === null || user === void 0 ? void 0 : user.roles) || !communityId || !userId) return null;
  const text = (config === null || config === void 0 ? void 0 : config.text) ?? '';
  return /*#__PURE__*/React.createElement(View, {
    style: styles.moderatorRow
  }, /*#__PURE__*/React.createElement(ImageElement, {
    configKey: "icon",
    pageID: pageID,
    componentID: componentID,
    elementID: ElementID.moderator_badge,
    style: styles.moderatorBadge
  }), /*#__PURE__*/React.createElement(Text, _extends({
    style: styles.moderatorTitle,
    testID: accessibilityId,
    accessibilityLabel: accessibilityId
  }, props), text));
};
export default /*#__PURE__*/memo(ModeratorBadgeElement);
//# sourceMappingURL=ModeratorBadgeElement.js.map