decord/beta/source/utils/native/MessagesUtils.tsx

289 lines
15 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 16:32:48 +00:00
// Module ID: 11629
// Function ID: 11630
// Name: MessagesUtils
2026-10-12 16:32:48 +00:00
// Dependencies: [1085, 7031, 5077, 8142, 5417, 2]
2026-10-12 16:32:48 +00:00
// Module 11629 (MessagesUtils)
import CodedLink from "CodedLink" /* 5077 */;
import MediaPostEmbedUtils from "MediaPostEmbedUtils" /* 5417 */;
import GuildTemplatesConstants from "GuildTemplatesConstants" /* 7031 */;
import ExperimentEmbedUtils from "ExperimentEmbedUtils" /* 8142 */;
2026-10-07 22:43:51 +00:00
import Constants from "Constants" /* 1085 */;
import size from "module_2" /* 2 */;
2026-10-01 14:13:23 +00:00
let invites;
let c2;
let c3;
({ InviteStates: c2, MessageEmbedTypes: c3 } = Constants);
const GuildTemplateStates = GuildTemplatesConstants.GuildTemplateStates;
2026-10-01 14:13:23 +00:00
let obj = {
2026-10-12 16:32:48 +00:00
messageAuthorActivitiesChanged(activity, props, merged) {
return props.messageAuthorActivities !== merged.messageAuthorActivities && null != activity.activity && props.messageAuthorActivities[activity.author.id] !== merged.messageAuthorActivities[activity.author.id];
},
2026-10-12 16:32:48 +00:00
codedLinksChanged(codedLinks, props, merged) {
let tmp = 0 !== codedLinks.codedLinks.length;
if (tmp) {
2026-10-12 16:32:48 +00:00
let someResult = props.invites !== merged.invites || props.appDirectoryEmbedApplications !== merged.appDirectoryEmbedApplications || props.invalidAppDirectoryEmbedApplicationIds !== merged.invalidAppDirectoryEmbedApplicationIds || props.invalidApplicationIds !== merged.invalidApplicationIds || props.appDirectoryEmbedApplicationFetchStates !== merged.appDirectoryEmbedApplicationFetchStates || props.guildTemplates !== merged.guildTemplates || props.gameOrganizationInvites !== merged.gameOrganizationInvites || props.buildOverrides !== merged.buildOverrides || props.activityParticipants !== merged.activityParticipants || props.quests !== merged.quests || props.isFetchingCurrentQuests !== merged.isFetchingCurrentQuests || props.applicationAssetFetchingIds !== merged.applicationAssetFetchingIds || props.experimentEmbeds !== merged.experimentEmbeds;
if (someResult) {
codedLinks = codedLinks.codedLinks;
someResult = codedLinks.some((item) => {
2026-10-01 14:13:23 +00:00
let code;
let type;
({ type, code } = item);
if (CodedLink.CodedLinkType.BUILD_OVERRIDE !== type) {
2026-10-01 14:13:23 +00:00
if (CodedLink.CodedLinkType.MANUAL_BUILD_OVERRIDE !== type) {
if (CodedLink.CodedLinkType.EXPERIMENT === type) {
const tmpResult = ExperimentEmbedUtils;
const experimentFromEmbedURL = tmpResult.getExperimentFromEmbedURL(code);
2026-10-07 22:43:51 +00:00
let tmp55 = null != experimentFromEmbedURL;
if (tmp55) {
const legacyExperiments = props.experimentEmbeds.legacyExperiments;
2026-10-07 22:43:51 +00:00
let tmp57;
if (legacyExperiments != null) {
2026-10-07 22:43:51 +00:00
tmp57 = legacyExperiments[experimentFromEmbedURL];
}
2026-10-12 16:32:48 +00:00
const legacyExperiments2 = merged.experimentEmbeds.legacyExperiments;
2026-10-07 22:43:51 +00:00
let tmp59;
if (legacyExperiments2 != null) {
2026-10-07 22:43:51 +00:00
tmp59 = legacyExperiments2[experimentFromEmbedURL];
}
2026-10-07 22:43:51 +00:00
let tmp60 = tmp57 !== tmp59;
if (!tmp60) {
const legacyOverridesInfo = tmp56.experimentEmbeds.legacyOverridesInfo;
let tmp61;
if (legacyOverridesInfo != null) {
2026-10-07 22:43:51 +00:00
tmp61 = legacyOverridesInfo[experimentFromEmbedURL];
}
2026-10-07 22:43:51 +00:00
const legacyOverridesInfo2 = tmp58.experimentEmbeds.legacyOverridesInfo;
let tmp62;
if (legacyOverridesInfo2 != null) {
2026-10-07 22:43:51 +00:00
tmp62 = legacyOverridesInfo2[experimentFromEmbedURL];
}
2026-10-07 22:43:51 +00:00
tmp60 = tmp61 !== tmp62;
}
2026-10-07 22:43:51 +00:00
if (!tmp60) {
const apexExperiments = tmp56.experimentEmbeds.apexExperiments;
let tmp63;
if (apexExperiments != null) {
2026-10-07 22:43:51 +00:00
tmp63 = apexExperiments[experimentFromEmbedURL];
}
2026-10-07 22:43:51 +00:00
const apexExperiments2 = tmp58.experimentEmbeds.apexExperiments;
let tmp64;
if (apexExperiments2 != null) {
2026-10-07 22:43:51 +00:00
tmp64 = apexExperiments2[experimentFromEmbedURL];
}
2026-10-07 22:43:51 +00:00
tmp60 = tmp63 !== tmp64;
}
2026-10-07 22:43:51 +00:00
if (!tmp60) {
const apexOverridesInfo = tmp56.experimentEmbeds.apexOverridesInfo;
let tmp65;
if (apexOverridesInfo != null) {
2026-10-07 22:43:51 +00:00
tmp65 = apexOverridesInfo[experimentFromEmbedURL];
}
2026-10-07 22:43:51 +00:00
const apexOverridesInfo2 = tmp58.experimentEmbeds.apexOverridesInfo;
let tmp66;
if (apexOverridesInfo2 != null) {
2026-10-07 22:43:51 +00:00
tmp66 = apexOverridesInfo2[experimentFromEmbedURL];
}
2026-10-07 22:43:51 +00:00
tmp60 = tmp65 !== tmp66;
}
2026-10-07 22:43:51 +00:00
tmp55 = tmp60;
}
2026-10-07 22:43:51 +00:00
return tmp55;
2026-10-01 14:13:23 +00:00
} else if (CodedLink.CodedLinkType.INVITE === type) {
const invites3 = props.invites;
2026-10-01 14:13:23 +00:00
const value = invites3.get(code);
2026-10-12 16:32:48 +00:00
const invites4 = merged.invites;
2026-10-07 22:43:51 +00:00
const value7 = invites4.get(code);
let state;
2026-10-01 14:13:23 +00:00
const applicationAssetFetchingIds = props.applicationAssetFetchingIds;
2026-10-12 16:32:48 +00:00
const applicationAssetFetchingIds2 = merged.applicationAssetFetchingIds;
if (value != null) {
state = value.state;
}
let state1;
2026-10-07 22:43:51 +00:00
if (value7 != null) {
state1 = value7.state;
}
2026-10-07 22:43:51 +00:00
let tmp50 = state !== state1;
if (tmp50) {
let state2;
2026-10-07 22:43:51 +00:00
if (value7 != null) {
state2 = value7.state;
}
2026-10-07 22:43:51 +00:00
tmp50 = state2 !== constants.RESOLVING;
}
2026-10-07 22:43:51 +00:00
if (!tmp50) {
tmp50 = applicationAssetFetchingIds !== applicationAssetFetchingIds2;
}
2026-10-07 22:43:51 +00:00
return tmp50;
2026-10-01 14:13:23 +00:00
} else if (CodedLink.CodedLinkType.TEMPLATE === type) {
const guildTemplates = props.guildTemplates;
2026-10-07 22:43:51 +00:00
const value8 = guildTemplates.get(code);
2026-10-12 16:32:48 +00:00
const guildTemplates2 = merged.guildTemplates;
2026-10-07 22:43:51 +00:00
const value9 = guildTemplates2.get(code);
let state3;
2026-10-07 22:43:51 +00:00
if (value8 != null) {
state3 = value8.state;
}
let state4;
2026-10-07 22:43:51 +00:00
if (value9 != null) {
state4 = value9.state;
}
2026-10-07 22:43:51 +00:00
let tmp40 = state3 !== state4;
if (tmp40) {
let state5;
2026-10-07 22:43:51 +00:00
if (value9 != null) {
state5 = value9.state;
}
2026-10-07 22:43:51 +00:00
tmp40 = state5 !== GuildTemplateStates.RESOLVING;
}
2026-10-07 22:43:51 +00:00
return tmp40;
} else {
2026-10-01 14:13:23 +00:00
if (CodedLink.CodedLinkType.EVENT !== type) {
if (CodedLink.CodedLinkType.CHANNEL_LINK !== type) {
if (CodedLink.CodedLinkType.APP_DIRECTORY_PROFILE === type) {
const invalidAppDirectoryEmbedApplicationIds = props.invalidAppDirectoryEmbedApplicationIds;
2026-10-12 16:32:48 +00:00
const invalidAppDirectoryEmbedApplicationIds2 = merged.invalidAppDirectoryEmbedApplicationIds;
2026-10-07 22:43:51 +00:00
const tmp26 = props.appDirectoryEmbedApplications[code];
2026-10-12 16:32:48 +00:00
const tmp28 = merged.appDirectoryEmbedApplications[code];
const hasItem = invalidAppDirectoryEmbedApplicationIds.has(code);
2026-10-07 22:43:51 +00:00
let tmp32 = tmp26 !== tmp28;
const tmp30 = props.appDirectoryEmbedApplicationFetchStates[code];
2026-10-12 16:32:48 +00:00
const tmp31 = merged.appDirectoryEmbedApplicationFetchStates[code];
2026-10-07 22:43:51 +00:00
if (!tmp32) {
tmp32 = hasItem !== invalidAppDirectoryEmbedApplicationIds2.has(code);
}
2026-10-07 22:43:51 +00:00
if (!tmp32) {
tmp32 = tmp30 !== tmp31;
}
2026-10-07 22:43:51 +00:00
return tmp32;
2026-10-01 14:13:23 +00:00
} else if (CodedLink.CodedLinkType.ACTIVITY_BOOKMARK === type) {
2026-10-12 16:32:48 +00:00
return props.activityParticipants !== merged.activityParticipants || props.invalidApplicationIds !== merged.invalidApplicationIds || props.applicationAssetFetchingIds !== merged.applicationAssetFetchingIds;
2026-10-01 14:13:23 +00:00
} else if (CodedLink.CodedLinkType.EMBEDDED_ACTIVITY_INVITE === type) {
invites = props.invites;
2026-10-07 22:43:51 +00:00
const value10 = invites.get(code);
2026-10-12 16:32:48 +00:00
const invites2 = merged.invites;
2026-10-07 22:43:51 +00:00
const value11 = invites2.get(code);
2026-10-12 16:32:48 +00:00
let tmp15 = props.activityParticipants !== merged.activityParticipants || tmp11.invalidApplicationIds !== tmp13.invalidApplicationIds || tmp11.applicationAssetFetchingIds !== tmp13.applicationAssetFetchingIds;
2026-10-07 22:43:51 +00:00
if (!tmp15) {
let state6;
2026-10-07 22:43:51 +00:00
if (value10 != null) {
state6 = value10.state;
}
let state7;
2026-10-07 22:43:51 +00:00
if (value11 != null) {
state7 = value11.state;
}
2026-10-07 22:43:51 +00:00
let tmp19 = state6 !== state7;
if (tmp19) {
let state8;
2026-10-07 22:43:51 +00:00
if (value11 != null) {
state8 = value11.state;
}
2026-10-07 22:43:51 +00:00
tmp19 = state8 !== constants.RESOLVING;
}
2026-10-07 22:43:51 +00:00
tmp15 = tmp19;
}
2026-10-07 22:43:51 +00:00
return tmp15;
} else {
2026-10-01 14:13:23 +00:00
if (CodedLink.CodedLinkType.GUILD_PRODUCT !== type) {
if (CodedLink.CodedLinkType.SERVER_SHOP !== type) {
if (CodedLink.CodedLinkType.SOCIAL_LAYER_STOREFRONT !== type) {
if (CodedLink.CodedLinkType.SOCIAL_LAYER_STOREFRONT_APP !== type) {
if (CodedLink.CodedLinkType.QUESTS_EMBED === type) {
2026-10-12 16:32:48 +00:00
return props.quests !== merged.quests || props.isFetchingCurrentQuests !== tmp9.isFetchingCurrentQuests;
} else {
2026-10-01 14:13:23 +00:00
if (CodedLink.CodedLinkType.APP_DIRECTORY_STOREFRONT !== type) {
if (CodedLink.CodedLinkType.APP_DIRECTORY_STOREFRONT_SKU !== type) {
if (CodedLink.CodedLinkType.APP_OAUTH2_LINK === type) {
2026-10-12 16:32:48 +00:00
return props.applicationAssetFetchingIds !== merged.applicationAssetFetchingIds || props.invalidApplicationIds !== tmp7.invalidApplicationIds;
} else {
2026-10-01 14:13:23 +00:00
if (CodedLink.CodedLinkType.COLLECTIBLES_SHOP !== type) {
if (CodedLink.CodedLinkType.GAME_PROFILE !== type) {
if (CodedLink.CodedLinkType.GAME_SERVER_SHARE !== type) {
if (CodedLink.CodedLinkType.USER_PROFILE !== type) {
2026-10-07 22:43:51 +00:00
if (CodedLink.CodedLinkType.GAME_ORGANIZATION_INVITE === type) {
const gameOrganizationInvites = props.gameOrganizationInvites;
2026-10-12 16:32:48 +00:00
const gameOrganizationInvites2 = merged.gameOrganizationInvites;
2026-10-07 22:43:51 +00:00
const value12 = gameOrganizationInvites.get(code);
return value12 !== gameOrganizationInvites2.get(code);
} else {
const _Error = Error;
const _HermesInternal = HermesInternal;
throw Error("Unknown coded link type: " + type);
}
}
}
}
}
return false;
}
}
}
return false;
}
}
}
}
}
return false;
}
}
}
return false;
}
}
}
let state9;
if (props.buildOverrides[code] != null) {
2026-10-07 22:43:51 +00:00
state9 = tmp67.state;
}
let state10;
2026-10-12 16:32:48 +00:00
if (merged.buildOverrides[code] != null) {
2026-10-07 22:43:51 +00:00
state10 = tmp68.state;
}
return state9 !== state10;
});
}
tmp = someResult;
}
return tmp;
},
2026-10-12 16:32:48 +00:00
giftCodesChanged(giftCodes, props, merged) {
let someResult = 0 !== giftCodes.giftCodes.length;
if (someResult) {
giftCodes = giftCodes.giftCodes;
someResult = giftCodes.some((item) => {
const resolvedGiftCodes = props.resolvedGiftCodes;
2026-10-12 16:32:48 +00:00
const resolvedGiftCodes2 = merged.resolvedGiftCodes;
const hasItem = resolvedGiftCodes.includes(item);
const resolvingGiftCodes = props.resolvingGiftCodes;
const hasItem1 = resolvedGiftCodes2.includes(item);
2026-10-12 16:32:48 +00:00
const resolvingGiftCodes2 = merged.resolvingGiftCodes;
const hasItem2 = resolvingGiftCodes.includes(item);
const acceptingGiftCodes = props.acceptingGiftCodes;
const hasItem3 = resolvingGiftCodes2.includes(item);
2026-10-12 16:32:48 +00:00
const acceptingGiftCodes2 = merged.acceptingGiftCodes;
const hasItem4 = acceptingGiftCodes.includes(item);
return true;
});
}
return someResult;
},
2026-10-12 16:32:48 +00:00
mediaPostPreviewEmbedsChanged(embeds, props, merged) {
embeds = embeds.embeds;
const found = embeds.filter((type) => type.type === constants.POST_PREVIEW);
2026-10-01 14:13:23 +00:00
const tmp = 0 !== found.length && found.some((url) => {
const obj = MediaPostEmbedUtils;
const mediaPostEmbedChannelId = obj.getMediaPostEmbedChannelId(url.url);
2026-10-12 16:32:48 +00:00
return null != mediaPostEmbedChannelId && props.mediaPostPreviewEmbeds[mediaPostEmbedChannelId] !== merged.mediaPostPreviewEmbeds[mediaPostEmbedChannelId];
});
2026-10-01 14:13:23 +00:00
return tmp;
}
};
2026-10-01 14:13:23 +00:00
const result = size.fileFinishedImporting("utils/native/MessagesUtils.tsx");
export default obj;