/* Metro module 4815; source: modules/messages/EphemeralMessageStore.tsx; dependencies: [6, 7, 15, 17, 18, 1379, 661, 1391, 4625, 566, 694, 2] */ import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */ import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */ import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */ import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ import * as FlagUtilsModule from '../../external/discord_common/js/shared/utils/FlagUtils.tsx'; /* Metro dependency 1391 */ import * as MessageRecordUtilsModule from './MessageRecordUtils.tsx'; /* Metro dependency 4625 */ function _fun41888(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#41888, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:6, offset: 0x0112ad78, size: 465 bytes, params: 8, frame: 21 const env0_0 = require; const _arrayLikeToArray_41894 = 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 CACHE_LOADED_418962 = CACHE_LOADED_41896; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_9 = []; const Map = global.Map; let map = new Map(); const Store = (Flux).Store; _fun41897(Store).displayName = 'EphemeralMessageStore'; map = new map(importDefault(694) /* metro dependency 694: Dispatcher */, {MESSAGE_CREATE: MESSAGE_CREATE_41901, MESSAGE_UPDATE: MESSAGE_UPDATE_41902, MESSAGE_DELETE: MESSAGE_DELETE_41903, MESSAGE_DELETE_BULK: MESSAGE_DELETE_BULK_41904, CLEAR_MESSAGES: CLEAR_MESSAGES_41905, CHANNEL_DELETE: CHANNEL_DELETE_41906, THREAD_DELETE: THREAD_DELETE_41907, GUILD_DELETE: GUILD_DELETE_41908, CACHE_LOADED: CACHE_LOADED_418962, CONNECTION_OPEN: CACHE_LOADED_418962, OVERLAY_INITIALIZE: CACHE_LOADED_418962, LOGOUT: CACHE_LOADED_418962}); (FileImportTrackerModule).fileFinishedImporting('modules/messages/EphemeralMessageStore.tsx'); exports.default = map; function _isNativeReflectConstruct_41889() { // fn#41889, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:184, offset: 0x0112af49, size: 94 bytes, params: 1, frame: 18 var Boolean; var prototype; var valueOf; var call; var Reflect; var construct; var closure; var value; var error; try { Boolean = global.Boolean; prototype = Boolean.prototype; valueOf = prototype.valueOf; call = valueOf.call; Reflect = global.Reflect; construct = Reflect.construct; Boolean = global.Boolean; closure = function() { }; value = Reflect.apply(construct, Reflect, [Boolean, [], closure]); value = Reflect.apply(call, valueOf, [value]); var result = !value; } catch (error) { } return (_isNativeReflectConstruct_41889_isNativeReflectConstruct = function() { return !!result; })(); } function _createForOfIteratorHelperLoose_41892(a0, a1) { // fn#41892, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:377, offset: 0x0112afa7, size: 370 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 _fun41893; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_41894(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_41894(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_41894(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun41893; } 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 _fun41893() { // fn#41893, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:948, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5 return env0_1 >= env0_0.length ? {done: true} : {done: false, value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]}; } } function dropChannelIfEmpty(a0, {size}) { // fn#41895, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:1306, offset: 0x0112b119, size: 38 bytes, params: 3, frame: 11 if (size === 0) { env0_10.delete(a0); } } function CACHE_LOADED_41896() { // fn#41896, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:1363, offset: 0x0112b13f, size: 40 bytes, params: 1, frame: 10 if (env0_10.size === 0) { return false; } env0_10.clear(); } function _fun41897(a0) { // fn#41897, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:1422, offset: 0x0112b167, size: 91 bytes, params: 2, frame: 16 const EphemeralMessageStore2 = EphemeralMessageStore; Inherits(EphemeralMessageStore2, a0); return CreateClass(EphemeralMessageStore2, [{key: 'initialize', value: function() { this.waitFor(ChannelStore); }}, {key: 'getMessages', value: value_41900}]); function EphemeralMessageStore() { // fn#41898, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:1434, offset: 0x00ff71a7, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_2(this, EphemeralMessageStore); const value3 = env1_5(EphemeralMessageStore); return env1_4(this, _isNativeReflectConstruct_41889() ? global.Reflect.construct(value3, arguments, env1_5(this).constructor) : value3.apply(this, arguments)); } function value_41900(a0) { // fn#41900, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:1811, offset: 0x0112b1c2, size: 72 bytes, params: 2, frame: 13 const value = environment.__proto__; const value2 = env1_10.get(a0); return value2 == null || value2.size === 0 ? env1_9 : global.Array.from(value2.values()); } } function MESSAGE_CREATE_41901({channelId, message}) { // fn#41901, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:1985, offset: 0x0112b20a, size: 264 bytes, params: 2, frame: 19 var r2; var value3; var map; var set; var id; var size; var next; var done; var value; const hasFlag = FlagUtilsModule.hasFlag; const r4 = message.flags ?? 0; const EPHEMERAL = MessageFlags.EPHEMERAL; if (Reflect.apply(hasFlag, FlagUtilsModule, [r4, EPHEMERAL])) { value3 = env0_10.get(channelId); if (value3 != null) { r2 = value3; } else { map = new global.Map(); env0_10.set(channelId, map); r2 = map; } set = r2.set; id = message.id; value = require(4625) /* metro dependency 4625: MessageRecordUtils */; Reflect.apply(set, r2, [id, value.createMessageRecord(message)]); size = r2.size; if (size > 50) { while (true) { value = r2.keys(); next = value.next; value = Reflect.apply(next, value, []); done = value.done; if (done === true) { break; } value = value.value; r2.delete(value); size = r2.size; if (size > 50) { continue; } break; } } return undefined; } return false; } function MESSAGE_UPDATE_41902({message}) { // fn#41902, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:2344, offset: 0x0112b312, size: 122 bytes, params: 2, frame: 17 const channel_id = message.channel_id; const id = message.id; if (channel_id == null) { return false; } if (id == null) { return false; } const value2 = env0_10.get(channel_id); if (value2 == null) { return false; } const value3 = value2.get(id); if (value3 == null) { return false; } const set = value2.set; Reflect.apply(set, value2, [id, MessageRecordUtilsModule.updateMessageRecord(value3, message)]); } function MESSAGE_DELETE_41903({channelId, id}) { // fn#41903, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:2570, offset: 0x0112b38c, size: 67 bytes, params: 2, frame: 14 const value2 = env0_10.get(channelId); if (value2 != null) { if (value2.delete(id)) { dropChannelIfEmpty(channelId, value2); return undefined; } } return false; } function MESSAGE_DELETE_BULK_41904({channelId, ids}) { // fn#41904, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:2713, offset: 0x0112b3cf, size: 128 bytes, params: 2, frame: 22 var r7; var r8; var r5; var value6; var value7; var value8; const value2 = env0_10.get(channelId); if (value2 != null) { var value3 = _createForOfIteratorHelperLoose_41892(ids); var value4 = value3(); var done = value4.done; if (done) { r5 = false; } else { r7 = false; r8 = value4; while (true) { value6 = r8.value; if (value2.delete(value6)) { value7 = true; r7 = value7; } value8 = value3(); done = value8.done; if (done) { r5 = r7; break; } r8 = value8; continue; } } if (r5) { dropChannelIfEmpty(channelId, value2); return undefined; } } return false; } function CLEAR_MESSAGES_41905({channelId}) { // fn#41905, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:2959, offset: 0x0112b44f, size: 50 bytes, params: 2, frame: 12 const binding = env0_10; if (binding.has(channelId)) { env0_10.delete(channelId); return undefined; } return false; } function CHANNEL_DELETE_41906({channel}) { // fn#41906, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:3053, offset: 0x0112b481, size: 41 bytes, params: 2, frame: 11 if (env0_10.delete(channel.id)) { return undefined; } return false; } function THREAD_DELETE_41907({channel}) { // fn#41907, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:3138, offset: 0x0112b481, size: 41 bytes, params: 2, frame: 11 if (env0_10.delete(channel.id)) { return undefined; } return false; } function GUILD_DELETE_41908() { // fn#41908, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4993:3221, offset: 0x0112b4aa, size: 137 bytes, params: 1, frame: 19 var r3; var r4; var r2; var value7; var channelStoreBinding; var getChannel; var value8; var value9; if (env0_10.size === 0) { return false; } const _createForOfIteratorHelperLoose_41892Binding = _createForOfIteratorHelperLoose_41892; let binding = env0_10; const value2 = binding.keys(); const value3 = undefined; const value4 = _createForOfIteratorHelperLoose_41892Binding(value2); const value5 = value4(); let done = value5.done; const value6 = false; if (done) { r2 = value6; } else { r3 = value6; r4 = value5; while (true) { value7 = r4.value; channelStoreBinding = ChannelStore; getChannel = channelStoreBinding.getChannel; if (Reflect.apply(getChannel, channelStoreBinding, [value7]) == null) { binding = env0_10; binding.delete(value7); value8 = true; r3 = value8; } value9 = value4(); done = value9.done; if (done) { r2 = r3; break; } r4 = value9; continue; } } return r2 ? value3 : !!r2; } } global.__d(_fun41888, 4815, [6, 7, 15, 17, 18, 1379, 661, 1391, 4625, 566, 694, 2]) /* metro module 4815, dependencies: [6, 7, 15, 17, 18, 1379, 661, 1391, 4625, 566, 694, 2] */;