/* Metro module 11600; source: modules/activities/useEmbeddedAppsForChannel.tsx; dependencies: [31, 4396, 1878, 1378, 566, 3774, 6777, 1360, 2] */ function _fun88829(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#88829, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:6, offset: 0x01ff3c55, size: 259 bytes, params: 8, frame: 20 let env0_0 = require; const _arrayLikeToArray_88832 = 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 = useEmbeddedApps; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importAll(31) /* metro dependency 31 */; const presenceStore = importDefault(4396) /* metro dependency 4396: PresenceStore */; const userStore = importDefault(1878) /* metro dependency 1878: UserStore */; const embeddedActivitiesStore = importDefault(1378) /* metro dependency 1378: EmbeddedActivitiesStore */; const env0_7 = (require(1378) /* metro dependency 1378: EmbeddedActivitiesStore */).NO_ACTIVITIES; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/activities/useEmbeddedAppsForChannel.tsx'); exports.default = useEmbeddedAppsForChannel; exports.useEmbeddedAppsByChannel = useEmbeddedAppsByChannel; exports.useEmbeddedApps = closure; exports.useEmbeddedAppsWithPresence = function(a0) { var env0_0 = a0; return require(dependencyMap[4]).useStateFromStores([PresenceStore], _fun88846, [a0], require(dependencyMap[4]).statesWillNeverBeEqual); }; } function _createForOfIteratorHelperLoose_88830(a0, a1) { // fn#88830, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:166, offset: 0x01ff3d58, 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 _fun88831; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_88832(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_88832(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_88832(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun88831; } 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 useEmbeddedApps(a0, a1) { // fn#88833, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:1076, offset: 0x01ff3ecc, size: 309 bytes, params: 3, frame: 23 var r5; var r10; var value7; var userIds; var value8; var value9; var value10; var add; var value11; var value12; const env0_0 = a0; const env0_1 = a1; let value = a0.map(function(a0) { return a0.applicationId; }); value = (importDefault(6777) /* metro dependency 6777: useGetOrFetchApplications */)(value); const Set = global.Set; const set = new Set([]); const env0_3 = set; const value5 = _createForOfIteratorHelperLoose_88830(a0); const value6 = value5(); let done = value6.done; if (!done) { r5 = value6; reducibleLoop1: while (true) { _createForOfIteratorHelperLoose_88830Binding = _createForOfIteratorHelperLoose_88830; value7 = r5.value; userIds = value7.userIds; value8 = _createForOfIteratorHelperLoose_88830Binding(userIds); value9 = value8(); done = value9.done; if (!done) { r10 = value9; reducibleLoop2: while (true) { value10 = r10.value; add = set.add; Reflect.apply(add, set, [value10]); value11 = value8(); done = value11.done; if (done) { break reducibleLoop2; } r10 = value11; continue reducibleLoop2; } } value12 = value5(); done = value12.done; if (done) { break reducibleLoop1; } r5 = value12; continue reducibleLoop1; } } return env0_3.useMemo(_fun88836, [a0, value, (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([UserStore], _fun88835, [set]), a1]); } function useEmbeddedAppsForChannel(a0, a1) { // fn#88839, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:2003, offset: 0x01ff41ad, size: 80 bytes, params: 3, frame: 16 const env0_0 = a0; const fluxModule = require(566) /* metro dependency 566: flux */; const useStateFromStoresArray = fluxModule.useStateFromStoresArray; return useEmbeddedApps(Reflect.apply(useStateFromStoresArray, fluxModule, [[EmbeddedActivitiesStore], _fun88840]), a1); } function useEmbeddedAppsByChannel(a0) { // fn#88841, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:2215, offset: 0x01ff424e, size: 109 bytes, params: 2, frame: 17 const env0_0 = a0; const fluxModule = require(566) /* metro dependency 566: flux */; const useStateFromStores = fluxModule.useStateFromStores; return env0_3.useMemo(_fun88843, [useEmbeddedApps(Reflect.apply(useStateFromStores, fluxModule, [[EmbeddedActivitiesStore], _fun88842]))]); } function useEmbeddedAppsWithPresence(a0) { // fn#88845, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:2644, offset: 0x01ff4391, size: 96 bytes, params: 2, frame: 21 const env0_0 = a0; return (require(566) /* metro dependency 566: flux */).useStateFromStores([PresenceStore], function() { var Map = global.Map; var value2 = new Map(); value2.forEach(_fun88847); return value2; }, [a0], (require(566) /* metro dependency 566: flux */).statesWillNeverBeEqual); } function _fun88835() { // fn#88835, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:1369, offset: 0x01ff4001, size: 84 bytes, params: 1, frame: 17 var r2; var value5; var push; var getUser; var value6; const items2 = []; const value3 = _createForOfIteratorHelperLoose_88830(env0_3); const value4 = value3(); let done = value4.done; if (!done) { for (r2 = value4; true; r2 = value6) { value5 = r2.value; push = items2.push; getUser = UserStore.getUser; Reflect.apply(push, items2, [Reflect.apply(getUser, UserStore, [value5])]); value6 = value3(); done = value6.done; if (done) { break; } } } return items2; } function _fun88836() { // fn#88836, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:1506, offset: 0x01ff4055, size: 122 bytes, params: 1, frame: 13 const Map = global.Map; let map = new Map(); const env0_0 = map; env0_4.forEach(_fun88837); map = env0_0.map(_fun88838); return map.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish); } function _fun88840() { // fn#88840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:2104, offset: 0x01ff41fd, size: 81 bytes, params: 1, frame: 12 return env0_0 == null || env0_0.id == null ? NO_ACTIVITIES : env0_0.id !== '' ? EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(env0_0.id) : NO_ACTIVITIES; } function _fun88842() { // fn#88842, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:2307, offset: 0x01ff42bb, size: 46 bytes, params: 1, frame: 12 return env0_0 != null ? EmbeddedActivitiesStore.getEmbeddedActivitiesForGuild(env0_0) : NO_ACTIVITIES; } function _fun88843() { // fn#88843, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:2377, offset: 0x01ff42e9, size: 60 bytes, params: 1, frame: 12 const Map = global.Map; const map = new Map(); env0_1.forEach(_fun88844); return map; } function _fun88846() { // fn#88846, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:2724, offset: 0x01ff43f1, size: 60 bytes, params: 1, frame: 12 const Map = global.Map; const map = new Map(); map.forEach(_fun88847); return map; } function _fun88837(a0) { // fn#88837, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:1536, offset: 0x01ff40cf, size: 36 bytes, params: 2, frame: 13 var binding; if (a0 != null) { binding = env0_0; binding.set(a0.id, a0); } } function _fun88838(a0, a1) { // fn#88838, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:1579, offset: 0x01ff40f3, size: 186 bytes, params: 3, frame: 21 var r6; var value3; var value4; var value5; var done; var value7; var binding; var value8; var moduleValue; var value9; const property = env1_2[a1]; const items2 = []; const value2 = null; if (value2 != items2) { value3 = environment.__proto__.__proto__; value4 = _createForOfIteratorHelperLoose_88830(a0.userIds); value5 = value4(); done = value5.done; if (!done) { r6 = value5; while (true) { value7 = r6.value; binding = env0_0; value8 = binding.get(value7); if (value2 != value8) { if (value2 == require) { break; } moduleValue = require(value8); if (value2 == moduleValue) { break; } items2.push(moduleValue); break; } value9 = value4(); done = value9.done; if (done) { break; } r6 = value9; continue; } } } return value2 == property ? value2 : {embeddedActivity: a0, application: property, userParticipantAvatarUrls: items2}; } function _fun88844(a0) { // fn#88844, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:2414, offset: 0x01ff4325, size: 108 bytes, params: 2, frame: 16 var r3; var binding; let value = environment.__proto__.__proto__; const getEmbeddedActivityLocationChannelId = (require(3774) /* metro dependency 3774: embeddedActivityLocationUtils */).getEmbeddedActivityLocationChannelId; value = Reflect.apply(getEmbeddedActivityLocationChannelId, value, [a0.embeddedActivity.location]); if (value != null) { binding = env0_0; r3 = binding.get(value) ?? []; r3.push(a0); binding = env0_0; binding.set(value, r3); } } function _fun88847(a0) { // fn#88847, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:2761, offset: 0x01ff442d, size: 152 bytes, params: 2, frame: 18 var r8; var environment; var r2; var value2; const env0_0 = a0; let value = environment.__proto__.__proto__; const findActivity = PresenceStore.findActivity; value = undefined; if (a0 == null) { r2 = value; } else { value2 = a0.embeddedActivity.userIds.values(); r2 = value2.next().value; r8 = value2; } const activity = Reflect.apply(findActivity, PresenceStore, [r2, _fun88848]); const binding = env0_0; const set = binding.set; const id = a0 == null || a0.application == null ? value : a0.application.id; const object2 = {}; copyDataProperties(object2, a0, r8); object2['presenceActivity'] = activity; Reflect.apply(set, binding, [id, object2]); return value; } function _fun88848({application_id}) { // fn#88848, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:2853, offset: 0x01ff44c5, size: 56 bytes, params: 2, frame: 6 return application_id === (env0_0 == null || env0_0.application == null ? undefined : env0_0.application.id); }