import React__default, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import Sendbird from './SendbirdProvider.js';
import { u as useMediaQueryContext } from './MediaQueryContext-e5b401d0.js';
import ChannelList from './ChannelList.js';
import Channel from './Channel.js';
import ChannelSettings from './ChannelSettings.js';
import MessageSearchPannel from './MessageSearch.js';
import Thread from './Thread.js';
import { GroupChannelHandler } from '@sendbird/chat/groupChannel';
import useSendbirdStateContext from './useSendbirdStateContext.js';
import { u as uuidv4 } from './uuid-8b344dd2.js';
import { u as useVoicePlayerContext, A as ALL } from './index-02ceed0a.js';
import { V as VOICE_RECORDER_DEFAULT_MAX, a as VOICE_RECORDER_DEFAULT_MIN } from './consts-44eaef6b.js';
import './_rollupPluginBabelHelpers-cc035350.js';
import './withSendbird.js';
import 'css-vars-ponyfill';
import './index.module-d24badee.js';
import './actionTypes-cccf62ac.js';
import '@sendbird/chat';
import '@sendbird/chat/openChannel';
import './index-99ab01f6.js';
import './utils/message/getOutgoingMessageState.js';
import '@sendbird/uikit-tools';
import './VoiceRecorder/context.js';
import './LocalizationContext-1701e5c8.js';
import './stringSet-e9bb0333.js';
import './index-ff8f2f61.js';
import './ui/Modal.js';
import 'react-dom';
import './index-44c86e58.js';
import './ui/Button.js';
import './index-f50d7ab0.js';
import './ui/Icon.js';
import './ui/IconButton.js';
import './resolvedReplyType-6bb8f548.js';
import './ChannelListProvider-6c1df64a.js';
import './topics-0b30f52b.js';
import './utils-05aa9060.js';
import './UserProfileContext-74e9a128.js';
import './ChannelList/components/ChannelListUI.js';
import './ChannelList/components/ChannelListHeader.js';
import './ui/Avatar.js';
import './ui/ImageRenderer.js';
import './ChannelList/components/AddChannel.js';
import './CreateChannel.js';
import './CreateChannel/components/CreateChannelUI.js';
import './CreateChannelProvider-ec477081.js';
import './sendbirdSelectors.js';
import './CreateChannel/components/InviteUsers.js';
import './ui/UserListItem.js';
import './ui/MutedAvatarOverlay.js';
import './ui/Checkbox.js';
import './ui/UserProfile.js';
import './ui/ContextMenu.js';
import './ui/SortByRow.js';
import './CreateChannel/components/SelectChannelType.js';
import './ChannelList/components/ChannelPreview.js';
import './ui/ChannelAvatar.js';
import './utils-cd7ab927.js';
import './ui/Badge.js';
import './index-0aa8cbad.js';
import './index-5a62f6b7.js';
import './ui/Loader.js';
import './index-7e5538e6.js';
import './index-3f8e1a51.js';
import './ui/MentionUserLabel.js';
import './consts-a0834b70.js';
import './ui/TextButton.js';
import './color-ea3bf5b8.js';
import './Channel/components/TypingIndicator.js';
import './ChannelProvider-1dc36682.js';
import './const-7c266a95.js';
import './compareIds-367bb030.js';
import '@sendbird/chat/message';
import './useLongPress-6d0b6619.js';
import './ChannelList/components/ChannelPreviewAction.js';
import './EditUserProfile.js';
import './index-9c80246a.js';
import './ui/Input.js';
import './index-11fe17e1.js';
import './Channel/components/ChannelUI.js';
import './ui/ConnectionStatus.js';
import './Channel/components/ChannelHeader.js';
import './utils-f1b4b34b.js';
import './Channel/components/MessageList.js';
import './Channel/components/Message.js';
import './Channel/components/SuggestedMentionList.js';
import './const-2e67461b.js';
import './ThreadProvider-dea308a0.js';
import './Thread/context/types.js';
import './ui/DateSeparator.js';
import './ui/MessageInput.js';
import 'dompurify';
import './consts-3a33a0a8.js';
import './consts-b3274b3d.js';
import './tokenize-d12690c3.js';
import './ui/MessageContent.js';
import './ui/MessageItemMenu.js';
import './types-28e84810.js';
import './ui/MessageItemReactionMenu.js';
import './ui/ReactionButton.js';
import './ui/EmojiReactions.js';
import './ui/ReactionBadge.js';
import './ui/BottomSheet.js';
import './ui/Tooltip.js';
import './ui/TooltipWrapper.js';
import './Message/context.js';
import './ui/AdminMessage.js';
import './ui/TextMessageItemBody.js';
import './index-a31ee68d.js';
import './ui/MentionLabel.js';
import './ui/LinkLabel.js';
import './ui/FileMessageItemBody.js';
import './ui/ThumbnailMessageItemBody.js';
import './ui/OGMessageItemBody.js';
import './ui/UnknownMessageItemBody.js';
import './ui/QuoteMessage.js';
import './index-35696958.js';
import './ui/ThreadReplies.js';
import './ui/VoiceMessageItemBody.js';
import './ui/ProgressBar.js';
import './VoicePlayer/useVoicePlayer.js';
import './ui/PlaybackTime.js';
import './Channel/components/FileViewer.js';
import './Channel/components/RemoveMessageModal.js';
import './index-3461216d.js';
import './useDirtyGetMentions-2df51ec3.js';
import './Channel/components/UnreadCount.js';
import './Channel/components/FrozenNotification.js';
import './Channel/components/MessageInput.js';
import './ui/QuoteMessageInput.js';
import './VoiceMessageInputWrapper-4625a847.js';
import './VoiceRecorder/useVoiceRecorder.js';
import './index-cac27d56.js';
import './ChannelSettings/components/ChannelSettingsUI.js';
import './ChannelSettings/context.js';
import './ChannelSettings/components/ChannelProfile.js';
import './ChannelSettings/components/EditDetailsModal.js';
import './ChannelSettings/components/ModerationPanel.js';
import './ui/Accordion.js';
import './ui/AccordionGroup.js';
import './context-b513d868.js';
import './ui/Toggle.js';
import './ChannelSettings/components/UserListItem.js';
import './MemberList-415d00a9.js';
import './ChannelSettings/components/LeaveChannel.js';
import './ChannelSettings/components/UserPanel.js';
import './MessageSearch/components/MessageSearchUI.js';
import './MessageSearch/context.js';
import './ui/MessageSearchItem.js';
import './ui/MessageSearchFileItem.js';
import './Thread/components/ThreadUI.js';
import './Thread/components/ParentMessageInfo.js';
import './RemoveMessageModal-bf0ab3b2.js';
import './Thread/components/ParentMessageInfoItem.js';
import './ui/FileViewer.js';
import './Thread/components/ThreadHeader.js';
import './Thread/components/ThreadList.js';
import './Thread/components/ThreadListItem.js';
import 'date-fns';
import './Thread/components/ThreadMessageInput.js';

