1440 lines
55 KiB
TypeScript
1440 lines
55 KiB
TypeScript
// Module ID: 6935
|
|
// Function ID: 6936
|
|
// Name: handleClearCaches
|
|
// Dependencies: [32, 5, 4994, 1218, 1960, 4124, 676, 3, 595, 1957, 6936, 6947, 9, 10, 1956, 6948, 6949, 6950, 6951, 6952, 7105, 7126, 589, 709, 1955, 7111, 7117, 7115, 7109, 1895, 7127, 500, 1352, 7129, 1952, 2]
|
|
|
|
// Module 6935 (handleClearCaches)
|
|
import getToken from "getToken";
|
|
import handleConnectionOpen from "handleConnectionOpen";
|
|
import _handleConnectionOpen from "_handleConnectionOpen";
|
|
import fetchFingerprint from "fetchFingerprint";
|
|
import closure_7 from "handleConnectionOpen";
|
|
import closure_8 from "handleConnectionOpen";
|
|
import ME from "ME";
|
|
import { Store } from "initialize";
|
|
|
|
let c10;
|
|
let c9;
|
|
let closure_12;
|
|
let unpackModuleId;
|
|
const require = arg1;
|
|
function handleClearCaches(type) {
|
|
tmp3.log("Clearing cache store");
|
|
let closure_16 = Date.now();
|
|
const Storage = require(595) /* Storage */.Storage;
|
|
Storage.remove(closure_10);
|
|
const Storage2 = require(595) /* Storage */.Storage;
|
|
Storage2.remove(closure_11);
|
|
const Storage3 = require(595) /* Storage */.Storage;
|
|
Storage3.remove(closure_12);
|
|
let c15 = "no-cache";
|
|
if (tmp5) {
|
|
let c14 = true;
|
|
}
|
|
}
|
|
function _loadChannelHistory() {
|
|
const self = this;
|
|
const tmp = callback((arg0, arg1, arg2) => {
|
|
let closure_0 = arg0;
|
|
let closure_1 = arg1;
|
|
let closure_2 = arg2;
|
|
let c5 = 0;
|
|
let c6 = 0;
|
|
return (function*(arg0, arg1, arg2) {
|
|
if (c6 === 2) {
|
|
c6 = 3;
|
|
HermesBuiltin.throwTypeError();
|
|
} else if (tmp4 === 3) {
|
|
if (arg0 === 1) {
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
let obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c6 = 2;
|
|
if (0 === c5) {
|
|
if (arg0 === 1) {
|
|
c6 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c6 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
let obj5 = tmp5;
|
|
let getToken = tmp2;
|
|
const callback = callback2;
|
|
callback2 = dependencyMap;
|
|
dependencyMap = undefined;
|
|
getToken = undefined;
|
|
obj5 = undefined;
|
|
const _performance3 = performance;
|
|
const nowResult = performance.now();
|
|
dependencyMap = nowResult;
|
|
if (null != callback) {
|
|
if (null != tmp52) {
|
|
let obj4 = callback2(6936);
|
|
c5 = 1;
|
|
c6 = 1;
|
|
const obj1 = { value: null, done: false };
|
|
obj1[0] = obj4.startupLoad(tmp50, tmp51, tmp52, outer1_9);
|
|
return obj1;
|
|
}
|
|
}
|
|
const _HermesInternal = HermesInternal;
|
|
outer1_13.verbose("skipped loaded messages (channel: " + dependencyMap + ", database: " + callback + ").");
|
|
const _performance = performance;
|
|
const items = [performance.now() - nowResult, ];
|
|
const obj2 = { guildId: null, channelId: null, users: null, members: null, messages: null };
|
|
obj2[2] = [];
|
|
obj2[3] = [];
|
|
obj2[4] = [];
|
|
items[1] = obj2;
|
|
c6 = 3;
|
|
const obj3 = { value: null, done: true };
|
|
obj3[0] = items;
|
|
return obj3;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c6 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c6 = 3;
|
|
obj4 = { value: null, done: true };
|
|
obj4[0] = arg1;
|
|
return obj4;
|
|
} else {
|
|
getToken = arg1;
|
|
const _HermesInternal2 = HermesInternal;
|
|
closure_13.verbose("loaded " + getToken.messages.length + " messages (guild: " + callback + ", channel: " + callback2 + ").");
|
|
obj5 = { guildId: null, channelId: null, users: null, members: null, messages: null };
|
|
obj5[0] = callback;
|
|
obj5[1] = callback2;
|
|
obj5[2] = getToken.users;
|
|
obj5[3] = getToken.members;
|
|
obj5[4] = getToken.messages;
|
|
const obj10 = callback2(6947);
|
|
const result = obj10.recordChannelFetchedLocal(callback2, callback(6947).INITIAL_MESSAGE_FETCH_KEY, null, null, closure_9, getToken.messages);
|
|
const _performance2 = performance;
|
|
const items1 = [performance.now() - dependencyMap, obj5];
|
|
c6 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = items1;
|
|
return obj;
|
|
}
|
|
} catch (tmp17) {
|
|
c6 = tmp;
|
|
throw tmp17;
|
|
}
|
|
}
|
|
})();
|
|
});
|
|
const _loadChannelHistory = tmp;
|
|
const apply = tmp.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
function _loadEarlyCache() {
|
|
let self = this;
|
|
const tmp = callback((arg0, arg1, arg2) => {
|
|
let closure_0 = arg0;
|
|
let closure_1 = arg1;
|
|
let closure_2 = arg2;
|
|
let c8 = 0;
|
|
let c9 = 0;
|
|
return (function*(arg0, arg1, arg2) {
|
|
if (dependencyMap2 === 2) {
|
|
dependencyMap2 = 3;
|
|
HermesBuiltin.throwTypeError();
|
|
} else {
|
|
let verboseResult = arg1;
|
|
verboseResult = arg0;
|
|
verboseResult = tmp4;
|
|
if (tmp5 === 3) {
|
|
if (arg0 === 1) {
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
let obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
dependencyMap2 = 2;
|
|
if (0 === guildId) {
|
|
if (arg0 === 1) {
|
|
dependencyMap2 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
dependencyMap2 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
let closure_7 = tmp2;
|
|
let fetchFingerprint = tmp3;
|
|
verboseResult = name;
|
|
verboseResult = callback;
|
|
verboseResult = dependencyMap;
|
|
let callback2;
|
|
let c4;
|
|
let c5;
|
|
fetchFingerprint = undefined;
|
|
closure_7 = undefined;
|
|
guildId = undefined;
|
|
dependencyMap2 = undefined;
|
|
let closure_10;
|
|
let closure_11;
|
|
let length;
|
|
let closure_13;
|
|
let closure_14;
|
|
let closure_15;
|
|
let length2;
|
|
let length3;
|
|
let closure_18;
|
|
let closure_19;
|
|
let c20;
|
|
guildId = undefined;
|
|
verboseResult = outer1_13;
|
|
verboseResult = outer1_13.verbose("loading early cache");
|
|
verboseResult = outer1_5;
|
|
const socket = outer1_5.getSocket();
|
|
callback2 = socket;
|
|
verboseResult = socket.connect();
|
|
verboseResult = guildId;
|
|
verboseResult = guildId.getGuildId();
|
|
callback2 = verboseResult;
|
|
verboseResult = null;
|
|
if (verboseResult == null) {
|
|
callback2 = null;
|
|
}
|
|
c4 = callback2;
|
|
let channelId = outer1_7.getChannelId();
|
|
c4 = channelId;
|
|
if (channelId == null) {
|
|
c4 = null;
|
|
}
|
|
c5 = c4;
|
|
let allResult = globalThis;
|
|
const _performance = performance;
|
|
fetchFingerprint = performance.now();
|
|
const loadCachedMessages = callback(9).loadCachedMessages;
|
|
const result = loadCachedMessages.measureAsyncWithoutNesting(() => (function loadChannelHistory(closure_0, c4, c5) {
|
|
const self = this;
|
|
const apply = closure_20.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
})(closure_0, c4, c5));
|
|
const fetchGuildCache = callback(9).fetchGuildCache;
|
|
const fetchGuildCache2 = callback(9).fetchGuildCache;
|
|
const measureAsyncResult = fetchGuildCache.measureAsync(() => (function loadInitialGuilds(closure_0, closure_2) {
|
|
const self = this;
|
|
const apply = closure_23.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
})(closure_0, closure_2));
|
|
if (null != verboseResult) {
|
|
let timeAsyncResult = callback(10).timeAsync("\u{1F4BE}", "cache: private_channels", () => callback2(1956).getAsync(closure_0, null));
|
|
const obj8 = callback(10);
|
|
} else {
|
|
timeAsyncResult = Promise.resolve([]);
|
|
}
|
|
if (null == verboseResult) {
|
|
let resolved = Promise.resolve({});
|
|
} else {
|
|
resolved = callback(10).timeAsync("\u{1F4BE}", "cache: user_settings", () => callback2(6948).getAll(closure_0));
|
|
const obj9 = callback(10);
|
|
}
|
|
if (null == verboseResult) {
|
|
let resolved1 = Promise.resolve([]);
|
|
} else {
|
|
resolved1 = callback(10).timeAsync("\u{1F4BE}", "cache: read_states", () => callback2(6949).getAll(closure_0));
|
|
const obj10 = callback(10);
|
|
}
|
|
if (null == verboseResult) {
|
|
let resolveResult = allResult.Promise.resolve([]);
|
|
const _Promise5 = allResult.Promise;
|
|
} else {
|
|
resolveResult = callback(10).timeAsync("\u{1F4BE}", "cache: user_guild_settings", () => callback2(6950).getAll(closure_0));
|
|
const obj11 = callback(10);
|
|
}
|
|
callback(6951)("AllCacheStores", () => callback(6952));
|
|
callback(6951)("MobileAppDatabaseManager", () => callback(7105));
|
|
let items = [
|
|
result,
|
|
measureAsyncResult,
|
|
fetchGuildCache2.measureAsync(() => (function loadInitialGuildChannels(closure_0, closure_2) {
|
|
const self = this;
|
|
const apply = closure_24.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
})(closure_0, closure_2)),
|
|
timeAsyncResult,
|
|
resolved,
|
|
resolved1,
|
|
resolveResult
|
|
];
|
|
allResult = allResult.Promise.all(items);
|
|
guildId = 1;
|
|
dependencyMap2 = 1;
|
|
const _Promise6 = allResult.Promise;
|
|
const measureAsyncResult1 = fetchGuildCache2.measureAsync(() => (function loadInitialGuildChannels(closure_0, closure_2) {
|
|
const self = this;
|
|
const apply = closure_24.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
})(closure_0, closure_2));
|
|
}
|
|
} else if (1 === tmp6) {
|
|
if (arg0 === 1) {
|
|
dependencyMap2 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
dependencyMap2 = 3;
|
|
let obj1 = { value: null, done: true };
|
|
obj1[0] = arg1;
|
|
return obj1;
|
|
} else {
|
|
verboseResult = fetchFingerprint;
|
|
verboseResult = closure_7;
|
|
closure_7 = arg1;
|
|
verboseResult = callback2;
|
|
verboseResult = closure_7;
|
|
guildId = callback2(closure_7, 7);
|
|
verboseResult = guildId;
|
|
dependencyMap2 = callback2(guildId[0], 2);
|
|
verboseResult = dependencyMap2;
|
|
closure_10 = 32;
|
|
verboseResult = dependencyMap2;
|
|
closure_11 = 5;
|
|
verboseResult = guildId;
|
|
length = guildId[1];
|
|
verboseResult = guildId;
|
|
closure_13 = guildId[2];
|
|
verboseResult = guildId;
|
|
closure_14 = guildId[3];
|
|
verboseResult = guildId;
|
|
closure_15 = guildId[4];
|
|
verboseResult = guildId;
|
|
length2 = guildId[5];
|
|
verboseResult = guildId;
|
|
length3 = guildId[6];
|
|
verboseResult = globalThis;
|
|
const _performance2 = performance;
|
|
verboseResult = fetchFingerprint;
|
|
closure_18 = performance.now() - fetchFingerprint;
|
|
verboseResult = closure_13;
|
|
verboseResult = closure_18;
|
|
verboseResult = closure_10;
|
|
const _HermesInternal2 = HermesInternal;
|
|
verboseResult = closure_13.verbose("cache loaded in " + closure_18 + "ms (channel_history " + closure_10 + "ms)");
|
|
verboseResult = closure_11;
|
|
verboseResult = null;
|
|
if (null == closure_11) {
|
|
callback(7126)("database:history_cache_null");
|
|
closure_13.verbose("finished without dispatching CACHE_LOADED");
|
|
const items1 = [false, null, 0];
|
|
dependencyMap2 = 3;
|
|
const obj2 = { value: null, done: true };
|
|
obj2[0] = items1;
|
|
return obj2;
|
|
} else {
|
|
verboseResult = fetchFingerprint;
|
|
const _Object2 = Object;
|
|
verboseResult = closure_11;
|
|
const members = closure_11.members;
|
|
closure_19 = Object.fromEntries(members.map((userId) => {
|
|
const items = [userId.userId, userId];
|
|
return items;
|
|
}));
|
|
verboseResult = closure_13;
|
|
let tmp52 = null != closure_13.guildId;
|
|
if (tmp52) {
|
|
tmp52 = null != closure_13.channels;
|
|
}
|
|
c20 = tmp52;
|
|
guildId = closure_13.guildId;
|
|
const promise = new Promise((arg0, arg1) => {
|
|
let closure_0 = arg0;
|
|
const callback2 = arg1;
|
|
const Emitter = callback2(589).Emitter;
|
|
return Emitter.batched(() => {
|
|
callback(10).time("\u{1F4BE}", "Dispatch Mini Cache", () => { ... });
|
|
let obj = callback(10);
|
|
callback(10).time("\u{1F4BE}", "socket.processFirstQueuedDispatch()", () => { ... });
|
|
});
|
|
});
|
|
guildId = 2;
|
|
dependencyMap2 = 1;
|
|
const obj3 = { value: null, done: false };
|
|
obj3[0] = promise;
|
|
return obj3;
|
|
}
|
|
}
|
|
} else if (arg0 === 1) {
|
|
dependencyMap2 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
dependencyMap2 = 3;
|
|
const obj4 = { value: null, done: true };
|
|
obj4[0] = arg1;
|
|
return obj4;
|
|
} else {
|
|
verboseResult = fetchFingerprint;
|
|
verboseResult = closure_7;
|
|
verboseResult = callback;
|
|
verboseResult = c4;
|
|
verboseResult = c5;
|
|
verboseResult = globalThis;
|
|
const _JSON = JSON;
|
|
verboseResult = dependencyMap;
|
|
verboseResult = closure_13;
|
|
verboseResult = JSON.stringify(dependencyMap);
|
|
verboseResult = name;
|
|
verboseResult = null;
|
|
verboseResult = null != name;
|
|
name = undefined;
|
|
if (name != null) {
|
|
name = name.name;
|
|
}
|
|
length = closure_14.length;
|
|
guildId = closure_11.guildId;
|
|
channelId = closure_11.channelId;
|
|
length2 = closure_11.messages.length;
|
|
length3 = closure_11.members.length;
|
|
let channels = closure_13.channels;
|
|
length = undefined;
|
|
if (channels != null) {
|
|
length = channels.length;
|
|
}
|
|
const _Object = Object;
|
|
const _HermesInternal = HermesInternal;
|
|
closure_13.verbose("early_cache_summary: (\n ok: true\n meta:\n auth_user_id: " + verboseResult + "\n selected_guild: " + verboseResult + "\n selected_channel: " + verboseResult + "\n navigation_state: " + verboseResult + "\n database: " + verboseResult + "\n name: " + name + "\n data:\n database:\n private_channels: " + length + "\n channel_history:\n guild: " + guildId + "\n channel: " + channelId + "\n messages: " + length2 + "\n members: " + length3 + "\n users: " + closure_11.users.length + "\n initial_guild:\n id: " + guildId + "\n channels: " + length + "\n user_settings: " + Object.keys(closure_15).length + "\n read_states: " + length2.length + "\n user_guild_settings: " + length3.length + "\n )");
|
|
obj = callback(9);
|
|
const obj5 = { guilds: null };
|
|
obj5[0] = length.length;
|
|
obj.setEarlyCacheInfo(obj5);
|
|
closure_13.verbose("finished dispatching CACHE_LOADED");
|
|
const items2 = [true, , ];
|
|
let tmp45 = null;
|
|
if (c20) {
|
|
c5 = guildId;
|
|
if (guildId == null) {
|
|
c5 = null;
|
|
}
|
|
tmp45 = c5;
|
|
}
|
|
items2[1] = tmp45;
|
|
items2[2] = closure_14.length;
|
|
dependencyMap2 = 3;
|
|
const obj6 = { value: null, done: true };
|
|
obj6[0] = items2;
|
|
return obj6;
|
|
}
|
|
} catch (tmp97) {
|
|
dependencyMap2 = verboseResult;
|
|
throw tmp97;
|
|
}
|
|
}
|
|
}
|
|
})();
|
|
});
|
|
const _loadEarlyCache = tmp;
|
|
let apply = tmp.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
function _loadInitialGuilds() {
|
|
const self = this;
|
|
const tmp = callback((arg0, arg1) => {
|
|
let closure_0 = arg0;
|
|
let closure_1 = arg1;
|
|
let c6 = 0;
|
|
let c7 = 0;
|
|
return (function*(arg0, initial_guild_id) {
|
|
if (c7 === 2) {
|
|
c7 = 3;
|
|
HermesBuiltin.throwTypeError();
|
|
} else if (tmp4 === 3) {
|
|
if (arg0 === 1) {
|
|
throw initial_guild_id;
|
|
} else if (arg0 === 2) {
|
|
let obj = { value: null, done: true };
|
|
obj[0] = initial_guild_id;
|
|
return obj;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c7 = 2;
|
|
if (0 === c6) {
|
|
if (arg0 === 1) {
|
|
c7 = 3;
|
|
throw initial_guild_id;
|
|
} else if (arg0 === 2) {
|
|
c7 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = initial_guild_id;
|
|
return obj;
|
|
} else {
|
|
let _handleConnectionOpen = tmp2;
|
|
let handleConnectionOpen = tmp5;
|
|
let table;
|
|
let guildId;
|
|
if (null == callback) {
|
|
c7 = 3;
|
|
let obj1 = { value: null, done: true };
|
|
obj1[0] = [];
|
|
return obj1;
|
|
} else {
|
|
const page = tmp36.page;
|
|
if ("private-channels" !== page) {
|
|
if ("guild-channels" !== page) {
|
|
if ("other" === page) {
|
|
if ("@me" === tmp36.guildId) {
|
|
let outer1_22 = true;
|
|
}
|
|
}
|
|
}
|
|
if (outer1_22) {
|
|
c6 = 1;
|
|
c7 = 1;
|
|
const obj2 = { value: null, done: false };
|
|
obj2[0] = callback(outer1_2[24]).tryLoadAsync(() => callback(10).timeAsync("\u{1F4BE}", "cache: guilds", () => outer1_1(outer1_2[25]).getAsync(closure_0)));
|
|
return obj2;
|
|
} else {
|
|
let obj7 = lib(outer1_2[26]);
|
|
c6 = 2;
|
|
c7 = 1;
|
|
const obj3 = { value: null, done: false };
|
|
obj3[0] = obj7.getCommittedVersions();
|
|
return obj3;
|
|
}
|
|
}
|
|
outer1_22 = true;
|
|
}
|
|
}
|
|
} else if (1 === tmp5) {
|
|
if (arg0 === 1) {
|
|
c7 = 3;
|
|
throw initial_guild_id;
|
|
} else if (arg0 === 2) {
|
|
c7 = 3;
|
|
const obj4 = { value: null, done: true };
|
|
obj4[0] = initial_guild_id;
|
|
return obj4;
|
|
} else {
|
|
table = initial_guild_id;
|
|
if (initial_guild_id == null) {
|
|
table = [];
|
|
}
|
|
c7 = 3;
|
|
const obj5 = { value: null, done: true };
|
|
obj5[0] = table;
|
|
return obj5;
|
|
}
|
|
} else if (2 === tmp5) {
|
|
if (arg0 === 1) {
|
|
c7 = 3;
|
|
throw initial_guild_id;
|
|
} else if (arg0 === 2) {
|
|
c7 = 3;
|
|
const obj6 = { value: null, done: true };
|
|
obj6[0] = initial_guild_id;
|
|
return obj6;
|
|
} else {
|
|
initial_guild_id = initial_guild_id.initial_guild_id;
|
|
guildId = initial_guild_id;
|
|
if (initial_guild_id == null) {
|
|
guildId = lib.guildId;
|
|
}
|
|
table = guildId;
|
|
if (null != table) {
|
|
if ("@me" !== table) {
|
|
obj1 = callback(table[24]);
|
|
c6 = 3;
|
|
c7 = 1;
|
|
obj7 = { value: null, done: false };
|
|
obj7[0] = obj1.tryLoadAsync(() => callback(7111).getOneAsync(closure_0, dependencyMap));
|
|
return obj7;
|
|
}
|
|
}
|
|
c7 = 3;
|
|
const obj8 = { value: null, done: true };
|
|
obj8[0] = [];
|
|
return obj8;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c7 = 3;
|
|
throw initial_guild_id;
|
|
} else if (arg0 === 2) {
|
|
c7 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = initial_guild_id;
|
|
return obj;
|
|
} else {
|
|
guildId = initial_guild_id;
|
|
if (null != guildId) {
|
|
const items = [guildId];
|
|
} else {
|
|
const items1 = [];
|
|
}
|
|
c7 = 3;
|
|
}
|
|
} catch (tmp28) {
|
|
c7 = tmp;
|
|
throw tmp28;
|
|
}
|
|
}
|
|
})();
|
|
});
|
|
const _loadInitialGuilds = tmp;
|
|
const apply = tmp.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
function _loadInitialGuildChannels() {
|
|
const self = this;
|
|
const tmp = callback((arg0, arg1) => {
|
|
let closure_0 = arg0;
|
|
let closure_1 = arg1;
|
|
let c5 = 0;
|
|
let c6 = 0;
|
|
return (function*(arg0, initial_guild_id) {
|
|
if (c6 === 2) {
|
|
c6 = 3;
|
|
HermesBuiltin.throwTypeError();
|
|
} else if (tmp4 === 3) {
|
|
if (arg0 === 1) {
|
|
throw initial_guild_id;
|
|
} else if (arg0 === 2) {
|
|
let obj = { value: null, done: true };
|
|
obj[0] = initial_guild_id;
|
|
return obj;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c6 = 2;
|
|
if (0 === c5) {
|
|
if (arg0 === 1) {
|
|
c6 = 3;
|
|
throw initial_guild_id;
|
|
} else if (arg0 === 2) {
|
|
c6 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = initial_guild_id;
|
|
return obj;
|
|
} else {
|
|
let handleConnectionOpen = tmp5;
|
|
let getToken = tmp2;
|
|
let table;
|
|
getToken = undefined;
|
|
if (null == callback) {
|
|
c6 = 3;
|
|
const obj1 = { value: null, done: true };
|
|
obj1[0] = Promise.resolve({ channels: null, guildId: null });
|
|
return obj1;
|
|
} else {
|
|
let obj6 = lib(outer1_2[26]);
|
|
c5 = 1;
|
|
c6 = 1;
|
|
let obj2 = { value: null, done: false };
|
|
obj2[0] = obj6.getCommittedVersions();
|
|
return obj2;
|
|
}
|
|
}
|
|
} else if (1 === tmp5) {
|
|
if (arg0 === 1) {
|
|
c6 = 3;
|
|
throw initial_guild_id;
|
|
} else if (arg0 === 2) {
|
|
c6 = 3;
|
|
const obj3 = { value: null, done: true };
|
|
obj3[0] = initial_guild_id;
|
|
return obj3;
|
|
} else {
|
|
table = initial_guild_id.initial_guild_id;
|
|
let tmp12 = null == table;
|
|
if (tmp12) {
|
|
tmp12 = "guild-channels" === lib.page;
|
|
}
|
|
if (tmp12) {
|
|
table = lib.guildId;
|
|
}
|
|
if (null != callback) {
|
|
if (null != table) {
|
|
getToken = table;
|
|
table = {};
|
|
obj2 = callback(table[24]);
|
|
c5 = 2;
|
|
c6 = 1;
|
|
const obj4 = { value: null, done: false };
|
|
obj4[0] = obj2.tryLoadAsync(() => callback(table[14]).getAsync(closure_0, getToken));
|
|
return obj4;
|
|
}
|
|
}
|
|
const _HermesInternal = HermesInternal;
|
|
closure_13.verbose("skipped loading initial guild (guild: " + table + ", database: " + callback + ")");
|
|
c6 = 3;
|
|
const obj5 = { value: null, done: true };
|
|
obj5[0] = Promise.resolve({ channels: null, guildId: null });
|
|
return obj5;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c6 = 3;
|
|
throw initial_guild_id;
|
|
} else if (arg0 === 2) {
|
|
c6 = 3;
|
|
obj6 = { value: null, done: true };
|
|
obj6[0] = initial_guild_id;
|
|
return obj6;
|
|
} else {
|
|
table.channels = initial_guild_id;
|
|
table.guildId = table;
|
|
c6 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = table;
|
|
return obj;
|
|
}
|
|
} catch (tmp34) {
|
|
c6 = tmp;
|
|
throw tmp34;
|
|
}
|
|
}
|
|
})();
|
|
});
|
|
const _loadInitialGuildChannels = tmp;
|
|
const apply = tmp.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
function _loadLateLazyCache() {
|
|
const self = this;
|
|
const tmp = callback((arg0, arg1, arg2, arg3) => {
|
|
let closure_0 = arg0;
|
|
let closure_1 = arg1;
|
|
let closure_2 = arg2;
|
|
let getToken = arg3;
|
|
let c6 = 0;
|
|
let c7 = 0;
|
|
return (function*(arg0, arg1, arg2, arg3) {
|
|
if (c7 === 2) {
|
|
c7 = 3;
|
|
HermesBuiltin.throwTypeError();
|
|
} else if (tmp4 === 3) {
|
|
if (arg0 === 1) {
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
let obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c7 = 2;
|
|
if (0 === c6) {
|
|
if (arg0 === 1) {
|
|
c7 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c7 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
let socket = tmp2;
|
|
let handleConnectionOpen = tmp5;
|
|
handleConnectionOpen = undefined;
|
|
socket = undefined;
|
|
c6 = undefined;
|
|
c7 = undefined;
|
|
let closure_8;
|
|
let closure_9;
|
|
let socket2;
|
|
outer1_13.verbose("loading late lazy cache");
|
|
const fetchLazyCache = callback2(9).fetchLazyCache;
|
|
c6 = 1;
|
|
c7 = 1;
|
|
let obj1 = { value: null, done: false };
|
|
obj1[0] = fetchLazyCache.measureAsync(() => {
|
|
const items = [
|
|
callback(1955).tryLoadAsync(() => {
|
|
if (null != closure_0) {
|
|
let timeAsyncResult = outer1_1(outer1_2[13]).timeAsync("\u{1F4BE}", "cache: cache_version", () => { ... });
|
|
const obj = outer1_1(outer1_2[13]);
|
|
} else {
|
|
timeAsyncResult = Promise.resolve(true);
|
|
}
|
|
return timeAsyncResult;
|
|
}),
|
|
,
|
|
|
|
];
|
|
let obj = callback(1955);
|
|
items[1] = callback(1955).tryLoadAsync(() => {
|
|
if (null != closure_0) {
|
|
if (!outer1_22) {
|
|
let timeAsyncResult = outer1_1(outer1_2[13]).timeAsync("\u{1F4BE}", "cache: lazy guilds", () => { ... });
|
|
const obj = outer1_1(outer1_2[13]);
|
|
}
|
|
return timeAsyncResult;
|
|
}
|
|
timeAsyncResult = Promise.resolve([]);
|
|
});
|
|
let obj2 = callback(1955);
|
|
items[2] = callback(1955).tryLoadAsync(() => {
|
|
if (null != closure_0) {
|
|
let timeAsyncResult = outer1_1(outer1_2[13]).timeAsync("\u{1F4BE}", "cache: basic_channels", () => { ... });
|
|
const obj2 = outer1_1(outer1_2[13]);
|
|
} else {
|
|
const obj = { all: null, stale: null, channels: null };
|
|
obj[0] = [];
|
|
obj[1] = [];
|
|
obj[2] = [];
|
|
timeAsyncResult = Promise.resolve(obj);
|
|
}
|
|
return timeAsyncResult;
|
|
});
|
|
return Promise.all(items);
|
|
});
|
|
return obj1;
|
|
}
|
|
} else if (1 === tmp5) {
|
|
if (arg0 === 1) {
|
|
c7 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c7 = 3;
|
|
let obj2 = { value: null, done: true };
|
|
obj2[0] = arg1;
|
|
return obj2;
|
|
} else {
|
|
handleConnectionOpen = arg1;
|
|
socket = callback3(handleConnectionOpen, 3);
|
|
c6 = socket[0];
|
|
c7 = socket[1];
|
|
closure_8 = socket[2];
|
|
const fetchStaleChannels = callback2(9).fetchStaleChannels;
|
|
c6 = 2;
|
|
c7 = 1;
|
|
const obj3 = { value: null, done: false };
|
|
obj3[0] = fetchStaleChannels.measureAsync(() => {
|
|
if (null != callback) {
|
|
if (null != closure_8) {
|
|
if (closure_8.stale.length > 0) {
|
|
let tryLoadAsyncResult = callback(1955).tryLoadAsync(() => {
|
|
stale = stale.stale;
|
|
outer1_13.verbose("loading stale guild channels (count: " + stale.length + ", ids: " + stale.join(", ") + ")");
|
|
return Promise.all(stale.map(() => { ... }));
|
|
});
|
|
const obj = callback(1955);
|
|
}
|
|
return tryLoadAsyncResult;
|
|
}
|
|
}
|
|
tryLoadAsyncResult = Promise.resolve([]);
|
|
});
|
|
return obj3;
|
|
}
|
|
} else {
|
|
if (2 === tmp5) {
|
|
if (arg0 === 1) {
|
|
c7 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c7 = 3;
|
|
const obj4 = { value: null, done: true };
|
|
obj4[0] = arg1;
|
|
return obj4;
|
|
} else {
|
|
closure_9 = arg1;
|
|
const DelayLoadLateLazyCacheHoldoutExperiment = callback(1895).DelayLoadLateLazyCacheHoldoutExperiment;
|
|
verbose = verbose.verbose;
|
|
if (DelayLoadLateLazyCacheHoldoutExperiment.getCachedEnabled()) {
|
|
verbose("loadLateLazyCache: not yielding to react");
|
|
} else {
|
|
verbose("loadLateLazyCache: yielding to react");
|
|
obj1 = callback(7127);
|
|
obj2 = callback(500);
|
|
let num4;
|
|
if (obj2.isIOS()) {
|
|
num4 = 0;
|
|
}
|
|
c6 = 3;
|
|
c7 = 1;
|
|
const obj5 = { value: null, done: false };
|
|
obj5[0] = obj1.waitSafelyForPostTTI(num4);
|
|
return obj5;
|
|
}
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c7 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c7 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
}
|
|
const loadLazyCache = callback2(9).loadLazyCache;
|
|
loadLazyCache.recordStart();
|
|
socket2 = socket.getSocket();
|
|
callback4(() => {
|
|
if (false === c6) {
|
|
callback2(7126)("database:not_ok");
|
|
callback2(709).dispatch({ type: "CLEAR_CACHES", reason: "database:not_ok" });
|
|
const obj10 = callback2(709);
|
|
callback2(709).dispatch({ type: "CACHE_LOADED_LAZY_NO_CACHE" });
|
|
} else {
|
|
if (null != c7) {
|
|
if (null != closure_8) {
|
|
if (null != closure_9) {
|
|
if (null == c6) {
|
|
callback2(7126)("database:versionless");
|
|
outer1_13.log("kv_cache was not ok (null version with values)");
|
|
callback2(709).dispatch({ type: "CLEAR_CACHES", reason: "database:versionless" });
|
|
const obj6 = callback2(709);
|
|
callback2(709).dispatch({ type: "CACHE_LOADED_LAZY_NO_CACHE" });
|
|
}
|
|
if (outer1_18) {
|
|
callback2(7126)("already_connected");
|
|
outer1_13.log("Skipping lazy cache; already connected.");
|
|
callback2(709).dispatch({ type: "CACHE_LOADED_LAZY_NO_CACHE" });
|
|
} else {
|
|
closure_10.addAnalytics({ hadCacheAtStartup: true });
|
|
let obj = { type: "CACHE_LOADED_LAZY", guilds: null, guildChannels: null, basicGuildChannels: null, initialGuildId: null };
|
|
obj[1] = c7;
|
|
obj[2] = closure_9;
|
|
obj[3] = closure_8.channels;
|
|
obj[4] = dependencyMap;
|
|
const deserializeCache = callback2(9).deserializeCache;
|
|
deserializeCache.measure(() => {
|
|
if (null != obj.channels) {
|
|
outer1_1(outer1_2[9])(tmp.channels);
|
|
}
|
|
if (null != obj.privateChannels) {
|
|
outer1_1(outer1_2[9])(tmp.privateChannels);
|
|
}
|
|
if (null != obj.guildChannels) {
|
|
obj = obj(outer1_2[9]);
|
|
const result = obj.deserializeChannelEntries(tmp.guildChannels);
|
|
}
|
|
});
|
|
const dispatchLazyCache = callback2(9).dispatchLazyCache;
|
|
dispatchLazyCache.measure(() => {
|
|
const obj = outer1_1(outer1_2[23]);
|
|
return obj.dispatch(obj);
|
|
});
|
|
const _performance = performance;
|
|
const _HermesInternal = HermesInternal;
|
|
outer1_13.verbose("late lazy cache loaded (ok: true, took: " + performance.now() - tmp + "ms)");
|
|
closure_10.addAnalytics({ usedCacheAtStartup: true });
|
|
const reduced = closure_9.reduce((arg0, arg1) => {
|
|
let arr;
|
|
[, arr] = arg1;
|
|
return arg0 + arr.length;
|
|
}, 0);
|
|
const all = closure_8.all;
|
|
const reduced1 = all.reduce((arg0, arg1) => {
|
|
let arr;
|
|
[, arr] = arg1;
|
|
return arg0 + arr.length;
|
|
}, 0);
|
|
const channels = closure_8.channels;
|
|
const reduced2 = channels.reduce((arg0, arg1) => {
|
|
let arr;
|
|
[, arr] = arg1;
|
|
return arg0 + arr.length;
|
|
}, 0);
|
|
const diff = reduced1 - reduced2;
|
|
let str3 = "";
|
|
if (0 !== closure_8.stale.length) {
|
|
const stale = closure_8.stale;
|
|
const _HermesInternal2 = HermesInternal;
|
|
str3 = " \u00B7 " + stale.join(", ");
|
|
}
|
|
let name;
|
|
if (obj != null) {
|
|
name = obj.name;
|
|
}
|
|
const _HermesInternal3 = HermesInternal;
|
|
outer1_13.verbose("lazy_cache_summary: (\n ok: true\n meta:\n auth_user_id: " + callback2 + "\n initial_guild: " + dependencyMap + "\n database: " + null != obj + "\n ok: " + c6 + "\n name: " + name + "\n data:\n database:\n guilds: " + c7.length + "\n basic_channels:\n total: " + reduced1 + " (" + closure_8.channels.length + " guilds)\n stale: " + diff + " (" + closure_8.stale.length + " guilds" + str3 + ")\n unstale: " + reduced2 + "\n full_channels (guilds_with_stale_basic_channels):\n total: " + reduced + " (" + closure_9.length + " guilds)\n )");
|
|
obj = { guilds: null, privateChannels: null, basicChannels: null, basicChannelsStale: null, fullChannels: null, fullChannelGuilds: null };
|
|
obj[0] = c7.length;
|
|
obj[1] = getToken;
|
|
obj[2] = reduced1;
|
|
obj[3] = diff;
|
|
obj[4] = reduced;
|
|
obj[5] = closure_9.length;
|
|
callback2(9).setLazyCacheInfo(obj);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
callback2(7126)("database:load_failed");
|
|
const _HermesInternal4 = HermesInternal;
|
|
outer1_13.log("couldn't load database item (\n database: " + null != obj + "\n basic_channels: " + null != closure_8 + "\n guild_channels: " + null != closure_9 + "\n guilds: " + null != c7 + "\n )");
|
|
callback2(709).dispatch({ type: "CLEAR_CACHES", reason: "database:load_failed" });
|
|
const obj8 = callback2(709);
|
|
callback2(709).dispatch({ type: "CACHE_LOADED_LAZY_NO_CACHE" });
|
|
}
|
|
});
|
|
c7 = 3;
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} catch (tmp20) {
|
|
c7 = tmp;
|
|
throw tmp20;
|
|
}
|
|
}
|
|
})();
|
|
});
|
|
const _loadLateLazyCache = tmp;
|
|
const apply = tmp.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
function resumeFluxAndSocket(arg0) {
|
|
let closure_0 = arg0;
|
|
const importDefault = socket.getSocket();
|
|
const dependencyMap = false;
|
|
const Emitter = importDefault(589).Emitter;
|
|
Emitter.batched(() => {
|
|
try {
|
|
f119182();
|
|
let dispatcher = lib.dispatcher;
|
|
if (dispatcher.hasStuffToDispatchNow()) {
|
|
const dependencyMap = true;
|
|
const loadLazyCache = lib(9).loadLazyCache;
|
|
loadLazyCache.recordEnd();
|
|
outer1_13.verbose("Processing First Queued Dispatch");
|
|
const dispatcher3 = tmp3.dispatcher;
|
|
const _Set = Set;
|
|
const set = new Set(["READY", "INITIAL_GUILD"]);
|
|
const result = dispatcher3.processFirstQueuedDispatch(set);
|
|
const _setTimeout = setTimeout;
|
|
const timerId = setTimeout(() => {
|
|
outer1_13.verbose("Unpausing Dispatch Queue");
|
|
dispatcher = dispatcher.dispatcher;
|
|
dispatcher.unpauseDispatchQueue();
|
|
}, 100);
|
|
} else {
|
|
outer1_13.verbose("Unpausing Dispatch Queue");
|
|
const dispatcher2 = tmp3.dispatcher;
|
|
dispatcher2.unpauseDispatchQueue();
|
|
}
|
|
} catch (tmp19) {
|
|
outer1_13.warn("Lazy cache has encountered error", tmp19);
|
|
let obj = lib(709);
|
|
obj = { type: "RESET_SOCKET", args: null };
|
|
obj = { error: null, action: "LazyCache" };
|
|
obj[0] = tmp19;
|
|
obj[1] = obj;
|
|
obj.dispatch(obj);
|
|
}
|
|
});
|
|
if (!dependencyMap) {
|
|
const loadLazyCache = importDefault(9).loadLazyCache;
|
|
loadLazyCache.recordEnd();
|
|
}
|
|
}
|
|
({ MAX_MESSAGES_PER_CHANNEL: c9, CACHE_STORE_KEY: c10, CACHE_STORE_LAZY_KEY: unpackModuleId, CACHE_STORE_CHANNELS_LAZY_KEY: closure_12 } = ME);
|
|
let c14 = false;
|
|
const initializing = "initializing";
|
|
let c16 = 0;
|
|
let c17 = false;
|
|
let c18 = false;
|
|
let c19 = false;
|
|
let c22 = false;
|
|
class CacheStoreClass extends Store {
|
|
}
|
|
const prototype = CacheStoreClass.prototype;
|
|
prototype["initialize"] = function initialize() {
|
|
this.waitFor(fetchFingerprint, _handleConnectionOpen, closure_7, closure_8);
|
|
};
|
|
prototype["hasCache"] = function hasCache() {
|
|
return c17;
|
|
};
|
|
prototype["getLazyCacheStatus"] = function getLazyCacheStatus() {
|
|
return initializing;
|
|
};
|
|
Object.defineProperty(prototype, "lastWriteTime", {
|
|
get: function lastWriteTime() {
|
|
return c16;
|
|
},
|
|
set: undefined
|
|
});
|
|
prototype["canWriteCaches"] = function canWriteCaches(flag) {
|
|
if (obj.isAuthenticated()) {
|
|
if (c14) {
|
|
tmp3.log("Not writing cache because caches cleared");
|
|
let flag2 = false;
|
|
} else {
|
|
let tmp5 = !flag;
|
|
if (!flag) {
|
|
tmp5 = !c19;
|
|
}
|
|
flag2 = !tmp5;
|
|
if (tmp5) {
|
|
tmp3.log("Not writing cache because never connected");
|
|
flag2 = false;
|
|
}
|
|
}
|
|
} else {
|
|
tmp3.log("Not writing cache because not authenticated");
|
|
return false;
|
|
}
|
|
};
|
|
prototype["loadCacheAsync"] = function loadCacheAsync(arg0, arg1) {
|
|
let closure_0 = arg0;
|
|
let closure_1 = arg1;
|
|
return callback(function*() {
|
|
if (c5 === 2) {
|
|
c5 = 3;
|
|
HermesBuiltin.throwTypeError();
|
|
} else if (tmp7 === 3) {
|
|
if (arg0 === 1) {
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
let obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c5 = 2;
|
|
if (0 === dependencyMap) {
|
|
if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c5 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
let id = tmp3;
|
|
let callback = tmp5;
|
|
callback = undefined;
|
|
id = undefined;
|
|
let closure_2;
|
|
let v0;
|
|
dependencyMap = undefined;
|
|
c5 = undefined;
|
|
let fetchFingerprint;
|
|
let closure_7;
|
|
const callOnceResult = outer1_0(outer1_2[33]).callOnce(outer1_1);
|
|
callback = callOnceResult;
|
|
const obj13 = outer1_0(outer1_2[33]);
|
|
outer1_1(outer1_2[12]).setInitialPage(outer1_0.page);
|
|
const guildId = outer1_0.guildId;
|
|
const obj14 = outer1_1(outer1_2[12]);
|
|
let tmp30 = null;
|
|
if (null != guildId) {
|
|
tmp30 = null;
|
|
if ("@me" !== guildId) {
|
|
tmp30 = guildId;
|
|
}
|
|
}
|
|
outer1_1(outer1_2[12]).setInitialGuildId(tmp30);
|
|
if ("initializing" !== outer1_15) {
|
|
outer1_1(outer1_2[21])("cache:lazy_cache_not_initializing");
|
|
callOnceResult();
|
|
let _setTimeout = setTimeout;
|
|
let timerId = setTimeout(() => {
|
|
const socket = store.getSocket();
|
|
let unpauseDispatchQueueResult;
|
|
if (socket != null) {
|
|
const dispatcher = socket.dispatcher;
|
|
if (dispatcher != null) {
|
|
unpauseDispatchQueueResult = dispatcher.unpauseDispatchQueue();
|
|
}
|
|
}
|
|
return unpauseDispatchQueueResult;
|
|
}, 0);
|
|
c5 = 3;
|
|
const obj1 = { value: null, done: true };
|
|
obj1[0] = undefined;
|
|
return obj1;
|
|
} else {
|
|
v0 = 1;
|
|
id = outer1_6.getId();
|
|
closure_2 = outer1_1(outer1_2[34]).carefullyOpenDatabase(id);
|
|
const loadMiniCache = outer1_1(outer1_2[12]).loadMiniCache;
|
|
dependencyMap = 2;
|
|
c5 = 1;
|
|
const obj2 = { value: null, done: false };
|
|
obj2[0] = loadMiniCache.measureAsync(() => (function loadEarlyCache(closure_2, id, c0) {
|
|
const self = this;
|
|
const apply = closure_21.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
})(closure_2, id, c0));
|
|
return obj2;
|
|
}
|
|
const obj15 = outer1_1(outer1_2[12]);
|
|
}
|
|
} else {
|
|
if (1 === tmp8) {
|
|
v0 = 0;
|
|
const stack = closure_2;
|
|
outer1_13.error("clearing cache. exception encountered while loading cache.", stack, stack.stack);
|
|
outer1_1(outer1_2[21])("cache:exception", stack);
|
|
callback();
|
|
let obj5 = outer1_1(outer1_2[23]);
|
|
const obj3 = { type: "RESET_SOCKET", args: null };
|
|
const obj4 = { error: null, action: "loadCacheAsync" };
|
|
obj4[0] = stack;
|
|
obj3[1] = obj4;
|
|
obj5.dispatch(obj3);
|
|
c5 = 3;
|
|
} else if (2 === tmp8) {
|
|
if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
v0 = 0;
|
|
c5 = 3;
|
|
obj5 = { value: null, done: true };
|
|
obj5[0] = arg1;
|
|
return obj5;
|
|
} else {
|
|
v0 = arg1;
|
|
dependencyMap = v0(v0, 3);
|
|
c5 = 32;
|
|
fetchFingerprint = 5;
|
|
closure_7 = 4994;
|
|
outer1_0();
|
|
if (c5) {
|
|
dependencyMap = 4;
|
|
c5 = 1;
|
|
const obj6 = { value: null, done: false };
|
|
obj6[0] = (function loadLateLazyCache(outer1_2, outer1_1, outer1_6, outer1_7) {
|
|
const self = this;
|
|
const apply = closure_25.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
})(outer1_2, outer1_1, outer1_6, outer1_7);
|
|
return obj6;
|
|
} else {
|
|
dependencyMap = 3;
|
|
c5 = 1;
|
|
const obj7 = { value: null, done: false };
|
|
obj7[0] = (function dontLoadLateLazyCache() {
|
|
const f119182 = () => lib(709).dispatch({ type: "CACHE_LOADED_LAZY_NO_CACHE" });
|
|
const id = store.getSocket();
|
|
const Emitter = id(tmp38[22]).Emitter;
|
|
Emitter.batched(() => {
|
|
try {
|
|
f119182();
|
|
let dispatcher = lib.dispatcher;
|
|
if (dispatcher.hasStuffToDispatchNow()) {
|
|
const dependencyMap = true;
|
|
const loadLazyCache = lib(9).loadLazyCache;
|
|
loadLazyCache.recordEnd();
|
|
outer1_13.verbose("Processing First Queued Dispatch");
|
|
const dispatcher3 = tmp3.dispatcher;
|
|
const _Set = Set;
|
|
const set = new Set(["READY", "INITIAL_GUILD"]);
|
|
const result = dispatcher3.processFirstQueuedDispatch(set);
|
|
const _setTimeout = setTimeout;
|
|
const timerId = setTimeout(() => {
|
|
outer1_13.verbose("Unpausing Dispatch Queue");
|
|
dispatcher = dispatcher.dispatcher;
|
|
dispatcher.unpauseDispatchQueue();
|
|
}, 100);
|
|
} else {
|
|
outer1_13.verbose("Unpausing Dispatch Queue");
|
|
const dispatcher2 = tmp3.dispatcher;
|
|
dispatcher2.unpauseDispatchQueue();
|
|
}
|
|
} catch (tmp19) {
|
|
outer1_13.warn("Lazy cache has encountered error", tmp19);
|
|
let obj = lib(709);
|
|
obj = { type: "RESET_SOCKET", args: null };
|
|
obj = { error: null, action: "LazyCache" };
|
|
obj[0] = tmp19;
|
|
obj[1] = obj;
|
|
obj.dispatch(obj);
|
|
}
|
|
});
|
|
if (!false) {
|
|
let loadLazyCache = id(tmp2[12]).loadLazyCache;
|
|
loadLazyCache.recordEnd();
|
|
}
|
|
return Promise.resolve();
|
|
})();
|
|
return obj7;
|
|
}
|
|
}
|
|
} else {
|
|
if (3 === tmp8) {
|
|
if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw arg1;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
v0 = 0;
|
|
c5 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
}
|
|
v0 = 0;
|
|
}
|
|
v0 = 0;
|
|
c5 = 3;
|
|
const obj8 = { value: null, done: true };
|
|
obj8[0] = arg1;
|
|
return obj8;
|
|
}
|
|
} catch (tmp38) {
|
|
closure_2 = tmp38;
|
|
if (tmp4 === v0) {
|
|
c5 = tmp2;
|
|
throw tmp38;
|
|
} else {
|
|
dependencyMap = tmp;
|
|
}
|
|
}
|
|
}
|
|
})();
|
|
};
|
|
CacheStoreClass.displayName = "CacheStore";
|
|
const cacheStoreClass = new CacheStoreClass(require("dispatcher"), {
|
|
CONNECTION_OPEN: function handleConnectionOpen() {
|
|
let c18 = true;
|
|
let c19 = true;
|
|
return false;
|
|
},
|
|
LOGOUT: handleClearCaches,
|
|
CONNECTION_CLOSED: function handleConnectionClose() {
|
|
let c18 = false;
|
|
let c19 = true;
|
|
return false;
|
|
},
|
|
CACHE_LOADED: function handleCacheLoaded() {
|
|
let c17 = true;
|
|
},
|
|
CACHE_LOADED_LAZY: function handleCacheLoadedLazy() {
|
|
let c17 = true;
|
|
let c15 = "cache-loaded";
|
|
},
|
|
CACHE_LOADED_LAZY_NO_CACHE: function handleCacheLoadedLazyNoCache() {
|
|
let c15 = "no-cache";
|
|
},
|
|
CLEAR_CACHES: handleClearCaches,
|
|
WRITE_CACHES: function saveCaches() {
|
|
tmp3.verbose("Writing cache now");
|
|
let closure_16 = Date.now();
|
|
let c17 = true;
|
|
const Storage = require(595) /* Storage */.Storage;
|
|
Storage.remove(closure_10);
|
|
const Storage2 = require(595) /* Storage */.Storage;
|
|
Storage2.remove(closure_12);
|
|
const Storage3 = require(595) /* Storage */.Storage;
|
|
Storage3.remove(closure_11);
|
|
}
|
|
});
|
|
let obj = {
|
|
CONNECTION_OPEN: function handleConnectionOpen() {
|
|
let c18 = true;
|
|
let c19 = true;
|
|
return false;
|
|
},
|
|
LOGOUT: handleClearCaches,
|
|
CONNECTION_CLOSED: function handleConnectionClose() {
|
|
let c18 = false;
|
|
let c19 = true;
|
|
return false;
|
|
},
|
|
CACHE_LOADED: function handleCacheLoaded() {
|
|
let c17 = true;
|
|
},
|
|
CACHE_LOADED_LAZY: function handleCacheLoadedLazy() {
|
|
let c17 = true;
|
|
let c15 = "cache-loaded";
|
|
},
|
|
CACHE_LOADED_LAZY_NO_CACHE: function handleCacheLoadedLazyNoCache() {
|
|
let c15 = "no-cache";
|
|
},
|
|
CLEAR_CACHES: handleClearCaches,
|
|
WRITE_CACHES: function saveCaches() {
|
|
tmp3.verbose("Writing cache now");
|
|
let closure_16 = Date.now();
|
|
let c17 = true;
|
|
const Storage = require(595) /* Storage */.Storage;
|
|
Storage.remove(closure_10);
|
|
const Storage2 = require(595) /* Storage */.Storage;
|
|
Storage2.remove(closure_12);
|
|
const Storage3 = require(595) /* Storage */.Storage;
|
|
Storage3.remove(closure_11);
|
|
}
|
|
};
|
|
const tmp3 = new require("fetchFingerprint")("CacheStore");
|
|
let result = require("_handleConnectionOpen").fileFinishedImporting("modules/cache/CacheStore.tsx");
|
|
|
|
export default cacheStoreClass;
|
|
export const ENABLE_CACHE_STORE = true;
|