decord/source/modules/unique_usernames/UniqueUsernamesUtils.tsx

75 lines
3.6 KiB
TypeScript
Raw Normal View History

2026-08-15 05:55:55 +00:00
// Module ID: 14121
// Function ID: 14122
2026-07-20 16:05:17 +00:00
// Name: formatUsernameLiveCheckValidation
2026-08-15 05:55:55 +00:00
// Dependencies: [4486, 14116, 1236, 2]
2026-07-20 16:05:17 +00:00
// Exports: formatUsernameLiveCheckValidation
2026-08-15 05:55:55 +00:00
// Module 14121 (formatUsernameLiveCheckValidation)
2026-07-23 10:11:24 +00:00
const result = require("getSystemLocale").fileFinishedImporting("modules/unique_usernames/UniqueUsernamesUtils.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const formatUsernameLiveCheckValidation = function formatUsernameLiveCheckValidation(arg0) {
2026-08-15 05:55:55 +00:00
const match = require(4486) /* t */.match(arg0);
const str = require(4486) /* t */;
2026-07-29 08:29:29 +00:00
let obj = { error: null };
2026-08-15 05:55:55 +00:00
const P = require(4486) /* t */.P;
obj[0] = P.not(require(4486) /* t */.P.nullish);
2026-07-20 16:05:17 +00:00
const withResult = match.with({ rateLimited: true }, () => {
2026-08-15 05:55:55 +00:00
const obj = { type: callback(14116).NameValidationState.RATE_LIMIT, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
});
const withResult1 = match.with({ rateLimited: true }, () => {
2026-08-15 05:55:55 +00:00
const obj = { type: callback(14116).NameValidationState.RATE_LIMIT, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-08-15 05:55:55 +00:00
}).with(obj, (error) => ({ type: callback(14116).NameValidationState.ERROR, message: error.error }));
2026-07-20 16:05:17 +00:00
const withResult2 = match.with({ rateLimited: true }, () => {
2026-08-15 05:55:55 +00:00
const obj = { type: callback(14116).NameValidationState.RATE_LIMIT, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-08-15 05:55:55 +00:00
}).with(obj, (error) => ({ type: callback(14116).NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => {
const obj = { type: callback(14116).NameValidationState.AVAILABLE, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.PgfBSx);
2026-07-20 16:05:17 +00:00
return obj;
});
2026-08-15 05:55:55 +00:00
obj = { error: require(4486) /* t */.P.nullish };
2026-07-20 16:05:17 +00:00
const withResult3 = match.with({ rateLimited: true }, () => {
2026-08-15 05:55:55 +00:00
const obj = { type: callback(14116).NameValidationState.RATE_LIMIT, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-08-15 05:55:55 +00:00
}).with(obj, (error) => ({ type: callback(14116).NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => {
const obj = { type: callback(14116).NameValidationState.AVAILABLE, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.PgfBSx);
2026-07-20 16:05:17 +00:00
return obj;
}).with({ taken: true }, () => {
2026-08-15 05:55:55 +00:00
const obj = { type: callback(14116).NameValidationState.ERROR, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.mCrAUb);
2026-07-20 16:05:17 +00:00
return obj;
});
return match.with({ rateLimited: true }, () => {
2026-08-15 05:55:55 +00:00
const obj = { type: callback(14116).NameValidationState.RATE_LIMIT, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-08-15 05:55:55 +00:00
}).with(obj, (error) => ({ type: callback(14116).NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => {
const obj = { type: callback(14116).NameValidationState.AVAILABLE, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.PgfBSx);
2026-07-20 16:05:17 +00:00
return obj;
}).with({ taken: true }, () => {
2026-08-15 05:55:55 +00:00
const obj = { type: callback(14116).NameValidationState.ERROR, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.mCrAUb);
2026-07-20 16:05:17 +00:00
return obj;
2026-08-15 05:55:55 +00:00
}).with(obj, () => ({ type: callback(14116).NameValidationState.INTERNAL_ERROR, message: "" })).otherwise(() => {
2026-07-20 16:05:17 +00:00
});
};