/* Metro module 11327; source: modules/presence_subscriptions/PresenceSubscriptionsStore.tsx; dependencies: [6, 7, 15, 17, 18, 57, 4396, 4237, 11328, 4041, 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 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 PresenceStore from '../../stores/PresenceStore.tsx'; /* Metro dependency 4396 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as TimersModule from '../../external/discord_common/js/packages/timers/Timers.tsx'; /* Metro dependency 4041 */ import * as ConstantsModule from '../activities/Constants.tsx'; /* Metro dependency 4237 */ function _fun86472(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#86472, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11513:6, offset: 0x01f959a8, size: 447 bytes, params: 8, frame: 21 const makeSubscriptionId = function(a0, a1) { return '' + a0 + ':' + a1; }; const closure = function() { env0_10 = {}; env0_11 = {}; }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let env0_10 = {}; let env0_11 = {}; const DelayedCall = (TimersModule).DelayedCall; let delayedCall = new DelayedCall(3000, flush_86479); const Store = (Flux).Store; _fun86480(Store).displayName = 'PresenceSubscriptionsStore'; delayedCall = new delayedCall(importDefault(694) /* metro dependency 694: Dispatcher */, {PRESENCE_SUBSCRIPTIONS_ADD: PRESENCE_SUBSCRIPTIONS_ADD, CONNECTION_OPEN: closure, CONNECTION_RESUMED: closure, LOGOUT: function() { env0_10 = {}; env0_11 = {}; }}); (FileImportTrackerModule).fileFinishedImporting('modules/presence_subscriptions/PresenceSubscriptionsStore.tsx'); exports.default = delayedCall; function _isNativeReflectConstruct_86473() { // fn#86473, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11513:199, offset: 0x01f95b67, 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_86473_isNativeReflectConstruct = function() { return !!result; })(); } function _isSubscribed({applicationId, partyId}) { // fn#86477, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11513:674, offset: 0x01f95bc9, size: 50 bytes, params: 2, frame: 14 const subscriptionId = makeSubscriptionId(applicationId, partyId); return subscriptionId in env0_10 || subscriptionId in env0_11; } function flush_86479() { // fn#86479, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11513:493, offset: 0x01f95c0e, size: 156 bytes, params: 1, frame: 20 var r5; var property; var value4; var property2; var push; var value5; var subscribeActivities; const items2 = []; const Object = global.Object; const entries = Object.entries; let value = environment; const value2 = Reflect.apply(entries, Object, [env0_11]); let length = value2.length; const value3 = 0; if (value3 < length) { r5 = value3; reducibleLoop1: while (true) { property = value2[r5]; value4 = Module00057(property, 2); property = value4[value3]; property2 = value4[1]; push = items2.push; Reflect.apply(push, items2, [property2]); env0_10[property] = property2; delete env0_11[property]; value5 = typeof r5 === 'bigint' ? r5 + 1n : +r5 + 1; length = value2.length; if (value5 < length) { r5 = value5; continue reducibleLoop1; } break reducibleLoop1; } } reducibleJoin4: while (true) { if (value3 === items2.length) { break reducibleJoin4; } value = importDefault(11328) /* metro dependency 11328: ActivitiesActionCreators */; subscribeActivities = value.subscribeActivities; Reflect.apply(subscribeActivities, value, [items2]); break reducibleJoin4; } } function _fun86480(a0) { // fn#86480, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11513:831, offset: 0x01f95caa, size: 97 bytes, params: 2, frame: 16 const PresenceSubscriptionsStore2 = PresenceSubscriptionsStore; Inherits(PresenceSubscriptionsStore2, a0); return CreateClass(PresenceSubscriptionsStore2, [{key: 'initialize', value: function() { this.waitFor(PresenceStore); }}, {key: 'isSubscribed', value: function(a0) { return _isSubscribed(a0); }}]); function PresenceSubscriptionsStore() { // fn#86481, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11513:843, offset: 0x00ea76ec, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_2(this, PresenceSubscriptionsStore); const value3 = env1_5(PresenceSubscriptionsStore); return env1_4(this, _isNativeReflectConstruct_86473() ? global.Reflect.construct(value3, arguments, env1_5(this).constructor) : value3.apply(this, arguments)); } } function PRESENCE_SUBSCRIPTIONS_ADD({subscription}) { // fn#86484, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11513:1395, offset: 0x01f95d0b, size: 395 bytes, params: 2, frame: 24 var r6; var r7; var r0; var property; var value7; var expiresAt; var value8; var value10; var value11; let Date = global.Date; let value = Date.now(); let Object = global.Object; const value3 = Object.entries(env0_10); let length = value3.length; if (0 < length) { r6 = 0; r7 = false; while (true) { property = value3[r6]; value7 = Module00057(property, 2); property = value7[0]; expiresAt = value7[1].expiresAt; if (expiresAt < value) { delete env0_10[property]; r7 = true; } value8 = typeof r6 === 'bigint' ? r6 + 1n : +r6 + 1; length = value3.length; if (value8 < length) { r6 = value8; continue; } r0 = r7; break; } } else { r0 = false; } Object = global.Object; const value9 = Object.entries(env0_11); length = value9.length; if (0 < length) { r6 = 0; r7 = r0; while (true) { property = value9[r6]; value10 = Module00057(property, 2); property = value10[0]; expiresAt = value10[1].expiresAt; if (expiresAt < value) { delete env0_11[property]; r7 = true; } value11 = typeof r6 === 'bigint' ? r6 + 1n : +r6 + 1; length = value9.length; if (value11 < length) { r6 = value11; continue; } r0 = r7; break; } } const userId = subscription.userId; const applicationId = subscription.applicationId; const partyId = subscription.partyId; const messageId = subscription.messageId; const channelId = subscription.channelId; const inviteTime = subscription.inviteTime; if (_isSubscribed(subscription)) { return r0; } value = inviteTime + INVITE_EXPIRATION_MS; Date = global.Date; if (value < Date.now()) { return r0; } value = makeSubscriptionId(applicationId, partyId); Date = global.Date; env0_11[value] = {userId: userId, applicationId: applicationId, partyId: partyId, messageId: messageId, channelId: channelId, expiresAt: INVITE_EXPIRATION_MS + Date.now()}; env0_12.delay(); return true; } } global.__d(_fun86472, 11327, [6, 7, 15, 17, 18, 57, 4396, 4237, 11328, 4041, 566, 694, 2]) /* metro module 11327, dependencies: [6, 7, 15, 17, 18, 57, 4396, 4237, 11328, 4041, 566, 694, 2] */;