import { _ as __assign } from '../../chunks/bundle-B8Grfnrx.js';
import React__default, { useState } from 'react';
import { a as useChannelSettings } from '../../chunks/bundle-BkZBhjs8.js';
import { u as useLocalization } from '../../chunks/bundle-l_QLKq1Y.js';
import { useMenuItems } from '../hooks/useMenuList.js';
import { d as deleteNullish, c as classnames } from '../../chunks/bundle-CDcu1I4f.js';
import { ChannelSettingsHeader } from './ChannelSettingsHeader.js';
import PlaceHolder, { PlaceHolderTypes } from '../../ui/PlaceHolder.js';
import { L as Label, a as LabelTypography, b as LabelColors } from '../../chunks/bundle-HspRRkmy.js';
import Icon, { IconTypes, IconColors } from '../../ui/Icon.js';
import ChannelProfile from './ChannelProfile.js';
import LeaveChannel from './LeaveChannel.js';
import { MenuItem } from './ChannelSettingsMenuItem.js';
import { MenuListByRole } from './ChannelSettingMenuList.js';
import { u as useSendbird } from '../../chunks/bundle-I25ah_Bv.js';
export { B as BannedUserList, M as MutedMemberList, O as OperatorList } from '../../chunks/bundle-BqREbgmR.js';
export { M as MemberList } from '../../chunks/bundle-nmIRAkKg.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-Y2KBbxRr.js';
import '../../chunks/bundle-BYOddwmS.js';
import '../../ui/Badge.js';
import '../../ui/Toggle.js';
import '../../ui/Header.js';
import '../../chunks/bundle-yKqHFFfz.js';
import '../../ui/TextButton.js';
import '../../chunks/bundle-DED6q4Ti.js';
import '../../ui/IconButton.js';
import '../../ui/Loader.js';
import '../../ui/ChannelAvatar.js';
import '../../chunks/bundle-DgFzcADJ.js';
import '../../ui/ImageRenderer.js';
import '../../chunks/bundle-C_ngoQD_.js';
import '../../chunks/bundle-DS6Kt7YS.js';
import './EditDetailsModal.js';
import '../../chunks/bundle-LnGQMQVt.js';
import 'react-dom';
import '../../ui/Button.js';
import '../../ui/Input.js';
import '../../chunks/bundle-CgLhYjm5.js';
import '../../utils/message/getOutgoingMessageState.js';
import '../../chunks/bundle-BTxw_tIt.js';
import '../../chunks/bundle-De-3zaYV.js';
import '../../chunks/bundle-DYBTopZK.js';
import '../../chunks/bundle-D_tSqvX6.js';
import '@sendbird/chat/message';
import '@sendbird/chat';
import '@sendbird/chat/openChannel';
import '../../chunks/bundle-fYlljM7o.js';
import '../../chunks/bundle-QCH8CZT8.js';
import '../../ui/SortByRow.js';
import '../../ui/UserListItem.js';
import '../../ui/MutedAvatarOverlay.js';
import '../../ui/Checkbox.js';
import '../../ui/UserProfile.js';
import '../../sendbirdSelectors.js';
import '../../chunks/bundle--1cImOGd.js';
import '../../chunks/bundle-DqR5RvpV.js';
import '@sendbird/uikit-tools';
import '../../chunks/bundle-C3VM5eS8.js';

var ChannelSettingsUI = function (props) {
    var _a = deleteNullish(props), _b = _a.renderHeader, renderHeader = _b === void 0 ? function (props) { return React__default.createElement(ChannelSettingsHeader, __assign({}, props)); } : _b, renderLeaveChannel = _a.renderLeaveChannel, renderChannelProfile = _a.renderChannelProfile, _c = _a.renderModerationPanel, renderModerationPanel = _c === void 0 ? function (props) { return React__default.createElement(MenuListByRole, __assign({}, props)); } : _c, renderPlaceholderError = _a.renderPlaceholderError, renderPlaceholderLoading = _a.renderPlaceholderLoading;
    var state = useSendbird().state;
    var isOnline = state.config.isOnline;
    var _d = useChannelSettings().state, channel = _d.channel, invalidChannel = _d.invalidChannel, onCloseClick = _d.onCloseClick, loading = _d.loading;
    var stringSet = useLocalization().stringSet;
    var menuItems = useMenuItems();
    var _e = useState(false), showLeaveChannelModal = _e[0], setShowLeaveChannelModal = _e[1];
    if (loading) {
        if (renderPlaceholderLoading)
            return renderPlaceholderLoading();
        return React__default.createElement(PlaceHolder, { type: PlaceHolderTypes.LOADING });
    }
    var headerProps = { onCloseClick: onCloseClick };
    if (invalidChannel || !channel) {
        return (React__default.createElement("div", null,
            renderHeader(headerProps),
            React__default.createElement("div", null, renderPlaceholderError ? renderPlaceholderError() : React__default.createElement(PlaceHolder, { type: PlaceHolderTypes.WRONG }))));
    }
    return (React__default.createElement(React__default.Fragment, null,
        renderHeader(headerProps),
        React__default.createElement("div", { className: "sendbird-channel-settings__scroll-area" },
            (renderChannelProfile === null || renderChannelProfile === void 0 ? void 0 : renderChannelProfile()) || React__default.createElement(ChannelProfile, null), renderModerationPanel === null || renderModerationPanel === void 0 ? void 0 :
            renderModerationPanel({ menuItems: menuItems }),
            (renderLeaveChannel === null || renderLeaveChannel === void 0 ? void 0 : renderLeaveChannel()) || (React__default.createElement(MenuItem, { className: classnames(!isOnline ? 'sendbird-channel-settings__panel-item__disabled' : '', 'sendbird-channel-settings__panel-item__leave-channel'), onKeyDown: function () {
                    if (!isOnline)
                        return;
                    setShowLeaveChannelModal(true);
                }, onClick: function () {
                    if (!isOnline)
                        return;
                    setShowLeaveChannelModal(true);
                }, renderLeft: function () { return (React__default.createElement(Icon, { className: ['sendbird-channel-settings__panel-icon-left', 'sendbird-channel-settings__panel-icon__leave'].join(' '), type: IconTypes.LEAVE, fillColor: IconColors.ERROR, height: "24px", width: "24px" })); }, renderMiddle: function () { return (React__default.createElement(Label, { type: LabelTypography.SUBTITLE_1, color: LabelColors.ONBACKGROUND_1 }, stringSet.CHANNEL_SETTING__LEAVE_CHANNEL__TITLE)); } })),
            showLeaveChannelModal && (React__default.createElement(LeaveChannel, { onCancel: function () {
                    setShowLeaveChannelModal(false);
                }, onSubmit: function () {
                    setShowLeaveChannelModal(false);
                    onCloseClick === null || onCloseClick === void 0 ? void 0 : onCloseClick();
                } })))));
};

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