437 lines
18 KiB
TypeScript
437 lines
18 KiB
TypeScript
/* Metro module 6904; source: modules/threads/LazyLoadedThreadManager.tsx; dependencies: [4257, 1383, 1379, 1934, 661, 1386, 694, 5225, 3974, 3987, 507, 2] */
|
|
import Dispatcher from '../../Dispatcher.tsx'; /* Metro dependency 694 */
|
|
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import SelectedChannelStore from '../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */
|
|
import GatewayConnectionStore from '../gateway/GatewayConnectionStore.tsx'; /* Metro dependency 4257 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ChannelRecordModule from '../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
|
|
import * as ChannelConstantsModule from '../channel/ChannelConstants.tsx'; /* Metro dependency 1386 */
|
|
import * as RouteUtilsModule from '../routing/RouteUtils.tsx'; /* Metro dependency 3987 */
|
|
import * as FakePlaceholderPrivateChannelModule from '../channel/FakePlaceholderPrivateChannel.tsx'; /* Metro dependency 5225 */
|
|
|
|
function _fun54935(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#54935, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7082:6, offset: 0x013714cf, size: 313 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_54938 = function(a0, a1) {
|
|
var r0;
|
|
var r1;
|
|
var r2;
|
|
var value3;
|
|
var length;
|
|
var value5;
|
|
var value = undefined;
|
|
var value2 = value == null;
|
|
reducibleJoin2: while (true) {
|
|
if (value2) {
|
|
r0 = value2;
|
|
break reducibleJoin2;
|
|
}
|
|
value3 = value > a0.length;
|
|
r0 = value3;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (r0) {
|
|
length = a0.length;
|
|
r1 = length;
|
|
break reducibleJoin4;
|
|
}
|
|
r1 = value;
|
|
break reducibleJoin4;
|
|
}
|
|
value = (0, global.Array)(r1);
|
|
var value4 = 0;
|
|
if (value4 < r1) {
|
|
r2 = value4;
|
|
reducibleLoop5: while (true) {
|
|
value[r2] = a0[r2];
|
|
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value5 < r1) {
|
|
r2 = value5;
|
|
continue reducibleLoop5;
|
|
}
|
|
break reducibleLoop5;
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
const loadThread2 = loadThread;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ChannelRecordModule;
|
|
const env0_4 = value.createChannelRecordFromServer;
|
|
const env0_5 = value.THREAD_CHANNEL_TYPES;
|
|
value = require(661) /* metro dependency 661: Constants */;
|
|
const env0_8 = value.Endpoints;
|
|
const env0_9 = value.Routes;
|
|
const env0_11 = {};
|
|
object = {getLoadState: getLoadState, loadThread: loadThread2, loadThreadsBulk: loadThreadsBulk};
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/threads/LazyLoadedThreadManager.tsx');
|
|
exports.default = object;
|
|
function _createForOfIteratorHelperLoose_54936(a0, a1) { // fn#54936, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7082:268, offset: 0x01371608, size: 370 bytes, params: 3, frame: 20
|
|
var r6;
|
|
var r9;
|
|
var r5;
|
|
var value3;
|
|
var regexp;
|
|
const env0_0 = a0;
|
|
const Symbol = global.Symbol;
|
|
let value = typeof Symbol !== 'undefined';
|
|
let r1 = value && a0[global.Symbol.iterator];
|
|
r1 = !r1 ? a0['@@iterator'] : r1;
|
|
if (r1) {
|
|
value = r1.call(a0);
|
|
return value.next.bind(value);
|
|
}
|
|
const Array = global.Array;
|
|
if (Array.isArray(a0)) {
|
|
if (r1) {
|
|
}
|
|
return _fun54937;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_54938(a0, value);
|
|
r5 = value;
|
|
} else {
|
|
value3 = ({}).toString.call(a0).slice(8, -1);
|
|
r6 = value3 === 'Object' && a0.constructor;
|
|
r9 = r6 ? a0.constructor.name : value3;
|
|
if (r9 === 'Map') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Set') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Arguments') {
|
|
value = _arrayLikeToArray_54938(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_54938(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun54937;
|
|
}
|
|
const TypeError = global.TypeError;
|
|
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
|
function _fun54937() { // fn#54937, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7082:839, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
|
|
return env0_1 >= env0_0.length ? {done: true} : {done: false,
|
|
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
|
|
}
|
|
|
|
}
|
|
|
|
function initialize_54939() { // fn#54939, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7082:1192, offset: 0x0137177a, size: 65 bytes, params: 1, frame: 13
|
|
if (!env0_12) {
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).subscribe('CONNECTION_OPEN', function() {
|
|
env1_11 = {};
|
|
var value2 = SelectedChannelStore.getChannelId();
|
|
if (value2 != null && ChannelStore.getChannel(value2) == null) {
|
|
loadThread(value2);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function dispatchLoadedThread(a0, a1) { // fn#54941, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7082:1347, offset: 0x013717ff, size: 70 bytes, params: 3, frame: 14
|
|
const channelRecordFromServer = createChannelRecordFromServer(a0);
|
|
Dispatcher.dispatch({type: 'THREAD_CREATE', channel: channelRecordFromServer, messageId: a1});
|
|
}
|
|
|
|
function loadThread(a0) { // fn#54942, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7082:1456, offset: 0x01371845, size: 515 bytes, params: 2, frame: 26
|
|
var property;
|
|
var moduleValue;
|
|
var matchPath;
|
|
var pathname;
|
|
var object;
|
|
const RouteParam = (RouteUtilsModule).RouteParam;
|
|
var HTTP;
|
|
var get;
|
|
var value6;
|
|
const env0_0 = a0;
|
|
if (a0 == null) {
|
|
return global.Promise.resolve();
|
|
}
|
|
const FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID = (FakePlaceholderPrivateChannelModule).FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID;
|
|
if (a0 === FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID) {
|
|
return global.Promise.resolve();
|
|
}
|
|
if (isStaticChannelRoute(a0)) {
|
|
return global.Promise.resolve();
|
|
}
|
|
const channelStoreBinding = ChannelStore;
|
|
const getChannel = channelStoreBinding.getChannel;
|
|
if (Reflect.apply(getChannel, channelStoreBinding, [a0]) != null) {
|
|
return global.Promise.resolve();
|
|
}
|
|
initialize_54939();
|
|
const gatewayConnectionStoreBinding = GatewayConnectionStore;
|
|
if (gatewayConnectionStoreBinding.isConnected()) {
|
|
property = env0_11[a0];
|
|
if (property != null) {
|
|
return property.type === 'LOADING' ? property.promise : global.Promise.resolve();
|
|
}
|
|
moduleValue = require(3974) /* metro dependency 3974: matchPathCompat */;
|
|
matchPath = moduleValue.matchPath;
|
|
pathname = global.location.pathname;
|
|
object = {};
|
|
object.path = Routes.CHANNEL(RouteParam.guildId(), RouteParam.channelId(), ':messageId');
|
|
object.exact = true;
|
|
var env0_1 = Reflect.apply(matchPath, moduleValue, [pathname, object]);
|
|
HTTP = (require(507) /* metro dependency 507: HTTPUtils */).HTTP;
|
|
get = HTTP.get;
|
|
object = {};
|
|
object.url = Endpoints.CHANNEL(a0);
|
|
object.rejectWithError = false;
|
|
value6 = Reflect.apply(get, HTTP, [object]).then(_fun54943).catch(_fun54944);
|
|
env0_11[a0] = {type: 'LOADING', promise: value6};
|
|
return value6;
|
|
}
|
|
const Promise = global.Promise;
|
|
return Promise.resolve();
|
|
function _fun54943({body}) { // fn#54943, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7082:2020, offset: 0x01371a48, size: 113 bytes, params: 2, frame: 16
|
|
const value = environment.__proto__;
|
|
env1_11[env0_0] = {type: 'LOADED'};
|
|
if (THREAD_CHANNEL_TYPES.has(body.type)) {
|
|
dispatchLoadedThread(body, env0_1 == null || env0_1.params == null ? undefined : env0_1.params.messageId);
|
|
}
|
|
}
|
|
|
|
function _fun54944() { // fn#54944, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7082:2158, offset: 0x01371ab9, size: 130 bytes, params: 1, frame: 17
|
|
let value = environment.__proto__;
|
|
const binding = env1_11;
|
|
const binding2 = env0_0;
|
|
binding[binding2] = {type: 'NOT_FOUND'};
|
|
value = undefined;
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'CHANNEL_DELETE',
|
|
channel: {id: binding2, guild_id: env0_1 == null || env0_1.params == null ? value : env0_1.params.guildId,
|
|
parent_id: value}});
|
|
return value;
|
|
}
|
|
|
|
}
|
|
|
|
function getLoadState(a0) { // fn#54945, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7082:2385, offset: 0x01371b3b, size: 32 bytes, params: 2, frame: 3
|
|
return env0_11[a0]?.type;
|
|
}
|
|
|
|
function loadThreadsBulk(a0) { // fn#54946, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7082:2491, offset: 0x01371b5b, size: 529 bytes, params: 2, frame: 26
|
|
var r15;
|
|
var environment;
|
|
var r7;
|
|
var r2;
|
|
var r1;
|
|
var Promise;
|
|
var items4;
|
|
var items2;
|
|
var value2;
|
|
var value3;
|
|
var done;
|
|
var value4;
|
|
var FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID;
|
|
var channelStoreBinding;
|
|
var getChannel;
|
|
var property;
|
|
var type;
|
|
var push;
|
|
var promise;
|
|
var value5;
|
|
var length;
|
|
var value6;
|
|
var HTTP;
|
|
var then;
|
|
var value9;
|
|
var binding;
|
|
var value10;
|
|
var all;
|
|
var items3;
|
|
let value = environment;
|
|
initialize_54939();
|
|
const gatewayConnectionStoreBinding = GatewayConnectionStore;
|
|
if (gatewayConnectionStoreBinding.isConnected()) {
|
|
items4 = [];
|
|
items2 = [];
|
|
value2 = _createForOfIteratorHelperLoose_54936(a0);
|
|
value3 = value2();
|
|
done = value3.done;
|
|
if (!done) {
|
|
r7 = value3;
|
|
reducibleLoop3: while (true) {
|
|
value4 = r7.value;
|
|
FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID = (require(5225) /* metro dependency 5225: FakePlaceholderPrivateChannel */).FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID;
|
|
reducibleJoin10: while (true) {
|
|
if (value4 === FAKE_PLACEHOLDER_PRIVATE_CHANNEL_ID) {
|
|
break reducibleJoin10;
|
|
}
|
|
if (isStaticChannelRoute(value4)) {
|
|
break reducibleJoin10;
|
|
}
|
|
channelStoreBinding = ChannelStore;
|
|
getChannel = channelStoreBinding.getChannel;
|
|
if (Reflect.apply(getChannel, channelStoreBinding, [value4]) != null) {
|
|
break reducibleJoin10;
|
|
}
|
|
property = env0_11[value4];
|
|
if (property == null) {
|
|
items2.push(value4);
|
|
break reducibleJoin10;
|
|
}
|
|
type = property.type;
|
|
if (type !== 'LOADING') {
|
|
break reducibleJoin10;
|
|
}
|
|
push = items4.push;
|
|
promise = property.promise;
|
|
Reflect.apply(push, items4, [promise]);
|
|
r15 = push;
|
|
break reducibleJoin10;
|
|
}
|
|
value5 = value2();
|
|
done = value5.done;
|
|
if (done) {
|
|
break reducibleLoop3;
|
|
}
|
|
r7 = value5;
|
|
continue reducibleLoop3;
|
|
}
|
|
}
|
|
length = items2.length;
|
|
value6 = 0;
|
|
if (value6 === length) {
|
|
return global.Promise.all(items4).then(function() {
|
|
});
|
|
}
|
|
HTTP = (require(507) /* metro dependency 507: HTTPUtils */).HTTP;
|
|
value9 = HTTP.post({url: Endpoints.THREADS_BULK, body: {thread_ids: items2},
|
|
rejectWithError: false}).then(_fun54948).catch(_fun54949);
|
|
length = items2.length;
|
|
if (value6 < length) {
|
|
r2 = value6;
|
|
reducibleLoop13: while (true) {
|
|
property = items2[r2];
|
|
binding = env0_11;
|
|
binding[property] = {type: 'LOADING', promise: value9};
|
|
value10 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
length = items2.length;
|
|
if (value10 < length) {
|
|
r2 = value10;
|
|
continue reducibleLoop13;
|
|
}
|
|
break reducibleLoop13;
|
|
}
|
|
}
|
|
length = items4.length;
|
|
reducibleJoin16: while (true) {
|
|
if (value6 === length) {
|
|
r1 = value9;
|
|
break reducibleJoin16;
|
|
}
|
|
Promise = global.Promise;
|
|
all = Promise.all;
|
|
items3 = [];
|
|
value = arraySpread(items3, items4, value6, r15);
|
|
items3[value] = value9;
|
|
value + 1;
|
|
value = Reflect.apply(all, Promise, [items3]);
|
|
then = value.then;
|
|
value = Reflect.apply(then, value, [_fun54950]);
|
|
r1 = value;
|
|
break reducibleJoin16;
|
|
}
|
|
return r1;
|
|
}
|
|
Promise = global.Promise;
|
|
return Promise.resolve();
|
|
function _fun54948({body}) { // fn#54948, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7082:2967, offset: 0x01371d6c, size: 200 bytes, params: 2, frame: 19
|
|
var r2;
|
|
var r3;
|
|
var value5;
|
|
var id;
|
|
var binding;
|
|
var value6;
|
|
var property;
|
|
var has;
|
|
var binding2;
|
|
var value9;
|
|
const Set = global.Set;
|
|
const set = new Set();
|
|
const value3 = _createForOfIteratorHelperLoose_54936(body.items);
|
|
const value4 = value3();
|
|
let done = value4.done;
|
|
if (!done) {
|
|
for (r2 = value4; true; r2 = value6) {
|
|
value5 = r2.value;
|
|
id = value5.id;
|
|
set.add(id);
|
|
binding = env1_11;
|
|
binding[id] = {type: 'LOADED'};
|
|
dispatchLoadedThread(value5);
|
|
value6 = value3();
|
|
done = value6.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
binding = env0_0;
|
|
let length = binding.length;
|
|
if (0 < length) {
|
|
r3 = 0;
|
|
while (true) {
|
|
property = binding[r3];
|
|
has = set.has;
|
|
if (!Reflect.apply(has, set, [property])) {
|
|
binding2 = env1_11;
|
|
binding2[property] = {type: 'NOT_FOUND'};
|
|
}
|
|
value9 = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
|
|
length = binding.length;
|
|
if (value9 < length) {
|
|
r3 = value9;
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun54949() { // fn#54949, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7082:3224, offset: 0x01371e34, size: 52 bytes, params: 1, frame: 5
|
|
var r2;
|
|
var property;
|
|
const binding = env0_0;
|
|
let length = binding.length;
|
|
let value = 0;
|
|
if (value < length) {
|
|
for (r2 = value; true; r2 = value) {
|
|
property = binding[r2];
|
|
delete env1_11[property];
|
|
value = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
length = binding.length;
|
|
if (!(value < length)) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function _fun54950() { // fn#54950, offset: 0x00c37b63, size: 4 bytes, params: 1, frame: 1
|
|
}
|
|
|
|
global.__d(_fun54935, 6904, [4257, 1383, 1379, 1934, 661, 1386, 694, 5225, 3974, 3987, 507,
|
|
2]) /* metro module 6904, dependencies: [4257, 1383, 1379, 1934, 661, 1386, 694, 5225, 3974, 3987, 507, 2] */;
|