2026-10-07 22:43:51 +00:00
|
|
|
// Module ID: 6817
|
|
|
|
|
// Function ID: 6818
|
2026-09-18 19:45:33 +00:00
|
|
|
// Name: LazyLoadedThreadManager
|
2026-10-07 22:43:51 +00:00
|
|
|
// Dependencies: [5436, 2055, 2051, 2103, 1085, 2058, 584, 6722, 4704, 4717, 1282, 2]
|
2026-09-18 19:45:33 +00:00
|
|
|
|
2026-10-07 22:43:51 +00:00
|
|
|
// Module 6817 (LazyLoadedThreadManager)
|
|
|
|
|
import DispatcherDefault from "Dispatcher" /* 584 */;
|
2026-10-02 13:37:24 +00:00
|
|
|
import ChannelConstants from "ChannelConstants" /* 2058 */;
|
2026-10-07 22:43:51 +00:00
|
|
|
import GatewayConnectionStore from "GatewayConnectionStore" /* 5436 */;
|
2026-10-02 13:37:24 +00:00
|
|
|
import ChannelRecord from "ChannelRecord" /* 2055 */;
|
|
|
|
|
import ChannelStore from "ChannelStore" /* 2051 */;
|
2026-10-07 22:43:51 +00:00
|
|
|
import SelectedChannelStore from "SelectedChannelStore" /* 2103 */;
|
|
|
|
|
import Constants from "Constants" /* 1085 */;
|
2026-10-01 14:13:23 +00:00
|
|
|
import size from "module_2" /* 2 */;
|
2026-09-18 19:45:33 +00:00
|
|
|
|
2026-10-01 14:13:23 +00:00
|
|
|
const require = globalThis.__r;
|
2026-10-02 13:37:24 +00:00
|
|
|
let _require, body, importDefault, set;
|
2026-10-01 14:13:23 +00:00
|
|
|
|
|
|
|
|
let c9;
|
|
|
|
|
let closure_4;
|
|
|
|
|
let hasOwnProperty;
|
|
|
|
|
let metroImportAll;
|
2026-10-07 22:43:51 +00:00
|
|
|
const f93345 = () => {
|
2026-10-01 14:13:23 +00:00
|
|
|
closure_11 = {};
|
|
|
|
|
channelId = channelId.getChannelId();
|
|
|
|
|
const tmp2 = null != channelId && null == channel.getChannel(channelId);
|
|
|
|
|
if (tmp2) {
|
|
|
|
|
loadThread(channelId);
|
|
|
|
|
}
|
|
|
|
|
};
|
2026-09-18 19:45:33 +00:00
|
|
|
function initialize() {
|
2026-10-01 14:13:23 +00:00
|
|
|
const tmp = c12;
|
|
|
|
|
if (!tmp) {
|
2026-09-18 19:45:33 +00:00
|
|
|
c12 = true;
|
2026-10-01 14:13:23 +00:00
|
|
|
const obj = DispatcherDefault;
|
2026-10-07 22:43:51 +00:00
|
|
|
const subscription = obj.subscribe("CONNECTION_OPEN", f93345);
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function dispatchLoadedThread(nextResult, arg1) {
|
2026-10-01 14:13:23 +00:00
|
|
|
const tmp = React3(nextResult);
|
|
|
|
|
const obj = DispatcherDefault;
|
|
|
|
|
obj.dispatch({ type: "THREAD_CREATE", channel: tmp, messageId: undefined });
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-02 13:37:24 +00:00
|
|
|
function loadThread(channelId) {
|
2026-10-01 14:13:23 +00:00
|
|
|
let CHANNEL;
|
|
|
|
|
let RouteParam2;
|
|
|
|
|
let channel;
|
|
|
|
|
let closure_1;
|
|
|
|
|
let guildIdResult;
|
|
|
|
|
let id;
|
|
|
|
|
let tmp13Result2;
|
2026-10-02 13:37:24 +00:00
|
|
|
_require = channelId;
|
|
|
|
|
if (null == channelId) {
|
2026-09-18 19:45:33 +00:00
|
|
|
return Promise.resolve();
|
2026-10-02 13:37:24 +00:00
|
|
|
} else if (channelId === require("FakePlaceholderPrivateChannel").FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID) {
|
2026-09-18 19:45:33 +00:00
|
|
|
return Promise.resolve();
|
2026-10-02 13:37:24 +00:00
|
|
|
} else if (isStaticChannelRoute(channelId)) {
|
2026-09-18 19:45:33 +00:00
|
|
|
return Promise.resolve();
|
2026-10-02 13:37:24 +00:00
|
|
|
} else if (null != ChannelStore.getChannel(channelId)) {
|
2026-09-18 19:45:33 +00:00
|
|
|
return Promise.resolve();
|
|
|
|
|
} else {
|
2026-10-01 14:13:23 +00:00
|
|
|
const tmp16 = c12;
|
|
|
|
|
if (!tmp16) {
|
2026-09-18 19:45:33 +00:00
|
|
|
c12 = true;
|
2026-10-01 14:13:23 +00:00
|
|
|
let tmp2 = importDefault;
|
|
|
|
|
let obj = DispatcherDefault;
|
2026-10-07 22:43:51 +00:00
|
|
|
const subscription = obj.subscribe("CONNECTION_OPEN", f93345);
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
if (GatewayConnectionStore.isConnected()) {
|
2026-10-02 13:37:24 +00:00
|
|
|
if (null != closure_11[channelId]) {
|
2026-10-01 14:13:23 +00:00
|
|
|
let resolved;
|
2026-10-02 13:37:24 +00:00
|
|
|
if ("LOADING" === closure_11[channelId].type) {
|
2026-10-01 14:13:23 +00:00
|
|
|
resolved = tmp7.promise;
|
2026-09-18 19:45:33 +00:00
|
|
|
} else {
|
|
|
|
|
resolved = Promise.resolve();
|
|
|
|
|
}
|
|
|
|
|
return resolved;
|
|
|
|
|
} else {
|
|
|
|
|
const _location = location;
|
2026-10-01 14:13:23 +00:00
|
|
|
let obj2 = { path: CHANNEL(guildIdResult, RouteParam2.channelId(), ":messageId"), exact: true };
|
|
|
|
|
const matchPath = require("matchPathCompat").matchPath;
|
|
|
|
|
CHANNEL = constants.CHANNEL;
|
|
|
|
|
require("matchPathCompat");
|
2026-10-07 22:43:51 +00:00
|
|
|
const RouteParam = tmp13(4717).RouteParam;
|
2026-10-01 14:13:23 +00:00
|
|
|
guildIdResult = RouteParam.guildId();
|
2026-10-07 22:43:51 +00:00
|
|
|
RouteParam2 = tmp13(4717).RouteParam;
|
2026-10-01 14:13:23 +00:00
|
|
|
importDefault = matchPath(pathname, obj2);
|
2026-10-07 22:43:51 +00:00
|
|
|
const HTTP = tmp13(1282).HTTP;
|
2026-10-01 14:13:23 +00:00
|
|
|
const get = HTTP.get;
|
2026-10-02 13:37:24 +00:00
|
|
|
const obj3 = { url: closure_8.CHANNEL(channelId), rejectWithError: tmp13Result2.rejectWithMigratedError() };
|
2026-10-01 14:13:23 +00:00
|
|
|
tmp13Result2 = require("HTTPUtils");
|
|
|
|
|
const value = get(obj3);
|
|
|
|
|
const nextPromise = value.then((body) => {
|
2026-09-18 19:45:33 +00:00
|
|
|
body = body.body;
|
2026-10-01 14:13:23 +00:00
|
|
|
closure_11[id] = { type: "LOADED" };
|
|
|
|
|
if (hasOwnProperty.has(body.type)) {
|
2026-09-18 19:45:33 +00:00
|
|
|
let messageId;
|
|
|
|
|
if (closure_1 != null) {
|
|
|
|
|
const params = closure_1.params;
|
|
|
|
|
if (params != null) {
|
|
|
|
|
messageId = params.messageId;
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
const obj2 = { type: "THREAD_CREATE", channel: React3(body), messageId };
|
|
|
|
|
const obj = DispatcherDefault;
|
|
|
|
|
obj.dispatch(obj2);
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
});
|
|
|
|
|
const catchPromise = nextPromise.catch(() => {
|
2026-09-18 19:45:33 +00:00
|
|
|
let guildId;
|
2026-10-01 14:13:23 +00:00
|
|
|
closure_11[id] = { type: "NOT_FOUND" };
|
|
|
|
|
const obj = { id, guild_id: guildId, parent_id: "Array" };
|
|
|
|
|
guildId = undefined;
|
|
|
|
|
const dispatch = DispatcherDefault.dispatch;
|
|
|
|
|
DispatcherDefault;
|
2026-09-18 19:45:33 +00:00
|
|
|
if (closure_1 != null) {
|
|
|
|
|
const params = closure_1.params;
|
|
|
|
|
if (params != null) {
|
|
|
|
|
guildId = params.guildId;
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
dispatch({ type: "CHANNEL_DELETE", channel: obj });
|
2026-09-18 19:45:33 +00:00
|
|
|
});
|
|
|
|
|
const obj4 = { type: "LOADING", promise: catchPromise };
|
2026-10-02 13:37:24 +00:00
|
|
|
closure_11[channelId] = obj4;
|
2026-09-18 19:45:33 +00:00
|
|
|
return catchPromise;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
({ createChannelRecordFromServer: closure_4, THREAD_CHANNEL_TYPES: hasOwnProperty } = ChannelRecord);
|
2026-10-01 14:13:23 +00:00
|
|
|
({ Endpoints: metroImportAll, Routes: c9 } = Constants);
|
|
|
|
|
const isStaticChannelRoute = ChannelConstants.isStaticChannelRoute;
|
|
|
|
|
let closure_11 = {};
|
2026-09-18 19:45:33 +00:00
|
|
|
let c12 = false;
|
2026-10-01 14:13:23 +00:00
|
|
|
let obj = {
|
2026-09-18 19:45:33 +00:00
|
|
|
getLoadState(key10013) {
|
|
|
|
|
let type;
|
2026-10-01 14:13:23 +00:00
|
|
|
if (closure_11[key10013] != null) {
|
2026-09-18 19:45:33 +00:00
|
|
|
type = tmp.type;
|
|
|
|
|
}
|
|
|
|
|
return type;
|
|
|
|
|
},
|
|
|
|
|
loadThread,
|
|
|
|
|
loadThreadsBulk(arr) {
|
2026-10-01 14:13:23 +00:00
|
|
|
let obj2;
|
|
|
|
|
let obj4;
|
2026-09-18 19:45:33 +00:00
|
|
|
initialize();
|
|
|
|
|
if (GatewayConnectionStore.isConnected()) {
|
2026-10-01 14:13:23 +00:00
|
|
|
let tmp4 = arr;
|
2026-09-18 19:45:33 +00:00
|
|
|
const items = [];
|
|
|
|
|
const items1 = [];
|
2026-10-01 14:13:23 +00:00
|
|
|
let tmp5 = arr;
|
2026-09-18 19:45:33 +00:00
|
|
|
let iter = arr[Symbol.iterator]();
|
2026-10-01 14:13:23 +00:00
|
|
|
let tmp6 = null;
|
|
|
|
|
let tmp7 = arr;
|
2026-09-18 19:45:33 +00:00
|
|
|
let nextResult = iter.next();
|
|
|
|
|
while (iter !== undefined) {
|
2026-10-01 14:13:23 +00:00
|
|
|
let tmp10 = nextResult;
|
2026-10-07 22:43:51 +00:00
|
|
|
if (nextResult !== items1(6722).FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID) {
|
2026-10-01 14:13:23 +00:00
|
|
|
if (!isStaticChannelRoute(tmp10)) {
|
|
|
|
|
if (null == ChannelStore.getChannel(tmp10)) {
|
|
|
|
|
let tmp19 = closure_11[tmp10];
|
|
|
|
|
let tmp20 = tmp19;
|
|
|
|
|
if (null == tmp19) {
|
|
|
|
|
arr = items1.push(tmp10);
|
|
|
|
|
} else if ("LOADING" === tmp20.type) {
|
|
|
|
|
let arr2 = items.push(tmp20.promise);
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (0 === items1.length) {
|
2026-10-01 14:13:23 +00:00
|
|
|
const allPromises = Promise.all(items);
|
|
|
|
|
return allPromises.then(() => {
|
2026-09-18 19:45:33 +00:00
|
|
|
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2026-10-07 22:43:51 +00:00
|
|
|
const HTTP = items1(1282).HTTP;
|
2026-10-01 14:13:23 +00:00
|
|
|
const request = { url: closure_8.THREADS_BULK, body: obj2, rejectWithError: obj4.rejectWithMigratedError() };
|
|
|
|
|
const post = HTTP.post;
|
|
|
|
|
obj2 = { thread_ids: items1 };
|
2026-10-07 22:43:51 +00:00
|
|
|
obj4 = items1(1282);
|
2026-10-01 14:13:23 +00:00
|
|
|
const postResult = post(request);
|
|
|
|
|
const nextPromise = postResult.then((body) => {
|
|
|
|
|
body = body.body;
|
2026-09-18 19:45:33 +00:00
|
|
|
set = new Set();
|
2026-10-01 14:13:23 +00:00
|
|
|
const iter = body.items[Symbol.iterator]();
|
2026-09-18 19:45:33 +00:00
|
|
|
const nextResult = iter.next();
|
|
|
|
|
while (iter !== undefined) {
|
|
|
|
|
let id = nextResult.id;
|
|
|
|
|
let addResult = set.add(id);
|
|
|
|
|
closure_11[id] = { type: "LOADED" };
|
|
|
|
|
let tmp5 = dispatchLoadedThread(nextResult);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (const item10029 of items1) {
|
|
|
|
|
let tmp6 = item10029;
|
|
|
|
|
if (!set.has(item10029)) {
|
|
|
|
|
closure_11[tmp6] = { type: "NOT_FOUND" };
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
});
|
|
|
|
|
const catchPromise = nextPromise.catch(() => {
|
2026-09-18 19:45:33 +00:00
|
|
|
for (const item10005 of items1) {
|
2026-10-01 14:13:23 +00:00
|
|
|
delete closure_11[item10005];
|
2026-09-18 19:45:33 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
for (const item10052 of items1) {
|
|
|
|
|
let obj = { type: "LOADING", promise: catchPromise };
|
2026-10-01 14:13:23 +00:00
|
|
|
closure_11[item10052] = obj;
|
2026-09-18 19:45:33 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
let nextPromise1 = catchPromise;
|
|
|
|
|
if (0 !== items.length) {
|
|
|
|
|
const items2 = [];
|
2026-10-01 14:13:23 +00:00
|
|
|
items2[HermesBuiltin.arraySpread(items2, items, 0)] = catchPromise;
|
|
|
|
|
const allPromises1 = Promise.all(items2);
|
|
|
|
|
nextPromise1 = allPromises1.then(() => {
|
2026-09-18 19:45:33 +00:00
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return nextPromise1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2026-10-01 14:13:23 +00:00
|
|
|
let tmp3 = globalThis;
|
2026-09-18 19:45:33 +00:00
|
|
|
return Promise.resolve();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2026-10-01 14:13:23 +00:00
|
|
|
const result = size.fileFinishedImporting("modules/threads/LazyLoadedThreadManager.tsx");
|
|
|
|
|
|
|
|
|
|
export default obj;
|