const DesktopLayout = props => {
  const {
    isReactionEnabled,
    replyType,
    isMessageGroupingEnabled,
    allowProfileEdit,
    showSearchIcon,
    onProfileEditSuccess,
    disableAutoSelect,
    currentChannel,
    setCurrentChannel,
    showSettings,
    setShowSettings,
    showSearch,
    setShowSearch,
    highlightedMessage,
    setHighlightedMessage,
    startingPoint,
    setStartingPoint,
    showThread,
    setShowThread,
    threadTargetMessage,
    setThreadTargetMessage
  } = props;
  const [animatedMessageId, setAnimatedMessageId] = useState(null);
  return /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-app__wrap"
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-app__channellist-wrap"
  }, /*#__PURE__*/React__default.createElement(ChannelList, {
    allowProfileEdit: allowProfileEdit,
    activeChannelUrl: currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.url,
    onProfileEditSuccess: onProfileEditSuccess,
    disableAutoSelect: disableAutoSelect,
    onChannelSelect: channel => {
      setStartingPoint === null || setStartingPoint === void 0 ? void 0 : setStartingPoint(null);
      setHighlightedMessage === null || setHighlightedMessage === void 0 ? void 0 : setHighlightedMessage(null);
      if (channel) {
        setCurrentChannel(channel);
      } else {
        setCurrentChannel(null);
      }
    }
  })), /*#__PURE__*/React__default.createElement("div", {
    className: `
          ${showSettings ? 'sendbird-app__conversation--settings-open' : ''}
          ${showSearch ? 'sendbird-app__conversation--search-open' : ''}
          sendbird-app__conversation-wrap
        `
  }, /*#__PURE__*/React__default.createElement(Channel, {
    channelUrl: (currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.url) || '',
    onChatHeaderActionClick: () => {
      setShowSearch(false);
      setShowThread(false);
      setShowSettings(!showSettings);
    },
    onSearchClick: () => {
      setShowSettings(false);
      setShowThread(false);
      setShowSearch(!showSearch);
    },
    onReplyInThread: _ref => {
      let {
        message
      } = _ref;
      // parent message
      setShowSettings(false);
      setShowSearch(false);
      if (replyType === 'THREAD') {
        setThreadTargetMessage(message);
        setShowThread(true);
      }
    },
    onQuoteMessageClick: _ref2 => {
      let {
        message
      } = _ref2;
      // thread message
      setShowSettings(false);
      setShowSearch(false);
      if (replyType === 'THREAD') {
        setThreadTargetMessage(message);
        setShowThread(true);
      }
    },
    onMessageAnimated: () => {
      setAnimatedMessageId(null);
    },
    onMessageHighlighted: () => {
      setHighlightedMessage === null || setHighlightedMessage === void 0 ? void 0 : setHighlightedMessage(null);
    },
    showSearchIcon: showSearchIcon,
    startingPoint: startingPoint,
    animatedMessage: animatedMessageId,
    highlightedMessage: highlightedMessage,
    isReactionEnabled: isReactionEnabled,
    replyType: replyType,
    isMessageGroupingEnabled: isMessageGroupingEnabled
  })), showSettings && /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-app__settingspanel-wrap"
  }, /*#__PURE__*/React__default.createElement(ChannelSettings, {
    className: "sendbird-channel-settings",
    channelUrl: (currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.url) || '',
    onCloseClick: () => {
      setShowSettings(false);
    }
  })), showSearch && /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-app__searchpanel-wrap"
  }, /*#__PURE__*/React__default.createElement(MessageSearchPannel, {
    channelUrl: (currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.url) || '',
    onResultClick: message => {
      if (message.messageId === highlightedMessage) {
        setHighlightedMessage === null || setHighlightedMessage === void 0 ? void 0 : setHighlightedMessage(null);
        setTimeout(() => {
          setHighlightedMessage === null || setHighlightedMessage === void 0 ? void 0 : setHighlightedMessage(message.messageId);
        });
      } else {
        setStartingPoint === null || setStartingPoint === void 0 ? void 0 : setStartingPoint(message.createdAt);
        setHighlightedMessage === null || setHighlightedMessage === void 0 ? void 0 : setHighlightedMessage(message.messageId);
      }
    },
    onCloseClick: () => {
      setShowSearch(false);
    }
  })), showThread && /*#__PURE__*/React__default.createElement(Thread, {
    className: "sendbird-app__thread",
    channelUrl: (currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.url) || '',
    message: threadTargetMessage,
    onHeaderActionClick: () => {
      setShowThread(false);
    },
    onMoveToParentMessage: _ref3 => {
      let {
        message,
        channel
      } = _ref3;
      if ((channel === null || channel === void 0 ? void 0 : channel.url) !== (currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.url)) {
        setCurrentChannel(channel);
      }
      if ((message === null || message === void 0 ? void 0 : message.messageId) !== animatedMessageId) {
        setStartingPoint === null || setStartingPoint === void 0 ? void 0 : setStartingPoint(message === null || message === void 0 ? void 0 : message.createdAt);
      }
      setTimeout(() => {
        setAnimatedMessageId(message === null || message === void 0 ? void 0 : message.messageId);
      }, 500);
    }
  }));
};

