import { _ as __assign } from '../../chunks/bundle-CyKcXwxv.js';
import React__default, { useState } from 'react';
import { L as Label } from '../../chunks/bundle-bz4PqMYo.js';
import Icon from '../../ui/Icon.js';
import { i as isOperator } from '../../chunks/bundle-15-msoxy.js';
import { MenuItem } from './ChannelSettingsMenuItem.js';
import { useChannelSettingsContext } from '../context.js';
import '../../chunks/bundle-xzHlqm91.js';
import '../../chunks/bundle-B43BrwWe.js';
import '@sendbird/chat/message';
import '../../chunks/bundle-C_RTy-wB.js';
import '@sendbird/chat/groupChannel';
import '../../useSendbirdStateContext.js';
import '../../withSendbird.js';
import '../../chunks/bundle-DV19ISeX.js';
import '@sendbird/uikit-tools';
import '../../chunks/bundle-DIM08oup.js';
import '../../chunks/bundle-DCvGHvPz.js';
import '../../utils/message/getOutgoingMessageState.js';
import '../../chunks/bundle-BFKFmP-d.js';
import '../../chunks/bundle-DAYMi6vw.js';
import '../../chunks/bundle-vddg8rUR.js';
import 'react-dom';
import '../../chunks/bundle-yFfkfO0O.js';
import '../../ui/IconButton.js';
import '../../ui/Button.js';
import 'css-vars-ponyfill';
import '@sendbird/chat';
import '../../chunks/bundle-BUQ58hWb.js';
import '@sendbird/chat/openChannel';
import '../../chunks/bundle-CKwMZR9c.js';
import '../../chunks/bundle-Bien0gJP.js';
import '../../ui/SortByRow.js';
import '../../chunks/bundle-ByOQ0ql4.js';

var MenuListByRole = function (_a) {
    var menuItems = _a.menuItems;
    var channel = useChannelSettingsContext().channel;
    var menuItemsByRole = isOperator(channel) ? menuItems.operator : menuItems.nonOperator;
    // State to track the open accordion key
    var _b = useState(null), openAccordionKey = _b[0], setOpenAccordionKey = _b[1];
    return (React__default.createElement("div", { className: "sendbird-channel-settings__operator" }, Object.entries(menuItemsByRole).map(function (_a) {
        var key = _a[0], item = _a[1];
        if (item.hideMenu)
            return null;
        return (React__default.createElement(MenuItem, { key: key, onClick: item.onClick, onKeyDown: item.onKeyDown, renderLeft: function () { return React__default.createElement(Icon, __assign({}, item.icon)); }, renderMiddle: function () { return React__default.createElement(Label, __assign({}, item.label)); }, renderRight: item.rightComponent, renderAccordion: item.accordionComponent, accordionOpened: openAccordionKey === key, setAccordionOpened: function () {
                setOpenAccordionKey(function (prevKey) { return (prevKey === key ? null : key); });
            } }));
    })));
};

export { MenuListByRole, MenuListByRole as default };
//# sourceMappingURL=ChannelSettingMenuList.js.map
