/* Metro module 11326; source: modules/activities/useSubscribeMissingActivities.tsx; dependencies: [57, 31, 11327, 4396, 566, 11329, 2] */ import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */ import PresenceStore from '../../stores/PresenceStore.tsx'; /* Metro dependency 4396 */ import PresenceSubscriptionsStore from '../presence_subscriptions/PresenceSubscriptionsStore.tsx'; /* Metro dependency 11327 */ 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 */ 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_6 = []; const env0_7 = []; const env0_8 = []; (FileImportTrackerModule).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 _fun86457() { // fn#86457, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11512:712, 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 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 = Module00057(Reflect.apply(useMemo, binding, [_fun86460, [a0, a1]]), 2); const property = value3[0]; const property2 = value3[1]; const value4 = (FluxModule).useStateFromStoresArray([PresenceStore], _fun86464, [property]); var env0_3 = value4; binding = env0_3; useMemo = binding.useMemo; return [property2, Reflect.apply(useMemo, binding, [_fun86467, [property, value4]])]; 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 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 _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 Module00057.forEach(_fun86465); return []; 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; const env0_0 = a0; const presenceStoreBinding = PresenceStore; if (presenceStoreBinding.findActivity(a0.author.id, _fun86466, null, true) != null) { binding = env0_0; binding.push(a0.id); } 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 _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(Module00057, env0_3); 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 _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 object; 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(); object = {}; object.userId = a0.author.id; object.applicationId = id; object.partyId = party_id; id = a0.id; object.messageId = id; object.channelId = a0.channel_id; object.inviteTime = time; env0_1.push(object); } } } return value; } } } } 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 = Module00057(useMissingActivities(a0, a1), 2); const property = value3[0]; const property2 = value3[1]; ReactModule.useEffect(_fun86471, [property2]); return [property, property2]; 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 presenceSubscriptionsStoreBinding; 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; presenceSubscriptionsStoreBinding = PresenceSubscriptionsStore; isSubscribed = presenceSubscriptionsStoreBinding.isSubscribed; if (!Reflect.apply(isSubscribed, presenceSubscriptionsStoreBinding, [value5])) { moduleValue = require(11329) /* metro dependency 11329: PresenceSubscriptionsActionCreators */; moduleValue.subscribe(value5); } value6 = value3(); done = value6.done; if (done) { break; } r2 = value6; continue; } } } } } function _fun86463(a0) { // fn#86463, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11512:1335, offset: 0x00e46f8c, size: 10 bytes, params: 2, frame: 1 return a0.id; } global.__d(_fun86455, 11326, [57, 31, 11327, 4396, 566, 11329, 2]) /* metro module 11326, dependencies: [57, 31, 11327, 4396, 566, 11329, 2] */;