/* Metro module 9546; source: modules/media_viewer/native/MediaSourceUtil.tsx; dependencies: [31, 27, 661, 4631, 1391, 4838, 4841, 1477, 8430, 8349, 4641, 8191, 4627, 1909, 8355, 8368, 1360, 8621, 676, 3856, 9547, 4496, 1244, 9548, 2] */ function _fun74490(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#74490, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:6, offset: 0x01d8f2bb, size: 747 bytes, params: 8, frame: 35 var object2; const env0_0 = require; const _arrayLikeToArray_74493 = function(a0, a1) { var r0; var r1; var r2; var value3; var length; var value5; var value = undefined; var value2 = value == null; reducibleJoin2: while (true) { if (value2) { r0 = value2; break reducibleJoin2; } value3 = value > a0.length; r0 = value3; break reducibleJoin2; } reducibleJoin4: while (true) { if (r0) { length = a0.length; r1 = length; break reducibleJoin4; } r1 = value; break reducibleJoin4; } value = (0, global.Array)(r1); var value4 = 0; if (value4 < r1) { r2 = value4; reducibleLoop5: while (true) { value[r2] = a0[r2]; value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1; if (value5 < r1) { r2 = value5; continue reducibleLoop5; } break reducibleLoop5; } } return value; }; const closure = function(a0, a1) { var value = a0; return global.Array.isArray(value) ? a1 ? value[value.length - 1] : value[0] : value; }; const closure2 = isValidImageAttachment; const closure3 = isValidVideoAttachment; const closure4 = function(a0) { return a0.image != null || a0.thumbnail != null; }; const closure5 = function(a0) { return a0.video != null; }; const closure6 = isThumbnailAttachment; const closure7 = function(a0) { return a0.proxy_url == null ? a0.url : a0.proxy_url !== '' ? a0.proxy_url : a0.url; }; const closure8 = extractMediaFromAttachment; const closure9 = getEmbedUrl; const getEmbedContentScanVersion = function(a0) { return a0.contentScanVersion ?? (a0.content_scan_version ?? undefined); }; const getMediaContentType = function(a0) { return 'contentType' in a0 ? a0.contentType : 'content_type' in a0 && a0.content_type != null ? a0.content_type : undefined; }; const closure10 = function(a0) { var r0; r0 = a0.image ?? a0.video; r0 = r0 ?? a0.thumbnail; return r0; }; const closure11 = extractMediaFromEmbed; const closure12 = downloadMediaAssetWithContentType; const closure13 = isAnimatedWebpSource; const closure14 = isAnimatedAvifSource; const closure15 = isGIFSource; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importAll(31) /* metro dependency 31 */; const env0_4 = (require(27) /* metro dependency 27 */).NativeModules; const constantsModule = require(661) /* metro dependency 661: Constants */; const env0_5 = constantsModule.MessageAttachmentFlags; const env0_6 = constantsModule.WEBP_RE_IOS; const env0_7 = RegExp('\\.avif$', 'i'); object2 = {PORTAL: 0}; object2[0] = 'PORTAL'; object2.TIKTOK_IFRAME = 1; object2[1] = 'TIKTOK_IFRAME'; object2.WEB_FILE_IFRAME = 2; object2[2] = 'WEB_FILE_IFRAME'; object2.DEFAULT = 3; object2[3] = 'DEFAULT'; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/media_viewer/native/MediaSourceUtil.tsx'); exports.flattenSource = closure; exports.isValidImageAttachment = closure2; exports.isValidVideoAttachment = closure3; exports.isValidImageEmbed = closure4; exports.isValidVideoEmbed = closure5; exports.isThumbnailAttachment = closure6; exports.getAttachmentUrl = closure7; exports.extractMediaFromAttachment = closure8; exports.getEmbedUrl = closure9; exports.getEmbedMedia = closure10; exports.extractMediaFromEmbed = closure11; exports.extractMediaFromMessageComponents = extractMediaFromMessageComponents; exports.extractMediaSourcesFromEmbed = extractMediaSourcesFromEmbed; exports.extractMediaSourcesFromComponent = extractMediaSourcesFromComponent; exports.extractMediaSourcesFromMessage = extractMediaSourcesFromMessage; exports.setMediaSourcePortal = setMediaSourcePortal; exports.getSelectedMediaSource = function(a0) { var property = a0.index; var value = property.get(); if (value < 0) { return null; } if (value >= a0.sources.length) { return null; } property = a0.sources[value]; value = null; return value == property ? value : global.Array.isArray(property) ? property[property.length - 1] : property; }; exports.useSelectedMediaSource = useSelectedMediaSource; exports.downloadMediaAsset = function(a0, a1) { return downloadMediaAssetWithContentType(a0, a1); }; exports.downloadMediaAssetWithContentType = closure12; exports.getYoutubeClipVideoIdFromURI = function(a0) { var value = a0.match(RegExp('^https:\\/\\/www\\.youtube\\.com\\/embed\\/([A-Za-z0-9_-]*)(\\?clip=([A-Za-z0-9_-]+)(&clipt=([A-Za-z0-9_-]+)))?$', '')); var value2 = null; if (value2 == value) { return value2; } if (value.length !== 6) { return value2; } var property = value[1]; var property2 = value[3]; var property3 = value[5]; return value2 == property || value2 == property2 || value2 == property3 ? value2 : {videoId: property, clip: property2, clipt: property3}; }; exports.getYoutubeVideoIdFromURI = getYoutubeVideoIdFromURI; exports.VideoSourceType = object2; exports.getVideoSourceType = getVideoSourceType; exports.supportOverlayVideoControls = function(a0) { var r0; r0 = a0.videoURI != null && a0.isGIFV !== true; r0 = !r0 ? a0.embedURI != null && a0.embedProviderName === 'TikTok' : r0; return r0; }; exports.isAnimatedWebpSource = closure13; exports.isAnimatedAvifSource = closure14; exports.isGIFSource = closure15; exports.isAnimatedImageSource = isAnimatedImageSource; } function _createForOfIteratorHelperLoose_74491(a0, a1) { // fn#74491, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:192, offset: 0x01d8f5a6, size: 372 bytes, params: 3, frame: 20 var r6; var r9; var r5; var value3; var regexp; const env0_0 = a0; const Symbol = global.Symbol; let value = typeof Symbol !== 'undefined'; let r1 = value && a0[global.Symbol.iterator]; r1 = !r1 ? a0['@@iterator'] : r1; if (r1) { value = r1.call(a0); return value.next.bind(value); } const Array = global.Array; if (Array.isArray(a0)) { if (r1) { } return _fun74492; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_74493(a0, value); r5 = value; } else { value3 = ({}).toString.call(a0).slice(8, -1); r6 = value3 === 'Object' && a0.constructor; r9 = r6 ? a0.constructor.name : value3; if (r9 === 'Map') { r6 = global.Array.from(a0); } else if (r9 === 'Set') { r6 = global.Array.from(a0); } else if (r9 === 'Arguments') { value = _arrayLikeToArray_74493(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_74493(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun74492; } const TypeError = global.TypeError; throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); } function isValidImageAttachment(a0) { // fn#74495, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:1194, offset: 0x01d8f758, size: 114 bytes, params: 2, frame: 17 if (a0 == null) { return false; } const filename = a0.filename; const height = a0.height; const width = a0.width; let r0 = (require(4631) /* metro dependency 4631: MediaFormatTesters */).isImageFile(filename) && height != null && height > 0; r0 = r0 && width != null && width > 0 && !isThumbnailAttachment(a0); return r0; } function isValidVideoAttachment(a0) { // fn#74496, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:1373, offset: 0x01d8f7ca, size: 79 bytes, params: 2, frame: 15 var r1; var r0; let value = a0 != null; if (value) { value = a0 != null; if (value) { value = require(4631) /* metro dependency 4631: MediaFormatTesters */; value = value.isVideoFile(a0.filename); r1 = value; } else { r1 = value; } r1 = r1 && a0.proxy_url != null; r0 = r1; } else { r0 = value; } return r0; } function isThumbnailAttachment(a0) { // fn#74499, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:1608, offset: 0x01d8f848, size: 81 bytes, params: 2, frame: 16 var r1; var r0; var moduleValue; let value = a0 != null; if (value) { value = a0.flags != null; if (value) { moduleValue = require(1391) /* metro dependency 1391: FlagUtils */; r1 = moduleValue.hasFlag(a0.flags, MessageAttachmentFlags.IS_THUMBNAIL); } else { r1 = value; } r0 = r1; } else { r0 = value; } return r0; } function extractMediaFromAttachment(a0, a1, a2, a3, a4) { // fn#74501, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:1806, offset: 0x01d8f8c5, size: 1038 bytes, params: 6, frame: 32 var id; var uRL; var items2; var items3; let width = a0.width; if (width == null) { return undefined; } width = a0.width; const value = 0; if (width <= value) { return undefined; } let height = a0.height; if (height == null) { return undefined; } if (a0.height <= value) { return undefined; } const value3 = undefined; const enabledHarmTypesForMessage = (require(4838) /* metro dependency 4838: ObscuredMediaUtils */).getEnabledHarmTypesForMessage(a1); const obscuredMediaUtilsModule = require(4838) /* metro dependency 4838: ObscuredMediaUtils */; const isMediaObscuredForHarmTypes = obscuredMediaUtilsModule.isMediaObscuredForHarmTypes; let object3 = {}; const ObscuredMediaTypes = (require(4841) /* metro dependency 4841: ExplicitMediaRedactionModels */).ObscuredMediaTypes; const Attachment = ObscuredMediaTypes.Attachment; object3.type = Attachment; object3.media = a0; const isMediaObscuredForHarmTypes2 = Reflect.apply(isMediaObscuredForHarmTypes, obscuredMediaUtilsModule, [object3, enabledHarmTypesForMessage]); const mediaFormatTestersModule = require(4631) /* metro dependency 4631: MediaFormatTesters */; const isVideoFile2 = mediaFormatTestersModule.isVideoFile(a0.filename); const attachmentUrl = getAttachmentUrl(a0); const defaultImport = importDefault(1477) /* metro dependency 1477: ImageUtils */; const getMobileOptimizedSrc = defaultImport.getMobileOptimizedSrc; width = a0.width; height = a0.height; const value7 = Reflect.apply(getMobileOptimizedSrc, defaultImport, [attachmentUrl, width, height, isVideoFile2 ? 'png' : value3]); if (isVideoFile2) { object3 = {uri: value7}; id = a1.id; object3.messageId = id; object3.guildId = a3; object3.channelId = a1.channel_id; object3.videoURI = attachmentUrl; object3.filename = (importDefault(8430) /* metro dependency 8430: getDisplayFilename */)(a0); object3.mediaIndex = a2; object3.width = a0.width; object3.height = a0.height; object3.sourceURI = attachmentUrl; object3.description = a0.description; object3.accessoryType = 'attachment'; object3.spoiler = a0.spoiler; object3.flags = a0.flags; object3.obscure = isMediaObscuredForHarmTypes2; object3.placeholder = a0.placeholder; object3.contentScanVersion = a0.content_scan_version; object3.mediaViewIndex = a4; id = a0.id; object3.attachmentId = id; return object3; } object3 = {uri: value7}; object3.messageId = a1.id; object3.guildId = a3; object3.channelId = a1.channel_id; object3.filename = (importDefault(8430) /* metro dependency 8430: getDisplayFilename */)(a0); object3.mediaIndex = a2; object3.width = a0.width; object3.height = a0.height; object3.sourceURI = a0.url; object3.description = a0.description; object3.accessoryType = 'attachment'; object3.spoiler = a0.spoiler; object3.flags = a0.flags; object3.obscure = isMediaObscuredForHarmTypes2; object3.placeholder = a0.placeholder; object3.contentScanVersion = a0.content_scan_version; object3.mediaViewIndex = a4; object3.attachmentId = a0.id; const object4 = {}; copyDataProperties(object4, object3, height); object4['uri'] = attachmentUrl; const value10 = (importDefault(8430) /* metro dependency 8430: getDisplayFilename */)(a0).toLowerCase().endsWith('.webp'); const value13 = (importDefault(8430) /* metro dependency 8430: getDisplayFilename */)(a0).toLowerCase().endsWith('.avif'); const flagUtilsModule = require(1391) /* metro dependency 1391: FlagUtils */; const hasFlag = flagUtilsModule.hasFlag; const r18 = a0.flags ?? value; const IS_ANIMATED = MessageAttachmentFlags.IS_ANIMATED; if (Reflect.apply(hasFlag, flagUtilsModule, [r18, IS_ANIMATED])) { if (value10) { uRL = new global.URL(attachmentUrl); uRL.searchParams.append('animated', 'true'); if (value13) { uRL.searchParams.append('format', 'webp'); } items3 = [object3]; object3 = {}; copyDataProperties(object3, object4, height); object3['uri'] = uRL.toString(); items3[1] = object3; return items3; } if (value13) { uRL = new global.URL(attachmentUrl); uRL.searchParams.append('animated', 'true'); if (value13) { uRL.searchParams.append('format', 'webp'); } items3 = [object3]; object3 = {}; copyDataProperties(object3, object4, height); object3['uri'] = uRL.toString(); items3[1] = object3; return items3; } } if (value13) { uRL = new global.URL(attachmentUrl); uRL.searchParams.append('format', 'webp'); items2 = [object3]; object3 = {}; copyDataProperties(object3, object4, height); object3['uri'] = uRL.toString(); items2[1] = object3; return items2; } return attachmentUrl === value7 ? object4 : [object3, object4]; } function getEmbedUrl({proxyURL, url, srcIsAnimated}) { // fn#74502, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:3310, offset: 0x01d8fcd3, size: 254 bytes, params: 2, frame: 17 var uRL; var pathname; var value3; if (proxyURL != null) { if (proxyURL !== '') { uRL = new global.URL(proxyURL); pathname = uRL.pathname; value3 = pathname.toLowerCase().endsWith('.avif'); pathname = uRL.pathname; if (srcIsAnimated) { if (pathname.toLowerCase().endsWith('.webp')) { uRL.searchParams.append('animated', 'true'); if (value3) { uRL.searchParams.append('format', 'webp'); } return uRL.toString(); } if (value3) { uRL.searchParams.append('animated', 'true'); if (value3) { uRL.searchParams.append('format', 'webp'); } return uRL.toString(); } return proxyURL; } if (value3) { uRL.searchParams.append('format', 'webp'); return uRL.toString(); } return proxyURL; } } return url; } function extractMediaFromEmbed(a0, a1, a2, a3, a4) { // fn#74506, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:4074, offset: 0x01d8fe59, size: 1413 bytes, params: 6, frame: 34 var getEmbedUrlBinding; var getMediaContentTypeBinding; var thumbnail; var object6; var embedUrlBinding; var defaultImport3; var value12; var push; var object7; var object8; var object9; const getEmbedMediaBinding = getEmbedMedia; const value2 = undefined; const embedMediaBinding = getEmbedMediaBinding(a0); if (embedMediaBinding == null) { return value2; } let video = a0.video; let r15 = video != null ? getEmbedUrl(a0.video) : value2; let type = a0.type; const embedUrl = getEmbedUrl(embedMediaBinding); const embedContentScanVersion = getEmbedContentScanVersion(a0); const defaultImport = importDefault(1477) /* metro dependency 1477: ImageUtils */; let getMobileOptimizedSrc = defaultImport.getMobileOptimizedSrc; let width = embedMediaBinding.width; let height = embedMediaBinding.height; const value7 = Reflect.apply(getMobileOptimizedSrc, defaultImport, [embedUrl, width, height]); const hasSpoilerEmbeds = (importDefault(8349) /* metro dependency 8349: renderMessageMarkup */)(a1, {contentMessage: a2}).hasSpoilerEmbeds; const enabledHarmTypesForMessage = (require(4838) /* metro dependency 4838: ObscuredMediaUtils */).getEnabledHarmTypesForMessage(a1); const obscuredMediaUtilsModule = require(4838) /* metro dependency 4838: ObscuredMediaUtils */; const isMediaObscuredForHarmTypes = obscuredMediaUtilsModule.isMediaObscuredForHarmTypes; const ObscuredMediaTypes = (require(4841) /* metro dependency 4841: ExplicitMediaRedactionModels */).ObscuredMediaTypes; const Embed = ObscuredMediaTypes.Embed; const isMediaObscuredForHarmTypes2 = Reflect.apply(isMediaObscuredForHarmTypes, obscuredMediaUtilsModule, [{type: Embed, media: a0}, enabledHarmTypesForMessage]); const r23 = 'title' in a0 ? a0.title : 'rawTitle' in a0 ? a0.rawTitle : value2; const embedUtilsModule = require(4641) /* metro dependency 4641: EmbedUtils */; const isEmbedInline = embedUtilsModule.isEmbedInline; object = {}; copyDataProperties(object, a0, undefined); object['rawTitle'] = r23; const isEmbedInline2 = Reflect.apply(isEmbedInline, embedUtilsModule, [object]); const moduleValue4 = embedUtilsModule; const getEffectiveVideoProvider = moduleValue4.getEffectiveVideoProvider; let provider = a0.provider; const name = provider == null ? value2 : provider.name; video = a0.video; const value9 = Reflect.apply(getEffectiveVideoProvider, moduleValue4, [name, video == null ? value2 : video.url]); const shouldPlayVideoInline2 = (require(8191) /* metro dependency 8191: EmbedUtils */).shouldPlayVideoInline(value9); let r3 = shouldPlayVideoInline2 && a0.video != null; if (r15 == null) { type = a0.type; if (type === 'video') { object = []; thumbnail = a0.thumbnail; if (thumbnail != null) { getEmbedUrlBinding = getEmbedUrl; thumbnail = a0.thumbnail; embedUrlBinding = getEmbedUrlBinding(thumbnail); defaultImport3 = defaultImport; getMobileOptimizedSrc = defaultImport3.getMobileOptimizedSrc; thumbnail = a0.thumbnail; width = thumbnail.width; thumbnail = a0.thumbnail; height = thumbnail.height; value12 = Reflect.apply(getMobileOptimizedSrc, defaultImport3, [embedUrlBinding, width, height]); push = object.push; object7 = {uri: value12, guildId: a4, spoiler: hasSpoilerEmbeds}; object7.flags = a0.flags; object7.obscure = isMediaObscuredForHarmTypes2; object7.contentScanVersion = embedContentScanVersion; getMediaContentTypeBinding = getMediaContentType; thumbnail = a0.thumbnail; object7.contentType = getMediaContentTypeBinding(thumbnail); object7.messageId = a1.id; object7.noCarousel = !isEmbedInline2; object7.mediaIndex = a3; object7.accessoryType = 'embed'; object7.channelId = a1.channel_id; thumbnail = a0.thumbnail; object7.sourceURI = thumbnail.url; thumbnail = a0.thumbnail; width = thumbnail.width; object7.width = width; thumbnail = a0.thumbnail; height = thumbnail.height; object7.height = height; Reflect.apply(push, object, [object7]); } r3 = r3 && a0.video != null; if (r3) { push = object.push; object8 = {uri: value7, guildId: a4, spoiler: hasSpoilerEmbeds}; object8.flags = a0.flags; object8.obscure = isMediaObscuredForHarmTypes2; object8.contentScanVersion = embedContentScanVersion; getMediaContentTypeBinding = getMediaContentType; video = a0.video; object8.contentType = getMediaContentTypeBinding(video); object8.sourceURI = a0.url; object8.messageId = a1.id; object8.noCarousel = !isEmbedInline2; object8.mediaIndex = a3; object8.accessoryType = 'embed'; video = a0.video; object8.width = video.width; video = a0.video; object8.height = video.height; object8.channelId = a1.channel_id; getEmbedUrlBinding = getEmbedUrl; video = a0.video; object8.embedURI = getEmbedUrlBinding(video); object8.embedProviderName = value9; object8.disableDownload = true; Reflect.apply(push, object, [object8]); } if (object.length !== 0) { return object.length === 1 ? object[0] : object.length !== 2 ? value2 : [object[0], object[1]]; } return value2; } type = a0.type; if (type === 'rich') { if (r3) { object = []; thumbnail = a0.thumbnail; if (thumbnail != null) { getEmbedUrlBinding = getEmbedUrl; thumbnail = a0.thumbnail; embedUrlBinding = getEmbedUrlBinding(thumbnail); defaultImport3 = importDefault(1477) /* metro dependency 1477: ImageUtils */; getMobileOptimizedSrc = defaultImport3.getMobileOptimizedSrc; thumbnail = a0.thumbnail; width = thumbnail.width; thumbnail = a0.thumbnail; height = thumbnail.height; value12 = Reflect.apply(getMobileOptimizedSrc, defaultImport3, [embedUrlBinding, width, height]); push = object.push; object7 = {uri: value12, guildId: a4, spoiler: hasSpoilerEmbeds}; object7.flags = a0.flags; object7.obscure = isMediaObscuredForHarmTypes2; object7.contentScanVersion = embedContentScanVersion; getMediaContentTypeBinding = getMediaContentType; thumbnail = a0.thumbnail; object7.contentType = getMediaContentTypeBinding(thumbnail); object7.messageId = a1.id; object7.noCarousel = !isEmbedInline2; object7.mediaIndex = a3; object7.accessoryType = 'embed'; object7.channelId = a1.channel_id; thumbnail = a0.thumbnail; object7.sourceURI = thumbnail.url; thumbnail = a0.thumbnail; width = thumbnail.width; object7.width = width; thumbnail = a0.thumbnail; height = thumbnail.height; object7.height = height; Reflect.apply(push, object, [object7]); } r3 = r3 && a0.video != null; if (r3) { push = object.push; object8 = {uri: value7, guildId: a4, spoiler: hasSpoilerEmbeds}; object8.flags = a0.flags; object8.obscure = isMediaObscuredForHarmTypes2; object8.contentScanVersion = embedContentScanVersion; getMediaContentTypeBinding = getMediaContentType; video = a0.video; object8.contentType = getMediaContentTypeBinding(video); object8.sourceURI = a0.url; object8.messageId = a1.id; object8.noCarousel = !isEmbedInline2; object8.mediaIndex = a3; object8.accessoryType = 'embed'; video = a0.video; object8.width = video.width; video = a0.video; object8.height = video.height; object8.channelId = a1.channel_id; getEmbedUrlBinding = getEmbedUrl; video = a0.video; object8.embedURI = getEmbedUrlBinding(video); object8.embedProviderName = value9; object8.disableDownload = true; Reflect.apply(push, object, [object8]); } if (object.length !== 0) { return object.length === 1 ? object[0] : object.length !== 2 ? value2 : [object[0], object[1]]; } return value2; } object = {uri: value7}; object.messageId = a1.id; object.guildId = a4; object.channelId = a1.channel_id; object.mediaIndex = a3; width = embedMediaBinding.width; object.width = width; height = embedMediaBinding.height; object.height = height; object.sourceURI = embedMediaBinding.url; object.accessoryType = 'embed'; object.noCarousel = !isEmbedInline2; object.spoiler = hasSpoilerEmbeds; object.flags = a0.flags; object.obscure = isMediaObscuredForHarmTypes2; object.contentScanVersion = embedContentScanVersion; object.contentType = getMediaContentType(embedMediaBinding); object9 = {}; copyDataProperties(object9, object, undefined); object9['uri'] = embedUrl; return embedUrl === value7 ? object9 : [object, object9]; } type = a0.type; if (type !== 'article') { object = {uri: value7}; object.messageId = a1.id; object.guildId = a4; object.channelId = a1.channel_id; object.mediaIndex = a3; object.width = embedMediaBinding.width; object.height = embedMediaBinding.height; object.sourceURI = embedMediaBinding.url; object.accessoryType = 'embed'; object.noCarousel = !isEmbedInline2; object.spoiler = hasSpoilerEmbeds; object.flags = a0.flags; object.obscure = isMediaObscuredForHarmTypes2; object.contentScanVersion = embedContentScanVersion; object.contentType = getMediaContentType(embedMediaBinding); object9 = {}; copyDataProperties(object9, object, undefined); object9['uri'] = embedUrl; return embedUrl === value7 ? object9 : [object, object9]; } if (r3) { object = []; thumbnail = a0.thumbnail; if (thumbnail != null) { getEmbedUrlBinding = getEmbedUrl; thumbnail = a0.thumbnail; embedUrlBinding = getEmbedUrlBinding(thumbnail); defaultImport3 = importDefault(1477) /* metro dependency 1477: ImageUtils */; getMobileOptimizedSrc = defaultImport3.getMobileOptimizedSrc; thumbnail = a0.thumbnail; width = thumbnail.width; thumbnail = a0.thumbnail; height = thumbnail.height; value12 = Reflect.apply(getMobileOptimizedSrc, defaultImport3, [embedUrlBinding, width, height]); push = object.push; object7 = {uri: value12, guildId: a4, spoiler: hasSpoilerEmbeds}; object7.flags = a0.flags; object7.obscure = isMediaObscuredForHarmTypes2; object7.contentScanVersion = embedContentScanVersion; getMediaContentTypeBinding = getMediaContentType; thumbnail = a0.thumbnail; object7.contentType = getMediaContentTypeBinding(thumbnail); object7.messageId = a1.id; object7.noCarousel = !isEmbedInline2; object7.mediaIndex = a3; object7.accessoryType = 'embed'; object7.channelId = a1.channel_id; thumbnail = a0.thumbnail; object7.sourceURI = thumbnail.url; thumbnail = a0.thumbnail; width = thumbnail.width; object7.width = width; thumbnail = a0.thumbnail; height = thumbnail.height; object7.height = height; Reflect.apply(push, object, [object7]); } r3 = r3 && a0.video != null; if (r3) { push = object.push; object8 = {uri: value7, guildId: a4, spoiler: hasSpoilerEmbeds}; object8.flags = a0.flags; object8.obscure = isMediaObscuredForHarmTypes2; object8.contentScanVersion = embedContentScanVersion; getMediaContentTypeBinding = getMediaContentType; video = a0.video; object8.contentType = getMediaContentTypeBinding(video); object8.sourceURI = a0.url; object8.messageId = a1.id; object8.noCarousel = !isEmbedInline2; object8.mediaIndex = a3; object8.accessoryType = 'embed'; video = a0.video; object8.width = video.width; video = a0.video; object8.height = video.height; object8.channelId = a1.channel_id; getEmbedUrlBinding = getEmbedUrl; video = a0.video; object8.embedURI = getEmbedUrlBinding(video); object8.embedProviderName = value9; object8.disableDownload = true; Reflect.apply(push, object, [object8]); } if (object.length !== 0) { return object.length === 1 ? object[0] : object.length !== 2 ? value2 : [object[0], object[1]]; } return value2; } object = {uri: value7}; object.messageId = a1.id; object.guildId = a4; object.channelId = a1.channel_id; object.mediaIndex = a3; width = embedMediaBinding.width; object.width = width; height = embedMediaBinding.height; object.height = height; object.sourceURI = embedMediaBinding.url; object.accessoryType = 'embed'; object.noCarousel = !isEmbedInline2; object.spoiler = hasSpoilerEmbeds; object.flags = a0.flags; object.obscure = isMediaObscuredForHarmTypes2; object.contentScanVersion = embedContentScanVersion; object.contentType = getMediaContentType(embedMediaBinding); object9 = {}; copyDataProperties(object9, object, undefined); object9['uri'] = embedUrl; return embedUrl === value7 ? object9 : [object, object9]; } if (shouldPlayVideoInline2) { type = a0.type; if (type === 'video') { object = []; thumbnail = a0.thumbnail; if (thumbnail != null) { getEmbedUrlBinding = getEmbedUrl; thumbnail = a0.thumbnail; embedUrlBinding = getEmbedUrlBinding(thumbnail); defaultImport3 = defaultImport; getMobileOptimizedSrc = defaultImport3.getMobileOptimizedSrc; thumbnail = a0.thumbnail; width = thumbnail.width; thumbnail = a0.thumbnail; height = thumbnail.height; value12 = Reflect.apply(getMobileOptimizedSrc, defaultImport3, [embedUrlBinding, width, height]); push = object.push; object7 = {uri: value12, guildId: a4, spoiler: hasSpoilerEmbeds}; object7.flags = a0.flags; object7.obscure = isMediaObscuredForHarmTypes2; object7.contentScanVersion = embedContentScanVersion; getMediaContentTypeBinding = getMediaContentType; thumbnail = a0.thumbnail; object7.contentType = getMediaContentTypeBinding(thumbnail); object7.messageId = a1.id; object7.noCarousel = !isEmbedInline2; object7.mediaIndex = a3; object7.accessoryType = 'embed'; object7.channelId = a1.channel_id; thumbnail = a0.thumbnail; object7.sourceURI = thumbnail.url; thumbnail = a0.thumbnail; width = thumbnail.width; object7.width = width; thumbnail = a0.thumbnail; height = thumbnail.height; object7.height = height; Reflect.apply(push, object, [object7]); } r3 = r3 && a0.video != null; if (r3) { push = object.push; object8 = {uri: value7, guildId: a4, spoiler: hasSpoilerEmbeds}; object8.flags = a0.flags; object8.obscure = isMediaObscuredForHarmTypes2; object8.contentScanVersion = embedContentScanVersion; getMediaContentTypeBinding = getMediaContentType; video = a0.video; object8.contentType = getMediaContentTypeBinding(video); object8.sourceURI = a0.url; object8.messageId = a1.id; object8.noCarousel = !isEmbedInline2; object8.mediaIndex = a3; object8.accessoryType = 'embed'; video = a0.video; object8.width = video.width; video = a0.video; object8.height = video.height; object8.channelId = a1.channel_id; getEmbedUrlBinding = getEmbedUrl; video = a0.video; object8.embedURI = getEmbedUrlBinding(video); object8.embedProviderName = value9; object8.disableDownload = true; Reflect.apply(push, object, [object8]); } if (object.length !== 0) { return object.length === 1 ? object[0] : object.length !== 2 ? value2 : [object[0], object[1]]; } return value2; } type = a0.type; if (type === 'rich') { if (r3) { object = []; thumbnail = a0.thumbnail; if (thumbnail != null) { getEmbedUrlBinding = getEmbedUrl; thumbnail = a0.thumbnail; embedUrlBinding = getEmbedUrlBinding(thumbnail); defaultImport3 = importDefault(1477) /* metro dependency 1477: ImageUtils */; getMobileOptimizedSrc = defaultImport3.getMobileOptimizedSrc; thumbnail = a0.thumbnail; width = thumbnail.width; thumbnail = a0.thumbnail; height = thumbnail.height; value12 = Reflect.apply(getMobileOptimizedSrc, defaultImport3, [embedUrlBinding, width, height]); push = object.push; object7 = {uri: value12, guildId: a4, spoiler: hasSpoilerEmbeds}; object7.flags = a0.flags; object7.obscure = isMediaObscuredForHarmTypes2; object7.contentScanVersion = embedContentScanVersion; getMediaContentTypeBinding = getMediaContentType; thumbnail = a0.thumbnail; object7.contentType = getMediaContentTypeBinding(thumbnail); object7.messageId = a1.id; object7.noCarousel = !isEmbedInline2; object7.mediaIndex = a3; object7.accessoryType = 'embed'; object7.channelId = a1.channel_id; thumbnail = a0.thumbnail; object7.sourceURI = thumbnail.url; thumbnail = a0.thumbnail; width = thumbnail.width; object7.width = width; thumbnail = a0.thumbnail; height = thumbnail.height; object7.height = height; Reflect.apply(push, object, [object7]); } r3 = r3 && a0.video != null; if (r3) { push = object.push; object8 = {uri: value7, guildId: a4, spoiler: hasSpoilerEmbeds}; object8.flags = a0.flags; object8.obscure = isMediaObscuredForHarmTypes2; object8.contentScanVersion = embedContentScanVersion; getMediaContentTypeBinding = getMediaContentType; video = a0.video; object8.contentType = getMediaContentTypeBinding(video); object8.sourceURI = a0.url; object8.messageId = a1.id; object8.noCarousel = !isEmbedInline2; object8.mediaIndex = a3; object8.accessoryType = 'embed'; video = a0.video; object8.width = video.width; video = a0.video; object8.height = video.height; object8.channelId = a1.channel_id; getEmbedUrlBinding = getEmbedUrl; video = a0.video; object8.embedURI = getEmbedUrlBinding(video); object8.embedProviderName = value9; object8.disableDownload = true; Reflect.apply(push, object, [object8]); } if (object.length !== 0) { return object.length === 1 ? object[0] : object.length !== 2 ? value2 : [object[0], object[1]]; } return value2; } object = {uri: value7}; object.messageId = a1.id; object.guildId = a4; object.channelId = a1.channel_id; object.mediaIndex = a3; width = embedMediaBinding.width; object.width = width; height = embedMediaBinding.height; object.height = height; object.sourceURI = embedMediaBinding.url; object.accessoryType = 'embed'; object.noCarousel = !isEmbedInline2; object.spoiler = hasSpoilerEmbeds; object.flags = a0.flags; object.obscure = isMediaObscuredForHarmTypes2; object.contentScanVersion = embedContentScanVersion; object.contentType = getMediaContentType(embedMediaBinding); object9 = {}; copyDataProperties(object9, object, undefined); object9['uri'] = embedUrl; return embedUrl === value7 ? object9 : [object, object9]; } type = a0.type; if (type !== 'article') { object = {uri: value7}; object.messageId = a1.id; object.guildId = a4; object.channelId = a1.channel_id; object.mediaIndex = a3; object.width = embedMediaBinding.width; object.height = embedMediaBinding.height; object.sourceURI = embedMediaBinding.url; object.accessoryType = 'embed'; object.noCarousel = !isEmbedInline2; object.spoiler = hasSpoilerEmbeds; object.flags = a0.flags; object.obscure = isMediaObscuredForHarmTypes2; object.contentScanVersion = embedContentScanVersion; object.contentType = getMediaContentType(embedMediaBinding); object9 = {}; copyDataProperties(object9, object, undefined); object9['uri'] = embedUrl; return embedUrl === value7 ? object9 : [object, object9]; } if (r3) { object = []; thumbnail = a0.thumbnail; if (thumbnail != null) { getEmbedUrlBinding = getEmbedUrl; thumbnail = a0.thumbnail; embedUrlBinding = getEmbedUrlBinding(thumbnail); defaultImport3 = importDefault(1477) /* metro dependency 1477: ImageUtils */; getMobileOptimizedSrc = defaultImport3.getMobileOptimizedSrc; thumbnail = a0.thumbnail; width = thumbnail.width; thumbnail = a0.thumbnail; height = thumbnail.height; value12 = Reflect.apply(getMobileOptimizedSrc, defaultImport3, [embedUrlBinding, width, height]); push = object.push; object7 = {uri: value12, guildId: a4, spoiler: hasSpoilerEmbeds}; object7.flags = a0.flags; object7.obscure = isMediaObscuredForHarmTypes2; object7.contentScanVersion = embedContentScanVersion; getMediaContentTypeBinding = getMediaContentType; thumbnail = a0.thumbnail; object7.contentType = getMediaContentTypeBinding(thumbnail); object7.messageId = a1.id; object7.noCarousel = !isEmbedInline2; object7.mediaIndex = a3; object7.accessoryType = 'embed'; object7.channelId = a1.channel_id; thumbnail = a0.thumbnail; object7.sourceURI = thumbnail.url; thumbnail = a0.thumbnail; width = thumbnail.width; object7.width = width; thumbnail = a0.thumbnail; height = thumbnail.height; object7.height = height; Reflect.apply(push, object, [object7]); } r3 = r3 && a0.video != null; if (r3) { push = object.push; object8 = {uri: value7, guildId: a4, spoiler: hasSpoilerEmbeds}; object8.flags = a0.flags; object8.obscure = isMediaObscuredForHarmTypes2; object8.contentScanVersion = embedContentScanVersion; getMediaContentTypeBinding = getMediaContentType; video = a0.video; object8.contentType = getMediaContentTypeBinding(video); object8.sourceURI = a0.url; object8.messageId = a1.id; object8.noCarousel = !isEmbedInline2; object8.mediaIndex = a3; object8.accessoryType = 'embed'; video = a0.video; object8.width = video.width; video = a0.video; object8.height = video.height; object8.channelId = a1.channel_id; getEmbedUrlBinding = getEmbedUrl; video = a0.video; object8.embedURI = getEmbedUrlBinding(video); object8.embedProviderName = value9; object8.disableDownload = true; Reflect.apply(push, object, [object8]); } if (object.length !== 0) { return object.length === 1 ? object[0] : object.length !== 2 ? value2 : [object[0], object[1]]; } return value2; } object = {uri: value7}; object.messageId = a1.id; object.guildId = a4; object.channelId = a1.channel_id; object.mediaIndex = a3; width = embedMediaBinding.width; object.width = width; height = embedMediaBinding.height; object.height = height; object.sourceURI = embedMediaBinding.url; object.accessoryType = 'embed'; object.noCarousel = !isEmbedInline2; object.spoiler = hasSpoilerEmbeds; object.flags = a0.flags; object.obscure = isMediaObscuredForHarmTypes2; object.contentScanVersion = embedContentScanVersion; object.contentType = getMediaContentType(embedMediaBinding); object9 = {}; copyDataProperties(object9, object, undefined); object9['uri'] = embedUrl; return embedUrl === value7 ? object9 : [object, object9]; } object = {uri: value7}; object.messageId = a1.id; object.guildId = a4; object.channelId = a1.channel_id; object.mediaIndex = a3; object.videoURI = r15; object.embedURI = a0.url; object.width = embedMediaBinding.width; object.height = embedMediaBinding.height; object.isGIFV = type === 'gifv'; object.sourceURI = embedMediaBinding.url; provider = a0.provider; object.embedProviderName = provider == null ? value2 : provider.name; object.accessoryType = 'embed'; object.noCarousel = !isEmbedInline2; object.spoiler = hasSpoilerEmbeds; object.flags = a0.flags; object.contentScanVersion = embedContentScanVersion; object.contentType = getMediaContentType(embedMediaBinding); object.obscure = isMediaObscuredForHarmTypes2; thumbnail = a0.thumbnail; if (thumbnail != null) { object6 = {}; thumbnail = a0.thumbnail; object6.width = thumbnail.width; thumbnail = a0.thumbnail; object6.height = thumbnail.height; thumbnail = a0.thumbnail; object6.uri = thumbnail.url; r15 = object6; } else { r15 = value2; } object.thumbnail = r15; return object; } function toMediaSourceFromUnfurledMedia(a0, a1, a2, a3, a4) { // fn#74507, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:6441, offset: 0x01d903de, size: 528 bytes, params: 6, frame: 26 var object5; var r1; var object4; const value2 = undefined; const unfurledMediaItemType = (require(8355) /* metro dependency 8355: transformMessageComponents */).getUnfurledMediaItemType(a2); const MediaGalleryItemType = (require(8368) /* metro dependency 8368: RowGeneratorTypes */).MediaGalleryItemType; const VISUAL_PLACEHOLDER = MediaGalleryItemType.VISUAL_PLACEHOLDER; if (unfurledMediaItemType === VISUAL_PLACEHOLDER) { return null; } const VIDEO = MediaGalleryItemType.VIDEO; const value4 = unfurledMediaItemType === VIDEO; const defaultImport = importDefault(1477) /* metro dependency 1477: ImageUtils */; const getMobileOptimizedSrc = defaultImport.getMobileOptimizedSrc; let proxyUrl = a2.proxyUrl; const width = a2.width; const value5 = 0; const r6 = width ?? value5; const r5 = a2.height ?? value5; const value7 = Reflect.apply(getMobileOptimizedSrc, defaultImport, [proxyUrl, r6, r5, value4 ? 'png' : value2]); const contentScanMetadata = a2.contentScanMetadata; const version = contentScanMetadata == null ? value2 : contentScanMetadata.version; let value = require(4838) /* metro dependency 4838: ObscuredMediaUtils */; value = value.getEnabledHarmTypesForMessage(a0); const obscuredMediaUtilsModule = require(4838) /* metro dependency 4838: ObscuredMediaUtils */; const isMediaObscuredForHarmTypes = obscuredMediaUtilsModule.isMediaObscuredForHarmTypes; const ObscuredMediaTypes = (require(4841) /* metro dependency 4841: ExplicitMediaRedactionModels */).ObscuredMediaTypes; const GenericMedia = ObscuredMediaTypes.GenericMedia; value = Reflect.apply(isMediaObscuredForHarmTypes, obscuredMediaUtilsModule, [{type: GenericMedia, media: a2}, value]); object5 = {}; object5.messageId = a0.id; object5.guildId = a1; object5.channelId = a0.channel_id; object5.uri = value7; object5.sourceURI = a2.url; object5.width = a2.width ?? value5; object5.height = a2.height ?? value5; object5.contentType = a2.contentType; object5.description = a3; object5.spoiler = a4; object5.obscure = value; object5.contentScanVersion = version; object5.accessoryType = 'component'; object5.mediaIndex = value5; const object6 = {}; copyDataProperties(object6, object5, r5); proxyUrl = a2.proxyUrl; if (value4) { object6['videoURI'] = proxyUrl; return object6; } object6['uri'] = proxyUrl; if (a2.proxyUrl === value7) { r1 = object6; } else { object4 = {}; copyDataProperties(object4, object5, r5); r1 = [object4, object6]; } return r1; } function handleDownloadError() { // fn#74508, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:7314, offset: 0x01d905ee, size: 150 bytes, params: 1, frame: 18 const defaultImport = importDefault(4496) /* metro dependency 4496: AlertActionCreators */; const show = defaultImport.show; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; const string = intl.string; const t = (require(1244) /* metro dependency 1244: indexNative */).t; Reflect.apply(show, defaultImport, [{title: Reflect.apply(string, intl, [t.cV3alD]), body: intl.string(t.r4Zjzv), isDismissable: true}]); } function downloadMediaAssetWithContentType(a0, a1, a2) { // fn#74509, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:7476, offset: 0x01d90684, size: 101 bytes, params: 4, frame: 17 const env0_0 = a1; const r3 = a2 != null ? NativeModules.MediaManager.downloadMediaAssetWithContentType(a0, a1, a2) : NativeModules.MediaManager.downloadMediaAsset(a0, a1); return r3.then(_fun74510, handleDownloadError); } function isAnimatedWebpSource(a0) { // fn#74511, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:8136, offset: 0x01d907e2, size: 143 bytes, params: 2, frame: 15 var uri; var moduleValue; var URL; var uRL; let r0 = a0.sourceURI != null && a0.uri != null; if (r0) { moduleValue = require(4631) /* metro dependency 4631: MediaFormatTesters */; r0 = moduleValue.urlMatchesFileExtension(a0.sourceURI, WEBP_RE_IOS); } if (r0) { URL = global.URL; uri = a0.uri; uRL = new URL(); uRL = uRL.searchParams.get('animated'); uRL = uRL === 'true'; r0 = uRL; } return r0; } function isAnimatedAvifSource(a0) { // fn#74512, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:8310, offset: 0x01d90871, size: 143 bytes, params: 2, frame: 15 var uri; var moduleValue; var URL; var uRL; let r0 = a0.sourceURI != null && a0.uri != null; if (r0) { moduleValue = require(4631) /* metro dependency 4631: MediaFormatTesters */; r0 = moduleValue.urlMatchesFileExtension(a0.sourceURI, env0_7); } if (r0) { URL = global.URL; uri = a0.uri; uRL = new URL(); uRL = uRL.searchParams.get('animated'); uRL = uRL === 'true'; r0 = uRL; } return r0; } function isGIFSource({sourceURI}) { // fn#74513, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:8484, offset: 0x01d90900, size: 66 bytes, params: 2, frame: 16 const mediaFormatTestersModule = require(4631) /* metro dependency 4631: MediaFormatTesters */; const urlMatchesFileExtension = mediaFormatTestersModule.urlMatchesFileExtension; const GIF_RE_IOS = (require(676) /* metro dependency 676: ConstantsIOS */).GIF_RE_IOS; return Reflect.apply(urlMatchesFileExtension, mediaFormatTestersModule, [sourceURI, GIF_RE_IOS]); } function extractMediaFromMessageComponents(a0, a1, a2) { // fn#74514, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:9155, offset: 0x01d90942, size: 511 bytes, params: 4, frame: 38 var r7; var r20; var property; var type; const ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType; var MEDIA_GALLERY; var THUMBNAIL; var toMediaSourceFromUnfurledMediaBinding; var media; var description; var spoiler; var push; var _createForOfIteratorHelperLoose_74491Binding; var items3; var value5; var done; var value6; var value7; var value8; let length = a1.components.length; let value = 0; if (value === length) { return []; } const items4 = []; const interactionComponentUtilsModule = require(4627) /* metro dependency 4627: InteractionComponentUtils */; const value4 = interactionComponentUtilsModule.flattenComponents(a1.components).values(); const items2 = []; arraySpread(items2, value4, value, undefined); length = items2.length; if (value < length) { r7 = value; while (true) { property = items2[r7]; type = property.type; MEDIA_GALLERY = ComponentType.MEDIA_GALLERY; if (MEDIA_GALLERY !== type) { THUMBNAIL = ComponentType.THUMBNAIL; if (THUMBNAIL !== type) { break; } toMediaSourceFromUnfurledMediaBinding = toMediaSourceFromUnfurledMedia; media = property.media; description = property.description; spoiler = property.spoiler; value = toMediaSourceFromUnfurledMediaBinding(a0, a2, media, description, spoiler); if (value == null) { break; } push = items4.push; media = property.media; Reflect.apply(push, items4, [{sources: value, unfurledMediaItem: media}]); break; } _createForOfIteratorHelperLoose_74491Binding = _createForOfIteratorHelperLoose_74491; items3 = property.items; value = _createForOfIteratorHelperLoose_74491Binding(items3); value5 = value(); done = value5.done; if (done) { break; } r20 = value5; while (true) { value6 = r20.value; toMediaSourceFromUnfurledMediaBinding = toMediaSourceFromUnfurledMedia; media = value6.media; description = value6.description; spoiler = value6.spoiler; value7 = toMediaSourceFromUnfurledMediaBinding(a0, a2, media, description, spoiler); if (value7 != null) { push = items4.push; media = value6.media; Reflect.apply(push, items4, [{sources: value7, unfurledMediaItem: media}]); } value8 = value(); done = value8.done; if (done) { break; } r20 = value8; continue; } value = typeof r7 === 'bigint' ? r7 + 1n : +r7 + 1; length = items2.length; if (value < length) { r7 = value; continue; } break; } } return items4; } function extractMediaSourcesFromEmbed(a0, a1, a2, a3, a4) { // fn#74515, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:9826, offset: 0x01d90b41, size: 129 bytes, params: 6, frame: 16 const env0_0 = a0; const env0_1 = a2; const env0_2 = a3; const env0_3 = a4; const env0_4 = (importDefault(8349) /* metro dependency 8349: renderMessageMarkup */)(a0, {contentMessage: a1}).hasSpoilerEmbeds; return (a2.images ?? [a2.image]).map(_fun74516); } function extractMediaSourcesFromComponent(a0, a1, a2, a3, a4) { // fn#74517, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:10749, offset: 0x01d90d64, size: 340 bytes, params: 6, frame: 24 let value = a4; const env0_0 = a0; const env0_1 = a2; const value4 = (require(4627) /* metro dependency 4627: InteractionComponentUtils */).flattenComponents(a1).get(a3); const value5 = null; if (value5 != value4) { var type = value4.type; var ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType; var MEDIA_GALLERY = ComponentType.MEDIA_GALLERY; if (MEDIA_GALLERY === type) { var env0_2 = value5 != value && value <= value4.items.length ? value : 0; value = value4.items.map(_fun74518); value = value.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish); return {initialIndex: env0_2, sources: value}; } var THUMBNAIL = ComponentType.THUMBNAIL; if (THUMBNAIL === type) { value = toMediaSourceFromUnfurledMedia(a0, a2, value4.media, value4.description, value4.spoiler); return value5 == value ? value5 : {initialIndex: 0, sources: [value]}; } } return value5; } function extractMediaSourcesFromMessage(a0, a1, a2, a3) { // fn#74519, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:11379, offset: 0x01d90f09, size: 326 bytes, params: 5, frame: 28 var r11; var r12; var r14; var r6; var property; var value3; var push; var value4; var value5; var has; var type; const items2 = []; let attachments = a1.attachments; let length = attachments.length; let value = 0; if (value < length) { r11 = value; r12 = value; reducibleLoop1: while (true) { attachments = a1.attachments; property = attachments[r11]; reducibleJoin5: while (true) { reducibleJoin3: while (true) { if (isValidImageAttachment(property)) { break reducibleJoin3; } if (isValidVideoAttachment(property)) { break reducibleJoin3; } break reducibleJoin5; } value3 = extractMediaFromAttachment(property, a0, r11, a2, r12); if (value3 == null) { break reducibleJoin5; } push = items2.push; Reflect.apply(push, items2, [value3]); break reducibleJoin5; } reducibleJoin7: while (true) { if (isThumbnailAttachment(property)) { r14 = r12; break reducibleJoin7; } value4 = r12 + 1; r14 = value4; break reducibleJoin7; } value5 = typeof r11 === 'bigint' ? r11 + 1n : +r11 + 1; attachments = a1.attachments; length = attachments.length; if (value5 < length) { r11 = value5; r12 = r14; continue reducibleLoop1; } break reducibleLoop1; } } let embeds = a1.embeds; length = embeds.length; if (value < length) { r6 = value; reducibleLoop9: while (true) { embeds = a1.embeds; property = embeds[r6]; reducibleJoin15: while (true) { reducibleJoin13: while (true) { if (a3 == null) { if (isValidImageEmbed(property)) { break reducibleJoin13; } if (isValidVideoEmbed(property)) { break reducibleJoin13; } break reducibleJoin15; } has = a3.has; type = property.type; if (Reflect.apply(has, a3, [type])) { if (isValidImageEmbed(property)) { break reducibleJoin13; } if (isValidVideoEmbed(property)) { break reducibleJoin13; } break reducibleJoin15; } break reducibleJoin15; } value = extractMediaFromEmbed(property, a0, a1, r6, a2); if (value == null) { break reducibleJoin15; } push = items2.push; Reflect.apply(push, items2, [value]); break reducibleJoin15; } value = typeof r6 === 'bigint' ? r6 + 1n : +r6 + 1; embeds = a1.embeds; length = embeds.length; if (value < length) { r6 = value; continue reducibleLoop9; } break reducibleLoop9; } } return items2; } function setMediaSourcePortal(a0, a1) { // fn#74520, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:11874, offset: 0x01d9104f, size: 81 bytes, params: 3, frame: 14 var Array; const value = flattenSource(a0); if (!(value == null || value.obscure)) { Array = global.Array; if (Array.isArray(a0)) { a0[0].portal = a1; } else { a0.portal = a1; } } } function useSelectedMediaSource(a0) { // fn#74522, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:12219, offset: 0x01d9110a, size: 102 bytes, params: 2, frame: 15 const env0_0 = a0; const value2 = (importDefault(8621) /* metro dependency 8621: useStateFromSharedValue */)(a0.index); const binding = env0_3; const useMemo = binding.useMemo; let items2 = [a0.sources, value2]; items2 = [value2, Reflect.apply(useMemo, binding, [_fun74523, items2])]; return items2; } function getYoutubeVideoIdFromURI(a0) { // fn#74526, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:12967, offset: 0x01d9126d, size: 151 bytes, params: 2, frame: 14 var r1; var r0; var object2; const value = a0.match(RegExp('^https:\\/\\/www\\.youtube\\.com\\/embed\\/([A-Za-z0-9_-]*)(\\?start=([0-9]+))?$', '')); const value2 = null; if (value2 == value) { r0 = value2; } else if (value2 == value[1]) { r0 = value2; } else if (value[1].length !== 11) { r0 = value2; } else { if (value.length !== 4) { r1 = {videoId: value[1]}; } else if (value2 != value[3]) { object2 = {videoId: value[1]}; object2.start = global.Number(value[3]); r1 = object2; } else { r1 = {videoId: value[1]}; } r0 = r1; } return r0; } function getVideoSourceType(a0) { // fn#74527, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:13263, offset: 0x01d91304, size: 201 bytes, params: 2, frame: 15 var r0; var moduleValue; var moduleValue2; if (a0.videoURI == null) { if (a0.portal == null) { r0 = a0.embedURI == null ? env0_8.DEFAULT : a0.embedProviderName === 'TikTok' ? env0_8.TIKTOK_IFRAME : env0_8.DEFAULT; } else { moduleValue2 = require(9548) /* metro dependency 9548: NativePortalView */; r0 = moduleValue2.isPortalExpired(a0.portal) ? a0.embedURI == null ? env0_8.DEFAULT : a0.embedProviderName === 'TikTok' ? env0_8.TIKTOK_IFRAME : env0_8.DEFAULT : env0_8.PORTAL; } } else { moduleValue = require(4631) /* metro dependency 4631: MediaFormatTesters */; if (moduleValue.isWebPlayerVideoUrl(a0.videoURI)) { r0 = env0_8.WEB_FILE_IFRAME; } else if (a0.portal == null) { r0 = a0.embedURI == null ? env0_8.DEFAULT : a0.embedProviderName === 'TikTok' ? env0_8.TIKTOK_IFRAME : env0_8.DEFAULT; } else { moduleValue2 = require(9548) /* metro dependency 9548: NativePortalView */; r0 = moduleValue2.isPortalExpired(a0.portal) ? a0.embedURI == null ? env0_8.DEFAULT : a0.embedProviderName === 'TikTok' ? env0_8.TIKTOK_IFRAME : env0_8.DEFAULT : env0_8.PORTAL; } } return r0; } function isAnimatedImageSource(a0) { // fn#74529, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:13818, offset: 0x01d91410, size: 43 bytes, params: 2, frame: 13 let r0 = isGIFSource(a0) || isAnimatedWebpSource(a0); r0 = !r0 ? isAnimatedAvifSource(a0) : r0; return r0; } function _fun74510() { // fn#74510, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:7643, offset: 0x01d906e9, size: 249 bytes, params: 1, frame: 14 const MediaType = (require(676) /* metro dependency 676: ConstantsIOS */).MediaType; const IMAGE = MediaType.IMAGE; if (IMAGE === require) { (require(3856) /* metro dependency 3856: ToastUtils */).presentImageSaved(); } else if (MediaType.GIF === require) { (require(3856) /* metro dependency 3856: ToastUtils */).presentGifSaved(); } else if (MediaType.VIDEO === require) { (require(3856) /* metro dependency 3856: ToastUtils */).presentVideoSaved(); } const MediaViewerAnalytics = (require(9547) /* metro dependency 9547: MediaViewerAnalyticsManager */).MediaViewerAnalytics; MediaViewerAnalytics.trackMediaViewerDownloadButtonTapped(); } function _fun74516(a0) { // fn#74516, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:9976, offset: 0x01d90bc2, size: 418 bytes, params: 2, frame: 25 let value = environment.__proto__; const embedUrl = getEmbedUrl(a0); const mobileOptimizedSrc = (importDefault(1477) /* metro dependency 1477: ImageUtils */).getMobileOptimizedSrc(embedUrl, a0.width, a0.height); const embedContentScanVersion = getEmbedContentScanVersion(importDefault); const getEnabledHarmTypesForMessage = (require(4838) /* metro dependency 4838: ObscuredMediaUtils */).getEnabledHarmTypesForMessage; const binding = env0_0; value = Reflect.apply(getEnabledHarmTypesForMessage, value, [binding]); const obscuredMediaUtilsModule = require(4838) /* metro dependency 4838: ObscuredMediaUtils */; const getMediaObscuredReasonFromBitmask = obscuredMediaUtilsModule.getMediaObscuredReasonFromBitmask; const ObscuredMediaTypes = (require(4841) /* metro dependency 4841: ExplicitMediaRedactionModels */).ObscuredMediaTypes; const Embed = ObscuredMediaTypes.Embed; value = Reflect.apply(getMediaObscuredReasonFromBitmask, obscuredMediaUtilsModule, [{type: Embed, media: importDefault}, value]).length > 0; const binding2 = env0_3; const hasSpoilerEmbedsBinding = hasSpoilerEmbeds; return [{uri: mobileOptimizedSrc, messageId: binding.id, guildId: binding2, channelId: binding.channel_id, mediaIndex: importAll, width: a0.width, height: a0.height, sourceURI: a0.url, accessoryType: 'embed', noCarousel: false, spoiler: hasSpoilerEmbedsBinding, flags: importDefault.flags, obscure: value, contentScanVersion: embedContentScanVersion, contentType: a0.contentType}, {uri: embedUrl, messageId: binding.id, guildId: binding2, channelId: binding.channel_id, mediaIndex: importAll, width: a0.width, height: a0.height, sourceURI: a0.url, accessoryType: 'embed', noCarousel: false, spoiler: hasSpoilerEmbedsBinding, contentType: a0.contentType, flags: importDefault.flags, obscure: value, contentScanVersion: embedContentScanVersion}]; } function _fun74518({media, description, spoiler}, a1) { // fn#74518, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:10979, offset: 0x01d90eb8, size: 81 bytes, params: 3, frame: 20 return toMediaSourceFromUnfurledMedia(env0_0, importDefault, media, description, spoiler) ?? (a1 < env0_2 ? null : null); } function _fun74523() { // fn#74523, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9732:12293, offset: 0x01d91170, size: 112 bytes, params: 1, frame: 13 if (env0_1 < 0) { return null; } if (env0_1 >= env0_0.sources.length) { return null; } const property = env0_0.sources[env0_1]; const value = null; return value == property ? value : global.Array.isArray(property) ? property[property.length - 1] : property; }