/* Metro module 9163; source: stores/InviteSuggestionsStore.tsx; dependencies: [6, 7, 15, 17, 18, 7233, 5221, 1379, 3784, 3793, 661, 4118, 9153, 1360, 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 Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import ChannelStore from './ChannelStore.tsx'; /* Metro dependency 1379 */ import PermissionStore from './PermissionStore.tsx'; /* Metro dependency 3784 */ import RelationshipStore from './RelationshipStore.tsx'; /* Metro dependency 3793 */ import UserAffinitiesV2Store from '../modules/user_affinities/UserAffinitiesV2Store.tsx'; /* Metro dependency 5221 */ import QuickSwitcherStore from '../modules/quickswitcher/QuickSwitcherStore.tsx'; /* Metro dependency 7233 */ import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */ import * as ConstantsModule2 from '../modules/instant_invite/Constants.tsx'; /* Metro dependency 4118 */ import * as InstantInviteUtilsModule from '../utils/InstantInviteUtils.tsx'; /* Metro dependency 9153 */ function _fun71847(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#71847, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:6, offset: 0x01d2f6df, size: 553 bytes, params: 8, frame: 20 const env0_0 = require; const _arrayLikeToArray_71853 = 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 _updateInviteSuggestions = function(a0) { env0_22 = a0; var Map = global.Map; var value3 = new Map(); a0.forEach(_fun71860); }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const Set = global.Set; const set = new Set(); let env0_22 = []; let Map = global.Map; let map = new Map(); const env0_24 = {'numFriends': 0, 'numDms': 0, 'numGroupDms': 0, 'numChannels': 0}; const Store = (Flux).Store; _fun71861(Store).displayName = 'InviteSuggestionsStore'; map = new map(importDefault(694) /* metro dependency 694: Dispatcher */, {LOAD_INVITE_SUGGESTIONS: LOAD_INVITE_SUGGESTIONS, INVITE_SUGGESTIONS_SEARCH: function({query}) { env0_16 = query !== ''; query = _computeRows(query).rows; query.sort(_fun71871); _updateInviteSuggestions(query); }}); (FileImportTrackerModule).fileFinishedImporting('stores/InviteSuggestionsStore.tsx'); exports.default = map; function _isNativeReflectConstruct_71848() { // fn#71848, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:275, offset: 0x01d2f908, 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_71848_isNativeReflectConstruct = function() { return !!result; })(); } function _createForOfIteratorHelperLoose_71851(a0, a1) { // fn#71851, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:468, offset: 0x01d2f96a, 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 _fun71852; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_71853(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_71853(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_71853(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun71852; } 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 _fun71852() { // fn#71852, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:1039, 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 _computeRows(a0) { // fn#71854, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:1473, offset: 0x01d2fade, size: 536 bytes, params: 2, frame: 21 var type; var r4; var id; var r8; var EMBEDDED_APPLICATION; var value7; var relationshipStoreBinding; var isBlockedOrIgnored; var id2; var isBlockedOrIgnored2; var add; var id3; var value12; var otherUserId; var value13; var quickSwitcherStoreBinding; var getChannelHistory; var value16; var map; var value17; var filter; var isNotNullish; var value18; var value19; var value20; var slice; var value21; var forEach; let Set = global.Set; let set = new Set(); let binding = env0_18; const value3 = null; reducibleJoin2: while (true) { if (value3 == binding) { type = undefined; break reducibleJoin2; } type = binding.type; break reducibleJoin2; } const GUILD_VOICE = ChannelTypes.GUILD_VOICE; const value5 = type === GUILD_VOICE; const value6 = value3 == env0_17; reducibleJoin4: while (true) { if (value6) { r4 = value6; break reducibleJoin4; } binding = env0_20; EMBEDDED_APPLICATION = InviteTargetTypes.EMBEDDED_APPLICATION; value7 = binding === EMBEDDED_APPLICATION; r4 = value7; break reducibleJoin4; } r4 = !r4 ? value5 : r4; reducibleJoin7: while (true) { if (r4) { id = value3; break reducibleJoin7; } id = env0_17.id; break reducibleJoin7; } const mostRecentDMedUser = (InstantInviteUtilsModule).getMostRecentDMedUser(env0_21, id); const value9 = value3 == mostRecentDMedUser; reducibleJoin9: while (true) { if (value9) { r8 = value9; break reducibleJoin9; } relationshipStoreBinding = RelationshipStore; isBlockedOrIgnored = relationshipStoreBinding.isBlockedOrIgnored; id2 = mostRecentDMedUser.id; isBlockedOrIgnored2 = Reflect.apply(isBlockedOrIgnored, relationshipStoreBinding, [id2]); r8 = isBlockedOrIgnored2; break reducibleJoin9; } reducibleJoin11: while (true) { if (r8) { break reducibleJoin11; } add = set.add; id3 = mostRecentDMedUser.id; Reflect.apply(add, set, [id3]); break reducibleJoin11; } const _createForOfIteratorHelperLoose_71851Binding = _createForOfIteratorHelperLoose_71851; const userAffinitiesV2StoreBinding = UserAffinitiesV2Store; const getUserAffinities = userAffinitiesV2StoreBinding.getUserAffinities; const value10 = _createForOfIteratorHelperLoose_71851Binding(Reflect.apply(getUserAffinities, userAffinitiesV2StoreBinding, [])); const value11 = value10(); let done = value11.done; if (!done) { r8 = value11; reducibleLoop12: while (true) { value12 = r8.value; add = set.add; otherUserId = value12.otherUserId; Reflect.apply(add, set, [otherUserId]); value13 = value10(); done = value13.done; if (done) { break reducibleLoop12; } r8 = value13; continue reducibleLoop12; } } Set = global.Set; set = new Set(); binding = env0_20; EMBEDDED_APPLICATION = InviteTargetTypes.EMBEDDED_APPLICATION; reducibleJoin15: while (true) { if (binding !== EMBEDDED_APPLICATION) { break reducibleJoin15; } quickSwitcherStoreBinding = QuickSwitcherStore; getChannelHistory = quickSwitcherStoreBinding.getChannelHistory; value16 = Reflect.apply(getChannelHistory, quickSwitcherStoreBinding, []); map = value16.map; value17 = Reflect.apply(map, value16, [function(a0) { return ChannelStore.getChannel(a0); }]); filter = value17.filter; isNotNullish = (require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish; value18 = Reflect.apply(filter, value17, [isNotNullish]); filter = value18.filter; value19 = Reflect.apply(filter, value18, [_fun71856]); filter = value19.filter; value20 = Reflect.apply(filter, value19, [_fun71857]); slice = value20.slice; value21 = Reflect.apply(slice, value20, [0, 3]); forEach = value21.forEach; Reflect.apply(forEach, value21, [_fun71858]); break reducibleJoin15; } return InstantInviteUtilsModule.generateRowsForQuery({query: a0, omitUserIds: env0_21, suggestedUserIds: set, maxRowsWithoutQuery: 100, omitGuildId: id, suggestedChannelIds: set, inviteTargetType: env0_20}); function _fun71856({type}) { // fn#71856, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:1955, offset: 0x01d2fd0c, size: 27 bytes, params: 2, frame: 2 const GUILD_TEXT = ChannelTypes.GUILD_TEXT; return type === GUILD_TEXT; } function _fun71857(a0) { // fn#71857, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:1990, offset: 0x01d2fd27, size: 34 bytes, params: 2, frame: 13 const permissionStoreBinding = PermissionStore; const can = permissionStoreBinding.can; const SEND_MESSAGES = Permissions.SEND_MESSAGES; return Reflect.apply(can, permissionStoreBinding, [SEND_MESSAGES, a0]); } function _fun71858({id}) { // fn#71858, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:2040, offset: 0x0112d4f2, size: 27 bytes, params: 2, frame: 11 return env0_0.add(id); } } function _updateInviteSuggestions(a0) { // fn#71859, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:2218, offset: 0x01d2fd49, size: 65 bytes, params: 2, frame: 12 env0_22 = a0; const Map = global.Map; const map = new Map(); a0.forEach(_fun71860); function _fun71860(a0, a1) { // fn#71860, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:2280, offset: 0x01d2fd8a, size: 34 bytes, params: 3, frame: 13 env1_23.set(a0, {index: a1}); } } function _fun71861(a0) { // fn#71861, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:2316, offset: 0x01d2fdac, size: 176 bytes, params: 2, frame: 16 const InviteSuggestionsStore2 = InviteSuggestionsStore; Inherits(InviteSuggestionsStore2, a0); return CreateClass(InviteSuggestionsStore2, [{key: 'initialize', value: function() { this.waitFor(ChannelStore, PermissionStore, QuickSwitcherStore, RelationshipStore, UserAffinitiesV2Store); }}, {key: 'getInviteSuggestionRows', value: value_71864}, {key: 'getTotalSuggestionsCount', value: value_71865}, {key: 'getInitialCounts', value: value_71866}, {key: 'getSelectedInviteMetadata', value: value_71867}]); function InviteSuggestionsStore() { // fn#71862, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:2328, offset: 0x0117dc78, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_2(this, InviteSuggestionsStore); const value3 = env1_5(InviteSuggestionsStore); return env1_4(this, _isNativeReflectConstruct_71848() ? global.Reflect.construct(value3, arguments, env1_5(this).constructor) : value3.apply(this, arguments)); } function value_71864() { // fn#71864, offset: 0x00e425c8, size: 9 bytes, params: 1, frame: 1 return env1_22; } function value_71865() { // fn#71865, offset: 0x00df0e8b, size: 9 bytes, params: 1, frame: 1 return env1_15; } function value_71866() { // fn#71866, offset: 0x00df3acd, size: 9 bytes, params: 1, frame: 1 return env1_24; } function value_71867(a0) { // fn#71867, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:2903, offset: 0x01d2fe87, size: 121 bytes, params: 2, frame: 14 var object; var length; const value2 = env1_23.get(a0); if (value2 != null) { object = {}; object.rowNum = value2.index; object.isAffinitySuggestion = a0.isSuggested; length = env1_22.length; object.numTotal = length; length = UserAffinitiesV2Store.getUserAffinities().map(function(a0) { return a0.otherUserId; }).length; object.numAffinityConnections = length; object.isFiltered = env1_16; return object; } } } function LOAD_INVITE_SUGGESTIONS({omitUserIds, guild, channel, applicationId, inviteTargetType}) { // fn#71869, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:3216, offset: 0x01d2ff0b, size: 261 bytes, params: 2, frame: 19 const r3 = channel != null ? guild : null; channel2 = channel; applicationId2 = applicationId; const blockedOrIgnoredIDs = RelationshipStore.getBlockedOrIgnoredIDs(); const getUsersAlreadyJoined = InstantInviteUtilsModule.getUsersAlreadyJoined; const binding = applicationId2; const value3 = Reflect.apply(getUsersAlreadyJoined, InstantInviteUtilsModule, [{channel: channel2, applicationId: binding, inviteTargetType: inviteTargetType}]); const Set = global.Set; items2 = []; arraySpread(items2, value3, arraySpread(items2, blockedOrIgnoredIDs, arraySpread(items2, omitUserIds, 0, binding), binding), binding); const set = new Set(items2); const {rows, counts} = _computeRows(''); _updateInviteSuggestions(rows); env0_15 = env0_22.length; } function INVITE_SUGGESTIONS_SEARCH({query}) { // fn#71870, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:3610, offset: 0x01d30010, size: 72 bytes, params: 2, frame: 13 result = query !== ''; const rows = _computeRows(query).rows; rows.sort(function(a0, a1) { return a0.score != null && a1.score != null ? a0.score - a1.score : 0; }); _updateInviteSuggestions(rows); } } function _fun71871(a0, a1) { // fn#71871, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9348:3687, offset: 0x01d30058, size: 56 bytes, params: 3, frame: 6 return a0.score != null && a1.score != null ? a0.score - a1.score : 0; } global.__d(_fun71847, 9163, [6, 7, 15, 17, 18, 7233, 5221, 1379, 3784, 3793, 661, 4118, 9153, 1360, 566, 694, 2]) /* metro module 9163, dependencies: [6, 7, 15, 17, 18, 7233, 5221, 1379, 3784, 3793, 661, 4118, 9153, 1360, 566, 694, 2] */;