481 lines
19 KiB
TypeScript
481 lines
19 KiB
TypeScript
/* Metro module 12562; source: modules/message_previews/MessagePreviewStore.tsx; dependencies: [57, 6, 7, 15, 17, 18, 1379, 4814, 3, 694, 12563, 4820, 566, 2] */
|
|
function _fun96119(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#96119, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:6, offset: 0x02155bda, size: 348 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_96122 = 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_3 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_4 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_5 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_6 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_7 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_8 = importDefault(18) /* metro dependency 18 */;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const messageStore = importDefault(4814) /* metro dependency 4814: MessageStore */;
|
|
let value = importDefault(3) /* metro dependency 3: Logger */;
|
|
value = new value('MessagePreviewStore');
|
|
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
|
|
value = _fun96126(Store);
|
|
value = new value();
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/message_previews/MessagePreviewStore.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_96120(a0, a1) { // fn#96120, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:180, offset: 0x02155d36, 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 _fun96121;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_96122(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_96122(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_96122(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun96121;
|
|
}
|
|
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 _isNativeReflectConstruct_96123() { // fn#96123, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:1090, offset: 0x02155eaa, size: 98 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_96123_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun96126(a0) { // fn#96126, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:1338, offset: 0x02155f0c, size: 503 bytes, params: 2, frame: 16
|
|
const closure = MessagePreviewStore_96127;
|
|
env0_8(closure, a0);
|
|
return env0_5(closure, [{key: 'initialize', value: function() {
|
|
this.waitFor(ChannelStore, MessageStore);
|
|
}}, {key: 'isLatest', value: function(a0, a1) {
|
|
var value = a0;
|
|
var guilds = this.guilds;
|
|
var get = guilds.get;
|
|
var value2 = null;
|
|
var r1 = value2 != value ? value : value2;
|
|
value = Reflect.apply(get, guilds, [r1]);
|
|
if (value2 == value) {
|
|
r1 = undefined;
|
|
} else {
|
|
value = value.isLatest(a1, this.generation);
|
|
r1 = value;
|
|
}
|
|
return value2 != r1 && r1;
|
|
}}, {key: 'isLocalFetchNeeded', value: function(a0) {
|
|
var r1;
|
|
r1 = this.guilds.get(a0)?.localNeeded;
|
|
return r1 == null || r1;
|
|
}}, {key: 'message', value: function(a0, a1) {
|
|
var r1;
|
|
var value = this.guilds.get(a0);
|
|
var value2 = null;
|
|
if (value2 == value) {
|
|
r1 = undefined;
|
|
} else {
|
|
value = value.messageRecord(a1);
|
|
r1 = value;
|
|
}
|
|
return value2 != r1 ? r1 : value2;
|
|
}}, {key: 'data', value: value_96144}, {key: 'handleOneGuildCreate', value: function(a0) {
|
|
var value = this.data(a0.id);
|
|
value.putMany(a0.lastMessages ?? [], this.generation);
|
|
value.putMany(a0.threadMessages ?? [], this.generation);
|
|
if (a0.lastMessages != null) {
|
|
value.localNeeded = false;
|
|
}
|
|
}}, {key: 'handleConnectionOpen', value: value_96146}, {key: 'handleGuildCreate', value: function(a0) {
|
|
this.handleOneGuildCreate(a0.guild);
|
|
}}, {key: 'handleGuildDelete', value: function(a0) {
|
|
this.guilds.delete(a0.guild.id);
|
|
}}, {key: 'handleMessageCreate', value: function(a0) {
|
|
if (a0.optimistic) {
|
|
return false;
|
|
}
|
|
if (a0.isPushNotification) {
|
|
return false;
|
|
}
|
|
var property = this.data;
|
|
var guildId = a0.guildId;
|
|
var value = null;
|
|
value = Reflect.apply(property, this, [value != guildId ? guildId : value]);
|
|
value.put(a0.message.channel_id, a0.message, this.generation);
|
|
}}, {key: 'handleMessageDelete', value: value_96150}, {key: 'handleMessageUpdate', value: function(a0) {
|
|
var property = a0.guildId;
|
|
var value = null;
|
|
var r3 = value != property ? property : value;
|
|
property = a0.message.channel_id;
|
|
var id = a0.message.id;
|
|
if (value == property) {
|
|
return false;
|
|
}
|
|
if (value == id) {
|
|
return false;
|
|
}
|
|
var value2 = this.data(r3);
|
|
var value3 = undefined;
|
|
if ((value == value2 ? value3 : value2.messageId(property)) !== id) {
|
|
return false;
|
|
}
|
|
if (value != value2) {
|
|
value2.update(a0.message);
|
|
}
|
|
return value3;
|
|
}}, {key: 'handleThreadListSync', value: function(a0) {
|
|
var value = this.data(a0.guildId);
|
|
value.putMany(a0.mostRecentMessages ?? [], this.generation);
|
|
}}, {key: 'handleLoadMessagesSuccess', value: value_96153}, {key: 'handleLocalMessagesLoaded', value: value_96154},
|
|
{key: 'handleMessagePreviewsLoaded', value: value_96155}, {key: 'handleMessagePreviewsLocallyLoaded',
|
|
value: value_96156}, {key: 'handleLogout', value: function() {
|
|
this.guilds.clear();
|
|
}}]);
|
|
}
|
|
|
|
function MessagePreviewStore_96127() { // fn#96127, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:1350, offset: 0x02156103, size: 332 bytes, params: 1, frame: 20
|
|
var environment;
|
|
let value = environment.__proto__;
|
|
env1_4(this, MessagePreviewStore_96127);
|
|
const items2 = [importDefault(694) /* metro dependency 694: Dispatcher */];
|
|
items2[1] = {CONNECTION_OPEN: CONNECTION_OPEN_96128, GUILD_CREATE: GUILD_CREATE_96129,
|
|
GUILD_DELETE: GUILD_DELETE_96130, LOAD_MESSAGES_SUCCESS: LOAD_MESSAGES_SUCCESS_96131,
|
|
LOCAL_MESSAGES_LOADED: LOCAL_MESSAGES_LOADED_96132, LOGOUT: LOGOUT_96133, MESSAGE_CREATE: MESSAGE_CREATE_96134,
|
|
MESSAGE_DELETE: MESSAGE_DELETE_96135, MESSAGE_PREVIEWS_LOADED: MESSAGE_PREVIEWS_LOADED,
|
|
MESSAGE_PREVIEWS_LOCALLY_LOADED: MESSAGE_PREVIEWS_LOCALLY_LOADED, MESSAGE_UPDATE: MESSAGE_UPDATE_96138,
|
|
THREAD_LIST_SYNC: THREAD_LIST_SYNC_96139};
|
|
const value3 = env1_7(MessagePreviewStore_96127);
|
|
value = env1_6(this, _isNativeReflectConstruct_96123() ? global.Reflect.construct(value3, items2,
|
|
env1_7(this).constructor) : value3.apply(this, items2));
|
|
const Map = global.Map;
|
|
const value4 = Object.create(Map.prototype, {constructor: {value: Map}});
|
|
const map = new Map();
|
|
value.guilds = map instanceof Object ? map : value4;
|
|
value.generation = 0;
|
|
return value;
|
|
}
|
|
|
|
function value_96144(a0) { // fn#96144, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:2720, offset: 0x021563cb, size: 111 bytes, params: 2, frame: 16
|
|
var set;
|
|
var value;
|
|
let guilds = this.guilds;
|
|
if (!guilds.has(a0)) {
|
|
guilds = this.guilds;
|
|
set = guilds.set;
|
|
value = environment.__proto__;
|
|
Reflect.apply(set, guilds, [a0, new (require(12563) /* metro dependency 12563: PreviewData */).PreviewData()]);
|
|
}
|
|
return this.guilds.get(a0);
|
|
}
|
|
|
|
function value_96146({guilds}) { // fn#96146, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:3091, offset: 0x021564a7, size: 90 bytes, params: 2, frame: 14
|
|
var r2;
|
|
var value3;
|
|
var value4;
|
|
this.generation = this.generation + 1;
|
|
let value = environment.__proto__;
|
|
value = _createForOfIteratorHelperLoose_96120(guilds);
|
|
const value2 = value();
|
|
let done = value2.done;
|
|
if (!done) {
|
|
for (r2 = value2; true; r2 = value4) {
|
|
value3 = r2.value;
|
|
this.handleOneGuildCreate(value3);
|
|
value4 = value();
|
|
done = value4.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function value_96150(a0) { // fn#96150, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:3617, offset: 0x0215659c, size: 181 bytes, params: 2, frame: 19
|
|
var r5;
|
|
var value5;
|
|
var value6;
|
|
const guildId = a0.guildId;
|
|
let value = null;
|
|
const r4 = value != guildId ? guildId : value;
|
|
const value2 = this.data(r4);
|
|
const value3 = undefined;
|
|
if ((value == value2 ? value3 : value2.messageId(a0.channelId)) === a0.id) {
|
|
value5 = environment.__proto__;
|
|
value6 = MessageStore.getMessages(a0.channelId);
|
|
r5 = value6.hasMoreAfter ? value : value6.last();
|
|
if (value != r5) {
|
|
value = this.data(r4);
|
|
value.put(a0.channelId, r5, this.generation);
|
|
} else {
|
|
this.data(r4).delete(a0.channelId);
|
|
}
|
|
}
|
|
return value3;
|
|
}
|
|
|
|
function value_96153(a0) { // fn#96153, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:4310, offset: 0x02156702, size: 238 bytes, params: 2, frame: 21
|
|
var put;
|
|
var property;
|
|
var putNew;
|
|
let value = environment.__proto__;
|
|
const getBasicChannel = ChannelStore.getBasicChannel;
|
|
let channelId = a0.channelId;
|
|
const value2 = Reflect.apply(getBasicChannel, ChannelStore, [channelId]);
|
|
const value3 = null;
|
|
if (value3 == value2) {
|
|
return false;
|
|
}
|
|
value = require(4820) /* metro dependency 4820: requireSortedDescending */;
|
|
value.requireSortedDescending(a0.messages);
|
|
if (a0.isAfter) {
|
|
value = this.data(value2.guild_id);
|
|
putNew = value.putNew;
|
|
channelId = a0.channelId;
|
|
property = a0.messages[0];
|
|
Reflect.apply(putNew, value, [channelId, value3 != property ? property : value3, this.generation]);
|
|
} else if (a0.isBefore) {
|
|
value = this.data(value2.guild_id);
|
|
putNew = value.putNew;
|
|
channelId = a0.channelId;
|
|
property = a0.messages[0];
|
|
Reflect.apply(putNew, value, [channelId, value3 != property ? property : value3, this.generation]);
|
|
} else if (a0.hasMoreAfter) {
|
|
value = this.data(value2.guild_id);
|
|
putNew = value.putNew;
|
|
channelId = a0.channelId;
|
|
property = a0.messages[0];
|
|
Reflect.apply(putNew, value, [channelId, value3 != property ? property : value3, this.generation]);
|
|
} else {
|
|
value = this.data(value2.guild_id);
|
|
put = value.put;
|
|
channelId = a0.channelId;
|
|
property = a0.messages[0];
|
|
Reflect.apply(put, value, [channelId, value3 != property ? property : value3, this.generation]);
|
|
}
|
|
}
|
|
|
|
function value_96154(a0) { // fn#96154, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:4685, offset: 0x021567f0, size: 145 bytes, params: 2, frame: 17
|
|
var requireSortedDescending;
|
|
var messages;
|
|
var putNew;
|
|
var property;
|
|
let value = environment.__proto__;
|
|
const getBasicChannel = ChannelStore.getBasicChannel;
|
|
let channelId = a0.channelId;
|
|
const value2 = Reflect.apply(getBasicChannel, ChannelStore, [channelId]);
|
|
const value3 = null;
|
|
if (value3 != value2) {
|
|
value = require(4820) /* metro dependency 4820: requireSortedDescending */;
|
|
requireSortedDescending = value.requireSortedDescending;
|
|
messages = a0.messages;
|
|
Reflect.apply(requireSortedDescending, value, [messages]);
|
|
value = this.data(value2.guild_id);
|
|
putNew = value.putNew;
|
|
channelId = a0.channelId;
|
|
messages = a0.messages;
|
|
property = messages[0];
|
|
Reflect.apply(putNew, value, [channelId, value3 != property ? property : value3, -Infinity]);
|
|
}
|
|
}
|
|
|
|
function value_96155(a0) { // fn#96155, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:4911, offset: 0x02156881, size: 191 bytes, params: 2, frame: 22
|
|
var r2;
|
|
var value4;
|
|
var isLatest;
|
|
var channel_id;
|
|
var generation;
|
|
var put;
|
|
var value5;
|
|
let value = environment.__proto__;
|
|
const binding = env1_11;
|
|
binding.verbose('adding remote previews (guildId: ' + a0.guildId + ', messages: ' + a0.messages.length + ')');
|
|
const value2 = this.data(a0.guildId);
|
|
value = _createForOfIteratorHelperLoose_96120(a0.messages);
|
|
const value3 = value();
|
|
let done = value3.done;
|
|
if (!done) {
|
|
r2 = value3;
|
|
while (true) {
|
|
value4 = r2.value;
|
|
isLatest = value2.isLatest;
|
|
channel_id = value4.channel_id;
|
|
generation = this.generation;
|
|
if (!Reflect.apply(isLatest, value2, [channel_id, generation])) {
|
|
put = value2.put;
|
|
channel_id = value4.channel_id;
|
|
generation = this.generation;
|
|
Reflect.apply(put, value2, [channel_id, value4, generation]);
|
|
}
|
|
value5 = value();
|
|
done = value5.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
r2 = value5;
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
|
|
function value_96156(a0) { // fn#96156, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:5255, offset: 0x02156940, size: 211 bytes, params: 2, frame: 23
|
|
var r3;
|
|
var value5;
|
|
var value6;
|
|
var property;
|
|
var property2;
|
|
var has;
|
|
var value7;
|
|
const binding = env1_11;
|
|
binding.verbose('adding local previews (guildId: ' + a0.guildId + ', messages: ' + a0.messages.length + ')');
|
|
const value2 = this.data(a0.guildId);
|
|
const value3 = _createForOfIteratorHelperLoose_96120(a0.messages);
|
|
const value4 = value3();
|
|
let done = value4.done;
|
|
if (!done) {
|
|
r3 = value4;
|
|
while (true) {
|
|
value5 = r3.value;
|
|
value6 = env1_3(value5, 2);
|
|
property = value6[0];
|
|
property2 = value6[1];
|
|
has = value2.has;
|
|
if (!Reflect.apply(has, value2, [property])) {
|
|
value2.put(property, property2, -Infinity);
|
|
}
|
|
value7 = value3();
|
|
done = value7.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
r3 = value7;
|
|
continue;
|
|
}
|
|
}
|
|
value2.localNeeded = false;
|
|
}
|
|
|
|
function MessagePreviewStore_96127LOAD_MESSAGES_SUCCESS(a0) { // fn#96131, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:1737, owner: MessagePreviewStore_96127.LOAD_MESSAGES_SUCCESS, offset: 0x0215624f, size: 23 bytes, params: 2, frame: 11
|
|
return env0_0.handleLoadMessagesSuccess(a0);
|
|
}
|
|
|
|
function MessagePreviewStore_96127LOCAL_MESSAGES_LOADED(a0) { // fn#96132, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:1793, owner: MessagePreviewStore_96127.LOCAL_MESSAGES_LOADED, offset: 0x02156266, size: 25 bytes, params: 2, frame: 11
|
|
return env0_0.handleLocalMessagesLoaded(a0);
|
|
}
|
|
|
|
function MessagePreviewStore_96127MESSAGE_PREVIEWS_LOADED(a0) { // fn#96136, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:1965, owner: MessagePreviewStore_96127.MESSAGE_PREVIEWS_LOADED, offset: 0x021562ad, size: 23 bytes, params: 2, frame: 11
|
|
return env0_0.handleMessagePreviewsLoaded(a0);
|
|
}
|
|
|
|
function MESSAGE_PREVIEWS_LOCALLY_LOADED(a0) { // fn#96137, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12752:2033, owner: MessagePreviewStore_96127.MESSAGE_PREVIEWS_LOCALLY_LOADED, offset: 0x021562c4, size: 25 bytes, params: 2, frame: 11
|
|
return env0_0.handleMessagePreviewsLocallyLoaded(a0);
|
|
}
|
|
|