/* Metro module 11330; source: modules/messages/native/MessagesHooks.tsx; dependencies: [57, 31, 27, 9858, 7729, 4646, 1867, 4396, 566, 22, 628, 6772, 1360, 4116, 11331, 9835, 11332, 2] */ function _fun86505(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#86505, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:6, offset: 0x01f966dc, size: 355 bytes, params: 8, frame: 19 const env0_0 = require; const _arrayLikeToArray_86508 = 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_3 = importDefault(57) /* metro dependency 57 */; const env0_4 = importAll(31) /* metro dependency 31 */; const env0_5 = (require(27) /* metro dependency 27 */).findNodeHandle; const voiceChannelStartTimeStore = importDefault(9858) /* metro dependency 9858: VoiceChannelStartTimeStore */; const env0_7 = (require(7729) /* metro dependency 7729: useChatBottomManagerUIStore */).updateShouldShowJumpToPresentButton; const guildAvailabilityStore = importDefault(4646) /* metro dependency 4646: GuildAvailabilityStore */; const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */; const presenceStore = importDefault(4396) /* metro dependency 4396: PresenceStore */; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/messages/native/MessagesHooks.tsx'); exports.useMessageAuthorActivities = useMessageAuthorActivities; exports.useFetchMessageApplications = useFetchMessageApplications; exports.useFetchVoiceChannelInviteStartTimes = useFetchVoiceChannelInviteStartTimes; exports.useMessagesLifecycle = useMessagesLifecycle; exports.useScrollState = useScrollState_86525; exports.useChatUpdatesQueue = useChatUpdatesQueue; exports.useMessagesState = useMessagesState; } function _createForOfIteratorHelperLoose_86506(a0, a1) { // fn#86506, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:234, offset: 0x01f9683f, 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 _fun86507; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_86508(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_86508(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_86508(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun86507; } 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 useMessageAuthorActivities(a0) { // fn#86509, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:1251, offset: 0x01f969b3, size: 110 bytes, params: 2, frame: 16 const env0_0 = a0; return (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([PresenceStore], _fun86512, [env0_4.useMemo(function() { var object = {}; object.forEach(_fun86511); return object; }, [a0])]); } function useFetchMessageApplications(a0) { // fn#86514, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:1553, offset: 0x01f96a91, size: 94 bytes, params: 2, frame: 14 const env0_0 = a0; const binding = env0_4; const value = binding.useMemo(function() { var value2 = new global.Set(); value2.forEach(_fun86516); return global.Array.from(value2); }, [a0]); const env0_2 = binding.useRef([]); binding.useEffect(_fun86517, [value]); } function useFetchVoiceChannelInviteStartTimes(a0) { // fn#86518, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:1971, offset: 0x01f96be9, size: 122 bytes, params: 2, frame: 19 const env0_0 = a0; env0_4.useEffect(_fun86520, [a0, (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([GuildStore, GuildAvailabilityStore], _fun86519, [a0])]); } function useMessagesLifecycle({messages, isMessagesReady, oldestUnreadMessageId, channelId, screenIndex, updateRows, scrollToMessageId}) { // fn#86521, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:2576, offset: 0x01f96def, size: 137 bytes, params: 2, frame: 16 const binding = screenIndex; binding.useEffect(_fun86522, []); binding.useEffect(function() { return _fun86524; }, [channelId, screenIndex]); } function useScrollState_86525() { // fn#86525, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:2978, offset: 0x01f96f20, size: 101 bytes, params: 1, frame: 15 const binding = env0_4; const value = env0_3(binding.useState({'animated': false, 'hasHandledScroll': false, 'isAtBottom': false, 'isNearBottom': false, 'isNearTop': false, 'decelerating': false, 'dragging': false, 'hasMoreMessagesAfterForLastUpdate': false, '_loaded': false}), 2); const property = value[0]; const env0_0 = value[1]; const useCallback = binding.useCallback; return [property, Reflect.apply(useCallback, binding, [function(a0) { a0(_fun86527); }, []])]; } function useChatUpdatesQueue(a0, a1) { // fn#86528, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:3279, offset: 0x01f96fa5, size: 85 bytes, params: 3, frame: 15 const env0_0 = a0; const env0_1 = a1; const binding = env0_4; const value = binding.useMemo(_fun86529, [a0, a1]); binding.useEffect(function() { return _fun86533; }, [value]); return value; } function useMessagesState() { // fn#86534, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:3481, offset: 0x01f97097, size: 97 bytes, params: 1, frame: 19 const binding = env0_4; let useState = binding.useState; const value2 = Reflect.apply(useState, binding, [false]); const binding2 = env0_3; let value = binding2(value2, 2); const property = value[0]; const property2 = value[1]; useState = binding.useState; value = binding2(Reflect.apply(useState, binding, [false]), 2); return {shouldForceRender: property, hasJumpedToOriginalPost: value[0], setHasJumpedToOriginalPost: value[1], setShouldForceRender: property2}; } function _fun86510() { // fn#86510, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:1307, offset: 0x01f96a21, size: 34 bytes, params: 1, frame: 12 const object2 = {}; object2.forEach(_fun86511); return object2; } function _fun86512() { // fn#86512, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:1457, offset: 0x01f96a43, size: 55 bytes, params: 1, frame: 13 var environment; let value = environment.__proto__; value = importDefault(22) /* metro dependency 22 */; return value.mapValues(env0_1, function(a0, a1) { return PresenceStore.getPrimaryActivity(a1); }); } function _fun86515() { // fn#86515, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:1610, offset: 0x01f96aef, size: 76 bytes, params: 1, frame: 13 const Set = global.Set; const set = new Set(); set.forEach(_fun86516); const Array = global.Array; return Array.from(set); } function _fun86517() { // fn#86517, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:1770, offset: 0x01f96b3b, size: 174 bytes, params: 1, frame: 19 var defaultImport; var fetchApplications; var defaultImport2; var value3; let value = environment.__proto__; const shallowEqualModule = require(628) /* metro dependency 628: shallowEqual */; const areArraysShallowEqual = shallowEqualModule.areArraysShallowEqual; let binding = env0_1; if (!Reflect.apply(areArraysShallowEqual, shallowEqualModule, [binding, env0_2.current])) { defaultImport = importDefault(6772) /* metro dependency 6772: ApplicationActionCreators */; fetchApplications = defaultImport.fetchApplications; defaultImport2 = importDefault(22) /* metro dependency 22 */; binding = env0_1; value3 = defaultImport2(binding); value = value3.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish); value = value.uniq(); value = value.value(); Reflect.apply(fetchApplications, defaultImport, [value, false]); env0_2.current = binding; } } function _fun86519() { // fn#86519, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:2067, offset: 0x01f96c63, size: 185 bytes, params: 1, frame: 21 var r3; var r10; var value6; var guild; var moduleValue; var isVoiceChannelInvite; var id; var getGuild; var value7; var isUnavailable; var value8; var value9; const object2 = {}; const value4 = _createForOfIteratorHelperLoose_86506(env0_0.values()); const value5 = value4(); let done = value5.done; if (!done) { r3 = value5; while (true) { value6 = r3.value; guild = value6.guild; if (guild != null) { moduleValue = require(4116) /* metro dependency 4116: InviteTypeUtils */; isVoiceChannelInvite = moduleValue.isVoiceChannelInvite; if (Reflect.apply(isVoiceChannelInvite, moduleValue, [value6])) { guild = value6.guild; id = guild.id; getGuild = GuildStore.getGuild; value7 = Reflect.apply(getGuild, GuildStore, [id]) != null; if (!value7) { r10 = value7; continue; } isUnavailable = GuildAvailabilityStore.isUnavailable; value8 = !Reflect.apply(isUnavailable, GuildAvailabilityStore, [id]); r10 = value8; object2[id] = r10; break; } break; } value9 = value4(); done = value9.done; if (done) { break; } r3 = value9; continue; } } return object2; } function _fun86520() { // fn#86520, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:2309, offset: 0x01f96d1c, size: 211 bytes, params: 1, frame: 23 var r3; var r12; var value6; var guild; var moduleValue; var isVoiceChannelInvite; var id; var value7; var hasRequestedStartTimes2; var moduleValue2; var value8; const value4 = _createForOfIteratorHelperLoose_86506(env0_0.values()); const value5 = value4(); let done = value5.done; if (!done) { r3 = value5; while (true) { value6 = r3.value; guild = value6.guild; if (guild != null) { moduleValue = require(4116) /* metro dependency 4116: InviteTypeUtils */; isVoiceChannelInvite = moduleValue.isVoiceChannelInvite; if (Reflect.apply(isVoiceChannelInvite, moduleValue, [value6])) { guild = value6.guild; id = guild.id; value7 = env0_1[id] !== true; if (value7) { r12 = value7; continue; } hasRequestedStartTimes2 = VoiceChannelStartTimeStore.hasRequestedStartTimes(id); r12 = hasRequestedStartTimes2; if (r12) { break; } moduleValue2 = require(11331) /* metro dependency 11331: ChannelInfoActionCreators */; moduleValue2.fetchChannelInfo(id); break; } break; } value8 = value4(); done = value8.done; if (done) { break; } r3 = value8; continue; } } } function _fun86522() { // fn#86522, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:2734, offset: 0x01f96e78, size: 126 bytes, params: 1, frame: 20 let value = environment.__proto__; value = require(9835) /* metro dependency 9835: MessagesUtils */; const syncMessageDisplay = value.syncMessageDisplay; const messagesBinding = messages; const channelIdBinding = channelId; Reflect.apply(syncMessageDisplay, value, [{messages: messagesBinding, isMessagesReady: isMessagesReady, oldestUnreadMessageId: oldestUnreadMessageId, channelId: channelIdBinding, screenIndex: screenIndex, updateRows: updateRows, scrollToMessageId: scrollToMessageId}]); (require(9835) /* metro dependency 9835: MessagesUtils */).recordTimings(channelIdBinding, messagesBinding); } function _fun86523() { // fn#86523, offset: 0x01f96ef6, size: 11 bytes, params: 1, frame: 1 return function() { updateShouldShowJumpToPresentButton(channelId, screenIndex, false); }; } function _fun86526(a0) { // fn#86526, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:3222, offset: 0x01f96f85, size: 32 bytes, params: 2, frame: 11 a0(_fun86527); } function _fun86529() { // fn#86529, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:3330, offset: 0x01f96ffa, size: 63 bytes, params: 1, frame: 13 var environment; let value = environment.__proto__; value = importDefault(11332) /* metro dependency 11332: ChatUpdatesQueue */; const value2 = Object.create(value.prototype, {constructor: {value: value}}); value = new value(_fun86530, function(a0) { require(a0); }); return value instanceof Object ? value : value2; } function _fun86532() { // fn#86532, offset: 0x01f97077, size: 11 bytes, params: 1, frame: 1 return _fun86533; } function _fun86530() { // fn#86530, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:3349, offset: 0x01f97039, size: 43 bytes, params: 1, frame: 12 const value = environment.__proto__; const current = env1_0.current; const value2 = null; return value2 === current ? value2 : findNodeHandle(env1_0.current); } function _fun86533() { // fn#86533, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11516:3434, offset: 0x01f97082, size: 21 bytes, params: 1, frame: 9 env1_2.cleanup(); }