// Module ID: 9440 // Function ID: 73419 // Name: findMessageRowIndex // Dependencies: [4157, 7691, 9441, 4097, 2] // Exports: default // Module 9440 (findMessageRowIndex) import _isNativeReflectConstruct from "_isNativeReflectConstruct"; import Changeset from "Changeset"; let closure_3; let closure_4; const require = arg1; function findMessageRowIndex(rows, focusTargetId) { let closure_0 = focusTargetId; const findIndexResult = rows.findIndex((message) => { let tmp = null != message.message; if (tmp) { tmp = message.message.id === closure_0; } return tmp; }); return -1 !== findIndexResult ? findIndexResult : undefined; } ({ RowType: closure_3, SeparatorType: closure_4 } = Changeset); const result = require("ChatScrollPosition").fileFinishedImporting("modules/chat/native/computeScrollData.tsx"); export default function computeScrollData(shouldInitialScroll) { let animated; let focusTargetId; let jumpTargetId; let jumpType; let rows; let scrollPosition; let scrollToMessageId; ({ rows, scrollToMessageId, jumpTargetId, animated, scrollPosition, focusTargetId, jumpType } = shouldInitialScroll); if (shouldInitialScroll.shouldInitialScroll) { if (null == jumpTargetId) { const tmp2 = (function findUnreadSeperatorRowIndex(rows) { const findIndexResult = rows.findIndex((type) => { let tmp = type.type === outer2_3.SEPARATOR; if (tmp) { tmp = type.id === outer2_4.UNREAD; } return tmp; }); return -1 !== findIndexResult ? findIndexResult : undefined; })(rows); if (null != tmp2) { let obj = { type: require(9441) /* ChatScrollPosition */.ChatScrollType.SCROLL, index: tmp2 }; if (animated) { animated = !_isNativeReflectConstruct.useReducedMotion; } obj.animate = animated; obj.highlight = false; obj.position = require(9441) /* ChatScrollPosition */.ChatScrollPosition.TOP; return obj; } } } let tmp3; if (null != scrollToMessageId) { const tmp5 = findMessageRowIndex(rows, scrollToMessageId); if (null != tmp5) { obj = { type: require(9441) /* ChatScrollPosition */.ChatScrollType.SCROLL, index: tmp5 }; let tmp9 = !_isNativeReflectConstruct.useReducedMotion; if (tmp9) { tmp9 = jumpType !== require(4097) /* GuildThemeSourcePreference */.JumpType.INSTANT; } obj.animate = tmp9; obj.highlight = scrollToMessageId === jumpTargetId; if (null == scrollPosition) { scrollPosition = require(9441) /* ChatScrollPosition */.ChatScrollPosition.TOP; } obj.position = scrollPosition; tmp3 = obj; } } if (null == tmp3) { let tmp14; if (null != focusTargetId) { const tmp16 = findMessageRowIndex(rows, focusTargetId); if (null != tmp16) { obj = { type: require(9441) /* ChatScrollPosition */.ChatScrollType.FOCUS_ONLY, index: tmp16 }; tmp14 = obj; } } tmp3 = tmp14; } return tmp3; }; export { findMessageRowIndex };