/* Metro module 11694; source: modules/application_commands/ApplicationCommandValidators.tsx; dependencies: [1949, 4644, 1909, 8053, 44, 1244, 8051, 5065, 8054, 2] */ 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 var object2; 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}); const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */; const uploadAttachmentStore = importDefault(4644) /* metro dependency 4644: UploadAttachmentStore */; object2 = {}; const ApplicationCommandOptionType = (require(1909) /* metro dependency 1909: Server */).ApplicationCommandOptionType; const SUB_COMMAND = ApplicationCommandOptionType.SUB_COMMAND; object2[SUB_COMMAND] = function() { return {success: false}; }; const SUB_COMMAND_GROUP = ApplicationCommandOptionType.SUB_COMMAND_GROUP; object2[SUB_COMMAND_GROUP] = function() { return {success: false}; }; const BOOLEAN = ApplicationCommandOptionType.BOOLEAN; object2[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; object2[STRING] = _fun89649; const INTEGER = ApplicationCommandOptionType.INTEGER; object2[INTEGER] = _fun89650; const NUMBER = ApplicationCommandOptionType.NUMBER; object2[NUMBER] = _fun89651; const USER = ApplicationCommandOptionType.USER; object2[USER] = _fun89652; const CHANNEL = ApplicationCommandOptionType.CHANNEL; object2[CHANNEL] = _fun89653; const ROLE = ApplicationCommandOptionType.ROLE; object2[ROLE] = _fun89654; const MENTIONABLE = ApplicationCommandOptionType.MENTIONABLE; object2[MENTIONABLE] = _fun89655; const ATTACHMENT = ApplicationCommandOptionType.ATTACHMENT; object2[ATTACHMENT] = _fun89656; const isValidRoleMention = function(a0) { return a0.type === 'roleMention' || a0.type === 'textMention' && a0.text === '@everyone'; }; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/application_commands/ApplicationCommandValidators.tsx'); exports.default = object2; } 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 = (require(1244) /* metro dependency 1244: indexNative */).intl; var formatToPlainString; var object; var localeNumberFormatBinding; var object5; var object6; 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; object5 = {}; object5.minimum = localeNumberFormat(a1.minValue); return {success: false, error: Reflect.apply(formatToPlainString, intl, [a3, object5])}; } if (a1.maxValue != null) { formatToPlainString = intl.formatToPlainString; object = {}; object.maximum = localeNumberFormat(a1.maxValue); return {success: false, error: Reflect.apply(formatToPlainString, intl, [a4, object])}; } return {success: true}; } minValue = a1.minValue; if (minValue != null) { formatToPlainString = intl.formatToPlainString; object6 = {}; localeNumberFormatBinding = localeNumberFormat; object6.minimum = localeNumberFormatBinding(a1.minValue); object6.maximum = localeNumberFormatBinding(a1.maxValue); return {success: false, error: Reflect.apply(formatToPlainString, intl, [a2, object6])}; } minValue = a1.minValue; if (minValue != null) { formatToPlainString = intl.formatToPlainString; object5 = {}; object5.minimum = localeNumberFormat(a1.minValue); return {success: false, error: Reflect.apply(formatToPlainString, intl, [a3, object5])}; } maxValue = a1.maxValue; if (maxValue != null) { formatToPlainString = intl.formatToPlainString; object = {}; object.maximum = localeNumberFormat(a1.maxValue); return {success: false, error: Reflect.apply(formatToPlainString, intl, [a4, object])}; } 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; object5 = {}; object5.minimum = localeNumberFormat(a1.minValue); return {success: false, error: Reflect.apply(formatToPlainString, intl, [a3, object5])}; } if (a1.maxValue != null) { formatToPlainString = intl.formatToPlainString; object = {}; object.maximum = localeNumberFormat(a1.maxValue); return {success: false, error: Reflect.apply(formatToPlainString, intl, [a4, object])}; } return {success: true}; } minValue = a1.minValue; if (minValue != null) { formatToPlainString = intl.formatToPlainString; object6 = {}; localeNumberFormatBinding = localeNumberFormat; object6.minimum = localeNumberFormatBinding(a1.minValue); object6.maximum = localeNumberFormatBinding(a1.maxValue); return {success: false, error: Reflect.apply(formatToPlainString, intl, [a2, object6])}; } minValue = a1.minValue; if (minValue != null) { formatToPlainString = intl.formatToPlainString; object5 = {}; object5.minimum = localeNumberFormat(a1.minValue); return {success: false, error: Reflect.apply(formatToPlainString, intl, [a3, object5])}; } maxValue = a1.maxValue; if (maxValue != null) { formatToPlainString = intl.formatToPlainString; object = {}; object.maximum = localeNumberFormat(a1.maxValue); return {success: false, error: Reflect.apply(formatToPlainString, intl, [a4, object])}; } } 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 object2; var moduleValue; var maxLength; var length; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; var formatToPlainString; var maxErrorMessage; var localeNumberFormatBinding; var minErrorMessage; var rangeErrorMessage; var exactRangeErrorMessage; var value; const defaultImport = importDefault(44) /* metro dependency 44 */; let type = a1.type; const ApplicationCommandOptionType = (require(1909) /* metro dependency 1909: Server */).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 object3 = {}; const t = (require(1244) /* metro dependency 1244: indexNative */).t; object3.exactRangeErrorMessage = t['e+9/SY']; const IE1sTh = t.IE1sTh; object3.rangeErrorMessage = IE1sTh; object3.minErrorMessage = t.rXAFQD; object3.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 = object3.exactRangeErrorMessage; object3 = {}; object3.value = localeNumberFormat(a1.minLength); object2 = {success: false, error: Reflect.apply(formatToPlainString, intl, [exactRangeErrorMessage, object3])}; break reducibleJoin27; } } } maxLength = a1.maxLength; if (maxLength !== undefined) { if (a1.minLength !== undefined) { formatToPlainString = intl.formatToPlainString; rangeErrorMessage = object3.rangeErrorMessage; object3 = {}; localeNumberFormatBinding = localeNumberFormat; object3.minimum = localeNumberFormatBinding(a1.minLength); object3.maximum = localeNumberFormatBinding(a1.maxLength); object2 = {success: false, error: Reflect.apply(formatToPlainString, intl, [rangeErrorMessage, object3])}; break reducibleJoin27; } } if (a1.minLength !== undefined) { formatToPlainString = intl.formatToPlainString; minErrorMessage = object3.minErrorMessage; object3 = {}; object3.minimum = localeNumberFormat(a1.minLength); object2 = {success: false, error: Reflect.apply(formatToPlainString, intl, [minErrorMessage, object3])}; break reducibleJoin27; } maxLength = a1.maxLength; if (maxLength !== undefined) { formatToPlainString = intl.formatToPlainString; maxErrorMessage = object3.maxErrorMessage; object3 = {}; object3.maximum = localeNumberFormat(a1.maxLength); object2 = {success: false, error: Reflect.apply(formatToPlainString, intl, [maxErrorMessage, object3])}; 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 = object3.exactRangeErrorMessage; object3 = {}; object3.value = localeNumberFormat(a1.minLength); object2 = {success: false, error: Reflect.apply(formatToPlainString, intl, [exactRangeErrorMessage, object3])}; break reducibleJoin27; } } } maxLength = a1.maxLength; if (maxLength !== undefined) { if (a1.minLength !== undefined) { formatToPlainString = intl.formatToPlainString; rangeErrorMessage = object3.rangeErrorMessage; object3 = {}; localeNumberFormatBinding = localeNumberFormat; object3.minimum = localeNumberFormatBinding(a1.minLength); object3.maximum = localeNumberFormatBinding(a1.maxLength); object2 = {success: false, error: Reflect.apply(formatToPlainString, intl, [rangeErrorMessage, object3])}; break reducibleJoin27; } } minLength = a1.minLength; if (minLength !== undefined) { formatToPlainString = intl.formatToPlainString; minErrorMessage = object3.minErrorMessage; object3 = {}; localeNumberFormatBinding = localeNumberFormat; minLength = a1.minLength; object3.minimum = localeNumberFormatBinding(minLength); object2 = {success: false, error: Reflect.apply(formatToPlainString, intl, [minErrorMessage, object3])}; break reducibleJoin27; } maxLength = a1.maxLength; if (maxLength !== undefined) { formatToPlainString = intl.formatToPlainString; maxErrorMessage = object3.maxErrorMessage; object3 = {}; localeNumberFormatBinding = localeNumberFormat; maxLength = a1.maxLength; object3.maximum = localeNumberFormatBinding(maxLength); object2 = {success: false, error: Reflect.apply(formatToPlainString, intl, [maxErrorMessage, object3])}; break reducibleJoin27; } break reducibleJoin22; } object2 = {success: true}; break reducibleJoin27; } if (object2.success) { return {success: true}; } return object2; } 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 = (require(1244) /* metro dependency 1244: indexNative */).t; var value; const defaultImport = importDefault(44) /* metro dependency 44 */; let type = a1.type; const ApplicationCommandOptionType = (require(1909) /* metro dependency 1909: Server */).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 moduleValue2 = importAll(8051) /* metro dependency 8051: ApplicationCommandOptionUtils */; const value4 = Number(moduleValue2.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 = (require(1244) /* metro dependency 1244: indexNative */).t; var value; const defaultImport = importDefault(44) /* metro dependency 44 */; let type = a1.type; const ApplicationCommandOptionType = (require(1909) /* metro dependency 1909: Server */).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 moduleValue2 = importAll(8051) /* metro dependency 8051: ApplicationCommandOptionUtils */; const value4 = Number(moduleValue2.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 object2 = {}; object2.success = isValidRoleMention(a0); return object2; } 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 getUpload = UploadAttachmentStore.getUpload; let value = require(5065) /* metro dependency 5065: ApplicationCommandUtils */; value = value.getCommandAttachmentDraftType(a4); value = Reflect.apply(getUpload, UploadAttachmentStore, [a2, name, value]); return {success: value != null && value.filename === a0.text}; }