Files
discord-decomp/sources/utils/ModerationUtils.tsx
T
2026-07-28 01:06:53 +03:00

269 lines
14 KiB
TypeScript

/* Metro module 13360; source: utils/ModerationUtils.tsx; dependencies: [661, 3831, 696, 13361, 1244, 1314, 2] */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
import * as ShimsNativeModule from '../external/discord_common/js/packages/tokens/shims.native.tsx'; /* Metro dependency 696 */
import * as IndexNativeModule from '../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as Preloaded_user_settingsModule from '../external/discord_common/js/packages/protos/discord_protos/discord_users/v1/preloaded_user_settings.tsx'; /* Metro dependency 1314 */
import * as DMSafetyConstantsModule from '../modules/user_settings/privacy_and_safety/DMSafetyConstants.tsx'; /* Metro dependency 3831 */
import * as HighlightedSettingsTypesModule from '../modules/guild_settings/safety/HighlightedSettingsTypes.tsx'; /* Metro dependency 13361 */
function _fun101730(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#101730, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13550:6, offset: 0x0221d0ba, size: 249 bytes, params: 8, frame: 19
const env0_0 = require;
const mapColorToHighlightColor2 = mapColorToHighlightColor;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('utils/ModerationUtils.tsx');
exports.mapColorToHighlightColor = mapColorToHighlightColor2;
exports.mapOptionToHighlightedRowOptions = function(a0) {
return a0.map(_fun101733);
};
exports.generateVerificationLevelOptions = generateVerificationLevelOptions;
exports.generateContentFilterHighlightedOptions = generateContentFilterHighlightedOptions;
exports.generateContentFilterOptions = generateContentFilterOptions;
exports.generateDmSpamOptions = generateDmSpamOptions;
exports.generateExplicitImageOptions = generateExplicitImageOptions;
function mapColorToHighlightColor(a0) { // fn#101731, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13550:227, offset: 0x0221d1b3, size: 408 bytes, params: 2, frame: 15
const HighlightColors = (HighlightedSettingsTypesModule).HighlightColors;
if (ShimsNativeModule.unsafe_getRawColor('PRIMARY_400') === a0) {
return HighlightColors.ACCENT;
}
if (ShimsNativeModule.unsafe_getRawColor('GREEN_360') === a0) {
return HighlightColors.GREEN;
}
if (ShimsNativeModule.unsafe_getRawColor('YELLOW_360') === a0) {
return HighlightColors.YELLOW;
}
if (ShimsNativeModule.unsafe_getRawColor('ORANGE_345') === a0) {
return HighlightColors.ORANGE;
}
if (ShimsNativeModule.unsafe_getRawColor('RED_400') === a0) {
return HighlightColors.RED;
}
return HighlightColors.NONE;
}
function mapOptionToHighlightedRowOptions(a0) { // fn#101732, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13550:878, offset: 0x0221d34b, size: 24 bytes, params: 2, frame: 11
return a0.map(function(a0) {
var object = {title: a0.name, description: a0.desc};
object.highlightColor = mapColorToHighlightColor(a0.color);
object.value = a0.value;
object.disabled = a0.disabled;
return object;
});
function _fun101733({name, desc, color, value, disabled}) { // fn#101733, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13550:937, offset: 0x0221d363, size: 68 bytes, params: 2, frame: 13
const object = {};
object.title = name;
object.description = desc;
const __proto__ = environment.__proto__;
object.highlightColor = mapColorToHighlightColor(color);
object.value = __proto__;
object.disabled = disabled;
return object;
}
}
function generateVerificationLevelOptions() { // fn#101734, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13550:1097, offset: 0x0221d3a7, size: 915 bytes, params: 1, frame: 21
let value = a0;
const value2 = a1;
const value3 = undefined;
const r0 = value !== value3 ? value : false;
const r4 = value2 !== value3 ? value2 : false;
let object = {};
const intl = (IndexNativeModule).intl;
let string = intl.string;
const t = (IndexNativeModule).t;
const PEzffq = t.PEzffq;
object.name = Reflect.apply(string, intl, [PEzffq]);
string = intl.string;
let r2 = r0 ? Reflect.apply(string, intl, [t.j9WtHx]) : Reflect.apply(string, intl, [t.nDQy0p]);
object.desc = r2;
const NONE = VerificationLevels.NONE;
object.value = NONE;
object.disabled = r0;
const items2 = [object];
object = {};
string = intl.string;
const SsCK8I = t.SsCK8I;
object.name = Reflect.apply(string, intl, [SsCK8I]);
object.desc = intl.string(t['8GCOX6']);
const LOW = VerificationLevels.LOW;
object.value = LOW;
object.color = r4 ? value3 : (require(696) /* metro dependency 696: shimsNative */).unsafe_getRawColor('GREEN_360');
items2[1] = object;
object = {};
string = intl.string;
const WwNoR4 = t.WwNoR4;
object.name = Reflect.apply(string, intl, [WwNoR4]);
let formatToPlainString = intl.formatToPlainString;
const VS14ga = t.VS14ga;
const ACCOUNT_AGE = VerificationCriteria.ACCOUNT_AGE;
object.desc = Reflect.apply(formatToPlainString, intl, [VS14ga, {min: ACCOUNT_AGE}]);
const MEDIUM = VerificationLevels.MEDIUM;
object.value = MEDIUM;
object.color = r4 ? value3 : (require(696) /* metro dependency 696: shimsNative */).unsafe_getRawColor('YELLOW_360');
items2[2] = object;
object = {};
string = intl.string;
const I2jMUF = t.I2jMUF;
object.name = Reflect.apply(string, intl, [I2jMUF]);
formatToPlainString = intl.formatToPlainString;
const property = t['r+b3I4'];
const MEMBER_AGE = VerificationCriteria.MEMBER_AGE;
object.desc = Reflect.apply(formatToPlainString, intl, [property, {min: MEMBER_AGE}]);
const HIGH = VerificationLevels.HIGH;
object.value = HIGH;
object.color = r4 ? value3 : (require(696) /* metro dependency 696: shimsNative */).unsafe_getRawColor('ORANGE_345');
items2[3] = object;
object = {};
object.name = intl.string(t.cJY8w9);
string = intl.string;
const PWaKme = t.PWaKme;
object.desc = Reflect.apply(string, intl, [PWaKme]);
const VERY_HIGH = VerificationLevels.VERY_HIGH;
object.value = VERY_HIGH;
if (r4) {
r2 = value3;
} else {
value = require(696) /* metro dependency 696: shimsNative */;
value = value.unsafe_getRawColor('RED_400');
r2 = value;
}
object.color = r2;
items2[4] = object;
return items2;
}
function generateContentFilterHighlightedOptions() { // fn#101735, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13550:2054, offset: 0x0221d73a, size: 543 bytes, params: 1, frame: 20
const value = a0;
const r3 = value !== undefined ? value : false;
let object = {};
const intl = (IndexNativeModule).intl;
let string = intl.string;
const t = (IndexNativeModule).t;
object.name = Reflect.apply(string, intl, [t.iHuPE6]);
object.desc = intl.string(t['Z+yUWF']);
const ALL_MEMBERS = GuildExplicitContentFilterTypes.ALL_MEMBERS;
object.value = ALL_MEMBERS;
object.color = (require(696) /* metro dependency 696: shimsNative */).unsafe_getRawColor('RED_400');
const items2 = [object];
object = {};
object.name = intl.string(t.ynfFaI);
string = intl.string;
object.desc = r3 ? Reflect.apply(string, intl, [t.j9WtHx]) : Reflect.apply(string, intl, [t['3fRIN4']]);
const MEMBERS_WITHOUT_ROLES = GuildExplicitContentFilterTypes.MEMBERS_WITHOUT_ROLES;
object.value = MEMBERS_WITHOUT_ROLES;
object.disabled = r3;
object.color = (require(696) /* metro dependency 696: shimsNative */).unsafe_getRawColor('YELLOW_360');
items2[1] = object;
object = {};
string = intl.string;
const VbSyAx = t.VbSyAx;
object.name = Reflect.apply(string, intl, [VbSyAx]);
string = intl.string;
object.desc = r3 ? Reflect.apply(string, intl, [t.j9WtHx]) : Reflect.apply(string, intl, [t.M6GNsJ]);
const DISABLED = GuildExplicitContentFilterTypes.DISABLED;
object.value = DISABLED;
object.disabled = r3;
object.color = (require(696) /* metro dependency 696: shimsNative */).unsafe_getRawColor('PRIMARY_400');
items2[2] = object;
return items2;
}
function generateContentFilterOptions() { // fn#101736, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13550:2727, offset: 0x0221d959, size: 446 bytes, params: 1, frame: 19
const value = a0;
const r2 = value !== undefined ? value : false;
let object = {};
const intl = (IndexNativeModule).intl;
let string = intl.string;
const t = (IndexNativeModule).t;
object.name = Reflect.apply(string, intl, [t.iHuPE6]);
object.desc = intl.string(t['Z+yUWF']);
const ALL_MEMBERS = GuildExplicitContentFilterTypes.ALL_MEMBERS;
object.value = ALL_MEMBERS;
const items2 = [object];
string = intl.string;
const MEMBERS_WITHOUT_ROLES = GuildExplicitContentFilterTypes.MEMBERS_WITHOUT_ROLES;
items2[1] = {name: intl.string(t.ynfFaI), desc: r2 ? Reflect.apply(string, intl, [t.j9WtHx]) : Reflect.apply(string,
intl, [t['3fRIN4']]), value: MEMBERS_WITHOUT_ROLES, disabled: r2};
object = {};
string = intl.string;
const VbSyAx = t.VbSyAx;
object.name = Reflect.apply(string, intl, [VbSyAx]);
string = intl.string;
object.desc = r2 ? Reflect.apply(string, intl, [t.j9WtHx]) : Reflect.apply(string, intl, [t.M6GNsJ]);
const DISABLED = GuildExplicitContentFilterTypes.DISABLED;
object.value = DISABLED;
object.disabled = r2;
items2[2] = object;
return items2;
}
function generateDmSpamOptions() { // fn#101737, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13550:3243, offset: 0x0221db17, size: 421 bytes, params: 1, frame: 18
let object = {};
const intl = (IndexNativeModule).intl;
let string = intl.string;
const t = (IndexNativeModule).t;
object.name = Reflect.apply(string, intl, [t['4IaoCI']]);
string = intl.string;
const TgipjE = t.TgipjE;
object.desc = Reflect.apply(string, intl, [TgipjE]);
const DmSpamFilterV2 = (Preloaded_user_settingsModule).DmSpamFilterV2;
const FRIENDS_AND_NON_FRIENDS = DmSpamFilterV2.FRIENDS_AND_NON_FRIENDS;
object.value = FRIENDS_AND_NON_FRIENDS;
const items2 = [object];
object = {};
object.name = intl.string(t['6NnX6F']);
object.desc = intl.string(t['+dw1qu']);
const NON_FRIENDS = DmSpamFilterV2.NON_FRIENDS;
object.value = NON_FRIENDS;
items2[1] = object;
object = {};
object.name = intl.string(t['1tiAFz']);
string = intl.string;
const LKTyeA = t.LKTyeA;
object.desc = Reflect.apply(string, intl, [LKTyeA]);
const DISABLED = DmSpamFilterV2.DISABLED;
object.value = DISABLED;
items2[2] = object;
return items2;
}
function generateExplicitImageOptions() { // fn#101738, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13550:3724, offset: 0x0221dcbc, size: 466 bytes, params: 1, frame: 19
let object = {};
const intl = (IndexNativeModule).intl;
let string = intl.string;
const t = (IndexNativeModule).t;
const PhNlhz = t.PhNlhz;
object.name = Reflect.apply(string, intl, [PhNlhz]);
object.desc = intl.string(t['Fw+Lvp']);
const FRIENDS_AND_NON_FRIENDS = ExplicitContentFilterTypes.FRIENDS_AND_NON_FRIENDS;
object.value = FRIENDS_AND_NON_FRIENDS;
object.color = (require(696) /* metro dependency 696: shimsNative */).unsafe_getRawColor('GREEN_360');
const items2 = [object];
object = {};
object.name = intl.string(t['8ioJ4S']);
object.desc = intl.string(t.z4l4Cr);
const NON_FRIENDS = ExplicitContentFilterTypes.NON_FRIENDS;
object.value = NON_FRIENDS;
object.color = (require(696) /* metro dependency 696: shimsNative */).unsafe_getRawColor('YELLOW_360');
items2[1] = object;
object = {};
string = intl.string;
const FLfuhL = t.FLfuhL;
object.name = Reflect.apply(string, intl, [FLfuhL]);
string = intl.string;
const MoZlaD = t.MoZlaD;
object.desc = Reflect.apply(string, intl, [MoZlaD]);
const DISABLED = ExplicitContentFilterTypes.DISABLED;
object.value = DISABLED;
object.color = (require(696) /* metro dependency 696: shimsNative */).unsafe_getRawColor('RED_400');
items2[2] = object;
return items2;
}
}
global.__d(_fun101730, 13360, [661, 3831, 696, 13361, 1244, 1314,
2]) /* metro module 13360, dependencies: [661, 3831, 696, 13361, 1244, 1314, 2] */;