233 lines
8.4 KiB
TypeScript
233 lines
8.4 KiB
TypeScript
/* Metro module 11181; source: modules/saved_messages/useSavedMessagesForPage.tsx; dependencies: [57, 31, 11174, 11182, 2] */
|
|
function _fun85410(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#85410, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11367:6, offset: 0x01f6daa1, size: 182 bytes, params: 8, frame: 18
|
|
const _arrayLikeToArray_85413 = 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_2 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_3 = importAll(31) /* metro dependency 31 */;
|
|
const savedMessagesStore = importDefault(11174) /* metro dependency 11174: SavedMessagesStore */;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/saved_messages/useSavedMessagesForPage.tsx');
|
|
exports.default = useSavedMessagesForPage;
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_85411(a0, a1) { // fn#85411, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11367:131, offset: 0x01f6db57, 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 _fun85412;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_85413(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_85413(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_85413(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun85412;
|
|
}
|
|
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 getKeys() { // fn#85414, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11367:1041, offset: 0x01f6dccb, size: 38 bytes, params: 1, frame: 11
|
|
return SavedMessagesStore.getSavedMessages().map(function(a0) {
|
|
return a0.saveData;
|
|
});
|
|
}
|
|
|
|
function useSavedMessagesForPage() { // fn#85416, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11367:1205, offset: 0x01f6dcfc, size: 131 bytes, params: 1, frame: 17
|
|
const binding = env0_3;
|
|
const useState = binding.useState;
|
|
const value3 = env0_2(Reflect.apply(useState, binding, [getKeys]), 2);
|
|
const property = value3[0];
|
|
let env0_0 = value3[1];
|
|
const useRef = binding.useRef;
|
|
const getIsStale = SavedMessagesStore.getIsStale;
|
|
let env0_1 = Reflect.apply(useRef, binding, [Reflect.apply(getIsStale, SavedMessagesStore, [])]);
|
|
binding.useEffect(function() {
|
|
var closure = _fun85418;
|
|
var env0_1 = closure;
|
|
var env0_0 = SavedMessagesStore.getLastChanged();
|
|
SavedMessagesStore.addChangeListener(closure);
|
|
return _fun85421;
|
|
}, []);
|
|
(importDefault(11182) /* metro dependency 11182: useRefreshSavedMessages */)();
|
|
return property;
|
|
}
|
|
|
|
function _fun85417() { // fn#85417, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11367:1336, offset: 0x01f6dd7f, size: 58 bytes, params: 1, frame: 13
|
|
const closure = handleChange_85418;
|
|
const env0_0 = SavedMessagesStore.getLastChanged();
|
|
SavedMessagesStore.addChangeListener(closure);
|
|
return function() {
|
|
SavedMessagesStore.removeChangeListener(handleChange_85418);
|
|
};
|
|
}
|
|
|
|
function handleChange_85418() { // fn#85418, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11367:1366, offset: 0x01f6ddb9, size: 123 bytes, params: 1, frame: 12
|
|
if (env0_0 !== SavedMessagesStore.getLastChanged()) {
|
|
if (env1_1.current) {
|
|
if (SavedMessagesStore.getIsStale()) {
|
|
env1_0(_fun85419);
|
|
return undefined;
|
|
}
|
|
env1_1.current = false;
|
|
env1_0(getKeys());
|
|
return undefined;
|
|
}
|
|
env1_0(_fun85419);
|
|
}
|
|
}
|
|
|
|
function _fun85419(a0) { // fn#85419, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11367:1500, offset: 0x01f6de34, size: 255 bytes, params: 2, frame: 20
|
|
var environment;
|
|
var r5;
|
|
var r2;
|
|
var value8;
|
|
var has;
|
|
var messageId;
|
|
var splice;
|
|
var indexOf;
|
|
var value9;
|
|
var value11;
|
|
var push;
|
|
var saveData;
|
|
var value12;
|
|
const items2 = [];
|
|
arraySpread(items2, a0, 0, undefined);
|
|
let value = environment.__proto__.__proto__.__proto__;
|
|
const savedMessages = SavedMessagesStore.getSavedMessages();
|
|
const Map = global.Map;
|
|
let map = savedMessages.map;
|
|
map = new Map(Reflect.apply(map, savedMessages, [function(a0) {
|
|
return [a0.saveData.messageId, a0];
|
|
}]));
|
|
const value6 = _createForOfIteratorHelperLoose_85411(a0);
|
|
const value7 = value6();
|
|
let done = value7.done;
|
|
if (!done) {
|
|
r5 = value7;
|
|
while (true) {
|
|
value8 = r5.value;
|
|
has = map.has;
|
|
messageId = value8.messageId;
|
|
if (Reflect.apply(has, map, [messageId])) {
|
|
messageId = value8.messageId;
|
|
map.delete(messageId);
|
|
} else {
|
|
splice = items2.splice;
|
|
indexOf = items2.indexOf;
|
|
Reflect.apply(splice, items2, [Reflect.apply(indexOf, items2, [value8]), 1]);
|
|
}
|
|
value9 = value6();
|
|
done = value9.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
r5 = value9;
|
|
continue;
|
|
}
|
|
}
|
|
value = _createForOfIteratorHelperLoose_85411(map.values());
|
|
const value10 = value();
|
|
done = value10.done;
|
|
if (!done) {
|
|
for (r2 = value10; true; r2 = value12) {
|
|
value11 = r2.value;
|
|
push = items2.push;
|
|
saveData = value11.saveData;
|
|
Reflect.apply(push, items2, [saveData]);
|
|
value12 = value();
|
|
done = value12.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return items2;
|
|
}
|
|
|