/* Metro module 14413; source: modules/favorites/useFavoriteGuildUnreads.tsx; dependencies: [5071, 3786, 1379, 5214, 3784, 4605, 4864, 566, 21, 2] */ import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */ import JoinedThreadsStore from '../threads/JoinedThreadsStore.tsx'; /* Metro dependency 3786 */ import ReadStateStore from '../../stores/ReadStateStore.tsx'; /* Metro dependency 4605 */ import UserGuildSettingsStore from '../../stores/UserGuildSettingsStore.tsx'; /* Metro dependency 4864 */ import ActiveJoinedThreadsStore from '../threads/ActiveJoinedThreadsStore.tsx'; /* Metro dependency 5071 */ import GuildReadStateStore from '../../stores/GuildReadStateStore.tsx'; /* Metro dependency 5214 */ 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 */ function _fun109093(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#109093, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14610:6, offset: 0x0233cfac, size: 214 bytes, params: 8, frame: 19 let env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/favorites/useFavoriteGuildUnreads.tsx'); exports.default = function(a0) { var env0_0 = a0; return require(dependencyMap[7]).useStateFromStoresObject([ActiveJoinedThreadsStore, ChannelStore, GuildReadStateStore, JoinedThreadsStore, PermissionStore, ReadStateStore, UserGuildSettingsStore], _fun109095); }; function useFavoriteGuildUnreads(a0) { // fn#109094, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14610:255, offset: 0x0233d082, size: 115 bytes, params: 2, frame: 15 const env0_0 = a0; return (FluxModule).useStateFromStoresObject([ActiveJoinedThreadsStore, ChannelStore, GuildReadStateStore, JoinedThreadsStore, PermissionStore, ReadStateStore, UserGuildSettingsStore], _fun109095); function _fun109095() { // fn#109095, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14610:348, offset: 0x0233d0f5, size: 111 bytes, params: 1, frame: 13 var environment; let value = environment.__proto__; value = importDefault(21) /* metro dependency 21: SnowflakeUtils */; value = value.keys(env0_0); const Set = global.Set; const set = new Set(); return value.reduce(_fun109096, {'badge': 0, 'unread': false}); function _fun109096(a0, a1) { // fn#109096, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14610:402, offset: 0x0233d164, size: 348 bytes, params: 3, frame: 23 var r9; var r8; var badge; var propertyName; var mentionCount; var channel; var hasUnread3; var shouldCountChannelUnread3; const channel2 = ChannelStore.getChannel(a1); const guildId = channel2?.getGuildId(); const mentionCount2 = ReadStateStore.getMentionCount(a1); let binding = env0_0; let has = binding.has; if (!Reflect.apply(has, binding, [a1])) { binding = env0_0; binding.add(a1); badge = a0.badge; a0.badge = badge + mentionCount2; } let unread = a0.unread; a0.unread = unread || ReadStateStore.hasUnread(a1) && GuildReadStateStore.shouldCountChannelUnread(channel2, mentionCount2); if (guildId != null) { for (propertyName in ActiveJoinedThreadsStore.getActiveJoinedRelevantThreadsForParent(guildId, a1)) { mentionCount = ReadStateStore.getMentionCount(propertyName); binding = env0_0; has = binding.has; if (Reflect.apply(has, binding, [propertyName])) { continue; } binding = env0_0; binding.add(propertyName); badge = a0.badge; a0.badge = badge + mentionCount; channel = ChannelStore.getChannel(propertyName); unread = a0.unread; if (unread) { r8 = unread; continue; } hasUnread3 = ReadStateStore.hasUnread(propertyName); if (!hasUnread3) { r9 = hasUnread3; continue; } shouldCountChannelUnread3 = GuildReadStateStore.shouldCountChannelUnread(channel, mentionCount); r9 = shouldCountChannelUnread3; r8 = r9; a0.unread = r8; } } return a0; } } } } global.__d(_fun109093, 14413, [5071, 3786, 1379, 5214, 3784, 4605, 4864, 566, 21, 2]) /* metro module 14413, dependencies: [5071, 3786, 1379, 5214, 3784, 4605, 4864, 566, 21, 2] */;