decord/source/modules/unique_usernames/UniqueUsernamesUtils.tsx

75 lines
3.7 KiB
TypeScript
Raw Normal View History

2026-07-23 10:11:24 +00:00
// Module ID: 13667
// Function ID: 104963
2026-07-20 16:05:17 +00:00
// Name: formatUsernameLiveCheckValidation
2026-07-23 10:11:24 +00:00
// Dependencies: [4329, 13662, 1212, 2]
2026-07-20 16:05:17 +00:00
// Exports: formatUsernameLiveCheckValidation
2026-07-23 10:11:24 +00:00
// Module 13667 (formatUsernameLiveCheckValidation)
const result = require("getSystemLocale").fileFinishedImporting("modules/unique_usernames/UniqueUsernamesUtils.tsx");
2026-07-20 16:05:17 +00:00
export const formatUsernameLiveCheckValidation = function formatUsernameLiveCheckValidation(stateFromStores) {
2026-07-23 10:11:24 +00:00
const match = require(4329) /* n */.match(stateFromStores);
const str = require(4329) /* n */;
2026-07-20 16:05:17 +00:00
let obj = {};
2026-07-23 10:11:24 +00:00
const P = require(4329) /* n */.P;
obj.error = P.not(require(4329) /* n */.P.nullish);
2026-07-20 16:05:17 +00:00
const withResult = match.with({ rateLimited: true }, () => {
2026-07-23 10:11:24 +00:00
const obj = { type: outer1_0(outer1_1[1]).NameValidationState.RATE_LIMIT };
const intl = outer1_0(outer1_1[2]).intl;
obj.message = intl.string(outer1_0(outer1_1[2]).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
});
const withResult1 = match.with({ rateLimited: true }, () => {
2026-07-23 10:11:24 +00:00
const obj = { type: outer1_0(outer1_1[1]).NameValidationState.RATE_LIMIT };
const intl = outer1_0(outer1_1[2]).intl;
obj.message = intl.string(outer1_0(outer1_1[2]).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-07-23 10:11:24 +00:00
}).with(obj, (error) => ({ type: outer1_0(outer1_1[1]).NameValidationState.ERROR, message: error.error }));
2026-07-20 16:05:17 +00:00
const withResult2 = match.with({ rateLimited: true }, () => {
2026-07-23 10:11:24 +00:00
const obj = { type: outer1_0(outer1_1[1]).NameValidationState.RATE_LIMIT };
const intl = outer1_0(outer1_1[2]).intl;
obj.message = intl.string(outer1_0(outer1_1[2]).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-07-23 10:11:24 +00:00
}).with(obj, (error) => ({ type: outer1_0(outer1_1[1]).NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => {
const obj = { type: outer1_0(outer1_1[1]).NameValidationState.AVAILABLE };
const intl = outer1_0(outer1_1[2]).intl;
obj.message = intl.string(outer1_0(outer1_1[2]).t.PgfBSx);
2026-07-20 16:05:17 +00:00
return obj;
});
2026-07-23 10:11:24 +00:00
obj = { error: require(4329) /* n */.P.nullish };
2026-07-20 16:05:17 +00:00
const withResult3 = match.with({ rateLimited: true }, () => {
2026-07-23 10:11:24 +00:00
const obj = { type: outer1_0(outer1_1[1]).NameValidationState.RATE_LIMIT };
const intl = outer1_0(outer1_1[2]).intl;
obj.message = intl.string(outer1_0(outer1_1[2]).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-07-23 10:11:24 +00:00
}).with(obj, (error) => ({ type: outer1_0(outer1_1[1]).NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => {
const obj = { type: outer1_0(outer1_1[1]).NameValidationState.AVAILABLE };
const intl = outer1_0(outer1_1[2]).intl;
obj.message = intl.string(outer1_0(outer1_1[2]).t.PgfBSx);
2026-07-20 16:05:17 +00:00
return obj;
}).with({ taken: true }, () => {
2026-07-23 10:11:24 +00:00
const obj = { type: outer1_0(outer1_1[1]).NameValidationState.ERROR };
const intl = outer1_0(outer1_1[2]).intl;
obj.message = intl.string(outer1_0(outer1_1[2]).t.mCrAUb);
2026-07-20 16:05:17 +00:00
return obj;
});
return match.with({ rateLimited: true }, () => {
2026-07-23 10:11:24 +00:00
const obj = { type: outer1_0(outer1_1[1]).NameValidationState.RATE_LIMIT };
const intl = outer1_0(outer1_1[2]).intl;
obj.message = intl.string(outer1_0(outer1_1[2]).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-07-23 10:11:24 +00:00
}).with(obj, (error) => ({ type: outer1_0(outer1_1[1]).NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => {
const obj = { type: outer1_0(outer1_1[1]).NameValidationState.AVAILABLE };
const intl = outer1_0(outer1_1[2]).intl;
obj.message = intl.string(outer1_0(outer1_1[2]).t.PgfBSx);
2026-07-20 16:05:17 +00:00
return obj;
}).with({ taken: true }, () => {
2026-07-23 10:11:24 +00:00
const obj = { type: outer1_0(outer1_1[1]).NameValidationState.ERROR };
const intl = outer1_0(outer1_1[2]).intl;
obj.message = intl.string(outer1_0(outer1_1[2]).t.mCrAUb);
2026-07-20 16:05:17 +00:00
return obj;
2026-07-23 10:11:24 +00:00
}).with(obj, () => ({ type: outer1_0(outer1_1[1]).NameValidationState.INTERNAL_ERROR, message: "" })).otherwise(() => {
2026-07-20 16:05:17 +00:00
});
};