decord/source/modules/messages/native/MessagesUtils.tsx

1015 lines
39 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 10493
// Function ID: 10494
2026-07-29 08:29:29 +00:00
// Name: getVisibleMessages
2026-08-24 06:08:38 +00:00
// Dependencies: [32, 5, 8719, 5018, 1391, 1991, 4982, 4999, 4569, 4024, 4777, 1922, 8197, 676, 4816, 4810, 1954, 5027, 7549, 6896, 4013, 4097, 1236, 10494, 10495, 1945, 7548, 4035, 4347, 4348, 8561, 7550, 7552, 5047, 7205, 4984, 11, 4096, 10511, 9, 12, 500, 1627, 698, 10512, 7465, 6756, 4310, 10516, 10544, 2]
2026-07-29 08:29:29 +00:00
// Exports: canAddNewReactions, clearRows, findMessageIndex, findMessageIndexInRows, getChatRef, getLongPressSelectedMedia, getVoiceChannelIdChangedAuthorIds, getVoiceStateChannelSummaryFromVoiceStates, handleAddOrRemoveReaction, handleCopyLinkForumPost, handleFirstLayout, handleLongPressSticker, handleMediaPlayFinishedAnalytics, handleMessageVisibilityChanged, handleTapNavBar, handleTapTableView, handleToggleFollowForumPost, handleVisibleMessagesChange, isLoadingAtTop, jumpToPresent, loadMoreAfter, loadMoreBefore, maybeRescrollToMessageId, recordTimings, scrollToBottom, scrollToMessageIdWithRescroll, scrollToNewMessages, scrollToRelativeOffset, scrollToTop, scrollToTopMessage, shouldJumpToOriginalPost, startOrCancelChannelLatestMessagesLoad, syncMessageDisplay, toObscuredMedia
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 10493 (getVisibleMessages)
import serializeDefault from "serialize" /* 9 */;
import DISCORD_EPOCHDefault from "DISCORD_EPOCH" /* 11 */;
import applyDefault from "apply" /* 12 */;
import set2 from "set" /* 500 */;
import expandEventPropertiesDefault from "expandEventProperties" /* 698 */;
import KeyboardTypes from "KeyboardTypes" /* 1627 */;
import isCommunicationDisabled from "isCommunicationDisabled" /* 4013 */;
import presentAddedFriendToast from "presentAddedFriendToast" /* 4096 */;
import dispatcherDefault from "dispatcher" /* 4097 */;
import HapticFeedbackTypes from "HapticFeedbackTypes" /* 4347 */;
import IMPACT_LIGHTDefault from "IMPACT_LIGHT" /* 4348 */;
import flattenComponents from "flattenComponents" /* 4810 */;
import urlMatchesFileExtension from "urlMatchesFileExtension" /* 4816 */;
import ContentHarmTypeChannel from "ContentHarmTypeChannel" /* 5027 */;
import QuestsVisibleMessagesChangedSource from "QuestsVisibleMessagesChangedSource" /* 6756 */;
import shouldShowMembershipVerificationGate from "shouldShowMembershipVerificationGate" /* 6896 */;
import trackInviteDefault from "trackInvite" /* 7465 */;
import checkReactionResponse from "checkReactionResponse" /* 7549 */;
import patchThreadDefault from "patchThread" /* 7550 */;
import trackForumChannelSeenBatch from "trackForumChannelSeenBatch" /* 7552 */;
import computeScrollData from "computeScrollData" /* 10511 */;
import ChatScrollPositionDefault from "ChatScrollPosition" /* 10512 */;
import _manuallyStartConsoleQuest from "_manuallyStartConsoleQuest" /* 10516 */;
import getVoiceInviteEmbedRenderInfo from "getVoiceInviteEmbedRenderInfo" /* 10544 */;
import closure_3 from "_slicedToArray" /* 32 */;
import closure_4 from "asyncGeneratorStep" /* 5 */;
import { updateShouldShowJumpToPresentButton as closure_5 } from "updateChatInputContainerHeight" /* 8719 */;
import closure_6 from "processMessage" /* 5018 */;
import closure_7 from "ensureGuildLoaded" /* 1391 */;
import closure_8 from "trackCommunicationDisabled" /* 1991 */;
import closure_9 from "recomputeGuild" /* 4982 */;
import closure_10 from "reinjectEphemerals" /* 4999 */;
import closure_11 from "handleConnectionInfoChange" /* 4569 */;
import closure_12 from "getUncachedChannelPermissions" /* 4024 */;
import closure_13 from "generateOldThreadCutoff" /* 4777 */;
import closure_14 from "mergeGuildAvatar" /* 1922 */;
import Changeset from "Changeset" /* 8197 */;
import ME from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function getVisibleMessages(arg0) {
({ firstVisibleMessageRowIndex, lastVisibleMessageRowIndex, firstVisibleMessagePercentVisible, lastVisibleMessagePercentVisible, chatManager } = arg0);
if (null != firstVisibleMessageRowIndex) {
if (null != lastVisibleMessageRowIndex) {
if (firstVisibleMessageRowIndex >= 0) {
if (lastVisibleMessageRowIndex >= 0) {
if (null != chatManager._rows) {
if (null != chatManager._messages) {
const items = [];
let diff = firstVisibleMessageRowIndex;
if (firstVisibleMessageRowIndex >= lastVisibleMessageRowIndex) {
do {
let tmp2 = chatManager._rows[diff];
2026-07-29 08:29:29 +00:00
let tmp3 = diff;
2026-07-20 16:05:17 +00:00
if (null != tmp2) {
2026-07-29 08:29:29 +00:00
let tmp10 = constants;
2026-07-23 10:11:24 +00:00
if (tmp2.type === constants.MESSAGE) {
2026-07-20 16:05:17 +00:00
let message = tmp2.message;
let id;
2026-07-29 08:29:29 +00:00
if (message != null) {
2026-07-20 16:05:17 +00:00
id = message.id;
}
if (null != id) {
if (diff !== firstVisibleMessageRowIndex) {
2026-07-29 08:29:29 +00:00
let tmp5 = diff === lastVisibleMessageRowIndex && null != lastVisibleMessagePercentVisible;
2026-07-20 16:05:17 +00:00
let num = 1;
2026-07-29 08:29:29 +00:00
if (tmp5) {
2026-07-20 16:05:17 +00:00
num = lastVisibleMessagePercentVisible;
}
} else {
num = firstVisibleMessagePercentVisible;
}
2026-07-29 08:29:29 +00:00
let tmp6 = message;
2026-07-23 10:11:24 +00:00
message = message.getMessage(tmp, tmp2.message.id);
2026-07-20 16:05:17 +00:00
if (null != message) {
2026-07-29 08:29:29 +00:00
let obj = { message: null, percentVisible: null, state: null };
obj[0] = message;
obj[1] = num;
obj[2] = message.state;
2026-07-20 16:05:17 +00:00
let arr = items.push(obj);
}
}
}
}
diff = diff - 1;
} while (diff >= lastVisibleMessageRowIndex);
}
return items;
}
}
}
}
}
}
return [];
}
function getMessage(toArray) {
2026-08-24 06:08:38 +00:00
closure_0 = arg1;
return applyDefault.find(toArray.toArray(), (id) => id.id === closure_0 || id.nonce === closure_0);
2026-07-20 16:05:17 +00:00
}
function _handleTapNavBar() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback2((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
c2 = 0;
c3 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0) {
if (c3 === 2) {
c3 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c3 = 2;
if (0 === table) {
if (arg0 === 1) {
c3 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
c1 = tmp2;
useReducedMotion = undefined;
c1 = undefined;
({ channel, useReducedMotion } = useReducedMotion);
({ scrollToTop: c1, isNearTop, messages, findMessageIndex, chatRef } = useReducedMotion);
if (channel.isForumPost()) {
if (!isNearTop) {
2026-08-24 06:08:38 +00:00
obj1 = closure_1_1(table[36]);
if (null == closure_1_23(messages, obj1.castChannelIdAsMessageId(channel.id))) {
2026-08-03 11:20:01 +00:00
let tmp10Result = tmp10(tmp11[45]);
2026-07-29 08:29:29 +00:00
obj1 = { channelId: null, jump: null, limit: null };
obj1[0] = channel.id;
const obj2 = { messageId: null, flash: false };
obj2[0] = channel.id;
obj1[1] = obj2;
2026-08-24 06:08:38 +00:00
obj1[2] = closure_1_21;
2026-07-29 08:29:29 +00:00
table = 1;
c3 = 1;
const obj3 = { value: null, done: false };
obj3[0] = tmp10Result.fetchMessages(obj1);
return obj3;
} else {
2026-08-03 11:20:01 +00:00
tmp10Result = tmp10(tmp11[36]);
2026-07-29 08:29:29 +00:00
const findMessageIndexResult = findMessageIndex(tmp10Result.castChannelIdAsMessageId(channel.id));
if (null == findMessageIndexResult) {
c3 = 3;
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
} else {
const obj4 = { animated: null };
obj4[0] = !useReducedMotion;
2026-08-03 11:20:01 +00:00
tmp10(tmp11[44]).scrollTo(chatRef.current, findMessageIndexResult, obj4);
2026-07-29 08:29:29 +00:00
const _setTimeout2 = setTimeout;
const timerId = setTimeout(() => _undefined(!useReducedMotion), 10 * findMessageIndexResult);
2026-08-03 11:20:01 +00:00
const tmp10Result1 = tmp10(tmp11[44]);
2026-07-29 08:29:29 +00:00
}
}
}
}
c3 = 3;
}
} else if (arg0 === 1) {
c3 = 3;
throw arg1;
} else if (arg0 !== 2) {
const _setTimeout = setTimeout;
const timerId1 = setTimeout(() => _undefined(!useReducedMotion), 50);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
c3 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} catch (tmp17) {
c3 = tmp;
throw tmp17;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
})();
});
2026-08-24 06:08:38 +00:00
closure_24 = tmp;
2026-07-29 08:29:29 +00:00
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
function parseVoiceStateChannelIdSummary(prop) {
2026-07-20 16:05:17 +00:00
const map = new Map();
2026-07-29 08:29:29 +00:00
if (null != prop) {
if ("" !== prop) {
const parts = prop.split("|");
const iter = parts[Symbol.iterator]();
while (iter !== undefined) {
let tmp5 = callback;
let tmp6 = callback(str4.split(":"), 2);
[tmp7, tmp9] = tmp6;
if (null != tmp7) {
let tmp10 = tmp7;
let str5 = tmp9;
if (tmp9 == null) {
str5 = "";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let result = map.set(tmp8, str5);
}
continue;
2026-07-20 16:05:17 +00:00
}
return map;
}
}
return map;
}
2026-07-23 10:11:24 +00:00
({ RowType: closure_15, Changeset: closure_16 } = Changeset);
({ AnalyticEvents: closure_17, MessageEmbedTypes: closure_18, MessageTypes: closure_19, Permissions: closure_20, MAX_MESSAGES_PER_CHANNEL: closure_21 } = ME);
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/messages/native/MessagesUtils.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const getLongPressSelectedMedia = function getLongPressSelectedMedia(message, mediaIndex, mediaType, tmpResult, componentMediaIndex) {
2026-07-20 16:05:17 +00:00
let obj = message;
2026-07-23 10:11:24 +00:00
if (message.type === constants5.THREAD_STARTER_MESSAGE) {
2026-07-20 16:05:17 +00:00
obj = message;
if (null != message.messageReference) {
message = messageByReference.getMessageByReference(message.messageReference).message;
obj = message;
if (null != message) {
obj = message;
}
}
}
if ("attachment" === mediaType) {
2026-07-29 08:29:29 +00:00
let tmp13 = obj.attachments[mediaIndex];
if (tmp13 == null) {
2026-07-20 16:05:17 +00:00
const contentMessage = obj.getContentMessage();
2026-07-29 08:29:29 +00:00
let tmp16;
if (contentMessage != null) {
tmp16 = contentMessage.attachments[mediaIndex];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp13 = tmp16;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp17 = null;
if (null != tmp13) {
obj = { sourceType: "attachment", source: null, mediaType: null, mediaUrl: null, contentType: null };
obj[1] = tmp13;
let str3 = "video";
if (!obj9.isVideoFile(tmp13.filename)) {
2026-08-24 06:08:38 +00:00
let tmp18Result = tmp18(4816);
2026-07-29 08:29:29 +00:00
let str4 = "audio";
if (!tmp18Result.isAudioFile(tmp13.filename)) {
2026-08-24 06:08:38 +00:00
tmp18Result = tmp18(4816);
2026-07-29 08:29:29 +00:00
let str5 = "file";
if (tmp18Result.isImageFile(tmp13.filename)) {
str5 = "image";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
str4 = str5;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
str3 = str4;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[2] = str3;
({ url: obj8[3], content_type } = tmp13);
obj[4] = content_type;
tmp17 = obj;
2026-08-24 06:08:38 +00:00
obj9 = urlMatchesFileExtension;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp17;
2026-07-20 16:05:17 +00:00
} else if ("embed" === mediaType) {
if (null == obj.embeds[mediaIndex]) {
return null;
} else {
2026-07-23 10:11:24 +00:00
if (tmp8.type === constants4.IMAGE) {
2026-07-20 16:05:17 +00:00
if (null != tmp8.url) {
2026-08-08 06:10:11 +00:00
obj = { sourceType: "embed", source: null, mediaType: "image", mediaUrl: null, contentType: "Boolean" };
2026-07-29 08:29:29 +00:00
obj[1] = tmp8;
obj[3] = tmp8.url;
return obj;
2026-07-20 16:05:17 +00:00
}
}
2026-07-23 10:11:24 +00:00
if (tmp8.type === constants4.GIFV) {
2026-07-20 16:05:17 +00:00
const video = tmp8.video;
let url;
2026-07-29 08:29:29 +00:00
if (video != null) {
2026-07-20 16:05:17 +00:00
url = video.url;
}
if (null != url) {
if (null != tmp8.video.proxyURL) {
if ("" !== tmp8.video.proxyURL) {
url = tmp8.video.proxyURL;
}
2026-08-24 06:08:38 +00:00
obj1 = { sourceType: "embed", source: null, mediaType: "video", mediaUrl: null, contentType: null };
2026-07-29 08:29:29 +00:00
obj1[1] = tmp8;
obj1[3] = url;
obj1[4] = tmp8.video.contentType;
return obj1;
2026-07-20 16:05:17 +00:00
}
url = tmp8.video.url;
}
}
2026-07-23 10:11:24 +00:00
if (tmp8.type === constants4.RICH) {
2026-07-20 16:05:17 +00:00
const image = tmp8.image;
let url1;
2026-07-29 08:29:29 +00:00
if (image != null) {
2026-07-20 16:05:17 +00:00
url1 = image.url;
}
if (null != url1) {
2026-07-29 08:29:29 +00:00
const obj2 = { sourceType: "embed", source: null, mediaType: "image", mediaUrl: null, contentType: null };
obj2[1] = tmp8;
obj2[3] = tmp8.image.url;
obj2[4] = tmp8.image.contentType;
return obj2;
2026-07-20 16:05:17 +00:00
} else {
const video2 = tmp8.video;
let url2;
2026-07-29 08:29:29 +00:00
if (video2 != null) {
2026-07-20 16:05:17 +00:00
url2 = video2.url;
}
if (null != url2) {
2026-07-29 08:29:29 +00:00
const obj3 = { sourceType: "embed", source: null, mediaType: "video", mediaUrl: null, contentType: null };
obj3[1] = tmp8;
obj3[3] = tmp8.video.url;
obj3[4] = tmp8.video.contentType;
return obj3;
2026-07-20 16:05:17 +00:00
}
}
}
return null;
}
} else if ("component" === mediaType) {
2026-07-29 08:29:29 +00:00
if (null == tmpResult) {
2026-07-20 16:05:17 +00:00
return null;
} else {
2026-08-24 06:08:38 +00:00
const obj12 = flattenComponents;
const value = flattenComponents.flattenComponents(obj.components).get(tmpResult);
2026-07-20 16:05:17 +00:00
if (null == value) {
return null;
2026-08-11 06:20:06 +00:00
} else if (value.type === tmp20(1954).ComponentType.MEDIA_GALLERY) {
2026-07-20 16:05:17 +00:00
if (null == componentMediaIndex) {
return null;
} else if (null == value.items[componentMediaIndex]) {
return null;
} else {
2026-07-29 08:29:29 +00:00
const media = tmp7.media;
const obj4 = { sourceType: "component", source: null, mediaType: null, mediaUrl: null };
obj4[1] = value;
2026-07-20 16:05:17 +00:00
let str = "image";
2026-07-29 08:29:29 +00:00
if (tmp20Result.isVideoContentType(media.contentType)) {
2026-07-20 16:05:17 +00:00
str = "video";
}
2026-07-29 08:29:29 +00:00
obj4[2] = str;
obj4[3] = media.url;
return obj4;
2026-07-20 16:05:17 +00:00
}
} else {
return null;
}
2026-08-24 06:08:38 +00:00
const flattenComponentsResult = flattenComponents.flattenComponents(obj.components);
2026-07-20 16:05:17 +00:00
}
} else {
return null;
}
};
export const toObscuredMedia = function toObscuredMedia(sourceType) {
if ("attachment" === sourceType.sourceType) {
2026-07-29 08:29:29 +00:00
let obj = { type: null, media: null };
2026-08-24 06:08:38 +00:00
obj[0] = ContentHarmTypeChannel.ObscuredMediaTypes.Attachment;
2026-07-29 08:29:29 +00:00
obj[1] = sourceType.source;
2026-07-20 16:05:17 +00:00
let tmp = obj;
} else {
tmp = null;
if ("embed" === sourceType.sourceType) {
2026-07-29 08:29:29 +00:00
obj = { type: null, media: null };
2026-08-24 06:08:38 +00:00
obj[0] = ContentHarmTypeChannel.ObscuredMediaTypes.Embed;
2026-07-29 08:29:29 +00:00
obj[1] = sourceType.source;
2026-07-20 16:05:17 +00:00
tmp = obj;
}
}
return tmp;
};
2026-07-21 06:55:02 +00:00
export const handleAddOrRemoveReaction = function handleAddOrRemoveReaction(messageId, channel, reaction, isBurst, MESSAGE) {
2026-07-20 16:05:17 +00:00
let flag = isBurst;
if (isBurst === undefined) {
flag = false;
}
if (MESSAGE === undefined) {
2026-08-24 06:08:38 +00:00
MESSAGE = checkReactionResponse.ReactionLocations.MESSAGE;
2026-07-20 16:05:17 +00:00
}
const guildId = channel.getGuildId();
2026-07-23 10:11:24 +00:00
currentUser = currentUser.getCurrentUser();
2026-07-29 08:29:29 +00:00
if (currentUser != null) {
2026-07-21 06:55:02 +00:00
const id = currentUser.id;
2026-07-20 16:05:17 +00:00
}
let canChatInGuildResult = null != guildId;
if (canChatInGuildResult) {
2026-08-24 06:08:38 +00:00
canChatInGuildResult = closure_9.canChatInGuild(guildId);
2026-07-20 16:05:17 +00:00
}
let result = null != guildId;
if (result) {
2026-08-24 06:08:38 +00:00
let obj = shouldShowMembershipVerificationGate;
2026-07-29 08:29:29 +00:00
result = obj.shouldShowMembershipVerificationGate(guildId);
2026-07-20 16:05:17 +00:00
}
let member = null;
if (null != guildId) {
member = null;
if (null != id) {
member = member.getMember(guildId, id);
}
}
2026-08-03 11:20:01 +00:00
let tmp36Result = dependencyMap;
2026-08-24 06:08:38 +00:00
obj1 = isCommunicationDisabled;
2026-07-20 16:05:17 +00:00
const result1 = obj1.isMemberCommunicationDisabled(member);
if (channel.isArchivedLockedThread()) {
2026-08-24 06:08:38 +00:00
const obj15 = dispatcherDefault;
2026-08-03 11:20:01 +00:00
const tmp36 = importDefault;
2026-07-29 08:29:29 +00:00
const intl = tmp12(1236).intl;
2026-07-20 16:05:17 +00:00
const string = intl.string;
2026-07-29 08:29:29 +00:00
let t = tmp12(1236).t;
2026-07-20 16:05:17 +00:00
if (isForumPostResult) {
let stringResult = string(t.EJQrFq);
} else {
stringResult = string(t.X2L3Oa);
}
2026-07-29 08:29:29 +00:00
obj = { key: "ARCHIVED_POST_REACTIONS_DISABLED_TOAST", content: null, icon: null };
obj[1] = stringResult;
2026-08-24 06:08:38 +00:00
tmp36Result = tmp36(10494);
2026-08-03 11:20:01 +00:00
obj[2] = tmp36Result;
t = obj15.open(obj);
2026-07-23 10:11:24 +00:00
isForumPostResult = channel.isForumPost();
2026-07-20 16:05:17 +00:00
} else if (null != reaction) {
if (flag) {
if (true === !reaction.me_burst) {
2026-08-11 06:20:06 +00:00
let tmp12Result = tmp12(1945);
2026-07-29 08:29:29 +00:00
if (!tmp12Result.isPremium(currentUser)) {
2026-08-24 06:08:38 +00:00
tmp12Result = tmp12(10495);
2026-07-29 08:29:29 +00:00
return tmp12Result.handleOutOfSuperReactions();
2026-07-20 16:05:17 +00:00
}
}
}
2026-08-24 06:08:38 +00:00
const ReactionTypes = tmp12(7548).ReactionTypes;
2026-08-03 11:20:01 +00:00
if (tmp12Result1.isMeReaction(reaction.me, reaction.me_burst, tmp23)) {
2026-08-24 06:08:38 +00:00
const result2 = tmp12(4347).triggerHapticFeedback(IMPACT_LIGHTDefault.IMPACT_LIGHT);
const tmp12Result2 = tmp12(4347);
2026-08-03 11:20:01 +00:00
obj = { channelId: null, messageId: null, emoji: null, location: null, options: null };
obj[0] = channel.id;
obj[1] = messageId;
obj[2] = reaction.emoji;
obj[3] = MESSAGE;
obj1 = { burst: null };
obj1[0] = flag;
obj[4] = obj1;
2026-08-24 06:08:38 +00:00
tmp12(7549).removeReaction(obj);
2026-08-03 11:20:01 +00:00
} else {
2026-07-20 16:05:17 +00:00
if (!result) {
if (channel.isPrivate()) {
if (!result1) {
2026-08-24 06:08:38 +00:00
const tmp12Result4 = tmp12(7549);
2026-08-03 11:20:01 +00:00
const obj2 = { burst: null };
obj2[0] = flag;
tmp12Result4.addReaction(channel.id, messageId, reaction.emoji, MESSAGE, obj2);
2026-07-20 16:05:17 +00:00
if (!flag) {
2026-08-24 06:08:38 +00:00
const result3 = tmp12(4347).triggerHapticFeedback(IMPACT_LIGHTDefault.IMPACT_LIGHT);
const tmp12Result5 = tmp12(4347);
2026-07-20 16:05:17 +00:00
}
}
}
}
if (result) {
const guildId1 = channel.getGuildId();
if (null != guildId1) {
2026-08-24 06:08:38 +00:00
return tmp12(8561).openMemberVerificationModal(guildId1);
2026-07-20 16:05:17 +00:00
}
}
}
2026-08-24 06:08:38 +00:00
tmp12Result1 = tmp12(4035);
2026-08-03 11:20:01 +00:00
tmp23 = flag ? ReactionTypes.BURST : ReactionTypes.NORMAL;
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
const tmp12Result7 = tmp12(10495);
2026-07-29 08:29:29 +00:00
const obj3 = { burst: null };
obj3[0] = flag;
2026-08-03 11:20:01 +00:00
const result4 = tmp12Result7.handleAddNewReactions(channel, messageId, MESSAGE, obj3);
2026-07-20 16:05:17 +00:00
}
};
2026-08-24 06:08:38 +00:00
export const handleToggleFollowForumPost = function handleToggleFollowForumPost(channel, closure_1_19) {
const result = HapticFeedbackTypes.triggerHapticFeedback(IMPACT_LIGHTDefault.IMPACT_LIGHT);
const obj2 = patchThreadDefault;
if (closure_1_19) {
2026-07-20 16:05:17 +00:00
obj2.leaveThread(channel, "iOS Forum Toolbar");
} else {
obj2.joinThread(channel, "iOS Forum Toolbar");
}
};
export const handleCopyLinkForumPost = function handleCopyLinkForumPost(guildId, id, location) {
const channel = store.getChannel(id);
let parent_id;
2026-07-29 08:29:29 +00:00
if (channel != null) {
2026-07-20 16:05:17 +00:00
parent_id = channel.parent_id;
}
const channel1 = store.getChannel(parent_id);
2026-07-29 08:29:29 +00:00
let flag;
if (channel1 != null) {
flag = channel1.isMediaChannel();
}
if (flag == null) {
flag = false;
2026-07-20 16:05:17 +00:00
}
let obj = { postId: id, location };
2026-08-24 06:08:38 +00:00
const result = trackForumChannelSeenBatch.trackForumPostLinkCopied(obj);
2026-07-29 08:29:29 +00:00
if (flag) {
2026-08-24 06:08:38 +00:00
let tmp4Result = tmp4(5047);
2026-07-29 08:29:29 +00:00
obj = { media_post_id: null };
obj[0] = id;
tmp4Result.trackWithMetadata(constants3.MEDIA_POST_SHARE_PROMPT_CLICKED, obj);
}
2026-08-24 06:08:38 +00:00
tmp4Result = tmp4(4347);
const result1 = tmp4Result.triggerHapticFeedback(IMPACT_LIGHTDefault.IMPACT_LIGHT);
2026-07-20 16:05:17 +00:00
if (null == channel) {
2026-08-24 06:08:38 +00:00
const tmp4Result1 = tmp4(7205);
2026-07-20 16:05:17 +00:00
let result2;
2026-07-29 08:29:29 +00:00
if (true === flag) {
2026-08-24 06:08:38 +00:00
result2 = DISCORD_EPOCHDefault.castChannelIdAsMessageId(id);
const tmp9Result = DISCORD_EPOCHDefault;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
tmp4Result1.copy(tmp4(4984).getChannelPermalink(guildId, id, result2));
const tmp4Result2 = tmp4(4984);
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
const tmp4Result3 = tmp4(7205);
tmp4Result3.copy(tmp4(4984).getChannelLinkToCopy(channel, channel1));
const tmp4Result4 = tmp4(4984);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const obj2 = trackForumChannelSeenBatch;
const tmp9 = importDefault;
presentAddedFriendToast.presentLinkCopied();
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
export const findMessageIndex = function findMessageIndex(previousRows, ChatTTITracker) {
if (null != ChatTTITracker) {
2026-08-24 06:08:38 +00:00
return computeScrollData.findMessageRowIndex(previousRows, ChatTTITracker);
2026-07-20 16:05:17 +00:00
}
};
export { getVisibleMessages };
2026-07-29 08:29:29 +00:00
export const shouldJumpToOriginalPost = function shouldJumpToOriginalPost(isForumPost, id, jumpTargetId) {
let isForumPostResult = isForumPost.isForumPost();
2026-07-20 16:05:17 +00:00
if (isForumPostResult) {
2026-08-24 06:08:38 +00:00
isForumPostResult = DISCORD_EPOCHDefault.castChannelIdAsMessageId(id) === jumpTargetId.jumpTargetId;
const obj = DISCORD_EPOCHDefault;
2026-07-20 16:05:17 +00:00
}
if (isForumPostResult) {
isForumPostResult = !arg3;
}
return isForumPostResult;
};
export const startOrCancelChannelLatestMessagesLoad = function startOrCancelChannelLatestMessagesLoad(hasJumpedToOriginalPost) {
if (null == hasJumpedToOriginalPost.jumpTargetId) {
if (null == hasJumpedToOriginalPost.oldestUnreadMessageId) {
if (!hasJumpedToOriginalPost.shouldJumpToOriginalPost) {
const tracker = hasJumpedToOriginalPost.tracker;
2026-07-29 08:29:29 +00:00
const obj = { channelId: null };
obj[0] = hasJumpedToOriginalPost.channelId;
2026-07-20 16:05:17 +00:00
tracker.start(obj);
}
}
}
const tracker2 = hasJumpedToOriginalPost.tracker;
tracker2.cancel();
};
2026-07-29 08:29:29 +00:00
export const recordTimings = function recordTimings(channelId, closure_0) {
const mapped = closure_0.map((id) => id.id);
let hasFetched = closure_0.hasFetched;
if (!hasFetched) {
hasFetched = closure_0.ready && !closure_0.cached;
const tmp2 = closure_0.ready && !closure_0.cached;
}
2026-08-24 06:08:38 +00:00
serializeDefault.recordMessageRender(channelId, mapped, hasFetched, closure_0.hasMoreAfter);
2026-07-29 08:29:29 +00:00
};
export const findMessageIndexInRows = function findMessageIndexInRows(ChatTTITracker, previousRows) {
if (null != ChatTTITracker) {
2026-08-24 06:08:38 +00:00
return computeScrollData.findMessageRowIndex(previousRows, ChatTTITracker);
2026-07-20 16:05:17 +00:00
}
};
export { getMessage };
export const isLoadingAtTop = function isLoadingAtTop(arg0, arg1) {
if (arg1) {
2026-07-29 08:29:29 +00:00
const iter = arg0[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
let tmp6 = nextResult;
let tmp7 = constants2;
if (nextResult.changeType === constants2.INSERT) {
let num = 1;
let tmp9 = iter;
let tmp8 = nextResult.index <= 1;
iter.return();
return tmp8;
2026-07-20 16:05:17 +00:00
}
}
return false;
} else {
return false;
}
};
export const handleTapTableView = function handleTapTableView(current) {
2026-08-24 06:08:38 +00:00
let isIOSResult = set2.isIOS();
2026-07-20 16:05:17 +00:00
if (isIOSResult) {
2026-08-24 06:08:38 +00:00
isIOSResult = arg1 !== KeyboardTypes.KeyboardTypes.SYSTEM;
2026-07-20 16:05:17 +00:00
}
if (isIOSResult) {
current = current.current;
2026-07-29 08:29:29 +00:00
if (current != null) {
2026-07-20 16:05:17 +00:00
current.closeCustomKeyboard();
}
}
};
export const handleMediaPlayFinishedAnalytics = function handleMediaPlayFinishedAnalytics(playWallTimeMs) {
2026-08-24 06:08:38 +00:00
let obj = expandEventPropertiesDefault;
2026-07-29 08:29:29 +00:00
obj = { play_time_sec: playWallTimeMs.playWallTimeMs / 1000, play_wall_time_ms: playWallTimeMs.playWallTimeMs, first_play_waiting_ms: Math.min(playWallTimeMs.firstPlayWaitingMs, 600000), stall_count: playWallTimeMs.stallCount, stall_ms: playWallTimeMs.stallMs, seek_count: playWallTimeMs.seekCount, seek_waiting_ms: null, media_source: playWallTimeMs.mediaSource, mime_type: null, file_size: null, file_duration_sec: null, connection_type: null, effective_connection_speed: null, service_provider: null };
2026-07-20 16:05:17 +00:00
let mimeType = null;
if (null != playWallTimeMs.mimeType) {
mimeType = null;
if ("" !== playWallTimeMs.mimeType) {
mimeType = playWallTimeMs.mimeType;
}
}
2026-07-29 08:29:29 +00:00
obj[8] = mimeType;
obj[10] = playWallTimeMs.fileDurationSec;
obj[11] = store2.getType();
obj[12] = store2.getEffectiveConnectionSpeed();
obj[13] = store2.getServiceProvider();
2026-07-23 10:11:24 +00:00
obj.track(constants3.MEDIA_PLAY_FINISHED, obj);
2026-07-20 16:05:17 +00:00
};
export const scrollToBottom = function scrollToBottom(current) {
let flag = arg3;
if (arg3 === undefined) {
flag = true;
}
arg2({ eventTimestamp: Date.now(), isAtBottom: true });
const obj = { eventTimestamp: Date.now(), isAtBottom: true };
if (flag) {
flag = !arg1;
}
2026-08-24 06:08:38 +00:00
ChatScrollPositionDefault.scrollToBottom(current.current, flag);
2026-07-20 16:05:17 +00:00
};
export const scrollToTop = function scrollToTop(current) {
let flag = arg2;
if (arg2 === undefined) {
flag = true;
}
if (flag) {
flag = !arg1;
}
2026-08-24 06:08:38 +00:00
ChatScrollPositionDefault.scrollToTop(current.current, flag);
2026-07-20 16:05:17 +00:00
};
export const scrollToRelativeOffset = function scrollToRelativeOffset(current) {
let flag = arg3;
if (arg3 === undefined) {
flag = true;
}
if (flag) {
flag = !arg1;
}
2026-08-24 06:08:38 +00:00
const result = ChatScrollPositionDefault.scrollToRelativeOffset(current.current, arg2, flag);
2026-07-20 16:05:17 +00:00
};
export const scrollToTopMessage = function scrollToTopMessage(current, getPreviousRows) {
const previousRows = getPreviousRows.getPreviousRows();
if (previousRows.length > 0) {
2026-08-24 06:08:38 +00:00
ChatScrollPositionDefault.scrollTo(current.current, previousRows.length - 1);
const obj = ChatScrollPositionDefault;
2026-07-20 16:05:17 +00:00
}
};
export const canAddNewReactions = function canAddNewReactions(isPrivate) {
let canResult = arg1;
if (arg1) {
2026-08-24 06:08:38 +00:00
canResult = closure_12.can(constants6.ADD_REACTIONS, isPrivate);
2026-07-20 16:05:17 +00:00
}
if (!canResult) {
canResult = isPrivate.isPrivate();
}
return canResult;
};
2026-07-29 08:29:29 +00:00
export const loadMoreBefore = function loadMoreBefore(arg0, hasMoreBefore) {
2026-07-20 16:05:17 +00:00
arg2(true);
if (tmp2) {
2026-08-24 06:08:38 +00:00
let obj = trackInviteDefault;
2026-07-29 08:29:29 +00:00
obj = { channelId: null, before: null, limit: null };
obj[0] = arg0;
2026-07-20 16:05:17 +00:00
const firstResult = hasMoreBefore.first();
let id;
2026-07-29 08:29:29 +00:00
if (firstResult != null) {
2026-07-20 16:05:17 +00:00
id = firstResult.id;
}
2026-07-29 08:29:29 +00:00
obj[1] = id;
obj[2] = closure_21;
2026-07-20 16:05:17 +00:00
const messages = obj.fetchMessages(obj);
}
};
2026-07-29 08:29:29 +00:00
export const loadMoreAfter = function loadMoreAfter(arg0, hasMoreAfter) {
2026-07-20 16:05:17 +00:00
arg2(true);
if (tmp2) {
2026-08-24 06:08:38 +00:00
let obj = trackInviteDefault;
2026-07-29 08:29:29 +00:00
obj = { channelId: null, after: null, limit: null };
obj[0] = arg0;
2026-07-20 16:05:17 +00:00
const lastResult = hasMoreAfter.last();
let id;
2026-07-29 08:29:29 +00:00
if (lastResult != null) {
2026-07-20 16:05:17 +00:00
id = lastResult.id;
}
2026-07-29 08:29:29 +00:00
obj[1] = id;
obj[2] = closure_21;
2026-07-20 16:05:17 +00:00
const messages = obj.fetchMessages(obj);
}
};
export const clearRows = function clearRows(current, clear) {
2026-07-29 08:29:29 +00:00
arg4({ animated: false, hasHandledScroll: false, isNearBottom: false, isAtBottom: false, isNearTop: false, decelerating: false, dragging: false, hasMoreMessagesAfterForLastUpdate: false, pendingUpdatesQueue: [], _loaded: false, animatingStickerMessageId: null });
2026-07-20 16:05:17 +00:00
clear.clear();
2026-07-23 10:11:24 +00:00
callback3(arg2, arg3, false);
2026-08-24 06:08:38 +00:00
ChatScrollPositionDefault.clearRows(current.current);
2026-07-20 16:05:17 +00:00
};
export const handleFirstLayout = function handleFirstLayout(arg0, firstVisibleMessageRowIndex, lastVisibleMessageRowIndex, firstVisibleMessagePercentVisible, lastVisibleMessagePercentVisible) {
2026-08-24 06:08:38 +00:00
arg0({ firstVisibleMessageRowIndex, lastVisibleMessageRowIndex, firstVisibleMessagePercentVisible, lastVisibleMessagePercentVisible, source: QuestsVisibleMessagesChangedSource.QuestsVisibleMessagesChangedSource.FIRST_LAYOUT });
2026-07-20 16:05:17 +00:00
};
export const handleMessageVisibilityChanged = function handleMessageVisibilityChanged(arg0, firstVisibleMessageRowIndex, lastVisibleMessageRowIndex, firstVisibleMessagePercentVisible, lastVisibleMessagePercentVisible) {
2026-08-24 06:08:38 +00:00
arg0({ firstVisibleMessageRowIndex, lastVisibleMessageRowIndex, firstVisibleMessagePercentVisible, lastVisibleMessagePercentVisible, source: QuestsVisibleMessagesChangedSource.QuestsVisibleMessagesChangedSource.VISIBILITY_CHANGED });
2026-07-20 16:05:17 +00:00
};
export const handleLongPressSticker = function handleLongPressSticker(arg0, arg1, arg2) {
const items = [arg0];
const set = new Set(items);
if (null != arg1) {
set.add(arg1);
}
let tmp2 = null;
if (arg1 !== arg0) {
tmp2 = arg0;
}
arg2({ forceRender: true, updateMessageIds: set });
return tmp2;
};
export const handleTapNavBar = function handleTapNavBar() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _handleTapNavBar.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
};
export const jumpToPresent = function jumpToPresent(jumpReturnTargetId, id) {
if (null == jumpReturnTargetId.jumpReturnTargetId) {
if (!jumpReturnTargetId.loadingMore) {
if (jumpReturnTargetId.hasMoreAfter) {
2026-07-29 08:29:29 +00:00
let obj = { channelId: null, limit: null, jump: null };
obj[0] = id.id;
obj[1] = closure_21;
obj[2] = { present: true };
2026-08-24 06:08:38 +00:00
const messages = trackInviteDefault.fetchMessages(obj);
const obj3 = trackInviteDefault;
2026-07-20 16:05:17 +00:00
} else {
arg2();
}
}
} else {
2026-08-24 06:08:38 +00:00
obj = trackInviteDefault;
2026-07-29 08:29:29 +00:00
obj = { channelId: null, messageId: null, flash: true };
obj[0] = id.id;
obj[1] = jumpReturnTargetId;
obj.jumpToMessage(obj);
2026-07-20 16:05:17 +00:00
}
};
export const scrollToNewMessages = function scrollToNewMessages(channel) {
channel = channel.channel;
2026-08-24 06:08:38 +00:00
let id = closure_13.ackMessageId(channel.id);
let obj = trackInviteDefault;
2026-07-29 08:29:29 +00:00
obj = { channelId: channel.id, messageId: null, offset: 1, context: "Mark As Read" };
if (id == null) {
2026-07-20 16:05:17 +00:00
id = channel.id;
}
2026-07-29 08:29:29 +00:00
obj[1] = id;
2026-07-20 16:05:17 +00:00
obj.jumpToMessage(obj);
};
export const syncMessageDisplay = function syncMessageDisplay(messages) {
messages = messages.messages;
const oldestUnreadMessageId = messages.oldestUnreadMessageId;
2026-07-29 08:29:29 +00:00
({ channelId, updateRows, scrollToMessageId } = messages);
2026-07-20 16:05:17 +00:00
if (messages.isMessagesReady) {
2026-07-29 08:29:29 +00:00
let obj = { scrollToMessageId: null, jumpTargetId: null, jumpType: null, focusTargetId: null };
({ jumpTargetId: obj[0], jumpTargetId: obj[1] } = messages);
2026-08-03 11:20:01 +00:00
obj[2] = messages(scrollToMessageId[47]).JumpType.INSTANT;
2026-07-29 08:29:29 +00:00
obj[3] = messages.focusTargetId;
2026-07-20 16:05:17 +00:00
updateRows(obj);
if (null != messages.jumpTargetId) {
2026-07-29 08:29:29 +00:00
obj = { scrollToMessageId: null, jumpTargetId: null, jumpType: null };
({ jumpTargetId: obj2[0], jumpTargetId: obj2[1] } = messages);
2026-08-03 11:20:01 +00:00
obj[2] = tmp2(tmp3[47]).JumpType.INSTANT;
2026-07-20 16:05:17 +00:00
scrollToMessageId(obj);
} else if (null != oldestUnreadMessageId) {
const _setTimeout = setTimeout;
2026-08-03 11:20:01 +00:00
const timerId = setTimeout(() => scrollToMessageId({ scrollToMessageId: oldestUnreadMessageId, jumpTargetId: messages.jumpTargetId, jumpType: messages(scrollToMessageId[47]).JumpType.INSTANT }), 50);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp2 = messages;
tmp3 = scrollToMessageId;
2026-07-20 16:05:17 +00:00
} else {
updateRows({});
}
2026-07-29 08:29:29 +00:00
const mapped = messages.map((id) => id.id);
let hasFetched = messages.hasFetched;
if (!hasFetched) {
hasFetched = messages.ready && !messages.cached;
const tmp10 = messages.ready && !messages.cached;
}
2026-08-03 11:20:01 +00:00
oldestUnreadMessageId(scrollToMessageId[39]).recordMessageRender(channelId, mapped, hasFetched, messages.hasMoreAfter);
2026-07-20 16:05:17 +00:00
};
export function getChatRef(arg0) {
return arg0;
}
2026-07-29 08:29:29 +00:00
export const maybeRescrollToMessageId = function maybeRescrollToMessageId(arg0, jumpType) {
const _require = arg0;
2026-08-24 06:08:38 +00:00
({ chatRef: importDefault, findMessageIndex: dependencyMap, updateRows: closure_3, updateRowsEnabled } = jumpType);
closure_4 = undefined !== updateRowsEnabled && updateRowsEnabled;
2026-07-29 08:29:29 +00:00
let INSTANT = jumpType.jumpType;
if (undefined === INSTANT) {
2026-08-24 06:08:38 +00:00
INSTANT = _require(4310).JumpType.INSTANT;
2026-07-29 08:29:29 +00:00
}
if (null != arg0) {
const _setTimeout = setTimeout;
const timerId = setTimeout(() => {
const tmp2 = findMessageIndex(scrollToMessageId);
if (null != tmp2) {
if (null != chatRef.current) {
let flag = false;
if (c4) {
let obj = { scrollToMessageId: null, jumpTargetId: null, jumpType: null, focusTargetId: null, overrideScrollJumpType: null, isRescrolling: true };
obj[0] = tmp;
obj[1] = tmp;
obj[2] = INSTANT;
obj[3] = tmp;
2026-08-03 11:20:01 +00:00
obj[4] = scrollToMessageId(findMessageIndex[47]).JumpType.INSTANT;
2026-07-29 08:29:29 +00:00
updateRows(obj);
flag = true;
}
if (!flag) {
obj = { animated: null };
2026-08-03 11:20:01 +00:00
obj[0] = INSTANT === scrollToMessageId(findMessageIndex[47]).JumpType.ANIMATED;
chatRef(findMessageIndex[44]).scrollTo(tmp14.current, tmp2, obj);
const obj2 = chatRef(findMessageIndex[44]);
2026-07-29 08:29:29 +00:00
}
}
}
}, 50);
}
};
2026-07-20 16:05:17 +00:00
export const scrollToMessageIdWithRescroll = function scrollToMessageIdWithRescroll(scrollToMessageId) {
scrollToMessageId = scrollToMessageId.scrollToMessageId;
const jumpTargetId = scrollToMessageId.jumpTargetId;
let tmp = null;
if (undefined !== jumpTargetId) {
tmp = jumpTargetId;
}
2026-07-29 08:29:29 +00:00
chatRef = tmp;
2026-07-20 16:05:17 +00:00
let ANIMATED = scrollToMessageId.jumpType;
if (undefined === ANIMATED) {
2026-08-03 11:20:01 +00:00
ANIMATED = scrollToMessageId(findMessageIndex[47]).JumpType.ANIMATED;
2026-07-20 16:05:17 +00:00
}
let TOP = scrollToMessageId.scrollPosition;
if (undefined === TOP) {
2026-08-03 11:20:01 +00:00
TOP = scrollToMessageId(findMessageIndex[44]).ChatScrollPosition.TOP;
2026-07-20 16:05:17 +00:00
}
const minimizeScrolling = scrollToMessageId.minimizeScrolling;
const isRescrolling = scrollToMessageId.isRescrolling;
({ useReducedMotion, chatRef } = scrollToMessageId);
2026-07-29 08:29:29 +00:00
findMessageIndex = chatRef;
2026-07-20 16:05:17 +00:00
({ findMessageIndex, updateRows } = scrollToMessageId);
if (!useReducedMotion) {
2026-08-03 11:20:01 +00:00
useReducedMotion = ANIMATED === scrollToMessageId(findMessageIndex[47]).JumpType.INSTANT;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
updateRows = tmp10;
2026-08-03 11:20:01 +00:00
let obj = scrollToMessageId(findMessageIndex[41]);
2026-07-20 16:05:17 +00:00
if (obj.isIOS()) {
if (!tmp7) {
2026-08-03 11:20:01 +00:00
const JumpType = tmp11(tmp12[47]).JumpType;
2026-07-29 08:29:29 +00:00
let INSTANT = useReducedMotion ? JumpType.INSTANT : JumpType.ANIMATED;
2026-08-24 06:08:38 +00:00
c4 = true;
2026-07-29 08:29:29 +00:00
if (undefined === INSTANT) {
2026-08-03 11:20:01 +00:00
INSTANT = tmp11(tmp12[47]).JumpType.INSTANT;
2026-07-29 08:29:29 +00:00
}
if (null != scrollToMessageId) {
const _setTimeout2 = setTimeout;
const timerId = setTimeout(() => {
const tmp2 = findMessageIndex(scrollToMessageId);
if (null != tmp2) {
if (null != chatRef.current) {
let flag = false;
if (c4) {
let obj = { scrollToMessageId: null, jumpTargetId: null, jumpType: null, focusTargetId: null, overrideScrollJumpType: null, isRescrolling: true };
obj[0] = tmp;
obj[1] = tmp;
obj[2] = INSTANT;
obj[3] = tmp;
2026-08-03 11:20:01 +00:00
obj[4] = scrollToMessageId(findMessageIndex[47]).JumpType.INSTANT;
2026-07-29 08:29:29 +00:00
updateRows(obj);
flag = true;
}
if (!flag) {
obj = { animated: null };
2026-08-03 11:20:01 +00:00
obj[0] = INSTANT === scrollToMessageId(findMessageIndex[47]).JumpType.ANIMATED;
chatRef(findMessageIndex[44]).scrollTo(tmp14.current, tmp2, obj);
const obj2 = chatRef(findMessageIndex[44]);
2026-07-29 08:29:29 +00:00
}
}
}
}, 50);
}
2026-07-20 16:05:17 +00:00
}
}
const findMessageIndexResult = findMessageIndex(scrollToMessageId);
2026-07-29 08:29:29 +00:00
c4 = findMessageIndexResult;
2026-07-20 16:05:17 +00:00
if (null != findMessageIndexResult) {
if (tmp6) {
const _setTimeout = setTimeout;
2026-07-29 08:29:29 +00:00
const timerId1 = setTimeout(() => {
2026-08-03 11:20:01 +00:00
let obj = chatRef(findMessageIndex[44]);
2026-07-29 08:29:29 +00:00
obj = { animated: updateRows, highlight: chatRef === scrollToMessageId };
obj.scrollIntoView(findMessageIndex.current, c4, obj);
2026-07-20 16:05:17 +00:00
}, 5);
} else {
2026-07-29 08:29:29 +00:00
obj = { animated: null, highlight: null, position: null };
obj[0] = tmp10;
obj[1] = tmp === scrollToMessageId;
obj[2] = TOP;
2026-08-03 11:20:01 +00:00
chatRef(tmp12[44]).scrollTo(chatRef.current, findMessageIndexResult, obj);
let obj2 = chatRef(tmp12[44]);
2026-07-20 16:05:17 +00:00
}
}
};
export const handleVisibleMessagesChange = function handleVisibleMessagesChange(arg0) {
({ firstVisibleMessageRowIndex, firstVisibleMessagePercentVisible, lastVisibleMessageRowIndex, lastVisibleMessagePercentVisible, shouldTrackAnnouncementMessageViews, shouldTrackOfficialMessageViews, shouldTrackRichPresenceInviteEmbedViews, shouldTrackVoiceInviteEmbedViews, guildId, channel } = arg0);
if (null != firstVisibleMessageRowIndex) {
if (null != lastVisibleMessageRowIndex) {
if (null != firstVisibleMessagePercentVisible) {
if (null != lastVisibleMessagePercentVisible) {
2026-07-29 08:29:29 +00:00
let obj = { firstVisibleMessageRowIndex: null, lastVisibleMessageRowIndex: null, firstVisibleMessagePercentVisible: null, lastVisibleMessagePercentVisible: null, chatManager: null, channelId: null };
obj[0] = firstVisibleMessageRowIndex;
obj[1] = lastVisibleMessageRowIndex;
obj[2] = firstVisibleMessagePercentVisible;
obj[3] = lastVisibleMessagePercentVisible;
obj[4] = tmp2;
obj[5] = tmp3;
2026-07-20 16:05:17 +00:00
const arr = getVisibleMessages(obj);
if (arr.length > 0) {
2026-07-29 08:29:29 +00:00
obj = { visibleMessages: null, source: null };
obj[0] = arr;
obj[1] = tmp;
2026-08-24 06:08:38 +00:00
const result = _manuallyStartConsoleQuest.questsVisibleMobileMessagesChanged(obj);
const obj4 = getVoiceInviteEmbedRenderInfo;
2026-07-20 16:05:17 +00:00
const result1 = obj4.handleAnnouncementMessageViewTracking(arr, shouldTrackAnnouncementMessageViews, guildId, channel);
2026-08-24 06:08:38 +00:00
const obj5 = getVoiceInviteEmbedRenderInfo;
2026-07-20 16:05:17 +00:00
const result2 = obj5.handleOfficialMessageViewTracking(arr, shouldTrackOfficialMessageViews, guildId, channel);
2026-08-24 06:08:38 +00:00
const obj6 = getVoiceInviteEmbedRenderInfo;
2026-07-20 16:05:17 +00:00
const result3 = obj6.handleRichPresenceInviteEmbedViewTracking(arr, shouldTrackRichPresenceInviteEmbedViews, guildId, channel);
2026-08-24 06:08:38 +00:00
const obj7 = getVoiceInviteEmbedRenderInfo;
2026-07-20 16:05:17 +00:00
const result4 = obj7.handleVoiceInviteEmbedViewTracking(arr, shouldTrackVoiceInviteEmbedViews, guildId, channel);
2026-08-24 06:08:38 +00:00
const obj2 = _manuallyStartConsoleQuest;
2026-07-20 16:05:17 +00:00
}
}
}
}
}
};
export const getVoiceStateChannelSummaryFromVoiceStates = function getVoiceStateChannelSummaryFromVoiceStates(voiceStates) {
const entries = Object.entries(voiceStates);
const found = entries.filter((arg0) => {
[, tmp] = arg0;
return false !== tmp.discoverable;
});
const mapped = found.map((arg0) => {
[tmp, tmp2] = arg0;
2026-07-29 08:29:29 +00:00
let str = tmp2.channelId;
if (str == null) {
str = "";
2026-07-20 16:05:17 +00:00
}
return "" + tmp + ":" + str;
});
const sorted = mapped.sort();
return sorted.join("|");
};
2026-07-29 08:29:29 +00:00
export const getVoiceChannelIdChangedAuthorIds = function getVoiceChannelIdChangedAuthorIds(prop, prop1) {
const obj = parseVoiceStateChannelIdSummary(prop);
const obj2 = parseVoiceStateChannelIdSummary(prop1);
2026-07-20 16:05:17 +00:00
const set = new Set();
const items = [...obj.keys(), ...obj2.keys()];
2026-07-29 08:29:29 +00:00
for (const item10032 of set1) {
let tmp2 = item10032;
let value = obj.get(item10032);
if (value !== obj2.get(item10032)) {
let tmp4 = item10032;
let addResult = set.add(tmp2);
}
continue;
2026-07-20 16:05:17 +00:00
}
return set;
};