/* Metro module 8349; source: modules/messages/renderMessageMarkup.tsx; dependencies: [661, 4096, 6622, 4641, 4102, 4105, 1216, 2] */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ function _fun66450(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#66450, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:6, offset: 0x01bfbb72, size: 396 bytes, params: 8, frame: 22 const env0_0 = require; const getInitialParserStateFromMessage2 = getInitialParserStateFromMessage; const getInitialParserState2 = getInitialParserState; const renderAutomodMessageMarkupWithParser = function(a0, a1, a2, a3) { var Map = global.Map; return a0(a1, true, {'allowLinks': false, 'allowDevLinks': false, 'allowEmojiLinks': false, 'allowGameMentions': false, 'mentionChannels': null, 'mentionGames': null, 'soundboardSounds': null, 'formatInline': false, 'noStyleAndInteraction': false, 'allowHeading': false, 'allowList': false, 'disableAutoBlockNewlines': true, mentionChannels: [], mentionGames: new Map(), soundboardSounds: [], highlightWord: a2, disableAnimatedEmoji: false, channelId: a3, muted: false}, _fun66463); }; const hasAnySpoilerEmbeds = function(a0) { return containsMatchingNode(a0, _fun66472); }; const convertNewlinesInContent = function(a0) { a0.forEach(_fun66475); return a0; }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const MessageEmbedTypes = ConstantsModule.MessageEmbedTypes; let Set = global.Set; const IMAGE = MessageEmbedTypes.IMAGE; const GIFV = MessageEmbedTypes.GIFV; let set = new Set([IMAGE, GIFV]); Set = global.Set; set = new Set(['strong', 'em', 'u', 'text', 'inlineCode', 's', 'spoiler']); (FileImportTrackerModule).fileFinishedImporting('modules/messages/renderMessageMarkup.tsx'); exports.default = renderMessageMarkup; exports.getInitialParserStateFromMessage = getInitialParserStateFromMessage2; exports.getInitialParserState = getInitialParserState2; exports.renderMessageMarkupWithParser = renderMessageMarkupWithParser; exports.renderMessageMarkupToAST = renderMessageMarkupToAST; exports.renderMessageContentMarkup = function(a0, a1) { var value = a2; return _fun66480(a0, a1, value !== undefined ? value : {}); }; exports.renderAutomodMessageMarkup = function(a0, a1, a2) { return renderAutomodMessageMarkupWithParser(importDefault(dependencyMap[2]).parseAutoModerationSystemMessage, a0, a1, a2); }; exports.renderAutomodMessageMarkupToAST = function(a0, a1, a2) { return renderAutomodMessageMarkupWithParser(importDefault(dependencyMap[2]).parseAutoModerationSystemMessageToAST, a0, a1, a2); }; function getInitialParserStateFromMessage({channel_id, id, author, webhookId, mentionChannels, mentionGames, soundboardSounds}, a1) { // fn#66451, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:240, offset: 0x01bfbcfe, size: 211 bytes, params: 3, frame: 17 const getInitialParserStateBinding = getInitialParserState; const value = author == null; const initialParserStateBinding = getInitialParserStateBinding({channelId: channel_id, messageId: id, authorId: value ? undefined : author.id, renderOptions: a1}); const value4 = webhookId != null; object = {}; copyDataProperties(object, initialParserStateBinding, value); object['allowLinks'] = value4 || initialParserStateBinding.allowLinks; object['allowEmojiLinks'] = value4; object['mentionChannels'] = mentionChannels; object['mentionGames'] = mentionGames ?? new global.Map(); object['soundboardSounds'] = soundboardSounds ?? []; return object; } function render_66453(a0, a1, a2) { // fn#66453, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:1431, offset: 0x01bfbf50, size: 187 bytes, params: 4, frame: 18 let value = a1; const toAST = a2.toAST; let r0 = toAST !== undefined && toAST; const hideSimpleEmbedContent = a2.hideSimpleEmbedContent; r0 = hideSimpleEmbedContent === undefined || hideSimpleEmbedContent; const formatInline = a2.formatInline; r0 = formatInline !== undefined && formatInline; const env0_4 = a2.postProcessor; const contentMessage = a2.contentMessage; const env0_6 = false; const env0_7 = false; const content = (contentMessage ?? value).content; value = getInitialParserStateFromMessage(value, a2); value = a0(content, true, value, _fun66454); return {hasSpoilerEmbeds: env0_6, hasBailedAst: env0_7, content: value}; function _fun66454(a0, a1, a2) { // fn#66454, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:1679, offset: 0x01bfc00b, size: 648 bytes, params: 4, frame: 22 var environment; var r5; var embeds; var property; var property2; var type; var binding; var checkForJumboEmojiBinding; var content3; var value5; var value6; var value7; var value8; let value = a0; const value2 = a2; let r2 = value2 != null && value2; env0_7 = r2; const Array = global.Array; let r8 = Array.isArray(value) ? value : [value]; r8 = env0_7 ? [{type: 'text', content: content, originalMatch: {index: 0, [0]: content}}] : r8; if (env0_2) { r2 = contentMessage ?? require; embeds = r2.embeds; if (r8.length !== 1) { r2 = r8; } else if (embeds.length !== 1) { r2 = r8; } else { property = r8[0]; property2 = embeds[0]; if (property.type === 'link') { value = environment.__proto__; binding = env1_4; if (binding.has(property2.type)) { value = require(4641) /* metro dependency 4641: EmbedUtils */; r2 = value.isEmbedInline(property2) ? [] : r8; } else { r2 = r8; } } else if (property.type !== 'attachmentLink') { r2 = r8; } else { value = environment.__proto__; binding = env1_4; if (binding.has(property2.type)) { value = require(4641) /* metro dependency 4641: EmbedUtils */; r2 = value.isEmbedInline(property2) ? [] : r8; } else { r2 = r8; } } } r5 = r2; } else { r5 = r8; } binding = ConstantsModule.MessageTypes; if (binding) { r2 = binding; } else { type = require.type; value = environment.__proto__; value = type === MessageTypes.MEDIA_MENTION_MESSAGE; r2 = value; } if (!r2) { if (a1) { value = environment.__proto__; checkForJumboEmoji(r5); } else { value = r5[0].type === 'paragraph'; if (value && r5[0].content instanceof global.Array) { property = r5[0]; value = environment.__proto__; checkForJumboEmojiBinding = checkForJumboEmoji; content3 = r5[0].content; checkForJumboEmojiBinding(content3); property.content = content3; } } } if (env0_1) { value = ((a0) => a0.filter(_fun66458))(r5); value = ((a0) => a0.filter(_fun66456))(value); r2 = value; } else { r2 = r5; } value = ((a0) => { var env0_0 = a0.some(_fun66460); return a0.filter(_fun66461); })(r2); let r0 = contentMessage ?? require; if (r0.embeds.length > 0) { if (a1) { value7 = environment.__proto__; r0 = hasAnySpoilerEmbeds(value); } else { type = value[0].type; value5 = false; if (type !== 'paragraph') { r0 = value5; } else if (value[0].content instanceof global.Array) { value6 = environment.__proto__; r0 = hasAnySpoilerEmbeds(value[0].content); } else { r0 = value5; } } } if (ConstantsModule.MessageTypes) { value8 = environment.__proto__; convertNewlinesInContent(value); } if (postProcessor == null) { r0 = value; } else { value = postProcessor(value, a1); r0 = value; } return r0; function removeExperimentLinks(a0) { // fn#66455, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:2269, offset: 0x01bfc293, size: 24 bytes, params: 2, frame: 11 return a0.filter(_fun66456); function _fun66456(a0) { // fn#66456, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:2320, offset: 0x01bfc2ab, size: 66 bytes, params: 2, frame: 13 var r0; let value = a0.type !== 'link'; if (value) { r0 = value; } else { value = environment.__proto__.__proto__.__proto__; value = require(4105) /* metro dependency 4105: ExperimentEmbedUtils */; value = !value.isExperimentEmbedURL(a0.target); r0 = value; } return r0; } } function removeBuildOverrideLinks(a0) { // fn#66457, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:2385, offset: 0x01bfc2ed, size: 24 bytes, params: 2, frame: 11 return a0.filter(_fun66458); function _fun66458(a0) { // fn#66458, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:2439, offset: 0x01bfc305, size: 66 bytes, params: 2, frame: 13 var r0; let value = a0.type !== 'link'; if (value) { r0 = value; } else { value = environment.__proto__.__proto__.__proto__; value = require(4102) /* metro dependency 4102: BuildOverrideUtils */; value = !value.isBuildOverrideLink(a0.target); r0 = value; } return r0; } } function removeQuestsEmbedLinks(a0) { // fn#66459, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:2508, offset: 0x01bfc347, size: 46 bytes, params: 2, frame: 12 const env0_0 = a0.some(function(a0) { return a0.type !== 'link'; }); return a0.filter(_fun66461); function _fun66461(a0) { // fn#66461, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:2595, offset: 0x01bfc387, size: 100 bytes, params: 2, frame: 15 var r1; var value3; var moduleValue; const value = a0.type === 'link'; const target = a0.target; const value2 = null; if (value2 != target) { value3 = environment.__proto__.__proto__.__proto__; moduleValue = require(4096) /* metro dependency 4096: findCodedLinks */; r1 = moduleValue.parseQuestsEmbedCode(a0.target); } else { r1 = value2; } return !(value && value2 != r1 && !env0_0); } } } } function renderAutomodMessageMarkupWithParser(a0, a1, a2, a3) { // fn#66462, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:3042, offset: 0x01bfc3eb, size: 119 bytes, params: 5, frame: 17 const Map = global.Map; return a0(a1, true, {'allowLinks': false, 'allowDevLinks': false, 'allowEmojiLinks': false, 'allowGameMentions': false, 'mentionChannels': null, 'mentionGames': null, 'soundboardSounds': null, 'formatInline': false, 'noStyleAndInteraction': false, 'allowHeading': false, 'allowList': false, 'disableAutoBlockNewlines': true, mentionChannels: [], mentionGames: new Map(), soundboardSounds: [], highlightWord: a2, disableAnimatedEmoji: false, channelId: a3, muted: false}, function(a0) { var value = a0; var Array = global.Array; return Array.isArray(value) ? value : [value]; }); } function checkForJumboEmoji(a0) { // fn#66464, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:3439, offset: 0x01bfc462, size: 81 bytes, params: 2, frame: 12 if (!a0.some(function(a0) { var r0; var r1; var value = a0.type !== 'emoji'; r0 = value && a0.type !== 'customEmoji'; if (r0) { value = typeof a0.content !== 'string'; if (value) { r1 = value; } else { value = a0.content.trim(); value = value !== ''; r1 = value; } r0 = r1; } return r0; })) { var env0_0 = 0; a0.forEach(_fun66466); if (!(env0_0 > 30)) { a0.forEach(function(a0) { a0.jumboable = true; }); } } return a0; function _fun66466(a0) { // fn#66466, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:3615, offset: 0x01bfc505, size: 75 bytes, params: 2, frame: 3 if (!(a0.type !== 'emoji' && a0.type !== 'customEmoji')) { env0_0 += 1; } if (env0_0 > 30) { return false; } } } function containsMatchingNode(a0, a1) { // fn#66468, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:3729, offset: 0x01bfc55f, size: 146 bytes, params: 3, frame: 18 const env0_0 = a1; const Array = global.Array; if (a0 instanceof Array) { return a0.some(function(a0) { return containsMatchingNode(a0, require); }); } return a1(a0) ?? (a0.content instanceof global.Array ? containsMatchingNode(a0.content, a1) : a0.items instanceof global.Array && a0.items.some(function(a0) { return containsMatchingNode(a0, require); })); } function hasAnySpoilerEmbeds(a0) { // fn#66471, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:3992, offset: 0x01bfc60c, size: 29 bytes, params: 2, frame: 13 return containsMatchingNode(a0, _fun66472); function _fun66472(a0) { // fn#66472, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:4055, offset: 0x01bfc629, size: 44 bytes, params: 2, frame: 14 var environment; var r0; const type = a0.type; let value = null; if (type !== 'spoiler') { r0 = value; } else { value = environment.__proto__; value = containsMatchingNode(a0, function(a0) { var r0; r0 = a0.type === 'link' || a0.type === 'attachmentLink'; r0 = !r0 ? null : r0; return r0; }); r0 = value; } return r0; } } function convertNewlinesInContent(a0) { // fn#66474, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:4162, offset: 0x01bfc67c, size: 24 bytes, params: 2, frame: 11 a0.forEach(_fun66475); return a0; function _fun66475(a0) { // fn#66475, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:4217, offset: 0x01bfc694, size: 254 bytes, params: 2, frame: 23 var content; var Array; var isArray; let value = environment.__proto__; const binding = env1_5; if (binding.has(a0.type) && a0.content != null) { Array = global.Array; isArray = Array.isArray; content = a0.content; if (Reflect.apply(isArray, Array, [content])) { convertNewlinesInContent(a0.content); } else { content = a0.content; if (typeof content === 'string') { content = a0.content; a0.content = content.replace(RegExp('\\n', 'g'), ' '); } else { value = importDefault(1216) /* metro dependency 1216: SentryUtilsNative */; value.captureMessage('AST node type:' + a0.type + ' with content typeof ' + typeof a0.content + '. Keys ' + global.Object.keys(a0)); } } } } } function renderMessageMarkup(a0) { // fn#66476, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:4586, offset: 0x01bfc792, size: 73 bytes, params: 2, frame: 17 let value = a1; const r4 = value !== undefined ? value : {}; const render_66453Binding = render_66453; const formatInline = r4.formatInline; value = importDefault(6622) /* metro dependency 6622: MarkupUtils */; return render_66453Binding(formatInline ? value.parseInlineReply : value.parse, a0, r4); } function renderMessageMarkupWithParser(a0, a1) { // fn#66477, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:4846, offset: 0x01bfc7db, size: 33 bytes, params: 3, frame: 15 const value = a2; return render_66453(a0, a1, value !== undefined ? value : {}); } function renderMessageMarkupToAST(a0) { // fn#66478, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:4945, offset: 0x01bfc7fc, size: 98 bytes, params: 2, frame: 17 let value = a1; const r0 = value !== undefined ? value : {}; const render_66453Binding = render_66453; const formatInline = r0.formatInline; value = importDefault(6622) /* metro dependency 6622: MarkupUtils */; const r2 = formatInline ? value.parseInlineReplyToAST : value.parseToAST; const object = {}; copyDataProperties(object, r0, undefined); object['toAST'] = true; return render_66453Binding(r2, a0, object); } function renderMessageContentMarkup(a0, a1) { // fn#66479, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:5115, offset: 0x01bfc85e, size: 35 bytes, params: 3, frame: 15 const value = a2; return renderMessageContentMarkupWithParser(a0, a1, value !== undefined ? value : {}); function renderMessageContentMarkupWithParser(a0, {content, guildId, channelId, messageId, authorId}) { // fn#66480, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:5168, owner: renderMessageContentMarkup.renderMessageContentMarkupWithParser, offset: 0x01bfc881, size: 153 bytes, params: 3, frame: 20 const Map = global.Map; return a0(content, true, {'allowLinks': false, 'allowDevLinks': false, 'allowEmojiLinks': false, 'allowGameMentions': false, 'mentionChannels': null, 'mentionGames': null, 'soundboardSounds': null, 'formatInline': true, 'noStyleAndInteraction': false, 'allowHeading': false, 'allowList': false, 'disableAutoBlockNewlines': true, 'previewLinkTarget': false, 'disableAnimatedEmoji': true, mentionChannels: [], mentionGames: new Map(), soundboardSounds: [], guildId: guildId, channelId: channelId, messageId: messageId, authorId: authorId, muted: false, disablePressableChannelMention: true}, function(a0) { var value = a0; var Array = global.Array; return Array.isArray(value) ? value : [value]; }); } } } function getInitialParserState({channelId, messageId, authorId, renderOptions}) { // fn#66452, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:629, offset: 0x01bfbdd1, size: 383 bytes, params: 2, frame: 16 const object = {channelId: channelId, messageId: messageId, authorId: authorId}; let Boolean = global.Boolean; object.allowLinks = Boolean(renderOptions.allowLinks); Boolean = global.Boolean; object.allowDevLinks = Boolean(renderOptions.allowDevLinks); Boolean = global.Boolean; object.allowGameMentions = Boolean(renderOptions.allowGameMentions); Boolean = global.Boolean; object.allowTimeMentionInput = Boolean(renderOptions.allowTimeMentionInput); Boolean = global.Boolean; object.formatInline = Boolean(renderOptions.formatInline); Boolean = global.Boolean; object.noStyleAndInteraction = Boolean(renderOptions.noStyleAndInteraction); Boolean = global.Boolean; object.allowHeading = Boolean(renderOptions.allowHeading); Boolean = global.Boolean; object.allowList = Boolean(renderOptions.allowList); Boolean = global.Boolean; object.previewLinkTarget = Boolean(renderOptions.previewLinkTarget); Boolean = global.Boolean; object.disableAnimatedEmoji = Boolean(renderOptions.disableAnimatedEmoji); object.allowEmojiLinks = false; object.disableAutoBlockNewlines = true; object.mentionChannels = []; const Map = global.Map; object.mentionGames = new Map(); object.soundboardSounds = []; object.muted = false; object.unknownUserMentionPlaceholder = true; object.viewingChannelId = renderOptions.viewingChannelId; Boolean = global.Boolean; object.forceWhite = Boolean(renderOptions.forceWhite); object.textColor = renderOptions.textColor; return object; } function _fun66460({type}) { // fn#66460, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:2557, offset: 0x01bfc375, size: 18 bytes, params: 2, frame: 2 return type !== 'link'; } function _fun66463(a0) { // fn#66463, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8534:3404, offset: 0x011b99b8, size: 40 bytes, params: 2, frame: 11 const value = a0; const Array = global.Array; return Array.isArray(value) ? value : [value]; } global.__d(_fun66450, 8349, [661, 4096, 6622, 4641, 4102, 4105, 1216, 2]) /* metro module 8349, dependencies: [661, 4096, 6622, 4641, 4102, 4105, 1216, 2] */;