decord/beta/source/modules/unique_usernames/UniqueUsernamesUtils.tsx
github-actions 84d017ff78 chore: update source for beta 348.6
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5021.js (118.4 MB)
2026-09-28 16:18:32 +00:00

63 lines
2.8 KiB
TypeScript

// Module ID: 14269
// Function ID: 14270
// Name: UniqueUsernamesUtils
// Dependencies: [5021, 14264, 1115, 2]
// Exports: formatUsernameLiveCheckValidation
// Module 14269 (UniqueUsernamesUtils)
import util from "util" /* 1115 */;
import _mod5021 from "module_5021" /* 5021 */;
import UniqueUsernamesTypes from "UniqueUsernamesTypes" /* 14264 */;
import size from "module_2" /* 2 */;
const result = size.fileFinishedImporting("modules/unique_usernames/UniqueUsernamesUtils.tsx");
export const formatUsernameLiveCheckValidation = function formatUsernameLiveCheckValidation(arg0) {
const match = _mod5021.match(arg0);
let obj = { error: null };
const P = _mod5021.P;
obj.error = P.not(_mod5021.P.nullish);
const withResult = match.with({ rateLimited: true }, () => {
const obj = { type: UniqueUsernamesTypes.NameValidationState.RATE_LIMIT, message: null };
const intl = util.intl;
obj.message = intl.string(util.t.T15lqn);
return obj;
});
const withResult1 = match.with({ rateLimited: true }, () => {
const obj = { type: UniqueUsernamesTypes.NameValidationState.RATE_LIMIT, message: null };
const intl = util.intl;
obj.message = intl.string(util.t.T15lqn);
return obj;
}).with(obj, (error) => ({ type: UniqueUsernamesTypes.NameValidationState.ERROR, message: error.error }));
const withResult2 = match.with({ rateLimited: true }, () => {
const obj = { type: UniqueUsernamesTypes.NameValidationState.RATE_LIMIT, message: null };
const intl = util.intl;
obj.message = intl.string(util.t.T15lqn);
return obj;
}).with(obj, (error) => ({ type: UniqueUsernamesTypes.NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => {
const obj = { type: UniqueUsernamesTypes.NameValidationState.AVAILABLE, message: null };
const intl = util.intl;
obj.message = intl.string(util.t.PgfBSx);
return obj;
});
const withResult3 = match.with({ rateLimited: true }, () => {
const obj = { type: UniqueUsernamesTypes.NameValidationState.RATE_LIMIT, message: null };
const intl = util.intl;
obj.message = intl.string(util.t.T15lqn);
return obj;
}).with(obj, (error) => ({ type: UniqueUsernamesTypes.NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => {
const obj = { type: UniqueUsernamesTypes.NameValidationState.AVAILABLE, message: null };
const intl = util.intl;
obj.message = intl.string(util.t.PgfBSx);
return obj;
}).with({ taken: true }, () => {
const obj = { type: UniqueUsernamesTypes.NameValidationState.ERROR, message: null };
const intl = util.intl;
obj.message = intl.string(util.t.mCrAUb);
return obj;
});
const obj2 = { error: _mod5021.P.nullish };
return withResult3.with({ error: _mod5021.P.nullish }, () => ({ type: UniqueUsernamesTypes.NameValidationState.INTERNAL_ERROR, message: "" })).otherwise(() => {
});
};