285 lines
12 KiB
TypeScript
285 lines
12 KiB
TypeScript
/* Metro module 8275; source: modules/guild_antiraid/GuildAntiRaidUtils.tsx; dependencies: [8276, 3738, 8277, 1244, 2] */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as GuildAntiRaidConstantsModule from './GuildAntiRaidConstants.tsx'; /* Metro dependency 8276 */
|
|
import * as GuildAntiRaidTypesModule from './GuildAntiRaidTypes.tsx'; /* Metro dependency 8277 */
|
|
|
|
function _fun66127(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#66127, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8460:6, offset: 0x01bee09b, size: 308 bytes, params: 8, frame: 19
|
|
let env0_0 = require;
|
|
const hasDetectedRaid2 = hasDetectedRaid;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/guild_antiraid/GuildAntiRaidUtils.tsx');
|
|
exports.DATE_CONFIG = {'month': 'numeric', 'day': 'numeric', 'hour': 'numeric', 'minute': '2-digit'};
|
|
exports.hasDetectedActivity = hasDetectedActivity;
|
|
exports.hasDetectedRaid = hasDetectedRaid2;
|
|
exports.hasDetectedDMRaid = hasDetectedDMRaid;
|
|
exports.getIncidentAlertType = getIncidentAlertType;
|
|
exports.getEnabledInterventions = getEnabledInterventions;
|
|
exports.getDisabledInterventions = getDisabledInterventions;
|
|
exports.isUnderLockdown = isUnderLockdown;
|
|
exports.hasDMsDisabled = function(a0) {
|
|
var r0;
|
|
var property;
|
|
var dmsDisabledUntil;
|
|
var value2;
|
|
var value3;
|
|
var value4;
|
|
value = a0?.dmsDisabledUntil != null;
|
|
if (value) {
|
|
property = global.Date;
|
|
dmsDisabledUntil = a0.dmsDisabledUntil;
|
|
value2 = new property();
|
|
property = global.Date;
|
|
value3 = Object.create(property.prototype, {constructor: {value: property}});
|
|
value4 = new property();
|
|
value2 = value2 > (value4 instanceof Object ? value4 : value3);
|
|
r0 = value2;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
};
|
|
exports.hasInvitesDisabled = function(a0) {
|
|
var r0;
|
|
var property;
|
|
var invitesDisabledUntil;
|
|
var value2;
|
|
var value3;
|
|
var value4;
|
|
value = a0?.invitesDisabledUntil != null;
|
|
if (value) {
|
|
property = global.Date;
|
|
invitesDisabledUntil = a0.invitesDisabledUntil;
|
|
value2 = new property();
|
|
property = global.Date;
|
|
value3 = Object.create(property.prototype, {constructor: {value: property}});
|
|
value4 = new property();
|
|
value2 = value2 > (value4 instanceof Object ? value4 : value3);
|
|
r0 = value2;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
};
|
|
exports.initialLockdownDurationHours = function(a0) {
|
|
var r0;
|
|
var env0_0 = a0?.lockdownDurationHours;
|
|
r0 = r0 == null || !getTimeframes().some(_fun66138) ? DEFAULT_LOCKDOWN_DURATION : r0;
|
|
return r0;
|
|
};
|
|
exports.getSecurityActionDetailsString = getSecurityActionDetailsString;
|
|
function hasDetectedRaid(a0) { // fn#66128, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8460:249, offset: 0x01bee1cf, size: 92 bytes, params: 2, frame: 18
|
|
var r0;
|
|
let value = a0.raidDetectedAt != null;
|
|
if (value) {
|
|
value = (importDefault(3738) /* metro dependency 3738 */)(a0.raidDetectedAt).add(NAGBAR_DISPLAY_MAX_HOURS,
|
|
'hours');
|
|
value = value > (importDefault(3738) /* metro dependency 3738 */)();
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function hasDetectedActivity(a0) { // fn#66129, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8460:476, offset: 0x01bee22b, size: 183 bytes, params: 2, frame: 20
|
|
var r0;
|
|
var r1;
|
|
let value = a0.dmSpamDetectedAt != null;
|
|
if (value) {
|
|
value = (importDefault(3738) /* metro dependency 3738 */)(a0.dmSpamDetectedAt).add(NAGBAR_DISPLAY_MAX_HOURS,
|
|
'hours');
|
|
value = value > (importDefault(3738) /* metro dependency 3738 */)();
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
if (!r0) {
|
|
value = a0.raidDetectedAt != null;
|
|
if (value) {
|
|
value = (importDefault(3738) /* metro dependency 3738 */)(a0.raidDetectedAt).add(NAGBAR_DISPLAY_MAX_HOURS,
|
|
'hours');
|
|
value = value > (importDefault(3738) /* metro dependency 3738 */)();
|
|
r1 = value;
|
|
} else {
|
|
r1 = value;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function hasDetectedDMRaid(a0) { // fn#66130, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8460:725, offset: 0x01bee2e2, size: 92 bytes, params: 2, frame: 18
|
|
var r0;
|
|
let value = a0.dmSpamDetectedAt != null;
|
|
if (value) {
|
|
value = (importDefault(3738) /* metro dependency 3738 */)(a0.dmSpamDetectedAt).add(NAGBAR_DISPLAY_MAX_HOURS,
|
|
'hours');
|
|
value = value > (importDefault(3738) /* metro dependency 3738 */)();
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getIncidentAlertType(a0) { // fn#66131, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8460:865, offset: 0x01bee33e, size: 76 bytes, params: 2, frame: 14
|
|
var r0;
|
|
var hasDetectedRaid2;
|
|
var GuildIncidentAlertTypes;
|
|
if (a0 == null) {
|
|
r0 = undefined;
|
|
} else {
|
|
hasDetectedRaid2 = hasDetectedRaid(a0);
|
|
GuildIncidentAlertTypes = (require(8277) /* metro dependency 8277: GuildAntiRaidTypes */).GuildIncidentAlertTypes;
|
|
r0 = hasDetectedRaid2 ? GuildIncidentAlertTypes.JOIN_RAID : GuildIncidentAlertTypes.DM_RAID;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getEnabledInterventions(a0, a1) { // fn#66132, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8460:1048, offset: 0x01bee38a, size: 112 bytes, params: 3, frame: 13
|
|
const GuildIncidentActionTypes = (GuildAntiRaidTypesModule).GuildIncidentActionTypes;
|
|
const items2 = [];
|
|
if (a0) {
|
|
items2.push(GuildIncidentActionTypes.INVITES_DISABLED);
|
|
}
|
|
if (a1) {
|
|
items2.push(GuildIncidentActionTypes.DMS_DISABLED);
|
|
}
|
|
return items2;
|
|
}
|
|
|
|
function getDisabledInterventions(a0, a1) { // fn#66133, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8460:1250, offset: 0x01bee3fa, size: 112 bytes, params: 3, frame: 13
|
|
const GuildIncidentActionTypes = (GuildAntiRaidTypesModule).GuildIncidentActionTypes;
|
|
const items2 = [];
|
|
if (!a0) {
|
|
items2.push(GuildIncidentActionTypes.INVITES_DISABLED);
|
|
}
|
|
if (!a1) {
|
|
items2.push(GuildIncidentActionTypes.DMS_DISABLED);
|
|
}
|
|
return items2;
|
|
}
|
|
|
|
function initialLockdownDurationHours(a0) { // fn#66137, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8460:1930, offset: 0x01bee5cb, size: 73 bytes, params: 2, frame: 14
|
|
var r0;
|
|
let value = undefined;
|
|
const lockdownDurationHours = a0 == null ? value : a0.lockdownDurationHours;
|
|
if (lockdownDurationHours == null) {
|
|
r0 = DEFAULT_LOCKDOWN_DURATION;
|
|
} else {
|
|
value = getTimeframes();
|
|
r0 = value.some(function({value}) {
|
|
return value === lockdownDurationHours;
|
|
}) ? lockdownDurationHours : DEFAULT_LOCKDOWN_DURATION;
|
|
}
|
|
return r0;
|
|
function _fun66138({value}) { // fn#66138, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8460:2042, offset: 0x01b733f1, size: 21 bytes, params: 2, frame: 2
|
|
return value === lockdownDurationHours;
|
|
}
|
|
|
|
}
|
|
|
|
function getSecurityActionDetailsString(a0, a1) { // fn#66139, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8460:2097, offset: 0x01bee614, size: 524 bytes, params: 3, frame: 22
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
var formatToPlainString;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
var M3iSyL;
|
|
var object;
|
|
var date;
|
|
var property;
|
|
var hCZitf;
|
|
if ((a0.dmsDisabledUntil ?? a0.invitesDisabledUntil) != null) {
|
|
var value = a0.dmsDisabledUntil != null;
|
|
var value2 = a0.invitesDisabledUntil != null;
|
|
if ((value && value2) === true) {
|
|
value = environment;
|
|
formatToPlainString = intl.formatToPlainString;
|
|
hCZitf = t.hCZitf;
|
|
object = {guildName: a1};
|
|
date = new global.Date();
|
|
object.time = date.toLocaleString((require(1244) /* metro dependency 1244: indexNative */).intl.currentLocale,
|
|
|
|
env0_6);
|
|
return Reflect.apply(formatToPlainString, intl, [hCZitf, object]);
|
|
}
|
|
if (value === true) {
|
|
formatToPlainString = intl.formatToPlainString;
|
|
property = t['HNKxf+'];
|
|
object = {guildName: a1};
|
|
date = new global.Date();
|
|
object.time = date.toLocaleString((require(1244) /* metro dependency 1244: indexNative */).intl.currentLocale,
|
|
|
|
env0_6);
|
|
return Reflect.apply(formatToPlainString, intl, [property, object]);
|
|
}
|
|
if (value2 === true) {
|
|
formatToPlainString = intl.formatToPlainString;
|
|
M3iSyL = t.M3iSyL;
|
|
object = {guildName: a1};
|
|
date = new global.Date();
|
|
object.time = date.toLocaleString((require(1244) /* metro dependency 1244: indexNative */).intl.currentLocale,
|
|
|
|
env0_6);
|
|
return Reflect.apply(formatToPlainString, intl, [M3iSyL, object]);
|
|
}
|
|
}
|
|
return '';
|
|
}
|
|
|
|
}
|
|
|
|
function isUnderLockdown(a0) { // fn#66134, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8460:1444, offset: 0x01bee46a, size: 167 bytes, params: 2, frame: 15
|
|
var r0;
|
|
var r1;
|
|
var Date;
|
|
var prototype;
|
|
var date;
|
|
var value2;
|
|
var invitesDisabledUntil;
|
|
var value4;
|
|
let dmsDisabledUntil = a0.dmsDisabledUntil;
|
|
let value = dmsDisabledUntil != null;
|
|
if (value) {
|
|
Date = global.Date;
|
|
dmsDisabledUntil = a0.dmsDisabledUntil;
|
|
prototype = Date.prototype;
|
|
value = Object.create(prototype, {constructor: {value: Date}});
|
|
date = new Date(dmsDisabledUntil);
|
|
value = date instanceof Object ? date : value;
|
|
Date = global.Date;
|
|
prototype = Date.prototype;
|
|
value2 = Object.create(prototype, {constructor: {value: Date}});
|
|
date = new Date();
|
|
value = value > (date instanceof Object ? date : value2);
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
if (!r0) {
|
|
invitesDisabledUntil = a0.invitesDisabledUntil;
|
|
value = invitesDisabledUntil != null;
|
|
if (value) {
|
|
Date = global.Date;
|
|
invitesDisabledUntil = a0.invitesDisabledUntil;
|
|
prototype = Date.prototype;
|
|
value = Object.create(prototype, {constructor: {value: Date}});
|
|
date = new Date();
|
|
value = date instanceof Object ? date : value;
|
|
Date = global.Date;
|
|
prototype = Date.prototype;
|
|
value4 = Object.create(prototype, {constructor: {value: Date}});
|
|
date = new Date();
|
|
value = value > (date instanceof Object ? date : value4);
|
|
r1 = value;
|
|
} else {
|
|
r1 = value;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
global.__d(_fun66127, 8275, [8276, 3738, 8277, 1244,
|
|
2]) /* metro module 8275, dependencies: [8276, 3738, 8277, 1244, 2] */;
|