decord/source/modules/unique_usernames/UniqueUsernamesStore.tsx

187 lines
5.9 KiB
TypeScript
Raw Normal View History

2026-07-23 10:11:24 +00:00
// Module ID: 13665
// Function ID: 104936
2026-07-20 16:05:17 +00:00
// Name: _isNativeReflectConstruct
2026-07-23 10:11:24 +00:00
// Dependencies: [6, 7, 15, 17, 18, 1362, 664, 566, 686, 2]
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
// Module 13665 (_isNativeReflectConstruct)
import set from "set";
import initialize from "initialize";
import _possibleConstructorReturn from "_possibleConstructorReturn";
import _getPrototypeOf from "_getPrototypeOf";
import _inherits from "_inherits";
import importDefaultResult from "priv";
2026-07-20 16:05:17 +00:00
function _isNativeReflectConstruct() {
let closure_0 = !valueOf.call(Reflect.construct(Boolean, [], () => {
}));
function _isNativeReflectConstruct() {
return closure_0;
}
const result = _isNativeReflectConstruct();
}
2026-07-23 10:11:24 +00:00
let obj = { taken: null, error: undefined, rateLimited: true };
obj = { validations: null, currentUsernameInvalid: false, retryAfterTime: null };
importDefaultResult = new importDefaultResult({ max: 100, maxAge: 60000 });
2026-07-20 16:05:17 +00:00
obj.validations = importDefaultResult;
2026-07-23 10:11:24 +00:00
obj = { suggestion: { username: undefined }, fetched: false, usernameSuggestionLoading: false };
2026-07-21 22:01:30 +00:00
obj.suggestions = { migration: obj, registration: { suggestion: { username: undefined }, source: undefined, fetched: false } };
2026-07-23 10:11:24 +00:00
let tmp4 = ((Store) => {
2026-07-20 16:05:17 +00:00
class UniqueUsernamesStore {
constructor() {
self = this;
2026-07-23 10:11:24 +00:00
tmp = outer1_2(this, UniqueUsernamesStore);
obj = outer1_5(UniqueUsernamesStore);
tmp2 = outer1_4;
if (outer1_9()) {
2026-07-20 16:05:17 +00:00
tmp6 = globalThis;
_Reflect = Reflect;
2026-07-23 10:11:24 +00:00
tmp7 = outer1_5;
2026-07-20 16:05:17 +00:00
tmp8 = arguments;
2026-07-23 10:11:24 +00:00
constructResult = Reflect.construct(obj, arguments, outer1_5(self).constructor);
2026-07-20 16:05:17 +00:00
} else {
tmp3 = arguments;
tmp4 = arguments;
constructResult = obj(...arguments);
}
return tmp2(self, constructResult);
}
}
callback2(UniqueUsernamesStore, Store);
let obj = {
key: "isRateLimited",
value() {
2026-07-23 10:11:24 +00:00
let tmp = null != outer1_8.retryAfterTime;
2026-07-20 16:05:17 +00:00
if (tmp) {
const _Date = Date;
2026-07-23 10:11:24 +00:00
tmp = Date.now() < outer1_8.retryAfterTime;
2026-07-20 16:05:17 +00:00
}
return tmp;
}
};
const items = [obj, , , , , , , ];
obj = {
key: "validate",
value(arg0) {
const self = this;
2026-07-23 10:11:24 +00:00
const validations = outer1_8.validations;
2026-07-20 16:05:17 +00:00
const value = validations.get(arg0);
if (!this.isRateLimited()) {
let tmp4 = value;
} else {
2026-07-23 10:11:24 +00:00
tmp4 = outer1_7;
2026-07-20 16:05:17 +00:00
}
return tmp4;
}
};
items[1] = obj;
obj = {
key: "registrationUsernameSuggestion",
value() {
2026-07-23 10:11:24 +00:00
return outer1_8.suggestions.registration.suggestion.username;
2026-07-20 16:05:17 +00:00
}
};
items[2] = obj;
items[3] = {
key: "usernameSuggestion",
value() {
2026-07-23 10:11:24 +00:00
return outer1_8.suggestions.migration.suggestion.username;
2026-07-20 16:05:17 +00:00
}
};
items[4] = {
key: "usernameSuggestionLoading",
value() {
2026-07-23 10:11:24 +00:00
return outer1_8.suggestions.migration.usernameSuggestionLoading;
2026-07-20 16:05:17 +00:00
}
};
items[5] = {
key: "isCurrentUsernameInvalid",
value() {
2026-07-23 10:11:24 +00:00
return outer1_8.currentUsernameInvalid;
2026-07-20 16:05:17 +00:00
}
};
items[6] = {
key: "wasRegistrationSuggestionFetched",
value(arg0) {
2026-07-23 10:11:24 +00:00
let fetched = outer1_8.suggestions.registration.source === arg0;
2026-07-20 16:05:17 +00:00
if (fetched) {
2026-07-23 10:11:24 +00:00
fetched = outer1_8.suggestions.registration.fetched;
2026-07-20 16:05:17 +00:00
}
return fetched;
}
};
items[7] = {
key: "wasSuggestionsFetched",
value() {
2026-07-23 10:11:24 +00:00
return outer1_8.suggestions.migration.fetched;
2026-07-20 16:05:17 +00:00
}
};
return callback(UniqueUsernamesStore, items);
2026-07-23 10:11:24 +00:00
})(require("initialize").Store);
2026-07-20 16:05:17 +00:00
tmp4.displayName = "UniqueUsernamesStore";
2026-07-23 10:11:24 +00:00
tmp4 = new tmp4(require("dispatcher"), {
2026-07-20 16:05:17 +00:00
UNIQUE_USERNAME_ATTEMPT_SUCCESS: function handleUniqueUsernameAttemptSuccess(taken) {
const validations = obj.validations;
2026-07-23 10:11:24 +00:00
obj = { taken: taken.taken };
2026-07-20 16:05:17 +00:00
const result = validations.set(taken.username, obj);
},
UNIQUE_USERNAME_ATTEMPT_FAILURE: function handleUniqueUsernameAttemptFailure(statusCode) {
let error;
let retryAfter;
let username;
({ username, error, retryAfter } = statusCode);
if (429 === statusCode.statusCode) {
let validations = obj.validations;
2026-07-23 10:11:24 +00:00
obj = { taken: null, error, rateLimited: true };
2026-07-20 16:05:17 +00:00
let num = 7;
if (null != retryAfter) {
num = retryAfter;
}
2026-07-23 10:11:24 +00:00
const result = validations.set(username, obj, num * importDefault(664).Millis.SECOND);
2026-07-20 16:05:17 +00:00
} else {
validations = obj.validations;
obj = { taken: null, error };
const result1 = validations.set(username, obj);
}
if (null != retryAfter) {
const _Date = Date;
const timestamp = Date.now();
2026-07-23 10:11:24 +00:00
obj.retryAfterTime = timestamp + retryAfter * importDefault(664).Millis.SECOND;
2026-07-20 16:05:17 +00:00
}
},
UNIQUE_USERNAME_SUGGESTIONS_RESET: function handleUniqueUsernameSuggestionsReset() {
2026-07-23 10:11:24 +00:00
const obj = { suggestion: { username: undefined }, fetched: false, usernameSuggestionLoading: false };
2026-07-21 22:01:30 +00:00
obj.suggestions.migration = obj;
2026-07-20 16:05:17 +00:00
obj.suggestions.registration = { suggestion: { username: undefined }, source: undefined, fetched: false };
},
UNIQUE_USERNAME_SUGGESTIONS_SUCCESS: function handleUniqueUsernameSuggestionsSuccess(suggestion) {
suggestion = suggestion.suggestion;
2026-07-23 10:11:24 +00:00
const obj = { suggestion, fetched: true, usernameSuggestionLoading: false };
2026-07-21 22:01:30 +00:00
obj.suggestions.migration = obj;
2026-07-20 16:05:17 +00:00
let prop;
if (null != suggestion) {
prop = suggestion.invalid_current_username;
}
if (true === prop) {
obj.currentUsernameInvalid = true;
}
},
UNIQUE_USERNAME_REGISTRATION_SUGGESTIONS_SUCCESS: function handleUniqueUsernameRegistrationSuggestionsSuccess(source) {
const suggestion = source.suggestion;
let obj = { suggestion, source: source.source, fetched: true };
obj.suggestions.registration = obj;
let username;
if (null != suggestion) {
username = suggestion.username;
}
if (null != username) {
const validations = obj.validations;
obj = { taken: false };
const result = validations.set(suggestion.username, obj);
}
}
2026-07-21 22:01:30 +00:00
});
2026-07-23 10:11:24 +00:00
let result = require("_possibleConstructorReturn").fileFinishedImporting("modules/unique_usernames/UniqueUsernamesStore.tsx");
2026-07-20 16:05:17 +00:00
export default tmp4;