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

106 lines
3.5 KiB
TypeScript
Raw Normal View History

2026-07-23 10:11:24 +00:00
// Module ID: 11242
// Function ID: 87512
2026-07-20 16:05:17 +00:00
// Name: useAppsInThisServer
2026-07-23 10:11:24 +00:00
// Dependencies: [31, 7920, 1849, 4566, 566, 8189, 1881, 7930, 11241, 22, 8177, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-23 10:11:24 +00:00
// Module 11242 (useAppsInThisServer)
import result from "result";
import { useGuildIndexState } from "_isNativeReflectConstruct";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import { DISCOVERY_COMMANDS_QUERY_LIMIT as closure_7 } from "TRUE_OPTION_NAME";
const require = arg1;
let result = require("_isNativeReflectConstruct").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;
if (null != channel) {
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]);
const items = [_isNativeReflectConstruct];
stateFromStores = obj.useStateFromStores(items, () => {
const currentUser = outer1_6.getCurrentUser();
2026-07-20 16:05:17 +00:00
let nsfwAllowed;
if (null != currentUser) {
nsfwAllowed = currentUser.nsfwAllowed;
}
return nsfwAllowed;
});
2026-07-23 10:11:24 +00:00
let obj1 = commandsByActiveSection(memo[5]);
2026-07-20 16:05:17 +00:00
obj = { context };
obj = {};
2026-07-23 10:11:24 +00:00
const items1 = [_require(memo[6]).ApplicationCommandType.CHAT, _require(memo[6]).ApplicationCommandType.PRIMARY_ENTRY_POINT];
2026-07-20 16:05:17 +00:00
obj.commandTypes = items1;
obj.filters = obj;
2026-07-23 10:11:24 +00:00
obj1 = { placeholderCount: 0, limit: closure_7, includeFrecency: true };
2026-07-20 16:05:17 +00:00
obj.options = obj1;
obj.allowFetch = true;
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;
if (null != result) {
sections = result.sections;
}
const items3 = [sections, memo];
2026-07-23 10:11:24 +00:00
const memo1 = sortApplicationsViaFrecency.useMemo(() => {
const result = _undefined.result;
2026-07-20 16:05:17 +00:00
let sections;
if (null != result) {
sections = result.sections;
}
if (null == sections) {
sections = {};
}
const values = Object.values(sections);
const mapped = values.map((descriptor) => descriptor.descriptor);
return mapped.filter((id) => {
2026-07-23 10:11:24 +00:00
const tmp = id.id in callback(memo[7]).BUILT_IN_SECTIONS;
2026-07-20 16:05:17 +00:00
let hasItem = !tmp;
if (!tmp) {
2026-07-23 10:11:24 +00:00
hasItem = outer1_3.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);
const obj6 = _require(memo[8]);
2026-07-20 16:05:17 +00:00
const tmp2 = useGuildIndexState;
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-23 10:11:24 +00:00
let tmp = false === outer1_1;
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-07-23 10:11:24 +00:00
tmp = stateFromStores(memo[10])(id.id);
2026-07-20 16:05:17 +00:00
}
return !tmp;
});
return found.map((application) => ({ application }));
}, items4),
isLoading: tmp12
};
};