var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MessageList = void 0;
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _useMessageList2 = require("./hooks/useMessageList");
var _useShouldScrollToRecentOnNewOwnMessage = require("./hooks/useShouldScrollToRecentOnNewOwnMessage");
var _InlineLoadingMoreIndicator = require("./InlineLoadingMoreIndicator");
var _InlineLoadingMoreRecentIndicator = require("./InlineLoadingMoreRecentIndicator");
var _InlineLoadingMoreRecentThreadIndicator = require("./InlineLoadingMoreRecentThreadIndicator");
var _getLastReceivedMessage = require("./utils/getLastReceivedMessage");
var _AttachmentPickerContext = require("../../contexts/attachmentPickerContext/AttachmentPickerContext");
var _ChannelContext = require("../../contexts/channelContext/ChannelContext");
var _ChatContext = require("../../contexts/chatContext/ChatContext");
var _DebugContext = require("../../contexts/debugContext/DebugContext");
var _ImageGalleryContext = require("../../contexts/imageGalleryContext/ImageGalleryContext");
var _MessagesContext = require("../../contexts/messagesContext/MessagesContext");
var _OverlayContext = require("../../contexts/overlayContext/OverlayContext");
var _PaginatedMessageListContext = require("../../contexts/paginatedMessageListContext/PaginatedMessageListContext");
var _ThemeContext = require("../../contexts/themeContext/ThemeContext");
var _ThreadContext = require("../../contexts/threadContext/ThreadContext");
var _hooks = require("../../hooks");
var _types = require("../../types/types");
var _jsxRuntime = require("react/jsx-runtime");
var _excluded = ["contentContainerStyle", "ItemSeparatorComponent", "style"];
var _this = this,
  _jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/components/MessageList/MessageList.tsx";
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
var WAIT_FOR_SCROLL_TIMEOUT = 0;
var MAX_RETRIES_AFTER_SCROLL_FAILURE = 10;
var styles = _reactNative.StyleSheet.create({
  container: {
    alignItems: 'center',
    flex: 1,
    width: '100%'
  },
  contentContainer: {
    paddingBottom: 4
  },
  flex: {
    flex: 1
  },
  invertAndroid: {
    transform: [{
      scaleX: -1
    }, {
      scaleY: -1
    }]
  },
  listContainer: {
    flex: 1,
    width: '100%'
  },
  stickyHeader: {
    position: 'absolute',
    top: 0
  }
});
var keyExtractor = function keyExtractor(item) {
  if (item.id) {
    return item.id;
  }
  if (item.created_at) {
    return typeof item.created_at === 'string' ? item.created_at : item.created_at.toISOString();
  }
  return Date.now().toString();
};
var flatListViewabilityConfig = {
  viewAreaCoveragePercentThreshold: 1
};
var hasReadLastMessage = function hasReadLastMessage(channel, userId) {
  var _channel$state$latest, _channel$state$read$u;
  var latestMessageIdInChannel = (_channel$state$latest = channel.state.latestMessages.slice(-1)[0]) == null ? void 0 : _channel$state$latest.id;
  var lastReadMessageIdServer = (_channel$state$read$u = channel.state.read[userId]) == null ? void 0 : _channel$state$read$u.last_read_message_id;
  return latestMessageIdInChannel === lastReadMessageIdServer;
};
var getPreviousLastMessage = function getPreviousLastMessage(messages, newMessage) {
  if (!newMessage) return;
  var previousLastMessage;
  for (var i = messages.length - 1; i >= 0; i--) {
    var msg = messages[i];
    if (!(msg != null && msg.id)) break;
    if (msg.id !== newMessage.id) {
      previousLastMessage = msg;
      break;
    }
  }
  return previousLastMessage;
};
var MessageListWithContext = function MessageListWithContext(props) {
  var _client$user3;
  var LoadingMoreRecentIndicator = props.threadList ? _InlineLoadingMoreRecentThreadIndicator.InlineLoadingMoreRecentThreadIndicator : _InlineLoadingMoreRecentIndicator.InlineLoadingMoreRecentIndicator;
  var additionalFlatListProps = props.additionalFlatListProps,
    channel = props.channel,
    channelUnreadState = props.channelUnreadState,
    client = props.client,
    closePicker = props.closePicker,
    DateHeader = props.DateHeader,
    disabled = props.disabled,
    disableTypingIndicator = props.disableTypingIndicator,
    EmptyStateIndicator = props.EmptyStateIndicator,
    FlatList = props.FlatList,
    _props$FooterComponen = props.FooterComponent,
    FooterComponent = _props$FooterComponen === void 0 ? _InlineLoadingMoreIndicator.InlineLoadingMoreIndicator : _props$FooterComponen,
    _props$HeaderComponen = props.HeaderComponent,
    HeaderComponent = _props$HeaderComponen === void 0 ? LoadingMoreRecentIndicator : _props$HeaderComponen,
    hideStickyDateHeader = props.hideStickyDateHeader,
    highlightedMessageId = props.highlightedMessageId,
    InlineDateSeparator = props.InlineDateSeparator,
    InlineUnreadIndicator = props.InlineUnreadIndicator,
    _props$inverted = props.inverted,
    inverted = _props$inverted === void 0 ? true : _props$inverted,
    _props$isListActive = props.isListActive,
    isListActive = _props$isListActive === void 0 ? false : _props$isListActive,
    legacyImageViewerSwipeBehaviour = props.legacyImageViewerSwipeBehaviour,
    loadChannelAroundMessage = props.loadChannelAroundMessage,
    loading = props.loading,
    LoadingIndicator = props.LoadingIndicator,
    loadMore = props.loadMore,
    loadMoreRecent = props.loadMoreRecent,
    loadMoreRecentThread = props.loadMoreRecentThread,
    loadMoreThread = props.loadMoreThread,
    markRead = props.markRead,
    Message = props.Message,
    MessageSystem = props.MessageSystem,
    myMessageTheme = props.myMessageTheme,
    NetworkDownIndicator = props.NetworkDownIndicator,
    noGroupByUser = props.noGroupByUser,
    onListScroll = props.onListScroll,
    onThreadSelect = props.onThreadSelect,
    overlay = props.overlay,
    reloadChannel = props.reloadChannel,
    ScrollToBottomButton = props.ScrollToBottomButton,
    selectedPicker = props.selectedPicker,
    setChannelUnreadState = props.setChannelUnreadState,
    setFlatListRef = props.setFlatListRef,
    setMessages = props.setMessages,
    setSelectedPicker = props.setSelectedPicker,
    setTargetedMessage = props.setTargetedMessage,
    shouldShowUnreadUnderlay = props.shouldShowUnreadUnderlay,
    StickyHeader = props.StickyHeader,
    targetedMessage = props.targetedMessage,
    thread = props.thread,
    threadInstance = props.threadInstance,
    _props$threadList = props.threadList,
    threadList = _props$threadList === void 0 ? false : _props$threadList,
    TypingIndicator = props.TypingIndicator,
    TypingIndicatorContainer = props.TypingIndicatorContainer,
    UnreadMessagesNotification = props.UnreadMessagesNotification;
  var _useState = (0, _react.useState)(false),
    _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
    isUnreadNotificationOpen = _useState2[0],
    setIsUnreadNotificationOpen = _useState2[1];
  var _useTheme = (0, _ThemeContext.useTheme)(),
    theme = _useTheme.theme;
  var white_snow = theme.colors.white_snow,
    _theme$messageList = theme.messageList,
    container = _theme$messageList.container,
    contentContainer = _theme$messageList.contentContainer,
    listContainer = _theme$messageList.listContainer,
    messageContainer = _theme$messageList.messageContainer,
    screenPadding = theme.screenPadding;
  var myMessageThemeString = (0, _react.useMemo)(function () {
    return JSON.stringify(myMessageTheme);
  }, [myMessageTheme]);
  var modifiedTheme = (0, _react.useMemo)(function () {
    return (0, _ThemeContext.mergeThemes)({
      style: myMessageTheme,
      theme: theme
    });
  }, [myMessageThemeString, theme]);
  var _useMessageList = (0, _useMessageList2.useMessageList)({
      noGroupByUser: noGroupByUser,
      threadList: threadList
    }),
    dateSeparatorsRef = _useMessageList.dateSeparatorsRef,
    messageGroupStylesRef = _useMessageList.messageGroupStylesRef,
    processedMessageList = _useMessageList.processedMessageList,
    rawMessageList = _useMessageList.rawMessageList;
  var messageListLengthBeforeUpdate = (0, _react.useRef)(0);
  var messageListLengthAfterUpdate = processedMessageList.length;
  var topMessageBeforeUpdate = (0, _react.useRef)(undefined);
  var latestNonCurrentMessageBeforeUpdateRef = (0, _react.useRef)(undefined);
  var topMessageAfterUpdate = rawMessageList[0];
  var shouldScrollToRecentOnNewOwnMessageRef = (0, _useShouldScrollToRecentOnNewOwnMessage.useShouldScrollToRecentOnNewOwnMessage)(rawMessageList, client.userID);
  var _useState3 = (0, _react.useState)(false),
    _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
    autoscrollToRecent = _useState4[0],
    setAutoscrollToRecent = _useState4[1];
  var maintainVisibleContentPosition = (0, _react.useMemo)(function () {
    return {
      autoscrollToTopThreshold: autoscrollToRecent ? 10 : undefined,
      minIndexForVisible: 1
    };
  }, [autoscrollToRecent]);
  var onStartReachedTracker = (0, _react.useRef)({});
  var onEndReachedTracker = (0, _react.useRef)({});
  var onStartReachedInPromise = (0, _react.useRef)(null);
  var onEndReachedInPromise = (0, _react.useRef)(null);
  var flatListRef = (0, _react.useRef)(null);
  var channelResyncScrollSet = (0, _react.useRef)(true);
  var scrollToDebounceTimeoutRef = (0, _react.useRef)(undefined);
  var onScrollEventTimeoutRef = (0, _react.useRef)(undefined);
  var messageIdLastScrolledToRef = (0, _react.useRef)(undefined);
  var _useState5 = (0, _react.useState)(false),
    _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
    hasMoved = _useState6[0],
    setHasMoved = _useState6[1];
  var lastReceivedId = (0, _react.useMemo)(function () {
    var _getLastReceivedMessa;
    return (_getLastReceivedMessa = (0, _getLastReceivedMessage.getLastReceivedMessage)(processedMessageList)) == null ? void 0 : _getLastReceivedMessa.id;
  }, [processedMessageList]);
  var _useState7 = (0, _react.useState)(false),
    _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
    scrollToBottomButtonVisible = _useState8[0],
    setScrollToBottomButtonVisible = _useState8[1];
  var _useState9 = (0, _react.useState)(),
    _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
    stickyHeaderDate = _useState10[0],
    setStickyHeaderDate = _useState10[1];
  var stickyHeaderDateRef = (0, _react.useRef)(undefined);
  var channelRef = (0, _react.useRef)(channel);
  channelRef.current = channel;
  var updateStickyHeaderDateIfNeeded = (0, _hooks.useStableCallback)(function (viewableItems) {
    if (!viewableItems.length) {
      return;
    }
    var lastItem = viewableItems[viewableItems.length - 1];
    if (lastItem) {
      var _lastItem$item, _stickyHeaderDateRef$;
      if (!channel.state.messagePagination.hasPrev && processedMessageList[processedMessageList.length - 1].id === lastItem.item.id) {
        setStickyHeaderDate(undefined);
        return;
      }
      var isMessageTypeDeleted = lastItem.item.type === 'deleted';
      if (lastItem != null && (_lastItem$item = lastItem.item) != null && _lastItem$item.created_at && !isMessageTypeDeleted && typeof lastItem.item.created_at !== 'string' && lastItem.item.created_at.toDateString() !== ((_stickyHeaderDateRef$ = stickyHeaderDateRef.current) == null ? void 0 : _stickyHeaderDateRef$.toDateString())) {
        stickyHeaderDateRef.current = lastItem.item.created_at;
        setStickyHeaderDate(lastItem.item.created_at);
      }
    }
  });
  var updateStickyUnreadIndicator = (0, _hooks.useStableCallback)(function (viewableItems) {
    if (!viewableItems.length) {
      setIsUnreadNotificationOpen(false);
      return;
    }
    if (selectedPicker === 'images') {
      setIsUnreadNotificationOpen(false);
      return;
    }
    var lastItem = viewableItems[viewableItems.length - 1];
    if (lastItem) {
      var lastItemMessage = lastItem.item;
      var lastItemCreatedAt = lastItemMessage.created_at;
      var unreadIndicatorDate = channelUnreadState == null ? void 0 : channelUnreadState.last_read.getTime();
      var lastItemDate = lastItemCreatedAt.getTime();
      if (!channel.state.messagePagination.hasPrev && processedMessageList[processedMessageList.length - 1].id === lastItemMessage.id) {
        setIsUnreadNotificationOpen(false);
        return;
      }
      if (viewableItems.length === 1 && channel.countUnread() === 0 && lastItemMessage.user.id === client.userID) {
        setIsUnreadNotificationOpen(false);
        return;
      }
      if (unreadIndicatorDate && lastItemDate > unreadIndicatorDate) {
        setIsUnreadNotificationOpen(true);
      } else {
        setIsUnreadNotificationOpen(false);
      }
    }
  });
  var unstableOnViewableItemsChanged = function unstableOnViewableItemsChanged(_ref) {
    var viewableItems = _ref.viewableItems;
    if (!viewableItems) {
      return;
    }
    if (!hideStickyDateHeader) {
      updateStickyHeaderDateIfNeeded(viewableItems);
    }
    updateStickyUnreadIndicator(viewableItems);
  };
  var onViewableItemsChanged = (0, _react.useRef)(unstableOnViewableItemsChanged);
  onViewableItemsChanged.current = unstableOnViewableItemsChanged;
  var stableOnViewableItemsChanged = (0, _react.useCallback)(function (_ref2) {
    var viewableItems = _ref2.viewableItems;
    onViewableItemsChanged.current({
      viewableItems: viewableItems
    });
  }, []);
  var resetPaginationTrackersRef = (0, _react.useRef)(function () {
    onStartReachedTracker.current = {};
    onEndReachedTracker.current = {};
  });
  (0, _react.useEffect)(function () {
    if (disabled) {
      setScrollToBottomButtonVisible(false);
    }
  }, [disabled]);
  (0, _react.useEffect)(function () {
    var shouldMarkRead = function shouldMarkRead() {
      var _client$user, _client$user2;
      return !(channelUnreadState != null && channelUnreadState.first_unread_message_id) && !scrollToBottomButtonVisible && ((_client$user = client.user) == null ? void 0 : _client$user.id) && !hasReadLastMessage(channel, (_client$user2 = client.user) == null ? void 0 : _client$user2.id);
    };
    var handleEvent = function () {
      var _ref3 = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(event) {
        var _event$message, _event$message2;
        var mainChannelUpdated;
        return _regenerator["default"].wrap(function _callee$(_context) {
          while (1) switch (_context.prev = _context.next) {
            case 0:
              mainChannelUpdated = !((_event$message = event.message) != null && _event$message.parent_id) || ((_event$message2 = event.message) == null ? void 0 : _event$message2.show_in_channel);
              if (!(scrollToBottomButtonVisible || channelUnreadState != null && channelUnreadState.first_unread_message_id)) {
                _context.next = 5;
                break;
              }
              setChannelUnreadState(function (prev) {
                var _prev$unread_messages, _prev$last_read;
                var previousUnreadCount = (_prev$unread_messages = prev == null ? void 0 : prev.unread_messages) != null ? _prev$unread_messages : 0;
                var previousLastMessage = getPreviousLastMessage(channel.state.messages, event.message);
                return Object.assign({}, prev || {}, {
                  last_read: (_prev$last_read = prev == null ? void 0 : prev.last_read) != null ? _prev$last_read : previousUnreadCount === 0 && previousLastMessage != null && previousLastMessage.created_at ? new Date(previousLastMessage.created_at) : new Date(0),
                  unread_messages: previousUnreadCount + 1
                });
              });
              _context.next = 8;
              break;
            case 5:
              if (!(mainChannelUpdated && shouldMarkRead())) {
                _context.next = 8;
                break;
              }
              _context.next = 8;
              return markRead();
            case 8:
            case "end":
              return _context.stop();
          }
        }, _callee);
      }));
      return function handleEvent(_x) {
        return _ref3.apply(this, arguments);
      };
    }();
    var listener = channel.on('message.new', handleEvent);
    return function () {
      listener == null || listener.unsubscribe();
    };
  }, [channel, channelUnreadState == null ? void 0 : channelUnreadState.first_unread_message_id, (_client$user3 = client.user) == null ? void 0 : _client$user3.id, markRead, scrollToBottomButtonVisible, setChannelUnreadState, threadList]);
  (0, _react.useEffect)(function () {
    var scrollToBottomIfNeeded = function scrollToBottomIfNeeded() {
      var _topMessageBeforeUpda;
      if (!client || !channel || rawMessageList.length === 0) {
        return;
      }
      var isMessageRemovedFromMessageList = messageListLengthAfterUpdate < messageListLengthBeforeUpdate.current;
      if (isMessageRemovedFromMessageList || (_topMessageBeforeUpda = topMessageBeforeUpdate.current) != null && _topMessageBeforeUpda.created_at && topMessageAfterUpdate != null && topMessageAfterUpdate.created_at && topMessageBeforeUpdate.current.created_at < topMessageAfterUpdate.created_at) {
        channelResyncScrollSet.current = false;
        setScrollToBottomButtonVisible(false);
        resetPaginationTrackersRef.current();
        setTimeout(function () {
          var _flatListRef$current;
          (_flatListRef$current = flatListRef.current) == null || _flatListRef$current.scrollToOffset({
            offset: 0
          });
        }, WAIT_FOR_SCROLL_TIMEOUT);
        setTimeout(function () {
          channelResyncScrollSet.current = true;
          if (channel.countUnread() > 0) {
            markRead();
          }
        }, 500);
      }
    };
    if (threadList) {
      scrollToBottomIfNeeded();
    }
    messageListLengthBeforeUpdate.current = messageListLengthAfterUpdate;
    topMessageBeforeUpdate.current = topMessageAfterUpdate;
  }, [threadList, messageListLengthAfterUpdate, topMessageAfterUpdate == null ? void 0 : topMessageAfterUpdate.id]);
  (0, _react.useEffect)(function () {
    if (!rawMessageList.length) {
      return;
    }
    if (threadList) {
      setAutoscrollToRecent(true);
      return;
    }
    var notLatestSet = channel.state.messages !== channel.state.latestMessages;
    if (notLatestSet) {
      latestNonCurrentMessageBeforeUpdateRef.current = channel.state.latestMessages[channel.state.latestMessages.length - 1];
      setAutoscrollToRecent(false);
      setScrollToBottomButtonVisible(true);
      return;
    }
    var latestNonCurrentMessageBeforeUpdate = latestNonCurrentMessageBeforeUpdateRef.current;
    latestNonCurrentMessageBeforeUpdateRef.current = undefined;
    var latestCurrentMessageAfterUpdate = rawMessageList[rawMessageList.length - 1];
    if (!latestCurrentMessageAfterUpdate) {
      setAutoscrollToRecent(true);
      return;
    }
    var didMergeMessageSetsWithNoUpdates = (latestNonCurrentMessageBeforeUpdate == null ? void 0 : latestNonCurrentMessageBeforeUpdate.id) === latestCurrentMessageAfterUpdate.id;
    setAutoscrollToRecent(!didMergeMessageSetsWithNoUpdates);
    if (!didMergeMessageSetsWithNoUpdates) {
      var shouldScrollToRecentOnNewOwnMessage = shouldScrollToRecentOnNewOwnMessageRef.current();
      if (shouldScrollToRecentOnNewOwnMessage) {
        setTimeout(function () {
          var _flatListRef$current2;
          (_flatListRef$current2 = flatListRef.current) == null || _flatListRef$current2.scrollToOffset({
            animated: true,
            offset: 0
          });
        }, WAIT_FOR_SCROLL_TIMEOUT);
      }
    }
  }, [channel, rawMessageList, threadList]);
  var goToMessage = (0, _hooks.useStableCallback)(function () {
    var _ref4 = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(messageId) {
      var indexOfParentInMessageList;
      return _regenerator["default"].wrap(function _callee2$(_context2) {
        while (1) switch (_context2.prev = _context2.next) {
          case 0:
            indexOfParentInMessageList = processedMessageList.findIndex(function (message) {
              return (message == null ? void 0 : message.id) === messageId;
            });
            _context2.prev = 1;
            if (!(indexOfParentInMessageList === -1)) {
              _context2.next = 8;
              break;
            }
            _context2.next = 5;
            return loadChannelAroundMessage({
              messageId: messageId
            });
          case 5:
            return _context2.abrupt("return");
          case 8:
            if (flatListRef.current) {
              _context2.next = 10;
              break;
            }
            return _context2.abrupt("return");
          case 10:
            clearTimeout(failScrollTimeoutId.current);
            scrollToIndexFailedRetryCountRef.current = 0;
            messageIdLastScrolledToRef.current = messageId;
            setTargetedMessage(messageId);
            flatListRef.current.scrollToIndex({
              animated: true,
              index: indexOfParentInMessageList,
              viewPosition: 0.5
            });
            return _context2.abrupt("return");
          case 16:
            _context2.next = 21;
            break;
          case 18:
            _context2.prev = 18;
            _context2.t0 = _context2["catch"](1);
            console.warn('Error while scrolling to message', _context2.t0);
          case 21:
          case "end":
            return _context2.stop();
        }
      }, _callee2, null, [[1, 18]]);
    }));
    return function (_x2) {
      return _ref4.apply(this, arguments);
    };
  }());
  (0, _react.useEffect)(function () {
    if (!targetedMessage) {
      return;
    }
    scrollToDebounceTimeoutRef.current = setTimeout((0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3() {
      var indexOfParentInMessageList;
      return _regenerator["default"].wrap(function _callee3$(_context3) {
        while (1) switch (_context3.prev = _context3.next) {
          case 0:
            indexOfParentInMessageList = processedMessageList.findIndex(function (message) {
              return (message == null ? void 0 : message.id) === targetedMessage;
            });
            if (!(indexOfParentInMessageList === -1)) {
              _context3.next = 6;
              break;
            }
            _context3.next = 4;
            return loadChannelAroundMessage({
              messageId: targetedMessage,
              setTargetedMessage: setTargetedMessage
            });
          case 4:
            _context3.next = 13;
            break;
          case 6:
            if (flatListRef.current) {
              _context3.next = 8;
              break;
            }
            return _context3.abrupt("return");
          case 8:
            clearTimeout(scrollToDebounceTimeoutRef.current);
            clearTimeout(failScrollTimeoutId.current);
            scrollToIndexFailedRetryCountRef.current = 0;
            flatListRef.current.scrollToIndex({
              animated: true,
              index: indexOfParentInMessageList,
              viewPosition: 0.5
            });
            setTargetedMessage(undefined);
          case 13:
          case "end":
            return _context3.stop();
        }
      }, _callee3);
    })), WAIT_FOR_SCROLL_TIMEOUT);
  }, [targetedMessage]);
  var shouldApplyAndroidWorkaround = inverted && _reactNative.Platform.OS === 'android';
  var renderItem = (0, _react.useCallback)(function (_ref6) {
    var _message$user, _messageGroupStylesRe;
    var index = _ref6.index,
      message = _ref6.item;
    if (!channel || channel.disconnected || !channel.initialized && !channel.offlineMode) {
      return null;
    }
    var createdAtTimestamp = message.created_at && new Date(message.created_at).getTime();
    var lastReadTimestamp = channelUnreadState == null ? void 0 : channelUnreadState.last_read.getTime();
    var isNewestMessage = index === 0;
    var isLastReadMessage = (channelUnreadState == null ? void 0 : channelUnreadState.last_read_message_id) === message.id || !(channelUnreadState != null && channelUnreadState.unread_messages) && createdAtTimestamp === lastReadTimestamp;
    var showUnreadSeparator = isLastReadMessage && !isNewestMessage && (!!(channelUnreadState != null && channelUnreadState.first_unread_message_id) || !!(channelUnreadState != null && channelUnreadState.unread_messages));
    var showUnreadUnderlay = !!shouldShowUnreadUnderlay && showUnreadSeparator;
    var wrapMessageInTheme = client.userID === ((_message$user = message.user) == null ? void 0 : _message$user.id) && !!myMessageTheme;
    var renderDateSeperator = dateSeparatorsRef.current[message.id] && (0, _jsxRuntime.jsx)(InlineDateSeparator, {
      date: dateSeparatorsRef.current[message.id]
    });
    var renderMessage = (0, _jsxRuntime.jsx)(Message, {
      goToMessage: goToMessage,
      groupStyles: (_messageGroupStylesRe = messageGroupStylesRef.current[message.id]) != null ? _messageGroupStylesRe : [],
      isTargetedMessage: highlightedMessageId === message.id,
      lastReceivedId: lastReceivedId === message.id || message.quoted_message_id ? lastReceivedId : undefined,
      message: message,
      onThreadSelect: onThreadSelect,
      showUnreadUnderlay: showUnreadUnderlay,
      style: [messageContainer],
      threadList: threadList
    });
    return (0, _jsxRuntime.jsxs)(_reactNative.View, {
      style: [shouldApplyAndroidWorkaround ? styles.invertAndroid : undefined],
      testID: "message-list-item-".concat(index),
      children: [message.type === 'system' ? (0, _jsxRuntime.jsx)(MessageSystem, {
        message: message,
        style: [{
          paddingHorizontal: screenPadding
        }, messageContainer]
      }) : wrapMessageInTheme ? (0, _jsxRuntime.jsx)(_ThemeContext.ThemeProvider, {
        mergedStyle: modifiedTheme,
        children: (0, _jsxRuntime.jsxs)(_reactNative.View, {
          testID: "message-list-item-".concat(index),
          children: [renderDateSeperator, renderMessage]
        })
      }) : (0, _jsxRuntime.jsxs)(_reactNative.View, {
        testID: "message-list-item-".concat(index),
        children: [renderDateSeperator, renderMessage]
      }), showUnreadUnderlay && (0, _jsxRuntime.jsx)(InlineUnreadIndicator, {})]
    });
  }, [InlineDateSeparator, InlineUnreadIndicator, Message, MessageSystem, channel, channelUnreadState == null ? void 0 : channelUnreadState.first_unread_message_id, channelUnreadState == null ? void 0 : channelUnreadState.last_read, channelUnreadState == null ? void 0 : channelUnreadState.last_read_message_id, channelUnreadState == null ? void 0 : channelUnreadState.unread_messages, client.userID, dateSeparatorsRef, goToMessage, highlightedMessageId, lastReceivedId, messageContainer, messageGroupStylesRef, modifiedTheme, myMessageTheme, onThreadSelect, screenPadding, shouldApplyAndroidWorkaround, shouldShowUnreadUnderlay, threadList]);
  var maybeCallOnStartReached = (0, _hooks.useStableCallback)((0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee4() {
    var callback, onError;
    return _regenerator["default"].wrap(function _callee4$(_context4) {
      while (1) switch (_context4.prev = _context4.next) {
        case 0:
          if (!(processedMessageList != null && processedMessageList.length && onStartReachedTracker.current[processedMessageList.length])) {
            _context4.next = 2;
            break;
          }
          return _context4.abrupt("return");
        case 2:
          if (processedMessageList != null && processedMessageList.length) {
            onStartReachedTracker.current[processedMessageList.length] = true;
          }
          callback = function callback() {
            onStartReachedInPromise.current = null;
            return Promise.resolve();
          };
          onError = function onError() {
            setTimeout(function () {
              onStartReachedTracker.current = {};
            }, 2000);
          };
          if (!onEndReachedInPromise.current) {
            _context4.next = 8;
            break;
          }
          _context4.next = 8;
          return onEndReachedInPromise.current;
        case 8:
          onStartReachedInPromise.current = (threadList && !!threadInstance && loadMoreRecentThread ? loadMoreRecentThread({}) : loadMoreRecent()).then(callback)["catch"](onError);
        case 9:
        case "end":
          return _context4.stop();
      }
    }, _callee4);
  })));
  var maybeCallOnEndReached = (0, _hooks.useStableCallback)((0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee5() {
    var callback, onError;
    return _regenerator["default"].wrap(function _callee5$(_context5) {
      while (1) switch (_context5.prev = _context5.next) {
        case 0:
          if (!(processedMessageList != null && processedMessageList.length && onEndReachedTracker.current[processedMessageList.length])) {
            _context5.next = 2;
            break;
          }
          return _context5.abrupt("return");
        case 2:
          if (processedMessageList != null && processedMessageList.length) {
            onEndReachedTracker.current[processedMessageList.length] = true;
          }
          callback = function callback() {
            onEndReachedInPromise.current = null;
            return Promise.resolve();
          };
          onError = function onError() {
            setTimeout(function () {
              onEndReachedTracker.current = {};
            }, 2000);
          };
          if (!onStartReachedInPromise.current) {
            _context5.next = 8;
            break;
          }
          _context5.next = 8;
          return onStartReachedInPromise.current;
        case 8:
          onEndReachedInPromise.current = (threadList ? loadMoreThread() : loadMore()).then(callback)["catch"](onError);
        case 9:
        case "end":
          return _context5.stop();
      }
    }, _callee5);
  })));
  var onUserScrollEvent = (0, _hooks.useStableCallback)(function (event) {
    var nativeEvent = event.nativeEvent;
    clearTimeout(onScrollEventTimeoutRef.current);
    var offset = nativeEvent.contentOffset.y;
    var visibleLength = nativeEvent.layoutMeasurement.height;
    var contentLength = nativeEvent.contentSize.height;
    if (!channel || !channelResyncScrollSet.current) {
      return;
    }
    var isScrollAtStart = offset < 100;
    var isScrollAtEnd = contentLength - visibleLength - offset < 100;
    if (isScrollAtStart) {
      maybeCallOnStartReached();
    }
    if (isScrollAtEnd) {
      maybeCallOnEndReached();
    }
  });
  var handleScroll = (0, _hooks.useStableCallback)(function (event) {
    var messageListHasMessages = processedMessageList.length > 0;
    var offset = event.nativeEvent.contentOffset.y;
    var isScrollAtBottom = offset <= 150;
    var notLatestSet = channel.state.messages !== channel.state.latestMessages;
    var showScrollToBottomButton = messageListHasMessages && (!threadList && notLatestSet || !isScrollAtBottom);
    setScrollToBottomButtonVisible(showScrollToBottomButton);
    if (onListScroll) {
      onListScroll(event);
    }
  });
  var goToNewMessages = (0, _hooks.useStableCallback)((0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee6() {
    var isNotLatestSet;
    return _regenerator["default"].wrap(function _callee6$(_context6) {
      while (1) switch (_context6.prev = _context6.next) {
        case 0:
          isNotLatestSet = channel.state.messages !== channel.state.latestMessages;
          if (!isNotLatestSet) {
            _context6.next = 7;
            break;
          }
          resetPaginationTrackersRef.current();
          _context6.next = 5;
          return reloadChannel();
        case 5:
          _context6.next = 8;
          break;
        case 7:
          if (flatListRef.current) {
            flatListRef.current.scrollToOffset({
              animated: true,
              offset: 0
            });
          }
        case 8:
          setScrollToBottomButtonVisible(false);
          _context6.next = 11;
          return markRead({
            updateChannelUnreadState: false
          });
        case 11:
        case "end":
          return _context6.stop();
      }
    }, _callee6);
  })));
  var scrollToIndexFailedRetryCountRef = (0, _react.useRef)(0);
  var failScrollTimeoutId = (0, _react.useRef)(undefined);
  var onScrollToIndexFailedRef = (0, _react.useRef)(function (info) {
    if (!flatListRef.current) {
      return;
    }
    failScrollTimeoutId.current = setTimeout(function () {
      try {
        var _flatListRef$current3;
        (_flatListRef$current3 = flatListRef.current) == null || _flatListRef$current3.scrollToIndex({
          animated: true,
          index: info.index,
          viewPosition: 0.5
        });
        if (messageIdLastScrolledToRef.current) {
          setTargetedMessage(messageIdLastScrolledToRef.current);
        }
        scrollToIndexFailedRetryCountRef.current = 0;
      } catch (e) {
        if (!onScrollToIndexFailedRef.current || scrollToIndexFailedRetryCountRef.current > MAX_RETRIES_AFTER_SCROLL_FAILURE) {
          scrollToIndexFailedRetryCountRef.current = 0;
          return;
        }
        scrollToIndexFailedRetryCountRef.current += 1;
        onScrollToIndexFailedRef.current(info);
      }
    }, WAIT_FOR_SCROLL_TIMEOUT);
  });
  var messagesWithImages = legacyImageViewerSwipeBehaviour && processedMessageList.filter(function (message) {
    var isMessageTypeDeleted = message.type === 'deleted';
    if (!isMessageTypeDeleted && message.attachments) {
      return message.attachments.some(function (attachment) {
        return attachment.type === _types.FileTypes.Image && !attachment.title_link && !attachment.og_scrape_url && (attachment.image_url || attachment.thumb_url);
      });
    }
    return false;
  });
  var imageString = legacyImageViewerSwipeBehaviour && messagesWithImages && messagesWithImages.map(function (message) {
    var _message$attachments;
    return (_message$attachments = message.attachments) == null ? void 0 : _message$attachments.map(function (attachment) {
      return attachment.image_url || attachment.thumb_url || '';
    }).join();
  }).join();
  var numberOfMessagesWithImages = legacyImageViewerSwipeBehaviour && messagesWithImages && messagesWithImages.length;
  var threadExists = !!thread;
  (0, _react.useEffect)(function () {
    if (legacyImageViewerSwipeBehaviour && isListActive && (threadList && thread || !threadList && !thread)) {
      setMessages(messagesWithImages);
    }
  }, [imageString, isListActive, legacyImageViewerSwipeBehaviour, numberOfMessagesWithImages, threadExists, threadList]);
  var dismissImagePicker = (0, _hooks.useStableCallback)(function () {
    if (selectedPicker) {
      setSelectedPicker(undefined);
      closePicker();
    }
  });
  var onScrollBeginDrag = (0, _hooks.useStableCallback)(function (event) {
    !hasMoved && selectedPicker && setHasMoved(true);
    onUserScrollEvent(event);
  });
  var onScrollEndDrag = (0, _hooks.useStableCallback)(function (event) {
    hasMoved && selectedPicker && setHasMoved(false);
    onUserScrollEvent(event);
  });
  var refCallback = (0, _hooks.useStableCallback)(function (ref) {
    flatListRef.current = ref;
    if (setFlatListRef) {
      setFlatListRef(ref);
    }
  });
  var onUnreadNotificationClose = (0, _hooks.useStableCallback)((0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee7() {
    return _regenerator["default"].wrap(function _callee7$(_context7) {
      while (1) switch (_context7.prev = _context7.next) {
        case 0:
          _context7.next = 2;
          return markRead();
        case 2:
          setIsUnreadNotificationOpen(false);
        case 3:
        case "end":
          return _context7.stop();
      }
    }, _callee7);
  })));
  var debugRef = (0, _DebugContext.useDebugContext)();
  var isDebugModeEnabled = __DEV__ && debugRef && debugRef.current;
  if (isDebugModeEnabled) {
    if (debugRef.current.setEventType) {
      debugRef.current.setEventType('send');
    }
    if (debugRef.current.setSendEventParams) {
      debugRef.current.setSendEventParams({
        action: thread ? 'ThreadList' : 'Messages',
        data: processedMessageList
      });
    }
  }
  var ListFooterComponent = (0, _react.useCallback)(function () {
    return (0, _jsxRuntime.jsx)(_reactNative.View, {
      style: shouldApplyAndroidWorkaround ? styles.invertAndroid : undefined,
      children: (0, _jsxRuntime.jsx)(FooterComponent, {})
    });
  }, [shouldApplyAndroidWorkaround, FooterComponent]);
  var ListHeaderComponent = (0, _react.useCallback)(function () {
    return (0, _jsxRuntime.jsx)(_reactNative.View, {
      style: shouldApplyAndroidWorkaround ? styles.invertAndroid : undefined,
      children: (0, _jsxRuntime.jsx)(HeaderComponent, {})
    });
  }, [shouldApplyAndroidWorkaround, HeaderComponent]);
  var ItemSeparatorComponent = additionalFlatListProps == null ? void 0 : additionalFlatListProps.ItemSeparatorComponent;
  var WrappedItemSeparatorComponent = (0, _react.useCallback)(function () {
    return (0, _jsxRuntime.jsx)(_reactNative.View, {
      style: [shouldApplyAndroidWorkaround ? styles.invertAndroid : undefined],
      children: ItemSeparatorComponent ? (0, _jsxRuntime.jsx)(ItemSeparatorComponent, {}) : null
    });
  }, [ItemSeparatorComponent, shouldApplyAndroidWorkaround]);
  var additionalFlatListPropsExcludingStyle;
  if (additionalFlatListProps) {
    var contentContainerStyle = additionalFlatListProps.contentContainerStyle,
      _ItemSeparatorComponent = additionalFlatListProps.ItemSeparatorComponent,
      style = additionalFlatListProps.style,
      rest = (0, _objectWithoutProperties2["default"])(additionalFlatListProps, _excluded);
    additionalFlatListPropsExcludingStyle = rest;
  }
  var flatListStyle = (0, _react.useMemo)(function () {
    return [styles.listContainer, listContainer, additionalFlatListProps == null ? void 0 : additionalFlatListProps.style, shouldApplyAndroidWorkaround ? styles.invertAndroid : undefined];
  }, [additionalFlatListProps == null ? void 0 : additionalFlatListProps.style, listContainer, shouldApplyAndroidWorkaround]);
  var flatListContentContainerStyle = (0, _react.useMemo)(function () {
    return [styles.contentContainer, additionalFlatListProps == null ? void 0 : additionalFlatListProps.contentContainerStyle, contentContainer];
  }, [additionalFlatListProps == null ? void 0 : additionalFlatListProps.contentContainerStyle, contentContainer]);
  if (!FlatList) {
    return null;
  }
  if (loading) {
    return (0, _jsxRuntime.jsx)(_reactNative.View, {
      style: [styles.container, {
        backgroundColor: white_snow
      }, container],
      children: (0, _jsxRuntime.jsx)(LoadingIndicator, {
        listType: "message"
      })
    });
  }
  return (0, _jsxRuntime.jsxs)(_reactNative.View, {
    style: [styles.container, {
      backgroundColor: white_snow
    }, container],
    testID: "message-flat-list-wrapper",
    children: [processedMessageList.length === 0 && !thread ? (0, _jsxRuntime.jsx)(_reactNative.View, {
      style: [styles.flex, {
        backgroundColor: white_snow
      }],
      testID: "empty-state",
      children: EmptyStateIndicator ? (0, _jsxRuntime.jsx)(EmptyStateIndicator, {
        listType: "message"
      }) : null
    }) : (0, _jsxRuntime.jsx)(FlatList, Object.assign({
      contentContainerStyle: flatListContentContainerStyle,
      data: processedMessageList,
      extraData: disabled,
      inverted: shouldApplyAndroidWorkaround ? false : inverted,
      ItemSeparatorComponent: WrappedItemSeparatorComponent,
      keyboardShouldPersistTaps: "handled",
      keyExtractor: keyExtractor,
      ListFooterComponent: ListFooterComponent,
      ListHeaderComponent: ListHeaderComponent,
      maintainVisibleContentPosition: maintainVisibleContentPosition,
      maxToRenderPerBatch: 30,
      onMomentumScrollEnd: onUserScrollEvent,
      onScroll: handleScroll,
      onScrollBeginDrag: onScrollBeginDrag,
      onScrollEndDrag: onScrollEndDrag,
      onScrollToIndexFailed: onScrollToIndexFailedRef.current,
      onTouchEnd: dismissImagePicker,
      onViewableItemsChanged: stableOnViewableItemsChanged,
      ref: refCallback,
      renderItem: renderItem,
      scrollEnabled: overlay === 'none',
      showsVerticalScrollIndicator: !shouldApplyAndroidWorkaround,
      style: flatListStyle,
      testID: "message-flat-list",
      viewabilityConfig: flatListViewabilityConfig
    }, additionalFlatListPropsExcludingStyle)), (0, _jsxRuntime.jsx)(_reactNative.View, {
      style: styles.stickyHeader,
      children: messageListLengthAfterUpdate && StickyHeader ? (0, _jsxRuntime.jsx)(StickyHeader, {
        date: stickyHeaderDate,
        DateHeader: DateHeader
      }) : null
    }), !disableTypingIndicator && TypingIndicator && (0, _jsxRuntime.jsx)(TypingIndicatorContainer, {
      children: (0, _jsxRuntime.jsx)(TypingIndicator, {})
    }), (0, _jsxRuntime.jsx)(ScrollToBottomButton, {
      onPress: goToNewMessages,
      showNotification: scrollToBottomButtonVisible,
      unreadCount: threadList ? 0 : channel == null ? void 0 : channel.countUnread()
    }), (0, _jsxRuntime.jsx)(NetworkDownIndicator, {}), isUnreadNotificationOpen && !threadList ? (0, _jsxRuntime.jsx)(UnreadMessagesNotification, {
      onCloseHandler: onUnreadNotificationClose
    }) : null]
  });
};
var MessageList = exports.MessageList = function MessageList(props) {
  var _useAttachmentPickerC = (0, _AttachmentPickerContext.useAttachmentPickerContext)(),
    closePicker = _useAttachmentPickerC.closePicker,
    selectedPicker = _useAttachmentPickerC.selectedPicker,
    setSelectedPicker = _useAttachmentPickerC.setSelectedPicker;
  var _useChannelContext = (0, _ChannelContext.useChannelContext)(),
    channel = _useChannelContext.channel,
    channelUnreadState = _useChannelContext.channelUnreadState,
    disabled = _useChannelContext.disabled,
    EmptyStateIndicator = _useChannelContext.EmptyStateIndicator,
    enableMessageGroupingByUser = _useChannelContext.enableMessageGroupingByUser,
    error = _useChannelContext.error,
    hideStickyDateHeader = _useChannelContext.hideStickyDateHeader,
    highlightedMessageId = _useChannelContext.highlightedMessageId,
    isChannelActive = _useChannelContext.isChannelActive,
    loadChannelAroundMessage = _useChannelContext.loadChannelAroundMessage,
    loading = _useChannelContext.loading,
    LoadingIndicator = _useChannelContext.LoadingIndicator,
    markRead = _useChannelContext.markRead,
    NetworkDownIndicator = _useChannelContext.NetworkDownIndicator,
    reloadChannel = _useChannelContext.reloadChannel,
    scrollToFirstUnreadThreshold = _useChannelContext.scrollToFirstUnreadThreshold,
    setChannelUnreadState = _useChannelContext.setChannelUnreadState,
    setTargetedMessage = _useChannelContext.setTargetedMessage,
    StickyHeader = _useChannelContext.StickyHeader,
    targetedMessage = _useChannelContext.targetedMessage,
    threadList = _useChannelContext.threadList;
  var _useChatContext = (0, _ChatContext.useChatContext)(),
    client = _useChatContext.client;
  var _useImageGalleryConte = (0, _ImageGalleryContext.useImageGalleryContext)(),
    setMessages = _useImageGalleryConte.setMessages;
  var _useMessagesContext = (0, _MessagesContext.useMessagesContext)(),
    DateHeader = _useMessagesContext.DateHeader,
    disableTypingIndicator = _useMessagesContext.disableTypingIndicator,
    FlatList = _useMessagesContext.FlatList,
    InlineDateSeparator = _useMessagesContext.InlineDateSeparator,
    InlineUnreadIndicator = _useMessagesContext.InlineUnreadIndicator,
    legacyImageViewerSwipeBehaviour = _useMessagesContext.legacyImageViewerSwipeBehaviour,
    Message = _useMessagesContext.Message,
    MessageSystem = _useMessagesContext.MessageSystem,
    myMessageTheme = _useMessagesContext.myMessageTheme,
    ScrollToBottomButton = _useMessagesContext.ScrollToBottomButton,
    shouldShowUnreadUnderlay = _useMessagesContext.shouldShowUnreadUnderlay,
    TypingIndicator = _useMessagesContext.TypingIndicator,
    TypingIndicatorContainer = _useMessagesContext.TypingIndicatorContainer,
    UnreadMessagesNotification = _useMessagesContext.UnreadMessagesNotification;
  var _usePaginatedMessageL = (0, _PaginatedMessageListContext.usePaginatedMessageListContext)(),
    loadMore = _usePaginatedMessageL.loadMore,
    loadMoreRecent = _usePaginatedMessageL.loadMoreRecent;
  var _useOverlayContext = (0, _OverlayContext.useOverlayContext)(),
    overlay = _useOverlayContext.overlay;
  var _useThreadContext = (0, _ThreadContext.useThreadContext)(),
    loadMoreRecentThread = _useThreadContext.loadMoreRecentThread,
    loadMoreThread = _useThreadContext.loadMoreThread,
    thread = _useThreadContext.thread,
    threadInstance = _useThreadContext.threadInstance;
  return (0, _jsxRuntime.jsx)(MessageListWithContext, Object.assign({
    channel: channel,
    channelUnreadState: channelUnreadState,
    client: client,
    closePicker: closePicker,
    DateHeader: DateHeader,
    disabled: disabled,
    disableTypingIndicator: disableTypingIndicator,
    EmptyStateIndicator: EmptyStateIndicator,
    enableMessageGroupingByUser: enableMessageGroupingByUser,
    error: error,
    FlatList: FlatList,
    hideStickyDateHeader: hideStickyDateHeader,
    highlightedMessageId: highlightedMessageId,
    InlineDateSeparator: InlineDateSeparator,
    InlineUnreadIndicator: InlineUnreadIndicator,
    isListActive: isChannelActive,
    legacyImageViewerSwipeBehaviour: legacyImageViewerSwipeBehaviour,
    loadChannelAroundMessage: loadChannelAroundMessage,
    loading: loading,
    LoadingIndicator: LoadingIndicator,
    loadMore: loadMore,
    loadMoreRecent: loadMoreRecent,
    loadMoreRecentThread: loadMoreRecentThread,
    loadMoreThread: loadMoreThread,
    markRead: markRead,
    Message: Message,
    MessageSystem: MessageSystem,
    myMessageTheme: myMessageTheme,
    NetworkDownIndicator: NetworkDownIndicator,
    overlay: overlay,
    reloadChannel: reloadChannel,
    ScrollToBottomButton: ScrollToBottomButton,
    scrollToFirstUnreadThreshold: scrollToFirstUnreadThreshold,
    selectedPicker: selectedPicker,
    setChannelUnreadState: setChannelUnreadState,
    setMessages: setMessages,
    setSelectedPicker: setSelectedPicker,
    setTargetedMessage: setTargetedMessage,
    shouldShowUnreadUnderlay: shouldShowUnreadUnderlay,
    StickyHeader: StickyHeader,
    targetedMessage: targetedMessage,
    thread: thread,
    threadInstance: threadInstance,
    threadList: threadList,
    TypingIndicator: TypingIndicator,
    TypingIndicatorContainer: TypingIndicatorContainer,
    UnreadMessagesNotification: UnreadMessagesNotification
  }, props, {
    noGroupByUser: !enableMessageGroupingByUser || props.noGroupByUser
  }));
};
//# sourceMappingURL=MessageList.js.map