This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,43 @@
// Metro module 5106 (f5107).
import AuthenticationStore from "../../stores/AuthenticationStore";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c3071_1 = new Set();
let c3071_2 = new Set();
class BulkBanStore extends Module589.Store {
static displayName = "BulkBanStore";
initialize() {
this.waitFor(AuthenticationStore);
}
hasPendingBulkBan(a0) {
return c3071_1.has(a0);
}
consumeCompletedBeforeStarted(a0, a1) {
return c3071_2.delete(`${a0}:${a1}`);
}
}
const bulkBanStore = new BulkBanStore(Dispatcher, {
GUILD_BULK_BAN_STARTED: function handleBulkBanStarted(a0) {
c3071_1.add(a0.guildId);
},
GUILD_BULK_BAN_FAILED: function handleBulkBanFailed(a0) {
if (c3071_1.has(a0.guildId)) {
c3071_1.delete(a0.guildId);
return void 0;
}
return false;
},
GUILD_BULK_BAN_UPDATE: function handleBulkBanUpdate(a0) {
if (c3071_1.has(a0.guildId)) {
c3071_1.delete(a0.guildId);
return void 0;
}
c3071_2.add(`${a0.guildId}:${AuthenticationStore.getId()}`);
return false;
},
CONNECTION_OPEN: function handleConnectionOpen() {
c3071_1.clear();
c3071_2.clear();
}
});
export default bulkBanStore;
@@ -0,0 +1,52 @@
// Metro module 5754 (f5755).
import { t } from "../../intl/index.native";
import getTimestampString from "../threads/getTimestampString";
let c3582_3, getAccountAgeDateFormatter;
const getJoinedAtDateFormatter = function getJoinedAtDateFormatter() {
return {
seconds: t["FsBhl/"],
minutes: t["4d1mgT"],
hours: t["2wkczD"],
days: t["ocdS+f"],
months: t["az14+h"],
years: t["5Gk1ns"]
};
};
getAccountAgeDateFormatter = function getAccountAgeDateFormatter() {
return {
hours: t.JZP2Rs,
days: t["3moSHc"],
months: t["0Ddwr1"],
years: t.cR7lcs
};
};
c3582_3 = {
JOINED_AT: 0,
0: "JOINED_AT",
ACCOUNT_AGE: 1,
1: "ACCOUNT_AGE"
};
export const ACCOUNT_AGE_DATE_TOOLTIP_CONFIG = {
month: "short",
day: "numeric",
year: "numeric",
hour: "numeric",
minute: "2-digit"
};
export const MEMBER_JOIN_DATE_TOOLTIP_CONFIG = {
month: "short",
day: "numeric",
year: "numeric",
hour: "numeric",
minute: "2-digit"
};
export { c3582_3 as MembersTableDateFormats };
export function getMembersTableTimestampFormatter(a0) {
return a0 === c3582_3.JOINED_AT ? getJoinedAtDateFormatter : a0 === c3582_3.ACCOUNT_AGE ? getAccountAgeDateFormatter : void 0;
}
export function formatDateRelativeTime(a0, a1) {
return getTimestampString(a0, a1 === c3582_3.JOINED_AT ? getJoinedAtDateFormatter : a1 === c3582_3.ACCOUNT_AGE ? getAccountAgeDateFormatter : void 0, false);
}
export function getJoinedAtTimestamp(a0) {
return (a0 != null ? new Date(a0) : new Date()).getTime();
}
@@ -0,0 +1,194 @@
// Metro module 5752 (f5753).
import UserStore from "../../stores/UserStore";
import { SecondaryIndexMap } from "../../_bundle/Module3813";
import { UNUSUAL_DM_COMPARISON_DELTA, OrderBy } from "./MemberSafetyElasticSearchQueryTypes";
import { getJoinedAtTimestamp } from "./DateUtils";
import { getSortValueForMember } from "./SortUtils";
import { getMemberSupplementalByGuildId } from "./MemberSafetyStoreSupplemental";
import { isSpammer } from "../messages/isSpam";
import isEqual from "../../_bundle/isEqual_4349";
let c3581_4, c3581_5, getGuildMemberSecondarySortBy;
const getGuildMemberSecondaryIndexes = function getGuildMemberSecondaryIndexes(a0) {
const r7 = [a0.isCurrentGuildMemberByTimestamp ? c3581_5.CURRENT_GUILD_MEMBER : c3581_5.NEW_GUILD_MEMBER];
if (a0.isIncludedInSearchResults) {
r7.push(c3581_5.INCLUDED_IN_SEARCH_RESULTS);
}
return r7;
};
getGuildMemberSecondarySortBy = function getGuildMemberSecondarySortBy(a0) {
return a0.sort;
};
c3581_4 = Date.now();
c3581_5 = {
NEW_GUILD_MEMBER: "NEW_GUILD_MEMBER",
CURRENT_GUILD_MEMBER: "CURRENT_GUILD_MEMBER",
INCLUDED_IN_SEARCH_RESULTS: "INCLUDED_IN_SEARCH_RESULTS"
};
export { c3581_5 as MemberSafetySecondaryIndex };
export function hasUnusualDmActivity(a0) {
return a0 != null && new Date(a0).getTime() >= c3581_4 - UNUSUAL_DM_COMPARISON_DELTA;
}
export class GuildMemberSafetyMembers {
constructor(a0) {
const r12 = {
__proto__: new.target.prototype,
newMemberTimestamp: Date.now()
};
r12.guildId = a0;
r12._membersMap = new SecondaryIndexMap(getGuildMemberSecondaryIndexes, getGuildMemberSecondarySortBy);
return r12;
}
reset() {
this._membersMap.clear();
this._membersMap = new SecondaryIndexMap(getGuildMemberSecondaryIndexes, getGuildMemberSecondarySortBy);
this.resetNewMemberTimestamp();
}
resetNewMemberTimestamp() {
this.newMemberTimestamp = Date.now();
}
enhanceNewMember(a0, a1, r3 = {}) {
const joinedAtTimestamp = getJoinedAtTimestamp(a0.joinedAt);
const r26 = this._computeMemberSupplementals(a0.userId, a0.unusualDMActivityUntil);
const { hasUnusualDmActivity: hasUnusualDmActivity2, hasUnusualAccountActivity, sourceInviteCode, joinSourceType, inviterId, integrationType, joinSourceApplicationId, joinSourceChannelId } = r26;
const user = UserStore.getUser(a0.userId);
let selectedSort = a1.selectedSort;
if (selectedSort == null) {
selectedSort = OrderBy.ORDER_BY_UNSPECIFIED;
}
return {
hasUnusualDmActivity: hasUnusualDmActivity2,
hasUnusualAccountActivity,
sourceInviteCode,
joinSourceType,
inviterId,
integrationType,
joinSourceApplicationId,
joinSourceChannelId,
...a0,
isCurrentGuildMemberByTimestamp: joinedAtTimestamp <= this.newMemberTimestamp,
isIncludedInSearchResults: false,
user,
sort: getSortValueForMember(a0, selectedSort),
joinedAtTimestamp,
...r3
};
}
_computeMemberSupplementals(a0, a1) {
let r16 = getMemberSupplementalByGuildId(this.guildId)[a0];
if (r16 == null) {
r16 = {};
}
let sourceInviteCode = r16.sourceInviteCode;
if (sourceInviteCode == null) {
sourceInviteCode = null;
}
let joinSourceType = r16.joinSourceType;
if (joinSourceType == null) {
joinSourceType = null;
}
let inviterId = r16.inviterId;
if (inviterId == null) {
inviterId = null;
}
let integrationType = r16.integrationType;
if (integrationType == null) {
integrationType = null;
}
let joinSourceApplicationId = r16.joinSourceApplicationId;
if (joinSourceApplicationId == null) {
joinSourceApplicationId = null;
}
let joinSourceChannelId = r16.joinSourceChannelId;
if (joinSourceChannelId == null) {
joinSourceChannelId = null;
}
return {
sourceInviteCode,
joinSourceType,
inviterId,
integrationType,
joinSourceApplicationId,
joinSourceChannelId,
hasUnusualDmActivity: a1 != null && new Date(a1).getTime() >= c3581_4 - UNUSUAL_DM_COMPARISON_DELTA,
hasUnusualAccountActivity: isSpammer(a0)
};
}
createMember(a0) {
return this._membersMap.set(a0.userId, a0);
}
updateMember(a0, a1) {
let r3;
if (a1 == null) {
return this._membersMap.set(a0.userId, a0);
}
const r12 = {
...a0
};
const r13 = {
...a1
};
const _computeMemberSupplementals2 = this._computeMemberSupplementals;
const userId = r12.userId;
let unusualDMActivityUntil = r13.unusualDMActivityUntil;
if (unusualDMActivityUntil == null) {
unusualDMActivityUntil = r12.unusualDMActivityUntil;
}
const r28 = _computeMemberSupplementals2.call(this, userId, unusualDMActivityUntil);
const { sourceInviteCode, hasUnusualDmActivity: hasUnusualDmActivity2, hasUnusualAccountActivity, joinSourceType, inviterId, integrationType, joinSourceApplicationId, joinSourceChannelId } = r28;
if (r12.sourceInviteCode !== sourceInviteCode) {
r13.sourceInviteCode = sourceInviteCode;
}
if (r12.hasUnusualDmActivity !== hasUnusualDmActivity2) {
r13.hasUnusualDmActivity = hasUnusualDmActivity2;
}
if (r12.hasUnusualAccountActivity !== hasUnusualAccountActivity) {
r13.hasUnusualAccountActivity = hasUnusualAccountActivity;
}
if (r12.joinSourceType !== joinSourceType) {
r13.joinSourceType = joinSourceType;
}
if (r12.joinSourceApplicationId !== joinSourceApplicationId) {
r13.joinSourceApplicationId = joinSourceApplicationId;
}
if (r12.joinSourceChannelId !== joinSourceChannelId) {
r13.joinSourceChannelId = joinSourceChannelId;
}
if (r12.inviterId !== inviterId) {
r13.inviterId = inviterId;
}
if (r12.integrationType !== integrationType) {
r13.integrationType = integrationType;
}
let r2 = false;
let r40 = false;
for (const key in r13) {
r3 = r2;
r40 = r3;
const r44 = r13[key];
const isEqual2 = isEqual(r44, r12[key]);
r2 = r3;
if (!isEqual2) {
r12[key] = r44;
r2 = true;
}
}
r3 = r2;
r40 = r3;
return this._membersMap.set(r12.userId, r12) || r40;
}
removeMember(a0) {
return this._membersMap.delete(a0);
}
getMemberByUserId(a0) {
return this._membersMap.get(a0);
}
values(a0) {
return this._membersMap.values(a0, true);
}
count(a0) {
return this._membersMap.size(a0);
}
get version() {
return this._membersMap.version;
}
}
@@ -0,0 +1,436 @@
// Metro module 5751 (f5752).
import _slicedToArray from "../../_bundle/_slicedToArray";
import GuildMemberStore from "../../stores/GuildMemberStore";
import UserStore from "../../stores/UserStore";
import Durations from "../../utils/Durations";
import { MemberSafetySecondaryIndex, GuildMemberSafetyMembers } from "./GuildMemberSafetyMembers";
import { GuildMemberSafetySearch, getDefaultSearchState } from "./GuildMemberSafetySearch";
import { GuildMemberSafetyPagination, getSearchChunkLimit, createDefaultMemberSafetyPaginationState } from "./GuildMemberSafetyPagination";
import { getJoinedAtTimestamp } from "./DateUtils";
import { cloneDeep } from "../../_bundle/Module12";
import { getSortValueForMember } from "./SortUtils";
let c3580_5 = 3 * Durations.Millis.SECOND;
export class GuildMemberSafetyPageStore {
constructor(a0) {
const r7 = {
__proto__: new.target.prototype,
lastRefreshTimestamp: 0,
lastCursorTimestamp: Date.now(),
_lastRefreshTimer: null
};
r7.guildId = a0;
r7._initialized = false;
r7._members = null;
r7._pagination = null;
r7._search = null;
return r7;
}
getSearchIndex() {
return this._search != null && !this._search.hasDefaultQuery ? MemberSafetySecondaryIndex.INCLUDED_IN_SEARCH_RESULTS : MemberSafetySecondaryIndex.CURRENT_GUILD_MEMBER;
}
initialize() {
if (this._initialized) {
this.lastCursorTimestamp = Date.now();
} else {
this._initialized = true;
this._search = new GuildMemberSafetySearch(this.guildId);
this._members = new GuildMemberSafetyMembers(this.guildId);
this._pagination = new GuildMemberSafetyPagination(this.guildId, this._members.values(this.getSearchIndex()));
}
}
get isInitialized() {
return this._initialized;
}
reset(r2 = false) {
if (this._initialized) {
const _members = this._members;
if (_members != null) {
_members.reset();
}
const _pagination = this._pagination;
if (_pagination != null) {
_pagination.reset();
}
const _search = this._search;
if (_search != null) {
_search.reset();
}
if (r2) {
this.initialize();
}
}
}
get searchChunkSize() {
return this._pagination != null ? this._initialized ? getSearchChunkLimit(this._pagination.getPaginationState()) : 0 : 0;
}
getMember(a0) {
const r1 = this._members != null;
let r6 = null;
if (r1) {
const _initialized = this._initialized;
r6 = null;
if (_initialized) {
let r9 = this._members.getMemberByUserId(a0);
if (r9 == null) {
r9 = null;
}
r6 = r9;
}
}
return r6;
}
getMembersByIndex(a0) {
return this._members != null && this._initialized ? [this._members.values(a0), this._members.version] : [[], 0];
}
countMembersByIndex(a0) {
return this._members != null ? this._initialized ? this._members.count(a0) : 0 : 0;
}
_checkUpdatesForPaginationUpdate(a0, a1) {
return a1.isIncludedInSearchResults != null && a1.isIncludedInSearchResults !== a0.isIncludedInSearchResults || a1.isCurrentGuildMemberByTimestamp != null && a1.isCurrentGuildMemberByTimestamp !== a0.isCurrentGuildMemberByTimestamp;
}
_getIsIncludedInSearch(a0, a1) {
if (this._search == null) {
return [false, false];
}
if (this._search.hasDefaultQuery) {
return [false, false];
}
const isMemberIncludedInSearchResults2 = this._search.isMemberIncludedInSearchResults({
...a0,
...a1
});
return [isMemberIncludedInSearchResults2, isMemberIncludedInSearchResults2 !== a0.isIncludedInSearchResults];
}
updatePaginationChunks() {
if (this._pagination != null && this._members != null && this._initialized) {
return this._pagination.updateSortedMembers(this._members.values(this.getSearchIndex()));
}
return false;
}
removeMember(a0) {
if (this._members != null && this._initialized) {
if (this._members.getMemberByUserId(a0) == null) {
return false;
}
return this._members.removeMember(a0) && this.updatePaginationChunks();
}
return false;
}
_rawUpdateMember(a0, a1) {
let r25;
if (this._members == null) {
return [false, false];
}
const memberByUserId = this._members.getMemberByUserId(a0);
const r4 = memberByUserId == null;
let r8 = memberByUserId;
let r1 = false;
if (r4) {
const trueMember = GuildMemberStore.getTrueMember(this.guildId, a0);
if (trueMember == null) {
return [false, false];
}
r8 = this._members.enhanceNewMember(trueMember, this.getSearchState(), a1);
r1 = true;
}
if (a1.isIncludedInSearchResults == null) {
const [isIncludedInSearchResults, r32] = this._getIsIncludedInSearch(r8, a1);
r25 = r1;
if (r32) {
a1.isIncludedInSearchResults = isIncludedInSearchResults;
r25 = true;
}
} else {
r25 = a1.isIncludedInSearchResults !== r8.isIncludedInSearchResults ? true : r1;
}
const r35 = this._members.updateMember(r8, a1);
if (!r25) {
r25 = this._checkUpdatesForPaginationUpdate(r8, a1);
}
return [r25, r35];
}
isMemberInIndex(a0) {
const r6 = this._members == null || !this._initialized;
return r6 ? !r6 : this._members._membersMap.has(a0);
}
isMemberIncludedInSearchResults(a0) {
let r6;
if (this._members != null && this._search != null && this._pagination != null && this._initialized) {
if (this._search.hasDefaultQuery) {
return this._pagination.isMemberInAnyChunk(a0);
}
const memberByUserId = this._members.getMemberByUserId(a0);
if (memberByUserId == null) {
const trueMember = GuildMemberStore.getTrueMember(this.guildId, a0);
if (trueMember == null) {
return false;
}
r6 = this._members.enhanceNewMember(trueMember, this.getSearchState());
} else {
const isIncludedInSearchResults = memberByUserId.isIncludedInSearchResults;
r6 = memberByUserId;
if (isIncludedInSearchResults) {
return true;
}
}
return this._search.isMemberIncludedInSearchResults(r6);
}
return false;
}
updateMember(a0, a1) {
if (this._members != null && this._initialized) {
let [r13, r14] = this._rawUpdateMember(a0, a1);
if (r13) {
r14 = this.updatePaginationChunks();
}
return r14;
}
return false;
}
updateClientMembers(a0, r13 = false, r11 = false) {
if (this._members != null && this._initialized) {
let r32 = false;
let r33 = false;
for (const item of a0) {
if (item.joinedAt != null) {
let r39 = item;
if (r13) {
r39 = {
...r39,
isIncludedInSearchResults: true
};
}
if (r11) {
r39 = {
...r39,
isCurrentGuildMemberByTimestamp: getJoinedAtTimestamp(item.joinedAt) <= this._members.newMemberTimestamp,
refreshTimestamp: this.lastRefreshTimestamp
};
}
const r63 = _slicedToArray(this._rawUpdateMember(item.userId, r39), 2);
r32 = r63[0] || r32;
r33 = r63[1] || r33;
}
}
if (r32) {
r33 = this.updatePaginationChunks();
}
return r33;
}
return false;
}
updateServerMembers(a0) {
if (this._members != null && this._initialized) {
let r30 = false;
let r31 = false;
for (const item of a0) {
const trueMember = GuildMemberStore.getTrueMember(this.guildId, item.user.id);
if (trueMember != null) {
const r48 = _slicedToArray(this._rawUpdateMember(item.user.id, trueMember), 2);
r30 = r48[0] || r30;
r31 = r48[1] || r31;
}
}
if (r30) {
r31 = this.updatePaginationChunks();
}
return r31;
}
return false;
}
updateMembersByMemberIds(a0) {
if (this._members != null && this._initialized) {
return this.updateClientMembers(a0.reduce((acc, item) => {
const trueMember = GuildMemberStore.getTrueMember(this.guildId, item);
if (trueMember != null) {
acc.push(trueMember);
}
return acc;
}, []));
}
return false;
}
updateMembersSort(c15089_0) {
return new Promise((resolve) => {
[...cloneDeep(this.getMembersByIndex(MemberSafetySecondaryIndex.CURRENT_GUILD_MEMBER)[0]), ...cloneDeep(this.getMembersByIndex(MemberSafetySecondaryIndex.NEW_GUILD_MEMBER)[0])].forEach((item) => {
const sortValueForMember = getSortValueForMember(item, c15089_0);
const _search = this._search;
let isIncludedInSearchResults = _search == null ? void 0 : _search.isMemberIncludedInSearchResults(item);
if (isIncludedInSearchResults == null) {
isIncludedInSearchResults = false;
}
const _members = this._members;
if (_members != null) {
_members.updateMember(item, {
sort: sortValueForMember,
isIncludedInSearchResults
});
}
});
resolve();
});
}
sortMembersBySelectedSort(a0) {
if (this._search != null && this._members != null && this._initialized && a0 != null) {
this.updatePaginationState({
sort: a0
}, true);
this.updateMembersSort(a0).then(() => {
this.updatePaginationChunks();
});
}
}
updateSearchedMembersByMemberIds(a0) {
if (this._search != null && this._members != null && this._initialized) {
return this.updateClientMembers(a0.reduce((acc, item) => {
const trueMember = GuildMemberStore.getTrueMember(this.guildId, item);
if (trueMember != null) {
acc.push(trueMember);
}
return acc;
}, []), this._search.requiresUsernameMatch, this.lastRefreshTimestamp !== 0);
}
return false;
}
rebuildAllMembers() {
if (this._members != null && this._initialized) {
return this.updateClientMembers(GuildMemberStore.getMembers(this.guildId));
}
return false;
}
_scheduleRefresh(a0) {
this.lastRefreshTimestamp = a0;
this.lastCursorTimestamp = Date.now();
if (this._lastRefreshTimer != null) {
clearTimeout(this._lastRefreshTimer);
}
this._lastRefreshTimer = setTimeout(() => {
this._lastRefreshTimer = null;
this.lastRefreshTimestamp = 0;
}, c3580_5);
}
refreshNewMembersAndSearchResults() {
if (this._search != null && this._members != null && this._initialized) {
const refreshTimestamp = Number(Date.now());
this._scheduleRefresh(refreshTimestamp);
const r44 = cloneDeep(this._members.values(MemberSafetySecondaryIndex.NEW_GUILD_MEMBER));
let r46 = false;
for (const item of r44) {
r46 = this._members.updateMember(item, {
isCurrentGuildMemberByTimestamp: true,
refreshTimestamp,
user: UserStore.getUser(item.userId)
}) || r46;
}
this._members.resetNewMemberTimestamp();
if (this.resetSearchState()) {
r46 = false;
}
const r68 = _slicedToArray(this.updatePaginationState({
currentPage: 1
}, false), 2);
r68[0];
if (r68[1]) {
r46 = false;
}
if (r46) {
this.updatePaginationChunks();
}
return true;
}
return false;
}
getNewMemberTimestamp() {
return this._members != null ? this._initialized ? this._members.newMemberTimestamp : 0 : 0;
}
updateSearchState(a0) {
if (this._members != null && this._search != null && this._initialized) {
const r31 = Boolean(this._search.hasDefaultQuery);
if (a0.selectedSort != null && a0.selectedSort !== this._search.getSearchState().selectedSort) {
this.sortMembersBySelectedSort(a0.selectedSort);
}
let r42 = this._search.updateSearchState(a0);
if (this._search.hasDefaultQuery && r31) {
return this.updatePaginationChunks();
}
const r57 = cloneDeep(this._members.values(MemberSafetySecondaryIndex.CURRENT_GUILD_MEMBER));
let r60 = r31 !== this._search.hasDefaultQuery;
for (const item of r57) {
if (item.isCurrentGuildMemberByTimestamp) {
const _search = this._search;
const isMemberIncludedInSearchResults2 = _search.isMemberIncludedInSearchResults(item);
if (isMemberIncludedInSearchResults2 !== item.isIncludedInSearchResults) {
r60 = true;
r42 = true;
this._members.updateMember(item, {
isIncludedInSearchResults: isMemberIncludedInSearchResults2
});
}
}
}
if (r60) {
this.updatePaginationChunks();
this.updatePaginationState({
currentPage: 1
});
r42 = true;
}
return r42;
}
return false;
}
getSearchState() {
return this._search != null && this._initialized ? this._search.getSearchState() : getDefaultSearchState();
}
hasDefaultSearchState() {
return this._search == null || !this._initialized || this._search.hasDefaultQuery;
}
resetSearchState() {
const r6 = this._search == null || !this._initialized;
return r6 ? !r6 : !!this._search.resetSearchState() && this.updatePaginationChunks();
}
getTotalResultsCount() {
return this._search != null ? this._pagination != null ? this._initialized ? this._search.hasDefaultQuery && this._defaultSearchTotalResultsCount != null ? this._defaultSearchTotalResultsCount : this._pagination.getPaginationState().totalResultsCount : 0 : 0 : 0;
}
updatePaginationState(a0, r5 = true) {
let r11;
if (this._search != null && (this._pagination != null && this._initialized)) {
if (r5) {
this.lastRefreshTimestamp = 0;
}
if (this._search.hasDefaultQuery && a0.totalResultsCount != null) {
this._defaultSearchTotalResultsCount = a0.totalResultsCount;
}
r11 = this._pagination.updatePaginationState(a0);
} else {
r11 = [false, false];
}
return r11;
}
clearPaginationState() {
const _pagination = this._pagination;
if (_pagination != null) {
_pagination.reset();
}
}
getPaginationState() {
return this._pagination != null && this._initialized ? this._pagination.getPaginationState() : createDefaultMemberSafetyPaginationState();
}
getPaginatedMembers() {
return this._pagination != null && this._initialized ? [this._pagination.paginatedMembers, this._pagination.version] : [{}, 0];
}
updatePaginationToken(a0) {
const r6 = this._pagination == null || !this._initialized;
return r6 ? !r6 : this._pagination.updatePaginationToken(a0);
}
getElasticSearchPagination() {
return this._pagination != null ? this._initialized ? this._pagination.getElasticSearchPagination() : null : null;
}
removeRoleFromSearchState(a0) {
const set = new Set(this.getSearchState().selectedRoleIds);
set.delete(a0);
return this.updateSearchState({
selectedRoleIds: set
});
}
}
@@ -0,0 +1,201 @@
// Metro module 5777 (f5778).
import GuildMemberStore from "../../stores/GuildMemberStore";
import { OrderBy } from "./MemberSafetyElasticSearchQueryTypes";
let c3593_4 = [12, 25, 50, 100];
const r18 = {
FORWARD: 1,
1: "FORWARD",
BACKWARD: -1
};
r18[-1] = "BACKWARD";
let c3593_5 = r18;
export { c3593_4 as PAGINATION_PAGE_SIZE_OPTIONS };
export const MAX_VISIBLE_PAGES = 7;
export const MAX_FORWARD_PAGE_SKIP = 5;
export const DEFAULT_SEARCH_CHUNK_LIMIT = 250;
export function createDefaultMemberSafetyPaginationState() {
return {
pageSize: c3593_4[0],
currentPage: 1,
continuationToken: null,
sort: OrderBy.ORDER_BY_UNSPECIFIED,
elasticSearchCursor: null
};
}
export function getSearchChunkLimit(a0) {
return Math.max(5 * a0.pageSize, 250);
}
export class GuildMemberSafetyPagination {
_reduceMemberIdsToPaginationChunks = (a0, a1, a2) => {
const r13 = Math.floor(a2 / this._paginationState.pageSize) + 1;
if (a0[r13] == null) {
a0[r13] = [];
}
a0[r13].push(a1);
return a0;
};
constructor(a0, a1) {
this.guildId = a0;
this._paginationState = {
pageSize: c3593_4[0],
currentPage: 1,
continuationToken: null,
sort: OrderBy.ORDER_BY_UNSPECIFIED,
elasticSearchCursor: null
};
this._version = 0;
const [_sortedMemberIds, _cachedPaginationChunks] = this._initPaginationFromRawMembers(a1);
this._sortedMemberIds = _sortedMemberIds;
this._cachedPaginationChunks = _cachedPaginationChunks;
this._version = this._version + 1;
}
reset() {
this._paginationState = {
pageSize: c3593_4[0],
currentPage: 1,
continuationToken: null,
sort: OrderBy.ORDER_BY_UNSPECIFIED,
elasticSearchCursor: null
};
this._sortedMemberIds = [];
this._cachedPaginationChunks = {};
this._version = this._version + 1;
}
isMemberOnCurrentPage(a0) {
let r3 = this._cachedPaginationChunks[this._paginationState.currentPage];
if (r3 == null) {
r3 = [];
}
return r3.includes(a0);
}
isMemberInAnyChunk(a0) {
return this._sortedMemberIds.includes(a0);
}
_initPaginationFromRawMembers(a0) {
const r2 = [];
let c15142_0 = r2;
return [r2, a0.reduce((acc, item, index) => {
const r7 = this._reduceMemberIdsToPaginationChunks(acc, item.userId, index);
c15142_0.push(item.userId);
return r7;
}, {})];
}
_buildPaginationFromMemberIds(a0) {
return a0.reduce(this._reduceMemberIdsToPaginationChunks, {});
}
_rebuildPaginationChunksFromStoredMembers() {
this._cachedPaginationChunks = this._buildPaginationFromMemberIds(this._sortedMemberIds);
this._version = this._version + 1;
return true;
}
getPaginationState() {
return this._paginationState;
}
updatePaginationToken(a0) {
let r0 = a0 !== this._paginationState.continuationToken;
if (r0) {
this._paginationState = {
...this._paginationState,
continuationToken: a0
};
r0 = true;
}
return r0;
}
_calculateNewPageFromPageSizeChange(a0, a1) {
const _paginationState = this._paginationState;
const { currentPage, pageSize } = _paginationState;
const r1 = a0 * pageSize <= this._sortedMemberIds.length;
let r14 = 1;
if (r1) {
let r8 = a1;
const r5 = Math;
const r7 = Math;
const r17 = pageSize / a0;
if (a1 == null) {
r8 = currentPage;
}
r14 = r5.max(r7.ceil(r17 * r8), 1);
}
return r14;
}
updatePaginationState(a0) {
const r0 = a0.pageSize != null && a0.pageSize !== this._paginationState.pageSize;
let r1 = false;
if (r0) {
const _calculateNewPageFromPageSizeChange2 = this._calculateNewPageFromPageSizeChange;
let pageSize = a0.pageSize;
if (pageSize == null) {
pageSize = this._paginationState.pageSize;
}
a0.currentPage = _calculateNewPageFromPageSizeChange2.call(this, pageSize, a0.currentPage);
r1 = true;
}
this._paginationState = {
...this._paginationState,
...a0
};
if (r1) {
this._rebuildPaginationChunksFromStoredMembers();
}
return [true, r1];
}
updateSortedMembers(a0) {
const [_sortedMemberIds, _cachedPaginationChunks] = this._initPaginationFromRawMembers(a0);
this._sortedMemberIds = _sortedMemberIds;
this._cachedPaginationChunks = _cachedPaginationChunks;
this._version = this._version + 1;
return true;
}
updateSortedMembersByUserIds(a0) {
this._sortedMemberIds = a0;
this._rebuildPaginationChunksFromStoredMembers();
return true;
}
_findMember(a0, r8 = c3593_5.BACKWARD) {
let length2;
(a0 < this._sortedMemberIds.length ? this._sortedMemberIds.length - 1 : a0) < 0;
const member = GuildMemberStore.getMember(this.guildId, this._sortedMemberIds[a0]);
let r23 = member;
if (member == null) {
let r24 = a0 + r8;
r23 = member;
if (!(r24 < 0)) {
const length = this._sortedMemberIds.length;
r23 = member;
if (!(r24 >= length)) {
do {
let r31 = GuildMemberStore.getMember(this.guildId, this._sortedMemberIds[r24]);
const r3 = r31 == null;
const r32 = r24;
if ((r3 ? void 0 : r31.joinedAt) == null) {
r31 = null;
}
r23 = r31;
if (r31 != null) {
break;
}
const r34 = r32 + r8;
r23 = r31;
if (r34 < 0) {
break;
}
length2 = this._sortedMemberIds.length;
r23 = r31;
r24 = r34;
} while (!(r24 >= length2));
}
}
}
return r23;
}
getElasticSearchPagination() {
return this.getPaginationState().elasticSearchCursor;
}
get paginatedMembers() {
return this._cachedPaginationChunks;
}
get version() {
return this._version;
}
}
@@ -0,0 +1,249 @@
// Metro module 5775 (f5776).
import _slicedToArray from "../../_bundle/_slicedToArray";
import { splitQuery } from "./GuildMemberSafetySearchUtils";
import isEqual from "../../_bundle/isEqual_4349";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import { isMemberCommunicationDisabled } from "../guild_communication_disabled/CommunicationDisabledUtils";
import { hasAutomodQuarantinedProfile } from "../guild_automod/AutomodPermissionUtils";
let c3591_4;
const hasStringMatch = function hasStringMatch(a0, a1) {
return a0 != null && !!a0.toLowerCase().includes(a1.toLowerCase());
};
c3591_4 = Object.freeze({
query: "",
requireUnusualDmActivity: false,
requireCommunicationDisabled: false,
requireUnusualAccountActivity: false,
requireUsernameQuarantined: false,
selectedRoleIds: new Set(),
selectedJoinDateOption: {
optionId: 0,
afterDate: null,
beforeDate: null
},
selectedAccountAgeOption: {
optionId: 0,
afterDate: null,
beforeDate: null
},
selectedJoinSourceType: void 0,
selectedSourceInviteCode: void 0,
selectedSort: void 0
});
export function getDefaultSearchState() {
return {
query: "",
requireUnusualDmActivity: false,
requireCommunicationDisabled: false,
requireUnusualAccountActivity: false,
requireUsernameQuarantined: false,
selectedRoleIds: new Set(),
selectedJoinDateOption: {
optionId: 0,
afterDate: null,
beforeDate: null
},
selectedAccountAgeOption: {
optionId: 0,
afterDate: null,
beforeDate: null
},
selectedJoinSourceType: void 0,
selectedSourceInviteCode: void 0,
selectedSort: void 0
};
}
export class GuildMemberSafetySearch {
constructor(a0) {
this.guildId = a0;
this._searchState = {
query: "",
requireUnusualDmActivity: false,
requireCommunicationDisabled: false,
requireUnusualAccountActivity: false,
requireUsernameQuarantined: false,
selectedRoleIds: new Set(),
selectedJoinDateOption: {
optionId: 0,
afterDate: null,
beforeDate: null
},
selectedAccountAgeOption: {
optionId: 0,
afterDate: null,
beforeDate: null
},
selectedJoinSourceType: void 0,
selectedSourceInviteCode: void 0,
selectedSort: void 0
};
this.hasDefaultQuery = true;
}
get requiresUsernameMatch() {
return this._searchState.query.trim().length > 0;
}
reset() {
this._searchState = {
query: "",
requireUnusualDmActivity: false,
requireCommunicationDisabled: false,
requireUnusualAccountActivity: false,
requireUsernameQuarantined: false,
selectedRoleIds: new Set(),
selectedJoinDateOption: {
optionId: 0,
afterDate: null,
beforeDate: null
},
selectedAccountAgeOption: {
optionId: 0,
afterDate: null,
beforeDate: null
},
selectedJoinSourceType: void 0,
selectedSourceInviteCode: void 0,
selectedSort: void 0
};
this.hasDefaultQuery = true;
}
updateSearchState(a0) {
this._searchState = {
...this._searchState,
...a0
};
this.hasDefaultQuery = isEqual(this._searchState, c3591_4);
return true;
}
resetSearchState() {
const hasDefaultQuery = this.hasDefaultQuery;
let r0 = !hasDefaultQuery;
if (!hasDefaultQuery) {
this._searchState = {
query: "",
requireUnusualDmActivity: false,
requireCommunicationDisabled: false,
requireUnusualAccountActivity: false,
requireUsernameQuarantined: false,
selectedRoleIds: new Set(),
selectedJoinDateOption: {
optionId: 0,
afterDate: null,
beforeDate: null
},
selectedAccountAgeOption: {
optionId: 0,
afterDate: null,
beforeDate: null
},
selectedJoinSourceType: void 0,
selectedSourceInviteCode: void 0,
selectedSort: void 0
};
this.hasDefaultQuery = true;
r0 = true;
}
return r0;
}
getSearchState() {
return this._searchState;
}
isMemberIncludedInSearchResults(a0) {
const _searchState = this._searchState;
const { query, requireUnusualDmActivity, requireCommunicationDisabled, requireUnusualAccountActivity, requireUsernameQuarantined, selectedRoleIds, selectedJoinDateOption, selectedAccountAgeOption, selectedSourceInviteCode, selectedJoinSourceType } = _searchState;
const r10 = query.length > 0 && !(function hasMatchingNickname(a0, a1) {
if (a1.trim() === "") {
return false;
}
const r34 = _slicedToArray(splitQuery(a1), 2);
const r6 = r34[0];
for (const item of r34[1]) {
if (a0.userId !== item) {
continue;
}
return true;
}
for (const item2 of r6) {
if (!hasStringMatch(a0.nick, item2)) {
continue;
}
return true;
}
if (a0.user == null) {
return false;
}
const user = a0.user;
const { globalName, username } = user;
for (const item3 of r6) {
if (!hasStringMatch(username, item3)) {
continue;
}
return true;
}
for (const item4 of r6) {
if (!hasStringMatch(globalName, item4)) {
continue;
}
return true;
}
return false;
})(a0, query);
let r33 = !r10;
if (!r10) {
let r9 = selectedRoleIds.size > 0;
if (r9) {
let c15139_0 = a0;
r9 = !(selectedRoleIds.size !== 0 && Array.from(selectedRoleIds).every((item) => c15139_0.roles.includes(item)));
}
let r42 = !r9;
if (!r9) {
const r8 = selectedJoinDateOption.afterDate != null && a0.joinedAtTimestamp < selectedJoinDateOption.afterDate;
let r46 = !r8;
if (!r8) {
const r5 = selectedJoinDateOption.beforeDate != null && a0.joinedAtTimestamp > selectedJoinDateOption.beforeDate;
let r50 = !r5;
if (!r5) {
const r4 = selectedAccountAgeOption.afterDate != null && SnowflakeUtils.extractTimestamp(a0.userId) < selectedAccountAgeOption.afterDate;
let r61 = !r4;
if (!r4) {
const r1 = selectedAccountAgeOption.beforeDate != null && SnowflakeUtils.extractTimestamp(a0.userId) > selectedAccountAgeOption.beforeDate;
let r72 = !r1;
if (!r1) {
let r73 = selectedSourceInviteCode == null || a0.sourceInviteCode === selectedSourceInviteCode;
if (r73) {
let r75 = selectedJoinSourceType == null || a0.joinSourceType === selectedJoinSourceType;
if (r75) {
const r77 = requireUnusualDmActivity || requireCommunicationDisabled || requireUnusualAccountActivity || requireUsernameQuarantined;
let r13 = !r77;
if (r77) {
const r3 = requireUnusualDmActivity ? !a0.hasUnusualDmActivity : !requireUnusualDmActivity;
let r12 = !r3;
if (r3) {
const r7 = requireCommunicationDisabled ? !isMemberCommunicationDisabled(a0) : !requireCommunicationDisabled;
let r86 = !r7;
if (r7) {
const r6 = requireUnusualAccountActivity ? !a0.hasUnusualAccountActivity : !requireUnusualAccountActivity;
r86 = r6 ? !(requireUsernameQuarantined ? !hasAutomodQuarantinedProfile(a0) : !requireUsernameQuarantined) : !r6;
}
r12 = r86;
}
r13 = r12;
}
r75 = r13;
}
r73 = r75;
}
r72 = r73;
}
r61 = r72;
}
r50 = r61;
}
r46 = r50;
}
r42 = r46;
}
r33 = r42;
}
return r33;
}
}
@@ -0,0 +1,18 @@
// Metro module 5776 (f5777).
import { isSnowflake } from "../application_commands/ApplicationCommandUtils";
export function splitQuery(a0) {
let c15140_0, c15140_1;
const r5 = a0.split(",").map((item) => item.trim());
const r9 = [];
c15140_0 = r9;
const r10 = [];
c15140_1 = r10;
r5.forEach((item) => {
if (isSnowflake(item)) {
c15140_0.push(item);
} else {
c15140_1.push(item);
}
});
return [r10, r9];
}
@@ -0,0 +1,5 @@
// Metro module 3821 (f3822).
import { Permissions } from "../../Constants";
import { combine } from "../../_bundle/HighLow";
const r28 = combine(Permissions.ADMINISTRATOR, Permissions.MANAGE_GUILD, Permissions.BAN_MEMBERS, Permissions.KICK_MEMBERS, Permissions.MODERATE_MEMBERS, Permissions.MANAGE_ROLES, Permissions.MANAGE_NICKNAMES);
export { r28 as MemberSafetyPagePermissions };
@@ -0,0 +1,23 @@
// Metro module 5753 (f5754).
import Durations from "../../utils/Durations";
const r2 = 2 * Durations.Millis.DAY;
const r17 = {
ORDER_BY_UNSPECIFIED: 0,
0: "ORDER_BY_UNSPECIFIED",
ORDER_BY_GUILD_JOINED_AT_DESC: 1,
1: "ORDER_BY_GUILD_JOINED_AT_DESC",
ORDER_BY_GUILD_JOINED_AT_ASC: 2,
2: "ORDER_BY_GUILD_JOINED_AT_ASC",
ORDER_BY_USER_ID_DESC: 3,
3: "ORDER_BY_USER_ID_DESC",
ORDER_BY_USER_ID_ASC: 4,
4: "ORDER_BY_USER_ID_ASC"
};
export { r2 as UNUSUAL_DM_COMPARISON_DELTA };
export function createMemberSearchCursor({ joinedAt, userId }) {
return joinedAt != null ? {
guild_joined_at: new Date(joinedAt).getTime(),
user_id: userId
} : null;
}
export { r17 as OrderBy };
@@ -0,0 +1,15 @@
// Metro module 15440 (f15441).
import { GuildJoinRequestApplicationStatuses } from "../guild_member_verification/MemberVerificationTypes";
const SUBMITTED = GuildJoinRequestApplicationStatuses.SUBMITTED;
const r10 = {
ALL_MEMBERS: "ALL_MEMBERS",
PENDING: SUBMITTED
};
r10[SUBMITTED] = "PENDING";
const REJECTED = GuildJoinRequestApplicationStatuses.REJECTED;
r10.REJECTED = REJECTED;
r10[REJECTED] = "REJECTED";
const APPROVED = GuildJoinRequestApplicationStatuses.APPROVED;
r10.APPROVED = APPROVED;
r10[APPROVED] = "APPROVED";
export { r10 as MemberSafetyPageTab };
@@ -0,0 +1,90 @@
// Metro module 6062 (f6063).
import { isGuildOwner } from "../../records/GuildRecord";
import GuildStore from "../../stores/GuildStore";
import PermissionStore from "../../stores/PermissionStore";
import UserStore from "../../stores/UserStore";
import { MemberSafetyPagePermissions } from "./MemberSafetyConstants";
import { GuildFeatures, Permissions } from "../../Constants";
import { combine } from "../../_bundle/HighLow";
import { useStateFromStores } from "../../_bundle/Module589";
function $mk77680($env) {
return () => {
const r2 = $env.$parent;
const r5 = $env[0];
const r9 = (0, r2[3])([r2[5], r2[7]], 2);
const r10 = r9[0];
const r11 = r9[1];
r10.getGuild(r5);
r11.getCurrentUser();
return false;
};
}
let env3844 = {};
export function getContextForPermission(a0, r3 = [UserStore, MemberSafetyPagePermissions]) {
const [r10, r11] = r3;
r10.getGuild(a0);
r11.getCurrentUser();
}
export function canAccessMemberSafetyPage(a0, r3 = [GuildStore, UserStore]) {
if (r3 === void 0) {
r3 = [UserStore, MemberSafetyPagePermissions];
}
const [r13, r14] = r3;
r13.getGuild(a0);
r14.getCurrentUser();
return false;
}
export function hasBulkBanningPermissions(a0, r3 = [GuildStore, UserStore]) {
if (r3 === void 0) {
r3 = [UserStore, MemberSafetyPagePermissions];
}
const [r13, r14] = r3;
r13.getGuild(a0);
r14.getCurrentUser();
return false;
}
export function canPruneGuildMembers(a0, a1, r6 = PermissionStore) {
return a0.features.has(GuildFeatures.PRUNE_REQUIRES_ADMIN) ? (0, isGuildOwner)(a0, a1) || r6.can(Permissions.ADMINISTRATOR, a0) : r6.can.call(r6, combine(Permissions.MANAGE_GUILD, Permissions.KICK_MEMBERS), a0);
}
export function useCanAccessMemberSafetyPage(a0) {
let env15431;
const r1 = env15431 = {
$parent: env3844
};
env15431[0] = a0;
return useStateFromStores([GuildStore, UserStore], $mk77680(r1), [a0]);
}
export function useCanAccessBulkBanningFeature(a0) {
let env15433;
const r1 = env15433 = {
$parent: env3844
};
env15433[0] = a0;
let r15 = useStateFromStores([GuildStore, UserStore], $mk77680(r1), [a0]);
const stateFromStores = useStateFromStores([GuildStore, UserStore], () => {
const [r10, r11] = [GuildStore, UserStore];
r10.getGuild(a0);
r11.getCurrentUser();
return false;
}, [a0]);
if (r15) {
r15 = stateFromStores;
}
return r15;
}
export function useCanAccessInviteCodeFeature(a0) {
return useStateFromStores([GuildStore, PermissionStore], () => {
const guild = GuildStore.getGuild(a0);
return guild != null && PermissionStore.can(Permissions.MANAGE_GUILD, guild);
}, [a0]);
}
export function useCanBulkBanUser(a0, a1, a2) {
return useStateFromStores([PermissionStore, GuildStore], () => {
const guild = GuildStore.getGuild(a0);
return guild != null && (a1 && PermissionStore.canManageUser(Permissions.BAN_MEMBERS, a2, guild));
}, [a1, a0, a2]);
}
export function canBulkBanUser(a0, a1, a2) {
const guild = GuildStore.getGuild(a0);
return guild != null && (a1 ? PermissionStore.canManageUser(Permissions.BAN_MEMBERS, a2, guild) : a1);
}
@@ -0,0 +1,460 @@
// Metro module 5750 (f5751).
import _slicedToArray from "../../_bundle/_slicedToArray";
import AuthenticationStore from "../../stores/AuthenticationStore";
import GuildMemberStore from "../../stores/GuildMemberStore";
import GuildStore from "../../stores/GuildStore";
import UserStore from "../../stores/UserStore";
import { GuildMemberSafetyPageStore } from "./GuildMemberSafetyPageStore";
import { EMPTY_STRING_SNOWFLAKE_ID } from "../../Constants";
import { isNotNullish } from "../../utils/GlobalUtils";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import { syncMemberSupplemental } from "./MemberSafetyStoreSupplemental";
import { registerFetchedSupplementals } from "./MemberSafetySupplementalUtils";
import { createMemberSearchCursor } from "./MemberSafetyElasticSearchQueryTypes";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c3579_10, c3579_11;
const getMemberSafetyPageStore = function getMemberSafetyPageStore(guildId) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
return c3579_11[guildId];
};
const handleGuildMemberUpdate = function handleGuildMemberUpdate() {
return false;
};
const handleGuildRoleUpdateOrDelete = function handleGuildRoleUpdateOrDelete(a0) {
const guildId = a0.guildId;
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
const r12 = c3579_11[guildId];
const r15 = a0.type === "GUILD_ROLE_DELETE" ? r12.removeRoleFromSearchState(a0.roleId) : false;
return r12.rebuildAllMembers() || r15;
};
const handleGuildRoleMemberUpdate = function handleGuildRoleMemberUpdate({ guildId, userId }) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
return c3579_11[guildId].updateMembersByMemberIds([userId]);
};
c3579_10 = false;
c3579_11 = {};
class MemberSafetyStore extends Module589.Store {
static displayName = "MemberSafetyStore";
initialize() {
this.waitFor(AuthenticationStore, GuildMemberStore, GuildStore, UserStore);
}
isInitialized(a0) {
if (c3579_11[a0] == null) {
c3579_11[a0] = new GuildMemberSafetyPageStore(a0);
}
return c3579_11[a0].isInitialized;
}
getMembersByGuildId(a0, a1) {
if (c3579_11[a0] == null) {
c3579_11[a0] = new GuildMemberSafetyPageStore(a0);
}
return c3579_11[a0].getMembersByIndex(a1);
}
getMembersCountByGuildId(a0, a1) {
if (c3579_11[a0] == null) {
c3579_11[a0] = new GuildMemberSafetyPageStore(a0);
}
return c3579_11[a0].countMembersByIndex(a1);
}
getEstimatedMemberSearchCountByGuildId(a0) {
if (c3579_11[a0] == null) {
c3579_11[a0] = new GuildMemberSafetyPageStore(a0);
}
const r11 = c3579_11[a0];
const searchChunkSize = r11.searchChunkSize;
const r16 = r11.countMembersByIndex(r11.getSearchIndex());
let r18 = r11.getTotalResultsCount();
if (!(r18 != null && !(r18 < searchChunkSize))) {
r18 = r16;
}
return r18;
}
getKnownMemberSearchCountByGuildId(a0) {
if (c3579_11[a0] == null) {
c3579_11[a0] = new GuildMemberSafetyPageStore(a0);
}
const r11 = c3579_11[a0];
return r11.countMembersByIndex(r11.getSearchIndex());
}
getCurrentMemberSearchResultsByGuildId(a0) {
if (c3579_11[a0] == null) {
c3579_11[a0] = new GuildMemberSafetyPageStore(a0);
}
const r11 = c3579_11[a0];
return r11.getMembersByIndex(r11.getSearchIndex());
}
getSearchStateByGuildId(a0) {
if (c3579_11[a0] == null) {
c3579_11[a0] = new GuildMemberSafetyPageStore(a0);
}
return c3579_11[a0].getSearchState();
}
hasDefaultSearchStateByGuildId(a0) {
if (c3579_11[a0] == null) {
c3579_11[a0] = new GuildMemberSafetyPageStore(a0);
}
return c3579_11[a0].hasDefaultSearchState();
}
getPagedMembersByGuildId(a0) {
if (c3579_11[a0] == null) {
c3579_11[a0] = new GuildMemberSafetyPageStore(a0);
}
return c3579_11[a0].getPaginatedMembers();
}
getPaginationStateByGuildId(a0) {
if (c3579_11[a0] == null) {
c3579_11[a0] = new GuildMemberSafetyPageStore(a0);
}
return c3579_11[a0].getPaginationState();
}
getElasticSearchPaginationByGuildId(a0) {
if (c3579_11[a0] == null) {
c3579_11[a0] = new GuildMemberSafetyPageStore(a0);
}
return c3579_11[a0].getElasticSearchPagination();
}
getEnhancedMember(a0, a1) {
if (c3579_11[a0] == null) {
c3579_11[a0] = new GuildMemberSafetyPageStore(a0);
}
return c3579_11[a0].getMember(a1);
}
getNewMemberTimestamp(a0) {
if (c3579_11[a0] == null) {
c3579_11[a0] = new GuildMemberSafetyPageStore(a0);
}
return c3579_11[a0].getNewMemberTimestamp();
}
getLastRefreshTimestamp(a0) {
if (c3579_11[a0] == null) {
c3579_11[a0] = new GuildMemberSafetyPageStore(a0);
}
return c3579_11[a0].lastRefreshTimestamp;
}
getLastCursorTimestamp(a0) {
if (c3579_11[a0] == null) {
c3579_11[a0] = new GuildMemberSafetyPageStore(a0);
}
return c3579_11[a0].lastCursorTimestamp;
}
}
const memberSafetyStore = new MemberSafetyStore(Dispatcher, {
CONNECTION_OPEN: function handleConnectionOpen(a0) {
if (c3579_10) {
c3579_10 = false;
} else {
for (const key in c3579_11) {
if (c3579_11[key] == null) {
c3579_11[key] = new GuildMemberSafetyPageStore(key);
}
c3579_11[key].reset(true);
}
}
let c15085_0 = false;
a0.guilds.forEach(({ id, members }) => {
if (c3579_11[id] == null) {
c3579_11[id] = new GuildMemberSafetyPageStore(id);
}
c15085_0 = c3579_11[id].updateServerMembers(members) || c15085_0;
});
return c15085_0;
},
CONNECTION_OPEN_SUPPLEMENTAL: function handleConnectionOpenSupplemental(a0) {
let c15086_0 = false;
a0.guilds.forEach(({ id, activity_instances }) => {
if (c3579_11[id] == null) {
c3579_11[id] = new GuildMemberSafetyPageStore(id);
}
const r15 = c3579_11[id];
const r16 = [];
let c29608_0 = r16;
if (activity_instances != null) {
activity_instances.forEach(({ participants }) => {
if (participants != null) {
participants.forEach((participant) => {
if (isNotNullish(participant.member)) {
c29608_0.push(participant.member);
}
});
}
});
}
c15086_0 = r15.updateServerMembers(r16) || c15086_0;
});
return c15086_0;
},
LOCAL_MESSAGES_LOADED: function handleLocalMessagesLoaded({ guildId, members }) {
if (guildId != null && GuildStore.getGuild(guildId) != null) {
c3579_10 = true;
const memberSafetyPageStore = getMemberSafetyPageStore(guildId);
const r27 = [];
for (const item of members) {
if (memberSafetyPageStore.getMember(item.userId) == null) {
r27.push(item);
}
}
return r27.length > 0 && memberSafetyPageStore.updateClientMembers(r27);
}
return false;
},
CACHE_LOADED: function handleCacheLoaded({ guildMembers }) {
let c15087_0 = false;
c3579_10 = true;
SnowflakeUtils.entries(guildMembers).forEach((item) => {
const [r23, r8] = item;
if (c3579_11[r23] == null) {
c3579_11[r23] = new GuildMemberSafetyPageStore(r23);
}
c15087_0 = c3579_11[r23].updateClientMembers(Object.values(r8)) || c15087_0;
});
return c15087_0;
},
PASSIVE_UPDATE_V2: function handlePassiveUpdateV2({ members, guildId }) {
let r11 = members.length > 0;
if (r11) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
r11 = c3579_11[guildId].updateServerMembers(members);
}
return r11;
},
GUILD_CREATE: function handleGuildCreate({ guild }) {
const id = guild.id;
if (c3579_11[id] == null) {
c3579_11[id] = new GuildMemberSafetyPageStore(id);
}
const r15 = c3579_11[id];
const id2 = guild.id;
let isInitialized2 = r15.isInitialized;
if (isInitialized2 === void 0) {
isInitialized2 = false;
}
if (c3579_11[id2] == null) {
c3579_11[id2] = new GuildMemberSafetyPageStore(id2);
}
c3579_11[id2].reset(isInitialized2);
},
GUILD_DELETE: function handleGuildDelete(a0) {
const id = a0.guild.id;
if (c3579_11[id] == null) {
c3579_11[id] = new GuildMemberSafetyPageStore(id);
}
c3579_11[id].reset(false);
},
GUILD_MEMBERS_CHUNK_BATCH: function handleGuildMembersChunkBatch({ chunks }) {
let r0 = false;
for (const item of chunks) {
r0 = getMemberSafetyPageStore(item.guildId).updateServerMembers(item.members) || r0;
}
return r0;
},
GUILD_MEMBER_ADD: handleGuildMemberUpdate,
GUILD_MEMBER_UPDATE: handleGuildMemberUpdate,
GUILD_MEMBER_UPDATE_LOCAL: function handleGuildMemberUpdateLocal({ guildId }) {
const id = AuthenticationStore.getId();
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
return c3579_11[guildId].updateMembersByMemberIds([id]);
},
GUILD_MEMBER_REMOVE: function handleGuildMemberRemove({ guildId, user }) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
return c3579_11[guildId].removeMember(user.id);
},
GUILD_ROLE_UPDATE: handleGuildRoleUpdateOrDelete,
GUILD_ROLE_DELETE: handleGuildRoleUpdateOrDelete,
GUILD_MEMBER_PROFILE_UPDATE: function handleGuildMemberProfileUpdate({ guildId, guildMember }) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
return c3579_11[guildId].updateMembersByMemberIds([guildMember.user.id]);
},
GUILD_ROLE_MEMBER_REMOVE: handleGuildRoleMemberUpdate,
GUILD_ROLE_MEMBER_ADD: handleGuildRoleMemberUpdate,
THREAD_MEMBER_LIST_UPDATE: function handleThreadMemberListUpdate({ guildId, members }) {
if (members != null && members.length !== 0) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
return c3579_11[guildId].updateMembersByMemberIds(members.reduce((acc, member) => {
if (member.member != null) {
acc.push(member.member.user.id);
}
return acc;
}, []));
}
return false;
},
THREAD_MEMBERS_UPDATE: function handleThreadMembersUpdate({ guildId, addedMembers }) {
if (addedMembers != null && addedMembers.length !== 0) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
return c3579_11[guildId].updateMembersByMemberIds(addedMembers.reduce((acc, addedMember) => {
acc.push(addedMember.userId);
return acc;
}, []));
}
return false;
},
LOAD_ARCHIVED_THREADS_SUCCESS: function handleLoadArchivedThreadsSuccess({ guildId, members }) {
if (members != null && members.length !== 0) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
return c3579_11[guildId].updateMembersByMemberIds(members.reduce((acc, member) => {
acc.push(member.userId);
return acc;
}, []));
}
return false;
},
LOAD_FORUM_POSTS: function handleLoadForumPosts(a0) {
const guildId = a0.guildId;
const r6 = Object.values(a0.threads);
if (r6.length === 0) {
return false;
}
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
return c3579_11[guildId].updateMembersByMemberIds(r6.reduce((acc, item) => {
if (item.owner != null) {
acc.push(item.owner.user.id);
}
return acc;
}, []));
},
INITIALIZE_MEMBER_SAFETY_STORE: function handleInitializeMemberSafetyStore({ guildId }) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
return c3579_11[guildId].initialize();
},
MEMBER_SAFETY_NEW_MEMBER_TIMESTAMP_REFRESH: function handleNewMemberTimestampRefresh({ guildId }) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
return c3579_11[guildId].refreshNewMembersAndSearchResults();
},
MEMBER_SAFETY_PAGINATION_UPDATE: function handlePaginationUpdate({ guildId, pagination }) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
return _slicedToArray(c3579_11[guildId].updatePaginationState(pagination), 1)[0];
},
MEMBER_SAFETY_PAGINATION_TOKEN_UPDATE: function handlePaginationTokenUpdate({ guildId, continuationToken }) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
return c3579_11[guildId].updatePaginationToken(continuationToken);
},
MEMBER_SAFETY_SEARCH_STATE_UPDATE: function handleSearchStateUpdate({ guildId, searchState }) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
return c3579_11[guildId].updateSearchState(searchState);
},
FETCH_GUILD_MEMBER_SUPPLEMENTAL_SUCCESS: function handleFetchGuildMemberSupplementalSuccess({ guildId, memberSupplementals }) {
const r15 = syncMemberSupplemental(guildId, memberSupplementals);
if (r15) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
c3579_11[guildId].updateMembersByMemberIds(memberSupplementals.map((memberSupplemental) => memberSupplemental.userId));
}
return r15;
},
MEMBER_SAFETY_GUILD_MEMBER_SEARCH_SUCCESS: function handleMemberSafetyGuildMemberSearchSuccess({ guildId, members, total_result_count }) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
const r9 = c3579_11[guildId];
const r30 = members.reduce((acc, { member, source_invite_code, join_source_type, join_source_application_id, join_source_channel_id, inviter_id }) => {
const user = member.user;
acc.memberIds.push(user.id);
acc.memberSupplementals.push({
userId: user.id,
sourceInviteCode: source_invite_code,
joinSourceType: join_source_type,
joinSourceApplicationId: join_source_application_id,
joinSourceChannelId: join_source_channel_id,
inviterId: inviter_id
});
return acc;
}, {
memberIds: [],
memberSupplementals: []
});
const memberIds = r30.memberIds;
let r35 = syncMemberSupplemental(guildId, r30.memberSupplementals);
registerFetchedSupplementals(guildId, memberIds);
const r41 = r9.updateSearchedMembersByMemberIds(memberIds);
const r3 = members.length > 0;
let r15 = void 0;
let r43 = void 0;
if (r3) {
r43 = members[0];
r15 = members[members.length - 1];
}
const joinedAt = r43 == null ? void 0 : r43.member?.joined_at;
const r55 = r43 == null;
let userId = void 0;
if (!r55) {
const member = r43.member;
userId = member == null ? void 0 : member.user.id;
}
if (userId == null) {
userId = EMPTY_STRING_SNOWFLAKE_ID;
}
const elasticSearchCursor = {
before: createMemberSearchCursor({
joinedAt,
userId
}),
after: null
};
const joinedAt2 = r15 == null ? void 0 : r15.member?.joined_at;
const r70 = r15 == null;
let userId2 = void 0;
if (!r70) {
const member2 = r15.member;
userId2 = member2 == null ? void 0 : member2.user.id;
}
if (userId2 == null) {
userId2 = EMPTY_STRING_SNOWFLAKE_ID;
}
elasticSearchCursor.after = createMemberSearchCursor({
joinedAt: joinedAt2,
userId: userId2
});
const [r81] = r9.updatePaginationState({
totalResultsCount: total_result_count,
elasticSearchCursor
}, false);
if (!r35) {
r35 = r41;
}
if (!r35) {
r35 = r81;
}
return r35;
},
MEMBER_SAFETY_GUILD_MEMBER_UPDATE_BATCH: function handleMemberSafetyGuildMemberUpdateBatch({ guildId, userIds }) {
if (c3579_11[guildId] == null) {
c3579_11[guildId] = new GuildMemberSafetyPageStore(guildId);
}
return c3579_11[guildId].updateMembersByMemberIds(userIds);
}
});
export default memberSafetyStore;
@@ -0,0 +1,80 @@
// Metro module 5757 (f5758).
import { JoinSourceType } from "./MemberSafetySupplementalUtils";
let c3585_2 = {};
export function hasMemberSupplemental(a0, a1) {
return c3585_2[a0] != null && c3585_2[a0][a1] != null;
}
export function getMemberSupplementalByGuildId(a0) {
if (c3585_2[a0] == null) {
c3585_2[a0] = {};
}
return c3585_2[a0];
}
export function syncMemberSupplemental(a0, a1) {
if (a1.length === 0) {
return false;
}
if (c3585_2[a0] == null) {
c3585_2[a0] = {};
}
let c15094_0 = c3585_2[a0];
a1.forEach((item) => {
const r8 = c15094_0[item.userId];
let joinSourceType = item.joinSourceType;
if (joinSourceType == null) {
joinSourceType = r8?.joinSourceType;
}
if (joinSourceType == null) {
joinSourceType = null;
}
if (!(joinSourceType != null && joinSourceType !== JoinSourceType.UNSPECIFIED || item.sourceInviteCode == null)) {
joinSourceType = JoinSourceType.INVITE;
}
const userId = item.userId;
let sourceInviteCode = item.sourceInviteCode;
if (sourceInviteCode == null) {
sourceInviteCode = r8?.sourceInviteCode;
}
if (sourceInviteCode == null) {
sourceInviteCode = null;
}
let inviterId = item.inviterId;
if (inviterId == null) {
inviterId = r8?.inviterId;
}
if (inviterId == null) {
inviterId = null;
}
let integrationType = item.integrationType;
if (integrationType == null) {
integrationType = r8?.integrationType;
}
if (integrationType == null) {
integrationType = null;
}
let joinSourceApplicationId = item.joinSourceApplicationId;
if (joinSourceApplicationId == null) {
joinSourceApplicationId = r8?.joinSourceApplicationId;
}
if (joinSourceApplicationId == null) {
joinSourceApplicationId = null;
}
let joinSourceChannelId = item.joinSourceChannelId;
if (joinSourceChannelId == null) {
joinSourceChannelId = r8?.joinSourceChannelId;
}
if (joinSourceChannelId == null) {
joinSourceChannelId = null;
}
c15094_0[userId] = {
userId: item.userId,
sourceInviteCode,
joinSourceType,
inviterId,
integrationType,
joinSourceApplicationId,
joinSourceChannelId
};
});
return true;
}
@@ -0,0 +1,220 @@
// Metro module 5758 (f5759).
import { Endpoints } from "../../Constants";
import { intl, t } from "../../intl/index.native";
import Platforms from "../../lib/Platforms";
import { useLegacyPlatformType } from "../connections/ConnectionsHooks";
import useTheme from "../../hooks/useTheme";
import * as _shared from "../../design/shared";
import { HTTP } from "../../_bundle/sendRequest";
function $mk114829($env) {
return (a0) => $env[5].push(a0.userId);
}
function $mk114830($env) {
return (a0) => !$env[5].includes(a0);
}
let getUserIdFromFetchKey, updateFetchRequests, _transformFetchMemberSupplementalResponse, c3586_5, c3586_6, c3586_10, c3586_11;
let env3586 = {};
const createFetchKeys = function createFetchKeys(c15095_0, a1) {
return a1.map((item) => c15095_0 + item);
};
getUserIdFromFetchKey = function getUserIdFromFetchKey(a0) {
return a0.split("-")[1];
};
updateFetchRequests = function updateFetchRequests(a0, c15096_0) {
a0.forEach((item) => {
c3586_5[item] = c15096_0;
});
};
_transformFetchMemberSupplementalResponse = function _transformFetchMemberSupplementalResponse(a0) {
return {
userId: a0.user_id,
sourceInviteCode: a0.source_invite_code,
joinSourceType: a0.join_source_type,
inviterId: a0.inviter_id,
integrationType: a0.integration_type
};
};
c3586_5 = {};
c3586_6 = {
FAILED: 0,
0: "FAILED",
UNFETCHED: 1,
1: "UNFETCHED",
PENDING: 2,
2: "PENDING",
SUCCEEDED: 3,
3: "SUCCEEDED",
FAILED_NO_RETRY: 4,
4: "FAILED_NO_RETRY"
};
c3586_10 = {
UNSPECIFIED: 0,
0: "UNSPECIFIED",
BOT: 1,
1: "BOT",
INTEGRATION: 2,
2: "INTEGRATION",
DISCOVERY: 3,
3: "DISCOVERY",
HUB: 4,
4: "HUB",
INVITE: 5,
5: "INVITE",
VANITY_URL: 6,
6: "VANITY_URL",
MANUAL_MEMBER_VERIFICATION: 7,
7: "MANUAL_MEMBER_VERIFICATION",
SOCIAL_LAYER_INTEGRATION_LINKED_CHANNEL: 8,
8: "SOCIAL_LAYER_INTEGRATION_LINKED_CHANNEL"
};
c3586_11 = {
DISCORD: "discord",
TWITCH: "twitch",
YOUTUBE: "youtube",
GUILD_SUBSCRIPTION: "guild_subscription"
};
export function registerFetchedSupplementals(c15097_0, a1) {
a1.forEach((item) => {
c3586_5[c15097_0 + item] = c3586_6.SUCCEEDED;
});
}
export { c3586_10 as JoinSourceType };
export function getJoinSourceTypeLabel(a0, vanityUrl = null, r3 = false) {
if (c3586_10.BOT === a0) {
return intl.string(t.HumZAi);
}
if (c3586_10.INTEGRATION === a0) {
return intl.string(t.gmCUFw);
}
if (c3586_10.DISCOVERY === a0) {
return intl.string(t["Ql/e9Y"]);
}
if (c3586_10.HUB === a0) {
return intl.string(t.Op8B3O);
}
if (c3586_10.INVITE === a0) {
return intl.string(t["/3vIRd"]);
}
if (c3586_10.VANITY_URL === a0) {
return vanityUrl != null && !r3 ? intl.formatToPlainString(t.EIUjRy, {
vanityUrl
}) : intl.string(t.dGiD1O);
}
if (c3586_10.MANUAL_MEMBER_VERIFICATION === a0) {
return intl.string(t.vdu7oS);
}
if (c3586_10.SOCIAL_LAYER_INTEGRATION_LINKED_CHANNEL === a0) {
return intl.string(t["9/ZreX"]);
}
return intl.string(t.DvMBkS);
}
export { c3586_11 as IntegrationType };
export function getIntegrationLabel(a0) {
if (c3586_11.TWITCH === a0) {
return intl.string(t.AVGAkw);
}
if (c3586_11.YOUTUBE === a0) {
return intl.string(t.PHSAsn);
}
return intl.string(t.gmCUFw);
}
export function useGetIntegrationIconString(a0) {
const r15 = Platforms.get(useLegacyPlatformType(a0));
const theme = useTheme();
const r2 = r15 != null;
let r19 = null;
if (r2) {
const r25 = [c3586_11.TWITCH, c3586_11.YOUTUBE].includes(a0);
r19 = null;
if (r25) {
const isThemeDark = _shared.isThemeDark(theme);
const icon = r15.icon;
r19 = `url('${isThemeDark ? icon.darkSVG : icon.lightSVG}')`;
}
}
return r19;
}
export async function fetchMemberSupplemental(c25598_0, c25598_1) {
let r104;
let c25598_2, c25598_3, c25598_4;
let c25598_5 = 0;
const r11 = env3586;
L15: {
L14: {
try {
let env29609;
c25598_3 = r11;
const r30 = env29609 = {
$parent: r11
};
c25598_2 = r30;
env29609[0] = c25598_0;
env29609[1] = void 0;
env29609[2] = void 0;
env29609[3] = void 0;
env29609[4] = void 0;
env29609[5] = void 0;
env29609[6] = void 0;
env29609[7] = void 0;
const fetchKeys = createFetchKeys(c25598_0, c25598_1);
env29609[1] = fetchKeys;
const user_ids = (function getFetchchableUsers(a0) {
return a0.filter((item) => c3586_5[item] <= c3586_6.UNFETCHED).map(getUserIdFromFetchKey);
})(fetchKeys);
env29609[2] = user_ids;
if (user_ids.length === 0) {
break L15;
}
updateFetchRequests(fetchKeys, c3586_6.PENDING);
c25598_5 = 1;
env29609[3] = await HTTP.post({
url: Endpoints.MEMBER_SAFETY_SUPPLEMENTAL(c25598_0),
body: {
user_ids
},
rejectWithError: true
});
const isArray = Array.isArray(env29609[3].body);
const r71 = c25598_2;
if (isArray) {
env29609[4] = env29609[3].body.map(_transformFetchMemberSupplementalResponse);
env29609[5] = [];
env29609[4].forEach($mk114829(r71));
env29609[6] = (0, createFetchKeys)(env29609[0], env29609[5]);
env29609[7] = (0, createFetchKeys)(env29609[0], env29609[2].filter($mk114830(r71)));
(0, updateFetchRequests)(env29609[6], c3586_6.SUCCEEDED);
(0, updateFetchRequests)(env29609[7], c3586_6.FAILED);
r104 = env29609[4];
c25598_5 = 0;
break L14;
}
(0, updateFetchRequests)(env29609[1], c3586_6.FAILED);
c25598_5 = 0;
} catch ($e) {
const r28 = $e;
let r8 = r28;
c25598_4 = r28;
if (c25598_5 !== 0) {
while (true) {
try {
c25598_5 = 0;
(0, updateFetchRequests)(env29609[1], c3586_6.FAILED);
} catch (r117) {
r8 = r117;
c25598_4 = r117;
if (c25598_5 === 0) {
break;
}
continue;
}
return [];
}
}
throw r8;
}
return [];
}
return r104;
}
return [];
}
@@ -0,0 +1,63 @@
// Metro module 15445 (f15446).
import { create } from "../../_bundle/Module644";
let c10981_1 = 3600000;
let c10981_2 = create((c22003_0) => ({
entries: {},
setPreview: (a0, a1, a2, count, isFinished) => {
let c28025_2 = `${a0}:${a1}:${[...a2].sort().join(",")}`;
c22003_0((a0) => {
const r4 = {
...a0.entries
};
const entries = {};
const r6 = Date.now();
for (const item of Object.entries(r4)) {
const [r36, r37] = item;
if (r6 - r37.cachedAt < c10981_1) {
entries[r36] = r37;
}
}
const r47 = entries[c28025_2];
if (r47 == null || r47.count <= count && !r47.isFinished) {
entries[c28025_2] = {
count,
isFinished,
cachedAt: Date.now()
};
}
return {
entries
};
});
},
clear: () => {
c22003_0({
entries: {}
});
}
}));
export const CACHE_TTL_MS = 3600000;
export function getPrunePreviewKey(a0, a1, a2) {
return `${a0}:${a1}:${[...a2].sort().join(",")}`;
}
export { c10981_2 as usePrunePreviewStore };
export function setPrunePreview(a0, a1, a2, a3, a4) {
c10981_2.getState().setPreview(a0, a1, a2, a3, a4);
}
export function clearAllPrunePreviews() {
c10981_2.getState().clear();
}
export function usePrunePreview(c22004_0, c22004_1, c22004_2) {
const r5 = c10981_2((a0) => {
const r28 = a0.entries[`${c22004_0}:${c22004_1}:${[...c22004_2].sort().join(",")}`];
return r28 != null ? Date.now() - r28.cachedAt < c10981_1 ? r28 : null : null;
});
return {
count: r5?.count,
isLoading: r5?.isFinished === false
};
}
export function getPrunePreview(a0, a1, a2) {
const r29 = c10981_2.getState().entries[`${a0}:${a1}:${[...a2].sort().join(",")}`];
return r29 != null ? Date.now() - r29.cachedAt < c10981_1 ? r29.count : null : null;
}
@@ -0,0 +1,19 @@
// Metro module 5756 (f5757).
import { getJoinedAtTimestamp } from "./DateUtils";
import { OrderBy } from "./MemberSafetyElasticSearchQueryTypes";
export function getSortValueForMember(a0, a1) {
const joinedAtTimestamp = getJoinedAtTimestamp(a0.joinedAt);
if (OrderBy.ORDER_BY_GUILD_JOINED_AT_ASC === a1) {
return joinedAtTimestamp;
}
if (OrderBy.ORDER_BY_GUILD_JOINED_AT_DESC === a1) {
return -joinedAtTimestamp;
}
if (OrderBy.ORDER_BY_USER_ID_ASC === a1) {
return parseInt(a0.userId);
}
if (OrderBy.ORDER_BY_USER_ID_DESC === a1) {
return -parseInt(a0.userId);
}
return -joinedAtTimestamp;
}
@@ -0,0 +1,20 @@
// Metro module 12627 (f12628).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-02-pubsub-bulk-ban-users",
kind: "user",
defaultConfig: {
usePubSub: false
},
variations: {
1: {
usePubSub: true
}
}
});
export default apexExperiment;
export function useBulkBanPubSubExperimentConfig(a0) {
return apexExperiment.useConfig({
location: a0.location
});
}