var PANELS = /*#__PURE__*/function (PANELS) {
  PANELS["CHANNEL_LIST"] = "CHANNEL_LIST";
  PANELS["CHANNEL"] = "CHANNEL";
  PANELS["CHANNEL_SETTINGS"] = "CHANNEL_SETTINGS";
  PANELS["MESSAGE_SEARCH"] = "MESSAGE_SEARCH";
  PANELS["THREAD"] = "THREAD";
  return PANELS;
}(PANELS || {});
const MobileLayout = props => {
  var _store$stores, _store$stores$sdkStor, _store$config;
  const {
    replyType,
    isMessageGroupingEnabled,
    allowProfileEdit,
    isReactionEnabled,
    showSearchIcon,
    onProfileEditSuccess,
    currentChannel,
    setCurrentChannel,
    highlightedMessage,
    setHighlightedMessage,
    startingPoint,
    setStartingPoint,
    threadTargetMessage,
    setThreadTargetMessage
  } = props;
  const [panel, setPanel] = useState(PANELS.CHANNEL_LIST);
  const [animatedMessageId, setAnimatedMessageId] = useState(null);
  const store = useSendbirdStateContext();
  const sdk = store === null || store === void 0 ? void 0 : (_store$stores = store.stores) === null || _store$stores === void 0 ? void 0 : (_store$stores$sdkStor = _store$stores.sdkStore) === null || _store$stores$sdkStor === void 0 ? void 0 : _store$stores$sdkStor.sdk;
  const userId = store === null || store === void 0 ? void 0 : (_store$config = store.config) === null || _store$config === void 0 ? void 0 : _store$config.userId;
  const {
    pause
  } = useVoicePlayerContext();
  const goToMessage = (message, timeoutCb) => {
    setStartingPoint === null || setStartingPoint === void 0 ? void 0 : setStartingPoint((message === null || message === void 0 ? void 0 : message.createdAt) || null);
    setTimeout(() => {
      timeoutCb === null || timeoutCb === void 0 ? void 0 : timeoutCb((message === null || message === void 0 ? void 0 : message.messageId) || null);
    }, 500);
  };
  useEffect(() => {
    if (panel !== PANELS.CHANNEL) {
      goToMessage(null, () => setAnimatedMessageId(null));
    }
  }, [panel]);
  useEffect(() => {
    var _sdk$groupChannel;
    const handlerId = uuidv4();
    if (sdk !== null && sdk !== void 0 && (_sdk$groupChannel = sdk.groupChannel) !== null && _sdk$groupChannel !== void 0 && _sdk$groupChannel.addGroupChannelHandler) {
      var _sdk$groupChannel2;
      const handler = new GroupChannelHandler({
        onUserBanned: (groupChannel, user) => {
          if (groupChannel.url === (currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.url) && (user === null || user === void 0 ? void 0 : user.userId) === userId) {
            setPanel(PANELS.CHANNEL_LIST);
          }
        },
        onChannelDeleted: channelUrl => {
          if (channelUrl === (currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.url)) {
            setPanel(PANELS.CHANNEL_LIST);
          }
        },
        onUserLeft: (groupChannel, user) => {
          if (groupChannel.url === (currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.url) && (user === null || user === void 0 ? void 0 : user.userId) === userId) {
            setPanel(PANELS.CHANNEL_LIST);
          }
        }
      });
      sdk === null || sdk === void 0 ? void 0 : (_sdk$groupChannel2 = sdk.groupChannel) === null || _sdk$groupChannel2 === void 0 ? void 0 : _sdk$groupChannel2.addGroupChannelHandler(handlerId, handler);
    }
    return () => {
      var _sdk$groupChannel3, _sdk$groupChannel3$re;
      sdk === null || sdk === void 0 ? void 0 : (_sdk$groupChannel3 = sdk.groupChannel) === null || _sdk$groupChannel3 === void 0 ? void 0 : (_sdk$groupChannel3$re = _sdk$groupChannel3.removeGroupChannelHandler) === null || _sdk$groupChannel3$re === void 0 ? void 0 : _sdk$groupChannel3$re.call(_sdk$groupChannel3, handlerId);
    };
  }, [sdk]);

  // if currentChannel is changed while on Thread
  // then change panel type to CHANNEL
  useEffect(() => {
    if (panel === PANELS.THREAD) {
      setPanel(PANELS.CHANNEL);
    }
  }, [currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.url]);
  return /*#__PURE__*/React__default.createElement("div", {
    className: "sb_mobile"
  }, panel === PANELS.CHANNEL_LIST && /*#__PURE__*/React__default.createElement("div", {
    className: "sb_mobile__panelwrap"
  }, /*#__PURE__*/React__default.createElement(ChannelList, {
    onProfileEditSuccess: onProfileEditSuccess,
    onChannelSelect: channel => {
      setCurrentChannel(channel);
      setPanel(PANELS.CHANNEL);
    },
    allowProfileEdit: allowProfileEdit
    // this condition must be true for mobile
    ,
    disableAutoSelect: true
  })), panel === PANELS.CHANNEL && /*#__PURE__*/React__default.createElement("div", {
    className: "sb_mobile__panelwrap"
  }, /*#__PURE__*/React__default.createElement(Channel, {
    replyType: replyType,
    channelUrl: (currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.url) || '',
    onSearchClick: () => {
      setPanel(PANELS.MESSAGE_SEARCH);
    },
    onBackClick: () => {
      setPanel(PANELS.CHANNEL_LIST);
      pause(ALL);
    },
    isReactionEnabled: isReactionEnabled,
    showSearchIcon: showSearchIcon,
    isMessageGroupingEnabled: isMessageGroupingEnabled,
    startingPoint: startingPoint,
    animatedMessage: animatedMessageId,
    highlightedMessage: highlightedMessage,
    onChatHeaderActionClick: () => {
      setPanel(PANELS.CHANNEL_SETTINGS);
    },
    onReplyInThread: _ref => {
      let {
        message
      } = _ref;
      if (replyType === 'THREAD') {
        setPanel(PANELS.THREAD);
        setThreadTargetMessage(message);
      }
    },
    onQuoteMessageClick: _ref2 => {
      let {
        message
      } = _ref2;
      // thread message
      if (replyType === 'THREAD') {
        setThreadTargetMessage(message);
        setPanel(PANELS.THREAD);
      }
    }
  })), panel === PANELS.CHANNEL_SETTINGS && /*#__PURE__*/React__default.createElement("div", {
    className: "sb_mobile__panelwrap"
  }, /*#__PURE__*/React__default.createElement(ChannelSettings, {
    channelUrl: (currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.url) || '',
    onCloseClick: () => {
      setPanel(PANELS.CHANNEL);
    },
    onLeaveChannel: () => {
      setPanel(PANELS.CHANNEL_LIST);
    }
  })), panel === PANELS.MESSAGE_SEARCH && /*#__PURE__*/React__default.createElement("div", {
    className: "sb_mobile__panelwrap"
  }, /*#__PURE__*/React__default.createElement(MessageSearchPannel, {
    channelUrl: (currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.url) || '',
    onCloseClick: () => {
      setPanel(PANELS.CHANNEL);
    },
    onResultClick: message => {
      setPanel(PANELS.CHANNEL);
      goToMessage(message, messageId => {
        setHighlightedMessage === null || setHighlightedMessage === void 0 ? void 0 : setHighlightedMessage(messageId);
      });
    }
  })), panel === PANELS.THREAD && /*#__PURE__*/React__default.createElement("div", {
    className: "sb_mobile__panelwrap"
  }, /*#__PURE__*/React__default.createElement(Thread, {
    channelUrl: (currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.url) || '',
    message: threadTargetMessage,
    onHeaderActionClick: () => {
      setPanel(PANELS.CHANNEL);
      pause(ALL);
    },
    onMoveToParentMessage: _ref3 => {
      let {
        message,
        channel
      } = _ref3;
      setCurrentChannel(channel);
      goToMessage(message, messageId => {
        setPanel(PANELS.CHANNEL);
        setAnimatedMessageId(messageId);
      });
    }
  })));
};

