"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _reactNative = require("react-native");
var _react = require("react");
var _ImageElement = _interopRequireDefault(require("../CommonElements/ImageElement"));
var _styles = require("./styles");
var _objects = require("../../hooks/objects");
var _hooks = require("../../hooks");
var _enums = require("../../enums");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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); }
const ModeratorBadgeElement = ({
  pageID = _enums.PageID.WildCardPage,
  componentID = _enums.ComponentID.WildCardComponent,
  userId,
  communityId,
  ...props
}) => {
  const {
    user
  } = (0, _objects.useUser)({
    userId
  });
  const elementID = _enums.ElementID.moderator_badge;
  const {
    isExcluded,
    config,
    accessibilityId,
    themeStyles
  } = (0, _hooks.useAmityElement)({
    pageId: pageID,
    componentId: componentID,
    elementId: elementID
  });
  const styles = (0, _styles.useStyles)(themeStyles);
  if (isExcluded) return null;
  if (!(0, _hooks.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(_reactNative.View, {
    style: styles.moderatorRow
  }, /*#__PURE__*/React.createElement(_ImageElement.default, {
    configKey: "icon",
    pageID: pageID,
    componentID: componentID,
    elementID: _enums.ElementID.moderator_badge,
    style: styles.moderatorBadge
  }), /*#__PURE__*/React.createElement(_reactNative.Text, _extends({
    style: styles.moderatorTitle,
    testID: accessibilityId,
    accessibilityLabel: accessibilityId
  }, props), text));
};
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(ModeratorBadgeElement);
//# sourceMappingURL=ModeratorBadgeElement.js.map