import { _ as __assign } from '../../chunks/bundle-yl5d1NoZ.js';
import React__default, { useState } from 'react';
import { L as Label } from '../../chunks/bundle-viBng0Kh.js';
import Icon from '../../ui/Icon.js';
import { i as isOperator } from '../../chunks/bundle-DFni3Lhf.js';
import { MenuItem } from './ChannelSettingsMenuItem.js';
import { u as useChannelSettings } from '../../chunks/bundle-CvsU5rx0.js';
import '../../chunks/bundle-C1dqPUnT.js';
import '../../chunks/bundle-MlG9piGf.js';
import '@sendbird/chat/message';
import '../../chunks/bundle-Del33VzI.js';
import '../../chunks/bundle-BZGITC2g.js';
import '../../chunks/bundle-BUYU9H94.js';
import '../../chunks/bundle-CqLLOVG5.js';
import '@sendbird/chat/groupChannel';
import '../../chunks/bundle-DGh2T5IL.js';
import '../../chunks/bundle-CM73CDTO.js';
import '../../chunks/bundle-B0s_McF0.js';
import '../../chunks/bundle-i_3w58Zd.js';
import '@sendbird/chat';
import '@sendbird/chat/openChannel';

var MenuListByRole = function (_a) {
    var menuItems = _a.menuItems;
    var channel = useChannelSettings().state.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
