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

666 lines
34 KiB
TypeScript

/* Metro module 8060; source: modules/application_commands/ApplicationCommandQueryApi.tsx; dependencies: [57, 31, 1867, 7861, 5066, 661, 5065, 7869, 566, 7871, 1360, 1909, 7866, 8039, 5068, 2] */
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import ApplicationCommandIndexStore from './ApplicationCommandIndexStore.tsx'; /* Metro dependency 7861 */
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 ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as ServerModule from '../../flow/Server.tsx'; /* Metro dependency 1909 */
import * as ApplicationCommandConstantsModule from './ApplicationCommandConstants.tsx'; /* Metro dependency 5066 */
import * as ApplicationCommandTypesModule from './ApplicationCommandTypes.tsx'; /* Metro dependency 5068 */
import * as ApplicationCommandIndexStoreModule from './ApplicationCommandIndexStore.tsx'; /* Metro dependency 7861 */
import * as CommandPermissionContextModule from './CommandPermissionContext.tsx'; /* Metro dependency 7866 */
import * as ApplicationCommandQueryTypesModule from './ApplicationCommandQueryTypes.tsx'; /* Metro dependency 7869 */
import * as CommandPermissionUtilsModule from './CommandPermissionUtils.tsx'; /* Metro dependency 8039 */
function _fun63958(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#63958, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:6, offset: 0x01b974ce, size: 509 bytes, params: 8, frame: 21
const env0_0 = require;
const _arrayLikeToArray_63961 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const useCommandsForApplication2 = useCommandsForApplication;
const createPlaceholderCommands = function(a0, a1) {
var r3;
var items = [];
var value = 0;
if (value < a0) {
for (r3 = value; true; r3 = value) {
items.push(createPlaceholderCommand(r3, a1));
value = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
if (!(value < a0)) {
break;
}
}
}
return items;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const ApplicationCommandType = (ServerModule).ApplicationCommandType;
const CHAT = ApplicationCommandType.CHAT;
object = [CHAT];
object = {'id': 'placeholder-section', 'type': null, 'name': ''};
const ApplicationCommandSectionType = (ApplicationCommandTypesModule).ApplicationCommandSectionType;
const APPLICATION = ApplicationCommandSectionType.APPLICATION;
object.type = APPLICATION;
(FileImportTrackerModule).fileFinishedImporting('modules/application_commands/ApplicationCommandQueryApi.tsx');
exports.getCachedCommand = getCachedCommand;
exports.getCachedApplicationSection = getCachedApplicationSection;
exports.getCachedResults = getCachedResults_63974;
exports.getChangeKeys = getChangeKeys;
exports.useCachedResults = useCachedResults;
exports.useDiscovery = useDiscovery;
exports.executeQuery = executeQuery;
exports.useQuery = useQuery;
exports.useCommand = useCommand;
exports.useCommandsForApplication = useCommandsForApplication2;
exports.useAccessibleCommandsForApplication = useAccessibleCommandsForApplication;
function _createForOfIteratorHelperLoose_63959(a0, a1) { // fn#63959, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:287, offset: 0x01b976cb, size: 370 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun63960;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_63961(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_63961(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_63961(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun63960;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
function _fun63960() { // fn#63960, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:858, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function findCommandInSection(a0, a1) { // fn#63962, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:1197, offset: 0x01b9783d, size: 208 bytes, params: 3, frame: 18
var rootCommand;
var r2;
var commands;
var Object;
var values;
var value;
var value2;
var buildCommand;
var application;
const env0_0 = a1;
if (a1 != null) {
commands = a0.commands;
if (commands[a1] != null) {
return a0.commands[a1];
}
Object = global.Object;
values = Object.values;
commands = a0.commands;
value = Reflect.apply(values, Object, [commands]);
value = value.find(_fun63963);
value2 = undefined;
rootCommand = value == null ? value2 : value.rootCommand;
if (rootCommand != null) {
value = require(5065) /* metro dependency 5065: ApplicationCommandUtils */;
buildCommand = value.buildCommand;
application = a0.descriptor.application;
value = Reflect.apply(buildCommand, value, [{rootCommand: rootCommand, command: rootCommand,
applicationId: (application == null ? value2 : application.id) ?? ''}]);
r2 = value;
} else {
r2 = value2;
}
return r2;
}
function _fun63963({rootCommand}) { // fn#63963, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:1345, offset: 0x01b9790d, size: 38 bytes, params: 2, frame: 3
return rootCommand?.id === require;
}
}
function useCommandsForApplication(a0, a1, a2) { // fn#63964, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:1576, offset: 0x01b97933, size: 129 bytes, params: 4, frame: 21
const env0_0 = a1;
const env0_1 = a2;
const value2 = undefined;
const value3 = useUserIndexState(true, true);
const value4 = useContextIndexState(a0, true, true);
return ReactModule.useMemo(_fun63965, [value3 == null ? value2 : value3.result, value4 == null ? value2 : value4.result,
a1, a2]);
function _fun63965() { // fn#63965, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:1664, offset: 0x01b979b4, size: 390 bytes, params: 1, frame: 20
let result = env0_2.result;
const value2 = undefined;
const value3 = (result == null || result.sections == null ? value2 : result.sections[require]) != null;
result = Module00057.result;
const value4 = (result == null || result.sections == null ? value2 : result.sections[require]) != null;
result = env0_2.result;
let r4 = result == null || result.sections == null ? value2 : result.sections[require];
r4 = r4 ?? (Module00057.result == null ? value2 : Module00057.result.sections[require]);
const Object = global.Object;
const env0_0 = Object.values((r4 == null ? value2 : r4.commands) ?? ({})).map(_fun63966).reduce(function(a0, a1) {
a0[a1.id] = a1;
return a0;
}, {});
const object = {};
object.application = r4 == null || r4.descriptor == null ? value2 : r4.descriptor.application;
const value = importDefault.map(_fun63968);
object.commands = value.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish);
object.sectionDescriptor = r4 == null ? value2 : r4.descriptor;
object.isGuildInstalled = value4;
object.isUserInstalled = value3;
return object;
function _fun63966(a0) { // fn#63966, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:1983, offset: 0x01b97b3a, size: 89 bytes, params: 2, frame: 14
var r0;
var value2;
var moduleValue;
var buildCommand;
var object;
let value = a0;
let rootCommand = value.rootCommand;
if (rootCommand == null) {
r0 = value;
} else {
value2 = environment.__proto__.__proto__;
moduleValue = require(5065) /* metro dependency 5065: ApplicationCommandUtils */;
buildCommand = moduleValue.buildCommand;
object = {};
rootCommand = value.rootCommand;
object.rootCommand = rootCommand;
rootCommand = value.rootCommand;
object.command = rootCommand;
object.applicationId = value.applicationId;
value = Reflect.apply(buildCommand, moduleValue, [object]);
r0 = value;
}
return r0;
}
function _fun63968(a0) { // fn#63968, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:2235, offset: 0x00c3fbaf, size: 16 bytes, params: 2, frame: 2
return env0_0[a0];
}
}
}
function createPlaceholderCommand(a0, a1) { // fn#63970, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:2673, offset: 0x01b97bd9, size: 110 bytes, params: 3, frame: 13
const ApplicationCommandInputType = (ApplicationCommandTypesModule).ApplicationCommandInputType;
const PLACEHOLDER = ApplicationCommandInputType.PLACEHOLDER;
return {'type': null, 'inputType': null, 'id': null, 'untranslatedName': '', 'displayName': '',
'untranslatedDescription': '', 'displayDescription': '', 'applicationId': '', type: a1, inputType: PLACEHOLDER,
id: 'placeholder-' + a0, section: env0_14};
}
function getCachedCommand(a0, a1, a2) { // fn#63971, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:3035, offset: 0x01b97c47, size: 322 bytes, params: 4, frame: 22
var value9;
var commandInSection;
var value10;
var value11;
const env0_0 = a2;
if (a1 == null) {
return {application: undefined, command: undefined};
}
const applicationCommandIndexStoreBinding = ApplicationCommandIndexStore;
const userState = applicationCommandIndexStoreBinding.getUserState();
const contextState = applicationCommandIndexStoreBinding.getContextState(a0);
let Object = global.Object;
let values = Object.values;
let result = userState.result;
const value4 = undefined;
const value5 = Reflect.apply(values, Object, [(result == null ? value4 : result.sections) ?? ({})]);
const concat = value5.concat;
Object = global.Object;
values = Object.values;
result = contextState.result;
const value6 = Reflect.apply(concat, value5, [Reflect.apply(values, Object,
[(result == null ? value4 : result.sections) ?? ({})])]);
if (a2 != null) {
value11 = value6.find(_fun63972);
if (value11 != null) {
return {application: value11.descriptor.application, command: findCommandInSection(value11, a1)};
}
return {application: value4, command: value4};
}
const value7 = _createForOfIteratorHelperLoose_63959(value6);
const value8 = value7();
let done = value8.done;
if (done) {
return {application: value4, command: value4};
}
let r9 = value8;
loopExit11: while (true) {
value9 = r9.value;
commandInSection = findCommandInSection(value9, a1);
if (commandInSection != null) {
break loopExit11;
}
value10 = value7();
done = value10.done;
if (done) {
return {application: value4, command: value4};
}
r9 = value10;
continue;
}
return {application: value9.descriptor.application, command: commandInSection};
function _fun63972({descriptor}) { // fn#63972, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:3349, offset: 0x01b97d89, size: 43 bytes, params: 2, frame: 3
return descriptor.application?.id === importDefault;
}
}
function getCachedApplicationSection(a0, a1, a2) { // fn#63973, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:3771, offset: 0x01b97db4, size: 180 bytes, params: 4, frame: 16
const applicationCommandIndexStoreBinding = ApplicationCommandIndexStore;
let value = applicationCommandIndexStoreBinding.getUserState();
const contextState = applicationCommandIndexStoreBinding.getContextState(a0);
const applicationState = applicationCommandIndexStoreBinding.getApplicationState(a2);
const result = value.result;
value = undefined;
let r1 = result == null || result.sections == null ? value : result.sections[a2];
r1 = r1 ?? (contextState.result == null || contextState.result.sections == null ? value : contextState.result.sections[a2]);
r1 = r1 ?? (applicationState.result == null || applicationState.result.sections == null ? value : applicationState.result.sections[a2]);
return r1 == null ? value : r1.descriptor;
}
function getCachedResults_63974(a0, a1, a2) { // fn#63974, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:4139, offset: 0x01b97e68, size: 122 bytes, params: 4, frame: 17
const applicationCommandIndexStoreBinding = ApplicationCommandIndexStore;
const query = applicationCommandIndexStoreBinding.query;
const ScoreMethod = (ApplicationCommandQueryTypesModule).ScoreMethod;
const COMMAND_OR_APPLICATION = ScoreMethod.COMMAND_OR_APPLICATION;
const value = Reflect.apply(query, applicationCommandIndexStoreBinding, [a0, {commandTypes: [a1], text: a2},
{scoreMethod: COMMAND_OR_APPLICATION, allowFetch: false}]);
return {commands: value.commands, sections: value.descriptors};
}
function getChangeKeys(a0) { // fn#63975, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:4356, offset: 0x01b97ee2, size: 77 bytes, params: 2, frame: 14
const applicationCommandIndexStoreBinding = ApplicationCommandIndexStore;
const userState = applicationCommandIndexStoreBinding.getUserState();
const contextState = applicationCommandIndexStoreBinding.getContextState(a0);
const value3 = undefined;
return [userState == null ? value3 : userState.result, contextState == null ? value3 : contextState.result];
}
function useCachedResults(a0, a1, a2) { // fn#63976, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:4505, offset: 0x01b97f2f, size: 105 bytes, params: 4, frame: 16
const env0_0 = a1;
let object = [a1];
object = {commandTypes: ReactModule.useMemo(function() {
return [require];
}, object), text: a2};
const value = useQueryState(a0, object, {allowFetch: false});
return {commands: value.commands, sections: value.descriptors};
}
function useDiscovery({context, filters, options, allowFetch}) { // fn#63978, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:4684, offset: 0x01b97fa9, size: 389 bytes, params: 2, frame: 24
const type = context.type;
let value = null;
const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildStore], function() {
return GuildStore.getGuild(guild_id);
}, [type !== 'channel' ? value : context.channel.guild_id]);
object = {};
copyDataProperties(object, options, undefined);
object['allowFetch'] = allowFetch;
const value4 = useDiscoveryState(context, value3, filters, object);
const descriptors = value4.descriptors;
const descriptors2 = descriptors;
const commands = value4.commands;
const commands2 = commands;
const sectionedCommands = value4.sectionedCommands;
const loading = value4.loading;
value = commands2.useState(value);
value = descriptors2(value, 2);
const property = value[0];
const env0_8 = value[1];
return commands2.useMemo(_fun63981, [loading, commands, descriptors, sectionedCommands, property,
commands2.useMemo(function() {
var createPlaceholderCommandsBinding = createPlaceholderCommands;
var placeholderCount = options.placeholderCount;
var value2 = 0;
return createPlaceholderCommandsBinding(placeholderCount ?? value2, filters.commandTypes[value2]);
}, [filters.commandTypes, options.placeholderCount])]);
function _fun63981() { // fn#63981, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:5162, offset: 0x01b98185, size: 436 bytes, params: 1, frame: 18
var r7;
var r1;
var value3;
var section;
var property;
var object;
var data;
var items8;
var items9;
var items10;
const object3 = {};
object3.loading = loading;
object3.commands = commands;
object3.activeSections = descriptors;
object3.commandsByActiveSection = sectionedCommands;
object3.filteredSectionId = ApplicationCommandIndexStoreModule.useDiscoveryState;
object3.hasMoreAfter = false;
object3.placeholders = loading ? ApplicationCommandIndexStoreModule.useUserIndexState : [];
object3.sectionDescriptors = descriptors;
object3.filterSection = filterSection;
object3.scrollDown = NOOP;
if (ApplicationCommandIndexStoreModule.useDiscoveryState != null) {
value3 = sectionedCommands.find(_fun63983);
if (value3 != null) {
section = value3.section;
r1 = [section];
r7 = section;
} else {
r1 = [];
}
object3.activeSections = r1;
r1 = value3 != null ? [value3] : [];
object3.commandsByActiveSection = r1;
}
if (loading) {
property = sectionedCommands[0];
if (property != null) {
object = {};
object.section = property.section;
data = property.data;
items8 = [];
arraySpread(items8, ApplicationCommandIndexStoreModule.useUserIndexState, arraySpread(items8, data, 0, r7), r7);
object.data = items8;
items9 = [object];
sectionedCommandsBinding = sectionedCommands;
arraySpread(items9, sectionedCommandsBinding.slice(1), 1, r7);
object3.commandsByActiveSection = items9;
} else {
property = (require(7871) /* metro dependency 7871: ApplicationCommandBuiltIns */).BUILT_IN_SECTIONS[BuiltInSectionId.BUILT_IN];
object3.activeSections = [property];
object3.commandsByActiveSection = [{section: property, data: ApplicationCommandIndexStoreModule.useUserIndexState}];
r7 = require;
}
commandsBinding = commands;
items10 = [];
arraySpread(items10, ApplicationCommandIndexStoreModule.useUserIndexState, arraySpread(items10, commandsBinding, 0, r7), r7);
object3.commands = items10;
}
return object3;
function filterSection(a0) { // fn#63982, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:5329, offset: 0x01b98339, size: 19 bytes, params: 2, frame: 11
env1_8(a0);
}
function _fun63983({section}) { // fn#63983, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:5379, offset: 0x01b9834c, size: 27 bytes, params: 2, frame: 2
return section.id === env1_7;
}
}
}
function executeQuery(a0, a1, a2) { // fn#63984, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:5778, offset: 0x01b98367, size: 214 bytes, params: 4, frame: 20
var items2;
const {descriptors, commands, loading} = ApplicationCommandIndexStore.query(a0, a1, a2);
const createPlaceholderCommandsBinding = createPlaceholderCommands;
const value3 = 0;
let r1 = loading && a2.placeholderCount != null ? a2.placeholderCount : value3;
const placeholderCommands = createPlaceholderCommandsBinding(r1, a1.commandTypes[value3]);
const object = {};
if (loading) {
items2 = [];
arraySpread(items2, placeholderCommands, arraySpread(items2, commands, value3, placeholderCommands),
placeholderCommands);
r1 = items2;
} else {
r1 = commands;
}
object.commands = r1;
object.sections = loading ? value3 !== descriptors.length ? descriptors : [(require(7871) /* metro dependency 7871: ApplicationCommandBuiltIns */).BUILT_IN_SECTIONS[BuiltInSectionId.BUILT_IN]] : descriptors;
return object;
}
function useQuery(a0, a1, a2) { // fn#63985, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:6068, offset: 0x01b9843d, size: 178 bytes, params: 4, frame: 20
const env0_0 = a1;
const env0_1 = a2;
const object = {};
copyDataProperties(object, a2, undefined);
object['allowFetch'] = true;
const {descriptors, commands, loading} = useQueryState(a0, a1, object);
const loading2 = loading;
return loading2.useMemo(_fun63987, [loading, commands, descriptors, loading2.useMemo(function() {
var createPlaceholderCommandsBinding = createPlaceholderCommands;
var placeholderCount = importDefault.placeholderCount;
var value2 = 0;
return createPlaceholderCommandsBinding(placeholderCount ?? value2, require.commandTypes[value2]);
}, [a1.commandTypes, a2.placeholderCount])]);
function _fun63987() { // fn#63987, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:6334, offset: 0x01b984ef, size: 159 bytes, params: 1, frame: 16
var r2;
var items2;
const object = {};
const loadingBinding = loading;
const commandsBinding = commands;
if (loadingBinding) {
items2 = [];
arraySpread(items2, env0_5, arraySpread(items2, commandsBinding, 0, commandsBinding), commandsBinding);
r2 = items2;
} else {
r2 = commandsBinding;
}
object.commands = r2;
object.sections = loading && descriptors.length === 0 ? [(require(7871) /* metro dependency 7871: ApplicationCommandBuiltIns */).BUILT_IN_SECTIONS[BuiltInSectionId.BUILT_IN]] : descriptors;
object.scrollDown = NOOP;
return object;
}
}
function useCommand(a0, a1) { // fn#63988, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:6475, offset: 0x01b9858e, size: 98 bytes, params: 3, frame: 18
const env0_0 = a1;
return ReactModule.useMemo(_fun63989, [useContextIndexState(a0, true, true).result, useUserIndexState(true, true).result,
a1]);
function _fun63989() { // fn#63989, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:6546, offset: 0x01b985f0, size: 230 bytes, params: 1, frame: 19
var value7;
var commands;
var property;
var value8;
if (require == null) {
return {command: undefined, application: undefined};
}
const _createForOfIteratorHelperLoose_63959Binding = _createForOfIteratorHelperLoose_63959;
let Object = global.Object;
let values = Object.values;
let result = env0_1.result;
const value3 = undefined;
const value4 = Reflect.apply(values, Object, [(result == null ? value3 : result.sections) ?? ({})]);
const concat = value4.concat;
Object = global.Object;
values = Object.values;
result = env0_2.result;
const value5 = _createForOfIteratorHelperLoose_63959Binding(Reflect.apply(concat, value4, [Reflect.apply(values,
Object, [(result == null ? value3 : result.sections) ?? ({})])]));
const value6 = value5();
let done = value6.done;
if (done) {
return {command: undefined, application: undefined};
}
let r3 = value6;
loopExit10: while (true) {
value7 = r3.value;
commands = value7.commands;
property = commands[require];
if (property != null) {
break loopExit10;
}
value8 = value5();
done = value8.done;
if (done) {
return {command: undefined, application: undefined};
}
r3 = value8;
continue;
}
return {command: property, application: value7.descriptor.application};
}
}
function useAccessibleCommandsForApplication(a0, a1, a2) { // fn#63990, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:7031, offset: 0x01b986d6, size: 205 bytes, params: 4, frame: 22
const env0_0 = a0;
let binding = isUserInstalled2;
let useMemo = binding.useMemo;
const {commands, application, sectionDescriptor, isGuildInstalled,
isUserInstalled} = useCommandsForApplication(Reflect.apply(useMemo, binding, [_fun63991, [a0]]), a1, a2);
var isUserInstalled2 = isUserInstalled;
const value4 = (CommandPermissionContextModule).usePermissionContext(a0,
env0_13);
binding = isUserInstalled2;
useMemo = binding.useMemo;
return {application: application, commands: Reflect.apply(useMemo, binding, [_fun63992, [commands, value4,
sectionDescriptor, isGuildInstalled, isUserInstalled, a0]])};
function _fun63991() { // fn#63991, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:7126, offset: 0x01b987a3, size: 23 bytes, params: 1, frame: 2
return {channel: env0_0, type: 'channel'};
}
function _fun63992() { // fn#63992, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:7341, offset: 0x01b987ba, size: 283 bytes, params: 1, frame: 23
var environment;
var permissions;
var r2;
var guild_id;
var value4;
var moduleValue;
var computeAllowedForUser;
var binding;
var value6;
var moduleValue2;
var computeAllowedForChannel;
var allowedForChannel;
const commandsBinding = commands;
const value2 = null;
if (value2 != commandsBinding) {
guild_id = env0_0.guild_id;
if (value2 != guild_id) {
permissions = value2 == sectionDescriptor ? undefined : sectionDescriptor.permissions;
if (value2 != permissions) {
value4 = environment.__proto__;
moduleValue = importAll(8039) /* metro dependency 8039: CommandPermissionUtils */;
computeAllowedForUser = moduleValue.computeAllowedForUser;
permissions = sectionDescriptor.permissions;
guild_id = env0_0.guild_id;
binding = env0_5;
r2 = Reflect.apply(computeAllowedForUser, moduleValue, [permissions, guild_id, binding.userId,
binding.roleIds,
binding.isImpersonating]);
} else {
r2 = value2;
}
} else {
r2 = value2;
}
var env0_0 = r2;
guild_id = env0_0.guild_id;
if (value2 != guild_id) {
permissions = value2 == sectionDescriptor ? undefined : sectionDescriptor.permissions;
if (value2 != permissions) {
value6 = environment.__proto__;
moduleValue2 = importAll(8039) /* metro dependency 8039: CommandPermissionUtils */;
computeAllowedForChannel = moduleValue2.computeAllowedForChannel;
permissions = sectionDescriptor.permissions;
binding = env0_0;
allowedForChannel = Reflect.apply(computeAllowedForChannel, moduleValue2, [permissions, binding,
binding.guild_id]);
}
}
return commands.filter(_fun63993);
}
function _fun63993(a0) { // fn#63993, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8238:7661, offset: 0x01b988d5, size: 154 bytes, params: 2, frame: 20
const value2 = undefined;
const hasAccess2 = CommandPermissionUtilsModule.hasAccess(a0, env1_5, {applicationAllowedForUser: env0_0,
applicationAllowedForChannel: env0_1, isGuildInstalled: isGuildInstalled, isUserInstalled: isUserInstalled,
commandBotId: sectionDescriptor == null ? value2 : sectionDescriptor.botId});
const HasAccessResult = (CommandPermissionUtilsModule).HasAccessResult;
const ALLOWED = HasAccessResult.ALLOWED;
return hasAccess2 === ALLOWED;
}
}
}
}
global.__d(_fun63958, 8060, [57, 31, 1867, 7861, 5066, 661, 5065, 7869, 566, 7871, 1360, 1909, 7866, 8039, 5068,
2]) /* metro module 8060, dependencies: [57, 31, 1867, 7861, 5066, 661, 5065, 7869, 566, 7871, 1360, 1909, 7866, 8039, 5068, 2] */;