/* Metro module 11600; source: modules/activities/useEmbeddedAppsForChannel.tsx; dependencies: [31, 4396, 1878, 1378, 566, 3774, 6777, 1360, 2] */ import EmbeddedActivitiesStore from './EmbeddedActivitiesStore.tsx'; /* Metro dependency 1378 */ import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */ import PresenceStore from '../../stores/PresenceStore.tsx'; /* Metro dependency 4396 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */ import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as GlobalUtilsModule from '../../utils/GlobalUtils.tsx'; /* Metro dependency 1360 */ import * as EmbeddedActivitiesStoreModule from './EmbeddedActivitiesStore.tsx'; /* Metro dependency 1378 */ import * as EmbeddedActivityLocationUtilsModule from './utils/embeddedActivityLocationUtils.tsx'; /* Metro dependency 3774 */ 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 useEmbeddedApps2 = useEmbeddedApps; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/activities/useEmbeddedAppsForChannel.tsx'); exports.default = useEmbeddedAppsForChannel; exports.useEmbeddedAppsByChannel = useEmbeddedAppsByChannel; exports.useEmbeddedApps = useEmbeddedApps2; 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 _fun88831() { // fn#88831, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11786:737, 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 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 set2 = 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 set2.useMemo(_fun88836, [a0, value, (FluxModule).useStateFromStoresArray([UserStore], _fun88835, [set]), a1]); 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 userStoreBinding; var getUser; var value6; const items2 = []; const value3 = _createForOfIteratorHelperLoose_88830(ReactModule); const value4 = value3(); let done = value4.done; if (!done) { for (r2 = value4; true; r2 = value6) { value5 = r2.value; push = items2.push; userStoreBinding = UserStore; getUser = userStoreBinding.getUser; Reflect.apply(push, items2, [Reflect.apply(getUser, userStoreBinding, [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 map2 = map; env0_4.forEach(_fun88837); map = map2.map(_fun88838); return map.filter((GlobalUtilsModule).isNotNullish); 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 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 useStateFromStoresArray = FluxModule.useStateFromStoresArray; return useEmbeddedApps(Reflect.apply(useStateFromStoresArray, FluxModule, [[EmbeddedActivitiesStore], _fun88840]), a1); 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 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 useStateFromStores = FluxModule.useStateFromStores; return ReactModule.useMemo(_fun88843, [useEmbeddedApps(Reflect.apply(useStateFromStores, FluxModule, [[EmbeddedActivitiesStore], _fun88842]))]); 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 _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 = (EmbeddedActivityLocationUtilsModule).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 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 _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 _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 presenceStoreBinding = PresenceStore; const findActivity = presenceStoreBinding.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, presenceStoreBinding, [r2, _fun88848]); const binding = env0_0; const set = binding.set; const id = a0 == null || a0.application == null ? value : a0.application.id; const object = {}; copyDataProperties(object, a0, r8); object['presenceActivity'] = activity; Reflect.apply(set, binding, [id, object]); 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); } } } } } global.__d(_fun88829, 11600, [31, 4396, 1878, 1378, 566, 3774, 6777, 1360, 2]) /* metro module 11600, dependencies: [31, 4396, 1878, 1378, 566, 3774, 6777, 1360, 2] */;