/* 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] */ 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 closure = ROBLOX_SUBGAME_UPDATE; 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 env0_8 = importDefault(57) /* metro dependency 57 */; const embeddedActivitiesStore = importDefault(1378) /* metro dependency 1378: EmbeddedActivitiesStore */; const applicationStore = importDefault(4234) /* metro dependency 4234: ApplicationStore */; const runningGameStoreNative = importDefault(4266) /* metro dependency 4266: RunningGameStoreNative */; const firstPartyRichPresenceStore = importDefault(6878) /* metro dependency 6878: FirstPartyRichPresenceStore */; const spotifyStore = importDefault(6867) /* metro dependency 6867: SpotifyStore */; const userSettingsProtoStore = importDefault(1348) /* metro dependency 1348: UserSettingsProtoStore */; const applicationStreamingStore = importDefault(4492) /* metro dependency 4492: ApplicationStreamingStore */; const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */; const detectableGameStore = importDefault(4267) /* metro dependency 4267: DetectableGameStore */; const externalStreamingStore = importDefault(6881) /* metro dependency 6881: ExternalStreamingStore */; const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */; const sessionsStore = importDefault(4296) /* metro dependency 4296: SessionsStore */; let value = require(661) /* metro dependency 661: Constants */; const env0_21 = value.ActivityFlags; const env0_22 = value.ActivityGamePlatforms; const env0_23 = value.ActivityTypes; const env0_24 = []; let env0_25 = {}; const Store = (importDefault(566) /* metro dependency 566: flux */).Store; _fun54562(Store).displayName = 'LocalActivityStore'; value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {ROBLOX_SUBGAME_UPDATE: closure, ROBLOX_SUBGAME_APPLICATION_FETCH_SUCCESS: closure, 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: closure, LIBRARY_APPLICATION_FLAGS_UPDATE_SUCCESS: closure, SPOTIFY_PLAYER_STATE: closure, SPOTIFY_PLAYER_PLAY: closure, STREAMING_UPDATE: closure, USER_CONNECTIONS_UPDATE: closure, STREAM_START: closure, STREAM_STOP: closure, USER_SETTINGS_PROTO_UPDATE: USER_SETTINGS_PROTO_UPDATE_54579, EMBEDDED_ACTIVITY_CLOSE: closure, RUNNING_GAME_TOGGLE_DETECTION: closure}); (require(2) /* metro dependency 2 */).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 object3; 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 game; var object5; var moduleValue3; var object6; const items4 = []; const value2 = undefined; const CustomStatusSetting = (require(3829) /* metro dependency 3829: UserSettings */).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; object3 = {}; object3.type = ActivityTypes.STREAMING; copyDataProperties(object3, stream, items4); Reflect.apply(push, items4, [object3]); } const Set = global.Set; const set = new Set(); const defaultImport = importDefault(22) /* metro dependency 22 */; defaultImport.forEach(env0_25, _fun54559); const getCurrentUserActiveStream = ApplicationStreamingStore.getCurrentUserActiveStream; const value19 = value4 != Reflect.apply(getCurrentUserActiveStream, ApplicationStreamingStore, []); 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); arraySpread(items3, SessionsStore.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; object5 = {}; object5.type = ActivityTypes.PLAYING; object5.name = r8.name; id = r8.id; object5.application_id = value4 != id ? id : value4 == game ? value2 : game.id; object5.timestamps = {start: value4 != env0_26 ? env0_26 : r8.start}; moduleValue3 = require(4483) /* metro dependency 4483: RobloxSubgameUtils */; copyDataProperties(object5, moduleValue3.maybeAddAdditionalGameMetadata(r8), r17); Reflect.apply(push, items4, [object5]); } } else { game = DetectableGameStore.findGame(r8); push = items4.push; object5 = {}; object5.type = ActivityTypes.PLAYING; object5.name = r8.name; id = r8.id; object5.application_id = value4 != id ? id : value4 == game ? value2 : game.id; object5.timestamps = {start: value4 != env0_26 ? env0_26 : r8.start}; moduleValue3 = require(4483) /* metro dependency 4483: RobloxSubgameUtils */; copyDataProperties(object5, moduleValue3.maybeAddAdditionalGameMetadata(r8), r17); Reflect.apply(push, items4, [object5]); } } } } const activity = SpotifyStore.getActivity(); if (value4 != activity) { push = items4.push; object6 = {}; object6.type = ActivityTypes.LISTENING; copyDataProperties(object6, activity, r17); Reflect.apply(push, items4, [object6]); } if ((importDefault(644) /* metro dependency 644 */)(env0_24, items4)) { } return value2; } 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 closure = LocalActivityStore; env0_7(closure, a0); return env0_4(closure, [{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 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 object3; var value9; var value10; const object4 = {}; 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 = env0_8; 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]; object3 = {}; copyDataProperties(object3, property3, value8); object3['flags'] = activityFlags; items2[1] = object3; items2[2] = property4; object4[property] = items2; value9 = true; r6 = value9; } else { object4[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; } 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 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 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 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 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_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; }