const AppLayout = props => {
  var _props$replyType, _props$isReactionEnab, _props$showSearchIcon;
  const {
    isMessageGroupingEnabled,
    allowProfileEdit,
    onProfileEditSuccess,
    disableAutoSelect,
    currentChannel,
    setCurrentChannel
  } = props;
  const globalStore = useSendbirdStateContext();
  const globalConfigs = globalStore === null || globalStore === void 0 ? void 0 : globalStore.config;
  const [showThread, setShowThread] = useState(false);
  const [threadTargetMessage, setThreadTargetMessage] = useState(null);
  const [showSettings, setShowSettings] = useState(false);
  const [showSearch, setShowSearch] = useState(false);
  const [highlightedMessage, setHighlightedMessage] = useState(null);
  const [startingPoint, setStartingPoint] = useState(null);
  const {
    isMobile
  } = useMediaQueryContext();

  /**
   * Below configs can be set via Dashboard UIKit config setting but as a lower priority than App props.
   * So need to be have fallback value \w global configs even though each prop values are undefined
   */
  const replyType = (_props$replyType = props.replyType) !== null && _props$replyType !== void 0 ? _props$replyType : globalConfigs === null || globalConfigs === void 0 ? void 0 : globalConfigs.replyType;
  const isReactionEnabled = (_props$isReactionEnab = props.isReactionEnabled) !== null && _props$isReactionEnab !== void 0 ? _props$isReactionEnab : globalConfigs === null || globalConfigs === void 0 ? void 0 : globalConfigs.isReactionEnabled;
  const showSearchIcon = (_props$showSearchIcon = props.showSearchIcon) !== null && _props$showSearchIcon !== void 0 ? _props$showSearchIcon : globalConfigs === null || globalConfigs === void 0 ? void 0 : globalConfigs.showSearchIcon;
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isMobile ? /*#__PURE__*/React__default.createElement(MobileLayout, {
    replyType: replyType,
    showSearchIcon: showSearchIcon,
    isReactionEnabled: isReactionEnabled,
    isMessageGroupingEnabled: isMessageGroupingEnabled,
    allowProfileEdit: allowProfileEdit,
    onProfileEditSuccess: onProfileEditSuccess,
    currentChannel: currentChannel,
    setCurrentChannel: setCurrentChannel,
    highlightedMessage: highlightedMessage,
    setHighlightedMessage: setHighlightedMessage,
    startingPoint: startingPoint,
    setStartingPoint: setStartingPoint,
    threadTargetMessage: threadTargetMessage,
    setThreadTargetMessage: setThreadTargetMessage
  }) : /*#__PURE__*/React__default.createElement(DesktopLayout, {
    replyType: replyType,
    isReactionEnabled: isReactionEnabled,
    showSearchIcon: showSearchIcon,
    isMessageGroupingEnabled: isMessageGroupingEnabled,
    allowProfileEdit: allowProfileEdit,
    onProfileEditSuccess: onProfileEditSuccess,
    disableAutoSelect: disableAutoSelect,
    currentChannel: currentChannel,
    setCurrentChannel: setCurrentChannel,
    showThread: showThread,
    setShowThread: setShowThread,
    threadTargetMessage: threadTargetMessage,
    setThreadTargetMessage: setThreadTargetMessage,
    showSettings: showSettings,
    setShowSettings: setShowSettings,
    showSearch: showSearch,
    setShowSearch: setShowSearch,
    highlightedMessage: highlightedMessage,
    setHighlightedMessage: setHighlightedMessage,
    startingPoint: startingPoint,
    setStartingPoint: setStartingPoint
  }));
};

