'use strict';

var React = require('react');
var useChannelSettings = require('../../chunks/bundle-CcVLRLk8.js');
var LocalizationContext = require('../../chunks/bundle-DDNdw3A9.js');
var ui_Badge = require('../../ui/Badge.js');
var ui_Label = require('../../chunks/bundle-B0UICprZ.js');
var ui_Icon = require('../../ui/Icon.js');
var MemberList = require('../../chunks/bundle-D5wxUmg4.js');
require('../../chunks/bundle-CxoFSSXv.js');
require('../../chunks/bundle-AAO7jUU2.js');
require('../../chunks/bundle-yU9Mr2pS.js');
require('@sendbird/chat/groupChannel');
require('../../chunks/bundle-BUGwK1WK.js');
require('../../chunks/bundle-CvQwksvR.js');
require('../../chunks/bundle-DQNu-S6D.js');
require('../../chunks/bundle-DeyX1dvY.js');
require('../../chunks/bundle-LI9JjqG2.js');
require('@sendbird/chat');
require('@sendbird/chat/openChannel');
require('../../chunks/bundle-EhtiN7UV.js');
require('../../chunks/bundle-BV7y6VDn.js');
require('../../ui/Button.js');
require('../../chunks/bundle-BWtBhW43.js');
require('../../chunks/bundle-Bqahh-7Q.js');
require('react-dom');
require('../../ui/SortByRow.js');
require('../../ui/IconButton.js');
require('../../chunks/bundle-D7YiKR6i.js');
require('../../utils/message/getOutgoingMessageState.js');
require('../../chunks/bundle-dfqZUdij.js');
require('../../chunks/bundle-Dn0hi6OJ.js');
require('../../chunks/bundle-C1G0SKDq.js');
require('../../ui/UserListItem.js');
require('../../chunks/bundle-CLL-nCFU.js');
require('../../ui/ImageRenderer.js');
require('../../chunks/bundle-C8MACRPO.js');
require('../../ui/MutedAvatarOverlay.js');
require('../../ui/Checkbox.js');
require('../../ui/UserProfile.js');
require('../../sendbirdSelectors.js');
require('../../chunks/bundle-BPWJgESF.js');
require('../../chunks/bundle-YeW89zsR.js');
require('../../chunks/bundle-CyQD5TkW.js');
require('../../chunks/bundle-DwVBqZFY.js');
require('../../chunks/bundle-CqFqMb6S.js');
require('@sendbird/chat/message');
require('@sendbird/uikit-tools');
require('../../chunks/bundle-D4Il5UXX.js');

function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefaultCompat(React);

var kFormatter = function (num) {
    return Math.abs(num) > 999
        ? "".concat((Math.abs(num) / 1000).toFixed(1), "K")
        : num;
};
var UserPanel = function () {
    var stringSet = LocalizationContext.useLocalization().stringSet;
    var _a = React.useState(false), showAccordion = _a[0], setShowAccordion = _a[1];
    var channel = useChannelSettings.useChannelSettings().state.channel;
    return (React__default.default.createElement("div", { className: 'sendbird-channel-settings__user-panel' },
        React__default.default.createElement("div", { className: [
                'sendbird-channel-settings__panel-item',
                'sendbird-channel-settings__members',
            ].join(' '), role: "switch", "aria-checked": showAccordion, onKeyDown: function () { return setShowAccordion(!showAccordion); }, onClick: function () { return setShowAccordion(!showAccordion); }, tabIndex: 0 },
            React__default.default.createElement(ui_Icon.default, { className: "sendbird-channel-settings__panel-icon-left", type: ui_Icon.IconTypes.MEMBERS, fillColor: ui_Icon.IconColors.PRIMARY, height: "24px", width: "24px" }),
            React__default.default.createElement(ui_Label.Label, { type: ui_Label.LabelTypography.SUBTITLE_1, color: ui_Label.LabelColors.ONBACKGROUND_1 },
                stringSet.CHANNEL_SETTING__MEMBERS__TITLE,
                React__default.default.createElement(ui_Badge, { className: 'sendbird-channel-settings__badge', count: channel ? kFormatter(channel === null || channel === void 0 ? void 0 : channel.memberCount) : '' })),
            React__default.default.createElement(ui_Icon.default, { className: [
                    'sendbird-channel-settings__panel-icon-right',
                    'sendbird-channel-settings__panel-icon--chevron',
                    (showAccordion ? 'sendbird-channel-settings__panel-icon--open' : ''),
                ].join(' '), type: ui_Icon.IconTypes.CHEVRON_RIGHT, height: "24px", width: "24px" })),
        showAccordion && (React__default.default.createElement(MemberList.MemberList, null))));
};

module.exports = UserPanel;
//# sourceMappingURL=UserPanel.js.map
