// Metro module 7720 (f7721). import { processColor } from "react-native"; import AccessibilityStore from "../../../a11y/AccessibilityStore"; import ApplicationStore from "../../../applications/ApplicationStore"; import ClientThemesBackgroundStore from "../../../client_themes/ClientThemesBackgroundStore"; import EmojiStore from "../../../emojis/EmojiStore"; import GuildAutomodMessageStore from "../../../guild_automod/GuildAutomodMessageStore"; import InteractionStore from "../../../interactions/InteractionStore"; import LurkingStore from "../../../lurker_mode/LurkingStore"; import MediaPostSharePromptStore from "../../../media_channel/MediaPostSharePromptStore"; import ReferencedMessageStore, { ReferencedMessageState } from "../../../replies/ReferencedMessageStore"; import JoinedThreadsStore from "../../../threads/JoinedThreadsStore"; import ThreadMessageStore from "../../../threads/ThreadMessageStore"; import ThemeStore from "../../../user_settings/ThemeStore"; import AuthenticationStore from "../../../../stores/AuthenticationStore"; import ChannelStore from "../../../../stores/ChannelStore"; import GuildMemberStore from "../../../../stores/GuildMemberStore"; import GuildStore from "../../../../stores/GuildStore"; import RelationshipStore from "../../../../stores/RelationshipStore"; import UploadStore from "../../../../stores/UploadStore"; import UserStore from "../../../../stores/UserStore"; import { DEFAULT_GUILD_OFFICIAL_COLOR, GUILD_OFFICIAL_HIGHLIGHT_ALPHA, GUILD_OFFICIAL_HIGHLIGHT_ALPHA_COLOR } from "../../MessageConstants"; import { ReferencedMessageRowState } from "./RowGeneratorConstants"; import { ChannelTypes, MessageFlags, MessageStates, MessageTypes } from "../../../../Constants"; import { GuildTagBadgeSize } from "../../../guild_tag/GuildTagConstants"; import { computeChannelName } from "../../../channel/useChannelName"; import getEmbedThemeColors from "./row_data/embeds/getEmbedThemeColors"; import SnowflakeUtils from "../../../../utils/SnowflakeUtils"; import { formatMobileMessageCountLabel, formatMessageCountLabel } from "../../../threads/MessageCountUtils"; import { isChannelSpoilerGated } from "../../../spoiler_channels/SpoilerChannelUtils"; import { intl, t } from "../../../../intl/index.native"; import { getAssetUriForEmbed } from "./EmbedUtils"; import Module7730 from "../../../../_bundle/Module7730"; import { createDefaultReaction, createForumPostActions } from "./row_data/ForumPostActions"; import { getMessageStickers } from "../../../stickers/StickersUtils"; import * as _Module1384 from "../../../../_bundle/Module1384"; import { getPollResultsReplyPreviewMobile, getPollReplyPreview } from "../../../polls/PollsUtils"; import resolveMessageContentColors from "./resolveMessageContentColors"; import { getHasEnhancedRoleColors } from "../../../premium/powerups/hooks/useHasEnhancedRoleColors"; import { maybeCreateSingleForwardForMessage } from "../../../forwarding/formatMessageForwards"; import transformReactions from "./transformReactions"; import isSystemMessage from "../../isSystemMessage"; import { createSystemMessageContent } from "./system_messages/SystemMessage"; import * as _MarkupEligibilityUtils from "../../../markup/MarkupEligibilityUtils"; import { parseMessageMarkup } from "./MarkupParsers"; import redactRestrictedContent from "./redactRestrictedContent"; import { getEnabledHarmTypesForMessage } from "../../../explicit_media_redaction/ObscuredMediaUtils"; import * as _ExplicitMediaRedactionUtils from "../../../explicit_media_redaction/ExplicitMediaRedactionUtils"; import { ViewImageDescriptions, AnimateStickers } from "../../../user_settings/UserSettings"; import transformEmbeds from "./transformEmbeds"; import transformMessageComponents from "./transformMessageComponents"; import getTagProperties from "./getTagProperties"; import createMessageFailedEmbed, { createAutomodBlockedMessageEmbed } from "./createMessageFailedEmbed"; import { getUserAuthor, getMessageAuthor } from "../../useMessageAuthor"; import { ensureAvatarSource } from "../../../../utils/native/AvatarUtils"; import AvatarUtils2, { getAvatarDecorationURL } from "../../../../utils/AvatarUtils"; import { getDecorationSizeForAvatarSize } from "../../../collectibles/avatar_decorations/native/AvatarDecorationUtils"; import { AvatarSizes } from "../../../../design/void/native"; import { getRoleIcon } from "../../../guild_boosting/native/RoleIconUtils"; import didReplyMention from "../../../replies/didReplyMention"; import { assertNever } from "../../../../utils/GlobalUtils"; import { createInteractionStatus } from "./row_data/interaction/InteractionStatus"; import * as _CommunicationDisabledUtils from "../../../guild_communication_disabled/CommunicationDisabledUtils"; import { getVisibleConnectionsRole } from "../../../connections/ConnectionsUtils"; import transformUploaderAttachments from "./transformUploaderAttachments"; import transformMessageAttachments from "./transformMessageAttachments"; import { calendarFormat, accessibilityLabelCalendarFormat, dateFormat } from "../../../../utils/DateUtils"; import formatPollMessageChatData from "../../../polls/chat/formatPollMessageChatData"; import { formatSharedClientThemeData } from "../../../client_themes/native/chat/formatSharedClientThemeData"; import * as _GuildTagUtils from "../../../guild_tag/GuildTagUtils"; import { getUserPrimaryGuild, getGuildTagBadgeUrl } from "../../../guild_tag/GuildTagUtils"; import * as _GuildOfficialMessageUtils from "../../GuildOfficialMessageUtils"; import { showGuildOfficialMessageGradient, showGuildOfficialMessageTextColor, getAccessibleGuildOfficialTextColor } from "../../GuildOfficialMessageUtils"; import Module712 from "../../../../_bundle/Module712"; import { createVoiceChannelBadge } from "./row_data/VoiceChannelBadge"; import { processColorStrings } from "../../../premium/enhanced_role_colors/native/EnhancedRoleColorUtils"; import { createConnectionsRoleTag } from "./row_data/ConnectionsRoleTag"; import { createSurveyIndication } from "./row_data/SurveyIndication"; import { createEphemeralIndication } from "./row_data/EphemeralIndication"; import { createExecutedCommand } from "./row_data/interaction/ExecutedCommand"; import { createGiftCodeEmbed } from "./row_data/embeds/GiftCodeEmbed"; import { createCodedLinkEmbeds } from "./row_data/embeds/coded_links/CodedLinks"; import { createActivityInstanceEmbed } from "./row_data/embeds/EmbeddedActivityInstanceEmbed"; import { createActivityRichPresenceInviteEmbed } from "./row_data/embeds/ActivityRichPresenceInviteEmbed"; import transformStickers from "./transformStickers"; import Module7747 from "../../../../_bundle/Module7747"; import Module7748 from "../../../../_bundle/Module7748"; import { createPostPreviewEmbeds } from "./row_data/embeds/PostPreviewEmbeds"; import { createSafetyPolicyNoticeEmbed } from "./row_data/embeds/SafetyPolicyNoticeEmbed"; import { createSafetySystemNotificationEmbed } from "./row_data/embeds/SafetySystemNotificationEmbed"; import { createCtaButton } from "./row_data/CtaButton"; import { createMessageAccessibilityActions } from "../MessageAccessibilityActions"; import { createDisplayNameStylesMobile } from "../../../display_name_styles/native/createDisplayNameStylesMobile"; let createMessageContent; const createThreadEmbed = function createThreadEmbed(a0, a1, a2, channel2, a4, theme) { let r62, r83; if (!a2 && a0.hasFlag(MessageFlags.HAS_THREAD) && channel2 != null) { const title = computeChannelName(channel2, UserStore, RelationshipStore); const backgroundColor = getEmbedThemeColors(theme).baseColors.backgroundColor; const mostRecentMessage = ThreadMessageStore.getMostRecentMessage(SnowflakeUtils.castMessageIdAsChannelId(a0.id)); const count = ThreadMessageStore.getCount(SnowflakeUtils.castMessageIdAsChannelId(a0.id)); const messageCountLabel = formatMobileMessageCountLabel(count, channel2.id); const messageCountAccessibilityLabel = formatMessageCountLabel(count, channel2.id); if (count != null && count > 0) { L26: { if (isChannelSpoilerGated(channel2)) { r83 = { title, messageCountLabel, messageCountAccessibilityLabel, messagePreviewString: intl.string(t["5uaI/7"]), archived: false, backgroundColor }; } else if (channel2.threadMetadata?.archived) { r83 = { title, messageCountLabel, messageCountAccessibilityLabel, messagePreviewString: intl.string(t.ZTo4HS), archived: true, archivedIconUrl: getAssetUriForEmbed(Module7730), backgroundColor }; } else { if (mostRecentMessage != null && mostRecentMessage.type !== MessageTypes.CHANNEL_NAME_CHANGE && mostRecentMessage.type !== MessageTypes.THREAD_STARTER_MESSAGE) { if (!mostRecentMessage.blocked && !mostRecentMessage.ignored) { r83 = { title, messageCountLabel, messageCountAccessibilityLabel, referencedMessage: { state: ReferencedMessageRowState.LOADED, message: createMessageContent({ message: mostRecentMessage, roleStyle: a1, options: a4, isFirst: true, isEditing: false, canShowImages: true, isSystemDM: false, isInlineReplyPreview: true }) }, backgroundColor }; break L26; } r83 = { title, messageCountLabel, messageCountAccessibilityLabel, messagePreviewString: mostRecentMessage.blocked ? intl.string(t.XAkOo2) : intl.string(t["G7p6v/"]), archived: false, backgroundColor }; break L26; } r83 = { title, messageCountLabel, messageCountAccessibilityLabel, messagePreviewString: intl.string(t.ZTo4HS), archived: false, backgroundColor }; } } r62 = r83; } else { r62 = { title, messageCountLabel, messageCountAccessibilityLabel, messagePreviewString: intl.string(t.HYtNyE), archived: false, backgroundColor }; } return r62; } }; createMessageContent = function createMessageContent(a0) { let r178, r920, colorString3, content4, defaultUsernameColor, usernameColor; const message = a0.message; let messageForward = a0.messageForward; const { roleStyle, isFirst, isEditing, canShowImages, isSystemDM, isInlineReplyPreview = false, options, pushFeedbackType, renderContentOnly, showContentInventoryEntryFallbackEmbed } = a0; const { renderEmbeds, renderReactions, inlineEmbedMedia, inlineAttachmentMedia, constrainedWidth, ignoreMentioned, animateEmoji, animatingStickerMessageId, gifAutoPlay, timestampHourCycle, renderCodedLinks, renderGiftCode, renderActivityInstanceEmbed, renderActivityInviteEmbed, renderComponents, renderThreadEmbeds, renderReplies } = options; let renderCommunicationDisabled = options.renderCommunicationDisabled; let renderAttachments = options.renderAttachments; const { renderExecutedCommands, renderPolls, renderSharedClientTheme, renderForumPostActions } = options; let forcedTheme = options.forcedTheme; const ignoreEmbedDescriptionCache = options.ignoreEmbedDescriptionCache; let forceHideSimpleEmbedContent = options.forceHideSimpleEmbedContent; const { shouldObscureSpoiler, shouldDisableInteractiveComponents, useAlternateEmbedColors, restrictedPreview } = options; if (forcedTheme == null) { forcedTheme = ThemeStore.theme; } const colors = resolveMessageContentColors(forcedTheme, useAlternateEmbedColors); const shouldShowMedia = canShowImages === true; const theme = forcedTheme; let r40 = (shouldShowMedia ? renderEmbeds : shouldShowMedia) && message.type !== MessageTypes.CUSTOM_GIFT; const shouldInlineEmbedMedia = shouldShowMedia ? inlineEmbedMedia : shouldShowMedia; let shouldInlineAttachmentMedia = shouldShowMedia ? inlineAttachmentMedia : shouldShowMedia; const channel = ChannelStore.getChannel(message.getChannelId()); const channel2 = ChannelStore.getChannel(SnowflakeUtils.castMessageIdAsChannelId(message.id)); const guildId = channel == null ? void 0 : channel.getGuildId(); const hasEnhancedRoleColors = getHasEnhancedRoleColors(guildId, message.author.id); if (messageForward == null) { messageForward = maybeCreateSingleForwardForMessage(message); } const message4 = messageForward != null ? messageForward.messageSnapshot.message : message; const reactions = renderReactions ? transformReactions({ reactions: message.reactions, animateEmoji }) : []; const type = message.type; const THREAD_STARTER_MESSAGE = MessageTypes.THREAD_STARTER_MESSAGE; let message5 = null; if (type === THREAD_STARTER_MESSAGE) { const messageByReference = ReferencedMessageStore.getMessageByReference(message.messageReference); message5 = messageByReference.state === ReferencedMessageState.LOADED ? messageByReference.message : null; } if (message5 != null) { return { ...createMessageContent({ message: message5, roleStyle, isFirst, isEditing, canShowImages, isSystemDM, isInlineReplyPreview, options: { ...options, renderThreadEmbeds: false, renderReactions: false, shouldDisableInteractiveComponents: true } }), id: message.id }; } if (isSystemMessage(message)) { return message.type === MessageTypes.THREAD_CREATED ? { threadEmbed: createThreadEmbed(message, roleStyle, isInlineReplyPreview, channel2, options, theme), ...createSystemMessageContent({ message, theme, reactions, roleStyle }) } : createSystemMessageContent({ message, theme, reactions, roleStyle, isForumPost: channel == null ? void 0 : channel.isForumPost() }); } const r78 = isFirst ? renderContentOnly : !isFirst; const author = message.author; let editedTimestamp = message.editedTimestamp; if (editedTimestamp == null) { editedTimestamp = message.timestamp; } const isMessageNewerThanImprovedMarkdownEpoch = _MarkupEligibilityUtils.isMessageNewerThanImprovedMarkdownEpoch(editedTimestamp.valueOf()); if (message4.content != null && message4.content !== "") { if (!forceHideSimpleEmbedContent) { forceHideSimpleEmbedContent = r40 ? shouldInlineEmbedMedia : r40; } r178 = parseMessageMarkup(message, message4, forceHideSimpleEmbedContent, isInlineReplyPreview, channel2 != null && message.isFirstMessageInForumPost(channel2), isMessageNewerThanImprovedMarkdownEpoch, isMessageNewerThanImprovedMarkdownEpoch); } else { r178 = { content: void 0, hasSpoilerEmbeds: false, hasBailedAst: false }; } const { content, hasSpoilerEmbeds, hasBailedAst } = r178; let r188 = restrictedPreview && content != null ? redactRestrictedContent(content) : content; const enabledHarmTypesForMessage = getEnabledHarmTypesForMessage(message); const shouldAgeVerifyForExplicitMedia = _ExplicitMediaRedactionUtils.shouldAgeVerifyForExplicitMedia(); const setting = ViewImageDescriptions.getSetting(); if (r40) { r40 = !hasBailedAst; } if (r40) { r40 = !restrictedPreview; } const interaction = InteractionStore.getInteraction(message); const r203 = r40 ? transformEmbeds({ embeds: message4.embeds, channelId: message.channel_id, gifAutoPlay, hasSpoilerEmbeds, ignoreEmbedDescriptionCache, shouldInlineEmbedMedia, colors, showListsAndHeaders: isMessageNewerThanImprovedMarkdownEpoch, showMaskedLinks: isMessageNewerThanImprovedMarkdownEpoch, themedBackgroundColor: colors.embedBackgroundColor, enabledContentHarmTypeFlags: enabledHarmTypesForMessage, shouldAgeVerify: shouldAgeVerifyForExplicitMedia, authorIsBot: message.author.bot, showContentInventoryEntryFallbackEmbed, transformComponents: (a0) => transformMessageComponents({ message, guildId, interaction, shouldDisableInteractiveComponents, shouldShowMedia, shouldObscureSpoiler, enabledContentHarmTypeFlags: enabledHarmTypesForMessage, shouldAgeVerify: shouldAgeVerifyForExplicitMedia, shouldShowMosaicMediaDescriptions: setting, shouldAutoPlayGifs: gifAutoPlay, colors }, a0) }) : void 0; const tagProperties = getTagProperties({ message, isSystemDM, channel, colors }); const { tagText, tagAccessibilityLabel, tagVerified, tagTextColor, tagBackgroundColor, tagType, tagIconUrl, opTagText, opTagTextColor, opTagBackgroundColor } = tagProperties; const uploaderFileForMessageId = UploadStore.getUploaderFileForMessageId(message.id); const useAttachmentUploadPreview = uploaderFileForMessageId != null; const r225 = message.state !== MessageStates.SEND_FAILED || message.isCommandType(); let r227 = r203; if (!r225) { const r228 = r203 == null ? [] : r203; r228.push(createMessageFailedEmbed({ uploaderFile: uploaderFileForMessageId, useAttachmentUploadPreview, colors })); r227 = r228; } const message2 = GuildAutomodMessageStore.getMessage(message.id); let embeds = r227; if (message2 != null) { const r239 = r227 == null ? [] : r227; r239.push(createAutomodBlockedMessageEmbed({ errorMessage: message2.errorMessage, colors })); embeds = r239; } const userAuthor = getUserAuthor(message.author, channel); const guildMemberAvatar = userAuthor.guildMemberAvatar; let guildMemberAvatarDecoration = userAuthor.guildMemberAvatarDecoration; const iconRoleId = userAuthor.iconRoleId; const r88 = ensureAvatarSource(message.isInteractionPlaceholder() && message.author.avatar == null && guildMemberAvatar == null ? message.application?.icon != null ? AvatarUtils2.getApplicationIconSource({ id: message.application.id, icon: message.application.icon, bot: message.application.bot }) : guildMemberAvatar != null && guildId != null ? AvatarUtils2.getGuildMemberAvatarSource({ userId: author.id, avatar: guildMemberAvatar, guildId }, author) : author.getAvatarSource(void 0) : guildMemberAvatar != null && guildId != null ? AvatarUtils2.getGuildMemberAvatarSource({ userId: author.id, avatar: guildMemberAvatar, guildId }, author) : author.getAvatarSource(void 0)); if (guildMemberAvatarDecoration == null) { guildMemberAvatarDecoration = author.avatarDecoration; } const avatarDecorationURL = getAvatarDecorationURL({ avatarDecoration: guildMemberAvatarDecoration, size: getDecorationSizeForAvatarSize(AvatarSizes.NORMAL) }); const r80 = iconRoleId != null ? guildId != null ? getRoleIcon({ guildId, roleId: iconRoleId, size: 18 }) : void 0 : void 0; if (message.hasFlag(MessageFlags.SOURCE_MESSAGE_DELETED)) { r188 = intl.string(t.JOtgSw); } const messageAuthor = getMessageAuthor(message); let nick = messageAuthor.nick; let colorString = messageAuthor.colorString; const colorStrings = messageAuthor.colorStrings; if (message.type === MessageTypes.INTERACTION_PREMIUM_UPSELL) { r188 = intl.formatToPlainString(t["u4A+xK"], { appName: nick }); } const type2 = message.type; const REPLY = MessageTypes.REPLY; let r108 = void 0; if (type2 === REPLY) { r108 = void 0; if (renderReplies) { const messageByReference2 = ReferencedMessageStore.getMessageByReference(message.messageReference); const state = messageByReference2.state; if (ReferencedMessageState.LOADED === state) { const message3 = messageByReference2.message; const messageForward2 = maybeCreateSingleForwardForMessage(message3); if (RelationshipStore.isBlockedForMessage(message3)) { r108 = { state: ReferencedMessageRowState.SYSTEM, content: intl.string(t.XAkOo2) }; } else if (RelationshipStore.isIgnoredForMessage(message3)) { r108 = { state: ReferencedMessageRowState.SYSTEM, content: intl.string(t["G7p6v/"]) }; } else { const messageContent = createMessageContent({ message: message3, messageForward: messageForward2, roleStyle, isFirst: true, isEditing: false, canShowImages: true, isSystemDM: false, isInlineReplyPreview: true, options: { ...options, renderReplies: false } }); if (messageContent == null) { r108 = { state: ReferencedMessageRowState.SYSTEM, content: intl.string(t["1i+hMi"]) }; } else { if ("username" in messageContent) { const messageAuthor2 = getMessageAuthor(message3); let nick2 = messageAuthor2.nick; let colorString2 = messageAuthor2.colorString; if (nick2 == null) { nick2 = message3.author.username; } if (nick2 == null) { nick2 = void 0; } messageContent.username = nick2; if (r78) { colorString3 = messageContent.colorString; } else { if (colorString2 == null) { colorString2 = void 0; } colorString3 = processColor(colorString2); if (colorString3 == null) { colorString3 = messageContent.colorString; } } messageContent.colorString = colorString3; if (didReplyMention(message, message3)) { messageContent.username = "@" + messageContent.username; } } if (Array.isArray(messageContent.content) && messageContent.content.length === 0) { messageContent.content = void 0; } let r406 = messageForward2 == null ? void 0 : messageForward2.messageSnapshot.message; if (r406 == null) { r406 = message3; } const content2 = messageContent.content; const r411 = "stickers" in r406 ? getMessageStickers(r406) : []; L137: { if (r411.length > 0) { content4 = intl.string(t["7K5Lma"]); } else { if ("interaction" in r406 && r406.interaction != null && r406.content === "") { content4 = intl.string(t["2v7kfl"]); break L137; } if (_Module1384.hasFlag(r406.flags, MessageFlags.IS_VOICE_MESSAGE)) { content4 = intl.string(t["6bhHrc"]); } else if (r406.type === MessageTypes.POLL_RESULT) { content4 = getPollResultsReplyPreviewMobile(r406); } else if (_Module1384.hasFlag(r406.flags, MessageFlags.IS_COMPONENTS_V2)) { content4 = intl.string(t.Xxm5i3); } else { if (r406.content !== "") { const r438 = content2 == null; content4 = null; if (!r438) { break L137; } } content4 = intl.string(t.JAKsM8); } } } if (message3.type === MessageTypes.POLL_RESULT) { messageContent.content = content4; } const r487 = { state: ReferencedMessageRowState.LOADED, message: messageContent }; r108 = r487; if (content4 != null) { r487.systemContent = content4; r108 = r487; } } } } else if (ReferencedMessageState.NOT_LOADED === state) { r108 = { state: ReferencedMessageRowState.SYSTEM, content: intl.string(t["1i+hMi"]) }; } else if (ReferencedMessageState.DELETED === state) { r108 = { state: ReferencedMessageRowState.SYSTEM, content: intl.string(t.mE3KJN) }; } else { assertNever(messageByReference2); r108 = void 0; } } } const threadEmbed = renderThreadEmbeds ? createThreadEmbed(message, roleStyle, isInlineReplyPreview, channel2, options, theme) : void 0; const interactionStatus = createInteractionStatus(message, interaction); const r536 = guildId != null ? GuildMemberStore.getMember(guildId, author.id) : null; const isMemberCommunicationDisabled = _CommunicationDisabledUtils.isMemberCommunicationDisabled(r536); const r545 = channel == null; const guildMember = r536; const visibleConnectionsRole = getVisibleConnectionsRole({ guildMember, channel: (r545 ? void 0 : channel.parent_id) != null ? (channel == null ? void 0 : channel.isThread()) ? ChannelStore.getChannel(channel.parent_id) : channel : channel, onlyChannelConnectionRoles: true }); const length = message4.attachments.length; const length2 = message4.embeds.length; const r562 = (useAttachmentUploadPreview ? message.attachments.length === 0 : useAttachmentUploadPreview) && uploaderFileForMessageId != null; const attachments = r562 ? transformUploaderAttachments({ uploaderFile: uploaderFileForMessageId, isFailedMessage: message.state === MessageStates.SEND_FAILED, shouldInlineAttachmentMedia }) : renderAttachments ? transformMessageAttachments({ attachments: message4.attachments, uploadAttachments: UploadStore.getUploadAttachments(message.nonce), shouldInlineAttachmentMedia, gifAutoPlay, viewImageDescriptions: setting, useReducedMotion: AccessibilityStore.useReducedMotion, shouldObscureSpoiler, themedBackgroundColor: colors.embedBackgroundColor, enabledContentHarmTypeFlags: enabledHarmTypesForMessage, shouldAgeVerify: shouldAgeVerifyForExplicitMedia, colors }) : []; const r79 = r562 && message.state !== MessageStates.SEND_FAILED ? intl.string(t["yXY+5J"]) : calendarFormat(message.timestamp, true, timestampHourCycle); const r76 = r562 && message.state !== MessageStates.SEND_FAILED ? intl.string(t["yXY+5J"]) : accessibilityLabelCalendarFormat(message.timestamp); const id = AuthenticationStore.getId(); let content3 = message.isUnsupported ? intl.string(t.sWi5EU) : r188; const isPoll = message.isPoll(); if (!((isPoll ? isInlineReplyPreview ? !isInlineReplyPreview : renderPolls : !isPoll) || r188 != null && r188 !== "")) { content3 = getPollReplyPreview(message); } const pollData = renderPolls ? formatPollMessageChatData(message, void 0, { theme, animateEmoji }) : void 0; const sharedClientTheme = renderSharedClientTheme ? formatSharedClientThemeData(message, r88, nick) : void 0; const shouldDisplayGuildTag = _GuildTagUtils.shouldDisplayGuildTag(author.id, guildId == null ? void 0 : guildId); let clanBadgeUrl = void 0; let clanTag = void 0; let clanTagGuildId = void 0; if (shouldDisplayGuildTag) { const userPrimaryGuild = getUserPrimaryGuild(author.primaryGuild); const { guildId: guildId2, tag } = userPrimaryGuild; clanBadgeUrl = userPrimaryGuild.guildId != null ? getGuildTagBadgeUrl(userPrimaryGuild.guildId, userPrimaryGuild.badge, GuildTagBadgeSize.SIZE_12) : void 0; clanTag = tag; clanTagGuildId = guildId2; } const linkedLobby = channel?.linkedLobby; const r662 = linkedLobby != null; let lobbyTagIconUrl = void 0; let lobbyAdditionalName = void 0; if (r662) { const r666 = message.additionalName != null; lobbyTagIconUrl = void 0; lobbyAdditionalName = void 0; if (r666) { const additionalName = message.additionalName; lobbyTagIconUrl = void 0; lobbyAdditionalName = void 0; if (additionalName !== "") { const additionalName2 = message.additionalName; const application = ApplicationStore.getApplication(linkedLobby.application_id); lobbyTagIconUrl = application?.icon != null ? AvatarUtils2.getApplicationIconURL({ id: application.id, icon: application.icon, size: 16 }) : void 0; lobbyAdditionalName = additionalName2; } } } const hasFlag = _Module1384.hasFlag((message4 == null ? message : message4).flags, MessageFlags.IS_VOICE_MESSAGE); let applicationId = message.applicationId; if (applicationId == null) { applicationId = ""; } const application2 = ApplicationStore.getApplication(applicationId); const gameApplicationId = application2 != null && _Module1384.hasFlag(message.flags, MessageFlags.SENT_BY_SOCIAL_LAYER_INTEGRATION) ? application2.id : void 0; const r702 = message4 == null ? void 0 : message4.hasFlag(MessageFlags.IS_GUILD_OFFICIAL); let stateAccessibilityLabel = void 0; let r706 = void 0; let officialMessageColor2 = void 0; if (r702) { const guild = GuildStore.getGuild(guildId); const r711 = guild != null; stateAccessibilityLabel = void 0; r706 = void 0; officialMessageColor2 = void 0; if (r711) { const isGuildOfficialMessagesEnabled = _GuildOfficialMessageUtils.isGuildOfficialMessagesEnabled(guild, "createMessageContent"); stateAccessibilityLabel = void 0; r706 = void 0; officialMessageColor2 = void 0; if (isGuildOfficialMessagesEnabled) { let officialMessageColor = guild.officialMessageColor; if (officialMessageColor == null) { officialMessageColor = DEFAULT_GUILD_OFFICIAL_COLOR; } const r114 = showGuildOfficialMessageGradient(AccessibilityStore.officialMessageStyle); const r720 = r114 ? officialMessageColor | GUILD_OFFICIAL_HIGHLIGHT_ALPHA_COLOR : void 0; const r726 = showGuildOfficialMessageTextColor(AccessibilityStore.officialMessageStyle) ? getAccessibleGuildOfficialTextColor(officialMessageColor, Module712.internal.resolveSemanticColor(theme, Module712.colors.BACKGROUND_BASE_LOWER), AccessibilityStore.desaturateUserColors ? AccessibilityStore.saturation : 1, r114 ? GUILD_OFFICIAL_HIGHLIGHT_ALPHA : 0).num() : void 0; stateAccessibilityLabel = intl.string(t.GzDTxY); r706 = r726; officialMessageColor2 = r720; } } } const voiceChannelBadge = createVoiceChannelBadge(message.author.id, guildId); const guildId4 = guildId == null ? void 0 : guildId; let r765 = message4; if (r765 == null) { r765 = message; } const nonce = message.nonce != null && typeof message.nonce !== "string" ? String(message.nonce) : message.nonce; const referencedMessage = renderContentOnly ? void 0 : r108; const forwardInfo = messageForward != null ? messageForward.getForwardInfo() : void 0; const mentioned = ignoreMentioned ? !ignoreMentioned : message.mentioned; const edited = message.isEdited() ? renderContentOnly ? "" : intl.string(t.C8sXIM) : ""; const editedTimestamp2 = message.isEdited() ? renderContentOnly ? void 0 : message.editedTimestamp != null ? dateFormat(message.editedTimestamp, "LLLL") : void 0 : void 0; const textColor = message.isUnsupported ? colors.unsupportedColor : r706 != null ? 4278190080 | r706 : colors.textColor; if (r78) { nick = author.username; } if (nick == null) { nick = void 0; } const r762 = { id: message.id, channelId: message.channel_id, guildId: guildId4, flags: r765.flags, type: message.type, nonce, state: message.state, reactions, referencedMessage, threadEmbed, forwardInfo, mentioned, edited, editedTimestamp: editedTimestamp2, editedColor: colors.editedColor, textColor, officialMessageColor: officialMessageColor2, linkColor: colors.linkColor, tagText, tagAccessibilityLabel, tagVerified, tagTextColor, tagBackgroundColor, tagType, tagIconUrl, opTagText, opTagTextColor, opTagBackgroundColor, stateAccessibilityLabel, constrainedWidth, gifAutoPlay, animateEmoji, username: nick, avatarURL: r78 ? void 0 : r88.uri, avatarDecorationURL: null, authorId: null, usernameColor: null, roleColor: null, roleColors: null, shouldShowRoleDot: null, shouldShowRoleOnName: null, showLinkDecorations: null, colorString: null, roleIcon: null, connectionsRoleTag: null, timestamp: null, timestampTooltip: null, timestampColor: null, timestampAccessibilityLabel: null, content: null, isEditing: null, renderContentOnly: null, surveyIndication: null, ephemeralIndication: null, interactionStatus: null, executedCommand: null, components: null, feedbackColor: null, highlightColor: null, embeds: null, giftCodes: null, codedLinks: null, activityInstanceEmbed: null, activityRichPresenceInviteEmbed: null, useAttachmentGridLayout: null, useAttachmentUploadPreview: null, attachments: null, attachmentsOpacity: null, stickers: null, communicationDisabled: null, isFirstForumPostMessage: null, postActions: null, isCurrentUserMessageAuthor: null, usingGradientTheme: null, swipeToReplyIconUrl: null, swipeToEditIconUrl: null, postPreviewEmbeds: null, obscureLearnMoreLabel: null, safetyPolicyNoticeEmbed: null, pollData: null, sharedClientTheme: null, safetySystemNotificationEmbed: null, ctaButton: null, audioAttachmentBackgroundColor: null, accessibilityActions: null, clanTagGuildId: null, clanTag: null, clanBadgeUrl: null, lobbyAdditionalName: null, lobbyTagIconUrl: null, isFirst: null, gameApplicationId: null, isAnnouncementChannel: null, displayNameStyles: null, voiceChannelBadge: null }; const avatarDecorationURL2 = r78 ? null : avatarDecorationURL; L270: { r762.avatarDecorationURL = avatarDecorationURL2; r762.authorId = author.id; if (!r78 && roleStyle === "username") { usernameColor = processColor(colorString == null ? void 0 : colorString); if (usernameColor != null) { break L270; } usernameColor = colors.defaultUsernameColor; } else { usernameColor = colors.defaultUsernameColor; } } r762.usernameColor = usernameColor; let roleColor = null; if (!r78) { let r817 = processColor(colorString == null ? void 0 : colorString); if (r817 == null) { r817 = null; } roleColor = r817; } r762.roleColor = roleColor; r762.roleColors = hasEnhancedRoleColors ? r78 ? null : processColorStrings(colorStrings) : null; r762.shouldShowRoleDot = roleStyle === "dot"; r762.shouldShowRoleOnName = roleStyle === "username"; r762.showLinkDecorations = AccessibilityStore.alwaysShowLinkDecorations; if (r78) { defaultUsernameColor = colors.defaultUsernameColor; } else { if (colorString == null) { colorString = void 0; } defaultUsernameColor = processColor(colorString); if (defaultUsernameColor == null) { defaultUsernameColor = colors.defaultUsernameColor; } } r762.colorString = defaultUsernameColor; r762.roleIcon = r78 ? void 0 : r80; r762.connectionsRoleTag = visibleConnectionsRole != null ? createConnectionsRoleTag(visibleConnectionsRole) : void 0; r762.timestamp = r78 ? void 0 : r79; r762.timestampTooltip = r78 ? void 0 : dateFormat(message.timestamp, "LLLL"); r762.timestampColor = r78 ? void 0 : colors.timestampColor; r762.timestampAccessibilityLabel = r78 ? void 0 : r76; r762.content = content3; r762.isEditing = isEditing; r762.renderContentOnly = renderContentOnly; r762.surveyIndication = pushFeedbackType !== void 0 ? createSurveyIndication(message, theme, pushFeedbackType) : void 0; r762.ephemeralIndication = createEphemeralIndication(message); r762.interactionStatus = interactionStatus; r762.executedCommand = renderExecutedCommands ? createExecutedCommand(message, channel, roleStyle, theme, colors.defaultUsernameColor) : void 0; r762.components = message4.components.length > 0 ? renderComponents ? transformMessageComponents({ message, guildId, interaction, shouldDisableInteractiveComponents, shouldShowMedia, shouldObscureSpoiler, enabledContentHarmTypeFlags: enabledHarmTypesForMessage, shouldAgeVerify: shouldAgeVerifyForExplicitMedia, shouldShowMosaicMediaDescriptions: setting, shouldAutoPlayGifs: gifAutoPlay, colors }, message4.components) : void 0 : void 0; r762.feedbackColor = renderContentOnly ? 0 : colors.feedbackColor; r762.highlightColor = renderContentOnly ? 0 : colors.highlightColor; if (embeds == null) { embeds = void 0; } r762.embeds = embeds; r762.giftCodes = renderGiftCode ? createGiftCodeEmbed(message, theme) : []; r762.codedLinks = renderCodedLinks ? createCodedLinkEmbeds(message, message4, channel, theme) : []; r762.activityInstanceEmbed = renderActivityInstanceEmbed ? createActivityInstanceEmbed(message) : void 0; r762.activityRichPresenceInviteEmbed = renderActivityInviteEmbed ? createActivityRichPresenceInviteEmbed(message, channel) : void 0; if (shouldInlineAttachmentMedia) { if (renderAttachments) { renderAttachments = length !== 0 || length2 !== 0; } if (!renderAttachments) { renderAttachments = useAttachmentUploadPreview; } shouldInlineAttachmentMedia = renderAttachments; } r762.useAttachmentGridLayout = shouldInlineAttachmentMedia; r762.useAttachmentUploadPreview = useAttachmentUploadPreview; r762.attachments = attachments; r762.attachmentsOpacity = useAttachmentUploadPreview ? message.state === MessageStates.SEND_FAILED ? 0.2 : 1 : 1; r762.stickers = restrictedPreview ? [] : transformStickers({ message: message4, animateStickersSetting: AnimateStickers.getSetting(), isUserInteracting: message.id === animatingStickerMessageId }); if (renderCommunicationDisabled) { renderCommunicationDisabled = isMemberCommunicationDisabled; } r762.communicationDisabled = renderCommunicationDisabled; r762.isFirstForumPostMessage = !!(channel == null ? void 0 : channel.isForumPost()) && message.id === message.channel_id; const r915 = channel == null ? void 0 : channel.isForumPost(); let postActions = void 0; if (r915) { postActions = void 0; if (renderForumPostActions) { L357: { const { id: id2, channel_id } = message; r920 = void 0; if (id2 === channel_id) { const guildId3 = channel.getGuildId(); if (guildId3 != null) { const isLurking = LurkingStore.isLurking(guildId3); r920 = void 0; if (isLurking) { break L357; } } const hasJoined = JoinedThreadsStore.hasJoined(message.channel_id); const hasReactions = message.reactions.length !== 0; let defaultReaction = void 0; if (!hasReactions) { const defaultReactionEmoji = ChannelStore.getChannel(channel.parent_id)?.defaultReactionEmoji; defaultReaction = createDefaultReaction({ defaultReactionEmoji, customGuildEmoji: defaultReactionEmoji?.emojiId != null ? EmojiStore.getUsableCustomEmojiById(defaultReactionEmoji.emojiId) : null }); } r920 = createForumPostActions({ isFollowing: hasJoined, hasReactions, defaultReaction, showMediaPostSharePrompt: MediaPostSharePromptStore.shouldDisplayPrompt(channel.id) }); } } postActions = r920; } } r762.postActions = postActions; r762.isCurrentUserMessageAuthor = message.author.id === id; r762.usingGradientTheme = ClientThemesBackgroundStore.gradientPreset != null; r762.swipeToReplyIconUrl = getAssetUriForEmbed(Module7747); r762.swipeToEditIconUrl = getAssetUriForEmbed(Module7748); r762.postPreviewEmbeds = r40 ? createPostPreviewEmbeds(message, roleStyle, AccessibilityStore.useReducedMotion) : []; r762.obscureLearnMoreLabel = intl.string(t["2aXnfa"]); r762.safetyPolicyNoticeEmbed = createSafetyPolicyNoticeEmbed(message); r762.pollData = pollData; r762.sharedClientTheme = sharedClientTheme; r762.safetySystemNotificationEmbed = createSafetySystemNotificationEmbed(message); r762.ctaButton = createCtaButton(message.id, message.channel_id, colors); r762.audioAttachmentBackgroundColor = hasFlag ? colors.embedBackgroundColor : void 0; r762.accessibilityActions = createMessageAccessibilityActions(message, channel); r762.clanTagGuildId = clanTagGuildId; r762.clanTag = clanTag; r762.clanBadgeUrl = clanBadgeUrl; r762.lobbyAdditionalName = lobbyAdditionalName; r762.lobbyTagIconUrl = lobbyTagIconUrl; r762.isFirst = isFirst; r762.gameApplicationId = gameApplicationId; r762.isAnnouncementChannel = channel?.type === ChannelTypes.GUILD_ANNOUNCEMENT; r762.displayNameStyles = createDisplayNameStylesMobile(message.author, guildMember); r762.voiceChannelBadge = voiceChannelBadge; return r762; }; export default createMessageContent;