import React__default, { useContext, useState } from 'react';
import { a as LocalizationContext } from '../../LocalizationContext-1701e5c8.js';
import { L as Label, a as LabelTypography, b as LabelColors } from '../../index-f50d7ab0.js';
import Icon, { IconTypes, IconColors } from '../../ui/Icon.js';
import Badge from '../../ui/Badge.js';
import { M as MemberList } from '../../MemberList-415d00a9.js';
import { useChannelSettingsContext } from '../context.js';
import '../../stringSet-e9bb0333.js';
import '../../index-ff8f2f61.js';
import 'prop-types';
import '../../ui/Button.js';
import '../../ui/IconButton.js';
import '../../_rollupPluginBabelHelpers-cc035350.js';
import '../../ui/ContextMenu.js';
import 'react-dom';
import '../../ui/SortByRow.js';
import '../../uuid-8b344dd2.js';
import '../../index-99ab01f6.js';
import '../../utils/message/getOutgoingMessageState.js';
import './UserListItem.js';
import '../../UserProfileContext-74e9a128.js';
import '../../ui/Avatar.js';
import '../../ui/ImageRenderer.js';
import '../../ui/MutedAvatarOverlay.js';
import '../../ui/UserProfile.js';
import '../../sendbirdSelectors.js';
import '../../topics-0b30f52b.js';
import '../../utils-05aa9060.js';
import '../../useSendbirdStateContext.js';
import '../../withSendbird.js';
import '../../ui/Modal.js';
import '../../index-44c86e58.js';
import '../../MediaQueryContext-e5b401d0.js';
import '../../ui/UserListItem.js';
import '../../ui/Checkbox.js';

const kFormatter = num => {
  return Math.abs(num) > 999 ? `${(Math.abs(num) / 1000).toFixed(1)}K` : num;
};
const UserPanel = () => {
  const {
    stringSet
  } = useContext(LocalizationContext);
  const [showAccordion, setShowAccordion] = useState(false);
  const {
    channel
  } = useChannelSettingsContext();
  return /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-channel-settings__user-panel"
  }, /*#__PURE__*/React__default.createElement("div", {
    className: ['sendbird-channel-settings__panel-item', 'sendbird-channel-settings__members'].join(' '),
    role: "switch",
    "aria-checked": showAccordion,
    onKeyDown: () => setShowAccordion(!showAccordion),
    onClick: () => setShowAccordion(!showAccordion),
    tabIndex: 0
  }, /*#__PURE__*/React__default.createElement(Icon, {
    className: "sendbird-channel-settings__panel-icon-left",
    type: IconTypes.MEMBERS,
    fillColor: IconColors.PRIMARY,
    height: "24px",
    width: "24px"
  }), /*#__PURE__*/React__default.createElement(Label, {
    type: LabelTypography.SUBTITLE_1,
    color: LabelColors.ONBACKGROUND_1
  }, stringSet.CHANNEL_SETTING__MEMBERS__TITLE, /*#__PURE__*/React__default.createElement(Badge, {
    className: 'sendbird-channel-settings__badge',
    count: kFormatter(channel === null || channel === void 0 ? void 0 : channel.memberCount)
  })), /*#__PURE__*/React__default.createElement(Icon, {
    className: ['sendbird-channel-settings__panel-icon-right', 'sendbird-channel-settings__panel-icon--chevron', showAccordion ? 'sendbird-channel-settings__panel-icon--open' : ''].join(' '),
    type: IconTypes.CHEVRON_RIGHT,
    height: "24px",
    width: "24px"
  })), showAccordion && /*#__PURE__*/React__default.createElement(MemberList, null));
};

export { UserPanel as default };
//# sourceMappingURL=UserPanel.js.map
