Files
discord-decomp/sources/modules/message_previews/RemoteFetchData.tsx
T
2026-07-27 16:20:00 +03:00

298 lines
10 KiB
TypeScript

/* Metro module 13778; source: modules/message_previews/RemoteFetchData.tsx; dependencies: [5, 6, 7, 2] */
function _fun105121(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#105121, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13975:6, offset: 0x022adb51, size: 204 bytes, params: 8, frame: 18
var object2;
const _arrayLikeToArray_105124 = 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 Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_0 = importDefault(5) /* metro dependency 5 */;
const env0_1 = importDefault(6) /* metro dependency 6 */;
const env0_2 = importDefault(7) /* metro dependency 7 */;
object2 = {Pending: 0};
object2[0] = 'Pending';
object2.Fetching = 1;
object2[1] = 'Fetching';
let value = _fun105125();
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/message_previews/RemoteFetchData.tsx');
exports.FetchStatus = object2;
exports.RemoteFetchData = value;
}
function _createForOfIteratorHelperLoose_105122(a0, a1) { // fn#105122, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13975:130, offset: 0x022adc1d, size: 372 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 _fun105123;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_105124(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_105124(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_105124(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun105123;
}
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 _fun105125() { // fn#105125, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13975:1126, offset: 0x022add91, size: 285 bytes, params: 1, frame: 17
const binding = env0_2;
const closure = RemoteFetchData;
const items2 = [{key: 'empty', value: function() {
return this.pending.size === 0 && this.fetching.size === 0;
}}];
items2[1] = {key: 'status', value: value_105128};
items2[2] = {key: 'addWant', value: function(a0) {
if (!this.fetching.has(a0)) {
this.pending.add(a0);
}
}};
items2[3] = {key: 'removeWant', value: function(a0) {
this.pending.delete(a0);
this.fetching.delete(a0);
}};
items2[4] = {key: 'nextWants', value: function(a0) {
var r4;
var property = this.pending;
var items = [];
arraySpread(items, property, 0, r4);
items.length = global.Math.min(a0, items.length);
return items;
}};
items2[5] = {key: 'markFetching', value: value_105132};
items2[6] = {key: 'markCompleted', value: value_105133};
items2[7] = {key: 'markFailed', value: value_105134};
const env0_0Binding = env0_0(_fun105136);
items2[8] = {key: 'try', value: value_105137};
return binding(closure, items2);
}
function RemoteFetchData() { // fn#105126, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13975:1147, offset: 0x022adeae, size: 93 bytes, params: 1, frame: 14
const value = environment.__proto__;
env1_1(this, RemoteFetchData);
let Set = global.Set;
this.pending = new Set();
Set = global.Set;
this.fetching = new Set();
}
function value_105128(a0) { // fn#105128, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13975:1349, offset: 0x022adf33, size: 76 bytes, params: 2, frame: 12
const pending = this.pending;
return pending.has(a0) ? env1_3.Pending : this.fetching.has(a0) ? env1_3.Fetching : null;
}
function value_105132(a0) { // fn#105132, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13975:1725, offset: 0x022ae00f, size: 86 bytes, params: 2, frame: 15
var r2;
var value3;
var pending;
var fetching;
var value4;
let value = environment.__proto__;
value = _createForOfIteratorHelperLoose_105122(a0);
const value2 = value();
let done = value2.done;
if (!done) {
for (r2 = value2; true; r2 = value4) {
value3 = r2.value;
pending = this.pending;
pending.delete(value3);
fetching = this.fetching;
fetching.add(value3);
value4 = value();
done = value4.done;
if (done) {
break;
}
}
}
}
function value_105133(a0) { // fn#105133, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13975:1888, offset: 0x022ae065, size: 86 bytes, params: 2, frame: 15
var r2;
var value3;
var pending;
var fetching;
var value4;
let value = environment.__proto__;
value = _createForOfIteratorHelperLoose_105122(a0);
const value2 = value();
let done = value2.done;
if (!done) {
for (r2 = value2; true; r2 = value4) {
value3 = r2.value;
pending = this.pending;
pending.delete(value3);
fetching = this.fetching;
fetching.delete(value3);
value4 = value();
done = value4.done;
if (done) {
break;
}
}
}
}
function value_105134(a0) { // fn#105134, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13975:2051, offset: 0x022ae0bb, size: 86 bytes, params: 2, frame: 15
var r2;
var value3;
var pending;
var fetching;
var value4;
let value = environment.__proto__;
value = _createForOfIteratorHelperLoose_105122(a0);
const value2 = value();
let done = value2.done;
if (!done) {
for (r2 = value2; true; r2 = value4) {
value3 = r2.value;
pending = this.pending;
pending.add(value3);
fetching = this.fetching;
fetching.delete(value3);
value4 = value();
done = value4.done;
if (done) {
break;
}
}
}
}
function* _fun105136(a0, a1) { // fn#105136, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13975:2210, offset: 0x022ae11c, size: 93 bytes, params: 3, frame: 14
var markFetching;
var value3;
var markCompleted;
var error;
let value = undefined;
if (true) {
try {
markFetching = this.markFetching;
} catch (error) {
this.markFailed(a0);
throw error;
}
try {
Reflect.apply(markFetching, this, [a0]);
} catch (error) {
this.markFailed(a0);
throw error;
}
try {
value = a1();
} catch (error) {
this.markFailed(a0);
throw error;
}
yield value;
try {
value = undefined;
value3 = false;
} catch (error) {
this.markFailed(a0);
throw error;
}
if (value3) {
return value;
}
try {
markCompleted = this.markCompleted;
} catch (error) {
this.markFailed(a0);
throw error;
}
try {
Reflect.apply(markCompleted, this, [a0]);
} catch (error) {
this.markFailed(a0);
throw error;
}
}
return value;
}