/* Metro module 11326; source: modules/activities/useSubscribeMissingActivities.tsx; dependencies: [57, 31, 11327, 4396, 566, 11329, 2] */ function _fun86455(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#86455, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11512:6, offset: 0x01f95348, size: 222 bytes, params: 8, frame: 19 const env0_0 = require; const _arrayLikeToArray_86458 = 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 Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_2 = importDefault(57) /* metro dependency 57 */; const env0_3 = importAll(31) /* metro dependency 31 */; const presenceSubscriptionsStore = importDefault(11327) /* metro dependency 11327: PresenceSubscriptionsStore */; const presenceStore = importDefault(4396) /* metro dependency 4396: PresenceStore */; const env0_6 = []; const env0_7 = []; const env0_8 = []; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/activities/useSubscribeMissingActivities.tsx'); exports.default = useSubscribeMissingActivities; } function _createForOfIteratorHelperLoose_86456(a0, a1) { // fn#86456, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11512:141, offset: 0x01f95426, 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 _fun86457; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_86458(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_86458(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_86458(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun86457; } 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 useMissingActivities(a0, a1) { // fn#86459, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11512:1070, offset: 0x01f9559a, size: 197 bytes, params: 3, frame: 19 const env0_0 = a0; const env0_1 = a1; let binding = env0_3; let useMemo = binding.useMemo; const value3 = env0_2(Reflect.apply(useMemo, binding, [_fun86460, [a0, a1]]), 2); const property = value3[0]; const property2 = value3[1]; const value4 = (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([PresenceStore], _fun86464, [property]); var env0_3 = value4; binding = env0_3; useMemo = binding.useMemo; return [property2, Reflect.apply(useMemo, binding, [_fun86467, [property, value4]])]; } function useSubscribeMissingActivities(a0, a1) { // fn#86470, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11512:2198, offset: 0x01f958df, size: 97 bytes, params: 3, frame: 16 const value3 = env0_2(useMissingActivities(a0, a1), 2); const property = value3[0]; const property2 = value3[1]; env0_3.useEffect(_fun86471, [property2]); return [property, property2]; } function _fun86460() { // fn#86460, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11512:1122, offset: 0x01f9565f, size: 30 bytes, params: 1, frame: 13 return getMessagesWithActivities(env0_0, require); } function _fun86464() { // fn#86464, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11512:1434, offset: 0x01f95715, size: 36 bytes, params: 1, frame: 12 env0_2.forEach(_fun86465); return []; } function _fun86467() { // fn#86467, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11512:1708, offset: 0x01f957eb, size: 30 bytes, params: 1, frame: 13 return makeActivitySubscriptions(env0_2, env0_3); } function _fun86471() { // fn#86471, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11512:2317, offset: 0x01f95940, size: 104 bytes, params: 1, frame: 16 var r2; var value5; var isSubscribed; var moduleValue; var value6; const value3 = _createForOfIteratorHelperLoose_86456(env0_0); const value4 = value3(); let done = value4.done; if (!done) { r2 = value4; while (true) { value5 = r2.value; isSubscribed = PresenceSubscriptionsStore.isSubscribed; if (!Reflect.apply(isSubscribed, PresenceSubscriptionsStore, [value5])) { moduleValue = require(11329) /* metro dependency 11329: PresenceSubscriptionsActionCreators */; moduleValue.subscribe(value5); } value6 = value3(); done = value6.done; if (done) { break; } r2 = value6; continue; } } } function getMessagesWithActivities(a0, a1) { // fn#86461, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11512:1126, offset: 0x01f9567d, size: 94 bytes, params: 3, frame: 13 var environment; var value; if (a1.isPrivate()) { value = a0.filter(function(a0) { var property = a0.application; var value = undefined; return (property == null ? value : property.id) != null && (a0.activity == null ? value : a0.activity.party_id) != null; }); return [value, value.map(_fun86463)]; } value = environment.__proto__.__proto__; return [env2_8, env2_7]; } function _fun86465(a0) { // fn#86465, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11512:1466, offset: 0x01f95739, size: 83 bytes, params: 2, frame: 18 var binding; if (PresenceStore.findActivity(a0.author.id, _fun86466, null, true) != null) { binding = a0; binding.push(a0.id); } } function makeActivitySubscriptions(a0, a1) { // fn#86468, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11512:1712, offset: 0x01f95809, size: 59 bytes, params: 3, frame: 12 var environment; var value; const env0_0 = a1; if (a0.length === 0) { value = environment.__proto__.__proto__; return env2_6; } a0.forEach(_fun86469); return []; } function _fun86466(a0) { // fn#86466, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11512:1504, offset: 0x01f9578c, size: 95 bytes, params: 2, frame: 8 const application_id = a0.application_id; const application = env0_0.application; const value2 = undefined; return application_id === (application == null ? value2 : application.id) && (a0.party == null ? value2 : a0.party.id) === (env0_0.activity == null ? value2 : env0_0.activity.party_id); } function _fun86469(a0) { // fn#86469, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11512:1804, offset: 0x01f95844, size: 155 bytes, params: 2, frame: 16 var time; var object2; const application = a0.application; const value = undefined; let id = application == null ? value : application.id; const activity = a0.activity; const party_id = activity == null ? value : activity.party_id; if (!(a0.id in require)) { if (id != null) { if (party_id != null) { time = a0.timestamp.getTime(); object2 = {}; object2.userId = a0.author.id; object2.applicationId = id; object2.partyId = party_id; id = a0.id; object2.messageId = id; object2.channelId = a0.channel_id; object2.inviteTime = time; env0_1.push(object2); } } } return value; }