decord/source/modules/forwarding/ForwardDestinationUtils.tsx

221 lines
8.4 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 6105
// Function ID: 54583
2026-07-20 16:05:17 +00:00
// Name: messageHasCheckpoint
2026-07-25 08:10:48 +00:00
// Dependencies: [31, 5036, 1352, 1348, 3759, 3768, 1850, 653, 6106, 1327, 566, 669, 4467, 1882, 4346, 1212, 4465, 3970, 4321, 2]
2026-07-20 16:05:17 +00:00
// Exports: getDestinationIsUnavailable, useDestinationNamesWithSlowmode, useSelectedDestinationChannel, useSelectedDestinationNames
2026-07-25 08:10:48 +00:00
// Module 6105 (messageHasCheckpoint)
2026-07-23 10:11:24 +00:00
import result from "result";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import _callSuper from "_callSuper";
import closure_8 from "_isNativeReflectConstruct";
import closure_9 from "_isNativeReflectConstruct";
import closure_10 from "_isNativeReflectConstruct";
import closure_11 from "_isNativeReflectConstruct";
import ME from "ME";
let closure_12;
let closure_13;
let closure_5;
let closure_6;
let closure_7;
const require = arg1;
2026-07-20 16:05:17 +00:00
function messageHasCheckpoint(message) {
let tmp = message.components.length > 0;
if (tmp) {
2026-07-25 08:10:48 +00:00
tmp = message.components[0].type === require(1882) /* PermissionOverwriteType */.ComponentType.CHECKPOINT_CARD;
2026-07-20 16:05:17 +00:00
}
return tmp;
}
2026-07-23 10:11:24 +00:00
function isRatelimitedInChannel(channel, outer2_6) {
2026-07-20 16:05:17 +00:00
let tmp = null != channel.rateLimitPerUser;
if (tmp) {
tmp = channel.rateLimitPerUser > 0;
}
if (tmp) {
2026-07-23 10:11:24 +00:00
let canResult = outer2_6.can(constants2.MANAGE_CHANNELS, channel);
2026-07-20 16:05:17 +00:00
if (!canResult) {
2026-07-23 10:11:24 +00:00
canResult = outer2_6.can(constants2.MANAGE_MESSAGES, channel);
2026-07-20 16:05:17 +00:00
}
tmp = !canResult;
}
return tmp;
}
2026-07-23 10:11:24 +00:00
({ ChannelRecordBase: closure_5, isGuildChannelType: closure_6, createChannelRecord: closure_7 } = _callSuper);
({ MessageFlags: closure_12, Permissions: closure_13 } = ME);
const result = require("_callSuper").fileFinishedImporting("modules/forwarding/ForwardDestinationUtils.tsx");
2026-07-20 16:05:17 +00:00
export const useSelectedDestinationChannel = function useSelectedDestinationChannel(selectedDestinations) {
2026-07-25 08:10:48 +00:00
const mapped = selectedDestinations.map(found(6106).getChannelIdFromDestinationId);
2026-07-23 10:11:24 +00:00
found = mapped.find(found(1327).isNotNullish);
2026-07-20 16:05:17 +00:00
const items = [closure_8];
const items1 = [found];
2026-07-23 10:11:24 +00:00
const stateFromStores = found(566).useStateFromStores(items, () => outer1_8.getChannel(found), items1);
2026-07-20 16:05:17 +00:00
const items2 = [stateFromStores];
return React.useMemo(() => {
if (null != stateFromStores) {
let tmp4 = stateFromStores;
} else {
2026-07-23 10:11:24 +00:00
const obj = { id: "1", type: found(outer1_2[11]).ChannelTypes.DM };
tmp4 = outer1_7(obj);
2026-07-20 16:05:17 +00:00
}
return tmp4;
}, items2);
};
export const getDestinationIsUnavailable = function getDestinationIsUnavailable(stateFromStores, stateFromStores1, type) {
2026-07-23 10:11:24 +00:00
const _require = type;
2026-07-20 16:05:17 +00:00
if (null != arg3) {
const tmp2 = arg3(type);
if (null != tmp2) {
return tmp2;
}
}
if (null != stateFromStores) {
const tmp44 = messageHasCheckpoint(stateFromStores);
let tmp4 = stateFromStores.messageSnapshots.length > 0;
if (tmp4) {
tmp4 = messageHasCheckpoint(stateFromStores.messageSnapshots[0].message);
}
if (null != stateFromStores1) {
2026-07-25 08:10:48 +00:00
let obj = _require(4346);
2026-07-20 16:05:17 +00:00
if (obj.isChannelOrGuildNSFW(stateFromStores1)) {
if (tmp) {
2026-07-25 08:10:48 +00:00
let obj1 = _require(4346);
2026-07-20 16:05:17 +00:00
}
obj = {};
2026-07-23 10:11:24 +00:00
const intl = _require(1212).intl;
obj.label = intl.string(_require(1212).t.KgPx1D);
2026-07-20 16:05:17 +00:00
obj.lineClamp = 2;
return obj;
}
if (tmp) {
if (callback(type.type)) {
if (stateFromStores.attachments.length > 0) {
if (!closure_9.can(constants2.ATTACH_FILES, type)) {
obj = {};
2026-07-23 10:11:24 +00:00
const intl2 = _require(1212).intl;
obj.label = intl2.string(_require(1212).t.P7yvbm);
2026-07-20 16:05:17 +00:00
return obj;
}
} else {
const messageSnapshots = stateFromStores.messageSnapshots;
}
if (stateFromStores.embeds.length > 0) {
2026-07-25 08:10:48 +00:00
let obj4 = _require(4465);
2026-07-20 16:05:17 +00:00
if (!obj4.canEmbedLinks(type, closure_9)) {
if (!obj6.shouldStripEmbeds(stateFromStores)) {
obj1 = {};
2026-07-23 10:11:24 +00:00
const intl3 = _require(1212).intl;
obj1.label = intl3.string(_require(1212).t.Wr4RIX);
2026-07-20 16:05:17 +00:00
return obj1;
}
2026-07-25 08:10:48 +00:00
obj6 = _require(4465);
2026-07-20 16:05:17 +00:00
}
} else {
const messageSnapshots2 = stateFromStores.messageSnapshots;
}
if (tmp44) {
if (!obj8.canEmbedLinks(type, closure_9)) {
const obj2 = {};
2026-07-23 10:11:24 +00:00
const intl4 = _require(1212).intl;
obj2.label = intl4.string(_require(1212).t.Wr4RIX);
2026-07-20 16:05:17 +00:00
return obj2;
}
2026-07-25 08:10:48 +00:00
obj8 = _require(4465);
2026-07-20 16:05:17 +00:00
}
const items = [];
const messageSnapshots3 = stateFromStores.messageSnapshots;
2026-07-25 08:10:48 +00:00
let arraySpreadResult = HermesBuiltin.arraySpread(_require(4467).getMessageStickers(stateFromStores), 0);
2026-07-23 10:11:24 +00:00
arraySpreadResult = HermesBuiltin.arraySpread(messageSnapshots3.flatMap((message) => type(outer1_2[12]).getMessageStickers(message.message)), arraySpreadResult);
2026-07-20 16:05:17 +00:00
if (items.length > 0) {
if (!closure_9.can(constants2.USE_EXTERNAL_STICKERS, type)) {
if (items.some((id) => {
2026-07-23 10:11:24 +00:00
const stickerById = outer1_4.getStickerById(id.id);
2026-07-20 16:05:17 +00:00
let isGuildStickerResult = null != stickerById;
if (isGuildStickerResult) {
2026-07-23 10:11:24 +00:00
isGuildStickerResult = type(outer1_2[12]).isGuildSticker(stickerById);
const obj = type(outer1_2[12]);
2026-07-20 16:05:17 +00:00
}
if (isGuildStickerResult) {
2026-07-23 10:11:24 +00:00
isGuildStickerResult = stickerById.guild_id !== type.guild_id || undefined;
const tmp6 = stickerById.guild_id !== type.guild_id || undefined;
2026-07-20 16:05:17 +00:00
}
return isGuildStickerResult;
})) {
const obj3 = {};
2026-07-23 10:11:24 +00:00
const intl5 = _require(1212).intl;
obj3.label = intl5.string(_require(1212).t["0Yyrua"]);
2026-07-20 16:05:17 +00:00
return obj3;
}
}
}
if (stateFromStores.hasFlag(constants.IS_VOICE_MESSAGE)) {
if (!closure_9.can(constants2.SEND_VOICE_MESSAGES, type)) {
obj4 = {};
2026-07-23 10:11:24 +00:00
const intl6 = _require(1212).intl;
obj4.label = intl6.string(_require(1212).t.quj4DY);
2026-07-20 16:05:17 +00:00
return obj4;
}
} else {
const messageSnapshots4 = stateFromStores.messageSnapshots;
}
2026-07-25 08:10:48 +00:00
const obj10 = _require(4467);
2026-07-20 16:05:17 +00:00
}
}
}
}
};
export { isRatelimitedInChannel };
export const useSelectedDestinationNames = function useSelectedDestinationNames(arg0) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-07-20 16:05:17 +00:00
const items = [closure_11, closure_8, closure_10];
const items1 = [arg0];
2026-07-23 10:11:24 +00:00
return _require(566).useStateFromStoresArray(items, () => {
const mapped = lib.map((id) => {
2026-07-20 16:05:17 +00:00
id = id.id;
if ("user" === id.type) {
2026-07-23 10:11:24 +00:00
const user = outer2_11.getUser(id);
2026-07-20 16:05:17 +00:00
let tmp13 = null;
if (null != user) {
2026-07-23 10:11:24 +00:00
let nickname = outer2_10.getNickname(user.id);
2026-07-20 16:05:17 +00:00
if (null == nickname) {
2026-07-23 10:11:24 +00:00
nickname = outer2_1(outer2_2[17]).getName(user);
const obj2 = outer2_1(outer2_2[17]);
2026-07-20 16:05:17 +00:00
}
tmp13 = nickname;
}
return tmp13;
} else {
2026-07-23 10:11:24 +00:00
const channel = outer2_8.getChannel(id);
2026-07-20 16:05:17 +00:00
let channelName = null;
if (null != channel) {
2026-07-23 10:11:24 +00:00
const obj = callback(outer2_2[18]);
channelName = obj.computeChannelName(channel, outer2_11, outer2_10, true);
2026-07-20 16:05:17 +00:00
}
return channelName;
}
});
2026-07-23 10:11:24 +00:00
return mapped.filter(lib(outer1_2[9]).isNotNullish);
2026-07-20 16:05:17 +00:00
}, items1);
};
export const useDestinationNamesWithSlowmode = function useDestinationNamesWithSlowmode(selectedDestinations) {
2026-07-23 10:11:24 +00:00
const _require = selectedDestinations;
2026-07-20 16:05:17 +00:00
const items = [closure_8, closure_9];
const items1 = [selectedDestinations];
2026-07-23 10:11:24 +00:00
const stateFromStoresArray = _require(566).useStateFromStoresArray(items, () => {
const mapped = selectedDestinations.map((type) => {
2026-07-20 16:05:17 +00:00
let channel = null;
if ("channel" === type.type) {
2026-07-23 10:11:24 +00:00
channel = outer2_8.getChannel(tmp);
2026-07-20 16:05:17 +00:00
}
return channel;
});
2026-07-23 10:11:24 +00:00
const found = mapped.filter(selectedDestinations(outer1_2[9]).isNotNullish);
return found.filter((arg0) => outer2_15(arg0, outer2_9));
2026-07-20 16:05:17 +00:00
}, items1);
2026-07-23 10:11:24 +00:00
const obj = _require(566);
2026-07-20 16:05:17 +00:00
const items2 = [closure_11, closure_10];
const items3 = [stateFromStoresArray];
2026-07-23 10:11:24 +00:00
return _require(566).useStateFromStoresArray(items2, () => stateFromStoresArray.map((channel) => callback(outer2_2[18]).computeChannelName(channel, outer2_11, outer2_10, true)), items3);
2026-07-20 16:05:17 +00:00
};