/* Metro module 7141; source: modules/messages/createMessage.tsx; dependencies: [4833, 1885, 1878, 661, 44, 7142, 2] */ function _fun57133(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57133, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7319:6, offset: 0x013dd58b, size: 255 bytes, params: 8, frame: 20 const env0_0 = require; const closure = function({id, username, avatar, discriminator, bot, globalName, primaryGuild}) { return {id: id, username: username, avatar: avatar, discriminator: discriminator, bot: bot, global_name: globalName, primary_guild: primaryGuild}; }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const referencedMessageStore = importDefault(4833) /* metro dependency 4833: ReferencedMessageStore */; const env0_4 = (require(4833) /* metro dependency 4833: ReferencedMessageStore */).ReferencedMessageState; const userRecord = importDefault(1885) /* metro dependency 1885: UserRecord */; const userStore = importDefault(1878) /* metro dependency 1878: UserStore */; const constantsModule = require(661) /* metro dependency 661: Constants */; const env0_7 = constantsModule.MessageStates; const env0_8 = constantsModule.MessageTypes; const env0_9 = constantsModule.LOCAL_BOT_ID; const env0_10 = constantsModule.NON_USER_BOT_DISCRIMINATOR; const env0_11 = constantsModule.MessageFlags; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/messages/createMessage.tsx'); exports.default = createMessage; exports.userRecordToServer = closure; exports.createBotMessage = createBotMessage; } function createMessage({channelId, content, tts, type, messageReference, allowedMentions, author, flags, nonce, poll, sharedCustomTheme, changelogId, giftingPrompt, boostingPrompt, state, mediaMention}) { // fn#57135, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7319:538, offset: 0x013dd6dc, size: 579 bytes, params: 2, frame: 33 var messageByReference; let value = undefined; tts = !(tts === value) && tts; const r18 = type !== value ? type : MessageTypes.DEFAULT; const items2 = []; const REPLY = MessageTypes.REPLY; if (r18 === REPLY) { (importDefault(44) /* metro dependency 44 */)(messageReference != null, 'Replies must have a message reference'); if (allowedMentions == null) { messageByReference = ReferencedMessageStore.getMessageByReference(messageReference); state = messageByReference == null ? value : messageByReference.state; if (state === ReferencedMessageState.LOADED) { items2.push(userRecordToServer(messageByReference.message.author)); } } else if (allowedMentions.replied_user) { messageByReference = ReferencedMessageStore.getMessageByReference(messageReference); state = messageByReference == null ? value : messageByReference.state; if (state === ReferencedMessageState.LOADED) { items2.push(userRecordToServer(messageByReference.message.author)); } } } let r19 = author ?? UserStore.getCurrentUser(); const r14 = r19 instanceof UserRecord ? userRecordToServer(r19) : r19; (importDefault(44) /* metro dependency 44 */)(r14 != null, 'createMessage: author cannot be undefined'); const object2 = {}; if (nonce != null) { r19 = nonce; } else { value = require(7142) /* metro dependency 7142: createNonce */; value = value.createNonce(); r19 = value; } object2.id = r19; object2.type = r18; object2.content = content; object2.channel_id = channelId; object2.author = r14; object2.attachments = []; object2.embeds = []; object2.pinned = false; object2.mentions = items2; object2.mention_channels = []; object2.mention_roles = []; object2.mention_everyone = false; const Date = global.Date; object2.timestamp = new Date().toISOString(); object2.state = state ?? MessageStates.SENDING; object2.tts = tts; object2.message_reference = messageReference; object2.message_snapshots = []; object2.flags = flags; object2.nonce = nonce; object2.poll = poll; object2.shared_client_theme = sharedCustomTheme; object2.changelog_id = changelogId; object2.gifting_prompt = giftingPrompt; object2.boosting_prompt = boostingPrompt; object2.media_mention = mediaMention; return object2; } function createBotMessage({messageId, channelId, content, embeds, loggingName}) { // fn#57136, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7319:1595, offset: 0x013dd91f, size: 285 bytes, params: 2, frame: 18 var r3; var value; const object2 = {}; if (messageId != null) { r3 = messageId; } else { value = require(7142) /* metro dependency 7142: createNonce */; value = value.createNonce(); r3 = value; } object2.id = r3; const DEFAULT = MessageTypes.DEFAULT; object2.type = DEFAULT; const EPHEMERAL = MessageFlags.EPHEMERAL; object2.flags = EPHEMERAL; object2.content = content; object2.channel_id = channelId; object2.author = {'id': null, 'username': 'Clyde', 'discriminator': null, 'avatar': 'clyde', 'bot': true, id: LOCAL_BOT_ID, discriminator: NON_USER_BOT_DISCRIMINATOR}; object2.attachments = []; object2.embeds = embeds ?? []; object2.pinned = false; object2.mentions = []; object2.mention_channels = []; object2.mention_roles = []; object2.mention_everyone = false; const Date = global.Date; const value2 = Object.create(Date.prototype, {constructor: {value: Date}}); const date = new Date(); object2.timestamp = (date instanceof Object ? date : value2).toISOString(); const SENT = MessageStates.SENT; object2.state = SENT; object2.tts = false; object2.loggingName = loggingName; return object2; }