Files
discord-decomp/sources/modules/application_commands/ApplicationCommandIndexStore.tsx
T
2026-07-28 01:06:53 +03:00

3118 lines
144 KiB
TypeScript

/* Metro module 7861; source: modules/application_commands/ApplicationCommandIndexStore.tsx; dependencies: [57, 6, 7, 15, 17, 18, 5, 31, 7862, 1949, 1226, 1379, 1945, 1867, 1878, 7863, 5066, 661, 3, 7864, 7865, 5065, 5067, 6593, 44, 7866, 683, 1909, 7869, 566, 694, 7870, 7871, 1362, 8039, 5068, 2] */
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import GuildMemberStore from '../../stores/GuildMemberStore.tsx'; /* Metro dependency 1945 */
import LocaleStore from '../user_settings/LocaleStore.tsx'; /* Metro dependency 1949 */
import ApplicationFrecencyStore from '../applications/ApplicationFrecencyStore.tsx'; /* Metro dependency 7862 */
import ApplicationCommandFrecencyStore from './ApplicationCommandFrecencyStore.tsx'; /* Metro dependency 7863 */
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 UserSettingsProtoActionCreatorsModule from '../user_settings/UserSettingsProtoActionCreators.tsx'; /* Metro dependency 1362 */
import * as ApplicationCommandConstantsModule from './ApplicationCommandConstants.tsx'; /* Metro dependency 5066 */
import * as ApplicationCommandTypesModule from './ApplicationCommandTypes.tsx'; /* Metro dependency 5068 */
import * as CommandPermissionContextModule from './CommandPermissionContext.tsx'; /* Metro dependency 7866 */
import * as ApplicationCommandQueryTypesModule from './ApplicationCommandQueryTypes.tsx'; /* Metro dependency 7869 */
import * as ApplicationCommandFrecencyHooksModule from './ApplicationCommandFrecencyHooks.tsx'; /* Metro dependency 7870 */
import * as ApplicationCommandBuiltInsModule from './ApplicationCommandBuiltIns.tsx'; /* Metro dependency 7871 */
function _fun62801(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#62801, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:6, offset: 0x01b67ca6, size: 1417 bytes, params: 8, frame: 42
const env0_0 = require;
const _arrayLikeToArray_62807 = 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 LOGOUT_628112 = LOGOUT_62811;
const updateIndexAndFetchApplicationCommandIndex = function() {
return _updateIndexAndFetchApplicationCommandIndex.apply(this, arguments);
};
const APPLICATION_COMMAND_INDEX_FETCH_SUCCESS2 = APPLICATION_COMMAND_INDEX_FETCH_SUCCESS;
const USER_APPLICATION_UPDATE2 = USER_APPLICATION_UPDATE;
const useContextIndexState2 = useContextIndexState;
const useUserIndexState2 = useUserIndexState;
const useQueryState2 = useQueryState;
const closure7 = function(a0) {
return a0.result?.version !== a0.serverVersion;
};
const toApplication = function(a0) {
return {description: a0.description, icon: a0.icon, id: a0.id, name: a0.name, bot: a0.bot, flags: a0.flags};
};
const toServerChoice = function(a0) {
var r3;
var object = {};
copyDataProperties(object, a0, r3);
object['name'] = a0.name_default ?? a0.name;
if (a0.name !== a0.name_default) {
object.name_localized = a0.name;
}
return object;
};
let Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ApplicationCommandConstantsModule;
const env0_20 = value.BuiltInSectionId;
const env0_21 = value.DISCOVERY_COMMANDS_FRECENCY_LIMIT;
value = require(661) /* metro dependency 661: Constants */;
const env0_22 = value.AnalyticEvents;
const env0_23 = value.ChannelTypes;
value = importDefault(3) /* metro dependency 3: Logger */;
value = new value('ApplicationCommandIndexStore');
let Symbol = global.Symbol;
const env0_25 = Symbol('currentUser');
Symbol = global.Symbol;
value = Symbol('stale');
Symbol = global.Symbol;
let value3 = Symbol('current');
Object = global.Object;
const env0_28 = Object.freeze({descriptors: [], commands: [], sectionedCommands: [], loading: true});
Object = global.Object;
const env0_29 = Object.freeze({serverVersion: value3, fetchState: {fetching: false}, result: {sections: {},
sectionIdsByBotId: {}, version: value3}});
Object = global.Object;
const env0_30 = Object.freeze({serverVersion: value, fetchState: {fetching: false}});
const env0_31 = {'sensitivity': 'accent', 'numeric': true};
const env0_33 = [];
const Store = (Flux).Store;
_fun62856(Store).displayName = 'ApplicationCommandIndexStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {LOGOUT: LOGOUT_628112,
CONNECTION_OPEN: CONNECTION_OPEN_62870,
APPLICATION_COMMAND_INDEX_FETCH_REQUEST: APPLICATION_COMMAND_INDEX_FETCH_REQUEST,
APPLICATION_COMMAND_INDEX_FETCH_SUCCESS: APPLICATION_COMMAND_INDEX_FETCH_SUCCESS2,
APPLICATION_COMMAND_INDEX_FETCH_FAILURE: APPLICATION_COMMAND_INDEX_FETCH_FAILURE,
APPLICATION_COMMAND_EXECUTE_BAD_VERSION: APPLICATION_COMMAND_EXECUTE_BAD_VERSION,
CHANNEL_DELETE: function({channel}) {
deleteIndex({type: 'channel', channelId: channel.id});
}, GUILD_DELETE: function({guild}) {
deleteIndex({type: 'guild', guildId: guild.id});
}, USER_APPLICATION_UPDATE: USER_APPLICATION_UPDATE2, USER_APPLICATION_REMOVE: USER_APPLICATION_UPDATE2,
GUILD_APPLICATION_COMMAND_INDEX_UPDATE: GUILD_APPLICATION_COMMAND_INDEX_UPDATE,
GUILD_MEMBERS_CHUNK_BATCH: function({chunks}) {
var r2;
var r3;
var r7;
var r0;
var updateGuildBotMembersBinding;
var guildId;
var value5;
var value6;
var value2 = _createForOfIteratorHelperLoose_62805(chunks);
var value3 = value2();
var value4 = false;
if (value3.done) {
r0 = value4;
} else {
r2 = value4;
r3 = value3;
while (true) {
chunks = r3.value;
updateGuildBotMembersBinding = updateGuildBotMembers;
guildId = chunks.guildId;
value5 = updateGuildBotMembersBinding(guildId, chunks.members);
r7 = value5 || r2;
value6 = value2();
if (value6.done) {
r0 = r7;
break;
}
r2 = r7;
r3 = value6;
continue;
}
}
return r0;
}});
Object = global.Object;
const env0_35 = Object.freeze({applications: {'useFrecency': false, 'useScore': false},
commands: {'useFrecency': true, 'useScore': true}});
object = {COMMAND_NAME_STARTS_WITH: 0};
object[0] = 'COMMAND_NAME_STARTS_WITH';
object.STARTS_WITH_COMMAND_NAME = 1;
object[1] = 'STARTS_WITH_COMMAND_NAME';
object.COMMAND_NAME_CONTAINS = 2;
object[2] = 'COMMAND_NAME_CONTAINS';
object.STARTS_WITH_COMMAND_OPTION_NAME_OR_OPTION_NAME = 3;
object[3] = 'STARTS_WITH_COMMAND_OPTION_NAME_OR_OPTION_NAME';
object.OPTION_NAME_CONTAINS = 4;
object[4] = 'OPTION_NAME_CONTAINS';
object.SECTION_NAME_STARTS_WITH = 5;
object[5] = 'SECTION_NAME_STARTS_WITH';
object.SECTION_NAME_CONTAINS = 6;
object[6] = 'SECTION_NAME_CONTAINS';
object.COMMAND_DESCRIPTION_CONTAINS = 7;
object[7] = 'COMMAND_DESCRIPTION_CONTAINS';
object.SECTION_DESCRIPTION_CONTAINS = 8;
object[8] = 'SECTION_DESCRIPTION_CONTAINS';
(FileImportTrackerModule).fileFinishedImporting('modules/application_commands/ApplicationCommandIndexStore.tsx');
exports.default = value;
exports.getOrFetchApplicationCommandIndexForTarget = function() {
return _getOrFetchApplicationCommandIndexForTarget.apply(this, arguments);
};
exports.useContextIndexState = useContextIndexState2;
exports.useGuildIndexState = useGuildIndexState;
exports.useUserIndexState = useUserIndexState2;
exports.useDiscoveryState = useDiscoveryState;
exports.useQueryState = useQueryState2;
exports.isStale = closure7;
exports.appLauncherOnlyCompareNames = function(a0, a1) {
return compareNames(a0, a1);
};
exports.getSection = getSection;
function _isNativeReflectConstruct_62802() { // fn#62802, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:386, offset: 0x01b6822f, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_62802_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_62805(a0, a1) { // fn#62805, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:579, offset: 0x01b6828d, 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 _fun62806;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_62807(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_62807(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_62807(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun62806;
}
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 _fun62806() { // fn#62806, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:1150, 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 getIndexKey(a0) { // fn#62808, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:1899, offset: 0x01b683ff, size: 74 bytes, params: 2, frame: 3
const type = a0.type;
if (type === 'guild') {
return a0.guildId;
}
if (type === 'channel') {
return a0.channelId;
}
if (type === 'user') {
return env0_25;
}
if (type === 'application') {
return a0.applicationId;
}
}
function updateIndex(a0, a1) { // fn#62809, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:2062, offset: 0x01b68449, size: 244 bytes, params: 3, frame: 19
var r4;
var object;
var binding;
const value = a2;
const value2 = undefined;
const r6 = value !== value2 ? value : false;
const indexKey = getIndexKey(a0);
const property = env0_34.indices[indexKey];
if (property != null) {
if ('fetchState' in a1 && property.fetchState.fetching) {
property.fetchState.abort.abort();
}
object = {};
copyDataProperties(object, property, undefined);
copyDataProperties(object, a1, undefined);
r4 = object;
} else if (r6) {
object = {serverVersion: env0_26};
object.fetchState = {fetching: false};
copyDataProperties(object, a1, false);
r4 = object;
} else {
r4 = value2;
}
if (value2 !== r4) {
env0_34.indices[indexKey] = r4;
if (a0.type === 'application') {
env0_34.applicationIndices.set(indexKey, r4);
binding = env0_34;
binding.applicationIndicesVersion = binding.applicationIndicesVersion + 1;
}
}
return property;
}
function deleteIndex(a0) { // fn#62810, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:2430, offset: 0x01b6853d, size: 93 bytes, params: 2, frame: 14
const indexKey = getIndexKey(a0);
const property = env0_34.indices[indexKey];
if (property != null && property.fetchState.fetching) {
property.fetchState.abort.abort();
}
delete env0_34.indices[indexKey];
}
function LOGOUT_62811() { // fn#62811, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:2569, offset: 0x01b6859a, size: 114 bytes, params: 1, frame: 13
var r2;
var property;
var fetchState;
var fetching;
var abort;
var value4;
const Object = global.Object;
const value2 = Object.values(env0_34.indices);
let length = value2.length;
const value3 = 0;
if (value3 < length) {
r2 = value3;
while (true) {
property = value2[r2];
fetchState = property.fetchState;
fetching = fetchState.fetching;
if (fetching) {
fetchState = property.fetchState;
abort = fetchState.abort;
abort.abort();
}
value4 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
length = value2.length;
if (value4 < length) {
r2 = value4;
continue;
}
break;
}
}
env0_34.indices = {};
}
function _getOrFetchApplicationCommandIndexForTarget() { // fn#62812, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:2721, offset: 0x01b6860c, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun62814).apply(this, arguments);
function* _fun62814(a0) { // fn#62814, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:2830, offset: 0x01b68645, size: 181 bytes, params: 2, frame: 17
if (false) {
return undefined;
}
value = environment.__proto__.__proto__;
const value3 = env2_40(a0);
const r1 = env2_34.indices[value3] ?? env2_30;
if (env2_55(r1)) {
yield env2_45(a0);
if (false) {
return undefined;
}
return env2_34.indices[value3] ?? env2_30;
}
if (r1.fetchState.fetching) {
yield r1.fetchState.promise;
if (false) {
return undefined;
}
return env2_34.indices[value3] ?? env2_30;
}
return r1;
}
}
function _updateIndexAndFetchApplicationCommandIndex() { // fn#62816, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:3262, offset: 0x01b686fa, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun62818).apply(this, arguments);
function* _fun62818(a0) { // fn#62818, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:3371, offset: 0x01b68733, size: 210 bytes, params: 2, frame: 22
if (true) {
var AbortController = global.AbortController;
var abortController = new AbortController();
var binding = env2_0;
var binding2 = env2_3;
var Future = binding(binding2[19]).Future;
var future = new Future();
env2_41(a0, {fetchState: {fetching: true, abort: abortController, promise: future.promise}}, true);
abortController = binding(binding2[20]).fetchApplicationCommandIndex(a0, abortController);
abortController = abortController.then(future.resolve);
yield abortController.catch(future.reject);
}
}
}
function APPLICATION_COMMAND_INDEX_FETCH_SUCCESS(a0) { // fn#62819, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:3613, offset: 0x01b68805, size: 775 bytes, params: 2, frame: 39
var r28;
var r6;
var id;
var r13;
var r24;
var r9;
var value8;
var bot;
var bot_id;
var id2;
var id3;
var id4;
var getUser;
var value9;
var add;
var object;
var moduleValue;
var getApplicationCommandSection;
var permissions;
var moduleValue2;
var keyPermissions;
var toServerPermissionsBinding;
var value10;
var id5;
var value11;
var size;
var value13;
var defaultImport;
var requestMembersById;
var guildId;
var items2;
var value17;
var applicationId;
var property;
var binding;
var error;
var commands;
var value18;
var push;
let value = a1;
const value2 = undefined;
reducibleJoin2: while (true) {
if (value !== value2) {
r6 = value;
break reducibleJoin2;
}
value = false;
r6 = value;
break reducibleJoin2;
}
const target = a0.target;
const index = a0.index;
const currentUser = UserStore.getCurrentUser();
reducibleJoin4: while (true) {
if (currentUser == null) {
id = value2;
break reducibleJoin4;
}
id = currentUser.id;
break reducibleJoin4;
}
if (id == null) {
reducibleJoin30: while (true) {
if (env0_32) {
break reducibleJoin30;
}
binding = env0_33;
push = binding.push;
Reflect.apply(push, binding, [a0]);
break reducibleJoin30;
}
return false;
}
const object2 = {};
const object4 = {};
const Set = global.Set;
const set = new Set();
const value6 = _createForOfIteratorHelperLoose_62805(index.applications);
const value7 = value6();
let done = value7.done;
if (!done) {
r13 = value7;
reducibleLoop6: while (true) {
value8 = r13.value;
bot = value8.bot;
reducibleJoin13: while (true) {
reducibleJoin8: while (true) {
if (bot != null) {
break reducibleJoin8;
}
bot_id = value8.bot_id;
if (bot_id != null) {
bot_id = value8.bot_id;
id4 = value8.id;
object4[bot_id] = id4;
userStoreBinding = UserStore;
getUser = userStoreBinding.getUser;
bot_id = value8.bot_id;
value9 = Reflect.apply(getUser, userStoreBinding, [bot_id]);
if (value9 != null) {
value8.bot = value9;
break reducibleJoin13;
}
add = set.add;
bot_id = value8.bot_id;
Reflect.apply(add, set, [bot_id]);
break reducibleJoin13;
}
break reducibleJoin8;
}
bot = value8.bot;
if (bot == null) {
break reducibleJoin13;
}
bot = value8.bot;
id2 = bot.id;
id3 = value8.id;
object4[id2] = id3;
break reducibleJoin13;
}
object = {};
moduleValue = require(5065) /* metro dependency 5065: ApplicationCommandUtils */;
getApplicationCommandSection = moduleValue.getApplicationCommandSection;
copyDataProperties(object, Reflect.apply(getApplicationCommandSection, moduleValue, [toApplication(value8),
false]),
undefined);
permissions = value8.permissions;
reducibleJoin15: while (true) {
if (permissions != null) {
moduleValue2 = require(5067) /* metro dependency 5067: IntegrationPermissionUtils */;
keyPermissions = moduleValue2.keyPermissions;
toServerPermissionsBinding = toServerPermissions;
permissions = value8.permissions;
value10 = Reflect.apply(keyPermissions, moduleValue2, [toServerPermissionsBinding(permissions,
id)]);
r24 = value10;
r28 = toServerPermissionsBinding;
break reducibleJoin15;
}
r24 = value2;
break reducibleJoin15;
}
object['permissions'] = r24;
bot_id = value8.bot_id;
object['botId'] = bot_id;
id5 = value8.id;
object2[id5] = {descriptor: object, commands: {}};
value11 = value6();
done = value11.done;
if (done) {
break reducibleLoop6;
}
r13 = value11;
continue reducibleLoop6;
}
}
const value12 = target.type === 'guild';
reducibleJoin18: while (true) {
if (value12) {
size = set.size;
value13 = size > 0;
r9 = value13;
break reducibleJoin18;
}
r9 = value12;
break reducibleJoin18;
}
reducibleJoin20: while (true) {
if (r9) {
defaultImport = importDefault(6593) /* metro dependency 6593: GuildActionCreators */;
requestMembersById = defaultImport.requestMembersById;
guildId = target.guildId;
items2 = [];
arraySpread(items2, set, 0, r28);
Reflect.apply(requestMembersById, defaultImport, [guildId, items2]);
break reducibleJoin20;
}
break reducibleJoin20;
}
_createForOfIteratorHelperLoose_62805Binding = _createForOfIteratorHelperLoose_62805;
const applicationCommandUtilsModule = require(5065) /* metro dependency 5065: ApplicationCommandUtils */;
const value15 = _createForOfIteratorHelperLoose_62805Binding(applicationCommandUtilsModule.buildApplicationCommands(index.application_commands.map(_fun62820),
true));
const value16 = value15();
done = value16.done;
if (!done) {
r9 = value16;
reducibleLoop21: while (true) {
value17 = r9.value;
applicationId = value17.applicationId;
property = object2[applicationId];
if (property != null) {
commands = property.commands;
id = value17.id;
commands[id] = value17;
} else {
binding = env0_24;
error = binding.error;
Reflect.apply(error, binding, ['Command has no matching application']);
}
value18 = value15();
done = value18.done;
if (done) {
break reducibleLoop21;
}
r9 = value18;
continue reducibleLoop21;
}
}
const version = index.version;
reducibleJoin27: while (true) {
if (version != null) {
r9 = version;
break reducibleJoin27;
}
binding = env0_27;
r9 = binding;
break reducibleJoin27;
}
updateIndex(target, {serverVersion: r9, result: {sections: object2, sectionIdsByBotId: object4, version: r9},
fetchState: {fetching: false}}, r6);
return value2;
function _fun62820(a0) { // fn#62820, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:4413, offset: 0x01b68b0c, size: 248 bytes, params: 2, frame: 18
const idBinding = id;
const object = {};
copyDataProperties(object, a0, undefined);
let r4 = a0.description_default ?? a0.description ?? '';
object['description'] = r4;
object['dm_permission'] = a0.dm_permission;
object['name'] = a0.name_default ?? a0.name;
const options = a0.options;
const value = undefined;
r4 = options == null ? value : options.map(toServerOption);
r4 = r4 ?? [];
object['options'] = r4;
object['permissions'] = a0.permissions != null ? toServerPermissions(a0.permissions, idBinding) : value;
if (a0.description !== a0.description_default) {
object.description_localized = a0.description;
}
if (a0.name !== a0.name_default) {
object.name_localized = a0.name;
}
return object;
}
}
function updateGuildBotMembers(a0, a1) { // fn#62821, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:5178, offset: 0x01b68c04, size: 104 bytes, params: 3, frame: 14
const getIndexKeyBinding = getIndexKey;
const value2 = undefined;
const property = env0_34.indices[getIndexKeyBinding({type: 'guild', guildId: a0})];
if ((property == null ? value2 : property.result) == null) {
return false;
}
const env0_1 = false;
a1.forEach(_fun62822);
return env0_1;
function _fun62822({user, nick}) { // fn#62822, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:5348, offset: 0x01b68c6c, size: 249 bytes, params: 2, frame: 23
var property;
var value2;
var defaultImport2;
var descriptor;
var application;
var moduleValue;
var getApplicationCommandSection;
var object;
var value3;
if (user.bot) {
property = result.sectionIdsByBotId[user.id];
if (property != null) {
property = result.sections[property];
value2 = environment.__proto__;
(importDefault(44) /* metro dependency 44 */)(property != null, 'Bot has no matching index section');
defaultImport2 = importDefault(44) /* metro dependency 44 */;
descriptor = property.descriptor;
application = descriptor.application;
defaultImport2(application != null, "Bot's index section has no application info");
moduleValue = require(5065) /* metro dependency 5065: ApplicationCommandUtils */;
getApplicationCommandSection = moduleValue.getApplicationCommandSection;
object = {};
descriptor = property.descriptor;
application = descriptor.application;
copyDataProperties(object, application, undefined);
object['bot'] = user;
value3 = Reflect.apply(getApplicationCommandSection, moduleValue, [object, false, nick]);
object = {};
descriptor = property.descriptor;
copyDataProperties(object, descriptor, undefined);
copyDataProperties(object, value3, undefined);
property.descriptor = object;
}
}
}
}
function USER_APPLICATION_REMOVE() { // fn#62823, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:5718, offset: 0x01b68d65, size: 38 bytes, params: 1, frame: 13
updateIndex({type: 'user'}, {serverVersion: env0_26});
}
function useContextIndexState(a0, a1, a2) { // fn#62824, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:11312, offset: 0x01b68d8b, size: 177 bytes, params: 4, frame: 19
const env0_0 = a0;
const env0_1 = a1;
const env0_2 = a2;
const [property, env0_4] = env0_4Binding(ReactModule.useState(true), 2);
const value4 = (FluxModule).useStateFromStoresObject([env0_34], _fun62825);
ReactModule.useEffect(_fun62826, [value4, a2, a0, a1, property]);
return value4;
function _fun62825() { // fn#62825, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:11435, offset: 0x01b68e3c, size: 63 bytes, params: 1, frame: 12
var r0;
var value2;
var value;
if (env0_0.type === 'channel') {
value2 = environment.__proto__;
r0 = env1_34.getContextState(env0_0);
} else {
value = environment.__proto__;
value = env1_34.getUserState();
r0 = value;
}
return r0;
}
function _fun62826() { // fn#62826, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:11518, offset: 0x01b68e7b, size: 436 bytes, params: 1, frame: 21
var value5;
var defaultImport;
var track;
var APPLICATION_COMMAND_CACHE_FETCH;
var binding;
var Object;
var value;
if (env0_3) {
if (env0_0.type !== 'contextless') {
if (importDefault) {
if (require && channelSupportsContextCommands(env0_0.channel)) {
value5 = environment.__proto__;
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
track = defaultImport.track;
APPLICATION_COMMAND_CACHE_FETCH = AnalyticEvents.APPLICATION_COMMAND_CACHE_FETCH;
binding = ClassCallCheck;
Object = global.Object;
Reflect.apply(track, defaultImport, [APPLICATION_COMMAND_CACHE_FETCH, {miss: binding.result == null,
size: Object.keys(env1_34.indices).length}]);
if (shouldFetch(binding)) {
if (env0_0.channel.guild_id != null) {
(require(7865) /* metro dependency 7865: ApplicationCommandIndexActionCreators */).requestApplicationCommandIndex({type: 'guild',
guildId: env0_0.channel.guild_id});
} else {
(require(7865) /* metro dependency 7865: ApplicationCommandIndexActionCreators */).requestApplicationCommandIndex({type: 'channel',
channelId: env0_0.channel.id});
}
}
}
}
env0_4(false);
} else if (importDefault && shouldFetch(ClassCallCheck)) {
value = environment.__proto__;
value = require(7865) /* metro dependency 7865: ApplicationCommandIndexActionCreators */;
value.requestApplicationCommandIndex({type: 'user'});
}
}
}
}
function useUserIndexState(a0, a1) { // fn#62827, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:12027, offset: 0x01b6902f, size: 166 bytes, params: 3, frame: 18
const env0_0 = a0;
const env0_1 = a1;
const [property, env0_3] = Module00057(ReactModule.useState(true), 2);
const value4 = (FluxModule).useStateFromStoresObject([env0_34], _fun62828);
ReactModule.useEffect(_fun62829, [value4, a1, a0, property]);
return value4;
function _fun62828() { // fn#62828, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:12145, offset: 0x01b690d5, size: 19 bytes, params: 1, frame: 9
return env1_34.getUserState();
}
function _fun62829() { // fn#62829, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:12188, offset: 0x01b690e8, size: 108 bytes, params: 1, frame: 13
var r1;
var value3;
if (env0_2) {
r1 = require && shouldFetch(Module00057);
r1 = r1 && env0_0;
if (r1) {
value3 = environment.__proto__;
(require(7865) /* metro dependency 7865: ApplicationCommandIndexActionCreators */).requestApplicationCommandIndex({type: 'user'});
}
env0_3(false);
}
}
}
function useQueryState(a0, a1, a2) { // fn#62830, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:12400, offset: 0x01b69154, size: 323 bytes, params: 4, frame: 25
const env0_0 = a0;
const env0_1 = a1;
const env0_2 = a2;
const value3 = (require(7866) /* metro dependency 7866: CommandPermissionContext */).usePermissionContext(a0.type !== 'channel' ? undefined : a0.channel,
a1.commandTypes);
const value4 = a1.applicationCommands !== false;
const value5 = useContextIndexState(a0, value4, a2.allowFetch);
const value6 = useUserIndexState(value4, a2.allowFetch);
const value7 = useApplicationIndexStates();
const value8 = useApplicationIndexStatesVersion();
useMaybeFetchApplicationIndex(a2.applicationId, a2.allowFetch);
return ReactModule.useMemo(_fun62838, [value3, a1.text, a1.builtIns, value4, a2.scoreMethod, a2.allowEmptySections,
a2.sortOptions, a2.allowApplicationState, a2.applicationId, a2.installOnDemand, value5, value6, a0, value7,
value8]);
function useApplicationIndexStates() { // fn#62831, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:12631, owner: useQueryState.useApplicationIndexStates, offset: 0x01b69297, size: 57 bytes, params: 1, frame: 13
return (FluxModule).useStateFromStores([env1_34], _fun62832);
function _fun62832() { // fn#62832, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:12709, offset: 0x01b692d0, size: 19 bytes, params: 1, frame: 9
return env2_34.getApplicationStates();
}
}
function useApplicationIndexStatesVersion() { // fn#62833, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:12745, owner: useQueryState.useApplicationIndexStatesVersion, offset: 0x01b692e3, size: 57 bytes, params: 1, frame: 13
return (FluxModule).useStateFromStores([env1_34], _fun62834);
function _fun62834() { // fn#62834, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:12830, offset: 0x01b6931c, size: 15 bytes, params: 1, frame: 1
return env2_34.applicationIndicesVersion;
}
}
function useMaybeFetchApplicationIndex(a0, a1) { // fn#62835, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:12874, owner: useQueryState.useMaybeFetchApplicationIndex, offset: 0x01b6932b, size: 165 bytes, params: 3, frame: 19
const env0_0 = a0;
const env0_1 = a1;
const [property, env0_3] = env1_4(env1_11.useState(true), 2);
env1_11.useEffect(_fun62837, [a1, a0, (FluxModule).useStateFromStores([env1_34],
_fun62836), property]);
function _fun62836() { // fn#62836, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:12998, offset: 0x01b693d0, size: 27 bytes, params: 1, frame: 11
return env2_34.getApplicationState(env0_0);
}
function _fun62837() { // fn#62837, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:13042, offset: 0x01b693eb, size: 122 bytes, params: 1, frame: 13
var r1;
var value4;
var moduleValue;
if (env0_2) {
r1 = require && shouldFetch(applicationState);
r1 = r1 && env0_0 != null;
if (r1) {
value4 = environment.__proto__.__proto__;
moduleValue = require(7865) /* metro dependency 7865: ApplicationCommandIndexActionCreators */;
moduleValue.requestApplicationCommandIndex({type: 'application', applicationId: env0_0});
}
env0_3(false);
}
}
}
function _fun62838() { // fn#62838, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:13220, offset: 0x01b69465, size: 202 bytes, params: 1, frame: 13
var r3;
var map;
const queryIndexBinding = queryIndex;
const object = {};
object.permissionContext = env0_3;
object.text = require.text;
object.allowApplicationCommands = result;
object.builtIns = require.builtIns;
object.scoreMethod = importDefault.scoreMethod;
object.allowEmptySections = importDefault.allowEmptySections;
object.contextState = ClassCallCheck;
object.userState = CreateClass;
object.launcherContext = env0_0;
if (importDefault.allowApplicationState) {
r3 = PossibleConstructorReturn;
} else {
map = new global.Map();
}
object.applicationStates = r3;
object.sortOptions = importDefault.sortOptions;
object.singleApplicationId = importDefault.applicationId;
object.installOnDemand = importDefault.installOnDemand;
return queryIndexBinding(object);
}
}
function queryIndex({permissionContext, contextState, userState, applicationStates, text, builtIns, allowApplicationCommands, singleApplicationId, allowEmptySections, scoreMethod, sortOptions, installOnDemand}) { // fn#62839, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:13719, offset: 0x01b6952f, size: 1876 bytes, params: 2, frame: 57
var environment;
var r23;
var r12;
var r10;
var r19;
var r18;
var sections;
var r27;
var r26;
var r22;
var r33;
var r34;
var r35;
var r29;
var r30;
var guild_id;
var r0;
var fetching;
var r1;
var r2;
var value2;
const BuiltInCommandFilter = (ApplicationCommandQueryTypesModule).BuiltInCommandFilter;
var ALLOW;
var value3;
var value4;
var value5;
const ScoreMethod = (ApplicationCommandQueryTypesModule).ScoreMethod;
var NONE;
var value6;
var binding;
var value7;
var toLowerCase;
var value8;
var split;
var value9;
var hasBaseAccessPermissions;
var properties;
var properties2;
var properties3;
var propertyName;
var propertyName2;
var property;
var value14;
var descriptor;
var id;
var value15;
var add;
var properties4;
var properties5;
var propertyName3;
var value16;
var value17;
var value23;
var value24;
var property2;
var Object;
var keys;
var value25;
var length;
var value26;
var value27;
var property3;
var property4;
var get;
var value29;
var value30;
var value31;
var values;
var commands;
var value32;
var value33;
var value34;
var items2;
var properties6;
var properties7;
var propertyName4;
var commands2;
var push;
var properties8;
var properties9;
var propertyName5;
var commands3;
var commands4;
var defaultImport;
var defaultImport2;
var queryIndexSectionBinding;
var value35;
var value36;
const FrecencyUserSettingsActionCreators = (UserSettingsProtoActionCreatorsModule).FrecencyUserSettingsActionCreators;
var loadIfNecessary;
var BUILT_IN_SECTIONS;
var BUILT_IN;
var value37;
var COMMAND_OR_APPLICATION;
var context;
var guildStoreBinding;
var getGuild;
var context2;
var value39;
var fetchState;
var value41;
var value42;
var value43;
let value = undefined;
reducibleJoin2: while (true) {
if (builtIns !== value) {
r23 = builtIns;
break reducibleJoin2;
}
value2 = environment;
ALLOW = BuiltInCommandFilter.ALLOW;
r23 = ALLOW;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (allowApplicationCommands !== value) {
break reducibleJoin4;
}
value3 = true;
allowApplicationCommands = value3;
break reducibleJoin4;
}
reducibleJoin6: while (true) {
if (allowEmptySections !== value) {
break reducibleJoin6;
}
value4 = false;
allowEmptySections = value4;
break reducibleJoin6;
}
reducibleJoin8: while (true) {
if (scoreMethod !== value) {
r12 = scoreMethod;
break reducibleJoin8;
}
value5 = environment;
NONE = ScoreMethod.NONE;
r12 = NONE;
break reducibleJoin8;
}
reducibleJoin10: while (true) {
if (sortOptions !== value) {
r10 = sortOptions;
break reducibleJoin10;
}
value6 = environment;
binding = env0_35;
r10 = binding;
break reducibleJoin10;
}
reducibleJoin12: while (true) {
if (installOnDemand !== value) {
break reducibleJoin12;
}
value7 = false;
installOnDemand = value7;
break reducibleJoin12;
}
var env0_2;
const commandTypes = permissionContext.commandTypes;
reducibleJoin14: while (true) {
if (text == null) {
r19 = value;
break reducibleJoin14;
}
toLowerCase = text.toLowerCase;
value8 = Reflect.apply(toLowerCase, text, []);
r19 = value8;
break reducibleJoin14;
}
reducibleJoin16: while (true) {
if (r19 == null) {
r18 = value;
break reducibleJoin16;
}
split = r19.split;
value9 = Reflect.apply(split, r19, [' ']);
r18 = value9;
break reducibleJoin16;
}
const ONLY_TEXT = BuiltInCommandFilter.ONLY_TEXT;
const DENY = BuiltInCommandFilter.DENY;
const r17 = r23 !== DENY ? (require(7871) /* metro dependency 7871: ApplicationCommandBuiltIns */).getBuiltInCommands(commandTypes,
true, r23 === ONLY_TEXT) : [];
const items3 = [];
const object = {permissionContext: permissionContext, query: r19, splitQuery: r18,
allowEmptySections: allowEmptySections, scoreMethod: r12, installOnDemand: installOnDemand};
let result = contextState.result;
reducibleJoin21: while (true) {
if (result == null) {
sections = value;
break reducibleJoin21;
}
sections = result.sections;
break reducibleJoin21;
}
reducibleJoin23: while (true) {
if (sections != null) {
r27 = sections;
break reducibleJoin23;
}
r27 = {};
break reducibleJoin23;
}
result = userState.result;
reducibleJoin25: while (true) {
if (result == null) {
sections = value;
break reducibleJoin25;
}
sections = result.sections;
break reducibleJoin25;
}
reducibleJoin27: while (true) {
if (sections != null) {
r26 = sections;
break reducibleJoin27;
}
r26 = {};
break reducibleJoin27;
}
const Set = global.Set;
let set = new Set();
reducibleJoin41: while (true) {
if (!allowApplicationCommands) {
break reducibleJoin41;
}
hasBaseAccessPermissions = permissionContext.hasBaseAccessPermissions;
reducibleJoin35: while (true) {
if (!hasBaseAccessPermissions) {
break reducibleJoin35;
}
properties = Object.keys(r27);
properties2 = 0;
properties3 = properties.length;
if (properties === value) {
break reducibleJoin35;
}
r18 = properties2;
reducibleLoop30: while (true) {
propertyName = properties[r18];
propertyName2 = r18 + 1;
if (propertyName === value) {
break reducibleJoin35;
}
property = r27[propertyName];
value14 = singleApplicationId != null;
reducibleJoin33: while (true) {
if (value14) {
descriptor = property.descriptor;
id = descriptor.id;
value15 = id !== singleApplicationId;
r22 = value15;
break reducibleJoin33;
}
r22 = value14;
break reducibleJoin33;
}
if (r22) {
r18 = propertyName2;
continue reducibleLoop30;
}
add = set.add;
Reflect.apply(add, set, [propertyName]);
r18 = propertyName2;
continue reducibleLoop30;
}
}
properties = Object.keys(r26);
properties4 = 0;
properties5 = properties.length;
if (properties === value) {
break reducibleJoin41;
}
r18 = properties4;
reducibleLoop36: while (true) {
propertyName = properties[r18];
propertyName3 = r18 + 1;
if (propertyName === value) {
break reducibleJoin41;
}
property = r26[propertyName];
value16 = singleApplicationId != null;
reducibleJoin39: while (true) {
if (value16) {
descriptor = property.descriptor;
id = descriptor.id;
value17 = id !== singleApplicationId;
r22 = value17;
break reducibleJoin39;
}
r22 = value16;
break reducibleJoin39;
}
if (r22) {
r18 = propertyName3;
continue reducibleLoop36;
}
add = set.add;
Reflect.apply(add, set, [propertyName]);
r18 = propertyName3;
continue reducibleLoop36;
}
}
const Map = global.Map;
const map = new Map();
const value20 = _createForOfIteratorHelperLoose_62805(applicationStates);
const value21 = value20();
let done = value21.done;
if (!done) {
r23 = value21;
reducibleLoop42: while (true) {
value23 = r23.value;
value24 = Module00057(value23, 2);
property = value24[0];
property2 = value24[1];
reducibleJoin49: while (true) {
reducibleJoin46: while (true) {
if (singleApplicationId == null) {
result = property2.result;
if (result == null) {
sections = value;
break reducibleJoin46;
}
sections = result.sections;
break reducibleJoin46;
}
if (property !== singleApplicationId) {
break reducibleJoin49;
}
result = property2.result;
if (result == null) {
sections = value;
break reducibleJoin46;
}
sections = result.sections;
break reducibleJoin46;
}
if (sections == null) {
break reducibleJoin49;
}
Object = global.Object;
keys = Object.keys;
value25 = Reflect.apply(keys, Object, [sections]);
length = value25.length;
if (!(0 < length)) {
break reducibleJoin49;
}
r33 = 0;
reducibleLoop48: while (true) {
property = value25[r33];
add = set.add;
Reflect.apply(add, set, [property]);
set = map.set;
Reflect.apply(set, map, [property, sections[property]]);
value26 = typeof r33 === 'bigint' ? r33 + 1n : +r33 + 1;
length = value25.length;
if (value26 < length) {
r33 = value26;
continue reducibleLoop48;
}
break reducibleJoin49;
}
break reducibleJoin49;
}
value27 = value20();
done = value27.done;
if (done) {
break reducibleLoop42;
}
r23 = value27;
continue reducibleLoop42;
}
}
const Array = global.Array;
const value28 = Array.from(set);
length = value28.length;
if (0 < length) {
r19 = 0;
reducibleLoop51: while (true) {
property = value28[r19];
property3 = r27[property];
property4 = r26[property];
get = map.get;
value29 = Reflect.apply(get, map, [property]);
value30 = property3 != null;
value31 = property4 != null;
reducibleJoin66: while (true) {
reducibleJoin53: while (true) {
if (property3 == null) {
break reducibleJoin53;
}
if (property4 != null) {
descriptor = property4.descriptor;
items2 = [];
commands = property4.commands;
properties = Object.keys(commands);
properties6 = 0;
properties7 = properties.length;
if (properties !== value) {
r34 = properties6;
reducibleLoop60: while (true) {
propertyName = properties[r34];
propertyName4 = r34 + 1;
if (propertyName === value) {
break reducibleLoop60;
}
commands2 = property4.commands;
property = commands2[propertyName];
push = items2.push;
Reflect.apply(push, items2, [property]);
r34 = propertyName4;
continue reducibleLoop60;
}
}
commands = property3.commands;
properties = Object.keys(commands);
properties8 = 0;
properties9 = properties.length;
if (properties === value) {
r29 = items2;
r30 = descriptor;
break reducibleJoin66;
}
r35 = properties8;
reducibleLoop63: while (true) {
propertyName = properties[r35];
propertyName5 = r35 + 1;
if (propertyName === value) {
r29 = items2;
r30 = descriptor;
break reducibleJoin66;
}
commands3 = property4.commands;
if (propertyName in commands3) {
r35 = propertyName5;
continue reducibleLoop63;
}
commands4 = property3.commands;
property = commands4[propertyName];
push = items2.push;
Reflect.apply(push, items2, [property]);
r35 = propertyName5;
continue reducibleLoop63;
}
defaultImport = importDefault(44) /* metro dependency 44 */;
defaultImport(r30 != null, 'Failed to select application descriptor');
defaultImport2 = importDefault(44) /* metro dependency 44 */;
defaultImport2(r29 != null, 'Failed to select list of application commands');
value35 = queryIndexSection(r30, r29, value30, value31, object);
reducibleJoin68: while (true) {
if (value35 == null) {
break reducibleJoin68;
}
push = items3.push;
Reflect.apply(push, items3, [value35]);
break reducibleJoin68;
}
value36 = typeof r19 === 'bigint' ? r19 + 1n : +r19 + 1;
length = value28.length;
if (value36 < length) {
r19 = value36;
continue reducibleLoop51;
}
break reducibleLoop51;
}
break reducibleJoin53;
}
if (property3 != null) {
descriptor = property3.descriptor;
Object = global.Object;
values = Object.values;
commands = property3.commands;
value34 = Reflect.apply(values, Object, [commands]);
r29 = value34;
r30 = descriptor;
break reducibleJoin66;
}
if (property4 != null) {
descriptor = property4.descriptor;
Object = global.Object;
values = Object.values;
commands = property4.commands;
value33 = Reflect.apply(values, Object, [commands]);
r29 = value33;
r30 = descriptor;
break reducibleJoin66;
}
if (value29 != null) {
descriptor = value29.descriptor;
Object = global.Object;
values = Object.values;
commands = value29.commands;
value32 = Reflect.apply(values, Object, [commands]);
r29 = value32;
r30 = descriptor;
break reducibleJoin66;
}
r29 = value;
r30 = value;
break reducibleJoin66;
}
defaultImport = importDefault(44) /* metro dependency 44 */;
defaultImport(r30 != null, 'Failed to select application descriptor');
defaultImport2 = importDefault(44) /* metro dependency 44 */;
defaultImport2(r29 != null, 'Failed to select list of application commands');
value35 = queryIndexSection(r30, r29, value30, value31, object);
reducibleJoin68: while (true) {
if (value35 == null) {
break reducibleJoin68;
}
push = items3.push;
Reflect.apply(push, items3, [value35]);
break reducibleJoin68;
}
value36 = typeof r19 === 'bigint' ? r19 + 1n : +r19 + 1;
length = value28.length;
if (value36 < length) {
r19 = value36;
continue reducibleLoop51;
}
break reducibleLoop51;
}
}
let useFrecency = r10.applications.useFrecency;
reducibleJoin71: while (true) {
if (useFrecency) {
loadIfNecessary = FrecencyUserSettingsActionCreators.loadIfNecessary;
Reflect.apply(loadIfNecessary, FrecencyUserSettingsActionCreators, []);
break reducibleJoin71;
}
break reducibleJoin71;
}
let sort = items3.sort;
Reflect.apply(sort, items3, [_fun62840]);
reducibleJoin75: while (true) {
reducibleJoin73: while (true) {
if (r17.length > 0) {
break reducibleJoin73;
}
if (allowEmptySections !== true) {
break reducibleJoin75;
}
break reducibleJoin73;
}
queryIndexSectionBinding = queryIndexSection;
BUILT_IN_SECTIONS = (require(7871) /* metro dependency 7871: ApplicationCommandBuiltIns */).BUILT_IN_SECTIONS;
BUILT_IN = BuiltInSectionId.BUILT_IN;
value37 = queryIndexSectionBinding(BUILT_IN_SECTIONS[BUILT_IN], r17, true, true, object);
if (value37 == null) {
break reducibleJoin75;
}
push = items3.push;
Reflect.apply(push, items3, [value37]);
break reducibleJoin75;
}
const value38 = items3.flatMap(function(a0) {
var env0_0 = a0;
return a0.data.map(_fun62842);
});
const COMMAND_ONLY = ScoreMethod.COMMAND_ONLY;
reducibleJoin85: while (true) {
reducibleJoin84: while (true) {
if (r12 === COMMAND_ONLY) {
context = permissionContext.context;
guildStoreBinding = GuildStore;
getGuild = guildStoreBinding.getGuild;
reducibleJoin80: while (true) {
if (permissionContext == null) {
guild_id = value;
break reducibleJoin80;
}
context2 = permissionContext.context;
if (context2 == null) {
guild_id = value;
break reducibleJoin80;
}
guild_id = context2.guild_id;
break reducibleJoin80;
}
value39 = Reflect.apply(getGuild, guildStoreBinding, [guild_id]);
reducibleJoin82: while (true) {
if (r10.commands.useFrecency) {
loadIfNecessary = FrecencyUserSettingsActionCreators.loadIfNecessary;
Reflect.apply(loadIfNecessary, FrecencyUserSettingsActionCreators, []);
break reducibleJoin82;
}
break reducibleJoin82;
}
if (context != null) {
r0 = {channel: context, guild: value39};
break reducibleJoin84;
}
r0 = value;
break reducibleJoin84;
}
COMMAND_OR_APPLICATION = ScoreMethod.COMMAND_OR_APPLICATION;
if (r12 !== COMMAND_OR_APPLICATION) {
break reducibleJoin85;
}
context = permissionContext.context;
guildStoreBinding = GuildStore;
getGuild = guildStoreBinding.getGuild;
reducibleJoin80: while (true) {
if (permissionContext == null) {
guild_id = value;
break reducibleJoin80;
}
context2 = permissionContext.context;
if (context2 == null) {
guild_id = value;
break reducibleJoin80;
}
guild_id = context2.guild_id;
break reducibleJoin80;
}
value39 = Reflect.apply(getGuild, guildStoreBinding, [guild_id]);
commands = r10.commands;
useFrecency = commands.useFrecency;
reducibleJoin82: while (true) {
if (useFrecency) {
loadIfNecessary = FrecencyUserSettingsActionCreators.loadIfNecessary;
Reflect.apply(loadIfNecessary, FrecencyUserSettingsActionCreators, []);
break reducibleJoin82;
}
break reducibleJoin82;
}
if (context != null) {
r0 = {channel: context, guild: value39};
break reducibleJoin84;
}
r0 = value;
break reducibleJoin84;
}
env0_2 = r0;
sort = value38.sort;
Reflect.apply(sort, value38, [_fun62843]);
break reducibleJoin85;
}
const object4 = {commands: value38};
object4.descriptors = items3.map(function(a0) {
return a0.section;
});
object4.sectionedCommands = items3;
reducibleJoin87: while (true) {
if (contextState == null) {
fetching = value;
break reducibleJoin87;
}
fetchState = contextState.fetchState;
fetching = fetchState.fetching;
break reducibleJoin87;
}
const value40 = fetching === true;
reducibleJoin91: while (true) {
if (value40) {
r1 = value40;
break reducibleJoin91;
}
reducibleJoin90: while (true) {
if (userState == null) {
fetching = value;
break reducibleJoin90;
}
fetchState = userState.fetchState;
fetching = fetchState.fetching;
break reducibleJoin90;
}
value41 = fetching === true;
r1 = value41;
break reducibleJoin91;
}
reducibleJoin97: while (true) {
if (r1) {
break reducibleJoin97;
}
value42 = singleApplicationId != null;
reducibleJoin96: while (true) {
if (value42) {
get = applicationStates.get;
value43 = Reflect.apply(get, applicationStates, [singleApplicationId]);
reducibleJoin95: while (true) {
if (value43 == null) {
fetching = value;
break reducibleJoin95;
}
fetchState = value43.fetchState;
fetching = fetchState.fetching;
break reducibleJoin95;
}
value = fetching === true;
r2 = value;
break reducibleJoin96;
}
r2 = value42;
break reducibleJoin96;
}
r1 = r2;
break reducibleJoin97;
}
object4.loading = r1;
return object4;
function _fun62840(a0, a1) { // fn#62840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:15697, offset: 0x01b69c83, size: 300 bytes, params: 3, frame: 18
var score;
var r1;
var r0;
var binding;
var value2;
var value3;
var data;
var property;
var applicationFrecencyStoreBinding;
var getScoreWithoutLoadingLatest;
var section;
var id;
var value4;
var compareNamesBinding;
var name;
var value;
if (env0_1.applications.useScore) {
binding = env0_0;
value2 = environment.__proto__;
value3 = undefined;
if (binding !== (require(7869) /* metro dependency 7869: ApplicationCommandQueryTypes */).ScoreMethod.APPLICATION_ONLY) {
if (env0_1.applications.useFrecency) {
value = environment.__proto__;
applicationFrecencyStoreBinding = ApplicationFrecencyStore;
getScoreWithoutLoadingLatest = applicationFrecencyStoreBinding.getScoreWithoutLoadingLatest;
section = a0.section;
id = section.id;
value4 = Reflect.apply(getScoreWithoutLoadingLatest, applicationFrecencyStoreBinding, [id]);
applicationFrecencyStoreBinding = ApplicationFrecencyStore;
getScoreWithoutLoadingLatest = applicationFrecencyStoreBinding.getScoreWithoutLoadingLatest;
section = a1.section;
id = section.id;
value = Reflect.apply(getScoreWithoutLoadingLatest, applicationFrecencyStoreBinding, [id]);
if (value4 !== value) {
return value - value4;
}
value = environment.__proto__;
compareNamesBinding = compareNames;
section = a0.section;
name = section.name;
section = a1.section;
return compareNamesBinding(name, section.name);
}
value = environment.__proto__;
compareNamesBinding = compareNames;
section = a0.section;
name = section.name;
section = a1.section;
return compareNamesBinding(name, section.name);
}
data = a0.data;
property = data[0];
score = property == null ? value3 : property.score;
r1 = score ?? global.Number.MAX_VALUE;
data = a1.data;
property = data[0];
score = property == null ? value3 : property.score;
r0 = score ?? global.Number.MAX_VALUE;
if (r1 !== r0) {
return r1 - r0;
}
if (env0_1.applications.useFrecency) {
value = environment.__proto__;
applicationFrecencyStoreBinding = ApplicationFrecencyStore;
getScoreWithoutLoadingLatest = applicationFrecencyStoreBinding.getScoreWithoutLoadingLatest;
section = a0.section;
id = section.id;
value4 = Reflect.apply(getScoreWithoutLoadingLatest, applicationFrecencyStoreBinding, [id]);
applicationFrecencyStoreBinding = ApplicationFrecencyStore;
getScoreWithoutLoadingLatest = applicationFrecencyStoreBinding.getScoreWithoutLoadingLatest;
section = a1.section;
id = section.id;
value = Reflect.apply(getScoreWithoutLoadingLatest, applicationFrecencyStoreBinding, [id]);
if (value4 !== value) {
return value - value4;
}
value = environment.__proto__;
compareNamesBinding = compareNames;
section = a0.section;
name = section.name;
section = a1.section;
return compareNamesBinding(name, section.name);
}
value = environment.__proto__;
compareNamesBinding = compareNames;
section = a0.section;
name = section.name;
section = a1.section;
return compareNamesBinding(name, section.name);
}
const useFrecency = env0_1.applications.useFrecency;
if (useFrecency) {
value = environment.__proto__;
applicationFrecencyStoreBinding = ApplicationFrecencyStore;
getScoreWithoutLoadingLatest = applicationFrecencyStoreBinding.getScoreWithoutLoadingLatest;
section = a0.section;
id = section.id;
value4 = Reflect.apply(getScoreWithoutLoadingLatest, applicationFrecencyStoreBinding, [id]);
applicationFrecencyStoreBinding = ApplicationFrecencyStore;
getScoreWithoutLoadingLatest = applicationFrecencyStoreBinding.getScoreWithoutLoadingLatest;
section = a1.section;
id = section.id;
value = Reflect.apply(getScoreWithoutLoadingLatest, applicationFrecencyStoreBinding, [id]);
if (value4 !== value) {
return value - value4;
}
value = environment.__proto__;
compareNamesBinding = compareNames;
section = a0.section;
name = section.name;
section = a1.section;
return compareNamesBinding(name, section.name);
}
value = environment.__proto__;
return compareNames(a0.section.name, a1.section.name);
}
function _fun62841(a0) { // fn#62841, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:16279, offset: 0x01b69daf, size: 31 bytes, params: 2, frame: 11
const env0_0 = a0;
return a0.data.map(_fun62842);
function _fun62842(a0) { // fn#62842, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:16294, offset: 0x01b69dce, size: 36 bytes, params: 2, frame: 12
const object = {};
copyDataProperties(object, a0, undefined);
object['section'] = env0_0.section;
return object;
}
}
function _fun62843(a0, a1) { // fn#62843, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:16646, offset: 0x01b69df2, size: 175 bytes, params: 3, frame: 18
var r0;
var r1;
var score;
var value2;
var value3;
var scoreWithoutLoadingLatest;
var value;
if (env0_1.commands.useScore) {
score = a0.score;
value2 = 0;
r0 = score ?? value2;
score = a1.score;
r1 = score ?? value2;
if (r0 !== r1) {
return r0 - r1;
}
if (env0_1.commands.useFrecency) {
value3 = environment.__proto__;
scoreWithoutLoadingLatest = ApplicationCommandFrecencyStore.getScoreWithoutLoadingLatest(env0_2, a0);
value = ApplicationCommandFrecencyStore.getScoreWithoutLoadingLatest(env0_2, a1);
if (scoreWithoutLoadingLatest !== value) {
return value - scoreWithoutLoadingLatest;
}
value = environment.__proto__;
return compareNames(a0.displayName, a1.displayName);
}
} else if (env0_1.commands.useFrecency) {
value3 = environment.__proto__;
scoreWithoutLoadingLatest = ApplicationCommandFrecencyStore.getScoreWithoutLoadingLatest(env0_2, a0);
value = ApplicationCommandFrecencyStore.getScoreWithoutLoadingLatest(env0_2, a1);
if (scoreWithoutLoadingLatest !== value) {
return value - scoreWithoutLoadingLatest;
}
value = environment.__proto__;
return compareNames(a0.displayName, a1.displayName);
}
value = environment.__proto__;
return compareNames(a0.displayName, a1.displayName);
}
}
function queryIndexSection(a0, a1, a2, a3, {query, splitQuery, allowEmptySections, scoreMethod, permissionContext, installOnDemand}) { // fn#62845, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:17171, offset: 0x01b69eac, size: 1042 bytes, params: 6, frame: 36
var r26;
var r13;
var r12;
var r6;
var r22;
var r15;
var r9;
var r19;
var r18;
var r2;
var r0;
var moduleValue;
var moduleValue2;
var value9;
var moduleValue3;
var hasAccess;
var botId;
var hasAccess2;
var HasAccessResult;
var ALLOWED;
var push;
var value10;
var items2;
var COMMAND_OR_APPLICATION;
var application;
var property;
var value11;
var value12;
var value13;
var value14;
var COMMAND_ONLY;
var value15;
var value16;
var value17;
var value18;
var value19;
var value20;
let value = a3;
const context = permissionContext.context;
const userId = permissionContext.userId;
if (context?.guild_id != null) {
moduleValue = importAll(8039) /* metro dependency 8039: CommandPermissionUtils */;
r13 = moduleValue.computeAllowedForUser(a0.permissions, context.guild_id, userId, permissionContext.roleIds,
permissionContext.isImpersonating);
r26 = userId;
} else {
r13 = null;
}
if (context?.guild_id != null) {
moduleValue2 = importAll(8039) /* metro dependency 8039: CommandPermissionUtils */;
r12 = moduleValue2.computeAllowedForChannel(a0.permissions, context, context.guild_id);
} else {
r12 = null;
}
let object = [];
const value7 = _createForOfIteratorHelperLoose_62805(a1);
const value8 = value7();
let done = value8.done;
if (!done) {
r6 = value8;
while (true) {
value9 = r6.value;
moduleValue3 = importAll(8039) /* metro dependency 8039: CommandPermissionUtils */;
hasAccess = moduleValue3.hasAccess;
botId = a0.botId;
r22 = value || installOnDemand;
hasAccess2 = Reflect.apply(hasAccess, moduleValue3, [value9, permissionContext,
{applicationAllowedForUser: r13,
applicationAllowedForChannel: r12, commandBotId: botId, isGuildInstalled: a2, isUserInstalled: r22}]);
HasAccessResult = (require(8039) /* metro dependency 8039: CommandPermissionUtils */).HasAccessResult;
ALLOWED = HasAccessResult.ALLOWED;
if (hasAccess2 !== ALLOWED) {
continue;
}
object.push(value9);
value10 = value7();
done = value10.done;
if (done) {
break;
}
r6 = value10;
continue;
}
}
const ScoreMethod = (ApplicationCommandQueryTypesModule).ScoreMethod;
const NONE = ScoreMethod.NONE;
if (scoreMethod === NONE) {
r2 = object;
} else if (query == null) {
r2 = object;
} else if (splitQuery == null) {
r2 = object;
} else {
items2 = [];
if (scoreMethod === ScoreMethod.APPLICATION_ONLY) {
value = a0.name.toLocaleLowerCase();
if (value.startsWith(query)) {
r15 = env0_36.SECTION_NAME_STARTS_WITH;
} else if (value.includes(query)) {
r15 = env0_36.SECTION_NAME_CONTAINS;
} else {
application = a0.application;
r12 = application == null || application.description == null ? undefined : application.description.toLocaleLowerCase();
r6 = r12 != null && r12.includes(query);
r15 = r6 ? env0_36.SECTION_DESCRIPTION_CONTAINS : undefined;
}
} else {
COMMAND_OR_APPLICATION = ScoreMethod.COMMAND_OR_APPLICATION;
if (scoreMethod !== COMMAND_OR_APPLICATION) {
r15 = undefined;
} else {
value = a0.name.toLocaleLowerCase();
if (value.startsWith(query)) {
r15 = env0_36.SECTION_NAME_STARTS_WITH;
} else if (value.includes(query)) {
r15 = env0_36.SECTION_NAME_CONTAINS;
} else {
application = a0.application;
r12 = application == null || application.description == null ? undefined : application.description.toLocaleLowerCase();
r6 = r12 != null && r12.includes(query);
r15 = r6 ? env0_36.SECTION_DESCRIPTION_CONTAINS : undefined;
}
}
}
property = splitQuery[0];
value = splitQuery.slice(1);
value = value.join(' ');
value11 = _createForOfIteratorHelperLoose_62805(object);
value12 = value11();
done = value12.done;
value13 = r15 !== undefined;
if (done) {
r2 = items2;
} else {
r9 = value12;
while (true) {
value14 = r9.value;
COMMAND_ONLY = ScoreMethod.COMMAND_ONLY;
value15 = scoreMethod !== COMMAND_ONLY;
if (value15) {
COMMAND_OR_APPLICATION = ScoreMethod.COMMAND_OR_APPLICATION;
value16 = scoreMethod !== COMMAND_OR_APPLICATION;
r6 = value16;
} else {
r6 = value15;
}
if (r6) {
r19 = undefined;
continue;
}
value17 = scoreCommand(value14, query, property, value);
r19 = value17;
r26 = property;
value18 = r19 === undefined;
if (value18) {
r6 = value18;
continue;
}
if (!value13) {
r18 = value13;
continue;
}
value19 = r15 < r19;
r18 = value19;
r6 = r18;
if (r6) {
r19 = r15;
continue;
}
continue;
if (r19 === undefined) {
continue;
}
push = items2.push;
object = {};
copyDataProperties(object, value14, r26);
object['score'] = r19;
Reflect.apply(push, items2, [object]);
value20 = value11();
done = value20.done;
if (done) {
r2 = items2;
break;
}
r9 = value20;
continue;
}
}
}
if (r2.length !== 0) {
if (!(scoreMethod !== ScoreMethod.NONE && scoreMethod !== ScoreMethod.APPLICATION_ONLY)) {
r2.sort(function(a0, a1) {
return compareNames(a0.displayName, a1.displayName);
});
}
r0 = {section: a0, data: r2};
} else if (allowEmptySections) {
if (!(scoreMethod !== ScoreMethod.NONE && scoreMethod !== ScoreMethod.APPLICATION_ONLY)) {
r2.sort(_fun62846);
}
r0 = {section: a0, data: r2};
} else {
r0 = null;
}
return r0;
function _fun62846({displayName}, {displayName}) { // fn#62846, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:18753, offset: 0x01b6a2be, size: 33 bytes, params: 3, frame: 13
return compareNames(displayName, displayName);
}
}
function channelSupportsContextCommands(a0) { // fn#62847, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:18829, offset: 0x01b6a2df, size: 111 bytes, params: 2, frame: 16
const value = undefined;
return (a0 == null ? value : a0.guild_id) != null || (a0 == null ? value : a0.type) === ChannelTypes.DM && (UserStore.getUser(a0.getRecipientId()) == null ? value : UserStore.getUser(a0.getRecipientId()).bot) === true;
}
function shouldFetch(a0) { // fn#62848, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:19012, offset: 0x01b6a34e, size: 100 bytes, params: 2, frame: 13
var r0;
var r1;
let value = isStale_62849(a0);
value = !(value ? a0.fetchState.fetching : !value);
if (r0) {
r0 = value;
} else {
value = a0.fetchState.retryAfter == null;
if (value) {
r1 = value;
} else {
value = global.Date.now();
value = value >= a0.fetchState.retryAfter;
r1 = value;
}
r0 = r1;
}
return r0;
}
function toServerOption(a0) { // fn#62851, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:19354, offset: 0x01b6a417, size: 200 bytes, params: 2, frame: 17
const object = {};
copyDataProperties(object, a0, undefined);
const choices = a0.choices;
const value = undefined;
object['choices'] = choices == null ? value : choices.map(toServerChoice);
object['description'] = a0.description_default ?? a0.description;
object['name'] = a0.name_default ?? a0.name;
const options = a0.options;
object['options'] = options == null ? value : options.map(toServerOption);
if (a0.description !== a0.description_default) {
object.description_localized = a0.description;
}
if (a0.name !== a0.name_default) {
object.name_localized = a0.name;
}
return object;
}
function toServerPermissions(a0, a1) { // fn#62853, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:19895, offset: 0x01b6a524, size: 402 bytes, params: 3, frame: 26
var r4;
var r2;
var push;
var value;
const ApplicationCommandPermissionType = (ApplicationCommandTypesModule).ApplicationCommandPermissionType;
var USER;
var Object;
var entries;
var length;
var value2;
var value3;
var property;
var value4;
var property2;
var CHANNEL;
var value5;
var value6;
var value7;
var value8;
var property3;
var ROLE;
var value9;
const items2 = [];
let user = a0.user;
reducibleJoin2: while (true) {
if (user == null) {
break reducibleJoin2;
}
push = items2.push;
value = environment;
USER = ApplicationCommandPermissionType.USER;
user = a0.user;
Reflect.apply(push, items2, [{type: USER, id: a1, permission: user}]);
break reducibleJoin2;
}
let channels = a0.channels;
reducibleJoin5: while (true) {
if (channels == null) {
break reducibleJoin5;
}
Object = global.Object;
entries = Object.entries;
channels = a0.channels;
value = Reflect.apply(entries, Object, [channels]);
length = value.length;
value2 = 0;
value3 = environment;
if (!(value2 < length)) {
break reducibleJoin5;
}
r4 = value2;
reducibleLoop4: while (true) {
property = value[r4];
value4 = Module00057(property, 2);
property = value4[value2];
property2 = value4[1];
push = items2.push;
CHANNEL = ApplicationCommandPermissionType.CHANNEL;
Reflect.apply(push, items2, [{type: CHANNEL, id: property, permission: property2}]);
value5 = typeof r4 === 'bigint' ? r4 + 1n : +r4 + 1;
length = value.length;
if (value5 < length) {
r4 = value5;
continue reducibleLoop4;
}
break reducibleJoin5;
}
}
let roles = a0.roles;
reducibleJoin8: while (true) {
if (roles == null) {
break reducibleJoin8;
}
Object = global.Object;
entries = Object.entries;
roles = a0.roles;
value = Reflect.apply(entries, Object, [roles]);
length = value.length;
value6 = 0;
value7 = environment;
if (!(value6 < length)) {
break reducibleJoin8;
}
r2 = value6;
reducibleLoop7: while (true) {
property = value[r2];
value8 = Module00057(property, 2);
property = value8[value6];
property3 = value8[1];
push = items2.push;
ROLE = ApplicationCommandPermissionType.ROLE;
Reflect.apply(push, items2, [{type: ROLE, id: property, permission: property3}]);
value9 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
length = value.length;
if (value9 < length) {
r2 = value9;
continue reducibleLoop7;
}
break reducibleJoin8;
}
}
return items2;
}
function scoreCommand(a0, a1, a2, a3) { // fn#62854, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:21034, offset: 0x01b6a6b6, size: 744 bytes, params: 5, frame: 29
var r3;
var r6;
var r7;
var r16;
var r5;
var COMMAND_DESCRIPTION_CONTAINS;
var split;
var value3;
var slice;
var value4;
var join;
var value5;
var value6;
var value7;
var value8;
var includes;
var value9;
var _createForOfIteratorHelperLoose_62805Binding;
var options;
var value10;
var value11;
var value12;
var done;
var value13;
var value14;
var name;
var serverLocalizedName;
var HermesInternal;
var concat;
var value15;
var value16;
var value17;
var value18;
var value19;
var value20;
var value21;
var value22;
var value23;
var untranslatedDescription;
var displayDescription;
var value24;
let value = a0.untranslatedName.toLocaleLowerCase();
const value2 = a0.displayName.toLocaleLowerCase();
let startsWith = value.startsWith;
if (!Reflect.apply(startsWith, value, [a1])) {
startsWith = value2.startsWith;
reducibleJoin39: while (true) {
if (!Reflect.apply(startsWith, value2, [a1])) {
startsWith = value.startsWith;
if (Reflect.apply(startsWith, value, [a2])) {
split = value.split;
value3 = Reflect.apply(split, value, [' ']);
slice = value3.slice;
value4 = Reflect.apply(slice, value3, [1]);
join = value4.join;
value5 = Reflect.apply(join, value4, [' ']);
reducibleJoin4: while (true) {
if (value5.startsWith(a3)) {
value = environment;
return env0_36.STARTS_WITH_COMMAND_NAME;
}
break reducibleJoin4;
}
}
startsWith = value2.startsWith;
if (Reflect.apply(startsWith, value2, [a2])) {
split = value2.split;
value6 = Reflect.apply(split, value2, [' ']);
slice = value6.slice;
value7 = Reflect.apply(slice, value6, [1]);
join = value7.join;
value8 = Reflect.apply(join, value7, [' ']);
startsWith = value8.startsWith;
reducibleJoin6: while (true) {
if (Reflect.apply(startsWith, value8, [a3])) {
value = environment;
return env0_36.STARTS_WITH_COMMAND_NAME;
}
break reducibleJoin6;
}
}
includes = value.includes;
if (!Reflect.apply(includes, value, [a1])) {
reducibleJoin36: while (true) {
reducibleJoin30: while (true) {
if (value2 == null) {
value9 = environment;
_createForOfIteratorHelperLoose_62805Binding = _createForOfIteratorHelperLoose_62805;
options = a0.options;
reducibleJoin11: while (true) {
if (options != null) {
r3 = options;
break reducibleJoin11;
}
r3 = [];
break reducibleJoin11;
}
value10 = undefined;
value11 = _createForOfIteratorHelperLoose_62805Binding(r3);
value12 = value11();
done = value12.done;
value13 = false;
if (done) {
r3 = value13;
break reducibleJoin30;
}
r6 = value13;
r7 = value12;
reducibleLoop12: while (true) {
value14 = r7.value;
name = value14.name;
serverLocalizedName = value14.serverLocalizedName;
startsWith = name.startsWith;
if (Reflect.apply(startsWith, name, [a1])) {
return env0_36.STARTS_WITH_COMMAND_OPTION_NAME_OR_OPTION_NAME;
}
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value15 = '' + value + ' ' + name;
startsWith = value15.startsWith;
if (Reflect.apply(startsWith, value15, [a1])) {
return env0_36.STARTS_WITH_COMMAND_OPTION_NAME_OR_OPTION_NAME;
}
if (value2 != null) {
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value16 = '' + value2 + ' ' + name;
startsWith = value16.startsWith;
reducibleJoin16: while (true) {
if (Reflect.apply(startsWith, value16, [a1])) {
return env0_36.STARTS_WITH_COMMAND_OPTION_NAME_OR_OPTION_NAME;
}
break reducibleJoin16;
}
}
if (serverLocalizedName != null) {
startsWith = serverLocalizedName.startsWith;
reducibleJoin21: while (true) {
reducibleJoin28: while (true) {
if (Reflect.apply(startsWith, serverLocalizedName, [a1])) {
break reducibleJoin28;
}
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value17 = '' + value + ' ' + serverLocalizedName;
startsWith = value17.startsWith;
if (Reflect.apply(startsWith, value17, [a1])) {
break reducibleJoin28;
}
if (value2 == null) {
break reducibleJoin21;
}
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value18 = '' + value2 + ' ' + serverLocalizedName;
startsWith = value18.startsWith;
if (Reflect.apply(startsWith, value18, [a1])) {
break reducibleJoin28;
}
break reducibleJoin21;
}
return env0_36.STARTS_WITH_COMMAND_OPTION_NAME_OR_OPTION_NAME;
}
}
includes = name.includes;
value19 = Reflect.apply(includes, name, [a1]);
reducibleJoin25: while (true) {
if (value19) {
r5 = value19;
break reducibleJoin25;
}
value20 = serverLocalizedName != null;
reducibleJoin24: while (true) {
if (value20) {
includes = serverLocalizedName.includes;
value21 = Reflect.apply(includes, serverLocalizedName, [a1]);
r16 = value21;
break reducibleJoin24;
}
r16 = value20;
break reducibleJoin24;
}
r5 = r16;
break reducibleJoin25;
}
reducibleJoin27: while (true) {
if (r5) {
value22 = true;
r6 = value22;
break reducibleJoin27;
}
break reducibleJoin27;
}
value23 = value11();
done = value23.done;
if (done) {
r3 = r6;
break reducibleJoin30;
}
r7 = value23;
continue reducibleLoop12;
}
} else {
includes = value2.includes;
if (Reflect.apply(includes, value2, [a1])) {
break reducibleJoin36;
}
value9 = environment;
_createForOfIteratorHelperLoose_62805Binding = _createForOfIteratorHelperLoose_62805;
options = a0.options;
reducibleJoin11: while (true) {
if (options != null) {
r3 = options;
break reducibleJoin11;
}
r3 = [];
break reducibleJoin11;
}
value10 = undefined;
value11 = _createForOfIteratorHelperLoose_62805Binding(r3);
value12 = value11();
done = value12.done;
value13 = false;
if (done) {
r3 = value13;
break reducibleJoin30;
}
r6 = value13;
r7 = value12;
reducibleLoop12: while (true) {
value14 = r7.value;
name = value14.name;
serverLocalizedName = value14.serverLocalizedName;
startsWith = name.startsWith;
if (Reflect.apply(startsWith, name, [a1])) {
return env0_36.STARTS_WITH_COMMAND_OPTION_NAME_OR_OPTION_NAME;
}
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value15 = '' + value + ' ' + name;
startsWith = value15.startsWith;
if (Reflect.apply(startsWith, value15, [a1])) {
return env0_36.STARTS_WITH_COMMAND_OPTION_NAME_OR_OPTION_NAME;
}
if (value2 != null) {
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value16 = '' + value2 + ' ' + name;
startsWith = value16.startsWith;
reducibleJoin16: while (true) {
if (Reflect.apply(startsWith, value16, [a1])) {
return env0_36.STARTS_WITH_COMMAND_OPTION_NAME_OR_OPTION_NAME;
}
break reducibleJoin16;
}
}
if (serverLocalizedName != null) {
startsWith = serverLocalizedName.startsWith;
reducibleJoin21: while (true) {
reducibleJoin28: while (true) {
if (Reflect.apply(startsWith, serverLocalizedName, [a1])) {
break reducibleJoin28;
}
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value17 = '' + value + ' ' + serverLocalizedName;
startsWith = value17.startsWith;
if (Reflect.apply(startsWith, value17, [a1])) {
break reducibleJoin28;
}
if (value2 == null) {
break reducibleJoin21;
}
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value18 = '' + value2 + ' ' + serverLocalizedName;
startsWith = value18.startsWith;
if (Reflect.apply(startsWith, value18, [a1])) {
break reducibleJoin28;
}
break reducibleJoin21;
}
return env0_36.STARTS_WITH_COMMAND_OPTION_NAME_OR_OPTION_NAME;
}
}
includes = name.includes;
value19 = Reflect.apply(includes, name, [a1]);
reducibleJoin25: while (true) {
if (value19) {
r5 = value19;
break reducibleJoin25;
}
value20 = serverLocalizedName != null;
reducibleJoin24: while (true) {
if (value20) {
includes = serverLocalizedName.includes;
value21 = Reflect.apply(includes, serverLocalizedName, [a1]);
r16 = value21;
break reducibleJoin24;
}
r16 = value20;
break reducibleJoin24;
}
r5 = r16;
break reducibleJoin25;
}
reducibleJoin27: while (true) {
if (r5) {
value22 = true;
r6 = value22;
break reducibleJoin27;
}
break reducibleJoin27;
}
value23 = value11();
done = value23.done;
if (done) {
r3 = r6;
break reducibleJoin30;
}
r7 = value23;
continue reducibleLoop12;
}
}
}
if (r3) {
return env0_36.OPTION_NAME_CONTAINS;
}
untranslatedDescription = a0.untranslatedDescription;
toLocaleLowerCase = untranslatedDescription.toLocaleLowerCase;
value = Reflect.apply(toLocaleLowerCase, untranslatedDescription, []);
displayDescription = a0.displayDescription;
toLocaleLowerCase = displayDescription.toLocaleLowerCase;
value24 = Reflect.apply(toLocaleLowerCase, displayDescription, []);
includes = value.includes;
reducibleJoin34: while (true) {
reducibleJoin33: while (true) {
if (Reflect.apply(includes, value, [a1])) {
break reducibleJoin33;
}
includes = value24.includes;
if (Reflect.apply(includes, value24, [a1])) {
break reducibleJoin33;
}
COMMAND_DESCRIPTION_CONTAINS = value10;
break reducibleJoin34;
}
COMMAND_DESCRIPTION_CONTAINS = env0_36.COMMAND_DESCRIPTION_CONTAINS;
break reducibleJoin34;
}
return COMMAND_DESCRIPTION_CONTAINS;
}
}
value = environment;
return env0_36.COMMAND_NAME_CONTAINS;
}
break reducibleJoin39;
}
}
return env0_36.COMMAND_NAME_STARTS_WITH;
}
function compareNames(a0, a1) { // fn#62855, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:22167, offset: 0x01b6a99e, size: 33 bytes, params: 3, frame: 13
return env0_34.collator.compare(a0, a1);
}
function _fun62856(a0) { // fn#62856, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:5801, offset: 0x01b6a9bf, size: 304 bytes, params: 2, frame: 16
const ApplicationCommandIndexStore2 = ApplicationCommandIndexStore;
Inherits(ApplicationCommandIndexStore2, a0);
return CreateClass(ApplicationCommandIndexStore2, [{key: 'initialize', value: function() {
var localeStoreBinding = LocaleStore;
this.waitFor(localeStoreBinding);
this.waitFor(ApplicationCommandFrecencyStore, ApplicationFrecencyStore, AuthenticationStore, ChannelStore,
GuildMemberStore, GuildStore, UserStore);
this.syncWith([localeStoreBinding], _fun62859);
}}, {key: 'getContextState', value: value_62860}, {key: 'hasContextStateApplication',
value: function({applicationId, channelId, guildId}) {
var r0;
var property = this.indices[guildId ?? channelId];
r0 = property == null || property.result == null ? undefined : property.result.sections;
r0 = r0 ?? ({});
return r0[applicationId] != null;
}}, {key: 'getGuildState', value: value_62862}, {key: 'getUserState', value: value_62863},
{key: 'hasUserStateApplication', value: value_62864}, {key: 'getApplicationState', value: value_62865},
{key: 'getApplicationStates', value: function() {
return this.applicationIndices;
}}, {key: 'hasApplicationState', value: function(a0) {
return a0 in this.indices;
}}, {key: 'query', value: value_62868}, {key: 'queryInstallOnDemandApp', value: value_62869}]);
function ApplicationCommandIndexStore(a0) { // fn#62857, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:5813, offset: 0x01b6aaef, size: 240 bytes, params: 2, frame: 21
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_5;
binding(this, ApplicationCommandIndexStore);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_8(ApplicationCommandIndexStore);
binding = env1_7;
if (_isNativeReflectConstruct_62802()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items2, env1_8(this).constructor);
r0 = value;
} else {
value = value.apply(this, items2);
r0 = value;
}
value = binding(this, r0);
value.indices = {};
const Map = global.Map;
const value4 = Object.create(Map.prototype, {constructor: {value: Map}});
const map = new Map();
value.applicationIndices = map instanceof Object ? map : value4;
value.applicationIndicesVersion = 0;
const localeStoreBinding = LocaleStore;
let locale = localeStoreBinding.locale;
value.oldLocale = locale;
const Intl = global.Intl;
const Collator = Intl.Collator;
locale = localeStoreBinding.locale;
binding = env1_31;
const value6 = Object.create(Collator.prototype, {constructor: {value: Collator}});
const collator = new Collator(locale, binding);
value.collator = collator instanceof Object ? collator : value6;
return value;
}
function value_62858() { // fn#62858, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:6316, offset: 0x01b6abdf, size: 93 bytes, params: 1, frame: 24
const waitFor = this.waitFor;
const localeStoreBinding = LocaleStore;
Reflect.apply(waitFor, this, [localeStoreBinding]);
this.waitFor(ApplicationCommandFrecencyStore, ApplicationFrecencyStore, AuthenticationStore, ChannelStore,
GuildMemberStore, GuildStore, UserStore);
this.syncWith([localeStoreBinding], _fun62859);
function _fun62859() { // fn#62859, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:6390, offset: 0x01b6ac3c, size: 112 bytes, params: 1, frame: 15
var binding;
var Collator;
var value2;
var collator;
const locale = LocaleStore.locale;
if (locale !== env2_34.oldLocale) {
LOGOUT_62811();
binding = env2_34;
Collator = global.Intl.Collator;
value2 = Object.create(Collator.prototype, {constructor: {value: Collator}});
collator = new Collator(locale, {'sensitivity': 'accent', 'numeric': true});
binding.collator = collator instanceof Object ? collator : value2;
env2_34.oldLocale = locale;
}
}
}
function value_62860(a0) { // fn#62860, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:6606, offset: 0x01b6acac, size: 101 bytes, params: 2, frame: 15
var r1;
var r0;
var value;
var indices;
if (a0.type === 'contextless') {
value = environment.__proto__;
r0 = env1_29;
} else {
value = environment.__proto__;
if (channelSupportsContextCommands(a0.channel)) {
indices = this.indices;
r1 = a0.channel.guild_id ?? a0.channel.id;
r1 = indices[r1] ?? env1_30;
r0 = r1;
} else {
value = environment.__proto__;
r0 = env1_29;
}
}
return r0;
}
function value_62862(a0) { // fn#62862, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:7008, offset: 0x01b6ad67, size: 44 bytes, params: 2, frame: 3
return a0 == null ? env1_29 : this.indices[a0] ?? env1_30;
}
function value_62863() { // fn#62863, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:7101, offset: 0x01b6ad93, size: 32 bytes, params: 1, frame: 3
return this.indices[env1_25] ?? env1_30;
}
function value_62864(a0) { // fn#62864, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:7194, offset: 0x01b6adb3, size: 71 bytes, params: 2, frame: 5
const indices = this.indices;
const value = environment.__proto__;
const property = indices[env1_25];
return ((property == null || property.result == null ? undefined : property.result.sections) ?? ({}))[a0] != null;
}
function value_62865(a0) { // fn#62865, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:7346, offset: 0x01b6ad67, size: 44 bytes, params: 2, frame: 3
return a0 == null ? env1_29 : this.indices[a0] ?? env1_30;
}
function value_62868(a0, {commandTypes, applicationCommands, text, builtIns}, a2) { // fn#62868, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:7582, offset: 0x01b6ae17, size: 774 bytes, params: 4, frame: 32
var r14;
var r2;
var r3;
var defaultImport;
var track;
var APPLICATION_COMMAND_CACHE_FETCH;
var Object;
let value = environment.__proto__;
if (UserStore.getCurrentUser() == null) {
return env1_28;
}
const channel = a0.type !== 'channel' ? undefined : a0.channel;
const contextState = this.getContextState(a0);
const userState = this.getUserState();
const applicationState = this.getApplicationState(a2.applicationId);
const applicationStates = this.getApplicationStates();
const permissionContext = (CommandPermissionContextModule).buildPermissionContext(channel,
commandTypes);
let r1 = channel == null || permissionContext?.hasBaseAccessPermissions === true;
const value11 = applicationCommands !== false;
if (a2.allowFetch) {
r14 = value11 && r1;
r14 = r14 && channel != null;
r14 = r14 && channelSupportsContextCommands(channel);
if (r14) {
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
track = defaultImport.track;
APPLICATION_COMMAND_CACHE_FETCH = AnalyticEvents.APPLICATION_COMMAND_CACHE_FETCH;
Object = global.Object;
Reflect.apply(track, defaultImport, [APPLICATION_COMMAND_CACHE_FETCH, {miss: contextState.result == null,
size: Object.keys(env1_34.indices).length}]);
if (shouldFetch(contextState) && channel != null) {
if (channel.guild_id != null) {
(require(7865) /* metro dependency 7865: ApplicationCommandIndexActionCreators */).requestApplicationCommandIndex({type: 'guild',
guildId: channel.guild_id});
r2 = true;
} else {
(require(7865) /* metro dependency 7865: ApplicationCommandIndexActionCreators */).requestApplicationCommandIndex({type: 'channel',
channelId: channel.id});
r2 = true;
}
} else {
r2 = false;
}
r1 = r2;
} else {
r1 = false;
}
if (shouldFetch(userState)) {
(require(7865) /* metro dependency 7865: ApplicationCommandIndexActionCreators */).requestApplicationCommandIndex({type: 'user'});
r1 = true;
}
r2 = shouldFetch(applicationState) && a2.applicationId != null;
if (r2) {
(require(7865) /* metro dependency 7865: ApplicationCommandIndexActionCreators */).requestApplicationCommandIndex({type: 'application',
applicationId: a2.applicationId});
r1 = true;
}
r3 = r1;
} else {
r3 = false;
}
const queryIndexBinding = queryIndex;
const object = {permissionContext: permissionContext};
object.text = text;
object.allowApplicationCommands = value11;
object.builtIns = builtIns;
object.scoreMethod = a2.scoreMethod;
object.allowEmptySections = a2.allowEmptySections;
object.contextState = contextState;
object.userState = userState;
object.applicationStates = a2.allowApplicationState ? applicationStates : new global.Map();
object.sortOptions = a2.sortOptions;
object.singleApplicationId = a2.applicationId;
object.installOnDemand = a2.installOnDemand;
value = queryIndexBinding(object);
value.loading = value.loading || r3;
return value;
}
function value_62869(a0, a1) { // fn#62869, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:8949, offset: 0x01b6b11d, size: 186 bytes, params: 3, frame: 19
var r2;
var query;
var object;
var object2;
const channel = ChannelStore.getChannel(a1);
if (channel != null) {
query = this.query;
r2 = channel != null ? {channel: channel, type: 'channel'} : {type: 'contextless'};
object = {};
object.commandTypes = [(require(1909) /* metro dependency 1909: Server */).ApplicationCommandType.CHAT];
object2 = {placeholderCount: 5};
object2.scoreMethod = (require(7869) /* metro dependency 7869: ApplicationCommandQueryTypes */).ScoreMethod.COMMAND_ONLY;
object2.applicationId = a0;
object2.allowFetch = true;
Reflect.apply(query, this, [r2, object, object2]);
}
}
}
function CONNECTION_OPEN_62870() { // fn#62870, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:9338, offset: 0x01b6b1d7, size: 143 bytes, params: 1, frame: 14
var r1;
var r3;
var property;
var value4;
var value7;
var value8;
const Object = global.Object;
const value2 = Object.values(env0_34.indices);
let length = value2.length;
const value3 = 0;
if (value3 < length) {
for (r1 = value3; true; r1 = value4) {
property = value2[r1];
property.serverVersion = env0_26;
value4 = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1;
length = value2.length;
if (!(value4 < length)) {
break;
}
}
}
const value5 = _createForOfIteratorHelperLoose_62805(items2);
const value6 = value5();
let done = value6.done;
if (!done) {
for (r3 = value6; true; r3 = value8) {
value7 = r3.value;
APPLICATION_COMMAND_INDEX_FETCH_SUCCESS(value7);
value8 = value5();
done = value8.done;
if (done) {
break;
}
}
}
items2 = [];
}
function APPLICATION_COMMAND_INDEX_FETCH_REQUEST({target}) { // fn#62871, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:9633, offset: 0x01b6b266, size: 70 bytes, params: 2, frame: 14
if (shouldFetch(env0_34.indices[getIndexKey(target)] ?? env0_30)) {
updateIndexAndFetchApplicationCommandIndex(target);
}
}
function APPLICATION_COMMAND_INDEX_FETCH_FAILURE({target}) { // fn#62872, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:9883, offset: 0x01b6b2ac, size: 74 bytes, params: 2, frame: 15
const updateIndexBinding = updateIndex;
const object2 = {fetching: false};
const Date = global.Date;
object2.retryAfter = Date.now() + 5000;
updateIndexBinding(target, {fetchState: object2});
}
function APPLICATION_COMMAND_EXECUTE_BAD_VERSION({applicationId, channelId, guildId}) { // fn#62873, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:10032, offset: 0x01b6b2f6, size: 227 bytes, params: 2, frame: 17
let binding = env0_34;
if (binding.hasContextStateApplication({applicationId: applicationId, channelId: channelId, guildId: guildId})) {
updateIndex(guildId != null ? {type: 'guild', guildId: guildId} : {type: 'channel', channelId: channelId},
{serverVersion: env0_26});
}
binding = env0_34;
if (binding.hasUserStateApplication(applicationId)) {
updateIndex({type: 'user'}, {serverVersion: env0_26});
}
binding = env0_34;
if (binding.hasApplicationState(applicationId)) {
updateIndex({type: 'application', applicationId: applicationId}, {serverVersion: env0_26});
}
}
function GUILD_APPLICATION_COMMAND_INDEX_UPDATE({guildId, version}) { // fn#62876, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:10772, offset: 0x01b6b42f, size: 175 bytes, params: 2, frame: 22
var r4;
var propertyName;
var propertyName2;
var dMFromUserId;
const value3 = updateIndex({type: 'guild', guildId: guildId}, {serverVersion: version ?? env0_26});
const sectionIdsByBotId = value3 == null || value3.result == null ? undefined : value3.result.sectionIdsByBotId;
if (sectionIdsByBotId != null) {
for (propertyName in sectionIdsByBotId) {
dMFromUserId = ChannelStore.getDMFromUserId(propertyName);
if (dMFromUserId == null) {
r4 = propertyName2;
continue;
}
updateIndex({type: 'channel', channelId: dMFromUserId}, {serverVersion: env0_26});
r4 = propertyName2;
}
}
}
function useGuildIndexState(a0, a1) { // fn#62879, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:22576, offset: 0x01b6b53f, size: 166 bytes, params: 3, frame: 18
const env0_0 = a0;
const env0_1 = a1;
const [property, env0_3] = Module00057(ReactModule.useState(true), 2);
const value4 = (FluxModule).useStateFromStoresObject([env0_34], _fun62880);
ReactModule.useEffect(_fun62881, [value4, a1, a0, property]);
return value4;
function _fun62880() { // fn#62880, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:22695, offset: 0x01b6b5e5, size: 36 bytes, params: 1, frame: 3
return env1_34.indices[env0_0] ?? env1_30;
}
function _fun62881() { // fn#62881, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:22763, offset: 0x01b6b609, size: 220 bytes, params: 1, frame: 20
var value3;
var defaultImport;
var track;
var APPLICATION_COMMAND_CACHE_FETCH;
var Object;
var moduleValue;
let binding = env0_2;
if (binding && env0_0 != null) {
if (require) {
value3 = environment.__proto__;
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
track = defaultImport.track;
APPLICATION_COMMAND_CACHE_FETCH = AnalyticEvents.APPLICATION_COMMAND_CACHE_FETCH;
binding = Module00057;
Object = global.Object;
Reflect.apply(track, defaultImport, [APPLICATION_COMMAND_CACHE_FETCH, {miss: binding.result == null,
size: Object.keys(env1_34.indices).length}]);
if (shouldFetch(binding)) {
moduleValue = require(7865) /* metro dependency 7865: ApplicationCommandIndexActionCreators */;
moduleValue.requestApplicationCommandIndex({type: 'guild', guildId: env0_0});
}
}
env0_3(false);
}
}
}
function useDiscoveryState(a0, a1, a2, a3) { // fn#62882, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:23059, offset: 0x01b6b6e5, size: 213 bytes, params: 5, frame: 23
const env0_0 = a0;
const env0_1 = a1;
const env0_2 = a3;
const {descriptors, commands, sectionedCommands, loading} = useQueryState(a0, a2, a3);
const value3 = ReactModule.useMemo(_fun62883, [a0, a1]);
return ReactModule.useMemo(_fun62884, [loading, a3.includeFrecency,
(ApplicationCommandFrecencyHooksModule).useTopCommands(value3), commands,
descriptors, sectionedCommands, value3]);
function _fun62883() { // fn#62883, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:23198, offset: 0x01b6b7ba, size: 50 bytes, params: 1, frame: 4
return env0_0.type !== 'channel' ? undefined : {channel: env0_0.channel, guild: require};
}
function _fun62884() { // fn#62884, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:23312, offset: 0x01b6b7ec, size: 356 bytes, params: 1, frame: 21
var environment;
var r0;
var length;
var value3;
var splice;
var value4;
var value5;
var object;
const BUILT_IN_SECTIONS = (ApplicationCommandBuiltInsModule).BUILT_IN_SECTIONS;
var FRECENCY;
var items3;
var concat;
var items2;
if (importAll.includeFrecency) {
length = Module00017.length;
if (length === 0) {
return {descriptors: descriptors, commands: commands, sectionedCommands: sectionedCommands,
loading: loading};
}
value3 = commands.filter(_fun62885).sort(_fun62886);
splice = value3.splice;
value4 = environment.__proto__;
value5 = Reflect.apply(splice, value3, [0, DISCOVERY_COMMANDS_FRECENCY_LIMIT]);
length = value5.length;
if (length === 0) {
r0 = {descriptors: descriptors, commands: commands, sectionedCommands: sectionedCommands, loading: loading};
} else {
object = {};
FRECENCY = BuiltInSectionId.FRECENCY;
items3 = [BUILT_IN_SECTIONS[FRECENCY]];
arraySpread(items3, descriptors, 1, undefined);
object.descriptors = items3;
concat = value5.concat;
object.commands = Reflect.apply(concat, value5, [commands]);
FRECENCY = BuiltInSectionId.FRECENCY;
items2 = [{section: BUILT_IN_SECTIONS[FRECENCY], data: value5}];
arraySpread(items2, sectionedCommands, 1, concat);
object.sectionedCommands = items2;
object.loading = loading;
r0 = object;
}
return r0;
}
return {descriptors: descriptors, commands: commands, sectionedCommands: sectionedCommands, loading: loading};
function _fun62885({id}) { // fn#62885, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:23432, offset: 0x01b6b950, size: 27 bytes, params: 2, frame: 11
return env1_8.includes(id);
}
function _fun62886(a0, a1) { // fn#62886, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:23460, offset: 0x01b6b96b, size: 54 bytes, params: 3, frame: 14
let applicationCommandFrecencyStoreBinding = ApplicationCommandFrecencyStore;
let getScoreWithoutLoadingLatest = applicationCommandFrecencyStoreBinding.getScoreWithoutLoadingLatest;
const binding = env1_7;
const value3 = Reflect.apply(getScoreWithoutLoadingLatest, applicationCommandFrecencyStoreBinding, [binding, a0]);
applicationCommandFrecencyStoreBinding = ApplicationCommandFrecencyStore;
getScoreWithoutLoadingLatest = applicationCommandFrecencyStoreBinding.getScoreWithoutLoadingLatest;
return Reflect.apply(getScoreWithoutLoadingLatest, applicationCommandFrecencyStoreBinding, [binding, a1]) - value3;
}
}
}
function getSection(a0, a1) { // fn#62888, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8039:24020, offset: 0x01b6b9b8, size: 593 bytes, params: 3, frame: 25
var r8;
var r5;
var r6;
var object;
var descriptor;
var Object;
var commands;
var properties;
var propertyName;
var commands2;
var property4;
var properties4;
var properties5;
var propertyName3;
var commands3;
var commands4;
var property5;
var value;
const BUILT_IN = BuiltInSectionId.BUILT_IN;
if (a1 === BUILT_IN) {
object = {};
object.descriptor = (require(7871) /* metro dependency 7871: ApplicationCommandBuiltIns */).BUILT_IN_SECTIONS[BuiltInSectionId.BUILT_IN];
value = require(7871) /* metro dependency 7871: ApplicationCommandBuiltIns */;
object.sectionCommands = value.getBuiltInCommands([(require(1909) /* metro dependency 1909: Server */).ApplicationCommandType.CHAT],
true, false);
object.isGuildInstalled = true;
object.isUserInstalled = true;
return object;
}
let binding = env0_34;
const contextState = binding.getContextState(a0);
const userState = env0_34.getUserState();
let result = contextState.result;
const value4 = undefined;
const r1 = (result == null ? value4 : result.sections) ?? ({});
result = userState.result;
let r0 = (result == null ? value4 : result.sections) ?? ({});
const property = r1[a1];
const property2 = r0[a1];
binding = env0_34;
const getApplicationState = binding.getApplicationState;
result = Reflect.apply(getApplicationState, binding, [a1]).result;
r0 = result == null || result.sections == null ? value4 : result.sections[a1];
if (property == null) {
if (property != null) {
descriptor = property.descriptor;
Object = global.Object;
r5 = Object.values(property.commands);
r6 = descriptor;
} else if (property2 != null) {
descriptor = property2.descriptor;
Object = global.Object;
r5 = Object.values(property2.commands);
r6 = descriptor;
} else if (r0 != null) {
descriptor = r0.descriptor;
Object = global.Object;
r5 = Object.values(r0.commands);
r6 = descriptor;
} else {
r5 = value4;
r6 = value4;
}
} else if (property2 != null) {
descriptor = property2.descriptor;
object = [];
commands = property2.commands;
for (propertyName in commands) {
commands2 = property2.commands;
property4 = commands2[propertyName];
object.push(property4);
}
commands = property.commands;
properties = Object.keys(commands);
properties4 = 0;
properties5 = properties.length;
if (properties === value4) {
r5 = object;
r6 = descriptor;
} else {
r8 = properties4;
while (true) {
propertyName = properties[r8];
propertyName3 = r8 + 1;
if (propertyName === value4) {
r5 = object;
r6 = descriptor;
break;
}
commands3 = property2.commands;
if (propertyName in commands3) {
r8 = propertyName3;
continue;
}
commands4 = property.commands;
property5 = commands4[propertyName];
object.push(property5);
r8 = propertyName3;
}
}
} else if (property != null) {
descriptor = property.descriptor;
Object = global.Object;
r5 = Object.values(property.commands);
r6 = descriptor;
} else if (property2 != null) {
descriptor = property2.descriptor;
Object = global.Object;
r5 = Object.values(property2.commands);
r6 = descriptor;
} else if (r0 != null) {
descriptor = r0.descriptor;
Object = global.Object;
r5 = Object.values(r0.commands);
r6 = descriptor;
} else {
r5 = value4;
r6 = value4;
}
return {descriptor: r6, sectionCommands: r5, isGuildInstalled: property != null, isUserInstalled: property2 != null};
}
}
global.__d(_fun62801, 7861, [57, 6, 7, 15, 17, 18, 5, 31, 7862, 1949, 1226, 1379, 1945, 1867, 1878, 7863, 5066, 661,
3, 7864, 7865, 5065, 5067, 6593, 44, 7866, 683, 1909, 7869, 566, 694, 7870, 7871, 1362, 8039, 5068,
2]) /* metro module 7861, dependencies: [57, 6, 7, 15, 17, 18, 5, 31, 7862, 1949, 1226, 1379, 1945, 1867, 1878, 7863, 5066, 661, 3, 7864, 7865, 5065, 5067, 6593, 44, 7866, 683, 1909, 7869, 566, 694, 7870, 7871, 1362, 8039, 5068, 2] */;