decord/source/components_native/chat/ChatItem.tsx

216 lines
7.3 KiB
TypeScript
Raw Normal View History

2026-07-31 08:44:05 +00:00
// Module ID: 9301
// Function ID: 9302
2026-07-20 16:05:17 +00:00
// Name: DCDChatItem
2026-07-31 08:44:05 +00:00
// Dependencies: [32, 19, 17, 4185, 676, 7719, 21, 4057, 9302, 9303, 9304, 686, 5927, 4193, 712, 500, 7910, 3897, 689, 4615, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-31 08:44:05 +00:00
// Module 9301 (DCDChatItem)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
2026-07-29 08:29:29 +00:00
import LinearGradient from "LinearGradient";
import get_ActivityIndicator from "map";
import maybeApplyNoTextColorForLightCustomTheme from "maybeApplyNoTextColorForLightCustomTheme";
2026-07-23 10:11:24 +00:00
import { MessageTypes } from "ME";
import Changeset from "Changeset";
import jsxProd from "jsxProd";
import isFabric from "isFabric";
import isFabric from "isFabric";
import isFabric from "isFabric";
2026-07-29 08:29:29 +00:00
import createCacheKey from "createCacheKey";
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
let c10;
let c5;
let c9;
let metroImportAll;
2026-07-20 16:05:17 +00:00
let requireNativeComponent;
2026-07-29 08:29:29 +00:00
let unpackModuleId;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function DCDChatItem(message) {
message = message.message;
2026-07-29 08:29:29 +00:00
const merged = Object.assign(message, Object.create(null));
2026-07-20 16:05:17 +00:00
if (message.type === MessageTypes.AUTO_MODERATION_ACTION) {
2026-07-29 08:29:29 +00:00
let obj = {};
2026-07-20 16:05:17 +00:00
const merged1 = Object.assign(merged);
2026-07-29 08:29:29 +00:00
let tmp3Result = callback(_default3, obj);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const AUTOMOD_INCIDENT_ACTIONS = require(686) /* set */.MessageTypesSets.AUTOMOD_INCIDENT_ACTIONS;
2026-07-20 16:05:17 +00:00
if (AUTOMOD_INCIDENT_ACTIONS.has(message.type)) {
2026-07-29 08:29:29 +00:00
obj = {};
2026-07-20 16:05:17 +00:00
const merged2 = Object.assign(merged);
2026-07-29 08:29:29 +00:00
tmp3Result = callback(_default, obj);
2026-07-31 08:44:05 +00:00
} else if (importDefault(5927)(message)) {
2026-07-29 08:29:29 +00:00
const obj1 = {};
2026-07-20 16:05:17 +00:00
const merged3 = Object.assign(merged);
2026-07-29 08:29:29 +00:00
tmp3Result = tmp3(_default2, obj1);
2026-07-20 16:05:17 +00:00
} else {
obj = {};
const merged4 = Object.assign(merged);
2026-07-29 08:29:29 +00:00
tmp3Result = tmp3(_default, obj);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
return tmp3Result;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
({ requireNativeComponent, View: c5 } = get_ActivityIndicator);
({ RowType: metroImportAll, Changeset: c9 } = Changeset);
({ jsx: c10, jsxs: unpackModuleId } = jsxProd);
2026-07-23 10:11:24 +00:00
if (isFabric.isFabric()) {
let _default = require("__INTERNAL_VIEW_CONFIG").default;
2026-07-20 16:05:17 +00:00
} else {
_default = requireNativeComponent("DCDMessageView");
}
2026-07-23 10:11:24 +00:00
if (isFabric.isFabric()) {
let _default2 = require("__INTERNAL_VIEW_CONFIG").default;
2026-07-20 16:05:17 +00:00
} else {
_default2 = requireNativeComponent("DCDSystemMessageView");
}
2026-07-23 10:11:24 +00:00
if (isFabric.isFabric()) {
let _default3 = require("__INTERNAL_VIEW_CONFIG").default;
2026-07-20 16:05:17 +00:00
} else {
_default3 = requireNativeComponent("DCDAutoModerationSystemMessageView");
}
2026-07-29 08:29:29 +00:00
let closure_16 = createCacheKey.createStyles((marginLeft, marginTop) => {
2026-07-20 16:05:17 +00:00
const offset = { marginTop: -marginTop, marginLeft: -marginLeft };
2026-07-23 10:11:24 +00:00
return { container: { position: "relative", overflow: "hidden" }, offset, gradient: { position: "absolute", bottom: 0, height: 24, width: "100%" }, itemRow: { backgroundColor: "transparent" } };
2026-07-20 16:05:17 +00:00
});
2026-07-23 10:11:24 +00:00
const result = require("get ActivityIndicator").fileFinishedImporting("components_native/chat/ChatItem.tsx");
2026-07-20 16:05:17 +00:00
export default function _default(rowGenerator) {
let backgroundColor;
2026-07-24 07:16:23 +00:00
let c6;
2026-07-20 16:05:17 +00:00
let maxHeight;
let modifyRow;
let pointerEvents;
let tmp4;
rowGenerator = rowGenerator.rowGenerator;
const message = rowGenerator.message;
let num = rowGenerator.horizontalOffset;
if (num === undefined) {
num = 8;
}
({ maxHeight, modifyRow } = rowGenerator);
const onLayout = rowGenerator.onLayout;
const messageSizeCacheRef = rowGenerator.messageSizeCacheRef;
({ backgroundColor, pointerEvents } = rowGenerator);
if (backgroundColor === undefined) {
2026-07-23 10:11:24 +00:00
backgroundColor = message(modifyRow[14]).colors.BACKGROUND_BASE_LOWER;
2026-07-20 16:05:17 +00:00
}
2026-07-24 07:16:23 +00:00
const gradientColors = rowGenerator.gradientColors;
2026-07-23 10:11:24 +00:00
let roleStyle;
2026-07-24 07:16:23 +00:00
let first;
let closure_8;
roleStyle = undefined;
2026-07-20 16:05:17 +00:00
let rawRow;
let token;
2026-07-29 08:29:29 +00:00
let obj = messageSizeCacheRef;
2026-07-24 07:16:23 +00:00
[tmp4, c6] = onLayout(messageSizeCacheRef.useState(0), 2);
2026-07-23 10:11:24 +00:00
const tmp5 = onLayout(messageSizeCacheRef.useState(undefined), 2);
first = tmp5[0];
2026-07-24 07:16:23 +00:00
closure_8 = tmp5[1];
roleStyle = roleStyle.roleStyle;
2026-07-23 10:11:24 +00:00
let items = [first, roleStyle, message, modifyRow, rowGenerator];
const memo = messageSizeCacheRef.useMemo(() => {
2026-07-20 16:05:17 +00:00
let obj = { constrainedWidth: first };
rowGenerator.setOptions(obj);
2026-07-24 07:16:23 +00:00
obj = { roleStyle, rowType: lib.MESSAGE, changeType: roleStyle.NOOP, message, isFirst: true, canShowImages: true, canAddNewReactions: false };
2026-07-20 16:05:17 +00:00
const generateResult = rowGenerator.generate(obj);
if (null != modifyRow) {
2026-07-29 08:29:29 +00:00
tmp3(generateResult);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { rawRow: generateResult, row: null };
2026-07-20 16:05:17 +00:00
let json = generateResult;
if (obj4.isFabric()) {
const _JSON = JSON;
const obj1 = { index: 0 };
const merged = Object.assign(generateResult);
json = JSON.stringify(obj1);
}
2026-07-29 08:29:29 +00:00
obj[1] = json;
2026-07-20 16:05:17 +00:00
return obj;
}, items);
rawRow = memo.rawRow;
const items1 = [rawRow.contextType];
2026-07-23 10:11:24 +00:00
const memo1 = messageSizeCacheRef.useMemo(() => {
2026-07-20 16:05:17 +00:00
let num = 0;
if (!obj.isAndroid()) {
let num2 = 16;
if (rawRow.contextType === rowGenerator(modifyRow[16]).MessageContextType.SEARCH) {
num2 = 12;
}
num = num2;
}
return num;
}, items1);
2026-07-23 10:11:24 +00:00
const tmp9 = callback2(num, memo1);
2026-07-20 16:05:17 +00:00
const items2 = [onLayout];
const items3 = [messageSizeCacheRef, message.id];
2026-07-23 10:11:24 +00:00
const callback = messageSizeCacheRef.useCallback((nativeEvent) => {
2026-07-24 07:16:23 +00:00
lib(nativeEvent.nativeEvent.layout.width);
2026-07-29 08:29:29 +00:00
if (onLayout != null) {
2026-07-20 16:05:17 +00:00
onLayout(nativeEvent);
}
}, items2);
2026-07-29 08:29:29 +00:00
let tmp14Result = null != maxHeight;
2026-07-23 10:11:24 +00:00
const callback1 = messageSizeCacheRef.useCallback((nativeEvent) => {
2026-07-20 16:05:17 +00:00
const height = nativeEvent.nativeEvent.layout.height;
if (height > 0) {
if (null != messageSizeCacheRef) {
2026-07-29 08:29:29 +00:00
if (tmp.current[message.id] !== height) {
tmp.current[tmp3.id] = height;
2026-07-20 16:05:17 +00:00
}
}
_undefined(height);
}
}, items3);
2026-07-29 08:29:29 +00:00
if (tmp14Result) {
tmp14Result = tmp4 - memo1 >= maxHeight;
2026-07-20 16:05:17 +00:00
}
let tmp13;
2026-07-29 08:29:29 +00:00
if (messageSizeCacheRef != null) {
2026-07-20 16:05:17 +00:00
const current = messageSizeCacheRef.current;
2026-07-29 08:29:29 +00:00
if (current != null) {
2026-07-20 16:05:17 +00:00
tmp13 = current[message.id];
}
}
2026-07-29 08:29:29 +00:00
if (tmp14Result) {
2026-07-20 16:05:17 +00:00
tmp13 = maxHeight;
}
2026-07-24 07:16:23 +00:00
obj = { style: tmp9.offset, onLayout: callback1, children: rawRow(DCDChatItem, obj) };
2026-07-20 16:05:17 +00:00
obj = { message, row: memo.row, style: tmp9.itemRow };
2026-07-29 08:29:29 +00:00
const tmp14 = rawRow;
const tmp15 = gradientColors;
2026-07-23 10:11:24 +00:00
const tmp3 = onLayout(messageSizeCacheRef.useState(0), 2);
2026-07-29 08:29:29 +00:00
const tmp16 = rawRow(gradientColors, obj);
const tmp17 = modifyRow;
token = rowGenerator(modifyRow[17]).useToken(backgroundColor);
2026-07-24 07:16:23 +00:00
const items4 = [gradientColors, token];
2026-07-29 08:29:29 +00:00
let obj1 = { style: items5, onLayout: callback, pointerEvents, children: null };
items5 = [tmp9.container, rowGenerator.style, { height: tmp13 }];
let tmp21 = null != first;
const memo2 = obj.useMemo(() => {
let tmp = gradientColors;
if (gradientColors == null) {
2026-07-24 07:16:23 +00:00
const obj = message(modifyRow[18])(token);
2026-07-29 08:29:29 +00:00
const items = [message(modifyRow[18])(token).alpha(0).hex(), token];
tmp = items;
2026-07-24 07:16:23 +00:00
const alphaResult = message(modifyRow[18])(token).alpha(0);
}
2026-07-29 08:29:29 +00:00
return tmp;
2026-07-20 16:05:17 +00:00
}, items4);
2026-07-29 08:29:29 +00:00
if (tmp21) {
tmp21 = tmp16;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const items6 = [tmp21, ];
if (tmp14Result) {
const obj2 = { colors: null, style: null };
obj2[0] = memo2;
2026-07-20 16:05:17 +00:00
const items7 = [tmp9.gradient, rowGenerator.gradientStyles];
2026-07-29 08:29:29 +00:00
obj2[1] = items7;
tmp14Result = tmp14(message(tmp17[19]), obj2);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
items6[1] = tmp14Result;
obj1[3] = items6;
return token(tmp15, obj1);
2026-07-20 16:05:17 +00:00
};
export const DCDMessageView = _default;
export const DCDSystemMessageView = _default2;
export const DCDAutoModerationSystemMessageView = _default3;