/**
 * This is a drop in Chat solution
 * Can also be used as an example for creating
 * default chat apps
 */
function App(props) {
  const {
    appId,
    userId,
    accessToken,
    customApiHost,
    customWebSocketHost,
    breakpoint,
    theme,
    userListQuery,
    nickname,
    profileUrl,
    dateLocale,
    config = {},
    isReactionEnabled,
    isMentionEnabled,
    isVoiceMessageEnabled,
    voiceRecord,
    replyType,
    isMessageGroupingEnabled,
    colorSet,
    stringSet,
    allowProfileEdit,
    disableUserProfile,
    disableMarkAsDelivered,
    renderUserProfile,
    showSearchIcon,
    onProfileEditSuccess,
    imageCompression,
    disableAutoSelect,
    isTypingIndicatorEnabledOnChannelList,
    isMessageReceiptStatusEnabledOnChannelList,
    uikitOptions,
    isUserIdUsedForNickname
  } = props;
  const [currentChannel, setCurrentChannel] = useState(null);
  return /*#__PURE__*/React__default.createElement(Sendbird, {
    stringSet: stringSet,
    appId: appId,
    userId: userId,
    accessToken: accessToken,
    customApiHost: customApiHost,
    customWebSocketHost: customWebSocketHost,
    breakpoint: breakpoint,
    theme: theme,
    nickname: nickname,
    profileUrl: profileUrl,
    dateLocale: dateLocale,
    userListQuery: userListQuery,
    config: config,
    colorSet: colorSet,
    disableUserProfile: disableUserProfile,
    disableMarkAsDelivered: disableMarkAsDelivered,
    renderUserProfile: renderUserProfile,
    imageCompression: imageCompression,
    isReactionEnabled: isReactionEnabled,
    isMentionEnabled: isMentionEnabled,
    isVoiceMessageEnabled: isVoiceMessageEnabled,
    voiceRecord: voiceRecord,
    onUserProfileMessage: channel => {
      setCurrentChannel(channel);
    },
    isTypingIndicatorEnabledOnChannelList: isTypingIndicatorEnabledOnChannelList,
    isMessageReceiptStatusEnabledOnChannelList: isMessageReceiptStatusEnabledOnChannelList,
    replyType: replyType,
    showSearchIcon: showSearchIcon,
    uikitOptions: uikitOptions,
    isUserIdUsedForNickname: isUserIdUsedForNickname
  }, /*#__PURE__*/React__default.createElement(AppLayout, {
    isReactionEnabled: isReactionEnabled,
    replyType: replyType,
    showSearchIcon: showSearchIcon,
    isMessageGroupingEnabled: isMessageGroupingEnabled,
    allowProfileEdit: allowProfileEdit,
    onProfileEditSuccess: onProfileEditSuccess,
    disableAutoSelect: disableAutoSelect,
    currentChannel: currentChannel,
    setCurrentChannel: setCurrentChannel
  }));
}
App.propTypes = {
  appId: PropTypes.string.isRequired,
  userId: PropTypes.string.isRequired,
  accessToken: PropTypes.string,
  customApiHost: PropTypes.string,
  customWebSocketHost: PropTypes.string,
  theme: PropTypes.string,
  userListQuery: PropTypes.func,
  nickname: PropTypes.string,
  profileUrl: PropTypes.string,
  breakpoint: PropTypes.oneOf([PropTypes.string, PropTypes.bool]),
  allowProfileEdit: PropTypes.bool,
  disableUserProfile: PropTypes.bool,
  disableMarkAsDelivered: PropTypes.bool,
  renderUserProfile: PropTypes.func,
  onProfileEditSuccess: PropTypes.func,
  dateLocale: PropTypes.shape({}),
  config: PropTypes.shape({
    // None Error Warning Info 'All/Debug'
    logLevel: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
    isREMUnitEnabled: PropTypes.bool
  }),
  uikitOptions: PropTypes.shape({}),
  isReactionEnabled: PropTypes.bool,
  replyType: PropTypes.oneOf(['NONE', 'QUOTE_REPLY', 'THREAD']),
  showSearchIcon: PropTypes.bool,
  isMessageGroupingEnabled: PropTypes.bool,
  stringSet: PropTypes.objectOf(PropTypes.string),
  colorSet: PropTypes.objectOf(PropTypes.string),
  imageCompression: PropTypes.shape({
    compressionRate: PropTypes.number,
    resizingWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
    resizingHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
  }),
  disableAutoSelect: PropTypes.bool,
  isMentionEnabled: PropTypes.bool,
  isVoiceMessageEnabled: PropTypes.bool,
  voiceRecord: PropTypes.shape({
    maxRecordingTime: PropTypes.number,
    minRecordingTime: PropTypes.number
  }),
  isTypingIndicatorEnabledOnChannelList: PropTypes.bool,
  isMessageReceiptStatusEnabledOnChannelList: PropTypes.bool,
  isUserIdUsedForNickname: PropTypes.bool
};
App.defaultProps = {
  accessToken: '',
  customApiHost: '',
  customWebSocketHost: '',
  theme: 'light',
  nickname: '',
  profileUrl: '',
  userListQuery: null,
  breakpoint: null,
  dateLocale: null,
  allowProfileEdit: false,
  onProfileEditSuccess: null,
  disableMarkAsDelivered: false,
  renderUserProfile: null,
  config: {},
  voiceRecord: {
    maxRecordingTime: VOICE_RECORDER_DEFAULT_MAX,
    minRecordingTime: VOICE_RECORDER_DEFAULT_MIN
  },
  isMessageGroupingEnabled: true,
  stringSet: null,
  colorSet: null,
  imageCompression: {},
  disableAutoSelect: false,
  uikitOptions: undefined,
  // The below configs are duplicates of the Dashboard UIKit Configs.
  // Since their default values will be set in the Sendbird component,
  // we don't need to set them here.
  showSearchIcon: undefined,
  isMentionEnabled: undefined,
  isReactionEnabled: undefined,
  replyType: undefined,
  disableUserProfile: undefined,
  isVoiceMessageEnabled: undefined,
  isTypingIndicatorEnabledOnChannelList: undefined,
  isMessageReceiptStatusEnabledOnChannelList: undefined,
  isUserIdUsedForNickname: true
};

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