decord/stable/source/modules/activities/ActivitiesInTextUtils.tsx

205 lines
5.9 KiB
TypeScript
Raw Permalink Normal View History

2026-10-06 22:12:49 +00:00
// Module ID: 8784
// Function ID: 8785
// Name: ActivitiesInTextUtils
2026-10-06 22:12:49 +00:00
// Dependencies: [2051, 4472, 1097, 1107, 558, 576, 504, 2]
// Exports: getIsAppLauncherEnabled, isActivitiesInTextEnabled
2026-10-06 22:12:49 +00:00
// Module 8784 (ActivitiesInTextUtils)
import Constants from "Constants" /* 1097 */;
import ChannelTypes from "ChannelTypes" /* 1107 */;
import ChannelStore from "ChannelStore" /* 2051 */;
import PermissionStore from "PermissionStore" /* 4472 */;
import ReactCompilerGating_mod from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
const require = globalThis.__r;
2026-10-06 22:12:49 +00:00
let _require;
function isActivityInTextSupportedForChannel(channel) {
if (null == channel) {
return false;
} else {
channel = ChannelStore.getChannel(channel.parent_id);
let hasItem = null == channel;
if (!hasItem) {
2026-10-06 22:12:49 +00:00
let type1;
if (channel != null) {
2026-10-06 22:12:49 +00:00
type1 = channel.type;
}
2026-10-06 22:12:49 +00:00
hasItem = type1 === ChannelTypes.ChannelTypes.GUILD_CATEGORY;
}
if (hasItem) {
2026-10-06 22:12:49 +00:00
const type = channel.type;
const items = [ChannelTypes.ChannelTypes.GUILD_TEXT, ChannelTypes.ChannelTypes.GUILD_VOICE, ChannelTypes.ChannelTypes.GROUP_DM, ChannelTypes.ChannelTypes.DM, ChannelTypes.ChannelTypes.GUILD_SPACE];
2026-10-06 22:12:49 +00:00
hasItem = items.includes(type);
}
return hasItem;
}
}
2026-10-06 22:12:49 +00:00
const Permissions = Constants.Permissions;
let ReactCompilerGating = ReactCompilerGating_mod;
let tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? ((arg0) => {
let closure_0;
let first;
let tmp7;
_require = arg0;
let obj = require("react");
const cResult = obj.c(3);
const tmp = _require;
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [ChannelStore, PermissionStore];
cResult[0] = items;
first = items;
} else {
first = cResult[0];
}
if (cResult[1] !== arg0) {
const fn = function u() {
const channel = ChannelStore.getChannel(closure_0);
let flag = false;
const obj = PermissionStore;
if (null != channel) {
flag = false;
if (undefined !== channel) {
flag = false;
if (isActivityInTextSupportedForChannel(channel)) {
flag = true;
if (null != channel.guild_id) {
flag = true;
if (!obj.can(Permissions.USE_EMBEDDED_ACTIVITIES, channel)) {
flag = false;
}
}
}
}
}
2026-10-06 22:12:49 +00:00
return flag;
};
cResult[1] = arg0;
cResult[2] = fn;
tmp7 = fn;
} else {
tmp7 = cResult[2];
}
2026-10-06 22:12:49 +00:00
const tmpResult = tmp(504);
return tmpResult.useStateFromStores(first, tmp7);
}) : ((arg0) => {
let closure_0;
_require = arg0;
let obj = require("get initialized");
const items = [ChannelStore, PermissionStore];
2026-10-06 22:12:49 +00:00
return obj.useStateFromStores(items, () => {
const channel = ChannelStore.getChannel(closure_0);
let flag = false;
2026-10-06 22:12:49 +00:00
const obj = PermissionStore;
if (null != channel) {
flag = false;
if (undefined !== channel) {
flag = false;
if (isActivityInTextSupportedForChannel(channel)) {
flag = true;
if (null != channel.guild_id) {
flag = true;
2026-10-06 22:12:49 +00:00
if (!obj.can(Permissions.USE_EMBEDDED_ACTIVITIES, channel)) {
flag = false;
}
}
}
}
}
return flag;
});
2026-10-06 22:12:49 +00:00
});
ReactCompilerGating = ReactCompilerGating_mod;
function getIsAppLauncherEnabled(channel) {
let guild_id;
if (channel != null) {
guild_id = channel.guild_id;
}
2026-10-06 22:12:49 +00:00
const tmp2 = null != guild_id || isActivityInTextSupportedForChannel(channel);
return tmp2;
2026-10-06 22:12:49 +00:00
}
const tmp3 = ReactCompilerGating.isReactCompilerEnabled() ? ((arg0) => {
let closure_0;
let first;
let tmp6;
_require = arg0;
let tmp2 = dependencyMap;
const obj = require("react");
const cResult = obj.c(3);
const tmp = _require;
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [ChannelStore];
cResult[0] = items;
first = items;
} else {
first = cResult[0];
}
if (cResult[1] !== arg0) {
const fn = function l() {
const channel = ChannelStore.getChannel(closure_0);
let tmp2 = null != channel;
if (tmp2) {
let guild_id;
if (channel != null) {
guild_id = channel.guild_id;
}
tmp2 = null != guild_id || isActivityInTextSupportedForChannel(channel);
const tmp4 = null != guild_id || isActivityInTextSupportedForChannel(channel);
}
return tmp2;
};
cResult[1] = arg0;
cResult[2] = fn;
tmp6 = fn;
} else {
tmp6 = cResult[2];
}
const tmpResult = tmp(504);
return tmpResult.useStateFromStores(first, tmp6);
}) : ((arg0) => {
let closure_0;
_require = arg0;
const items = [ChannelStore];
2026-10-06 22:12:49 +00:00
const obj = require("get initialized");
return obj.useStateFromStores(items, () => {
const channel = ChannelStore.getChannel(closure_0);
let tmp2 = null != channel;
if (tmp2) {
let guild_id;
if (channel != null) {
guild_id = channel.guild_id;
}
2026-10-06 22:12:49 +00:00
tmp2 = null != guild_id || isActivityInTextSupportedForChannel(channel);
const tmp4 = null != guild_id || isActivityInTextSupportedForChannel(channel);
}
return tmp2;
});
2026-10-06 22:12:49 +00:00
});
const result = size.fileFinishedImporting("modules/activities/ActivitiesInTextUtils.tsx");
export { isActivityInTextSupportedForChannel };
export const isActivitiesInTextEnabled = function isActivitiesInTextEnabled(channel) {
let flag = false;
const obj = PermissionStore;
if (null != channel) {
flag = false;
if (undefined !== channel) {
flag = false;
if (isActivityInTextSupportedForChannel(channel)) {
flag = true;
if (null != channel.guild_id) {
flag = true;
if (!obj.can(Permissions.USE_EMBEDDED_ACTIVITIES, channel)) {
flag = false;
}
}
}
}
}
return flag;
};
2026-10-06 22:12:49 +00:00
export const useIsActivitiesInTextEnabled = tmp2;
export { getIsAppLauncherEnabled };
export const useIsAppLauncherEnabled = tmp3;