/* Metro module 5266; source: modules/safety_hub/SafetyHubUtils.tsx; dependencies: [1226, 5267, 661, 4503, 3738, 4631, 1244, 5268, 566, 2] */ import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */ import Module03738 from '../../by-id/module-03738.js'; /* Metro dependency 3738 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */ import * as MessageConstantsModule from '../messages/MessageConstants.tsx'; /* Metro dependency 4503 */ import * as MediaFormatTestersModule from '../messages/MediaFormatTesters.tsx'; /* Metro dependency 4631 */ import * as SafetyHubConstantsModule from './SafetyHubConstants.tsx'; /* Metro dependency 5267 */ import * as SafetyHubModelsModule from './SafetyHubModels.tsx'; /* Metro dependency 5268 */ function _fun46833(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#46833, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:6, offset: 0x011b0031, size: 340 bytes, params: 8, frame: 20 const env0_0 = require; const parseMessageEmbedForProps2 = parseMessageEmbedForProps; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/safety_hub/SafetyHubUtils.tsx'); exports.getClassificationRelativeIncidentTime = getClassificationRelativeIncidentTime; exports.getAttachmentFilename = getAttachmentFilename; exports.parseMessageForProps = function(a0) { return parseMessageEmbedForProps(a0.embeds[0]); }; exports.parseMessageEmbedForProps = parseMessageEmbedForProps2; exports.mapCtaToNativeData = mapCtaToNativeData; exports.isFlaggedContentEmpty = isFlaggedContentEmpty; exports.getAppealSignalDisplayText = getAppealSignalDisplayText; exports.capitalizeText = function(a0) { var r1; var r0; var value = ''; if (a0 == null) { r0 = value; } else if (a0.length === 0) { r0 = value; } else { if (a0.length === 1) { r1 = a0.toUpperCase(); } else { value = value + a0.charAt(0).toUpperCase() + a0.slice(1); r1 = value; } r0 = r1; } return r0; }; exports.isGuildClassification = function(a0) { return a0 != null && a0.guild_metadata != null; }; exports.getRequestReviewErrorFromCode = getRequestReviewErrorFromCode; exports.getClassificationExpiration = function({max_expiration_time}) { var Date; var prototype; var value; var value2; var error; if (max_expiration_time == null) { return null; } try { Date = global.Date; prototype = Date.prototype; value = Object.create(prototype, {constructor: {value: Date}}); value2 = new Date(max_expiration_time); value = value2 instanceof Object ? value2 : value; } catch (error) { return null; } return value; }; exports.useIsSuspendedUser = useIsSuspendedUser; exports.isCurrentUserSuspended = isCurrentUserSuspended; function parseMessageEmbedForProps(a0) { // fn#46834, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:273, offset: 0x011b0185, size: 298 bytes, params: 2, frame: 18 var r5; var value; var object; var property; var value3; var parseFloat; if (a0.fields != null) { value = a0.fields.reduce(function(a0, a1) { a0[a1.rawName] = a1.rawValue; return a0; }, {}); object = {}; property = value[SafetySystemNotificationEmbedKeys.HEADER]; value3 = ''; r5 = property ?? value3; object.header = r5; object.icon = value[SafetySystemNotificationEmbedKeys.ICON_TYPE]; property = value[SafetySystemNotificationEmbedKeys.BODY]; r5 = property ?? value3; object.body = r5; property = value[SafetySystemNotificationEmbedKeys.CTAS]; object.ctas = (property ?? value3).split(',').filter(_fun46836); parseFloat = global.parseFloat; property = value[SafetySystemNotificationEmbedKeys.TIMESTAMP]; object.timestamp = parseFloat(property ?? 0); object.theme = value[SafetySystemNotificationEmbedKeys.THEME]; object.learn_more_link = value[SafetySystemNotificationEmbedKeys.LEARN_MORE_LINK]; object.classification_id = value[SafetySystemNotificationEmbedKeys.CLASSIFICATION_ID]; return object; } } function getClassificationRelativeIncidentTime(a0) { // fn#46837, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:818, offset: 0x011b02c7, size: 58 bytes, params: 2, frame: 14 const value = (Module03738)(); return value.to((Module03738)(a0)); } function getAttachmentFilename(a0) { // fn#46838, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:925, offset: 0x011b0301, size: 162 bytes, params: 2, frame: 16 var r0; var moduleValue2; var isVideoFile; var value; const isImageFile = MediaFormatTestersModule.isImageFile; let filename = a0.filename; if (Reflect.apply(isImageFile, MediaFormatTestersModule, [filename])) { filename = a0.filename; value = '.png'; value = '' + SPOILER_ATTACHMENT_PREFIX + (filename ?? value); r0 = value; } else { moduleValue2 = MediaFormatTestersModule; isVideoFile = moduleValue2.isVideoFile; filename = a0.filename; if (Reflect.apply(isVideoFile, moduleValue2, [filename])) { filename = a0.filename; value = '.png'; value = '' + SPOILER_ATTACHMENT_PREFIX + (filename ?? value); r0 = value; } else { r0 = a0.filename ?? ''; } } return r0; } function mapCtaToNativeData(a0, a1, a2) { // fn#46840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:1283, offset: 0x011b03c2, size: 246 bytes, params: 4, frame: 18 var object; const intl = (IndexNativeModule).intl; const t = (IndexNativeModule).t; const value = a1; const value2 = a2; const LEARN_MORE_LINK = SafetySystemNotificationCtaType.LEARN_MORE_LINK; if (LEARN_MORE_LINK === a0) { object = {}; object.text = intl.string(t['8/GdRB']); object.type = SafetySystemNotificationCtaType.LEARN_MORE_LINK; object.key = value ?? ''; return object; } const POLICY_VIOLATION_DETAIL = SafetySystemNotificationCtaType.POLICY_VIOLATION_DETAIL; if (POLICY_VIOLATION_DETAIL === a0) { return {text: intl.string(t.QsqdXC), type: SafetySystemNotificationCtaType.POLICY_VIOLATION_DETAIL, key: value2 ?? ''}; } } function isFlaggedContentEmpty(a0) { // fn#46841, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:1616, offset: 0x011b04b8, size: 90 bytes, params: 2, frame: 13 const type = a0.type; const ContentIdType = (SafetyHubModelsModule).ContentIdType; const MESSAGE = ContentIdType.MESSAGE; return type !== MESSAGE || a0.content === '' && a0.attachments.length === 0; } function getAppealSignalDisplayText(a0) { // fn#46842, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:1768, offset: 0x011b0512, size: 259 bytes, params: 2, frame: 18 const object = {}; const DIDNT_VIOLATE_POLICY = AppealIngestionSignal.DIDNT_VIOLATE_POLICY; const intl = (IndexNativeModule).intl; let string = intl.string; const t = (IndexNativeModule).t; object[DIDNT_VIOLATE_POLICY] = Reflect.apply(string, intl, [t.mZffAi]); const TOO_STRICT_UNFAIR = AppealIngestionSignal.TOO_STRICT_UNFAIR; object[TOO_STRICT_UNFAIR] = intl.string(t.wgZVAn); const DONT_AGREE_PENALTY = AppealIngestionSignal.DONT_AGREE_PENALTY; object[DONT_AGREE_PENALTY] = intl.string(t.eu8G4k); const SOMETHING_ELSE = AppealIngestionSignal.SOMETHING_ELSE; string = intl.string; const XU3s6r = t.XU3s6r; object[SOMETHING_ELSE] = Reflect.apply(string, intl, [XU3s6r]); return object[a0]; } function getRequestReviewErrorFromCode(a0) { // fn#46845, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:2267, offset: 0x011b069d, size: 142 bytes, params: 2, frame: 15 const intl = (IndexNativeModule).intl; const t = (IndexNativeModule).t; const DSA_APPEAL_REQUEST_DEFLECTION = AbortCodes.DSA_APPEAL_REQUEST_DEFLECTION; return a0 === DSA_APPEAL_REQUEST_DEFLECTION ? intl.string(t['0qyXXH']) : intl.string(t.aPmsx3); } function useIsSuspendedUser() { // fn#46847, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:2573, offset: 0x011b0766, size: 63 bytes, params: 1, frame: 13 const useStateFromStores = FluxModule.useStateFromStores; return Reflect.apply(useStateFromStores, FluxModule, [[AuthenticationStore], function() { return AuthenticationStore.getSuspendedUserToken(); }]) != null; } function isCurrentUserSuspended() { // fn#46849, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5444:2672, offset: 0x011b07b8, size: 25 bytes, params: 1, frame: 9 return AuthenticationStore.getSuspendedUserToken() != null; } } function _fun46836(a0) { // fn#46836, offset: 0x00c5f3a9, size: 13 bytes, params: 2, frame: 2 return a0 !== ''; } global.__d(_fun46833, 5266, [1226, 5267, 661, 4503, 3738, 4631, 1244, 5268, 566, 2]) /* metro module 5266, dependencies: [1226, 5267, 661, 4503, 3738, 4631, 1244, 5268, 566, 2] */;