Files
2026-07-28 01:06:53 +03:00

504 lines
26 KiB
TypeScript

/* Metro module 13278; source: modules/safety_hub/native/SafetyHubViolationsContainer.tsx; dependencies: [57, 31, 27, 11473, 5267, 661, 33, 4501, 697, 8792, 8129, 4573, 1244, 12298, 8708, 5266, 21, 13279, 5268, 5080, 11470, 1962, 11481, 566, 683, 11479, 2] */
import SnowflakeUtils from '../../../utils/SnowflakeUtils.tsx'; /* Metro dependency 21 */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import TouchableHitBox from '../../../design/void/TouchableHitBox/native/TouchableHitBox.tsx'; /* Metro dependency 8792 */
import SafetyHubStore from '../SafetyHubStore.tsx'; /* Metro dependency 11473 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as SafetyHubUtilsModule from '../SafetyHubUtils.tsx'; /* Metro dependency 5266 */
import * as WarningIconModule from '../../../design/components/Icon/native/redesign/generated/WarningIcon.tsx'; /* Metro dependency 8129 */
import * as UseSafetyHubClassificationsModule from '../hooks/useSafetyHubClassifications.tsx'; /* Metro dependency 11479 */
import * as UseSafetyHubAccountStandingModule from '../hooks/useSafetyHubAccountStanding.tsx'; /* Metro dependency 11481 */
import * as UseIsNewClassificationModule from '../hooks/useIsNewClassification.tsx'; /* Metro dependency 13279 */
function _fun101225(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#101225, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:6, offset: 0x0220ce26, size: 1375 bytes, params: 8, frame: 24
const env0_0 = require;
const SafetyHubViolationsContainer2 = SafetyHubViolationsContainer;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
const env0_5 = value.Pressable;
const env0_6 = value.View;
value = require(5267) /* metro dependency 5267: SafetyHubConstants */;
const env0_8 = value.SafetyHubAnalyticsActionSource;
const env0_9 = value.SafetyHubAnalyticsActions;
value = require(33) /* metro dependency 33 */;
const env0_11 = value.jsx;
const env0_12 = value.jsxs;
const env0_13 = value.Fragment;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
const object2 = {'display': 'flex', 'marginTop': null, 'marginBottom': 36};
let PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object2.marginTop = PX_12;
PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object2.gap = PX_12;
object.connectedContainer = object2;
const object3 = {};
const CARD_BACKGROUND_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.CARD_BACKGROUND_DEFAULT;
object3.backgroundColor = CARD_BACKGROUND_DEFAULT;
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.md;
let PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object3.padding = PX_8;
object3.width = '100%';
object.container = object3;
const PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.header = {'display': 'flex', 'flexDirection': 'row', 'alignItems': 'center', 'gap': null, 'width': '100%',
gap: PX_16};
const object5 = {};
const BACKGROUND_MOD_STRONG = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_STRONG;
object5.backgroundColor = BACKGROUND_MOD_STRONG;
object5.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.md;
PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object5.padding = PX_12;
object5.marginTop = 10;
object.detailContainerOuter = object5;
const CONTROL_PRIMARY_BACKGROUND_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_PRIMARY_BACKGROUND_DEFAULT;
object.detailContainerOuterNew = {'borderColor': null, 'borderWidth': 1, 'borderStyle': 'solid',
borderColor: CONTROL_PRIMARY_BACKGROUND_DEFAULT};
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.detailContainerInner = {display: 'flex', gap: PX_8};
const object8 = {'display': 'flex', 'borderRadius': null, 'backgroundColor': null, 'justifyContent': 'center',
'alignItems': 'center', 'padding': 6};
object8.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
let BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
object8.backgroundColor = BACKGROUND_BASE_LOWEST;
object.iconBackground = object8;
object.chevron = {marginLeft: 'auto'};
const object10 = {alignSelf: 'flex-start'};
BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
object10.backgroundColor = BACKGROUND_BASE_LOWEST;
object10.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.md;
const PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
object10.paddingVertical = PX_4;
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object10.paddingHorizontal = PX_8;
object.incidentDate = object10;
const object11 = {};
const BACKGROUND_BRAND = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BRAND;
object11.backgroundColor = BACKGROUND_BRAND;
const CONTROL_PRIMARY_TEXT_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_PRIMARY_TEXT_DEFAULT;
object11.color = CONTROL_PRIMARY_TEXT_DEFAULT;
object.incidentDateNew = object11;
object.newText = {textTransform: 'capitalize'};
const object13 = {'display': 'flex', 'alignItems': 'center'};
const BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
object13.backgroundColor = BACKGROUND_BASE_LOWER;
object13.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.md;
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object13.gap = PX_8;
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object13.marginTop = PX_8;
let PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object13.paddingTop = PX_24;
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object13.paddingBottom = PX_24;
object.emptyState = object13;
const BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE;
object.separator = {'height': 1, 'width': '100%', 'backgroundColor': null, 'marginTop': 10,
backgroundColor: BORDER_SUBTLE};
object.moreButtonContainer = {'display': 'flex', 'alignItems': 'center', 'justifyContent': 'center'};
const object15 = {'display': 'flex', 'alignItems': 'center', 'justifyContent': 'center',
'borderBottomEndRadius': null, 'borderBottomStartRadius': null, 'backgroundColor': null, 'height': 29,
'width': 207};
object15.borderBottomEndRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
object15.borderBottomStartRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
const BACKGROUND_MOD_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_MUTED;
object15.backgroundColor = BACKGROUND_MOD_MUTED;
object.moreButton = object15;
object.headerTextContainer = {'flexShrink': 0, 'flexGrow': 1, 'gap': 2};
const env0_14 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).fileFinishedImporting('modules/safety_hub/native/SafetyHubViolationsContainer.tsx');
exports.default = SafetyHubViolationsContainer2;
exports.ConnectedSafetyHubViolationsContainer = ConnectedSafetyHubViolationsContainer;
function SafetyHubViolationsHeader({count, onClick, opened, status}) { // fn#101226, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:2244, offset: 0x0220d385, size: 664 bytes, params: 2, frame: 33
var r14;
var fZAHBT;
var object3;
var IeV2oY;
var object4;
const styles = useStyles();
const items5 = [styles.header];
const items2 = [styles.iconBackground];
const WarningIcon = (WarningIconModule).WarningIcon;
const value2 = status === 'active';
const colors = (Native).colors;
const items3 = [
<View style={items2}>
<WarningIcon color={value2 ? colors.INTERACTIVE_TEXT_DEFAULT : colors.ICON_MUTED} size="xs" />
</View>,
];
const items4 = [styles.headerTextContainer];
const Text = (TextModule).Text;
const intl = (IndexNativeModule).intl;
const formatToPlainString = intl.formatToPlainString;
const t = (IndexNativeModule).t;
if (value2) {
IeV2oY = t.IeV2oY;
object4 = {};
object4.count = count.toString();
r14 = Reflect.apply(formatToPlainString, intl, [IeV2oY, object4]);
} else {
fZAHBT = t.fZAHBT;
object3 = {};
object3.count = count.toString();
r14 = Reflect.apply(formatToPlainString, intl, [fZAHBT, object3]);
}
const text = (
<Text variant="heading-sm/semibold">
{r14}
</Text>
);
const string = intl.string;
items3[1] = (
<View style={items4}>
{text}
<Text variant="text-xxs/normal" color="text-muted">
{value2 ? Reflect.apply(string, intl, [t.XJ2YVR]) : Reflect.apply(string, intl, [t.SzGV0g])}
</Text>
</View>
);
items3[2] = ((Component) => <Component size="md" style={[styles.chevron]} />)(opened ? (require(12298) /* metro dependency 12298: ChevronSmallUpIcon */).ChevronSmallUpIcon : (require(8708) /* metro dependency 8708: ChevronSmallDownIcon */).ChevronSmallDownIcon);
return (
<TouchableHitBox onPress={onClick} style={items5}>
{items3}
</TouchableHitBox>
);
}
function EmptyActiveState() { // fn#101227, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:3074, offset: 0x0220d61d, size: 251 bytes, params: 1, frame: 24
const styles = useStyles();
const items2 = [styles.emptyState];
const Text = (TextModule).Text;
const intl = (IndexNativeModule).intl;
let string = intl.string;
const text = (
<Text variant="heading-sm/extrabold">
{Reflect.apply(string, intl, [(IndexNativeModule).t.reLFaV])}
</Text>
);
string = intl.string;
const ERdH1o = (IndexNativeModule).t.ERdH1o;
return (
<View style={items2}>
{text}
<Text variant="text-xs/normal">
{Reflect.apply(string, intl, [ERdH1o])}
</Text>
</View>
);
}
function EmptyExpiredState() { // fn#101228, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:3350, offset: 0x0220d718, size: 153 bytes, params: 1, frame: 21
const styles = useStyles();
const items2 = [styles.emptyState];
const Text = (TextModule).Text;
const intl = (IndexNativeModule).intl;
const string = intl.string;
const RV3AXf = (IndexNativeModule).t.RV3AXf;
return (
<View style={items2}>
<Text variant="text-xs/normal">
{Reflect.apply(string, intl, [RV3AXf])}
</Text>
</View>
);
}
function ClassificationDetail({classification}) { // fn#101229, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:3946, offset: 0x0220d7b1, size: 385 bytes, params: 2, frame: 25
const styles = useStyles();
const id = classification.id;
const description = classification.description;
const guild_metadata = classification.guild_metadata;
const value2 = (SnowflakeUtils).extractTimestamp(id);
const value3 = (UseIsNewClassificationModule).useIsNewClassification(classification);
const value4 = ReactModule.useMemo(_fun101230, [description, guild_metadata]);
const items3 = [styles.detailContainerOuter];
items3[1] = value3 ? styles.detailContainerOuterNew : null;
const items2 = [styles.detailContainerInner];
const r12 = (
value3
? (
<NewBadge_101244 />
)
: (
<RelativeIncidentTime timestamp={value2} />
)
);
const Text = (TextModule).Text;
return (
<View style={items3}>
<TouchableHitBox
onPress={function() {
importDefault(dependencyMap[19]).pushLazy(require(dependencyMap[21])(dependencyMap[20], dependencyMap.paths),
{classificationId: id, source: SafetyHubAnalyticsActionSource.StandingTab});
}}
>
<View style={items2}>
{r12}
<Text variant="heading-md/normal">
{value4}
</Text>
</View>
</TouchableHitBox>
</View>
);
function _fun101230() { // fn#101230, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:4129, offset: 0x0220d932, size: 378 bytes, params: 1, frame: 21
var environment;
var member_type;
var r1;
var r0;
const intl = (IndexNativeModule).intl;
var format;
const t = (IndexNativeModule).t;
var value2;
var value3;
var Lb0HVv;
var object;
const descriptionHook2 = descriptionHook;
const object2 = {};
var value;
object2.description = description;
object2.descriptionHook = descriptionHook2;
let guild_metadataBinding = guild_metadata;
if (guild_metadataBinding != null) {
guild_metadataBinding = guild_metadata;
value2 = undefined;
member_type = guild_metadataBinding == null ? value2 : guild_metadata.member_type;
value3 = environment.__proto__;
if (member_type === (require(5268) /* metro dependency 5268: SafetyHubModels */).MemberType.OWNER) {
format = intl.format;
Lb0HVv = t.Lb0HVv;
object = {};
copyDataProperties(object, object2, undefined);
object['guildName'] = guild_metadata == null ? value2 : guild_metadata.name;
r1 = Reflect.apply(format, intl, [Lb0HVv, object]);
} else {
r1 = intl.format(t.rmpEPD, {classification_type: description, classificationHook: descriptionHook2,
guildName: guild_metadata == null ? value2 : guild_metadata.name});
}
r0 = r1;
} else {
value = environment.__proto__;
value = intl.format(t.QY4g5t, object2);
r0 = value;
}
return r0;
function classificationHook_101231(a0, a1) { // fn#101231, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:4143, offset: 0x0220daac, size: 65 bytes, params: 3, frame: 15
const Text = (TextModule).Text;
return <Text {...{variant: 'heading-md/extrabold', children: a0}} key={a1} />;
}
}
}
function SafetyHubViolationsContainer({status, classifications}) { // fn#101233, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:4946, offset: 0x0220db52, size: 903 bytes, params: 2, frame: 43
var r14;
var r10;
var r5;
var items4;
var value14;
var jsxRuntimeEnv0_13Binding;
var items6;
var Text;
var intl;
const styles = useStyles();
const [property, env0_2] = Module00057(env0_4Binding.useState(false), 2);
var [property2, env0_4] = Module00057(env0_4Binding.useState(3), 2);
const value7 = (UseSafetyHubAccountStandingModule).useSafetyHubAccountStanding();
const isDsaEligible = (require(566) /* metro dependency 566: flux */).useStateFromStores([SafetyHubStore],
function() {
return SafetyHubStore.getIsDsaEligible();
});
const value8 = env0_4Binding.useMemo(_fun101235, [classifications, property2]);
env0_4Binding.useEffect(_fun101236, [property, value7.state, value8, isDsaEligible]);
let length = classifications.length;
const r32 = length - value8.length > 3 ? 3 : classifications.length - value8.length;
const items2 = [styles.container];
const safetyHubViolationsHeader = (
<SafetyHubViolationsHeader
status={status}
onClick={onClick_101238}
opened={property}
count={classifications.length}
/>
);
if (property) {
items4 = [
<View style={[styles.separator]} />,
];
length = value8.length;
items4[1] = length > 0 && value8.map(_fun101240);
length = value8.length;
value14 = length < classifications.length;
if (value14) {
jsxRuntimeEnv0_13Binding = jsxRuntimeEnv0_13;
items6 = [
<View style={[styles.separator]} />,
];
var viewBinding4Props = {style: [styles.moreButtonContainer]};
var pressableBindingProps = {style: [styles.moreButton], onPress: onPress_101241};
Text = (require(4573) /* metro dependency 4573: Text */).Text;
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
items6[1] = (
<View {...viewBinding4Props}>
<Pressable {...pressableBindingProps}>
<Text variant="heading-sm/semibold">
{intl.format((require(1244) /* metro dependency 1244: indexNative */).t['9Ml56H'],
{nextPageSize: r32})}
</Text>
</Pressable>
</View>
);
r14 = (
<>
{items6}
</>
);
} else {
r14 = value14;
}
items4[2] = r14;
length = value8.length;
r14 = length === 0 && status === 'active';
r14 = r14 && <EmptyActiveState />;
items4[3] = r14;
length = value8.length;
r10 = length === 0 && status === 'expired';
r10 = r10 && <EmptyExpiredState />;
items4[4] = r10;
r5 = (
<View>
{items4}
</View>
);
} else {
r5 = property;
}
return (
<View style={items2}>
{safetyHubViolationsHeader}
{r5}
</View>
);
function _fun101235() { // fn#101235, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:5219, offset: 0x0220deec, size: 26 bytes, params: 1, frame: 13
return classifications.slice(0, Module00057);
}
function _fun101236() { // fn#101236, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:5257, offset: 0x0220df06, size: 151 bytes, params: 1, frame: 18
var environment;
var value2;
var defaultImport;
var track;
var SAFETY_HUB_ACTION;
var object;
if (env0_1) {
value2 = environment.__proto__;
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
track = defaultImport.track;
SAFETY_HUB_ACTION = AnalyticEvents.SAFETY_HUB_ACTION;
object = {};
object.action = SafetyHubAnalyticsActions.ViewViolationsDropdown;
object.account_standing = env0_5.state;
object.classification_ids = env0_7.map(function(a0) {
var Number = global.Number;
return Number(a0.id);
});
object.source = SafetyHubAnalyticsActionSource.StandingTab;
object.is_violative_content_shown = false;
object.is_dsa_eligible = isDsaEligible;
Reflect.apply(track, defaultImport, [SAFETY_HUB_ACTION, object]);
}
}
function SafetyHubViolationsContainerOnClick() { // fn#101238, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:5626, owner: SafetyHubViolationsContainer.onClick, offset: 0x0220dfb6, size: 25 bytes, params: 1, frame: 11
return env0_2(function(a0) {
return !a0;
});
}
function _fun101240(a0) { // fn#101240, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:5731, offset: 0x0220dfcf, size: 37 bytes, params: 2, frame: 15
return <ClassificationDetail classification={a0} key={a0.id} />;
}
function SafetyHubViolationsContainerOnPress() { // fn#101241, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:5923, owner: SafetyHubViolationsContainer.onPress, offset: 0x0220dff4, size: 25 bytes, params: 1, frame: 11
return env0_4(_fun101242);
function _fun101242(a0) { // fn#101242, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:5930, offset: 0x0220e00d, size: 16 bytes, params: 2, frame: 2
return a0 + env1_8;
}
}
}
function RelativeIncidentTime({timestamp}) { // fn#101243, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:3551, offset: 0x0220e01d, size: 128 bytes, params: 2, frame: 20
const styles = useStyles();
const Text = (TextModule).Text;
return (
<View style={styles.incidentDate}>
<Text variant="text-xs/medium">
{(SafetyHubUtilsModule).getClassificationRelativeIncidentTime(timestamp)}
</Text>
</View>
);
}
function NewBadge_101244() { // fn#101244, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:3736, offset: 0x0220e09d, size: 175 bytes, params: 1, frame: 21
const styles = useStyles();
const items2 = [styles.incidentDate];
items2[1] = styles.incidentDateNew;
const Text = (TextModule).Text;
const intl = (IndexNativeModule).intl;
const string = intl.string;
const QKMRC4 = (IndexNativeModule).t.QKMRC4;
return (
<View style={items2}>
<Text
variant="text-xs/medium"
color="always-white"
style={styles.newText}
>
{Reflect.apply(string, intl, [QKMRC4])}
</Text>
</View>
);
}
function ConnectedSafetyHubViolationsContainer() { // fn#101245, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13468:6355, offset: 0x0220e14c, size: 192 bytes, params: 1, frame: 21
const styles = useStyles();
const value2 = (UseSafetyHubClassificationsModule).useActiveSafetyHubClassifications();
const value3 = (UseSafetyHubClassificationsModule).useExpiredSafetyHubClassifications();
return (
value2.length !== 0
? (
<View style={[styles.connectedContainer]}>
<SafetyHubViolationsContainer status="active" classifications={value2} />
<SafetyHubViolationsContainer status="expired" classifications={value3} />
</View>
)
: (
value3.length === 0
? null
: (
<View style={[styles.connectedContainer]}>
<SafetyHubViolationsContainer status="active" classifications={value2} />
<SafetyHubViolationsContainer status="expired" classifications={value3} />
</View>
)
)
);
}
}
global.__d(_fun101225, 13278, [57, 31, 27, 11473, 5267, 661, 33, 4501, 697, 8792, 8129, 4573, 1244, 12298, 8708,
5266, 21, 13279, 5268, 5080, 11470, 1962, 11481, 566, 683, 11479,
2]) /* metro module 13278, dependencies: [57, 31, 27, 11473, 5267, 661, 33, 4501, 697, 8792, 8129, 4573, 1244, 12298, 8708, 5266, 21, 13279, 5268, 5080, 11470, 1962, 11481, 566, 683, 11479, 2] */;