402 lines
15 KiB
TypeScript
402 lines
15 KiB
TypeScript
/* Metro module 3785; source: modules/lurker_mode/LurkingStore.tsx; dependencies: [6, 7, 15, 17, 18, 1422, 1945, 1867, 1878, 661, 566, 694, 2] */
|
|
function _fun28721(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#28721, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:6, offset: 0x00f811e2, size: 518 bytes, params: 8, frame: 19
|
|
const _arrayLikeToArray_28727 = 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(6) /* metro dependency 6 */;
|
|
const env0_1 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_2 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_3 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_4 = importDefault(18) /* metro dependency 18 */;
|
|
const env0_5 = (require(1422) /* metro dependency 1422: GuildRecord */).isGuildLurker;
|
|
const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */;
|
|
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
let value = require(661) /* metro dependency 661: Constants */;
|
|
const env0_9 = value.JoinGuildSources;
|
|
const env0_10 = value.ME;
|
|
let env0_11 = [];
|
|
const env0_12 = {};
|
|
let env0_13 = {};
|
|
let env0_14 = {};
|
|
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
|
|
_fun28731(Store).displayName = 'LurkingStore';
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: function() {
|
|
env0_11 = GuildStore.getGuildsArray().filter(_fun28742).map(_fun28743);
|
|
env0_13 = {};
|
|
env0_14 = {};
|
|
}, GUILD_JOIN: GUILD_JOIN_28744, GUILD_STOP_LURKING: function({ignoredGuildIds}) {
|
|
return _fun28746(ignoredGuildIds);
|
|
}, GUILD_STOP_LURKING_FOR_GUILD: function({lurkingGuildId}) {
|
|
return removeLurkedGuild(lurkingGuildId);
|
|
}, GUILD_STOP_LURKING_FAILURE: function({lurkingGuildId, lurkingSource}) {
|
|
addLurkingGuild(lurkingGuildId);
|
|
setLurkingSource(lurkingGuildId, lurkingSource);
|
|
return true;
|
|
}, GUILD_CREATE: GUILD_CREATE_28750, GUILD_DELETE: GUILD_DELETE_28751, GUILD_MEMBER_ADD: GUILD_MEMBER_ADD_28752,
|
|
LURKER_PREVIEW_SET_EXPIRY: LURKER_PREVIEW_SET_EXPIRY});
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/lurker_mode/LurkingStore.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function _isNativeReflectConstruct_28722() { // fn#28722, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:244, offset: 0x00f813e8, size: 94 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_28722_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_28725(a0, a1) { // fn#28725, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:437, offset: 0x00f81446, 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 _fun28726;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_28727(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_28727(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_28727(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun28726;
|
|
}
|
|
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 removeLurkedGuild(a0) { // fn#28728, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:1371, offset: 0x00f815b8, size: 99 bytes, params: 2, frame: 16
|
|
var items2;
|
|
let binding = env0_11;
|
|
const value2 = binding.indexOf(a0);
|
|
if (value2 > -1) {
|
|
binding = env0_11;
|
|
items2 = [];
|
|
arraySpread(items2, binding, 0, value2);
|
|
items2.splice(value2, 1);
|
|
delete env0_12[a0];
|
|
delete env0_13[a0];
|
|
delete env0_14[a0];
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function addLurkingGuild(a0) { // fn#28729, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:1515, offset: 0x00f8161b, size: 77 bytes, params: 2, frame: 17
|
|
var r1;
|
|
var r0;
|
|
var binding;
|
|
var value3;
|
|
var items2;
|
|
var value5;
|
|
const value2 = a0 !== ME;
|
|
if (value2) {
|
|
binding = env0_11;
|
|
value3 = binding.includes(a0);
|
|
if (value3) {
|
|
r1 = !value3;
|
|
} else {
|
|
binding = env0_11;
|
|
items2 = [];
|
|
value5 = arraySpread(items2, binding, 0, undefined);
|
|
items2[value5] = a0;
|
|
value5 + 1;
|
|
r1 = true;
|
|
}
|
|
r0 = r1;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function setLurkingSource(a0, a1) { // fn#28730, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:1591, offset: 0x00f81668, size: 40 bytes, params: 3, frame: 3
|
|
if (a1 == null) {
|
|
delete env0_13[a0];
|
|
} else {
|
|
env0_13[a0] = a1;
|
|
}
|
|
}
|
|
|
|
function _fun28731(a0) { // fn#28731, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:1655, offset: 0x00f81690, size: 233 bytes, params: 2, frame: 16
|
|
const closure = LurkingStore;
|
|
env0_4(closure, a0);
|
|
return env0_1(closure, [{key: 'initialize', value: function() {
|
|
this.waitFor(GuildMemberStore, GuildStore, UserStore);
|
|
}}, {key: 'lurkingGuildIds', value: value_28734}, {key: 'mostRecentLurkedGuildId', value: value_28735},
|
|
{key: 'isLurking', value: value_28736}, {key: 'getLurkingSourceForGuild', value: value_28737},
|
|
{key: 'getLoadId', value: value_28738}, {key: 'getLurkingPreviewExpirations', value: value_28739},
|
|
{key: 'getLurkingPreviewExpiry', value: value_28740}]);
|
|
}
|
|
|
|
function CONNECTION_OPEN_28741() { // fn#28741, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:2665, offset: 0x00f818f5, size: 69 bytes, params: 1, frame: 13
|
|
env0_11 = GuildStore.getGuildsArray().filter(function(a0) {
|
|
return isGuildLurker(a0);
|
|
}).map(function(a0) {
|
|
return a0.id;
|
|
});
|
|
env0_13 = {};
|
|
env0_14 = {};
|
|
}
|
|
|
|
function GUILD_JOIN_28744({guildId, lurker, source, directoryChannelId, loadId}) { // fn#28744, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:2773, offset: 0x00f8193a, size: 177 bytes, params: 2, frame: 17
|
|
if (lurker) {
|
|
addLurkingGuild(guildId);
|
|
if (loadId != null) {
|
|
env0_12[guildId] = loadId;
|
|
}
|
|
delete env0_14[guildId];
|
|
if (JoinGuildSources.MOBILE_GUILD_DISCOVERY === source) {
|
|
setLurkingSource(guildId, {type: JoinGuildSources.MOBILE_GUILD_DISCOVERY});
|
|
} else if (JoinGuildSources.DIRECTORY_ENTRY === source) {
|
|
setLurkingSource(guildId, {type: JoinGuildSources.DIRECTORY_ENTRY, directoryChannelId: directoryChannelId});
|
|
} else {
|
|
setLurkingSource(guildId, null);
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function GUILD_STOP_LURKING({ignoredGuildIds}) { // fn#28745, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:3215, offset: 0x00f819eb, size: 25 bytes, params: 2, frame: 11
|
|
return clearLurkingGuilds(ignoredGuildIds);
|
|
}
|
|
|
|
function GUILD_CREATE_28750({guild}) { // fn#28750, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:3697, offset: 0x00f81ae7, size: 77 bytes, params: 2, frame: 13
|
|
var r0;
|
|
const r2 = guild.joined_at == null || !env0_11.includes(guild.id);
|
|
if (r2) {
|
|
r0 = !r2;
|
|
} else {
|
|
removeLurkedGuild(guild.id);
|
|
r0 = true;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function GUILD_DELETE_28751({guild}) { // fn#28751, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:3831, offset: 0x00f81b34, size: 59 bytes, params: 2, frame: 13
|
|
var r0;
|
|
const binding = env0_11;
|
|
const value2 = binding.includes(guild.id);
|
|
if (value2) {
|
|
removeLurkedGuild(guild.id);
|
|
r0 = true;
|
|
} else {
|
|
r0 = !!value2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function GUILD_MEMBER_ADD_28752({guildId, joinedAt, user}) { // fn#28752, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:3948, offset: 0x00f81b6f, size: 108 bytes, params: 2, frame: 17
|
|
var r0;
|
|
let r4 = user.id !== UserStore.getCurrentUser()?.id || joinedAt == null;
|
|
r4 = !r4 ? !env0_11.includes(guildId) : r4;
|
|
if (r4) {
|
|
r0 = !r4;
|
|
} else {
|
|
removeLurkedGuild(guildId);
|
|
r0 = true;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function LURKER_PREVIEW_SET_EXPIRY({guildIds, expiresAt}) { // fn#28753, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:4155, offset: 0x00f81bdb, size: 121 bytes, params: 2, frame: 19
|
|
var r2;
|
|
var r3;
|
|
var r9;
|
|
var r0;
|
|
var value5;
|
|
var binding;
|
|
var includes;
|
|
var value6;
|
|
var value7;
|
|
const value2 = _createForOfIteratorHelperLoose_28725(guildIds);
|
|
const value3 = value2();
|
|
let done = value3.done;
|
|
if (done) {
|
|
r0 = false;
|
|
} else {
|
|
r2 = false;
|
|
r3 = value3;
|
|
while (true) {
|
|
value5 = r3.value;
|
|
binding = env0_11;
|
|
includes = binding.includes;
|
|
if (Reflect.apply(includes, binding, [value5])) {
|
|
if (env0_14[value5] === expiresAt) {
|
|
continue;
|
|
}
|
|
env0_14[value5] = expiresAt;
|
|
value6 = true;
|
|
r9 = value6;
|
|
} else {
|
|
r9 = r2;
|
|
}
|
|
value7 = value2();
|
|
done = value7.done;
|
|
if (done) {
|
|
r0 = r9;
|
|
break;
|
|
}
|
|
r2 = r9;
|
|
r3 = value7;
|
|
continue;
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function value_28735() { // fn#28735, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:2066, offset: 0x00f8180d, size: 42 bytes, params: 1, frame: 4
|
|
return env1_11.length === 0 ? null : env1_11[env1_11.length - 1];
|
|
}
|
|
|
|
function value_28736(a0) { // fn#28736, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:2141, offset: 0x00f81837, size: 81 bytes, params: 2, frame: 13
|
|
let value = environment.__proto__;
|
|
const guild = GuildStore.getGuild(a0);
|
|
if (guild == null) {
|
|
return false;
|
|
}
|
|
const isCurrentUserGuest2 = GuildMemberStore.isCurrentUserGuest(a0);
|
|
value = isGuildLurker(guild);
|
|
const Boolean = global.Boolean;
|
|
return Boolean(!isCurrentUserGuest2 && value);
|
|
}
|
|
|
|
function value_28738(a0) { // fn#28738, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:2377, offset: 0x00f818b2, size: 25 bytes, params: 2, frame: 3
|
|
const value = null;
|
|
return value != a0 ? env1_12[a0] : value;
|
|
}
|
|
|
|
function value_28740(a0) { // fn#28740, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:2517, offset: 0x00f818cb, size: 42 bytes, params: 2, frame: 4
|
|
const value = null;
|
|
return value == a0 ? value : value != env1_14[a0] ? env1_14[a0] : value;
|
|
}
|
|
|
|
function clearLurkingGuilds(a0) { // fn#28746, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:3275, owner: GUILD_STOP_LURKING.clearLurkingGuilds, offset: 0x00f81a04, size: 105 bytes, params: 2, frame: 15
|
|
var environment;
|
|
const value = a0;
|
|
const Set = global.Set;
|
|
const r3 = value ?? [];
|
|
let items2 = [];
|
|
arraySpread(items2, r3, 0, Set);
|
|
let set = new Set(items2);
|
|
set = environment.__proto__;
|
|
const binding = env1_11;
|
|
items2 = [];
|
|
arraySpread(items2, binding, 0, Set);
|
|
return items2.reduce(_fun28747, false);
|
|
}
|
|
|
|
function _fun28747(a0, a1) { // fn#28747, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3912:3360, offset: 0x00f81a6d, size: 54 bytes, params: 3, frame: 13
|
|
const value = a0;
|
|
const binding = env0_0;
|
|
return binding.has(a1) ? value : removeLurkedGuild(a1) || value;
|
|
}
|
|
|