decord/source/modules/app_launcher/hooks/useAppsInThisServer.tsx

107 lines
3.5 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 11350
// Function ID: 11351
2026-07-20 16:05:17 +00:00
// Name: useAppsInThisServer
2026-08-24 06:08:38 +00:00
// Dependencies: [19, 8487, 1922, 5251, 589, 9592, 1954, 8497, 11349, 12, 9594, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-24 06:08:38 +00:00
// Module 11350 (useAppsInThisServer)
import closure_4 from "noop" /* 19 */;
import { useGuildIndexState } from "getIndexKey" /* 8487 */;
import closure_6 from "mergeGuildAvatar" /* 1922 */;
import { DISCOVERY_COMMANDS_QUERY_LIMIT as closure_7 } from "TRUE_OPTION_NAME" /* 5251 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/app_launcher/hooks/useAppsInThisServer.tsx");
2026-07-20 16:05:17 +00:00
export default function useAppsInThisServer(context) {
context = context.context;
2026-07-23 10:11:24 +00:00
let _require;
let stateFromStores;
let commandsByActiveSection;
let memo;
let sortApplicationsViaFrecency;
2026-07-20 16:05:17 +00:00
let channel;
if ("channel" === context.type) {
channel = context.channel;
}
let guild_id;
2026-07-29 08:29:29 +00:00
if (channel != null) {
2026-07-20 16:05:17 +00:00
guild_id = channel.guild_id;
}
const tmp2Result = useGuildIndexState(guild_id, true);
2026-07-23 10:11:24 +00:00
_require = tmp2Result;
let obj = _require(memo[4]);
2026-08-24 06:08:38 +00:00
const items = [closure_6];
2026-07-23 10:11:24 +00:00
stateFromStores = obj.useStateFromStores(items, () => {
2026-07-29 08:29:29 +00:00
currentUser = currentUser.getCurrentUser();
2026-07-20 16:05:17 +00:00
let nsfwAllowed;
2026-07-29 08:29:29 +00:00
if (currentUser != null) {
2026-07-20 16:05:17 +00:00
nsfwAllowed = currentUser.nsfwAllowed;
}
return nsfwAllowed;
});
2026-08-24 06:08:38 +00:00
obj1 = commandsByActiveSection(memo[5]);
2026-07-29 08:29:29 +00:00
obj = { context, filters: null, options: null, allowFetch: true };
obj = { commandTypes: null };
2026-07-23 10:11:24 +00:00
const items1 = [_require(memo[6]).ApplicationCommandType.CHAT, _require(memo[6]).ApplicationCommandType.PRIMARY_ENTRY_POINT];
2026-07-29 08:29:29 +00:00
obj[0] = items1;
obj[1] = obj;
2026-07-23 10:11:24 +00:00
obj1 = { placeholderCount: 0, limit: closure_7, includeFrecency: true };
2026-07-29 08:29:29 +00:00
obj[2] = obj1;
2026-07-20 16:05:17 +00:00
const discovery = obj1.useDiscovery(obj);
2026-07-23 10:11:24 +00:00
commandsByActiveSection = discovery.commandsByActiveSection;
2026-07-20 16:05:17 +00:00
const items2 = [commandsByActiveSection];
2026-07-23 10:11:24 +00:00
memo = sortApplicationsViaFrecency.useMemo(() => commandsByActiveSection.reduce((add, data) => {
2026-07-20 16:05:17 +00:00
if (data.data.length > 0) {
add.add(tmp.id);
}
return add;
}, new Set()), items2);
2026-07-23 10:11:24 +00:00
let result = tmp2Result.result;
2026-07-20 16:05:17 +00:00
let sections;
2026-07-29 08:29:29 +00:00
if (result != null) {
2026-07-20 16:05:17 +00:00
sections = result.sections;
}
const items3 = [sections, memo];
2026-07-23 10:11:24 +00:00
const memo1 = sortApplicationsViaFrecency.useMemo(() => {
2026-08-24 06:08:38 +00:00
result = result.result;
2026-07-20 16:05:17 +00:00
let sections;
2026-07-29 08:29:29 +00:00
if (result != null) {
2026-07-20 16:05:17 +00:00
sections = result.sections;
}
2026-07-29 08:29:29 +00:00
if (sections == null) {
2026-07-20 16:05:17 +00:00
sections = {};
}
const values = Object.values(sections);
const mapped = values.map((descriptor) => descriptor.descriptor);
return mapped.filter((id) => {
2026-08-24 06:08:38 +00:00
let hasItem = !(id.id in closure_1_0(closure_1_3[7]).BUILT_IN_SECTIONS);
2026-07-29 08:29:29 +00:00
if (hasItem) {
hasItem = set.has(id.id);
2026-07-20 16:05:17 +00:00
}
return hasItem;
});
}, items3);
2026-07-23 10:11:24 +00:00
sortApplicationsViaFrecency = _require(memo[8]).useSortApplicationsViaFrecency(memo1);
2026-07-29 08:29:29 +00:00
const obj6 = sortApplicationsViaFrecency;
2026-07-20 16:05:17 +00:00
const tmp2 = useGuildIndexState;
2026-07-29 08:29:29 +00:00
const tmp5 = _require;
const tmp5Result = _require(memo[8]);
const tmp6 = memo;
2026-07-20 16:05:17 +00:00
const items4 = [stateFromStores, sortApplicationsViaFrecency];
return {
2026-07-23 10:11:24 +00:00
appsInThisServer: sortApplicationsViaFrecency.useMemo(() => {
2026-07-20 16:05:17 +00:00
const obj = stateFromStores(memo[9]);
const found = stateFromStores(memo[9]).compact(sortApplicationsViaFrecency.map((application) => application.application)).filter((id) => {
2026-07-29 08:29:29 +00:00
let tmp = false === closure_1;
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-08-24 06:08:38 +00:00
tmp = closure_1_1(closure_1_3[10])(id.id);
2026-07-20 16:05:17 +00:00
}
return !tmp;
});
return found.map((application) => ({ application }));
}, items4),
2026-07-29 08:29:29 +00:00
isLoading: tmp13
2026-07-20 16:05:17 +00:00
};
};