// Metro module 10897 (f10898). import _slicedToArray from "../../../_bundle/_slicedToArray"; import { forwardRef, useState, useRef, useCallback, useImperativeHandle, useEffect, useLayoutEffect, memo } from "react"; import { updateShouldShowJumpToPresentButton } from "../../chat_input/native/useChatBottomManagerUIStore"; import { getUserCommunicationDisabledVersion } from "../../../stores/GuildMemberStore"; import PermissionStore from "../../../stores/PermissionStore"; import ReadStateStore from "../../../stores/ReadStateStore"; import SKUStore from "../../../stores/game_store/SKUStore"; import { Changeset } from "./renderer/RowGeneratorConstants"; import { MAX_MESSAGES_PER_CHANNEL, Permissions, MessageTypes, ActivityActionTypes, MessageFlags } from "../../../Constants"; import TTITracker from "../../tti_analytics/TTITracker"; import openMediaModalOverlayAltTextSheet from "../../media_viewer/native/components/overlay/openMediaModalOverlayAltTextSheet"; import * as _MessagesUtils from "./MessagesUtils"; import { getVisibleMessages, getVoiceChannelIdChangedAuthorIds } from "./MessagesUtils"; import DimensionActionCreators from "../../../actions/DimensionActionCreators"; import ChatManager from "./renderer/ChatManager"; import RowGenerator from "./renderer/RowGenerator"; import NativeChatUtils from "../../chat/native/NativeChatUtils"; import { useChatUpdatesQueue } from "./MessagesHooks"; import Module12 from "../../../_bundle/Module12"; import SnowflakeUtils from "../../../utils/SnowflakeUtils"; import useChannelLoading from "./hooks/useChannelLoading"; import { questsVisibleMobileMessagesChanged } from "../../quests/QuestActionCreators"; import { handleAnnouncementMessageViewTracking, handleOfficialMessageViewTracking, handleRichPresenceInviteEmbedViewTracking, handleVoiceInviteEmbedViewTracking } from "./MessageImpressionAnalyticsHelpers"; import { findMessageRowIndex } from "../../chat/native/computeScrollData"; import useScrollHandlers from "./hooks/useScrollHandlers"; import MessageActionCreators from "../../../actions/MessageActionCreators"; import { MessagesHandlers } from "./MessagesHandlers"; import useRowManager from "./hooks/useRowManager"; import { JumpType } from "../../../flow/Client"; import SentryUtils_native from "../../../utils/SentryUtils.native"; import { getChangesetIdForChat } from "../../chat/native/ChatChangesetUpdateTracker"; import getMessageJumpData from "../../../components_native/chat/getMessageJumpData"; import shallowEqual, { areArraysShallowEqual } from "../../../_bundle/shallowEqual"; import { CodedLinkType } from "../../coded_links/CodedLink"; import { isVoiceChannelInvite } from "../../instant_invite/InviteTypeUtils"; import MessagesUtils2 from "../../../utils/native/MessagesUtils"; import Chat_android from "../../chat/native/Chat.android"; import { getNativeSyntheticEventData } from "./snowflake/MessageDataSnowflakeUtils"; import { isIOS } from "../../../utils/PlatformUtils"; import { KeyboardTypes } from "../../keyboard/native/KeyboardTypes"; import { QuestsVisibleMessagesChangedSource } from "../../quests/QuestTypes"; import { ChatTTITracker } from "../../chat/native/ChatTTITracker"; function $mk85738() { return (a0) => a0.id; } function $mk118285($env) { return () => (0, $env.$parent[25])(!$env[0]); } let handleMediaPlayFinishedAnalytics, isLoadingAtTop; let env7335 = {}; const handleTapShowAltText = function handleTapShowAltText(a0) { openMediaModalOverlayAltTextSheet({ description: a0.nativeEvent.description }); }; handleMediaPlayFinishedAnalytics = function handleMediaPlayFinishedAnalytics(a0) { _MessagesUtils.handleMediaPlayFinishedAnalytics(a0.nativeEvent); }; isLoadingAtTop = function isLoadingAtTop(a0, a1) { if (!a1) { return false; } for (const item of a0) { if (item.changeType !== Changeset.INSERT) { continue; } return item.index <= 1; } return false; }; const r51 = forwardRef((a0, a1) => { let env18347 = { $parent: env7335 }; env18347[0] = a0; const handleVisibleMessagesChange = function handleVisibleMessagesChange({ firstVisibleMessageRowIndex, firstVisibleMessagePercentVisible, lastVisibleMessageRowIndex, lastVisibleMessagePercentVisible, source }) { const r22 = env18347[0]; const visibleMessages = getVisibleMessages({ firstVisibleMessageRowIndex, lastVisibleMessageRowIndex, firstVisibleMessagePercentVisible, lastVisibleMessagePercentVisible, chatManager: env18347[1], channelId: r22.channelId }); if (!(visibleMessages.length <= 0)) { questsVisibleMobileMessagesChanged({ visibleMessages, source }); handleAnnouncementMessageViewTracking(visibleMessages, r22.shouldTrackAnnouncementMessageViews, r22.guildId, r22.channel); handleOfficialMessageViewTracking(visibleMessages, r22.shouldTrackOfficialMessageViews, r22.guildId, r22.channel); handleRichPresenceInviteEmbedViewTracking(visibleMessages, r22.shouldTrackRichPresenceInviteEmbedViews, r22.guildId, r22.channel); handleVoiceInviteEmbedViewTracking(visibleMessages, r22.shouldTrackVoiceInviteEmbedViews, r22.guildId, r22.channel); } }; env18347[16] = handleVisibleMessagesChange; const findMessageIndex = function findMessageIndex(a0) { if (a0 != null) { return findMessageRowIndex(env18347[1].getPreviousRows(), a0); } }; env18347[17] = findMessageIndex; env18347[28] = function _handleTapNavBar() { const r9 = async () => { let c30301_0; L19: { L18: { L14: { let env31598; const r12 = env31598 = { $parent: env18347 }; c30301_0 = r12; env31598[0] = void 0; const r32 = env18347[0]; const { channel, useReducedMotion } = r32; env31598[0] = useReducedMotion; if (!channel.isForumPost()) { break L19; } if (env18347[21].current) { break L19; } if (env18347[13](SnowflakeUtils.castChannelIdAsMessageId(channel.id)) == null) { await MessageActionCreators.fetchMessages({ channelId: channel.id, jump: { messageId: channel.id, flash: false }, limit: MAX_MESSAGES_PER_CHANNEL }); setTimeout($mk118285(c30301_0), 50); break L18; } const r58 = (0, env18347[17])(SnowflakeUtils.castChannelIdAsMessageId(channel.id)); if (r58 == null) { break L14; } NativeChatUtils.scrollTo(env18347[11].current, r58, { animated: !useReducedMotion }); setTimeout(() => (0, env18347[25])(!env31598[0]), 10 * r58); break L19; } return void 0; } return void 0; } }; env18347[28] = r9; return r9.apply(this, arguments); }; env18347[29] = function scrollToBottom(r5 = true) { (0, env18347[26])({ eventTimestamp: Date.now(), isAtBottom: true }); const current = env18347[11].current; if (r5) { r5 = !env18347[0].useReducedMotion; } NativeChatUtils.scrollToBottom(current, r5); }; env18347[30] = function jumpToPresent() { const r4 = env18347[0]; const { messages: messages2, channel } = r4; const jumpReturnTargetId = messages2.jumpReturnTargetId; if (jumpReturnTargetId == null) { if (!messages2.loadingMore) { if (messages2.hasMoreAfter) { MessageActionCreators.fetchMessages({ channelId: channel.id, limit: MAX_MESSAGES_PER_CHANNEL, jump: { present: true } }); } else { (0, env18347[26])({ eventTimestamp: Date.now(), isAtBottom: true }); NativeChatUtils.scrollToBottom(env18347[11].current, !r4.useReducedMotion); } } } else { MessageActionCreators.jumpToMessage({ channelId: channel.id, messageId: jumpReturnTargetId, flash: true }); } }; env18347[31] = function scrollToNewMessages() { const r6 = env18347[0]; let messageId = ReadStateStore.ackMessageId(r6.channel.id); if (messageId == null) { messageId = r6.channel.id; } MessageActionCreators.jumpToMessage({ channelId: r6.channel.id, messageId, offset: 1, context: "Mark As Read" }); }; env18347[32] = function getChatRef() { return env18347[11]; }; env18347[35] = function clearRowsState(a0) { env18347[6].current = false; env18347[18].current = false; env18347[20].current = false; env18347[19].current = false; env18347[21].current = false; env18347[22].current = false; env18347[23].current = false; env18347[7].current = false; env18347[8].current = []; env18347[10].current = false; env18347[9].current = null; const r35 = env18347[12]; const length2 = r35.queue.length; const size = r35.blockers.size; const r4 = env18347[1]; const length = r4.getPreviousRows().length; r4.clear(); r35.clear(); const r8 = env18347[11]; NativeChatUtils.clearRows(r8.current); SentryUtils_native.addBreadcrumb({ category: "chat.queue.clear", message: `clearRows (${a0}): queue=${length2} blockers=${size} jsRows=${length}`, data: { reason: a0, changesetUpdateId: getChangesetIdForChat(r8.current), queueLength: length2, blockers: size, chatManagerRows: length } }); }; env18347[36] = function clearRows() { (0, env18347[35])("channel-change"); const r8 = env18347[0]; updateShouldShowJumpToPresentButton(r8.channelId, r8.screenIndex, false); }; const [chatManager] = useState(() => new ChatManager()); env18347[1] = chatManager; const [rowGenerator] = useState(() => new RowGenerator()); const r49 = _slicedToArray(useState(false), 2); env18347[2] = r49[0]; env18347[3] = r49[1]; const r54 = _slicedToArray(useState(false), 2); const shouldForceRender = r54[0]; env18347[4] = shouldForceRender; env18347[5] = r54[1]; const ref4 = useRef(false); env18347[6] = ref4; const ref3 = useRef(false); env18347[7] = ref3; const ref2 = useRef([]); env18347[8] = ref2; const ref6 = useRef(null); env18347[9] = ref6; const ref5 = useRef(false); env18347[10] = ref5; const ref = useRef(null); env18347[11] = ref; const callback = useCallback(({ rows: rows2, hasMoreMessagesAfter, scrollData, HACK_iOSForceAnimations, forceReload, isAnimated, rows }) => { const r14 = env18347[7]; NativeChatUtils.updateRows(env18347[11].current, { rows: rows2, isLoadingAtTop: isLoadingAtTop(rows, r14.current), scrollData, HACK_iOSForceAnimations, forceReload, isAnimated }); r14.current = hasMoreMessagesAfter; }, []); const chatUpdatesQueue = useChatUpdatesQueue(ref, callback); env18347[12] = chatUpdatesQueue; const callback3 = useCallback(() => { const r1 = env18347[0]; return r1.canChat && PermissionStore.can(Permissions.ADD_REACTIONS, r1.channel) || r1.channel.isPrivate(); }, [a0.canChat, a0.channel]); const callback4 = useCallback((c26843_0) => Module12.find(env18347[0].messages.toArray(), ({ id, nonce }) => id === c26843_0 || nonce === c26843_0), [a0.messages]); env18347[13] = callback4; const callback2 = useCallback((a0) => { const r2 = env18347[0]; return r2.channel.isForumPost() && SnowflakeUtils.castChannelIdAsMessageId(r2.channelId) === r2.messages.jumpTargetId && !a0; }, [a0.channel, a0.channelId, a0.messages.jumpTargetId]); env18347[14] = callback2; const channelLoading = useChannelLoading({ channelId: a0.channelId, jumpTargetId: a0.messages.jumpTargetId, oldestUnreadMessageId: a0.oldestUnreadMessageId, shouldJumpToOriginalPost: callback2 }); const channelLatestMessageLoadingStatsManager = channelLoading.channelLatestMessageLoadingStatsManager; env18347[15] = channelLoading.startOrCancelLatestMessagesLoad; const scrollHandlers = useScrollHandlers({ chatRef: ref, chatManager, chatUpdatesQueue, pendingUpdatesQueueRef: ref2, animatedRef: ref4, fetchMoreBefore: function fetchMoreBefore() { const r8 = env18347[0]; const { channelId, messages: messages2 } = r8; if (messages2.hasMoreBefore && !messages2.loadingMore) { MessageActionCreators.fetchMessages({ channelId, before: messages2.first()?.id, limit: MAX_MESSAGES_PER_CHANNEL }); } }, fetchMoreAfter: function fetchMoreAfter() { const r8 = env18347[0]; const { channelId, messages: messages2 } = r8; if (messages2.hasMoreAfter && !messages2.loadingMore) { MessageActionCreators.fetchMessages({ channelId, after: messages2.last()?.id, limit: MAX_MESSAGES_PER_CHANNEL }); } }, handleVisibleMessagesChange, applyNativeRowsUpdate: callback, messages: a0.messages, channel: a0.channel, channelId: a0.channelId, screenIndex: a0.screenIndex, onScroll: a0.onScroll, useReducedMotion: a0.useReducedMotion, isStaff: a0.isStaff, visibleMessagesWindowHandler: a0.visibleMessagesWindowHandler }); env18347[18] = scrollHandlers.hasHandledScrollRef; env18347[19] = scrollHandlers.isAtBottomRef; env18347[20] = scrollHandlers.isNearBottomRef; env18347[21] = scrollHandlers.isNearTopRef; env18347[22] = scrollHandlers.deceleratingRef; env18347[23] = scrollHandlers.draggingRef; env18347[24] = scrollHandlers.firstIgnoredScrollEventTimestampRef; const { loadMoreBefore, loadMoreAfter } = scrollHandlers; env18347[25] = scrollHandlers.scrollToTop; const { scrollToTopMessage, updateNativeRows } = scrollHandlers; env18347[26] = scrollHandlers.handleScrollCallbacks; const handleScrollPosition = scrollHandlers.handleScrollPosition; const ref7 = useRef(null); env18347[27] = ref7; ref7.current = { getMessage: callback4, chatInputRef: a0.chatInputRef, selectedChannelId: a0.channelId, revealedMessageId: a0.messages.revealedMessageId, uploads: a0.uploads, paymentsBlocked: a0.paymentsBlocked, loadMoreBefore, loadMoreAfter }; const [r133] = useState(() => new MessagesHandlers(() => env18347[27].current)); useImperativeHandle(a1, () => ({ scrollToBottom: env18347[29], jumpToPresent: env18347[30], scrollToNewMessages: env18347[31], getChatRef: env18347[32] })); const rowManager = useRowManager({ chatManager, rowGenerator, animatingStickerMessageIdRef: ref6, canAddNewReactions: callback3, channel: a0.channel, messages: a0.messages, isMessagesReady: a0.isMessagesReady, uploads: a0.uploads, roleStyle: a0.roleStyle, oldestUnreadMessageId: a0.oldestUnreadMessageId, replyingMessageId: a0.replyingMessageId, inlineAttachmentMedia: a0.inlineAttachmentMedia, inlineEmbedMedia: a0.inlineEmbedMedia, renderEmbeds: a0.renderEmbeds, renderReactions: a0.renderReactions, animateEmoji: a0.animateEmoji, gifAutoPlay: a0.gifAutoPlay, timestampHourCycle: a0.timestampHourCycle, currentUserId: a0.currentUserId, renderCommunicationDisabled: a0.renderCommunicationDisabled, selectedSummary: a0.selectedSummary, enableSwipeActions: a0.enableSwipeActions, isResourceChannel: a0.isResourceChannel, shouldObscureSpoiler: a0.shouldObscureSpoiler, shouldDisableInteractiveComponents: a0.shouldDisableInteractiveComponents, unloadableContentEntryMessageIds: a0.unloadableContentEntryMessageIds, containerWidth: a0.containerWidth, chatRef: ref, loadedRef: ref5, animatedRef: ref4, hasMoreMessagesAfterForLastUpdateRef: ref3, updateNativeRows, isLoadingAtTop, channelLatestMessageLoadingStatsManager, channelId: a0.channelId, isMessagesCached: a0.isMessagesCached, chatUpdatesQueue, shouldJumpToOriginalPost: callback2, findMessageIndex, scrollToTopMessage, useReducedMotion: a0.useReducedMotion }); env18347[33] = rowManager.updateRows; env18347[34] = rowManager.scrollToMessageId; useEffect(() => { const r4 = env18347[0]; const { messages, isMessagesReady, oldestUnreadMessageId } = r4; const r12 = env18347[33]; if (isMessagesReady) { const hasJumpedToOriginalPost = env18347[2]; r12({ scrollToMessageId: messages.jumpTargetId, jumpTargetId: messages.jumpTargetId, jumpType: JumpType.INSTANT, focusTargetId: messages.focusTargetId, hasJumpedToOriginalPost }); if (messages.jumpTargetId != null) { (0, env18347[34])({ scrollToMessageId: messages.jumpTargetId, jumpTargetId: messages.jumpTargetId, jumpType: JumpType.INSTANT, hasJumpedToOriginalPost }); } else if (oldestUnreadMessageId != null) { setTimeout(() => (0, env18347[34])({ scrollToMessageId: oldestUnreadMessageId, jumpTargetId: messages.jumpTargetId, jumpType: JumpType.INSTANT, hasJumpedToOriginalPost: env18347[2] }), 50); } } else { r12({ hasJumpedToOriginalPost: env18347[2] }); } const { channelId, messages: messages2 } = r4; TTITracker.recordMessageRender(channelId, messages2.map($mk85738()), messages2.hasFetched || messages2.ready && !messages2.cached, messages2.hasMoreAfter); const { channelId: channelId2, messages: messages3 } = r4; TTITracker.recordMessageRender(channelId2, messages3.map($mk85738()), messages3.hasFetched || messages3.ready && !messages3.cached, messages3.hasMoreAfter); return () => { (0, env18347[35])("unmount"); }; }, []); useEffect(() => () => { const r6 = env18347[0]; updateShouldShowJumpToPresentButton(r6.channelId, r6.screenIndex, false); }, [a0.channelId, a0.screenIndex]); env18347[37] = useRef({ props: a0, shouldForceRender }); useLayoutEffect(() => { let props, c26845_1, c26845_2, c26845_3, c26845_4, c26845_5, c26845_6, c26845_7, c26845_8, c26845_9, c26845_10, c26845_11, c26845_12, c26845_13, c26845_14, c26845_15, c26845_16, c26845_17, c26845_18, c26845_19, c26845_20, c26845_21, c26845_22, c26845_23, c26845_24, c26845_25, c26845_26, c26845_27, c26845_28, c26845_29, c26845_30, c26845_31, c26845_32, cacheStoreLoaded, voiceChannelIdChangedAuthorIds; L202: { const r29 = env18347[37]; const current = r29.current; props = current.props; const shouldForceRender = current.shouldForceRender; const props2 = env18347[0]; const shouldForceRender2 = env18347[4]; r29.current = { props: props2, shouldForceRender: shouldForceRender2 }; if (props2.currentUserId != null) { const messages3 = props2.messages; const messages2 = props.messages; const r9 = props.channelId !== props2.channelId; if (r9) { (0, env18347[3])(false); } const hasJumpedToOriginalPost = r9 ? !r9 : env18347[2]; const channelId = props.channelId; const channelId2 = props2.channelId; const r71 = { clearRows: env18347[36], startOrCancelChannelLatestMessagesLoad: env18347[15], hasJumpedToOriginalPost, firstIgnoredScrollEventTimestampRef: env18347[24] }; if (channelId !== channelId2) { r71.clearRows(); DimensionActionCreators.clearChannelDimensions(channelId2); r71.startOrCancelChannelLatestMessagesLoad(r71.hasJumpedToOriginalPost); r71.firstIgnoredScrollEventTimestampRef.current = void 0; } const isMessagesAckable = props.isMessagesAckable; const isMessagesAckable2 = props2.isMessagesAckable; const r90 = env18347[18]; if (isMessagesAckable ? !isMessagesAckable : isMessagesAckable2) { r90.current = false; } const r93 = env18347[14]; const r94 = env18347[25]; const r95 = env18347[3]; if (r93(hasJumpedToOriginalPost)) { r94(false); if (messages2.jumpSequenceId === messages3.jumpSequenceId) { r95(true); } } const messagesNewlyLoaded = props2.isMessagesReady && !props2.isMessagesCached && props.isMessagesCached; const messageJumpData = getMessageJumpData(props2, { isAtBottom: env18347[19].current, hasPreviousMessages: env18347[1].getPreviousMessages() != null }, props); const { scrollToMessageId, jumpTargetId, jumpType, minimizeScrolling, focusTargetId, shouldInitialScroll } = messageJumpData; let forceReload = props.theme !== props2.theme || props.saturation !== props2.saturation || props.isVisualRefreshEnabled !== props2.isVisualRefreshEnabled; const forceRender = props.theme !== props2.theme || props.saturation !== props2.saturation || props.isVisualRefreshEnabled !== props2.isVisualRefreshEnabled || props.inlineAttachmentMedia !== props2.inlineAttachmentMedia || props.inlineEmbedMedia !== props2.inlineEmbedMedia || props.renderEmbeds !== props2.renderEmbeds || props.renderReactions !== props2.renderReactions || props.animateEmoji !== props2.animateEmoji || props.animateStickers !== props2.animateStickers || props.gifAutoPlay !== props2.gifAutoPlay || props.timestampHourCycle !== props2.timestampHourCycle || props.containerWidth !== props2.containerWidth || props.guildSystemChannelFlags !== props2.guildSystemChannelFlags || props.userSettingsLocale !== props2.userSettingsLocale || props.roleStyle !== props2.roleStyle || props.officialMessageStyle !== props2.officialMessageStyle || props.canSendMessages !== props2.canSendMessages || props.showPushFeedback !== props2.showPushFeedback || props.selectedSummary !== props2.selectedSummary || props.shouldObscureSpoiler !== props2.shouldObscureSpoiler || props.explicitMediaFalsePositiveInfo !== props2.explicitMediaFalsePositiveInfo || props.familyCenterPendingConnection !== props2.familyCenterPendingConnection || props.isStaff !== props2.isStaff || props.isAgeVerified !== props2.isAgeVerified || shouldForceRender !== shouldForceRender2 && shouldForceRender2 || props.displayNameStylesEnabled !== props2.displayNameStylesEnabled; const r5 = props.resolvingGiftCodes !== props2.resolvingGiftCodes || props.resolvedGiftCodes !== props2.resolvedGiftCodes || props.acceptingGiftCodes !== props2.acceptingGiftCodes; c26845_1 = r5; const uploads2 = props.uploads; const uploads = props2.uploads; const r50 = shallowEqual(props.interactionStates, props2.interactionStates); c26845_2 = !r50; const r17 = props.channelPolls !== props2.channelPolls; c26845_3 = r17; const r18 = props.messageReferencePolls !== props2.messageReferencePolls; c26845_4 = r18; const r16 = props.interactionComponentStatesVersion !== props2.interactionComponentStatesVersion; c26845_5 = r16; c26845_6 = props.shouldDisableInteractiveComponents !== props2.shouldDisableInteractiveComponents; const r12 = props.communicationDisabledVersion !== props2.communicationDisabledVersion; c26845_7 = r12; const r13 = props.messageAuthorMembers !== props2.messageAuthorMembers; c26845_8 = r13; const r14 = props.failedMessagesVersion !== props2.failedMessagesVersion; c26845_9 = r14; const r15 = props.renderCommunicationDisabled !== props2.renderCommunicationDisabled; c26845_10 = r15; const forwardGuildsVersion2 = props.forwardGuildsVersion; const forwardGuildsVersion = props2.forwardGuildsVersion; const r49 = props2.channel.isForumPost() && props.isFollowingForumPost !== props2.isFollowingForumPost; c26845_11 = r49; const r19 = props.showMediaPostSharePrompt !== props2.showMediaPostSharePrompt; c26845_12 = r19; const r20 = props.unloadedContentEntryMessageIds !== props2.unloadedContentEntryMessageIds; c26845_13 = r20; const r216 = props.invalidApplicationIds !== props2.invalidApplicationIds; c26845_14 = r216; const r1 = props.activityInstanceIds !== props2.activityInstanceIds || props.activityParticipants !== props2.activityParticipants || props.applicationAssetFetchingIds !== props2.applicationAssetFetchingIds || props.activityInstancePresenceDetails !== props2.activityInstancePresenceDetails || props.messagesWithActivitiesLaunching !== props2.messagesWithActivitiesLaunching || r216; c26845_15 = r1; const r48 = areArraysShallowEqual(props.activityInviteMessageIds, props2.activityInviteMessageIds); c26845_16 = !r48; const r240 = areArraysShallowEqual(props.resolvedReferralTrialOfferIds, props2.resolvedReferralTrialOfferIds); const r6 = (r240 ? props.referralTrialOfferId !== props2.referralTrialOfferId : !r240) || props.isPremiumTier2User !== props2.isPremiumTier2User; c26845_17 = r6; const r21 = props.guildInviteColorsFetched !== props2.guildInviteColorsFetched; c26845_18 = r21; const guildEmojis = props.guildEmojis; const guildEmojis2 = props2.guildEmojis; const r22 = props.selfActivities !== props2.selfActivities; c26845_19 = r22; const r11 = props.currentClientVoiceChannelId !== props2.currentClientVoiceChannelId; c26845_20 = r11; const r254 = props.voiceStateChannelIdSummaryForGuild !== props2.voiceStateChannelIdSummaryForGuild; c26845_21 = r254; const voiceStatePrivateChannelId2 = props.voiceStatePrivateChannelId; const voiceStatePrivateChannelId = props2.voiceStatePrivateChannelId; const r23 = props.activityLaunchJoinStates !== props2.activityLaunchJoinStates; c26845_22 = r23; const r24 = props.authorizedAppsTokens !== props2.authorizedAppsTokens; c26845_23 = r24; const displayNameStylesEnabled = props.displayNameStylesEnabled; const displayNameStylesEnabled2 = props2.displayNameStylesEnabled; const fontId = props.currentUserDisplayNameStyles?.fontId; const fontId2 = props2.currentUserDisplayNameStyles?.fontId; const r264 = voiceStatePrivateChannelId2 !== voiceStatePrivateChannelId; const r25 = fontId !== fontId2; c26845_24 = r25; const r271 = areArraysShallowEqual(props.fetchingSkuIds, props2.fetchingSkuIds); c26845_25 = !r271; const r274 = props.voiceInviteDataByChannelId !== props2.voiceInviteDataByChannelId; c26845_26 = r274; if (!forceRender && !r5 && uploads2 === uploads && !r1 && props.messages === props2.messages && props.editingMessageId === props2.editingMessageId && props.replyingMessageId === props2.replyingMessageId && !r264 && props.messageAuthorActivities === props2.messageAuthorActivities && props.oldestUnreadMessageId === props2.oldestUnreadMessageId && props.invites === props2.invites && props.appDirectoryEmbedApplications === props2.appDirectoryEmbedApplications && props.invalidAppDirectoryEmbedApplicationIds === props2.invalidAppDirectoryEmbedApplicationIds && props.appDirectoryEmbedApplicationFetchStates === props2.appDirectoryEmbedApplicationFetchStates && props.guildTemplates === props2.guildTemplates && props.buildOverrides === props2.buildOverrides && props.experimentEmbeds === props2.experimentEmbeds && props.quests === props2.quests && props.isFetchingCurrentQuests === props2.isFetchingCurrentQuests && props.participantsLength === props2.participantsLength && props.isMessagesReady === props2.isMessagesReady && props.channelThreadsVersion === props2.channelThreadsVersion && props.rsvpVersion === props2.rsvpVersion && props.repliedIds === props2.repliedIds && props.hasLoadedExperiments === props2.hasLoadedExperiments && props.isMessageRequest === props2.isMessageRequest && props.isSpamMessageRequest === props2.isSpamMessageRequest && props.currentUserCommunicationDisabled === props2.currentUserCommunicationDisabled && props.userSettingsLocale === props2.userSettingsLocale && props.selectedSummary === props2.selectedSummary && props.showPushFeedback === props2.showPushFeedback && props.cacheStoreLoaded === props2.cacheStoreLoaded && !r11 && !r12 && !r13 && !r14 && forwardGuildsVersion2 === forwardGuildsVersion && !r15 && r50 && !r16 && !r49 && jumpTargetId == null && focusTargetId == null && props.androidKeyboardHeight === props2.androidKeyboardHeight && props.mediaPostPreviewEmbeds === props2.mediaPostPreviewEmbeds && props.shouldObscureSpoiler === props2.shouldObscureSpoiler && props.shouldDisableInteractiveComponents === props2.shouldDisableInteractiveComponents && !r17 && !r18 && !r19 && props.threadStartingReferenceMessage === props2.threadStartingReferenceMessage && !r20 && r48 && !r6 && !r21 && guildEmojis === guildEmojis2 && !r22 && !r23 && !r24 && displayNameStylesEnabled === displayNameStylesEnabled2 && !r25 && !r254 && !r274 && r271) { const { channelId: channelId3, messages: messages4 } = props2; TTITracker.recordMessageRender(channelId3, messages4.map($mk85738()), messages4.hasFetched || messages4.ready && !messages4.cached, messages4.hasMoreAfter); break L202; } const set = new Set(); c26845_27 = set; if (props.editingMessageId !== props2.editingMessageId) { if (props2.editingMessageId != null) { set.add(props2.editingMessageId); } if (props.editingMessageId != null) { set.add(props.editingMessageId); } } if (props.replyingMessageId !== props2.replyingMessageId) { if (props2.replyingMessageId != null) { set.add(props2.replyingMessageId); } if (props.replyingMessageId != null) { set.add(props.replyingMessageId); } } if (!(props.isMessagesReady === props2.isMessagesReady && (props.isCallActive === props2.isCallActive && (!r264 && props.participantsLength === props2.participantsLength)))) { const r396 = Module12.find(props2.messages.toArray().reverse(), (a0) => a0.type === MessageTypes.CALL); if (r396 != null) { set.add(r396.id); } } c26845_28 = props.channelThreadsVersion !== props2.channelThreadsVersion; c26845_29 = props.rsvpVersion !== props2.rsvpVersion; c26845_30 = props.repliedIds !== props2.repliedIds; c26845_31 = props.hasLoadedExperiments !== props2.hasLoadedExperiments; let communicationDisabledVersion = props.communicationDisabledVersion; if (communicationDisabledVersion == null) { communicationDisabledVersion = -1; } c26845_32 = communicationDisabledVersion; const cacheStoreLoaded2 = props.cacheStoreLoaded; cacheStoreLoaded = cacheStoreLoaded2 ? !cacheStoreLoaded2 : props2.cacheStoreLoaded; let r415 = null; if (r254) { let voiceStateChannelIdSummaryForGuild = props.voiceStateChannelIdSummaryForGuild; if (voiceStateChannelIdSummaryForGuild == null) { voiceStateChannelIdSummaryForGuild = null; } let voiceStateChannelIdSummaryForGuild2 = props2.voiceStateChannelIdSummaryForGuild; if (voiceStateChannelIdSummaryForGuild2 == null) { voiceStateChannelIdSummaryForGuild2 = null; } r415 = getVoiceChannelIdChangedAuthorIds(voiceStateChannelIdSummaryForGuild, voiceStateChannelIdSummaryForGuild2); } voiceChannelIdChangedAuthorIds = r415; props2.messages.forEach((message) => { L149: { if (c26845_21 && (voiceChannelIdChangedAuthorIds != null && (message.author != null && voiceChannelIdChangedAuthorIds.has(message.author.id)))) { c26845_27.add(message.id); } else { if (c26845_20) { if (message.activity?.type === ActivityActionTypes.STREAM_REQUEST) { c26845_27.add(message.id); break L149; } } if (c26845_31 && message.type === MessageTypes.USER_JOIN) { c26845_27.add(message.id); } else { if (c26845_30 && message.type === MessageTypes.REPLY) { const messageReference = message.messageReference; if (messageReference != null && env18347[0].repliedIds.has(messageReference.message_id)) { c26845_27.add(message.id); return void 0; } } if (c26845_28 && message.hasFlag(MessageFlags.HAS_THREAD)) { c26845_27.add(message.id); } else if (c26845_29 && message.codedLinks.length > 0) { c26845_27.add(message.id); } else { if (c26845_26 && message.codedLinks.length > 0) { for (const codedLink of message.codedLinks) { const { type, code } = codedLink; if (type !== CodedLinkType.INVITE) { continue; } const r94 = env18347[0].invites.get(code); if (r94 == null) { continue; } if (r94.channel == null) { continue; } if (!isVoiceChannelInvite(r94)) { continue; } const id = r94.channel.id; if (props.voiceInviteDataByChannelId[id] === env18347[0].voiceInviteDataByChannelId[id]) { continue; } c26845_27.add(message.id); return void 0; } } L142: { if (!c26845_10) { if (c26845_7 && env18347[0].guildId != null && (0, getUserCommunicationDisabledVersion)(env18347[0].guildId, message.author.id) > c26845_32) { break L142; } if (c26845_8 && env18347[0].guildId != null) { if (message.author?.id != null) { if (env18347[0].messageAuthorMembers[message.author.id] === props.messageAuthorMembers[message.author.id]) { break L149; } c26845_27.add(message.id); break L149; } } if (c26845_9 && message.author.id === env18347[0].currentUserId) { c26845_27.add(message.id); break L149; } if (c26845_2 && props.interactionStates[message.id] !== env18347[0].interactionStates[message.id]) { c26845_27.add(message.id); break L149; } if (c26845_5 && props.interactionComponentStates.get(message.id) !== env18347[0].interactionComponentStates.get(message.id)) { c26845_27.add(message.id); break L149; } if (c26845_6 && message.components.length !== 0) { c26845_27.add(message.id); break L149; } if (c26845_3 && props.channelPolls[message.id] !== env18347[0].channelPolls[message.id]) { c26845_27.add(message.id); break L149; } if (c26845_4) { const message_id = message.messageReference?.message_id; if (message_id != null && props.messageReferencePolls[message_id] !== env18347[0].messageReferencePolls[message_id]) { c26845_27.add(message.id); return void 0; } } if (c26845_13 && props.unloadedContentEntryMessageIds.has(message.id) !== env18347[0].unloadedContentEntryMessageIds.has(message.id)) { c26845_27.add(message.id); break L149; } L61: { if (env18347[0].channel.isForumPost()) { if (!c26845_11 && !c26845_12) { break L61; } if (message.id === SnowflakeUtils.castChannelIdAsMessageId(env18347[0].channelId)) { c26845_27.add(message.id); break L149; } } } if (c26845_15 && message.activityInstance != null) { c26845_27.add(message.id); break L149; } if (c26845_16 && message.activity?.party_id != null) { c26845_27.add(message.id); } if (c26845_23 && message.application != null) { c26845_27.add(message.id); break L149; } if (c26845_24) { if (message.author?.id === env18347[0].currentUserId) { c26845_27.add(message.id); break L149; } } if (!(!c26845_25 && !c26845_14) && message.codedLinks.length > 0) { for (const codedLink2 of message.codedLinks) { const { type: type2, code: code2 } = codedLink2; if (type2 !== CodedLinkType.SOCIAL_LAYER_STOREFRONT && type2 !== CodedLinkType.SOCIAL_LAYER_STOREFRONT_APP) { continue; } const [r290] = code2.split("-"); if (!props.fetchingSkuIds.includes(r290)) { const r300 = SKUStore.get(r290); if (r300 == null) { continue; } if (!props.invalidApplicationIds.includes(r300.applicationId)) { continue; } c26845_27.add(message.id); return void 0; } c26845_27.add(message.id); return void 0; } } if (message.author == null) { break L149; } L128: { if (!MessagesUtils2.messageAuthorActivitiesChanged(message, props, env18347[0]) && !MessagesUtils2.codedLinksChanged(message, props, env18347[0])) { if (c26845_1 && MessagesUtils2.giftCodesChanged(message, props, env18347[0])) { break L128; } if (!MessagesUtils2.mediaPostPreviewEmbedsChanged(message, props, env18347[0])) { let r358 = cacheStoreLoaded; if (cacheStoreLoaded) { r358 = message.embeds.length > 0; } if (r358) { c26845_27.add(message.id); } if (message.type === MessageTypes.THREAD_STARTER_MESSAGE && props.threadStartingReferenceMessage !== env18347[0].threadStartingReferenceMessage) { c26845_27.add(message.id); } if (c26845_14 && message.applicationId != null && props.invalidApplicationIds.includes(message.applicationId)) { c26845_27.add(message.id); } if (c26845_17) { const referralTrialOfferId = message.referralTrialOfferId; if (referralTrialOfferId != null && env18347[0].resolvedReferralTrialOfferIds.includes(referralTrialOfferId)) { c26845_27.add(message.id); } } if (c26845_18 && message.codedLinks.length > 0) { c26845_27.add(message.id); } if (!((c26845_19 || c26845_22) && message.activity?.party_id != null)) { break L149; } c26845_27.add(message.id); break L149; } } } c26845_27.add(message.id); break L149; } } c26845_27.add(message.id); } } } } }); const isAnimated = props.channelId !== props2.channelId || messages2.suppressRowAnimationSequenceId === messages3.suppressRowAnimationSequenceId; const r431 = env18347[33]; if (!forceReload) { forceReload = r9; } r431({ forceRender, forceReload, updateMessageIds: set, scrollToMessageId, jumpTargetId, jumpType, focusTargetId, ignoreEmbedDescriptionCache: cacheStoreLoaded, messagesNewlyLoaded, shouldInitialScroll, minimizeScrolling, isAnimated, hasJumpedToOriginalPost }); (0, env18347[5])(false); const { channelId: channelId4, messages: messages5 } = props2; TTITracker.recordMessageRender(channelId4, messages5.map($mk85738()), messages5.hasFetched || messages5.ready && !messages5.cached, messages5.hasMoreAfter); } } }); return <> {a0.children} ; }); r51.displayName = "Messages"; const r55 = memo(r51, (a0, a1) => !!shallowEqual(a0, a1, ["interactionStates"], { shouldWarnLargeObjects: false }) && !!shallowEqual(a0.interactionStates, a1.interactionStates)); export default r55;