148 lines
7.5 KiB
TypeScript
148 lines
7.5 KiB
TypeScript
/* Metro module 8787; source: utils/FriendsUtils.tsx; dependencies: [57, 661, 1244, 44, 683, 8788, 2] */
|
|
import Module00044 from '../by-id/module-00044.js'; /* Metro dependency 44 */
|
|
import Module00057 from '../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as IndexNativeModule from '../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
|
|
function _fun68710(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#68710, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8972:6, offset: 0x01c59942, size: 253 bytes, params: 8, frame: 21
|
|
const env0_0 = require;
|
|
const validateDiscordTag2 = validateDiscordTag;
|
|
const humanizeAbortCode2 = humanizeAbortCode;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_6 = RegExp('^\\d+$', '');
|
|
const env0_7 = RegExp('^(.+?@.+?\\..+?|.+?#\\d{4})$', '');
|
|
const env0_8 = RegExp('^[a-zA-Z0-9_\\\\.]+$', '');
|
|
(FileImportTrackerModule).fileFinishedImporting('utils/FriendsUtils.tsx');
|
|
exports.validateDiscordTag = validateDiscordTag2;
|
|
exports.isValidDiscordTag = isValidDiscordTag;
|
|
exports.humanizeAbortCode = humanizeAbortCode2;
|
|
exports.humanizeAbortCodeForA11y = humanizeAbortCodeForA11y;
|
|
function validateDiscordTag(a0) { // fn#68711, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8972:214, offset: 0x01c59a3f, size: 338 bytes, params: 2, frame: 23
|
|
var r0;
|
|
var value5;
|
|
var property;
|
|
var property2;
|
|
var defaultImport;
|
|
var track;
|
|
var FRIEND_REQUEST_FAILED;
|
|
var object;
|
|
var length;
|
|
const intl = (IndexNativeModule).intl;
|
|
const t = (IndexNativeModule).t;
|
|
let binding = env0_8;
|
|
const value2 = binding.test(a0);
|
|
const value3 = null;
|
|
if (value2) {
|
|
r0 = value3;
|
|
} else if (a0.includes('#')) {
|
|
binding = env0_7;
|
|
if (binding.test(a0)) {
|
|
r0 = value3;
|
|
} else {
|
|
value5 = Module00057(a0.split('#'), 2);
|
|
property = value5[0];
|
|
property2 = value5[1];
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = defaultImport.track;
|
|
FRIEND_REQUEST_FAILED = AnalyticEvents.FRIEND_REQUEST_FAILED;
|
|
object = {reason: 'Invalid Username', query: a0};
|
|
length = (value3 != property2 ? property2 : '').length;
|
|
object.discrim_len = length;
|
|
length = property.length;
|
|
object.username_len = length;
|
|
object.is_email_like = (importDefault(8788) /* metro dependency 8788: ValidationUtils */).isEmail(a0);
|
|
object.is_invite_like = (importDefault(8788) /* metro dependency 8788: ValidationUtils */).isInvite(a0);
|
|
object.is_num_only = env0_6.test(a0);
|
|
Reflect.apply(track, defaultImport, [FRIEND_REQUEST_FAILED, object]);
|
|
r0 = intl.string(t.paDJBM);
|
|
}
|
|
} else {
|
|
value5 = Module00057(a0.split('#'), 2);
|
|
property = value5[0];
|
|
property2 = value5[1];
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = defaultImport.track;
|
|
FRIEND_REQUEST_FAILED = AnalyticEvents.FRIEND_REQUEST_FAILED;
|
|
object = {reason: 'Invalid Username', query: a0};
|
|
length = (value3 != property2 ? property2 : '').length;
|
|
object.discrim_len = length;
|
|
length = property.length;
|
|
object.username_len = length;
|
|
object.is_email_like = (importDefault(8788) /* metro dependency 8788: ValidationUtils */).isEmail(a0);
|
|
object.is_invite_like = (importDefault(8788) /* metro dependency 8788: ValidationUtils */).isInvite(a0);
|
|
object.is_num_only = env0_6.test(a0);
|
|
Reflect.apply(track, defaultImport, [FRIEND_REQUEST_FAILED, object]);
|
|
r0 = intl.string(t.paDJBM);
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function humanizeAbortCode(a0, a1) { // fn#68712, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8972:639, offset: 0x01c59b91, size: 608 bytes, params: 3, frame: 16
|
|
const intl = (IndexNativeModule).intl;
|
|
const t = (IndexNativeModule).t;
|
|
const RELATIONSHIP_INCOMING_DISABLED = AbortCodes.RELATIONSHIP_INCOMING_DISABLED;
|
|
if (RELATIONSHIP_INCOMING_DISABLED === a0) {
|
|
return intl.format(t.Oxe6Ur, {discordTag: a1});
|
|
}
|
|
const TOO_MANY_FRIENDS = AbortCodes.TOO_MANY_FRIENDS;
|
|
if (TOO_MANY_FRIENDS === a0) {
|
|
return intl.string(t.tnBalD);
|
|
}
|
|
const RELATIONSHIP_ALREADY_FRIENDS = AbortCodes.RELATIONSHIP_ALREADY_FRIENDS;
|
|
if (RELATIONSHIP_ALREADY_FRIENDS === a0) {
|
|
return intl.string(t.VNLneq);
|
|
}
|
|
const USER_QUARANTINED = AbortCodes.USER_QUARANTINED;
|
|
if (USER_QUARANTINED === a0) {
|
|
return intl.string(t.EouHwv);
|
|
}
|
|
const USER_FRIEND_REQUEST_LIMITED_ACCESS = AbortCodes.USER_FRIEND_REQUEST_LIMITED_ACCESS;
|
|
if (USER_FRIEND_REQUEST_LIMITED_ACCESS === a0) {
|
|
return intl.string(t.EouHwv);
|
|
}
|
|
const TOO_MANY_BLOCKED_USERS = AbortCodes.TOO_MANY_BLOCKED_USERS;
|
|
if (TOO_MANY_BLOCKED_USERS === a0) {
|
|
return intl.string(t.sIGo1i);
|
|
}
|
|
const TOO_MANY_PENDING_OUTGOING = AbortCodes.TOO_MANY_PENDING_OUTGOING;
|
|
if (TOO_MANY_PENDING_OUTGOING === a0) {
|
|
return intl.string(t.k1K15p);
|
|
}
|
|
const RELATIONSHIP_INCOMING_BLOCKED = AbortCodes.RELATIONSHIP_INCOMING_BLOCKED;
|
|
if (RELATIONSHIP_INCOMING_BLOCKED !== a0) {
|
|
if (AbortCodes.RELATIONSHIP_INVALID_SELF !== a0) {
|
|
if (AbortCodes.RELATIONSHIP_INVALUD_USER_BOT !== a0) {
|
|
AbortCodes.RELATIONSHIP_INVALID_DISCORD_TAG;
|
|
}
|
|
}
|
|
}
|
|
return intl.string(t.paDJBM);
|
|
}
|
|
|
|
function isValidDiscordTag(a0) { // fn#68713, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8972:1510, offset: 0x01c59df1, size: 25 bytes, params: 2, frame: 11
|
|
return validateDiscordTag(a0) == null;
|
|
}
|
|
|
|
function humanizeAbortCodeForA11y(a0, a1) { // fn#68714, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8972:1641, offset: 0x01c59e0a, size: 145 bytes, params: 3, frame: 18
|
|
var r0;
|
|
var intl;
|
|
const value2 = humanizeAbortCode(a0, a1);
|
|
const RELATIONSHIP_INCOMING_DISABLED = AbortCodes.RELATIONSHIP_INCOMING_DISABLED;
|
|
if (a0 !== RELATIONSHIP_INCOMING_DISABLED) {
|
|
r0 = value2;
|
|
} else {
|
|
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
r0 = intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t['ihb+UW'],
|
|
{discordTag: a1});
|
|
}
|
|
(Module00044)(typeof r0 === 'string', 'abortCode should be a string for a11y');
|
|
return r0;
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun68710, 8787, [57, 661, 1244, 44, 683, 8788,
|
|
2]) /* metro module 8787, dependencies: [57, 661, 1244, 44, 683, 8788, 2] */;
|