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

543 lines
27 KiB
TypeScript

/* Metro module 11694; source: modules/application_commands/ApplicationCommandValidators.tsx; dependencies: [1949, 4644, 1909, 8053, 44, 1244, 8051, 5065, 8054, 2] */
import Module00044 from '../../by-id/module-00044.js'; /* Metro dependency 44 */
import LocaleStore from '../user_settings/LocaleStore.tsx'; /* Metro dependency 1949 */
import UploadAttachmentStore from '../../stores/UploadAttachmentStore.tsx'; /* Metro dependency 4644 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as ServerModule from '../../flow/Server.tsx'; /* Metro dependency 1909 */
import * as ApplicationCommandUtilsModule from './ApplicationCommandUtils.tsx'; /* Metro dependency 5065 */
import * as ApplicationCommandOptionUtilsModule from './ApplicationCommandOptionUtils.tsx'; /* Metro dependency 8051 */
function _fun89643(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#89643, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11880:6, offset: 0x0201835a, size: 535 bytes, params: 8, frame: 19
const env0_0 = require;
const localeNumberFormat = function(a0) {
return a0.toLocaleString(require(dependencyMap[5]).intl.currentLocale, {useGrouping: false});
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
object = {};
const ApplicationCommandOptionType = (ServerModule).ApplicationCommandOptionType;
const SUB_COMMAND = ApplicationCommandOptionType.SUB_COMMAND;
object[SUB_COMMAND] = function() {
return {success: false};
};
const SUB_COMMAND_GROUP = ApplicationCommandOptionType.SUB_COMMAND_GROUP;
object[SUB_COMMAND_GROUP] = function() {
return {success: false};
};
const BOOLEAN = ApplicationCommandOptionType.BOOLEAN;
object[BOOLEAN] = function(a0) {
if (a0.type !== 'text') {
return {success: false};
}
var value = a0.text.trim();
value = require(dependencyMap[3]).toChoiceBooleanValue(value);
return {success: value != null};
};
const STRING = ApplicationCommandOptionType.STRING;
object[STRING] = _fun89649;
const INTEGER = ApplicationCommandOptionType.INTEGER;
object[INTEGER] = _fun89650;
const NUMBER = ApplicationCommandOptionType.NUMBER;
object[NUMBER] = _fun89651;
const USER = ApplicationCommandOptionType.USER;
object[USER] = _fun89652;
const CHANNEL = ApplicationCommandOptionType.CHANNEL;
object[CHANNEL] = _fun89653;
const ROLE = ApplicationCommandOptionType.ROLE;
object[ROLE] = _fun89654;
const MENTIONABLE = ApplicationCommandOptionType.MENTIONABLE;
object[MENTIONABLE] = _fun89655;
const ATTACHMENT = ApplicationCommandOptionType.ATTACHMENT;
object[ATTACHMENT] = _fun89656;
const isValidRoleMention = function(a0) {
return a0.type === 'roleMention' || a0.type === 'textMention' && a0.text === '@everyone';
};
(FileImportTrackerModule).fileFinishedImporting('modules/application_commands/ApplicationCommandValidators.tsx');
exports.default = object;
function validateNumericOptionRange(a0, a1, a2, a3, a4) { // fn#89644, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11880:4844, offset: 0x02018571, size: 361 bytes, params: 6, frame: 17
var maxValue;
const intl = (IndexNativeModule).intl;
var formatToPlainString;
var object2;
var localeNumberFormatBinding;
var object3;
var object4;
let minValue = a1.minValue;
if (minValue == null) {
if (a1.maxValue == null) {
return {success: true};
}
} else {
minValue = a1.minValue;
if (a0 < minValue) {
maxValue = a1.maxValue;
if (maxValue == null) {
if (a1.minValue != null) {
formatToPlainString = intl.formatToPlainString;
object3 = {};
object3.minimum = localeNumberFormat(a1.minValue);
return {success: false, error: Reflect.apply(formatToPlainString, intl, [a3, object3])};
}
if (a1.maxValue != null) {
formatToPlainString = intl.formatToPlainString;
object2 = {};
object2.maximum = localeNumberFormat(a1.maxValue);
return {success: false, error: Reflect.apply(formatToPlainString, intl, [a4, object2])};
}
return {success: true};
}
minValue = a1.minValue;
if (minValue != null) {
formatToPlainString = intl.formatToPlainString;
object4 = {};
localeNumberFormatBinding = localeNumberFormat;
object4.minimum = localeNumberFormatBinding(a1.minValue);
object4.maximum = localeNumberFormatBinding(a1.maxValue);
return {success: false, error: Reflect.apply(formatToPlainString, intl, [a2, object4])};
}
minValue = a1.minValue;
if (minValue != null) {
formatToPlainString = intl.formatToPlainString;
object3 = {};
object3.minimum = localeNumberFormat(a1.minValue);
return {success: false, error: Reflect.apply(formatToPlainString, intl, [a3, object3])};
}
maxValue = a1.maxValue;
if (maxValue != null) {
formatToPlainString = intl.formatToPlainString;
object2 = {};
object2.maximum = localeNumberFormat(a1.maxValue);
return {success: false, error: Reflect.apply(formatToPlainString, intl, [a4, object2])};
}
return {success: true};
}
if (a1.maxValue == null) {
return {success: true};
}
}
maxValue = a1.maxValue;
if (a0 > maxValue) {
maxValue = a1.maxValue;
if (maxValue == null) {
if (a1.minValue != null) {
formatToPlainString = intl.formatToPlainString;
object3 = {};
object3.minimum = localeNumberFormat(a1.minValue);
return {success: false, error: Reflect.apply(formatToPlainString, intl, [a3, object3])};
}
if (a1.maxValue != null) {
formatToPlainString = intl.formatToPlainString;
object2 = {};
object2.maximum = localeNumberFormat(a1.maxValue);
return {success: false, error: Reflect.apply(formatToPlainString, intl, [a4, object2])};
}
return {success: true};
}
minValue = a1.minValue;
if (minValue != null) {
formatToPlainString = intl.formatToPlainString;
object4 = {};
localeNumberFormatBinding = localeNumberFormat;
object4.minimum = localeNumberFormatBinding(a1.minValue);
object4.maximum = localeNumberFormatBinding(a1.maxValue);
return {success: false, error: Reflect.apply(formatToPlainString, intl, [a2, object4])};
}
minValue = a1.minValue;
if (minValue != null) {
formatToPlainString = intl.formatToPlainString;
object3 = {};
object3.minimum = localeNumberFormat(a1.minValue);
return {success: false, error: Reflect.apply(formatToPlainString, intl, [a3, object3])};
}
maxValue = a1.maxValue;
if (maxValue != null) {
formatToPlainString = intl.formatToPlainString;
object2 = {};
object2.maximum = localeNumberFormat(a1.maxValue);
return {success: false, error: Reflect.apply(formatToPlainString, intl, [a4, object2])};
}
}
return {success: true};
}
function _fun89649(a0, a1, a2) { // fn#89649, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11880:475, offset: 0x02018780, size: 934 bytes, params: 4, frame: 25
var r5;
var object;
var moduleValue;
var maxLength;
var length;
const intl = (IndexNativeModule).intl;
var formatToPlainString;
var maxErrorMessage;
var localeNumberFormatBinding;
var minErrorMessage;
var rangeErrorMessage;
var exactRangeErrorMessage;
var value;
const defaultImport = Module00044;
let type = a1.type;
const ApplicationCommandOptionType = (ServerModule).ApplicationCommandOptionType;
const STRING = ApplicationCommandOptionType.STRING;
defaultImport(type === STRING, 'option type must match validator type');
type = a0.type;
if (type === 'emoji') {
r5 = a0.surrogate;
} else {
if (type !== 'text') {
return {success: false};
}
r5 = a0.text.trim();
}
if (a1.choices != null) {
value = require(8053) /* metro dependency 8053: ApplicationCommandChoiceUtils */;
return {success: value.findChoiceStringValue(a1.choices, r5) != null};
}
if (a1.autocomplete) {
moduleValue = require(8053) /* metro dependency 8053: ApplicationCommandChoiceUtils */;
reducibleJoin8: while (true) {
if (moduleValue.findAutocompleteChoiceStringValue(a2, a1.name, r5) != null) {
return {success: true};
}
break reducibleJoin8;
}
}
let minLength = a1.minLength;
if (minLength === undefined) {
maxLength = a1.maxLength;
reducibleJoin10: while (true) {
if (maxLength === undefined) {
return {success: true};
}
break reducibleJoin10;
}
}
if (r5 == null) {
return {success: false};
}
let object4 = {};
const t = (IndexNativeModule).t;
object4.exactRangeErrorMessage = t['e+9/SY'];
const IE1sTh = t.IE1sTh;
object4.rangeErrorMessage = IE1sTh;
object4.minErrorMessage = t.rXAFQD;
object4.maxErrorMessage = t['ycEPx/'];
minLength = a1.minLength;
reducibleJoin27: while (true) {
reducibleJoin22: while (true) {
if (minLength === undefined) {
maxLength = a1.maxLength;
if (maxLength === undefined) {
break reducibleJoin22;
}
length = r5.length;
maxLength = a1.maxLength;
if (length > maxLength) {
maxLength = a1.maxLength;
if (maxLength !== undefined) {
if (a1.minLength !== undefined) {
if (a1.minLength === a1.maxLength) {
formatToPlainString = intl.formatToPlainString;
exactRangeErrorMessage = object4.exactRangeErrorMessage;
object4 = {};
object4.value = localeNumberFormat(a1.minLength);
object = {success: false, error: Reflect.apply(formatToPlainString, intl,
[exactRangeErrorMessage,
object4])};
break reducibleJoin27;
}
}
}
maxLength = a1.maxLength;
if (maxLength !== undefined) {
if (a1.minLength !== undefined) {
formatToPlainString = intl.formatToPlainString;
rangeErrorMessage = object4.rangeErrorMessage;
object4 = {};
localeNumberFormatBinding = localeNumberFormat;
object4.minimum = localeNumberFormatBinding(a1.minLength);
object4.maximum = localeNumberFormatBinding(a1.maxLength);
object = {success: false, error: Reflect.apply(formatToPlainString, intl,
[rangeErrorMessage,
object4])};
break reducibleJoin27;
}
}
if (a1.minLength !== undefined) {
formatToPlainString = intl.formatToPlainString;
minErrorMessage = object4.minErrorMessage;
object4 = {};
object4.minimum = localeNumberFormat(a1.minLength);
object = {success: false, error: Reflect.apply(formatToPlainString, intl, [minErrorMessage,
object4])};
break reducibleJoin27;
}
maxLength = a1.maxLength;
if (maxLength !== undefined) {
formatToPlainString = intl.formatToPlainString;
maxErrorMessage = object4.maxErrorMessage;
object4 = {};
object4.maximum = localeNumberFormat(a1.maxLength);
object = {success: false, error: Reflect.apply(formatToPlainString, intl, [maxErrorMessage,
object4])};
break reducibleJoin27;
}
break reducibleJoin22;
}
break reducibleJoin22;
}
length = r5.length;
minLength = a1.minLength;
if (!(length < minLength)) {
if (a1.maxLength === undefined) {
break reducibleJoin22;
}
length = r5.length;
if (!(length > a1.maxLength)) {
break reducibleJoin22;
}
}
maxLength = a1.maxLength;
if (maxLength !== undefined) {
if (a1.minLength !== undefined) {
if (a1.minLength === a1.maxLength) {
formatToPlainString = intl.formatToPlainString;
exactRangeErrorMessage = object4.exactRangeErrorMessage;
object4 = {};
object4.value = localeNumberFormat(a1.minLength);
object = {success: false, error: Reflect.apply(formatToPlainString, intl,
[exactRangeErrorMessage,
object4])};
break reducibleJoin27;
}
}
}
maxLength = a1.maxLength;
if (maxLength !== undefined) {
if (a1.minLength !== undefined) {
formatToPlainString = intl.formatToPlainString;
rangeErrorMessage = object4.rangeErrorMessage;
object4 = {};
localeNumberFormatBinding = localeNumberFormat;
object4.minimum = localeNumberFormatBinding(a1.minLength);
object4.maximum = localeNumberFormatBinding(a1.maxLength);
object = {success: false, error: Reflect.apply(formatToPlainString, intl, [rangeErrorMessage,
object4])};
break reducibleJoin27;
}
}
minLength = a1.minLength;
if (minLength !== undefined) {
formatToPlainString = intl.formatToPlainString;
minErrorMessage = object4.minErrorMessage;
object4 = {};
localeNumberFormatBinding = localeNumberFormat;
minLength = a1.minLength;
object4.minimum = localeNumberFormatBinding(minLength);
object = {success: false, error: Reflect.apply(formatToPlainString, intl, [minErrorMessage, object4])};
break reducibleJoin27;
}
maxLength = a1.maxLength;
if (maxLength !== undefined) {
formatToPlainString = intl.formatToPlainString;
maxErrorMessage = object4.maxErrorMessage;
object4 = {};
localeNumberFormatBinding = localeNumberFormat;
maxLength = a1.maxLength;
object4.maximum = localeNumberFormatBinding(maxLength);
object = {success: false, error: Reflect.apply(formatToPlainString, intl, [maxErrorMessage, object4])};
break reducibleJoin27;
}
break reducibleJoin22;
}
object = {success: true};
break reducibleJoin27;
}
if (object.success) {
return {success: true};
}
return object;
}
function _fun89650(a0, a1, a2) { // fn#89650, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11880:2061, offset: 0x02018b26, size: 498 bytes, params: 4, frame: 24
var moduleValue;
const t = (IndexNativeModule).t;
var value;
const defaultImport = Module00044;
let type = a1.type;
const ApplicationCommandOptionType = (ServerModule).ApplicationCommandOptionType;
const INTEGER = ApplicationCommandOptionType.INTEGER;
defaultImport(type === INTEGER, 'option type must match validator type');
type = a0.type;
const value2 = null;
const r5 = type !== 'text' ? value2 : a0.text.trim();
if (value2 == r5) {
return {success: false};
}
if (r5.length === 0) {
return {success: false};
}
if (value2 != a1.choices) {
value = require(8053) /* metro dependency 8053: ApplicationCommandChoiceUtils */;
return {success: value2 != value.findChoiceNumberValue(a1.choices, r5)};
}
if (a1.autocomplete) {
moduleValue = require(8053) /* metro dependency 8053: ApplicationCommandChoiceUtils */;
if (value2 != moduleValue.findAutocompleteChoiceNumberValue(a2, a1.name, r5)) {
return {success: true};
}
}
const Number = global.Number;
const value4 = Number(ApplicationCommandOptionUtilsModule.normalizeNumericString(LocaleStore.locale, r5));
return value2 == value4 || global.isNaN(value4) ? {success: false} : global.Number.isInteger(value4) && global.Number.isSafeInteger(value4) ? validateNumericOptionRange(value4,
a1, t['8Y5zsp'], t.CyRLmH, t['VD3Q+S']) : {success: false};
}
function _fun89651(a0, a1, a2) { // fn#89651, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11880:2719, offset: 0x02018d18, size: 480 bytes, params: 4, frame: 24
var moduleValue;
const t = (IndexNativeModule).t;
var value;
const defaultImport = Module00044;
let type = a1.type;
const ApplicationCommandOptionType = (ServerModule).ApplicationCommandOptionType;
const NUMBER = ApplicationCommandOptionType.NUMBER;
defaultImport(type === NUMBER, 'option type must match validator type');
type = a0.type;
const value2 = null;
const r5 = type !== 'text' ? value2 : a0.text.trim();
if (value2 == r5) {
return {success: false};
}
if (r5.length === 0) {
return {success: false};
}
if (value2 != a1.choices) {
value = require(8053) /* metro dependency 8053: ApplicationCommandChoiceUtils */;
return {success: value2 != value.findChoiceNumberValue(a1.choices, r5)};
}
if (a1.autocomplete) {
moduleValue = require(8053) /* metro dependency 8053: ApplicationCommandChoiceUtils */;
if (value2 != moduleValue.findAutocompleteChoiceNumberValue(a2, a1.name, r5)) {
return {success: true};
}
}
const Number = global.Number;
const value4 = Number(ApplicationCommandOptionUtilsModule.normalizeNumericString(LocaleStore.locale, r5));
return global.isNaN(value4) || value4 > global.Number.MAX_SAFE_INTEGER || value4 < global.Number.MIN_SAFE_INTEGER ? {success: false} : validateNumericOptionRange(value4,
a1, t['8Y5zsp'], t.CyRLmH, t['VD3Q+S']);
}
function _fun89652(a0, a1, a2, a3) { // fn#89652, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11880:3372, offset: 0x02018ef8, size: 186 bytes, params: 5, frame: 18
var value;
var value2;
var moduleValue;
var isSnowflake;
var text;
var resolveApplicationCommandOption;
if (a0.type === 'text') {
value2 = undefined;
moduleValue = require(5065) /* metro dependency 5065: ApplicationCommandUtils */;
isSnowflake = moduleValue.isSnowflake;
text = a0.text;
if (Reflect.apply(isSnowflake, moduleValue, [text])) {
return {success: true};
}
value = require(8054) /* metro dependency 8054: PlaintextResolvers */;
resolveApplicationCommandOption = value.resolveApplicationCommandOption;
text = a0.text;
value = Reflect.apply(resolveApplicationCommandOption, value, [text, a3, a2, {allowRoles: false}]);
return {success: (value == null ? value2 : value.type) === 'userMention'};
}
return {success: a0.type === 'userMention'};
}
function _fun89653(a0, a1, a2, a3) { // fn#89653, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11880:3671, offset: 0x02018fb2, size: 170 bytes, params: 5, frame: 16
var value;
var value2;
var moduleValue;
var isSnowflake;
var text;
var resolveApplicationCommandOption;
if (a0.type === 'text') {
value2 = undefined;
moduleValue = require(5065) /* metro dependency 5065: ApplicationCommandUtils */;
isSnowflake = moduleValue.isSnowflake;
text = a0.text;
if (Reflect.apply(isSnowflake, moduleValue, [text])) {
return {success: true};
}
value = require(8054) /* metro dependency 8054: PlaintextResolvers */;
resolveApplicationCommandOption = value.resolveApplicationCommandOption;
text = a0.text;
value = Reflect.apply(resolveApplicationCommandOption, value, [text, a3, a2]);
return {success: (value == null ? value2 : value.type) === 'channelMention'};
}
return {success: a0.type === 'channelMention'};
}
function _fun89654(a0, a1, a2, a3) { // fn#89654, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11880:3957, offset: 0x0201905c, size: 183 bytes, params: 5, frame: 18
var value;
var value2;
var moduleValue;
var isSnowflake;
var text;
var resolveApplicationCommandOption;
if (a0.type === 'text') {
value2 = undefined;
moduleValue = require(5065) /* metro dependency 5065: ApplicationCommandUtils */;
isSnowflake = moduleValue.isSnowflake;
text = a0.text;
if (Reflect.apply(isSnowflake, moduleValue, [text])) {
return {success: true};
}
value = require(8054) /* metro dependency 8054: PlaintextResolvers */;
resolveApplicationCommandOption = value.resolveApplicationCommandOption;
text = a0.text;
value = Reflect.apply(resolveApplicationCommandOption, value, [text, a3, a2, {allowUsers: false}]);
return {success: (value == null ? value2 : value.type) === 'roleMention'};
}
const object = {};
object.success = isValidRoleMention(a0);
return object;
}
function _fun89655(a0, a1, a2, a3) { // fn#89655, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11880:4259, offset: 0x02019113, size: 204 bytes, params: 5, frame: 17
var moduleValue;
var isSnowflake;
var text;
var moduleValue2;
var resolveApplicationCommandOption;
var applicationCommandOption;
if (a0.type === 'text') {
moduleValue = require(5065) /* metro dependency 5065: ApplicationCommandUtils */;
isSnowflake = moduleValue.isSnowflake;
text = a0.text;
if (Reflect.apply(isSnowflake, moduleValue, [text])) {
return {success: true};
}
moduleValue2 = require(8054) /* metro dependency 8054: PlaintextResolvers */;
resolveApplicationCommandOption = moduleValue2.resolveApplicationCommandOption;
text = a0.text;
applicationCommandOption = Reflect.apply(resolveApplicationCommandOption, moduleValue2, [text, a3, a2]);
return {success: applicationCommandOption != null && (applicationCommandOption.type === 'userMention' || isValidRoleMention(applicationCommandOption))};
}
return {success: a0.type === 'userMention' || isValidRoleMention(a0)};
}
function _fun89656(a0, {name}, a2, a3, a4) { // fn#89656, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11880:4585, offset: 0x020191df, size: 127 bytes, params: 6, frame: 17
if (a0.type !== 'text') {
return {success: false};
}
const uploadAttachmentStoreBinding = UploadAttachmentStore;
const getUpload = uploadAttachmentStoreBinding.getUpload;
let value = ApplicationCommandUtilsModule;
value = value.getCommandAttachmentDraftType(a4);
value = Reflect.apply(getUpload, uploadAttachmentStoreBinding, [a2, name, value]);
return {success: value != null && value.filename === a0.text};
}
}
global.__d(_fun89643, 11694, [1949, 4644, 1909, 8053, 44, 1244, 8051, 5065, 8054,
2]) /* metro module 11694, dependencies: [1949, 4644, 1909, 8053, 44, 1244, 8051, 5065, 8054, 2] */;