import { _ as __assign } from '../../chunks/bundle-B8Grfnrx.js';
import React__default, { useState } from 'react';
import { L as Label } from '../../chunks/bundle-HspRRkmy.js';
import Icon from '../../ui/Icon.js';
import { i as isOperator } from '../../chunks/bundle-D_tSqvX6.js';
import { MenuItem } from './ChannelSettingsMenuItem.js';
import { a as useChannelSettings } from '../../chunks/bundle-BkZBhjs8.js';
import '../../chunks/bundle-Y2KBbxRr.js';
import '../../chunks/bundle-CDcu1I4f.js';
import '@sendbird/chat/message';
import '../../chunks/bundle-l_QLKq1Y.js';
import '../../chunks/bundle-BYOddwmS.js';
import '../../chunks/bundle-C4OmfIXk.js';
import '../../chunks/bundle-Ob7Cw3V-.js';
import '@sendbird/chat/groupChannel';
import '../../chunks/bundle-CTkGIdt8.js';
import '../../chunks/bundle-Djq12iSf.js';
import '../../chunks/bundle-BYqblmEM.js';
import '../../chunks/bundle-I25ah_Bv.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
