Files
2026-07-28 01:06:53 +03:00

346 lines
23 KiB
TypeScript

/* Metro module 15715; source: modules/user_settings/FrecencyUserSettingsManager.tsx; dependencies: [5, 6, 7, 15, 17, 18, 7863, 7862, 6540, 6582, 6586, 1348, 670, 4238, 672, 1362, 1349, 1350, 4860, 22, 2] */
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import UserSettingsProtoStore from './UserSettingsProtoStore.tsx'; /* Metro dependency 1348 */
import EmojiStore from '../emojis/EmojiStore.tsx'; /* Metro dependency 6540 */
import StickersPersistedStore from '../stickers/StickersPersistedStore.tsx'; /* Metro dependency 6582 */
import FrecencyStore from '../../stores/FrecencyStore.tsx'; /* Metro dependency 6586 */
import ApplicationFrecencyStore from '../applications/ApplicationFrecencyStore.tsx'; /* Metro dependency 7862 */
import ApplicationCommandFrecencyStore from '../application_commands/ApplicationCommandFrecencyStore.tsx'; /* Metro dependency 7863 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as UserSettingsConstantsModule from './UserSettingsConstants.tsx'; /* Metro dependency 670 */
import * as Frecency_user_settingsModule from '../../external/discord_common/js/packages/protos/discord_protos/discord_users/v1/frecency_user_settings.tsx'; /* Metro dependency 1349 */
import * as UserSettingsProtoActionCreatorsModule from './UserSettingsProtoActionCreators.tsx'; /* Metro dependency 1362 */
import * as ApplicationConstantsModule from '../applications/ApplicationConstants.tsx'; /* Metro dependency 4238 */
import * as FrecencyStoreModule from '../../stores/FrecencyStore.tsx'; /* Metro dependency 6586 */
function _fun120600(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120600, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:6, offset: 0x02530c68, size: 634 bytes, params: 8, frame: 23
const env0_0 = require;
const saveProtos = function() {
return _saveProtos.apply(this, arguments);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let Math = global.Math;
let value = Math.random();
let Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
const SECOND = Millis.SECOND;
const env0_18 = 10 + value * (10 * SECOND);
Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
const HOUR = Millis.HOUR;
value = 2 * HOUR;
Math = global.Math;
const floor = Math.floor;
const Math2 = global.Math;
const value2 = Math2.random();
Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
const MINUTE = Millis.MINUTE;
const env0_19 = value + Reflect.apply(floor, Math, [value2 * (10 * MINUTE)]);
value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
value = _fun120614(value);
value = new value();
(FileImportTrackerModule).fileFinishedImporting('modules/user_settings/FrecencyUserSettingsManager.tsx');
exports.default = value;
function _isNativeReflectConstruct_120601() { // fn#120601, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:315, offset: 0x02530ee2, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_120601_isNativeReflectConstruct = function() {
return !!result;
})();
}
function handleConnectionOpen_120604() { // fn#120604, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:650, offset: 0x02530f44, size: 27 bytes, params: 1, frame: 13
resetTimer(env0_18, true);
}
function handleAppStateUpdate_120605(a0) { // fn#120605, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:704, offset: 0x02530f5f, size: 69 bytes, params: 2, frame: 12
if (env0_21 && a0.state !== 'active') {
global.clearTimeout(env0_20);
saveProtos(false);
}
}
function handleConnectionClosed_120606() { // fn#120606, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:800, offset: 0x02530fa4, size: 50 bytes, params: 1, frame: 12
if (env0_21) {
global.clearTimeout(env0_20);
saveProtos(false);
}
}
function _saveProtos() { // fn#120608, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:940, offset: 0x02530fd6, size: 50 bytes, params: 1, frame: 14
return Module00005(_fun120610).apply(this, arguments);
function* _fun120610(a0) { // fn#120610, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:985, offset: 0x02531013, size: 295 bytes, params: 2, frame: 17
var environment;
var r3;
var binding2;
var FrecencyUserSettingsActionCreators;
var binding3;
var value7;
var forEach;
if (true) {
value = environment.__proto__.__proto__;
var binding = env2_28;
binding(env2_19, false);
var hasLoaded = env2_15.hasLoaded;
var FRECENCY_AND_FAVORITES_SETTINGS = env2_16.FRECENCY_AND_FAVORITES_SETTINGS;
if (Reflect.apply(hasLoaded, binding, [FRECENCY_AND_FAVORITES_SETTINGS])) {
binding = env2_1;
binding3 = env2_2;
value7 = binding(binding3[19]);
forEach = value7.forEach;
binding = env2_0;
Reflect.apply(forEach, value7, [binding(binding3[15]).UserSettingsActionCreatorsByType, function(a0) {
a0.markDirtyIfHasPendingChange();
}]);
} else {
binding = env2_12;
r3 = binding.hasPendingUsage() || env2_11.hasPendingUsage();
r3 = !r3 ? env2_9.hasPendingUsage() : r3;
r3 = !r3 ? env2_10.hasPendingUsage() : r3;
r3 = !r3 ? env2_13.hasPendingUsage() && !a0 : r3;
if (r3) {
binding = env2_0;
binding2 = env2_2;
binding(binding2[15]).markUserSettingsLoadOkayForDevelopment();
FrecencyUserSettingsActionCreators = binding(binding2[15]).FrecencyUserSettingsActionCreators;
yield FrecencyUserSettingsActionCreators.loadIfNecessary();
if (false) {
return undefined;
}
binding = env2_1;
binding3 = env2_2;
value7 = binding(binding3[19]);
forEach = value7.forEach;
binding = env2_0;
Reflect.apply(forEach, value7, [binding(binding3[15]).UserSettingsActionCreatorsByType, function(a0) {
a0.markDirtyIfHasPendingChange();
}]);
return undefined;
}
binding = env2_1;
binding3 = env2_2;
value7 = binding(binding3[19]);
forEach = value7.forEach;
binding = env2_0;
Reflect.apply(forEach, value7, [binding(binding3[15]).UserSettingsActionCreatorsByType, function(a0) {
a0.markDirtyIfHasPendingChange();
}]);
}
}
}
}
function resetTimer(a0, a1) { // fn#120612, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:1419, offset: 0x0253114d, size: 73 bytes, params: 3, frame: 14
const env0_0 = a1;
if (env0_20 != null) {
global.clearTimeout(env0_20);
}
env0_20 = global.setTimeout(function() {
return saveProtos(require);
}, a0);
}
function _fun120614(a0) { // fn#120614, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:1515, offset: 0x025311ad, size: 72 bytes, params: 2, frame: 15
const FrecencyUserSettingsManager2 = FrecencyUserSettingsManager;
Inherits(FrecencyUserSettingsManager2, a0);
return CreateClass(FrecencyUserSettingsManager2, [{key: '_initialize', value: value_120616}]);
function FrecencyUserSettingsManager(a0) { // fn#120615, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:1527, offset: 0x025311f5, size: 166 bytes, params: 2, frame: 20
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_4;
binding(this, FrecencyUserSettingsManager);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_7(FrecencyUserSettingsManager);
binding = env1_6;
if (_isNativeReflectConstruct_120601()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items2, env1_7(this).constructor);
r0 = value;
} else {
value = value.apply(this, items2);
r0 = value;
}
value = binding(this, r0);
const handleConnectionOpen_120604Binding = handleConnectionOpen_120604;
value.actions = {POST_CONNECTION_OPEN: handleConnectionOpen_120604Binding,
CONNECTION_RESUMED: handleConnectionOpen_120604Binding, CONNECTION_CLOSED: handleConnectionClosed_120606,
APP_STATE_UPDATE: handleAppStateUpdate_120605};
return value;
}
function value_120616() { // fn#120616, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:2065, offset: 0x0253129b, size: 362 bytes, params: 1, frame: 17
const FrecencyUserSettingsActionCreators = (UserSettingsProtoActionCreatorsModule).FrecencyUserSettingsActionCreators;
let beforeSendCallbacks = FrecencyUserSettingsActionCreators.beforeSendCallbacks;
beforeSendCallbacks.push({hasChanges: function() {
return false;
}, processProto: processProto});
beforeSendCallbacks = FrecencyUserSettingsActionCreators.beforeSendCallbacks;
beforeSendCallbacks.push({hasChanges: hasChanges_120619, processProto: processProto_120620});
beforeSendCallbacks = FrecencyUserSettingsActionCreators.beforeSendCallbacks;
beforeSendCallbacks.push({hasChanges: hasChanges_120621, processProto: processProto_120622});
beforeSendCallbacks = FrecencyUserSettingsActionCreators.beforeSendCallbacks;
beforeSendCallbacks.push({hasChanges: hasChanges_120623, processProto: processProto_120624});
beforeSendCallbacks = FrecencyUserSettingsActionCreators.beforeSendCallbacks;
beforeSendCallbacks.push({hasChanges: hasChanges_120625, processProto: processProto_120626});
beforeSendCallbacks = FrecencyUserSettingsActionCreators.beforeSendCallbacks;
beforeSendCallbacks.push({hasChanges: hasChanges_120627, processProto: processProto_120628});
function value_120616ProcessProto() { // fn#120618, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:2177, owner: value_120616.processProto, offset: 0x02531405, size: 23 bytes, params: 1, frame: 13
resetTimer(env2_19, false);
}
function value_120616HasChanges_120619() { // fn#120619, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:2283, owner: value_120616.hasChanges, offset: 0x0253141c, size: 47 bytes, params: 1, frame: 12
const value = environment.__proto__.__proto__;
return StickersPersistedStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS);
}
function value_120616ProcessProto_120620(a0) { // fn#120620, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:2368, owner: value_120616.processProto, offset: 0x0253144b, size: 153 bytes, params: 2, frame: 16
var StickerFrecency;
var stickerFrecency;
var moduleValue;
if (StickersPersistedStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS)) {
StickerFrecency = (require(1349) /* metro dependency 1349: frecency_user_settings */).StickerFrecency;
a0.stickerFrecency = StickerFrecency.create();
stickerFrecency = a0.stickerFrecency;
moduleValue = require(1350) /* metro dependency 1350: UserSettingsUtils */;
stickerFrecency.stickers = moduleValue.serializeUsageHistory(StickersPersistedStore.stickerFrecencyWithoutFetchingLatest.usageHistory,
100);
}
}
function value_120616HasChanges_120621() { // fn#120621, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:2694, owner: value_120616.hasChanges, offset: 0x025314e4, size: 47 bytes, params: 1, frame: 12
const value = environment.__proto__.__proto__;
return EmojiStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS);
}
function value_120616ProcessProto_120622(a0) { // fn#120622, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:2779, owner: value_120616.processProto, offset: 0x02531513, size: 235 bytes, params: 2, frame: 20
const EmojiFrecency = (Frecency_user_settingsModule).EmojiFrecency;
var create;
var emojiFrecency;
var moduleValue;
var serializeUsageHistory;
var usageHistory;
var emojiReactionFrecency;
var moduleValue2;
if (EmojiStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS)) {
create = EmojiFrecency.create;
a0.emojiFrecency = Reflect.apply(create, EmojiFrecency, []);
create = EmojiFrecency.create;
a0.emojiReactionFrecency = Reflect.apply(create, EmojiFrecency, []);
emojiFrecency = a0.emojiFrecency;
moduleValue = require(1350) /* metro dependency 1350: UserSettingsUtils */;
serializeUsageHistory = moduleValue.serializeUsageHistory;
usageHistory = EmojiStore.emojiFrecencyWithoutFetchingLatest.usageHistory;
emojiFrecency.emojis = Reflect.apply(serializeUsageHistory, moduleValue, [usageHistory, 100]);
emojiReactionFrecency = a0.emojiReactionFrecency;
moduleValue2 = require(1350) /* metro dependency 1350: UserSettingsUtils */;
serializeUsageHistory = moduleValue2.serializeUsageHistory;
usageHistory = EmojiStore.emojiReactionFrecencyWithoutFetchingLatest.usageHistory;
emojiReactionFrecency.emojis = Reflect.apply(serializeUsageHistory, moduleValue2, [usageHistory, 100]);
}
}
function value_120616HasChanges_120623() { // fn#120623, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:3276, owner: value_120616.hasChanges, offset: 0x025315fe, size: 47 bytes, params: 1, frame: 12
const value = environment.__proto__.__proto__;
return ApplicationCommandFrecencyStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS);
}
function value_120616ProcessProto_120624(a0) { // fn#120624, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:3361, owner: value_120616.processProto, offset: 0x0253162d, size: 162 bytes, params: 2, frame: 16
var ApplicationCommandFrecency;
var applicationCommandFrecency;
var moduleValue;
var serializeUsageHistory;
if (ApplicationCommandFrecencyStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS)) {
ApplicationCommandFrecency = (require(1349) /* metro dependency 1349: frecency_user_settings */).ApplicationCommandFrecency;
a0.applicationCommandFrecency = ApplicationCommandFrecency.create();
applicationCommandFrecency = a0.applicationCommandFrecency;
moduleValue = require(1350) /* metro dependency 1350: UserSettingsUtils */;
serializeUsageHistory = moduleValue.serializeUsageHistory;
applicationCommandFrecencyStoreBinding = ApplicationCommandFrecencyStore;
applicationCommandFrecency.applicationCommands = Reflect.apply(serializeUsageHistory, moduleValue,
[applicationCommandFrecencyStoreBinding.getCommandFrecencyWithoutLoadingLatest().usageHistory, 500]);
}
}
function value_120616HasChanges_120625() { // fn#120625, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:3735, owner: value_120616.hasChanges, offset: 0x025316cf, size: 47 bytes, params: 1, frame: 12
const value = environment.__proto__.__proto__;
return ApplicationFrecencyStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS);
}
function value_120616ProcessProto_120626(a0) { // fn#120626, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:3820, owner: value_120616.processProto, offset: 0x025316fe, size: 158 bytes, params: 2, frame: 16
var ApplicationFrecency;
var applicationFrecency;
var moduleValue;
var serializeUsageHistory;
if (ApplicationFrecencyStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS)) {
ApplicationFrecency = (require(1349) /* metro dependency 1349: frecency_user_settings */).ApplicationFrecency;
a0.applicationFrecency = ApplicationFrecency.create();
applicationFrecency = a0.applicationFrecency;
moduleValue = require(1350) /* metro dependency 1350: UserSettingsUtils */;
serializeUsageHistory = moduleValue.serializeUsageHistory;
applicationFrecencyStoreBinding = ApplicationFrecencyStore;
applicationFrecency.applications = Reflect.apply(serializeUsageHistory, moduleValue,
[applicationFrecencyStoreBinding.getApplicationFrecencyWithoutLoadingLatest().usageHistory,
FREQUENCY_ITEM_LIMIT]);
}
}
function value_120616HasChanges_120627() { // fn#120627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:4168, owner: value_120616.hasChanges, offset: 0x0253179c, size: 47 bytes, params: 1, frame: 12
const value = environment.__proto__.__proto__;
return FrecencyStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS);
}
function value_120616ProcessProto_120628(a0) { // fn#120628, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:4253, owner: value_120616.processProto, offset: 0x025317cb, size: 154 bytes, params: 2, frame: 16
var GuildAndChannelFrecency;
var guildAndChannelFrecency;
var moduleValue;
if (FrecencyStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS)) {
GuildAndChannelFrecency = (require(1349) /* metro dependency 1349: frecency_user_settings */).GuildAndChannelFrecency;
a0.guildAndChannelFrecency = GuildAndChannelFrecency.create();
guildAndChannelFrecency = a0.guildAndChannelFrecency;
moduleValue = require(1350) /* metro dependency 1350: UserSettingsUtils */;
guildAndChannelFrecency.guildAndChannels = moduleValue.serializeUsageHistory(FrecencyStore.frecencyWithoutFetchingLatest.usageHistory,
MAX_NUM_SELECTED_ITEMS);
}
}
}
}
}
global.__d(_fun120600, 15715, [5, 6, 7, 15, 17, 18, 7863, 7862, 6540, 6582, 6586, 1348, 670, 4238, 672, 1362, 1349,
1350, 4860, 22,
2]) /* metro module 15715, dependencies: [5, 6, 7, 15, 17, 18, 7863, 7862, 6540, 6582, 6586, 1348, 670, 4238, 672, 1362, 1349, 1350, 4860, 22, 2] */;