Files
2026-07-28 01:06:53 +03:00

123 lines
7.4 KiB
TypeScript

/* Metro module 11664; source: modules/app_launcher/hooks/useAppsInThisServer.tsx; dependencies: [31, 7861, 1878, 5066, 566, 8060, 1909, 7871, 11663, 22, 8040, 2] */
import Module00022 from '../../../by-id/module-00022.js'; /* Metro dependency 22 */
import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ServerModule from '../../../flow/Server.tsx'; /* Metro dependency 1909 */
import * as ApplicationCommandConstantsModule from '../../application_commands/ApplicationCommandConstants.tsx'; /* Metro dependency 5066 */
import * as ApplicationCommandIndexStoreModule from '../../application_commands/ApplicationCommandIndexStore.tsx'; /* Metro dependency 7861 */
import * as ApplicationCommandBuiltInsModule from '../../application_commands/ApplicationCommandBuiltIns.tsx'; /* Metro dependency 7871 */
import * as ApplicationCommandQueryApiModule from '../../application_commands/ApplicationCommandQueryApi.tsx'; /* Metro dependency 8060 */
function _fun89428(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#89428, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:6, offset: 0x0200d1dd, size: 185 bytes, params: 8, frame: 20
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/app_launcher/hooks/useAppsInThisServer.tsx');
exports.default = useAppsInThisServer;
function useAppsInThisServer({context}) { // fn#89429, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:281, offset: 0x0200d296, size: 478 bytes, params: 2, frame: 25
let value = undefined;
const env0_4 = value;
const channel = context.type !== 'channel' ? value : context.channel;
const value3 = useGuildIndexState(channel == null ? value : channel.guild_id, true);
const value4 = (FluxModule).useStateFromStores([UserStore], _fun89430);
const useDiscovery = ApplicationCommandQueryApiModule.useDiscovery;
object = {context: context};
const {CHAT, PRIMARY_ENTRY_POINT} = (ServerModule).ApplicationCommandType;
object.filters = {commandTypes: [CHAT, PRIMARY_ENTRY_POINT]};
object.options = {'placeholderCount': 0, 'limit': null, 'includeFrecency': true,
limit: DISCOVERY_COMMANDS_QUERY_LIMIT};
object.allowFetch = true;
const {commandsByActiveSection, loading} = Reflect.apply(useDiscovery, ApplicationCommandQueryApiModule, [object]);
let binding = env0_4;
let useMemo = binding.useMemo;
const value6 = Reflect.apply(useMemo, binding, [_fun89431, [commandsByActiveSection]]);
useMemo = binding.useMemo;
const result = value3.result;
const value7 = Reflect.apply(useMemo, binding, [_fun89433, [result == null ? value : result.sections, value6]]);
value = require(11663) /* metro dependency 11663: ApplicationFrecencyHooks */;
value = value.useSortApplicationsViaFrecency(value7);
binding = value;
useMemo = binding.useMemo;
return {appsInThisServer: Reflect.apply(useMemo, binding, [_fun89436, [value4, value]]),
isLoading: value3.fetchState.fetching || loading};
function _fun89430() { // fn#89430, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:435, offset: 0x0200d474, size: 35 bytes, params: 1, frame: 10
const value = environment.__proto__;
return UserStore.getCurrentUser()?.nsfwAllowed;
}
function _fun89431() { // fn#89431, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:777, offset: 0x0200d497, size: 58 bytes, params: 1, frame: 13
const commandsByActiveSectionBinding = commandsByActiveSection;
const reduce = commandsByActiveSectionBinding.reduce;
const Set = global.Set;
return Reflect.apply(reduce, commandsByActiveSectionBinding, [function(a0, a1) {
if (a1.data.length > 0) {
a0.add(a1.section.id);
}
return a0;
}, new Set()]);
}
function _fun89433() { // fn#89433, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:872, offset: 0x0200d4fe, size: 92 bytes, params: 1, frame: 15
const Object = global.Object;
let value = Object.values(env0_0.result?.sections ?? ({}));
value = value.map(function(a0) {
return a0.descriptor;
});
return value.filter(_fun89435);
function _fun89435(a0) { // fn#89435, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:994, offset: 0x0200d565, size: 73 bytes, params: 2, frame: 13
var r0;
var binding;
const id = a0.id;
let value = environment.__proto__.__proto__;
const BUILT_IN_SECTIONS = (ApplicationCommandBuiltInsModule).BUILT_IN_SECTIONS;
if (value) {
r0 = !(id in BUILT_IN_SECTIONS);
} else {
value = environment.__proto__;
binding = env1_3;
value = binding.has(a0.id);
r0 = value;
}
return r0;
}
}
function _fun89436() { // fn#89436, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:1172, offset: 0x0200d5ae, size: 98 bytes, params: 1, frame: 14
var environment;
let value = environment.__proto__;
const compact = (Module00022).compact;
const binding = env0_4;
value = Reflect.apply(compact, value, [binding.map(function(a0) {
return a0.application;
})]);
value = value.filter(_fun89438);
return value.map(function(a0) {
return {application: a0};
});
function _fun89438(a0) { // fn#89438, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:1231, offset: 0x0200d610, size: 59 bytes, params: 2, frame: 12
var r0;
let value = environment.__proto__;
value = env1_1 === false;
if (value) {
value = environment.__proto__.__proto__;
value = importDefault(8040) /* metro dependency 8040: isApplicationAgeRestricted */;
value = value(a0.id);
r0 = value;
} else {
r0 = value;
}
return !r0;
}
}
}
}
global.__d(_fun89428, 11664, [31, 7861, 1878, 5066, 566, 8060, 1909, 7871, 11663, 22, 8040,
2]) /* metro module 11664, dependencies: [31, 7861, 1878, 5066, 566, 8060, 1909, 7871, 11663, 22, 8040, 2] */;