988 lines
45 KiB
TypeScript
988 lines
45 KiB
TypeScript
/* Metro module 5065; source: modules/application_commands/ApplicationCommandUtils.tsx; dependencies: [1383, 4645, 5066, 661, 482, 5067, 1909, 5068, 483, 22, 44, 24, 4863, 2] */
|
|
import Module00022 from '../../by-id/module-00022.js'; /* Metro dependency 22 */
|
|
import Module00024 from '../../by-id/module-00024.js'; /* Metro dependency 24 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../../external/discord_common/js/shared/Constants.tsx'; /* Metro dependency 482 */
|
|
import * as ChannelRecordModule from '../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
|
|
import * as ServerModule from '../../flow/Server.tsx'; /* Metro dependency 1909 */
|
|
import * as DraftStoreModule from '../../stores/DraftStore.tsx'; /* Metro dependency 4645 */
|
|
import * as AppAnalyticsUtilsModule from '../app_analytics/AppAnalyticsUtils.tsx'; /* Metro dependency 4863 */
|
|
import * as ApplicationCommandConstantsModule from './ApplicationCommandConstants.tsx'; /* Metro dependency 5066 */
|
|
import * as IntegrationPermissionUtilsModule from '../guild_settings/integrations/permission/IntegrationPermissionUtils.tsx'; /* Metro dependency 5067 */
|
|
import * as ApplicationCommandTypesModule from './ApplicationCommandTypes.tsx'; /* Metro dependency 5068 */
|
|
|
|
function _fun43792(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#43792, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:6, offset: 0x0115e828, size: 488 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_43795 = 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 buildCommand2 = buildCommand;
|
|
const mapOptions = function(a0) {
|
|
return a0?.map(_fun43801);
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ApplicationCommandConstantsModule;
|
|
const env0_6 = value.BuiltInSectionId;
|
|
const env0_7 = value.SUB_COMMAND_KEY_SEPARATOR;
|
|
value = require(661) /* metro dependency 661: Constants */;
|
|
const env0_8 = value.AnalyticEvents;
|
|
const env0_9 = value.ID_REGEX;
|
|
value = importAll(483) /* metro dependency 483: BigFlagUtils */;
|
|
value = value.deserialize(0);
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/application_commands/ApplicationCommandUtils.tsx');
|
|
exports.buildCommand = buildCommand2;
|
|
exports.buildApplicationCommands = buildApplicationCommands;
|
|
exports.applicationPermissionsList = function(a0) {
|
|
return a0?.reduce(_fun43810, []);
|
|
};
|
|
exports.isSnowflake = function(a0) {
|
|
return ID_REGEX.test(a0.trim());
|
|
};
|
|
exports.getMatchingGroupCommands = getMatchingGroupCommands;
|
|
exports.getApplicationCommandOptionQueryOptions = getApplicationCommandOptionQueryOptions;
|
|
exports.allChannelsSentinel = allChannelsSentinel;
|
|
exports.canUseApplicationCommands = canUseApplicationCommands;
|
|
exports.DISABLED_BY_DEFAULT_PERMISSION_FLAG = value;
|
|
exports.hasAccess = hasAccess;
|
|
exports.getCommandAttachmentDraftType = getCommandAttachmentDraftType;
|
|
exports.getCommandTriggerSection = getCommandTriggerSection;
|
|
exports.getApplicationCommandSection = getApplicationCommandSection;
|
|
exports.extractInteractionDataProps = extractInteractionDataProps;
|
|
exports.trackCommandSelected = trackCommandSelected;
|
|
exports.getInitialInteractionMetadata = function({interactionMetadata}) {
|
|
var value = null;
|
|
return value == interactionMetadata ? value : 'triggering_interaction_metadata' in interactionMetadata ? interactionMetadata.triggering_interaction_metadata : interactionMetadata;
|
|
};
|
|
exports.hasCommandIndexForApp = function(a0, {result}) {
|
|
var r2;
|
|
r2 = result?.sections;
|
|
return r2 != null && a0 in r2;
|
|
};
|
|
function _createForOfIteratorHelperLoose_43793(a0, a1) { // fn#43793, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:277, offset: 0x0115ea10, 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 _fun43794;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_43795(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_43795(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_43795(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun43794;
|
|
}
|
|
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 _fun43794() { // fn#43794, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:848, 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 buildCommand({rootCommand, command, applicationId, subCommandPath, useKeyedPermissions}) { // fn#43796, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:1187, offset: 0x0115eb82, size: 662 bytes, params: 2, frame: 25
|
|
var r2;
|
|
var r5;
|
|
var r10;
|
|
var r14;
|
|
var r8;
|
|
var moduleValue;
|
|
let value = undefined;
|
|
if (rootCommand.permissions != null && rootCommand.permissions.length > 0) {
|
|
if (useKeyedPermissions) {
|
|
moduleValue = require(dependencyMap[5]);
|
|
r2 = moduleValue.keyPermissions(rootCommand.permissions);
|
|
} else {
|
|
rootCommand.permissions.forEach(_fun43797);
|
|
r2 = {};
|
|
}
|
|
r5 = r2;
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
const value6 = (subCommandPath ?? []).map(function(a0) {
|
|
return a0.name;
|
|
});
|
|
const value7 = (subCommandPath ?? []).map(function(a0) {
|
|
return a0.displayName;
|
|
});
|
|
const object = {};
|
|
object.version = rootCommand.version;
|
|
object.guildId = rootCommand.guild_id;
|
|
const items4 = [rootCommand.id];
|
|
arraySpread(items4, value6, 1, items4);
|
|
object.id = items4.join(SUB_COMMAND_KEY_SEPARATOR);
|
|
const items2 = [rootCommand.name];
|
|
arraySpread(items2, value6, 1, items4);
|
|
object.untranslatedName = items2.join(' ');
|
|
object.serverLocalizedName = command.name_localized;
|
|
object.applicationId = applicationId;
|
|
const type = rootCommand.type;
|
|
if (type != null) {
|
|
r10 = type;
|
|
r14 = items4;
|
|
} else {
|
|
r10 = require(dependencyMap[6]).ApplicationCommandType.CHAT;
|
|
r14 = dependencyMap;
|
|
}
|
|
object.type = r10;
|
|
const ApplicationCommandInputType = require(dependencyMap[7]).ApplicationCommandInputType;
|
|
const BOT = ApplicationCommandInputType.BOT;
|
|
object.inputType = BOT;
|
|
object.untranslatedDescription = command.description;
|
|
object.options = mapOptions(command.options);
|
|
object.rootCommand = rootCommand;
|
|
object.subCommandPath = subCommandPath;
|
|
if (rootCommand.default_member_permissions == null) {
|
|
r8 = value;
|
|
} else {
|
|
value = importAll(dependencyMap[8]);
|
|
value = value.deserialize(rootCommand.default_member_permissions);
|
|
r8 = value;
|
|
}
|
|
object.defaultMemberPermissions = r8;
|
|
object.dmPermission = rootCommand.dm_permission;
|
|
object.permissions = r5;
|
|
const items3 = [rootCommand.name_localized ?? rootCommand.name];
|
|
arraySpread(items3, value7, 1, r14);
|
|
object.displayName = items3.join(' ');
|
|
object.displayDescription = command.description_localized ?? command.description;
|
|
object.nsfw = rootCommand.nsfw;
|
|
object.contexts = rootCommand.contexts;
|
|
object.integration_types = rootCommand.integration_types;
|
|
object.global_popularity_rank = rootCommand.global_popularity_rank;
|
|
object.handler = rootCommand.handler;
|
|
return object;
|
|
function _fun43797(a0) { // fn#43797, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:1421, offset: 0x0115ee18, size: 23 bytes, params: 2, frame: 3
|
|
env0_0[a0.id] = a0;
|
|
}
|
|
|
|
}
|
|
|
|
function mapOptions(a0) { // fn#43800, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:2323, offset: 0x0115ee39, size: 33 bytes, params: 2, frame: 12
|
|
return a0?.map(_fun43801);
|
|
function _fun43801(a0) { // fn#43801, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:2375, offset: 0x0115ee5a, size: 502 bytes, params: 2, frame: 17
|
|
var r1;
|
|
var r0;
|
|
var object;
|
|
var object2;
|
|
var object3;
|
|
const object4 = {};
|
|
copyDataProperties(object4, a0, undefined);
|
|
object4['choices'] = a0.choices?.map(function(a0) {
|
|
var r3;
|
|
var object = {};
|
|
copyDataProperties(object, a0, r3);
|
|
object['displayName'] = a0.name_localized ?? a0.name;
|
|
return object;
|
|
});
|
|
object4['options'] = mapOptions(a0.options);
|
|
object4['serverLocalizedName'] = a0.name_localized;
|
|
object4['displayName'] = a0.name_localized ?? a0.name;
|
|
object4['displayDescription'] = a0.description_localized ?? a0.description;
|
|
const type = a0.type;
|
|
const ApplicationCommandOptionType = (ServerModule).ApplicationCommandOptionType;
|
|
const CHANNEL = ApplicationCommandOptionType.CHANNEL;
|
|
if (type !== CHANNEL) {
|
|
if (a0.type === ApplicationCommandOptionType.NUMBER) {
|
|
if ('min_value' in a0) {
|
|
object = {};
|
|
copyDataProperties(object, object4, 6);
|
|
object['minValue'] = a0.min_value;
|
|
object['maxValue'] = a0.max_value;
|
|
r0 = object;
|
|
} else if ('max_value' in a0) {
|
|
object = {};
|
|
copyDataProperties(object, object4, 6);
|
|
object['minValue'] = a0.min_value;
|
|
object['maxValue'] = a0.max_value;
|
|
r0 = object;
|
|
} else {
|
|
if (a0.type !== ApplicationCommandOptionType.STRING) {
|
|
r1 = object4;
|
|
} else if ('min_length' in a0) {
|
|
object2 = {};
|
|
copyDataProperties(object2, object4, 6);
|
|
object2['minLength'] = a0.min_length;
|
|
object2['maxLength'] = a0.max_length;
|
|
r1 = object2;
|
|
} else if ('max_length' in a0) {
|
|
object2 = {};
|
|
copyDataProperties(object2, object4, 6);
|
|
object2['minLength'] = a0.min_length;
|
|
object2['maxLength'] = a0.max_length;
|
|
r1 = object2;
|
|
} else {
|
|
r1 = object4;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
} else if (a0.type !== ApplicationCommandOptionType.INTEGER) {
|
|
if (a0.type !== ApplicationCommandOptionType.STRING) {
|
|
r1 = object4;
|
|
} else if ('min_length' in a0) {
|
|
object2 = {};
|
|
copyDataProperties(object2, object4, 6);
|
|
object2['minLength'] = a0.min_length;
|
|
object2['maxLength'] = a0.max_length;
|
|
r1 = object2;
|
|
} else if ('max_length' in a0) {
|
|
object2 = {};
|
|
copyDataProperties(object2, object4, 6);
|
|
object2['minLength'] = a0.min_length;
|
|
object2['maxLength'] = a0.max_length;
|
|
r1 = object2;
|
|
} else {
|
|
r1 = object4;
|
|
}
|
|
r0 = r1;
|
|
} else if ('min_value' in a0) {
|
|
object = {};
|
|
copyDataProperties(object, object4, 6);
|
|
object['minValue'] = a0.min_value;
|
|
object['maxValue'] = a0.max_value;
|
|
r0 = object;
|
|
} else if ('max_value' in a0) {
|
|
object = {};
|
|
copyDataProperties(object, object4, 6);
|
|
object['minValue'] = a0.min_value;
|
|
object['maxValue'] = a0.max_value;
|
|
r0 = object;
|
|
} else {
|
|
if (a0.type !== ApplicationCommandOptionType.STRING) {
|
|
r1 = object4;
|
|
} else if ('min_length' in a0) {
|
|
object2 = {};
|
|
copyDataProperties(object2, object4, 6);
|
|
object2['minLength'] = a0.min_length;
|
|
object2['maxLength'] = a0.max_length;
|
|
r1 = object2;
|
|
} else if ('max_length' in a0) {
|
|
object2 = {};
|
|
copyDataProperties(object2, object4, 6);
|
|
object2['minLength'] = a0.min_length;
|
|
object2['maxLength'] = a0.max_length;
|
|
r1 = object2;
|
|
} else {
|
|
r1 = object4;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
} else if ('channel_types' in a0) {
|
|
object3 = {};
|
|
copyDataProperties(object3, object4, 6);
|
|
object3['channelTypes'] = a0.channel_types;
|
|
r0 = object3;
|
|
} else if (a0.type === ApplicationCommandOptionType.NUMBER) {
|
|
if ('min_value' in a0) {
|
|
object = {};
|
|
copyDataProperties(object, object4, 6);
|
|
object['minValue'] = a0.min_value;
|
|
object['maxValue'] = a0.max_value;
|
|
r0 = object;
|
|
} else if ('max_value' in a0) {
|
|
object = {};
|
|
copyDataProperties(object, object4, 6);
|
|
object['minValue'] = a0.min_value;
|
|
object['maxValue'] = a0.max_value;
|
|
r0 = object;
|
|
} else {
|
|
if (a0.type !== ApplicationCommandOptionType.STRING) {
|
|
r1 = object4;
|
|
} else if ('min_length' in a0) {
|
|
object2 = {};
|
|
copyDataProperties(object2, object4, 6);
|
|
object2['minLength'] = a0.min_length;
|
|
object2['maxLength'] = a0.max_length;
|
|
r1 = object2;
|
|
} else if ('max_length' in a0) {
|
|
object2 = {};
|
|
copyDataProperties(object2, object4, 6);
|
|
object2['minLength'] = a0.min_length;
|
|
object2['maxLength'] = a0.max_length;
|
|
r1 = object2;
|
|
} else {
|
|
r1 = object4;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
} else if (a0.type !== ApplicationCommandOptionType.INTEGER) {
|
|
if (a0.type !== ApplicationCommandOptionType.STRING) {
|
|
r1 = object4;
|
|
} else if ('min_length' in a0) {
|
|
object2 = {};
|
|
copyDataProperties(object2, object4, 6);
|
|
object2['minLength'] = a0.min_length;
|
|
object2['maxLength'] = a0.max_length;
|
|
r1 = object2;
|
|
} else if ('max_length' in a0) {
|
|
object2 = {};
|
|
copyDataProperties(object2, object4, 6);
|
|
object2['minLength'] = a0.min_length;
|
|
object2['maxLength'] = a0.max_length;
|
|
r1 = object2;
|
|
} else {
|
|
r1 = object4;
|
|
}
|
|
r0 = r1;
|
|
} else if ('min_value' in a0) {
|
|
object = {};
|
|
copyDataProperties(object, object4, 6);
|
|
object['minValue'] = a0.min_value;
|
|
object['maxValue'] = a0.max_value;
|
|
r0 = object;
|
|
} else if ('max_value' in a0) {
|
|
object = {};
|
|
copyDataProperties(object, object4, 6);
|
|
object['minValue'] = a0.min_value;
|
|
object['maxValue'] = a0.max_value;
|
|
r0 = object;
|
|
} else {
|
|
if (a0.type !== ApplicationCommandOptionType.STRING) {
|
|
r1 = object4;
|
|
} else if ('min_length' in a0) {
|
|
object2 = {};
|
|
copyDataProperties(object2, object4, 6);
|
|
object2['minLength'] = a0.min_length;
|
|
object2['maxLength'] = a0.max_length;
|
|
r1 = object2;
|
|
} else if ('max_length' in a0) {
|
|
object2 = {};
|
|
copyDataProperties(object2, object4, 6);
|
|
object2['minLength'] = a0.min_length;
|
|
object2['maxLength'] = a0.max_length;
|
|
r1 = object2;
|
|
} else {
|
|
r1 = object4;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
}
|
|
|
|
function buildSubCommands({rootCommand, command, applicationId, subCommandPath, useKeyedPermissions}) { // fn#43803, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:3168, offset: 0x0115f07b, size: 829 bytes, params: 2, frame: 32
|
|
var environment;
|
|
var r12;
|
|
var r19;
|
|
var r17;
|
|
var r21;
|
|
var r7;
|
|
var type;
|
|
var value;
|
|
const ApplicationCommandOptionType = (ServerModule).ApplicationCommandOptionType;
|
|
var SUB_COMMAND;
|
|
var SUB_COMMAND_GROUP;
|
|
var options;
|
|
var length;
|
|
var buildCommandBinding;
|
|
var push;
|
|
var buildSubCommandsBinding;
|
|
var object;
|
|
var concat;
|
|
var object2;
|
|
var name;
|
|
var name_localized;
|
|
var property;
|
|
var subCommands;
|
|
var items3;
|
|
var value4;
|
|
var object3;
|
|
var object4;
|
|
var value6;
|
|
if (command.hasOwnProperty('id')) {
|
|
options = command.options;
|
|
reducibleJoin8: while (true) {
|
|
reducibleJoin27: while (true) {
|
|
if (options == null) {
|
|
break reducibleJoin27;
|
|
}
|
|
options = command.options;
|
|
length = options.length;
|
|
if (length === 0) {
|
|
break reducibleJoin27;
|
|
}
|
|
break reducibleJoin8;
|
|
}
|
|
value = environment;
|
|
value = buildCommand({rootCommand: rootCommand, command: command, applicationId: applicationId,
|
|
subCommandPath: subCommandPath, useKeyedPermissions: useKeyedPermissions});
|
|
return [value];
|
|
}
|
|
} else {
|
|
type = command.type;
|
|
value = environment;
|
|
SUB_COMMAND = ApplicationCommandOptionType.SUB_COMMAND;
|
|
reducibleJoin8: while (true) {
|
|
if (type === SUB_COMMAND) {
|
|
break reducibleJoin8;
|
|
}
|
|
type = command.type;
|
|
SUB_COMMAND_GROUP = ApplicationCommandOptionType.SUB_COMMAND_GROUP;
|
|
if (type !== SUB_COMMAND_GROUP) {
|
|
options = command.options;
|
|
if (options != null) {
|
|
options = command.options;
|
|
length = options.length;
|
|
reducibleJoin5: while (true) {
|
|
if (length !== 0) {
|
|
break reducibleJoin8;
|
|
}
|
|
break reducibleJoin5;
|
|
}
|
|
}
|
|
value = buildCommand({rootCommand: rootCommand, command: command, applicationId: applicationId,
|
|
subCommandPath: subCommandPath, useKeyedPermissions: useKeyedPermissions});
|
|
return [value];
|
|
}
|
|
break reducibleJoin8;
|
|
}
|
|
}
|
|
const items2 = [];
|
|
if (command.options != null) {
|
|
value = command.options.filter(function({type}) {
|
|
return type === require(dependencyMap[6]).ApplicationCommandOptionType.SUB_COMMAND_GROUP;
|
|
});
|
|
length = value.length;
|
|
if (0 < length) {
|
|
r12 = 0;
|
|
reducibleLoop10: while (true) {
|
|
push = items2.push;
|
|
buildSubCommandsBinding = buildSubCommands;
|
|
object = {rootCommand: rootCommand, command: value[r12], applicationId: applicationId};
|
|
reducibleJoin12: while (true) {
|
|
if (subCommandPath != null) {
|
|
r19 = subCommandPath;
|
|
break reducibleJoin12;
|
|
}
|
|
r19 = [];
|
|
break reducibleJoin12;
|
|
}
|
|
concat = r19.concat;
|
|
object2 = {};
|
|
name = value[r12].name;
|
|
object2.name = name;
|
|
SUB_COMMAND_GROUP = ApplicationCommandOptionType.SUB_COMMAND_GROUP;
|
|
object2.type = SUB_COMMAND_GROUP;
|
|
name_localized = value[r12].name_localized;
|
|
reducibleJoin14: while (true) {
|
|
if (name_localized != null) {
|
|
r17 = name_localized;
|
|
r21 = require;
|
|
break reducibleJoin14;
|
|
}
|
|
property = value[r12];
|
|
name = property.name;
|
|
r17 = name;
|
|
r21 = property;
|
|
break reducibleJoin14;
|
|
}
|
|
object2.displayName = r17;
|
|
object.subCommandPath = Reflect.apply(concat, r19, [[object2]]);
|
|
object.useKeyedPermissions = useKeyedPermissions;
|
|
subCommands = buildSubCommandsBinding(object);
|
|
items3 = [];
|
|
arraySpread(items3, subCommands, 0, r21);
|
|
apply(push, items3, items2, r21);
|
|
value4 = typeof r12 === 'bigint' ? r12 + 1n : +r12 + 1;
|
|
length = value.length;
|
|
if (value4 < length) {
|
|
r12 = value4;
|
|
continue reducibleLoop10;
|
|
}
|
|
break reducibleLoop10;
|
|
}
|
|
}
|
|
var value5 = command.options.filter(function({type}) {
|
|
return type === require(dependencyMap[6]).ApplicationCommandOptionType.SUB_COMMAND;
|
|
});
|
|
length = value5.length;
|
|
if (0 < length) {
|
|
r12 = 0;
|
|
reducibleLoop16: while (true) {
|
|
push = items2.push;
|
|
buildCommandBinding = buildCommand;
|
|
object3 = {rootCommand: rootCommand, command: value5[r12], applicationId: applicationId};
|
|
reducibleJoin18: while (true) {
|
|
if (subCommandPath != null) {
|
|
r19 = subCommandPath;
|
|
break reducibleJoin18;
|
|
}
|
|
r19 = [];
|
|
break reducibleJoin18;
|
|
}
|
|
concat = r19.concat;
|
|
object4 = {};
|
|
name = value5[r12].name;
|
|
object4.name = name;
|
|
SUB_COMMAND = ApplicationCommandOptionType.SUB_COMMAND;
|
|
object4.type = SUB_COMMAND;
|
|
name_localized = value5[r12].name_localized;
|
|
reducibleJoin20: while (true) {
|
|
if (name_localized != null) {
|
|
r17 = name_localized;
|
|
break reducibleJoin20;
|
|
}
|
|
name = value5[r12].name;
|
|
r17 = name;
|
|
break reducibleJoin20;
|
|
}
|
|
object4.displayName = r17;
|
|
object3.subCommandPath = Reflect.apply(concat, r19, [[object4]]);
|
|
object3.useKeyedPermissions = useKeyedPermissions;
|
|
Reflect.apply(push, items2, [buildCommandBinding(object3)]);
|
|
value6 = typeof r12 === 'bigint' ? r12 + 1n : +r12 + 1;
|
|
length = value5.length;
|
|
if (value6 < length) {
|
|
r12 = value6;
|
|
continue reducibleLoop16;
|
|
}
|
|
break reducibleLoop16;
|
|
}
|
|
}
|
|
value = value.length === 0;
|
|
reducibleJoin23: while (true) {
|
|
if (value) {
|
|
length = value5.length;
|
|
value = length === 0;
|
|
r7 = value;
|
|
break reducibleJoin23;
|
|
}
|
|
r7 = value;
|
|
break reducibleJoin23;
|
|
}
|
|
reducibleJoin25: while (true) {
|
|
if (r7) {
|
|
push = items2.push;
|
|
Reflect.apply(push, items2, [buildCommand({rootCommand: rootCommand, command: command,
|
|
applicationId: applicationId,
|
|
subCommandPath: subCommandPath, useKeyedPermissions: useKeyedPermissions})]);
|
|
break reducibleJoin25;
|
|
}
|
|
break reducibleJoin25;
|
|
}
|
|
}
|
|
return items2;
|
|
}
|
|
|
|
function hasAccessGivenPerms({userId, roles}, a1, a2) { // fn#43806, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:4696, offset: 0x0115f41e, size: 306 bytes, params: 4, frame: 27
|
|
var r11;
|
|
var r12;
|
|
var r5;
|
|
var permission;
|
|
var value7;
|
|
var moduleValue2;
|
|
var ROLE;
|
|
var value8;
|
|
let toPermissionKey = IntegrationPermissionUtilsModule.toPermissionKey;
|
|
const ApplicationCommandPermissionType = (ApplicationCommandTypesModule).ApplicationCommandPermissionType;
|
|
const USER = ApplicationCommandPermissionType.USER;
|
|
let property = a2[Reflect.apply(toPermissionKey, IntegrationPermissionUtilsModule, [userId, USER])];
|
|
if (property != null) {
|
|
return property.permission;
|
|
}
|
|
const value3 = _createForOfIteratorHelperLoose_43793(roles);
|
|
const value4 = value3();
|
|
let done = value4.done;
|
|
if (done) {
|
|
r5 = false;
|
|
} else {
|
|
r11 = false;
|
|
r12 = value4;
|
|
reducibleLoop2: while (true) {
|
|
value7 = r12.value;
|
|
moduleValue2 = IntegrationPermissionUtilsModule;
|
|
toPermissionKey = moduleValue2.toPermissionKey;
|
|
ROLE = ApplicationCommandPermissionType.ROLE;
|
|
property = a2[Reflect.apply(toPermissionKey, moduleValue2, [value7, ROLE])];
|
|
if (property != null) {
|
|
permission = property.permission;
|
|
reducibleJoin4: while (true) {
|
|
if (permission) {
|
|
return true;
|
|
}
|
|
r11 = true;
|
|
break reducibleJoin4;
|
|
}
|
|
}
|
|
value8 = value3();
|
|
done = value8.done;
|
|
if (done) {
|
|
r5 = r11;
|
|
break reducibleLoop2;
|
|
}
|
|
r12 = value8;
|
|
continue reducibleLoop2;
|
|
}
|
|
}
|
|
if (r5) {
|
|
return false;
|
|
}
|
|
toPermissionKey = IntegrationPermissionUtilsModule.toPermissionKey;
|
|
ROLE = ApplicationCommandPermissionType.ROLE;
|
|
property = a2[Reflect.apply(toPermissionKey, IntegrationPermissionUtilsModule, [a1, ROLE])];
|
|
reducibleJoin9: while (true) {
|
|
if (property != null) {
|
|
permission = property.permission;
|
|
break reducibleJoin9;
|
|
}
|
|
permission = null;
|
|
break reducibleJoin9;
|
|
}
|
|
return permission;
|
|
}
|
|
|
|
function buildApplicationCommands(a0, a1) { // fn#43807, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:5343, offset: 0x0115f550, size: 56 bytes, params: 3, frame: 13
|
|
const env0_0 = a1;
|
|
return (importDefault(22) /* metro dependency 22 */).flatMap(a0, function(a0) {
|
|
importDefault(dependencyMap[10])(a0.id != null, 'Missing command id');
|
|
return buildSubCommands({rootCommand: a0, command: a0, applicationId: a0.application_id,
|
|
subCommandPath: undefined,
|
|
useKeyedPermissions: require});
|
|
});
|
|
}
|
|
|
|
function applicationPermissionsList(a0) { // fn#43809, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:5611, offset: 0x0115f5ed, size: 39 bytes, params: 2, frame: 14
|
|
return a0?.reduce(function(a0, a1) {
|
|
if (a1.applicationCommandPermissions != null) {
|
|
a0.push({id: a1.id, permissions: a1.applicationCommandPermissions});
|
|
}
|
|
return a0;
|
|
}, []);
|
|
}
|
|
|
|
function getMatchingGroupCommands(a0, a1, a2, a3) { // fn#43812, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:5892, offset: 0x0115f668, size: 90 bytes, params: 5, frame: 14
|
|
const env0_0 = a1;
|
|
const env0_1 = a2;
|
|
let value = Module00022;
|
|
value = value(a0);
|
|
value.forEach(_fun43813);
|
|
return [].slice(0, a3);
|
|
function _fun43813(a0) { // fn#43813, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:5973, offset: 0x0115f6c2, size: 82 bytes, params: 2, frame: 14
|
|
if (require.test(a0.displayName) && (a0.predicate == null || a0.predicate(importDefault))) {
|
|
env0_2.push(a0);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function getApplicationCommandOptionQueryOptions(a0) { // fn#43814, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:6107, offset: 0x0115f714, size: 309 bytes, params: 2, frame: 18
|
|
let type = a0.type;
|
|
const ApplicationCommandOptionType = (ServerModule).ApplicationCommandOptionType;
|
|
const STRING = ApplicationCommandOptionType.STRING;
|
|
const value2 = type === STRING;
|
|
type = a0.type;
|
|
const CHANNEL = ApplicationCommandOptionType.CHANNEL;
|
|
const value3 = type === CHANNEL;
|
|
type = a0.type;
|
|
const USER = ApplicationCommandOptionType.USER;
|
|
const r3 = type === USER || a0.type === ApplicationCommandOptionType.MENTIONABLE;
|
|
type = a0.type;
|
|
const ROLE = ApplicationCommandOptionType.ROLE;
|
|
const r2 = type === ROLE || a0.type === ApplicationCommandOptionType.MENTIONABLE;
|
|
return {canMentionEveryone: value2 || r2, canMentionHere: value2, canMentionChannels: value2 || value3,
|
|
canMentionUsers: value2 || r3, canMentionRoles: value2 || r2, canMentionAnyGuildUser: r3,
|
|
canMentionNonMentionableRoles: r2, canMentionOtherGlobals: value2};
|
|
}
|
|
|
|
function allChannelsSentinel(a0) { // fn#43815, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:6725, offset: 0x0115f849, size: 58 bytes, params: 2, frame: 11
|
|
let value = Module00024;
|
|
value = value(a0);
|
|
value = value.subtract(1);
|
|
return value.toString();
|
|
}
|
|
|
|
function canUseApplicationCommands(a0, a1, a2) { // fn#43816, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:6831, offset: 0x0115f883, size: 244 bytes, params: 4, frame: 20
|
|
var r2;
|
|
var r1;
|
|
var r0;
|
|
var can;
|
|
let value = !a1;
|
|
if (a1) {
|
|
r0 = value;
|
|
} else {
|
|
value = a2.isMultiUserDM();
|
|
if (value) {
|
|
r1 = !!value;
|
|
} else {
|
|
if (a2.isDM()) {
|
|
r2 = !a2.isSystemDM();
|
|
} else {
|
|
value = a2.isArchivedLockedThread();
|
|
if (value) {
|
|
can = a0.can;
|
|
value = importAll(483) /* metro dependency 483: BigFlagUtils */;
|
|
value = Reflect.apply(can, a0, [value.combine(Permissions.USE_APPLICATION_COMMANDS,
|
|
Permissions.MANAGE_THREADS),
|
|
a2]);
|
|
r2 = value;
|
|
} else {
|
|
value = isReadableType(a2.type);
|
|
if (value) {
|
|
can = a0.can;
|
|
value = importAll(483) /* metro dependency 483: BigFlagUtils */;
|
|
value = Reflect.apply(can, a0, [value.combine(Permissions.USE_APPLICATION_COMMANDS,
|
|
Permissions.SEND_MESSAGES),
|
|
a2]);
|
|
r2 = value;
|
|
} else {
|
|
r2 = !!value;
|
|
}
|
|
}
|
|
}
|
|
r1 = r2;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function hasAccess({PermissionStore, guild, selfMember, applicationLevelPermissions, commandLevelPermissions, defaultMemberPermissions}) { // fn#43817, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:7169, offset: 0x0115f977, size: 239 bytes, params: 2, frame: 21
|
|
const ownerId = guild.ownerId;
|
|
const userId = selfMember.userId;
|
|
if (ownerId === userId) {
|
|
return true;
|
|
}
|
|
const can = PermissionStore.can;
|
|
const ADMINISTRATOR = Permissions.ADMINISTRATOR;
|
|
if (Reflect.apply(can, PermissionStore, [ADMINISTRATOR, guild])) {
|
|
return true;
|
|
}
|
|
const id = guild.id;
|
|
if (commandLevelPermissions != null) {
|
|
var hasAccessGivenPerms2 = hasAccessGivenPerms(selfMember, id, commandLevelPermissions);
|
|
if (typeof hasAccessGivenPerms2 === 'boolean') {
|
|
return hasAccessGivenPerms2;
|
|
}
|
|
}
|
|
const hasAccessGivenPerms3 = hasAccessGivenPerms(selfMember, id, applicationLevelPermissions);
|
|
return !(typeof hasAccessGivenPerms3 === 'boolean' && !hasAccessGivenPerms3) && (defaultMemberPermissions == null || !(importAll(483) /* metro dependency 483: BigFlagUtils */).equals(defaultMemberPermissions,
|
|
env0_11) && PermissionStore.can(defaultMemberPermissions, guild));
|
|
}
|
|
|
|
function getCommandAttachmentDraftType(a0) { // fn#43818, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:7606, offset: 0x0115fa66, size: 637 bytes, params: 2, frame: 14
|
|
const CommandOrigin = (ApplicationCommandTypesModule).CommandOrigin;
|
|
const CHAT = CommandOrigin.CHAT;
|
|
if (CHAT === a0) {
|
|
return DraftType.SlashCommand;
|
|
}
|
|
const APPLICATION_LAUNCHER = CommandOrigin.APPLICATION_LAUNCHER;
|
|
if (APPLICATION_LAUNCHER === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
const APP_LAUNCHER_APPLICATION_VIEW = CommandOrigin.APP_LAUNCHER_APPLICATION_VIEW;
|
|
if (APP_LAUNCHER_APPLICATION_VIEW === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
const CONTEXT_MENU = CommandOrigin.CONTEXT_MENU;
|
|
if (CONTEXT_MENU === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
const VOICE_UI = CommandOrigin.VOICE_UI;
|
|
if (VOICE_UI === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
const VOICE_TILE_ACTIVITY_SUGGESTIONS = CommandOrigin.VOICE_TILE_ACTIVITY_SUGGESTIONS;
|
|
if (VOICE_TILE_ACTIVITY_SUGGESTIONS === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
const MINI_SHELF = CommandOrigin.MINI_SHELF;
|
|
if (MINI_SHELF === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
const USER_PROFILE = CommandOrigin.USER_PROFILE;
|
|
if (USER_PROFILE === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
const NOW_PLAYING = CommandOrigin.NOW_PLAYING;
|
|
if (NOW_PLAYING === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
const ACTIVITY_DETAILS = CommandOrigin.ACTIVITY_DETAILS;
|
|
if (ACTIVITY_DETAILS === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
const ACTIVITIES_HOME = CommandOrigin.ACTIVITIES_HOME;
|
|
if (ACTIVITIES_HOME === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
const ACTIVITY_INSTANCE_EMBED = CommandOrigin.ACTIVITY_INSTANCE_EMBED;
|
|
if (ACTIVITY_INSTANCE_EMBED === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
const ACTIVITY_BOOKMARK_EMBED = CommandOrigin.ACTIVITY_BOOKMARK_EMBED;
|
|
if (ACTIVITY_BOOKMARK_EMBED === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
const APP_MESSAGE_EMBED = CommandOrigin.APP_MESSAGE_EMBED;
|
|
if (APP_MESSAGE_EMBED === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
const APP_DMS_ENTRY_POINT_COMMAND_BUTTON = CommandOrigin.APP_DMS_ENTRY_POINT_COMMAND_BUTTON;
|
|
if (APP_DMS_ENTRY_POINT_COMMAND_BUTTON === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
const IMAGE_RECS_MENU = CommandOrigin.IMAGE_RECS_MENU;
|
|
if (IMAGE_RECS_MENU === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
const IMAGE_RECS_SUBMENU = CommandOrigin.IMAGE_RECS_SUBMENU;
|
|
if (IMAGE_RECS_SUBMENU === a0) {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
}
|
|
|
|
function getCommandTriggerSection(a0) { // fn#43819, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:8537, offset: 0x0115fce3, size: 162 bytes, params: 2, frame: 13
|
|
const ApplicationCommandTriggerSections = (ApplicationCommandTypesModule).ApplicationCommandTriggerSections;
|
|
if (a0 != null) {
|
|
return a0.id === BuiltInSectionId.BUILT_IN ? ApplicationCommandTriggerSections.BUILT_IN : a0.id === BuiltInSectionId.FRECENCY ? ApplicationCommandTriggerSections.FRECENCY : ApplicationCommandTriggerSections.APP;
|
|
}
|
|
}
|
|
|
|
function getApplicationCommandSection(a0, a1, a2) { // fn#43820, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:8812, offset: 0x0115fd85, size: 145 bytes, params: 4, frame: 17
|
|
const value = a1;
|
|
const value2 = a2;
|
|
const value4 = undefined;
|
|
const ApplicationCommandSectionType = (ApplicationCommandTypesModule).ApplicationCommandSectionType;
|
|
const APPLICATION = ApplicationCommandSectionType.APPLICATION;
|
|
let r4 = value2 ?? (a0 == null || a0.bot == null ? value4 : a0.bot.username);
|
|
r4 = r4 ?? a0.name;
|
|
return {type: APPLICATION, id: a0.id, name: r4, icon: a0.icon, application: a0, isUserApp: value != null && value};
|
|
}
|
|
|
|
function extractInteractionDataProps({id, options}) { // fn#43821, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:9093, offset: 0x0115fe16, size: 183 bytes, params: 2, frame: 20
|
|
var r4;
|
|
var r2;
|
|
var value4;
|
|
let value = undefined;
|
|
const r5 = options == null ? value : options.find(function({type}) {
|
|
return type === require(dependencyMap[6]).ApplicationCommandOptionType.SUB_COMMAND_GROUP;
|
|
});
|
|
if (r5 == null) {
|
|
r4 = id;
|
|
} else {
|
|
value4 = id + ('' + SUB_COMMAND_KEY_SEPARATOR + r5.name);
|
|
options = r5.options;
|
|
r4 = value4;
|
|
}
|
|
const r0 = options == null ? value : options.find(function({type}) {
|
|
return type === require(dependencyMap[6]).ApplicationCommandOptionType.SUB_COMMAND;
|
|
});
|
|
if (r0 == null) {
|
|
r2 = r4;
|
|
} else {
|
|
value = r4 + ('' + SUB_COMMAND_KEY_SEPARATOR + r0.name);
|
|
options = r0.options;
|
|
r2 = value;
|
|
}
|
|
return {commandKey: r2, interactionOptions: options};
|
|
}
|
|
|
|
function trackCommandSelected({command, location, triggerSection, queryLength, sectionName, query, searchResultsPosition, source}) { // fn#43824, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:9508, offset: 0x0115fecd, size: 196 bytes, params: 2, frame: 26
|
|
const trackWithMetadata = AppAnalyticsUtilsModule.trackWithMetadata;
|
|
const APPLICATION_COMMAND_SELECTED = AnalyticEvents.APPLICATION_COMMAND_SELECTED;
|
|
let id = command.rootCommand?.id;
|
|
id = id ?? command.id;
|
|
Reflect.apply(trackWithMetadata, AppAnalyticsUtilsModule, [APPLICATION_COMMAND_SELECTED, {command_id: id,
|
|
application_id: command.applicationId, location: location, section: triggerSection, query_length: queryLength,
|
|
command_text_length: command.displayName.length, section_name: sectionName, query: query,
|
|
search_results_position: searchResultsPosition, source: source}]);
|
|
}
|
|
|
|
}
|
|
|
|
function _fun43810(a0, a1) { // fn#43810, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5243:5682, offset: 0x0115f614, size: 52 bytes, params: 3, frame: 13
|
|
if (a1.applicationCommandPermissions != null) {
|
|
a0.push({id: a1.id, permissions: a1.applicationCommandPermissions});
|
|
}
|
|
return a0;
|
|
}
|
|
|
|
global.__d(_fun43792, 5065, [1383, 4645, 5066, 661, 482, 5067, 1909, 5068, 483, 22, 44, 24, 4863,
|
|
2]) /* metro module 5065, dependencies: [1383, 4645, 5066, 661, 482, 5067, 1909, 5068, 483, 22, 44, 24, 4863, 2] */;
|