/* Metro module 11169; source: stores/ChannelPinsStore.tsx; dependencies: [6, 7, 15, 17, 18, 1949, 1379, 1945, 1867, 4814, 3793, 1878, 4625, 22, 4821, 566, 694, 2] */ function _fun85277(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#85277, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:6, offset: 0x01f69f3d, size: 588 bytes, params: 8, frame: 22 const env0_0 = require; const closure = CHANNEL_DELETE_85281; const closure2 = RELATIONSHIP_ADD_85282; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(6) /* metro dependency 6 */; const env0_4 = importDefault(7) /* metro dependency 7 */; const env0_5 = importDefault(15) /* metro dependency 15 */; const env0_6 = importDefault(17) /* metro dependency 17 */; const env0_7 = importDefault(18) /* metro dependency 18 */; const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */; const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */; const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */; const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */; const messageStore = importDefault(4814) /* metro dependency 4814: MessageStore */; const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */; const userStore = importDefault(1878) /* metro dependency 1878: UserStore */; let env0_16 = {}; const Store = (importDefault(566) /* metro dependency 566: flux */).Store; let value = _fun85285(Store); value.displayName = 'ChannelPinsStore'; value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: function() { env0_16 = {}; }, LOAD_PINNED_MESSAGES: LOAD_PINNED_MESSAGES, LOAD_PINNED_MESSAGES_SUCCESS: LOAD_PINNED_MESSAGES_SUCCESS_85291, LOAD_PINNED_MESSAGES_FAILURE: LOAD_PINNED_MESSAGES_FAILURE, CHANNEL_DELETE: closure, THREAD_DELETE: closure, GUILD_DELETE: GUILD_DELETE_85294, MESSAGE_DELETE: MESSAGE_DELETE_85296, MESSAGE_DELETE_BULK: MESSAGE_DELETE_BULK_85298, MESSAGE_UPDATE: MESSAGE_UPDATE_85300, RELATIONSHIP_ADD: closure2, RELATIONSHIP_REMOVE: closure2, RELATIONSHIP_UPDATE: closure2, MESSAGE_EXPLICIT_CONTENT_SCAN_TIMEOUT: MESSAGE_EXPLICIT_CONTENT_SCAN_TIMEOUT_85304}); (require(2) /* metro dependency 2 */).fileFinishedImporting('stores/ChannelPinsStore.tsx'); exports.default = value; exports.FetchState = {LOADING: 'LOADING', LOADED_HAS_MORE: 'LOADED_HAS_MORE', LOADED_FINISHED: 'LOADING_FINISHED', FAILED: 'FAILED'}; } function _isNativeReflectConstruct_85278() { // fn#85278, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:220, offset: 0x01f6a189, size: 98 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_85278_isNativeReflectConstruct = function() { return !!result; })(); } function CHANNEL_DELETE_85281({channel}) { // fn#85281, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:561, offset: 0x01f6a1eb, size: 28 bytes, params: 2, frame: 2 delete env0_16[channel.id]; } function RELATIONSHIP_ADD_85282() { // fn#85282, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:618, offset: 0x01f6a207, size: 51 bytes, params: 1, frame: 14 const defaultImport = importDefault(22) /* metro dependency 22 */; defaultImport.forEach(env0_16, function(a0) { a0.items.forEach(_fun85284); a0.items = a0.items.slice(); }); } function _fun85285(a0) { // fn#85285, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:831, offset: 0x01f6a2ba, size: 97 bytes, params: 2, frame: 16 const closure = ChannelPinsStore; env0_7(closure, a0); return env0_4(closure, [{key: 'initialize', value: function() { this.waitFor(ChannelStore, GuildMemberStore, GuildStore, LocaleStore, MessageStore, RelationshipStore, UserStore); }}, {key: 'getPins', value: value_85288}]); } function LOAD_PINNED_MESSAGES(a0) { // fn#85290, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:1378, offset: 0x01f6a34e, size: 155 bytes, params: 2, frame: 15 var channel; var value3; const channelId = a0.channelId; if (a0.reset) { channel = ChannelStore.getChannel(channelId); value3 = undefined; env0_16[channelId] = {id: channelId, items: [], state: env0_15.LOADING, guildId: (channel == null ? value3 : channel.getGuildId()) ?? value3}; } else if (env0_16[channelId] == null) { channel = ChannelStore.getChannel(channelId); value3 = undefined; env0_16[channelId] = {id: channelId, items: [], state: env0_15.LOADING, guildId: (channel == null ? value3 : channel.getGuildId()) ?? value3}; } else { env0_16[channelId].state = env0_15.LOADING; } } function LOAD_PINNED_MESSAGES_SUCCESS_85291({channelId, pins, hasMore}) { // fn#85291, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:1628, offset: 0x01f6a3e9, size: 126 bytes, params: 2, frame: 17 const property = env0_16[channelId]; if (property == null) { return false; } const value2 = pins.map(_fun85292); const items3 = property.items; const items2 = []; arraySpread(items2, value2, arraySpread(items2, items3, 0, undefined), undefined); property.items = items2; const binding = env0_15; property.state = hasMore ? binding.LOADED_HAS_MORE : binding.LOADED_FINISHED; } function LOAD_PINNED_MESSAGES_FAILURE({channelId}) { // fn#85293, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:1939, offset: 0x01f6a4d5, size: 49 bytes, params: 2, frame: 3 const property = env0_16[channelId]; if (property == null) { return false; } const FAILED = env0_15.FAILED; property.state = FAILED; } function GUILD_DELETE_85294({guild}) { // fn#85294, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:2109, offset: 0x01f6a506, size: 95 bytes, params: 2, frame: 13 env0_16 = (importDefault(22) /* metro dependency 22 */)(env0_16).filter(function({guildId}) { return guildId !== guild.id; }).keyBy('id').value(); } function MESSAGE_DELETE_85296({id, channelId}) { // fn#85296, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:2227, offset: 0x01f6a57f, size: 136 bytes, params: 2, frame: 17 var r1; var r0; var value3; var defaultImport; var value4; const property = env0_16[channelId]; const value2 = property != null; if (value2) { value3 = undefined; defaultImport = importDefault(22) /* metro dependency 22 */; value4 = defaultImport.remove(property.items, function(a0) { return a0.message.id === id; }).length !== 0; if (value4) { property.items = property.items.slice(); env0_16[channelId] = property; r1 = value3; } else { r1 = value4; } r0 = r1; } else { r0 = value2; } return r0; } function MESSAGE_DELETE_BULK_85298({ids, channelId}) { // fn#85298, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:2428, offset: 0x01f6a621, size: 74 bytes, params: 2, frame: 12 const property = env0_16[channelId]; if (property == null) { return false; } property.items = property.items.filter(function({message}) { return !ids.includes(message.id); }); } function MESSAGE_UPDATE_85300(a0) { // fn#85300, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:2588, offset: 0x01f6a68e, size: 621 bytes, params: 2, frame: 21 var findIndex; var items2; var updateMessageRecord; var value3; var object2; var defaultImport2; var index2; var property3; var unshift; let message = a0.message; const env0_0 = message.id; const channel_id = a0.message.channel_id; if (channel_id == null) { return false; } var value; const property = env0_16[channel_id]; if (property == null) { return false; } if (a0.message.author != null) { if (a0.message.pinned) { items2 = property.items; property.items = items2.slice(); defaultImport2 = importDefault(22) /* metro dependency 22 */; findIndex = defaultImport2.findIndex; items2 = property.items; index2 = Reflect.apply(findIndex, defaultImport2, [items2, function(a0) { return a0.message.id === id; }]); if (index2 === -1) { items2 = property.items; unshift = items2.unshift; object2 = {}; value = require(4625) /* metro dependency 4625: MessageRecordUtils */; object2.message = value.createMessageRecord(a0.message); object2.pinnedAt = new global.Date(); Reflect.apply(unshift, items2, [object2]); } else { items2 = property.items; property3 = items2[index2]; value = require(4625) /* metro dependency 4625: MessageRecordUtils */; updateMessageRecord = value.updateMessageRecord; items2 = property.items; property3.message = Reflect.apply(updateMessageRecord, value, [items2[index2].message, a0.message]); } return undefined; } value = importDefault(22) /* metro dependency 22 */; findIndex = value.findIndex; items2 = property.items; value = Reflect.apply(findIndex, value, [items2, _fun85302]); if (value === -1) { return false; } items2 = property.items; property.items = items2.slice(); items2 = property.items; items2.splice(value, 1); } else { var defaultImport = importDefault(22) /* metro dependency 22 */; findIndex = defaultImport.findIndex; items2 = property.items; var index = Reflect.apply(findIndex, defaultImport, [items2, function(a0) { return a0.message.id === id; }]); if (index === -1) { return undefined; } items2 = property.items; var {pinnedAt, message} = items2[index]; var moduleValue = require(4625) /* metro dependency 4625: MessageRecordUtils */; var value2 = moduleValue.updateMessageRecord(message, a0.message); if (value2 !== message) { value3 = property.items.slice(); value3[index] = {pinnedAt: pinnedAt, message: value2}; env0_16[channel_id].items = value3; } } } function MESSAGE_EXPLICIT_CONTENT_SCAN_TIMEOUT_85304({messageId, channelId}) { // fn#85304, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:3556, offset: 0x01f6a8fb, size: 189 bytes, params: 2, frame: 16 const property = env0_16[channelId]; if (property == null) { return false; } const defaultImport = importDefault(22) /* metro dependency 22 */; const index = defaultImport.findIndex(property.items, function(a0) { return a0.message.id === messageId; }); if (index === -1) { return false; } property.items = property.items.slice(); const property2 = property.items[index]; const explicitMediaRedactionUtilsModule = require(4821) /* metro dependency 4821: ExplicitMediaRedactionUtils */; property2.message = explicitMediaRedactionUtilsModule.handleExplicitMediaScanTimeoutForMessage(property.items[index].message); } function _fun85283(a0) { // fn#85283, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:674, offset: 0x01f6a23a, size: 53 bytes, params: 2, frame: 12 let items2 = a0.items; items2.forEach(_fun85284); items2 = a0.items; a0.items = items2.slice(); } function _fun85292({pinned_at, message}) { // fn#85292, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:1731, offset: 0x01f6a467, size: 110 bytes, params: 2, frame: 14 const object2 = {}; const Date = global.Date; const Date2 = global.Date; let value = Date2.parse(pinned_at); const value2 = Object.create(Date.prototype, {constructor: {value: Date}}); const date = new Date(value); object2.pinnedAt = date instanceof Object ? date : value2; value = environment.__proto__; object2.message = (require(4625) /* metro dependency 4625: MessageRecordUtils */).createMessageRecord(message); return object2; } function _fun85284({message}) { // fn#85284, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:695, offset: 0x01f6a26f, size: 75 bytes, params: 2, frame: 14 const set = message.set; const value = environment.__proto__.__proto__; Reflect.apply(set, message, ['blocked', RelationshipStore.isBlockedForMessage(message)]); message.set('ignored', RelationshipStore.isIgnoredForMessage(message)); }