/* Metro module 6877; source: stores/LocalActivityStore.tsx; dependencies: [6, 7, 15, 17, 18, 57, 1378, 4234, 4266, 6878, 6867, 1348, 4492, 1379, 4267, 6881, 1934, 4296, 661, 3829, 6882, 22, 6883, 4483, 644, 6884, 1391, 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 Module00022 from '../by-id/module-00022.js'; /* Metro dependency 22 */ import Module00057 from '../by-id/module-00057.js'; /* Metro dependency 57 */ import Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import UserSettingsProtoStore from '../modules/user_settings/UserSettingsProtoStore.tsx'; /* Metro dependency 1348 */ import EmbeddedActivitiesStore from '../modules/activities/EmbeddedActivitiesStore.tsx'; /* Metro dependency 1378 */ import ChannelStore from './ChannelStore.tsx'; /* Metro dependency 1379 */ import SelectedChannelStore from './SelectedChannelStore.tsx'; /* Metro dependency 1934 */ import ApplicationStore from '../modules/applications/ApplicationStore.tsx'; /* Metro dependency 4234 */ import RunningGameStoreNative from '../modules/game_detection/RunningGameStore.native.tsx'; /* Metro dependency 4266 */ import DetectableGameStore from './DetectableGameStore.tsx'; /* Metro dependency 4267 */ import SessionsStore from './SessionsStore.tsx'; /* Metro dependency 4296 */ import ApplicationStreamingStore from './ApplicationStreamingStore.tsx'; /* Metro dependency 4492 */ import SpotifyStore from '../modules/spotify/SpotifyStore.tsx'; /* Metro dependency 6867 */ import FirstPartyRichPresenceStore from '../modules/rich_presence/FirstPartyRichPresenceStore.tsx'; /* Metro dependency 6878 */ import ExternalStreamingStore from './ExternalStreamingStore.tsx'; /* Metro dependency 6881 */ import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */ import * as UserSettingsModule from '../modules/user_settings/UserSettings.tsx'; /* Metro dependency 3829 */ function _fun54554(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#54554, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:6, offset: 0x0136836b, size: 652 bytes, params: 8, frame: 20 const env0_0 = require; const ROBLOX_SUBGAME_UPDATE2 = ROBLOX_SUBGAME_UPDATE; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = ConstantsModule; const env0_21 = value.ActivityFlags; const env0_22 = value.ActivityGamePlatforms; const env0_23 = value.ActivityTypes; const env0_24 = []; let env0_25 = {}; const Store = (Flux).Store; _fun54562(Store).displayName = 'LocalActivityStore'; value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {ROBLOX_SUBGAME_UPDATE: ROBLOX_SUBGAME_UPDATE2, ROBLOX_SUBGAME_APPLICATION_FETCH_SUCCESS: ROBLOX_SUBGAME_UPDATE2, OVERLAY_INITIALIZE: function({localActivities}) { var object = {}; copyDataProperties(object, localActivities, object); env0_25 = object; ROBLOX_SUBGAME_UPDATE(); }, START_SESSION: function() { env0_25 = {}; ROBLOX_SUBGAME_UPDATE(); }, LOCAL_ACTIVITY_UPDATE: LOCAL_ACTIVITY_UPDATE_54577, RPC_APP_DISCONNECTED: RPC_APP_DISCONNECTED_54578, RUNNING_GAMES_CHANGE: ROBLOX_SUBGAME_UPDATE2, LIBRARY_APPLICATION_FLAGS_UPDATE_SUCCESS: ROBLOX_SUBGAME_UPDATE2, SPOTIFY_PLAYER_STATE: ROBLOX_SUBGAME_UPDATE2, SPOTIFY_PLAYER_PLAY: ROBLOX_SUBGAME_UPDATE2, STREAMING_UPDATE: ROBLOX_SUBGAME_UPDATE2, USER_CONNECTIONS_UPDATE: ROBLOX_SUBGAME_UPDATE2, STREAM_START: ROBLOX_SUBGAME_UPDATE2, STREAM_STOP: ROBLOX_SUBGAME_UPDATE2, USER_SETTINGS_PROTO_UPDATE: USER_SETTINGS_PROTO_UPDATE_54579, EMBEDDED_ACTIVITY_CLOSE: ROBLOX_SUBGAME_UPDATE2, RUNNING_GAME_TOGGLE_DETECTION: ROBLOX_SUBGAME_UPDATE2}); (FileImportTrackerModule).fileFinishedImporting('stores/LocalActivityStore.tsx'); exports.default = value; function _isNativeReflectConstruct_54555() { // fn#54555, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:360, offset: 0x013685f7, 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_54555_isNativeReflectConstruct = function() { return !!result; })(); } function EMBEDDED_ACTIVITY_CLOSE_54558() { // fn#54558, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:574, offset: 0x01368655, size: 1049 bytes, params: 1, frame: 27 var r16; var r5; var r4; var r14; var id; var r8; var r17; var value6; var Date; var value7; var prototype; var value8; var date; var time; var value11; var value12; var push; var moduleValue; var object; var streamerActiveStreamMetadata; var visibleRunningGames; var value23; var value24; var value25; var value26; var start; var value30; var moduleValue2; var doesGameHaveRichPresence; var items3; var value31; var sessionsStoreBinding; var game; var object2; var moduleValue3; var object4; const items4 = []; const value2 = undefined; const CustomStatusSetting = (UserSettingsModule).CustomStatusSetting; const setting = CustomStatusSetting.getSetting(); const value4 = null; const value5 = value4 != setting; if (value5) { value6 = setting.expiresAtMs === '0'; if (value6) { r5 = value6; } else { Date = global.Date; value7 = global.Number(setting.expiresAtMs); prototype = Date.prototype; value8 = Object.create(prototype, {constructor: {value: Date}}); date = new Date(); time = (date instanceof Object ? date : value8).getTime(); Date = global.Date; prototype = Date.prototype; value11 = Object.create(prototype, {constructor: {value: Date}}); date = new Date(); value12 = date instanceof Object ? date : value11; r5 = time - value12.getTime() > 0; } r4 = r5; } else { r4 = value5; } if (r4) { push = items4.push; moduleValue = require(6882) /* metro dependency 6882: userSettingToActivity */; Reflect.apply(push, items4, [moduleValue.getActivityFromCustomStatus(setting)]); } const activities = FirstPartyRichPresenceStore.getActivities(); push = items4.push; const items2 = []; arraySpread(items2, activities, 0, r16); apply(push, items2, items4, r16); const stream = ExternalStreamingStore.getStream(); if (value4 != stream) { push = items4.push; object = {}; object.type = ActivityTypes.STREAMING; copyDataProperties(object, stream, items4); Reflect.apply(push, items4, [object]); } const Set = global.Set; const set = new Set(); const defaultImport = Module00022; defaultImport.forEach(env0_25, _fun54559); const applicationStreamingStoreBinding = ApplicationStreamingStore; const getCurrentUserActiveStream = applicationStreamingStoreBinding.getCurrentUserActiveStream; const value19 = value4 != Reflect.apply(getCurrentUserActiveStream, applicationStreamingStoreBinding, []); const visibleGame = RunningGameStoreNative.getVisibleGame(); if (value19) { streamerActiveStreamMetadata = ApplicationStreamingStore.getStreamerActiveStreamMetadata(); visibleRunningGames = RunningGameStoreNative.getVisibleRunningGames(); if (value4 != (value4 == streamerActiveStreamMetadata ? value2 : streamerActiveStreamMetadata.pid)) { value23 = visibleRunningGames.find(_fun54560); value24 = value4 != value23; r14 = value24 ? value23 : value4; r16 = value24; } else { r14 = value4; } if (value4 != r14) { r5 = r14; } else { value25 = value4 == streamerActiveStreamMetadata; if (value4 == (value25 ? value2 : streamerActiveStreamMetadata.id)) { r5 = r14; r16 = value25; } else { value26 = visibleRunningGames.find(_fun54561); r5 = value4 != value26 ? value26 : value4; r16 = value25; } } if (value4 != r5) { if (value4 != env0_26) { r8 = r5; } else { start = r5.start; env0_26 = value4 != start ? start : global.Date.now(); r8 = r5; } } else { env0_26 = value4; r8 = visibleGame; } } else { env0_26 = value4; r8 = visibleGame; } let r6 = value4 != r8 && value4 != r8.name; if (r6) { value30 = set.has(r8.name); if (value30) { r5 = value30; r17 = items4; } else { moduleValue2 = require(6883) /* metro dependency 6883: PresenceActivityFiltering */; doesGameHaveRichPresence = moduleValue2.doesGameHaveRichPresence; items3 = []; value31 = arraySpread(items3, items4, 0, r16); sessionsStoreBinding = SessionsStore; arraySpread(items3, sessionsStoreBinding.getRemoteActivities(), value31, r16); r5 = Reflect.apply(doesGameHaveRichPresence, moduleValue2, [r8, items3]); r17 = value31; } r6 = r5; } else { r17 = items4; } if (value4 != r8) { if (value4 != r8.name) { if (!r6) { if (value4 != r8 && r8.isLauncher) { if (value19) { game = DetectableGameStore.findGame(r8); push = items4.push; object2 = {}; object2.type = ActivityTypes.PLAYING; object2.name = r8.name; id = r8.id; object2.application_id = value4 != id ? id : value4 == game ? value2 : game.id; object2.timestamps = {start: value4 != env0_26 ? env0_26 : r8.start}; moduleValue3 = require(4483) /* metro dependency 4483: RobloxSubgameUtils */; copyDataProperties(object2, moduleValue3.maybeAddAdditionalGameMetadata(r8), r17); Reflect.apply(push, items4, [object2]); } } else { game = DetectableGameStore.findGame(r8); push = items4.push; object2 = {}; object2.type = ActivityTypes.PLAYING; object2.name = r8.name; id = r8.id; object2.application_id = value4 != id ? id : value4 == game ? value2 : game.id; object2.timestamps = {start: value4 != env0_26 ? env0_26 : r8.start}; moduleValue3 = require(4483) /* metro dependency 4483: RobloxSubgameUtils */; copyDataProperties(object2, moduleValue3.maybeAddAdditionalGameMetadata(r8), r17); Reflect.apply(push, items4, [object2]); } } } } const activity = SpotifyStore.getActivity(); if (value4 != activity) { push = items4.push; object4 = {}; object4.type = ActivityTypes.LISTENING; copyDataProperties(object4, activity, r17); Reflect.apply(push, items4, [object4]); } if ((importDefault(644) /* metro dependency 644 */)(env0_24, items4)) { } return value2; function _fun54559(a0) { // fn#54559, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:933, offset: 0x01368a6e, size: 138 bytes, params: 2, frame: 18 var r1; var r2; var r4; var item3; var value3; var binding; const iterator = a0[Symbol.iterator](); const iterator2 = iterator.next; const value = undefined; let item2 = Reflect.apply(iterator2, iterator, []); let item = item2.value; item2 = item2.done ? undefined : iterator; const value2 = item2 === value; if (value2) { } if (value2) { r1 = item2; r2 = value2; r4 = value; } else { item3 = Reflect.apply(iterator2, item2, []); item = item3.value; item3 = item3.done ? undefined : item2; value3 = item3 === value; if (value3) { r1 = item3; r2 = value3; r4 = value; } else { r1 = item3; r2 = value3; r4 = item; } } if (!r2) { r1.return(); } if (r4.application_id != null) { binding = env0_1; binding.add(r4.name); binding = env0_0; binding.push(r4); } return value; } function _fun54560({pid}) { // fn#54560, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:1198, offset: 0x01368af8, size: 28 bytes, params: 2, frame: 2 return pid === env0_2.pid; } function _fun54561({id}) { // fn#54561, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:1284, offset: 0x01368b14, size: 26 bytes, params: 2, frame: 2 return id === env0_2.id; } } function _fun54562(a0) { // fn#54562, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:1863, offset: 0x01368b2e, size: 235 bytes, params: 2, frame: 16 const LocalActivityStore2 = LocalActivityStore; Inherits(LocalActivityStore2, a0); return CreateClass(LocalActivityStore2, [{key: 'initialize', value: function() { this.waitFor(ApplicationStore, ApplicationStreamingStore, ChannelStore, EmbeddedActivitiesStore, ExternalStreamingStore, FirstPartyRichPresenceStore, DetectableGameStore, RunningGameStoreNative, SelectedChannelStore, SessionsStore, SpotifyStore, UserSettingsProtoStore); this.syncWith([FirstPartyRichPresenceStore], _fun54565); }}, {key: 'getActivities', value: value_54566}, {key: 'getPrimaryActivity', value: value_54567}, {key: 'getApplicationActivity', value: function(a0) { var env0_0 = a0; return this.findActivity(_fun54569); }}, {key: 'getCustomStatusActivity', value: function() { return this.findActivity(_fun54571); }}, {key: 'findActivity', value: value_54572}, {key: 'getApplicationActivities', value: value_54573}, {key: 'getActivityForPID', value: value_54574}]); function LocalActivityStore() { // fn#54563, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:1875, offset: 0x01161b4e, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_3(this, LocalActivityStore); const value3 = env1_6(LocalActivityStore); return env1_5(this, _isNativeReflectConstruct_54555() ? global.Reflect.construct(value3, arguments, env1_6(this).constructor) : value3.apply(this, arguments)); } function value_54564() { // fn#54564, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:2183, offset: 0x01368c19, size: 102 bytes, params: 1, frame: 34 this.waitFor(ApplicationStore, ApplicationStreamingStore, ChannelStore, EmbeddedActivitiesStore, ExternalStreamingStore, FirstPartyRichPresenceStore, DetectableGameStore, RunningGameStoreNative, SelectedChannelStore, SessionsStore, SpotifyStore, UserSettingsProtoStore); this.syncWith([FirstPartyRichPresenceStore], function() { ROBLOX_SUBGAME_UPDATE(); }); function _fun54565() { // fn#54565, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:2251, offset: 0x01368c7f, size: 15 bytes, params: 1, frame: 9 ROBLOX_SUBGAME_UPDATE(); } } function value_54566() { // fn#54566, offset: 0x00df3acd, size: 9 bytes, params: 1, frame: 1 return env1_24; } function value_54567() { // fn#54567, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:2359, offset: 0x01368c8e, size: 15 bytes, params: 1, frame: 2 return env1_24[0]; } function value_54568(a0) { // fn#54568, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:2420, offset: 0x01368c9d, size: 30 bytes, params: 2, frame: 11 const env0_0 = a0; return this.findActivity(_fun54569); function _fun54569({application_id}) { // fn#54569, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:2458, offset: 0x0108da35, size: 22 bytes, params: 2, frame: 2 return application_id === env0_0; } } function value_54570() { // fn#54570, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:2523, offset: 0x01368cbb, size: 23 bytes, params: 1, frame: 11 return this.findActivity(function({type}) { return type === ActivityTypes.CUSTOM_STATUS; }); function _fun54571({type}) { // fn#54571, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:2560, offset: 0x01368cd2, size: 27 bytes, params: 2, frame: 2 const CUSTOM_STATUS = ActivityTypes.CUSTOM_STATUS; return type === CUSTOM_STATUS; } } function value_54572(a0) { // fn#54572, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:2618, offset: 0x01368ced, size: 23 bytes, params: 2, frame: 11 return env1_24.find(a0); } function value_54573() { // fn#54573, offset: 0x00df3ad6, size: 9 bytes, params: 1, frame: 1 return env1_25; } function value_54574(a0) { // fn#54574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:2740, offset: 0x01368d04, size: 96 bytes, params: 2, frame: 19 var r2; var property; var value4; var property2; var value5; const Object = global.Object; const value2 = Object.values(env1_25); let length = value2.length; const value3 = 0; if (value3 < length) { r2 = value3; loopExit1: while (true) { property = value2[r2]; value4 = env1_8(property, 2); property = value4[value3]; property2 = value4[1]; if (property === a0) { return property2; } value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1; length = value2.length; if (value5 < length) { r2 = value5; continue; } break loopExit1; } } return null; } } function LOCAL_ACTIVITY_UPDATE_54577({socketId, pid, activity, partyPrivacy}) { // fn#54577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:3231, offset: 0x01368da0, size: 139 bytes, params: 2, frame: 19 if ((importDefault(644) /* metro dependency 644 */)(env0_25[socketId], [pid, activity, partyPrivacy])) { return false; } if (activity != null) { env0_25[socketId] = [pid, activity, partyPrivacy]; } else { delete env0_25[socketId]; } ROBLOX_SUBGAME_UPDATE(); } function RPC_APP_DISCONNECTED_54578({socketId}) { // fn#54578, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:3421, offset: 0x01368e2b, size: 32 bytes, params: 2, frame: 10 delete env0_25[socketId]; ROBLOX_SUBGAME_UPDATE(); } function USER_SETTINGS_PROTO_UPDATE_54579() { // fn#54579, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7055:3833, offset: 0x01368e4b, size: 372 bytes, params: 1, frame: 40 var r5; var r6; var r4; var flags; var r22; var r3; var property; var binding; var value6; var value7; var property2; var property3; var property4; var moduleValue; var computeActivityFlags; var moduleValue2; var hasFlag; var INSTANCE; var hasFlag2; var platform; var EMBEDDED; var moduleValue3; var isContextlessEmbeddedActivity2; var value8; var activityFlags; var items2; var object; var value9; var value10; const object2 = {}; const Object = global.Object; const value2 = Object.entries(env0_25); let length = value2.length; const value3 = 0; const value4 = false; const value5 = undefined; if (value3 < length) { r5 = value3; r6 = value4; while (true) { property = value2[r5]; binding = Module00057; value6 = binding(property, 2); property = value6[value3]; value7 = binding(value6[1], 3); property2 = value7[value3]; property3 = value7[1]; property4 = value7[2]; flags = property3.flags; r4 = flags ?? value3; moduleValue = require(6884) /* metro dependency 6884: ActivityFlagUtils */; computeActivityFlags = moduleValue.computeActivityFlags; moduleValue2 = require(1391) /* metro dependency 1391: FlagUtils */; hasFlag = moduleValue2.hasFlag; if (property3 == null) { flags = value5; continue; } flags = property3.flags; if (flags != null) { r22 = flags; continue; } r22 = value3; continue; INSTANCE = ActivityFlags.INSTANCE; hasFlag2 = Reflect.apply(hasFlag, moduleValue2, [r22, INSTANCE]); platform = property3.platform; EMBEDDED = ActivityGamePlatforms.EMBEDDED; moduleValue3 = require(6884) /* metro dependency 6884: ActivityFlagUtils */; isContextlessEmbeddedActivity2 = moduleValue3.isContextlessEmbeddedActivity(property3); value8 = platform === EMBEDDED; activityFlags = Reflect.apply(computeActivityFlags, moduleValue, [property3, hasFlag2, value8, isContextlessEmbeddedActivity2, property4]); if (activityFlags !== r4) { items2 = [property2]; object = {}; copyDataProperties(object, property3, value8); object['flags'] = activityFlags; items2[1] = object; items2[2] = property4; object2[property] = items2; value9 = true; r6 = value9; } else { object2[property] = [property2, property3, property4]; } value10 = typeof r5 === 'bigint' ? r5 + 1n : +r5 + 1; length = value2.length; if (value10 < length) { r5 = value10; continue; } r3 = r6; break; } } else { r3 = value4; } if (r3) { } ROBLOX_SUBGAME_UPDATE(); return value5; } } global.__d(_fun54554, 6877, [6, 7, 15, 17, 18, 57, 1378, 4234, 4266, 6878, 6867, 1348, 4492, 1379, 4267, 6881, 1934, 4296, 661, 3829, 6882, 22, 6883, 4483, 644, 6884, 1391, 566, 694, 2]) /* metro module 6877, dependencies: [6, 7, 15, 17, 18, 57, 1378, 4234, 4266, 6878, 6867, 1348, 4492, 1379, 4267, 6881, 1934, 4296, 661, 3829, 6882, 22, 6883, 4483, 644, 6884, 1391, 566, 694, 2] */;