/* Metro module 10580; source: stores/GamePartyStore.tsx; dependencies: [6, 7, 15, 17, 18, 1226, 3793, 6876, 661, 22, 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 Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import AuthenticationStore from './AuthenticationStore.tsx'; /* Metro dependency 1226 */ import RelationshipStore from './RelationshipStore.tsx'; /* Metro dependency 3793 */ import SelfPresenceStore from './SelfPresenceStore.tsx'; /* Metro dependency 6876 */ import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */ function _fun81607(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#81607, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:6, offset: 0x01ed7b3f, size: 571 bytes, params: 8, frame: 22 const _arrayLikeToArray_81613 = function(a0, a1) { var r0; var r1; var r2; var value3; var length; var value5; var value = undefined; var value2 = value == null; reducibleJoin2: while (true) { if (value2) { r0 = value2; break reducibleJoin2; } value3 = value > a0.length; r0 = value3; break reducibleJoin2; } reducibleJoin4: while (true) { if (r0) { length = a0.length; r1 = length; break reducibleJoin4; } r1 = value; break reducibleJoin4; } value = (0, global.Array)(r1); var value4 = 0; if (value4 < r1) { r2 = value4; reducibleLoop5: while (true) { value[r2] = a0[r2]; value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1; if (value5 < r1) { r2 = value5; continue reducibleLoop5; } break reducibleLoop5; } } return value; }; const closure = function({guild}) { var r2; var r3; var r0; var value5; var user; var status; var activities; var updatePartyBinding; var id; var value6; var value7; var value2 = _createForOfIteratorHelperLoose_81611(guild.presences); var value3 = value2(); var value4 = false; if (value3.done) { r0 = value4; } else { r2 = value4; r3 = value3; while (true) { value5 = r3.value; user = value5.user; status = value5.status; activities = value5.activities; updatePartyBinding = updateParty; id = guild.id; if (value4 !== updatePartyBinding(id, user.id, activities, status)) { value6 = true; r2 = value6; } value7 = value2(); if (value7.done) { r0 = r2; break; } r3 = value7; continue; } } return r0; }; const handleLocalPresenceUpdate_81621 = function() { return updateParty(ME, AuthenticationStore.getId(), SelfPresenceStore.getActivities()); }; const RELATIONSHIP_ADD_816222 = RELATIONSHIP_ADD_81622; let Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let env0_12 = {}; let Map = global.Map; let map = new Map(); const Store = (Flux).Store; _fun81623(Store).displayName = 'GamePartyStore'; map = new map(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN_SUPPLEMENTAL: CONNECTION_OPEN_SUPPLEMENTAL_81629, OVERLAY_INITIALIZE: function(a0) { var r5; var parties = a0.parties; var env0_0 = parties; var userParties = a0.userParties; var Map = global.Map; env0_13 = new Map(); var object = {}; copyDataProperties(object, userParties, r5); env0_12 = object; var Object = global.Object; Object.keys(parties).forEach(_fun81631); }, GUILD_CREATE: closure, PRESENCES_REPLACE: function({presences}) { var r2; var r3; var r1; var r0; var user; var value5; var value6; var value7; var value8; var value2 = _createForOfIteratorHelperLoose_81611(presences); var value3 = value2(); var value4 = false; if (value3.done) { r0 = value4; } else { r2 = value4; r3 = value3; while (true) { presences = r3.value; user = presences.user; presences = presences.activities; value5 = user != null; if (value5) { value6 = value4 !== updateParty(ME, user.id, presences); r1 = value6; } else { r1 = value5; } if (!r1) { continue; } value7 = true; r2 = value7; value8 = value2(); if (value8.done) { r0 = r2; break; } r3 = value8; continue; } } return r0; }, PRESENCE_UPDATES: function({updates}) { return updates.map(_fun81634).some(_fun81635); }, THREAD_MEMBER_LIST_UPDATE: THREAD_MEMBER_LIST_UPDATE_81636, THREAD_MEMBERS_UPDATE: THREAD_MEMBERS_UPDATE_81638, RELATIONSHIP_ADD: RELATIONSHIP_ADD_816222, RELATIONSHIP_UPDATE: RELATIONSHIP_ADD_816222, RELATIONSHIP_REMOVE: RELATIONSHIP_REMOVE_81640}); (FileImportTrackerModule).fileFinishedImporting('stores/GamePartyStore.tsx'); exports.default = map; function _isNativeReflectConstruct_81608() { // fn#81608, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:214, offset: 0x01ed7d7a, 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_81608_isNativeReflectConstruct = function() { return !!result; })(); } function _createForOfIteratorHelperLoose_81611(a0, a1) { // fn#81611, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:407, offset: 0x01ed7ddc, size: 372 bytes, params: 3, frame: 20 var r6; var r9; var r5; var value3; var regexp; const env0_0 = a0; const Symbol = global.Symbol; let value = typeof Symbol !== 'undefined'; let r1 = value && a0[global.Symbol.iterator]; r1 = !r1 ? a0['@@iterator'] : r1; if (r1) { value = r1.call(a0); return value.next.bind(value); } const Array = global.Array; if (Array.isArray(a0)) { if (r1) { } return _fun81612; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_81613(a0, value); r5 = value; } else { value3 = ({}).toString.call(a0).slice(8, -1); r6 = value3 === 'Object' && a0.constructor; r9 = r6 ? a0.constructor.name : value3; if (r9 === 'Map') { r6 = global.Array.from(a0); } else if (r9 === 'Set') { r6 = global.Array.from(a0); } else if (r9 === 'Arguments') { value = _arrayLikeToArray_81613(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_81613(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun81612; } const TypeError = global.TypeError; throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); function _fun81612() { // fn#81612, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:978, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5 return env0_1 >= env0_0.length ? {done: true} : {done: false, value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]}; } } function getPartyForUser(a0, a1) { // fn#81614, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:1336, offset: 0x01ed7f50, size: 31 bytes, params: 3, frame: 2 return (env0_12[a0] ?? ({}))[a1]; } function removeUserFromParty(a0, a1) { // fn#81615, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:1403, offset: 0x01ed7f6f, size: 136 bytes, params: 3, frame: 18 var property; var defaultImport; var value3; const partyForUser = getPartyForUser(a0, a1); if (partyForUser != null) { property = env0_12[a0]; delete property[a1]; defaultImport = importDefault(22) /* metro dependency 22 */; if (defaultImport.isEmpty(property)) { delete env0_12[a0]; } value3 = env0_13.get(partyForUser); if (value3 != null) { value3.delete(a0); if (value3.size === 0) { env0_13.delete(partyForUser); } } } } function updateParty(a0, a1, a2, a3) { // fn#81616, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:1594, offset: 0x01ed7ff7, size: 294 bytes, params: 5, frame: 19 var r6; var r7; var r0; var property; var binding; var object; var relationshipStoreBinding; var value4; var set; var value7; const value = a2.find(function(a0) { return a0.party != null && a0.party.id; }); const value2 = null; const id = value2 != value && value2 != value.party ? value.party.id : value2; const partyForUser = getPartyForUser(a1, a0); if (value2 == id) { value7 = value2 != partyForUser; if (value7) { removeUserFromParty(a1, a0); r0 = true; } else { r0 = value7; } return r0; } const OFFLINE = StatusTypes.OFFLINE; if (a3 === OFFLINE) { value7 = value2 != partyForUser; if (value7) { removeUserFromParty(a1, a0); r0 = true; } else { r0 = value7; } return r0; } if (value2 == partyForUser) { property = env0_12[a1]; if (value2 != property) { r6 = property; } else { binding = env0_12; object = {}; binding[a1] = object; r6 = object; } r6[a0] = id; if (!Reflect.apply(RelationshipStore.isBlocked, relationshipStoreBinding, [a1])) { relationshipStoreBinding = RelationshipStore; if (!relationshipStoreBinding.isIgnored(a1)) { binding = env0_13; value4 = binding.get(id); if (value2 != value4) { r7 = value4; } else { set = new global.Set(); } binding = env0_13; binding.set(id, r7); r7.add(a1); } } } else { if (partyForUser === id) { return false; } removeUserFromParty(a1, a0); property = env0_12[a1]; if (value2 != property) { r6 = property; } else { binding = env0_12; object = {}; binding[a1] = object; r6 = object; } r6[a0] = id; if (!Reflect.apply(RelationshipStore.isBlocked, relationshipStoreBinding, [a1])) { relationshipStoreBinding = RelationshipStore; if (!relationshipStoreBinding.isIgnored(a1)) { binding = env0_13; value4 = binding.get(id); if (value2 != value4) { r7 = value4; } else { set = new global.Set(); } binding = env0_13; binding.set(id, r7); r7.add(a1); } } } return true; } function batchUpdatePresences(a0, a1) { // fn#81619, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:2257, offset: 0x01ed81b0, size: 41 bytes, params: 3, frame: 12 const env0_0 = a0; const env0_1 = false; a1.forEach(_fun81620); return env0_1; function _fun81620(a0) { // fn#81620, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:2319, offset: 0x01ed81d9, size: 69 bytes, params: 2, frame: 18 var r0; let value = a0 != null; if (value) { value = environment.__proto__; value = updateParty(env0_0, a0.user.id, a0.activities, a0.status); r0 = value; } else { r0 = value; } if (r0) { } } } function RELATIONSHIP_ADD_81622({relationship}) { // fn#81622, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:2491, offset: 0x01ed8250, size: 193 bytes, params: 2, frame: 17 var r2; var value4; var get; var value5; var value6; const isBlocked = RelationshipStore.isBlocked; let id = relationship.id; if (!Reflect.apply(isBlocked, relationshipStoreBinding, [id])) { relationshipStoreBinding = RelationshipStore; reducibleJoin3: while (true) { if (!relationshipStoreBinding.isIgnored(relationship.id)) { return false; } break reducibleJoin3; } } let binding = env0_12; const property = binding[relationship.id]; if (property == null) { return false; } const _createForOfIteratorHelperLoose_81611Binding = _createForOfIteratorHelperLoose_81611; const defaultImport = Module00022; const value2 = _createForOfIteratorHelperLoose_81611Binding(defaultImport.values(property)); const value3 = value2(); let done = value3.done; if (!done) { r2 = value3; reducibleLoop5: while (true) { value4 = r2.value; binding = env0_13; get = binding.get; value5 = Reflect.apply(get, binding, [value4]); reducibleJoin7: while (true) { if (value5 == null) { break reducibleJoin7; } id = relationship.id; value5.delete(id); break reducibleJoin7; } value6 = value2(); done = value6.done; if (done) { break reducibleLoop5; } r2 = value6; continue reducibleLoop5; } } } function _fun81623(a0) { // fn#81623, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:2768, offset: 0x01ed8311, size: 153 bytes, params: 2, frame: 16 const GamePartyStore2 = GamePartyStore; Inherits(GamePartyStore2, a0); return CreateClass(GamePartyStore2, [{key: 'initialize', value: function() { this.syncWith([SelfPresenceStore], handleLocalPresenceUpdate_81621); this.waitFor(AuthenticationStore, RelationshipStore, SelfPresenceStore); }}, {key: 'getParty', value: value_81626}, {key: 'getUserParties', value: value_81627}, {key: 'getParties', value: value_81628}]); function GamePartyStore() { // fn#81624, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:2780, offset: 0x0118e06f, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_2(this, GamePartyStore); const value3 = env1_5(GamePartyStore); return env1_4(this, _isNativeReflectConstruct_81608() ? global.Reflect.construct(value3, arguments, env1_5(this).constructor) : value3.apply(this, arguments)); } function value_81626(a0) { // fn#81626, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:3168, offset: 0x01ed83e9, size: 52 bytes, params: 2, frame: 14 const value = null; return value != a0 && env1_13.has(a0) ? env1_13.get(a0) : value; } function value_81627() { // fn#81627, offset: 0x00e2f9de, size: 9 bytes, params: 1, frame: 1 return env1_12; } function value_81628() { // fn#81628, offset: 0x00e2f9d5, size: 9 bytes, params: 1, frame: 1 return env1_13; } } function CONNECTION_OPEN_SUPPLEMENTAL_81629({guilds, presences}) { // fn#81629, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:3418, offset: 0x01ed841d, size: 205 bytes, params: 2, frame: 27 var r3; var r4; var r1; var r0; var r2; var value5; var user; var status; var activities; var value6; var updatePartyBinding; var id; var value7; var value8; var value9; var object; var value12; var value13; var value14; const value2 = _createForOfIteratorHelperLoose_81611(presences); const value3 = value2(); let done = value3.done; if (done) { r0 = false; } else { r3 = false; r4 = value3; while (true) { value5 = r4.value; user = value5.user; status = value5.status; activities = value5.activities; value6 = user != null; if (value6) { updatePartyBinding = updateParty; id = user.id; value7 = updatePartyBinding(ME, id, activities, status) !== false; r1 = value7; } else { r1 = value6; } if (!r1) { continue; } value8 = true; r3 = value8; value9 = value2(); done = value9.done; if (done) { r0 = r3; break; } r4 = value9; continue; } } const value10 = _createForOfIteratorHelperLoose_81611(guilds); const value11 = value10(); done = value11.done; if (!done) { r2 = value11; r3 = r0; while (true) { object = {}; value12 = r2.value; object.guild = value12; if (GUILD_CREATE_81618(object) !== false) { value13 = true; r3 = value13; } value14 = value10(); done = value14.done; if (done) { r0 = r3; break; } r2 = value14; continue; } } return r0; } function OVERLAY_INITIALIZE_81630({parties, userParties}) { // fn#81630, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:3787, offset: 0x01ed84ea, size: 110 bytes, params: 2, frame: 15 const Map = global.Map; const map = new Map(); copyDataProperties({}, userParties, undefined); const Object = global.Object; Object.keys(parties).forEach(_fun81631); function _fun81631(a0) { // fn#81631, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:3890, offset: 0x01ed8558, size: 62 bytes, params: 2, frame: 15 const value = environment.__proto__; const binding = env1_13; const set = binding.set; const Set = global.Set; return Reflect.apply(set, binding, [a0, new Set(parties[a0])]); } } function PRESENCE_UPDATES_81633({updates}) { // fn#81633, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:4191, offset: 0x01ed860c, size: 48 bytes, params: 2, frame: 12 return updates.map(function({guildId, user, status, activities}) { return updateParty(guildId ?? ME, user.id, activities, status); }).some(function(a0) { return a0; }); function _fun81634({guildId, user, status, activities}) { // fn#81634, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:4249, offset: 0x01ed863c, size: 63 bytes, params: 2, frame: 18 return updateParty(guildId ?? ME, user.id, activities, status); } } function THREAD_MEMBER_LIST_UPDATE_81636({guildId, members}) { // fn#81636, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:4369, offset: 0x01ed867b, size: 50 bytes, params: 2, frame: 14 return batchUpdatePresences(guildId, members.map(function(a0) { return a0.presence; })); } function THREAD_MEMBERS_UPDATE_81638({guildId, addedMembers}) { // fn#81638, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:4507, offset: 0x01ed86b8, size: 59 bytes, params: 2, frame: 15 var r0; var batchUpdatePresencesBinding; let value = addedMembers != null; if (value) { batchUpdatePresencesBinding = batchUpdatePresences; value = addedMembers.map(function(a0) { return a0.presence; }); value = batchUpdatePresencesBinding(guildId, value); r0 = value; } else { r0 = value; } return r0; } function RELATIONSHIP_REMOVE_81640({relationship}) { // fn#81640, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10766:4751, offset: 0x01ed86f3, size: 143 bytes, params: 2, frame: 17 var r2; var value4; var value5; var add; var value6; let binding = env0_12; let id = relationship.id; const property = binding[id]; if (property == null) { return false; } const _createForOfIteratorHelperLoose_81611Binding = _createForOfIteratorHelperLoose_81611; const defaultImport = Module00022; const value2 = _createForOfIteratorHelperLoose_81611Binding(defaultImport.values(property)); const value3 = value2(); let done = value3.done; if (!done) { r2 = value3; while (true) { value4 = r2.value; binding = env0_13; value5 = binding.get(value4); if (value5 != null) { add = value5.add; id = relationship.id; Reflect.apply(add, value5, [id]); } value6 = value2(); done = value6.done; if (done) { break; } r2 = value6; continue; } } } } function _fun81635(a0) { // fn#81635, offset: 0x00c37049, size: 5 bytes, params: 2, frame: 1 return a0; } global.__d(_fun81607, 10580, [6, 7, 15, 17, 18, 1226, 3793, 6876, 661, 22, 566, 694, 2]) /* metro module 10580, dependencies: [6, 7, 15, 17, 18, 1226, 3793, 6876, 661, 22, 566, 694, 2] */;