547 lines
16 KiB
TypeScript
547 lines
16 KiB
TypeScript
// Metro module 6055 (f6056).
|
|
import ExperimentStore from "../modules/experiments/ExperimentStore";
|
|
import ApplicationStreamingStore from "./ApplicationStreamingStore";
|
|
import AuthenticationStore from "./AuthenticationStore";
|
|
import ChannelStore from "./ChannelStore";
|
|
import GuildMemberCountStore from "./GuildMemberCountStore";
|
|
import GuildMemberStore from "./GuildMemberStore";
|
|
import GuildRoleStore from "./GuildRoleStore";
|
|
import GuildStore from "./GuildStore";
|
|
import PresenceStore from "./PresenceStore";
|
|
import SelfPresenceStore from "./SelfPresenceStore";
|
|
import UserStore from "./UserStore";
|
|
import { Permissions, StatusTypes } from "../Constants";
|
|
import { canEveryone, getGuildVisualOwnerId } from "../utils/PermissionUtils";
|
|
import MurmurHashV3 from "../_bundle/MurmurHashV3";
|
|
import Module12 from "../_bundle/Module12";
|
|
import { has } from "../_bundle/HighLow";
|
|
import Module589 from "../_bundle/Module589";
|
|
import Dispatcher from "../Dispatcher";
|
|
function $mk77661($env) {
|
|
return function() {
|
|
const r3 = $env[0];
|
|
const r6 = $env.$parent;
|
|
const r2 = r6[15];
|
|
if (r2.ONLINE === r3) {
|
|
const r30 = r6[0];
|
|
const r31 = r6[3];
|
|
return r30(r31[12]).intl.string(r30(r31[12]).t.WbGtnH);
|
|
}
|
|
if (r2.OFFLINE === r3) {
|
|
const r18 = r6[0];
|
|
const r19 = r6[3];
|
|
return r18(r19[12]).intl.string(r18(r19[12]).t.Vv0abJ);
|
|
}
|
|
const r5 = r6[0];
|
|
const r8 = r6[3];
|
|
return r5(r8[12]).intl.string(r5(r8[12]).t["UQMV/E"]);
|
|
};
|
|
}
|
|
let handleApplicationStreamUpdate, handleLocalPresenceUpdate, c3838_17, c3838_18, c3838_21, c3838_25;
|
|
let env3838 = {};
|
|
const getMemberListId = function getMemberListId(a0) {
|
|
const channel = ChannelStore.getChannel(a0);
|
|
return channel == null ? c3838_17 : channel.memberListId == null ? canEveryone(Permissions.VIEW_CHANNEL, channel) ? c3838_17 : MurmurHashV3.v3(Module12(channel.permissionOverwrites).reduce((acc, { id: id2, allow, deny }) => {
|
|
if (has(allow, Permissions.VIEW_CHANNEL)) {
|
|
acc.push(`allow:${id2}`);
|
|
} else if (has(deny, Permissions.VIEW_CHANNEL)) {
|
|
acc.push(`deny:${id2}`);
|
|
}
|
|
return acc;
|
|
}, []).sort().join(",")).toString() : channel.memberListId;
|
|
};
|
|
const handleConnectionOpen = function handleConnectionOpen() {
|
|
c3838_21.reset();
|
|
};
|
|
handleApplicationStreamUpdate = function handleApplicationStreamUpdate() {
|
|
const allApplicationStreams = ApplicationStreamingStore.getAllApplicationStreams();
|
|
const r7 = env3838[22].concat(allApplicationStreams);
|
|
env3838[22] = allApplicationStreams;
|
|
r7.forEach((c25686_0) => {
|
|
c3838_21.forEach(null, (a0) => a0.rebuildMember(c25686_0.ownerId));
|
|
});
|
|
};
|
|
handleLocalPresenceUpdate = function handleLocalPresenceUpdate() {
|
|
const id = AuthenticationStore.getId();
|
|
c3838_21.forEach(null, (a0) => a0.rebuildMember(id));
|
|
};
|
|
c3838_17 = "everyone";
|
|
c3838_18 = {
|
|
GROUP: "GROUP",
|
|
MEMBER: "MEMBER",
|
|
CONTENT_INVENTORY: "CONTENT_INVENTORY",
|
|
CONTENT_INVENTORY_GROUP: "CONTENT_INVENTORY_GROUP",
|
|
HIDDEN_CONTENT_INVENTORY: "HIDDEN_CONTENT_INVENTORY",
|
|
CONTENT_INVENTORY_LEADERBOARD: "CONTENT_INVENTORY_LEADERBOARD"
|
|
};
|
|
class MemberList {
|
|
constructor(a0, a1) {
|
|
const r3 = {
|
|
__proto__: new.target.prototype,
|
|
rows: [],
|
|
groups: null,
|
|
members: null,
|
|
version: 0
|
|
};
|
|
r3.groups = [];
|
|
r3.members = {};
|
|
r3.guildId = a0;
|
|
r3.listId = a1;
|
|
r3.updateOwnerId();
|
|
return r3;
|
|
}
|
|
updateOwnerId() {
|
|
const guild = GuildStore.getGuild(this.guildId);
|
|
if (guild == null) {
|
|
return false;
|
|
}
|
|
const guildVisualOwnerId = getGuildVisualOwnerId(guild);
|
|
let r16 = this.ownerId !== guildVisualOwnerId;
|
|
if (r16) {
|
|
this.ownerId = guildVisualOwnerId;
|
|
r16 = true;
|
|
}
|
|
return r16;
|
|
}
|
|
setGroups(a0) {
|
|
const length = 0;
|
|
this.groups = a0.map((item) => {
|
|
let r33;
|
|
const index = length;
|
|
const r8 = Math;
|
|
let count = item.count;
|
|
if (count == null) {
|
|
count = 0;
|
|
}
|
|
let env25687;
|
|
const count2 = r8.max(0, count);
|
|
length = length + (count2 + 1);
|
|
const r9 = env3838;
|
|
const guildId = this.guildId;
|
|
const id2 = item.id;
|
|
const r20 = env25687 = {
|
|
$parent: r9
|
|
};
|
|
env25687[0] = id2;
|
|
if (StatusTypes.ONLINE !== id2 && (StatusTypes.OFFLINE !== id2 && StatusTypes.UNKNOWN !== id2)) {
|
|
const guild = GuildStore.getGuild(guildId);
|
|
const r28 = guild != null ? GuildRoleStore.getRole(guild.id, id2) : null;
|
|
r33 = {
|
|
type: c3838_18.GROUP,
|
|
key: id2,
|
|
id: id2,
|
|
title: r28 != null ? r28.name : "",
|
|
count: count2,
|
|
index
|
|
};
|
|
} else {
|
|
const r38 = {
|
|
type: c3838_18.GROUP,
|
|
key: id2,
|
|
id: id2
|
|
};
|
|
Object.defineProperty(r38, "title", {
|
|
get: $mk77661(r20),
|
|
set: void 0,
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
r38.count = count2;
|
|
r38.index = index;
|
|
r33 = r38;
|
|
}
|
|
return r33;
|
|
});
|
|
this.rows.length = length;
|
|
}
|
|
sync(a0, a1) {
|
|
let [c15416_0] = a0;
|
|
a1.forEach((item, index) => this.update(c15416_0 + index, item));
|
|
}
|
|
invalidate(a0) {
|
|
let [r16, r17] = a0;
|
|
while (r16 <= r17) {
|
|
const r22 = this.rows[r16];
|
|
const r23 = r16;
|
|
if (r22 == null) {
|
|
break;
|
|
}
|
|
delete this.rows[r23];
|
|
if (r22.type === c3838_18.MEMBER) {
|
|
delete this.members[r22.user.id];
|
|
}
|
|
r16 = r23 + 1;
|
|
}
|
|
this.version = this.version + 1;
|
|
}
|
|
insert(a0, { group, member }) {
|
|
let r74;
|
|
if (group != null) {
|
|
let env15417;
|
|
const rows = this.rows;
|
|
const guildId2 = this.guildId;
|
|
const { id: id3, count } = group;
|
|
const r59 = env15417 = {
|
|
$parent: env3838
|
|
};
|
|
env15417[0] = id3;
|
|
if (StatusTypes.ONLINE !== id3 && (StatusTypes.OFFLINE !== id3 && StatusTypes.UNKNOWN !== id3)) {
|
|
const guild = GuildStore.getGuild(guildId2);
|
|
const r68 = guild != null ? GuildRoleStore.getRole(guild.id, id3) : null;
|
|
r74 = {
|
|
type: c3838_18.GROUP,
|
|
key: id3,
|
|
id: id3,
|
|
title: r68 != null ? r68.name : "",
|
|
count,
|
|
index: void 0
|
|
};
|
|
} else {
|
|
const r79 = {
|
|
type: c3838_18.GROUP,
|
|
key: id3,
|
|
id: id3
|
|
};
|
|
Object.defineProperty(r79, "title", {
|
|
get: $mk77661(r59),
|
|
set: void 0,
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
r79.count = count;
|
|
r79.index = void 0;
|
|
r74 = r79;
|
|
}
|
|
rows.splice(a0, 0, r74);
|
|
} else if (member != null) {
|
|
const guildId = this.guildId;
|
|
const ownerId = this.ownerId;
|
|
const id2 = member.user.id;
|
|
const r2 = id2 === AuthenticationStore.getId();
|
|
const isMobileOnline = PresenceStore.isMobileOnline(id2);
|
|
const isVROnline = PresenceStore.isVROnline(id2);
|
|
const status = r2 ? SelfPresenceStore.getStatus() : PresenceStore.getStatus(id2, guildId);
|
|
const activities = r2 ? SelfPresenceStore.getActivities() : PresenceStore.getActivities(id2, guildId);
|
|
const streamForUser = ApplicationStreamingStore.getStreamForUser(id2, guildId);
|
|
const user2 = UserStore.getUser(id2);
|
|
const r41 = user2 == null ? null : {
|
|
type: c3838_18.MEMBER,
|
|
...GuildMemberStore.getMember(guildId, id2),
|
|
user: user2,
|
|
status,
|
|
activities,
|
|
applicationStream: streamForUser,
|
|
isOwner: ownerId === id2,
|
|
isMobileOnline,
|
|
isVROnline
|
|
};
|
|
if (r41 == null) {
|
|
return void 0;
|
|
}
|
|
this.rows.splice(a0, 0, r41);
|
|
this.members[member.user.id] = r41;
|
|
}
|
|
this.version = this.version + 1;
|
|
}
|
|
update(a0, { group, member }) {
|
|
let r80;
|
|
const r24 = this.rows[a0];
|
|
if (r24 != null && r24.type === c3838_18.MEMBER) {
|
|
delete this.members[r24.user.id];
|
|
}
|
|
if (group != null) {
|
|
let env15418;
|
|
const rows = this.rows;
|
|
const guildId2 = this.guildId;
|
|
const { id: id3, count } = group;
|
|
const r65 = env15418 = {
|
|
$parent: env3838
|
|
};
|
|
env15418[0] = id3;
|
|
if (StatusTypes.ONLINE !== id3 && (StatusTypes.OFFLINE !== id3 && StatusTypes.UNKNOWN !== id3)) {
|
|
const guild = GuildStore.getGuild(guildId2);
|
|
const r74 = guild != null ? GuildRoleStore.getRole(guild.id, id3) : null;
|
|
r80 = {
|
|
type: c3838_18.GROUP,
|
|
key: id3,
|
|
id: id3,
|
|
title: r74 != null ? r74.name : "",
|
|
count,
|
|
index: void 0
|
|
};
|
|
} else {
|
|
const r85 = {
|
|
type: c3838_18.GROUP,
|
|
key: id3,
|
|
id: id3
|
|
};
|
|
Object.defineProperty(r85, "title", {
|
|
get: $mk77661(r65),
|
|
set: void 0,
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
r85.count = count;
|
|
r85.index = void 0;
|
|
r80 = r85;
|
|
}
|
|
rows[a0] = r80;
|
|
} else if (member != null) {
|
|
const guildId = this.guildId;
|
|
const ownerId = this.ownerId;
|
|
const id2 = member.user.id;
|
|
const r34 = id2 === AuthenticationStore.getId();
|
|
const isMobileOnline = PresenceStore.isMobileOnline(id2);
|
|
const isVROnline = PresenceStore.isVROnline(id2);
|
|
const status = r34 ? SelfPresenceStore.getStatus() : PresenceStore.getStatus(id2, guildId);
|
|
const activities = r34 ? SelfPresenceStore.getActivities() : PresenceStore.getActivities(id2, guildId);
|
|
const streamForUser = ApplicationStreamingStore.getStreamForUser(id2, guildId);
|
|
const user2 = UserStore.getUser(id2);
|
|
const r50 = user2 == null ? null : {
|
|
type: c3838_18.MEMBER,
|
|
...GuildMemberStore.getMember(guildId, id2),
|
|
user: user2,
|
|
status,
|
|
activities,
|
|
applicationStream: streamForUser,
|
|
isOwner: ownerId === id2,
|
|
isMobileOnline,
|
|
isVROnline
|
|
};
|
|
if (r50 == null) {
|
|
return void 0;
|
|
}
|
|
this.rows[a0] = r50;
|
|
this.members[member.user.id] = r50;
|
|
}
|
|
this.version = this.version + 1;
|
|
}
|
|
delete(a0) {
|
|
const r7 = this.rows[a0];
|
|
if (r7 != null) {
|
|
if (r7.type === c3838_18.MEMBER) {
|
|
delete this.members[r7.user.id];
|
|
}
|
|
this.rows.splice(a0, 1);
|
|
this.version = this.version + 1;
|
|
}
|
|
}
|
|
rebuildMember(a0) {
|
|
const r5 = this.members[a0];
|
|
if (r5 != null) {
|
|
const r3 = Object;
|
|
const guildId = this.guildId;
|
|
const ownerId = this.ownerId;
|
|
const r0 = a0 === AuthenticationStore.getId();
|
|
const isMobileOnline = PresenceStore.isMobileOnline(a0);
|
|
const isVROnline = PresenceStore.isVROnline(a0);
|
|
const status = r0 ? SelfPresenceStore.getStatus() : PresenceStore.getStatus(a0, guildId);
|
|
const activities = r0 ? SelfPresenceStore.getActivities() : PresenceStore.getActivities(a0, guildId);
|
|
const streamForUser = ApplicationStreamingStore.getStreamForUser(a0, guildId);
|
|
const user2 = UserStore.getUser(a0);
|
|
r3.assign(r5, user2 == null ? null : {
|
|
type: c3838_18.MEMBER,
|
|
...GuildMemberStore.getMember(guildId, a0),
|
|
user: user2,
|
|
status,
|
|
activities,
|
|
applicationStream: streamForUser,
|
|
isOwner: ownerId === a0,
|
|
isMobileOnline,
|
|
isVROnline
|
|
});
|
|
this.version = this.version + 1;
|
|
}
|
|
}
|
|
rebuildMembers() {
|
|
const r9 = Object.keys(this.members);
|
|
const length2 = r9.length;
|
|
let r0 = 0;
|
|
if (0 < length2) {
|
|
do {
|
|
this.rebuildMember(r9[r0]);
|
|
r0 = r0 + 1;
|
|
} while (r0 < r9.length);
|
|
}
|
|
}
|
|
rebuildGroup(a0) {
|
|
let r32;
|
|
const r7 = this.groups.findIndex((group) => group.id === a0);
|
|
const r18 = this.groups[r7];
|
|
if (r18 != null) {
|
|
let env15420;
|
|
const groups = this.groups;
|
|
const guildId = this.guildId;
|
|
const { count, index } = r18;
|
|
const r11 = env15420 = {
|
|
$parent: env3838
|
|
};
|
|
env15420[0] = a0;
|
|
if (StatusTypes.ONLINE !== a0 && (StatusTypes.OFFLINE !== a0 && StatusTypes.UNKNOWN !== a0)) {
|
|
const guild = GuildStore.getGuild(guildId);
|
|
const r27 = guild != null ? GuildRoleStore.getRole(guild.id, a0) : null;
|
|
r32 = {
|
|
type: c3838_18.GROUP,
|
|
key: a0,
|
|
id: a0,
|
|
title: r27 != null ? r27.name : "",
|
|
count,
|
|
index
|
|
};
|
|
} else {
|
|
const r37 = {
|
|
type: c3838_18.GROUP,
|
|
key: a0,
|
|
id: a0
|
|
};
|
|
Object.defineProperty(r37, "title", {
|
|
get: $mk77661(r11),
|
|
set: void 0,
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
r37.count = count;
|
|
r37.index = index;
|
|
r32 = r37;
|
|
}
|
|
groups.splice(r7, 1, r32);
|
|
this.version = this.version + 1;
|
|
}
|
|
}
|
|
}
|
|
class MemberLists {
|
|
constructor() {
|
|
return {
|
|
__proto__: new.target.prototype,
|
|
_guildLists: {}
|
|
};
|
|
}
|
|
get(a0, a1) {
|
|
let r4 = this._guildLists[a0];
|
|
if (r4 == null) {
|
|
const _guildLists = this._guildLists;
|
|
const r10 = {};
|
|
_guildLists[a0] = r10;
|
|
r4 = r10;
|
|
}
|
|
let r11 = r4[a1];
|
|
if (r11 == null) {
|
|
const r16 = {
|
|
__proto__: MemberList.prototype,
|
|
rows: [],
|
|
groups: null,
|
|
members: null,
|
|
version: 0
|
|
};
|
|
r16.groups = [];
|
|
r16.members = {};
|
|
r16.guildId = a0;
|
|
r16.listId = a1;
|
|
r16.updateOwnerId();
|
|
r16.setGroups([{
|
|
id: StatusTypes.UNKNOWN,
|
|
count: 0
|
|
}]);
|
|
r4[a1] = r16;
|
|
r11 = r16;
|
|
}
|
|
return r11;
|
|
}
|
|
forEach(a0, a1) {
|
|
if (a0 == null) {
|
|
Module12.forEach(this._guildLists, (a0) => {
|
|
Module12.forEach(a0, a1);
|
|
});
|
|
} else {
|
|
const r6 = this._guildLists[a0];
|
|
if (r6 != null) {
|
|
Module12.forEach(r6, a1);
|
|
}
|
|
}
|
|
}
|
|
delete(a0) {
|
|
delete this._guildLists[a0];
|
|
}
|
|
reset() {
|
|
this._guildLists = {};
|
|
}
|
|
}
|
|
c3838_21 = {
|
|
__proto__: MemberLists.prototype,
|
|
_guildLists: {}
|
|
};
|
|
env3838[22] = [];
|
|
class ChannelMemberStore extends Module589.Store {
|
|
static displayName = "ChannelMemberStore";
|
|
constructor() {
|
|
super(...arguments);
|
|
}
|
|
initialize() {
|
|
this.waitFor(UserStore, GuildStore, GuildRoleStore, ChannelStore, GuildMemberStore, PresenceStore, SelfPresenceStore, AuthenticationStore, GuildMemberCountStore, ApplicationStreamingStore, ExperimentStore);
|
|
this.syncWith([SelfPresenceStore], handleLocalPresenceUpdate);
|
|
this.syncWith([ApplicationStreamingStore], handleApplicationStreamUpdate);
|
|
}
|
|
getProps(a0, a1) {
|
|
const r11 = c3838_21.get(a0, getMemberListId(a1));
|
|
return {
|
|
listId: `${r11.guildId}:${r11.listId}`,
|
|
groups: r11.groups,
|
|
rows: r11.rows,
|
|
version: r11.version
|
|
};
|
|
}
|
|
getRows(a0, a1) {
|
|
return c3838_21.get(a0, getMemberListId(a1)).rows;
|
|
}
|
|
}
|
|
c3838_25 = ChannelMemberStore;
|
|
const r114 = new ChannelMemberStore(Dispatcher, {
|
|
CONNECTION_OPEN: handleConnectionOpen,
|
|
OVERLAY_INITIALIZE: handleConnectionOpen,
|
|
GUILD_MEMBER_LIST_UPDATE: function handleGuildMemberListUpdate(a0) {
|
|
const r8 = c3838_21.get(a0.guildId, a0.id);
|
|
let c15422_0 = r8;
|
|
a0.ops.forEach((a0) => {
|
|
const op = a0.op;
|
|
if (op === "SYNC") {
|
|
c15422_0.sync(a0.range, a0.items);
|
|
} else if (op === "INVALIDATE") {
|
|
c15422_0.invalidate(a0.range);
|
|
} else if (op === "INSERT") {
|
|
c15422_0.insert(a0.index, a0.item);
|
|
} else if (op === "UPDATE") {
|
|
c15422_0.update(a0.index, a0.item);
|
|
} else if (op === "DELETE") {
|
|
c15422_0.delete(a0.index);
|
|
}
|
|
});
|
|
r8.setGroups(a0.groups);
|
|
},
|
|
GUILD_UPDATE: function handleGuildUpdate(a0) {
|
|
c3838_21.forEach(a0.guild.id, (a0) => {
|
|
if (a0.updateOwnerId()) {
|
|
a0.rebuildMembers();
|
|
}
|
|
});
|
|
},
|
|
GUILD_DELETE: function handleGuildDelete(a0) {
|
|
c3838_21.delete(a0.guild.id);
|
|
},
|
|
GUILD_ROLE_UPDATE: function handleGuildRoleUpdate({ guildId, role }) {
|
|
c3838_21.forEach(guildId, (a0) => {
|
|
a0.rebuildGroup(role.id);
|
|
a0.rebuildMembers();
|
|
});
|
|
},
|
|
GUILD_MEMBER_UPDATE: function handleMemberUpdate({ guildId, user }) {
|
|
c3838_21.forEach(guildId, (a0) => a0.rebuildMember(user.id));
|
|
},
|
|
CHANNEL_UPDATES: function handleChannelUpdates() {
|
|
return true;
|
|
}
|
|
});
|
|
export default r114;
|
|
export const EVERYONE_ID = "everyone";
|
|
export const EVERYONE_CHANNEL_ID = 0;
|
|
export { c3838_18 as MemberListRowTypes };
|