decord/source/modules/user_profile/native/UserProfileCustomStatusBubble.tsx
github-actions 67d978d9fb chore: update source for alpha 346.0
Skipped 1 file(s) >100MB (GitHub limit): source/__vendor/09xxx/9672_m.js (378.6 MB)
2026-09-07 16:44:02 +00:00

509 lines
18 KiB
TypeScript

// Module ID: 11117
// Function ID: 11118
// Name: StatusBubbleConnector
// Dependencies: [32, 19, 17, 7208, 1374, 1085, 21, 4560, 576, 8456, 1935, 5587, 1396, 1115, 4556, 7130, 4262, 8190, 10885, 10124, 4527, 11118, 7182, 1114, 5123, 11209, 2]
// Module 11117 (StatusBubbleConnector)
import ThemesDefault from "Themes" /* 576 */;
import set from "set" /* 1115 */;
import getAvatarURLDefault from "getAvatarURL" /* 1396 */;
import explicitContentFromProto from "explicitContentFromProto" /* 1935 */;
import Text from "Text" /* 4556 */;
import preloadDefault from "preload" /* 5587 */;
import EmojiDefault from "Emoji" /* 7130 */;
import inlineStyles from "inlineStyles" /* 8456 */;
import inlineStylesDefault from "inlineStyles" /* 8456 */;
import closure_3 from "_slicedToArray" /* 32 */;
import importAllResult from "noop" /* 19 */;
import get_ActivityIndicator from "get ActivityIndicator" /* 17 */;
import { EMOJI_URL_BASE_SIZE } from "set" /* 1374 */;
import { Fonts } from "sum" /* 1085 */;
import jsxProd from "jsxProd" /* 21 */;
import createCacheKey from "createCacheKey" /* 4560 */;
require = arg1;
function StatusBubbleConnector(arg0) {
({ backgroundColor, borderColor, style } = arg0);
const obj = { pointerEvents: "none", style, width: 20, height: 11, viewBox: "0 0 20 11", children: null };
const items = [callback(inlineStyles.Path, { d: "M0 10 A10 10 0 0 1 20 10 L20 11 L0 11 Z", fill: backgroundColor }), callback(inlineStyles.Path, { d: "M0.5 10 A9.5 9.5 0 0 1 19.5 10", fill: "none", stroke: borderColor, strokeWidth: 1 })];
obj[5] = items;
return callback2(inlineStylesDefault, obj);
}
function EmojiImage(id) {
({ size, animated } = id);
if (animated === undefined) {
animated = false;
}
const AnimateEmoji = explicitContentFromProto.AnimateEmoji;
const setting = AnimateEmoji.useSetting();
let obj = { style: items, source: null, resizeMode: "contain" };
items = [{ height: size, width: size }, id.style];
const tmp2 = closure_9;
const tmp3 = preloadDefault;
obj = { id: id.emojiId, animated: null, size: null };
const obj2 = getAvatarURLDefault;
obj = { uri: obj2.getEmojiURL(obj) };
obj[1] = Boolean(animated) && setting;
obj[2] = EMOJI_URL_BASE_SIZE;
obj[1] = obj;
return tmp2(tmp3, obj);
}
function TextStatusContent(arg0) {
({ emoji, lineHeight, isPlaceholderText } = arg0);
({ text, textVariant, lineClamp, onTextLayout } = arg0);
if (isPlaceholderText === undefined) {
isPlaceholderText = false;
}
let obj = { paddingVertical: lineHeight / 10 };
if (!isPlaceholderText) {
const merged = Object.assign(isPlaceholderText);
obj = { variant: null, color: "text-default", lineClamp: null, onTextLayout: null, style: null, children: null };
obj[0] = textVariant;
obj[2] = lineClamp;
obj[3] = onTextLayout;
obj[4] = obj;
let id;
if (emoji != null) {
id = emoji.id;
}
if (null != id) {
obj = { children: null };
obj1 = { children: null };
const obj2 = { emojiId: null, size: null, animated: null, style: null };
obj2[0] = emoji.id;
obj2[1] = 0.9 * lineHeight;
obj2[2] = emoji.animated;
const obj3 = { marginBottom: null };
obj3[0] = 0.1 * -lineHeight;
obj2[3] = obj3;
obj1[0] = callback(EmojiImage, obj2);
const items = [callback(closure_6, obj1), ];
const obj4 = { style: null };
const obj5 = { width: null };
obj5[0] = 0.5 * lineHeight;
obj4[0] = obj5;
items[1] = callback(closure_6, obj4);
obj[0] = items;
let tmp8Result = tmp8(closure_11, obj);
} else {
let name;
if (emoji != null) {
name = emoji.name;
}
tmp8Result = null;
if (null != name) {
const obj6 = { children: null };
const items1 = [emoji.name, ];
const obj7 = { style: null };
const obj8 = { width: null };
obj8[0] = 0.4 * lineHeight;
obj7[0] = obj8;
items1[1] = callback(closure_6, obj7);
obj6[0] = items1;
tmp8Result = tmp8(closure_11, obj6);
}
}
const items2 = [tmp8Result, text];
obj[5] = items2;
return closure_10(Text.Text, obj);
} else {
obj1 = set;
if (obj1.isAndroid()) {
const obj9 = { fontFamily: null };
obj9[0] = Fonts.PRIMARY_NORMAL_ITALIC;
let obj10 = obj9;
} else {
obj10 = { fontStyle: "italic" };
}
}
}
function EmojiOnlyStatusContent(arg0) {
({ emoji, size } = arg0);
const AnimateEmoji = explicitContentFromProto.AnimateEmoji;
let id;
const setting = AnimateEmoji.useSetting();
if (emoji != null) {
id = emoji.id;
}
let emojiURL;
if (null != id) {
let obj = getAvatarURLDefault;
obj = { id: null, animated: null, size: null };
obj[0] = emoji.id;
let animated;
if (emoji != null) {
animated = emoji.animated;
}
obj[1] = Boolean(animated) && setting;
obj[2] = EMOJI_URL_BASE_SIZE;
emojiURL = obj.getEmojiURL(obj);
const tmp9 = Boolean(animated) && setting;
}
obj = { style: callback3().container, children: null };
obj1 = { textEmojiStyle: { fontSize: size }, fastImageStyle: { width: size, height: size }, src: emojiURL, name: null };
let str;
const tmp = callback3();
const tmp12 = closure_6;
if (emoji != null) {
str = emoji.name;
}
if (str == null) {
str = "";
}
obj1[3] = str;
obj[1] = closure_9(EmojiDefault, obj1);
return closure_9(tmp12, obj);
}
let c4 = importAllResult;
({ PixelRatio: c5, View: closure_6 } = get_ActivityIndicator);
({ jsx: c9, jsxs: c10, Fragment: unpackModuleId } = jsxProd);
let closure_12 = createCacheKey.createStyles((arg0) => {
let obj = { container: { position: "relative" }, bubble: null, statusBubble: null, statusBubbleMeasureable: null, smallCircle: null, largeCircle: null, addStatusIconSpacer: null, statusBubbleLeftAligned: null };
const colors = ThemesDefault.colors;
if (arg0) {
let BACKGROUND_SURFACE_HIGH = colors.CUSTOM_STATUS_BUBBLE_BG;
let tmp4 = tmp;
} else {
BACKGROUND_SURFACE_HIGH = colors.BACKGROUND_SURFACE_HIGH;
tmp4 = tmp;
}
obj = { backgroundColor: BACKGROUND_SURFACE_HIGH, borderColor: null, borderWidth: 1 };
const colors2 = tmp4(576).colors;
obj[1] = arg0 ? colors2.BORDER_MUTED : colors2.BORDER_SUBTLE;
obj[1] = obj;
obj = { alignSelf: "flex-start", alignItems: "center", justifyContent: "center", borderRadius: tmp4(576).radii.lg };
const merged = Object.assign(tmp4(576).shadows.SHADOW_LOW);
obj.top = -14;
obj[2] = obj;
obj[3] = { position: "absolute", top: 0, left: 0, opacity: 0 };
const merged1 = Object.assign(tmp4(576).shadows.SHADOW_LOW);
obj[4] = { position: "absolute", top: -30, width: 12, height: 12, borderRadius: tmp4(576).radii.round };
obj[5] = { position: "absolute", top: -10, left: 12, width: 20, height: 11 };
obj[6] = { width: 6 };
obj[7] = { alignItems: "flex-start" };
return obj;
});
let closure_14 = { textVariant: "text-md/normal", emojiOnlyEmojiSize: 32, textMinWidth: 42, statusBubblePaddingHorizontal: 12, statusBubblePaddingVertical: 7 };
let closure_15 = { [arg1(7208).UserProfileThemeTypes.PREVIEW]: { textVariant: "text-sm/normal", emojiOnlyEmojiSize: 26, textMinWidth: 53, statusBubblePaddingHorizontal: 10, statusBubblePaddingVertical: 6 } };
let closure_18 = createCacheKey.createStyles(() => ({ container: { alignItems: "center" } }));
const forwardRefResult = importAllResult.forwardRef((showFullStatus, ref) => {
({ customStatusActivity, themeType, hasCustomProfileTheme, editEnabled } = showFullStatus);
showFullStatus = showFullStatus.showFullStatus;
const _require = tmp2;
({ onPressTruncatedStatus, previewEmoji, previewText, placeholderText, prompt: importDefault } = showFullStatus);
({ style, emojiOnlyStyle } = showFullStatus);
const tmp3 = scaledTextLineHeight(hasCustomProfileTheme);
let obj = _require(textVariant[16]);
const colors = importDefault(textVariant[8]).colors;
if (hasCustomProfileTheme) {
let BACKGROUND_SURFACE_HIGH = colors.CUSTOM_STATUS_BUBBLE_BG;
let tmp7 = tmp6;
let tmp8 = tmp6;
} else {
BACKGROUND_SURFACE_HIGH = colors.BACKGROUND_SURFACE_HIGH;
tmp7 = tmp6;
tmp8 = tmp6;
}
const token = obj.useToken(BACKGROUND_SURFACE_HIGH);
let tmp4Result = tmp4(tmp5[16]);
const colors2 = tmp8(tmp5[8]).colors;
let tmp11;
const token1 = tmp4Result.useToken(hasCustomProfileTheme ? colors2.BORDER_MUTED : colors2.BORDER_SUBTLE);
if (null != themeType) {
tmp11 = table[themeType];
}
if (tmp11 == null) {
tmp11 = closure_14;
}
textVariant = tmp11.textVariant;
const emojiOnlyEmojiSize = tmp11.emojiOnlyEmojiSize;
({ statusBubblePaddingHorizontal, statusBubblePaddingVertical, textMinWidth } = tmp11);
tmp4Result = tmp4(tmp5[17]);
const trackUserProfileAction = tmp4Result.useUserProfileAnalyticsContext().trackUserProfileAction;
if (undefined === previewText) {
let state;
if (customStatusActivity != null) {
state = customStatusActivity.state;
}
previewText = state;
}
const gameMentionsAsPlainText = _require(textVariant[18]).useGameMentionsAsPlainText(previewText);
let tmp15 = null != gameMentionsAsPlainText;
if (tmp15) {
tmp15 = "" !== gameMentionsAsPlainText;
}
if (undefined === previewEmoji) {
let emoji;
if (customStatusActivity != null) {
emoji = customStatusActivity.emoji;
}
previewEmoji = emoji;
}
let tmp18 = tmp17;
if (null != previewEmoji) {
tmp18 = !tmp15;
}
closure_6 = tmp18;
let tmp19 = !tmp15;
if (!tmp15) {
tmp19 = !tmp17;
}
if (tmp19) {
tmp19 = undefined !== placeholderText;
}
if (tmp19) {
tmp19 = "" !== placeholderText;
}
closure_7 = tmp19;
let str4 = gameMentionsAsPlainText;
if (tmp19) {
str4 = placeholderText;
}
let tmp20 = null != str4;
if (tmp20) {
tmp20 = "" !== str4;
}
const callback = tmp20;
if (!tmp15) {
tmp15 = tmp17;
}
if (!tmp15) {
let tmp21 = !tmp;
if (!tmp) {
tmp21 = tmp19;
}
tmp15 = tmp21;
}
let tmp22 = !tmp15;
if (!tmp15) {
tmp22 = tmp;
}
let obj4 = trackUserProfileAction;
const tmp23 = emojiOnlyEmojiSize(trackUserProfileAction.useState(false), 2);
closure_10 = tmp23[1];
let num = 0;
if (tmp20) {
num = textMinWidth;
}
obj = { minWidth: num, minHeight: null, paddingVertical: null, paddingHorizontal: null };
let num2 = 0;
if (tmp18) {
num2 = emojiOnlyEmojiSize + 2 * statusBubblePaddingVertical;
}
obj[1] = num2;
if (tmp20) {
let num3 = statusBubblePaddingVertical;
} else {
num3 = 0;
}
obj[2] = num3;
obj[3] = statusBubblePaddingHorizontal;
obj = { top: statusBubblePaddingVertical, bottom: statusBubblePaddingVertical, left: statusBubblePaddingHorizontal, right: statusBubblePaddingHorizontal };
ref = obj4.useRef(null);
const imperativeHandle = obj4.useImperativeHandle(ref, () => ref.current);
const tmp4Result1 = _require(textVariant[18]);
scaledTextLineHeight = _require(textVariant[19]).useScaledTextLineHeight(textVariant);
if (!tmp15) {
if (!tmp22) {
return null;
}
}
let name;
if (previewEmoji != null) {
name = previewEmoji.name;
}
obj1 = { text: null };
let items = [name, str4];
const found = items.filter((arg0) => null != arg0);
obj1[0] = found.join(" ");
const items1 = [style, ];
let tmp30;
if (tmp18) {
tmp30 = emojiOnlyStyle;
}
const obj2 = { style: items1, children: null };
items1[1] = tmp30;
const items2 = [, ];
({ bubble: arr3[0], smallCircle: arr3[1] } = tmp3);
const items3 = [callback(closure_6, { style: items2 }), , ];
let tmp31Result;
if (null != onPressTruncatedStatus) {
if (!tmp2) {
if (tmp20) {
const obj3 = { style: null, children: null };
const items4 = [, , , ];
({ bubble: arr5[0], statusBubble: arr5[1] } = tmp3);
items4[2] = obj;
items4[3] = tmp3.statusBubbleMeasureable;
obj3[0] = items4;
obj4 = { text: null, isPlaceholderText: null, emoji: null, textVariant: null, onTextLayout: null, lineHeight: null };
obj4[0] = str4;
obj4[1] = tmp19;
obj4[2] = previewEmoji;
obj4[3] = textVariant;
obj4[4] = function onTextLayout(nativeEvent) {
callback3(nativeEvent.nativeEvent.lines.length > Math.ceil(2 * previewEmoji.getFontScale()));
};
obj4[5] = scaledTextLineHeight;
obj3[1] = tmp31(TextStatusContent, obj4);
tmp31Result = tmp31(tmp29, obj3);
}
}
}
items3[1] = tmp31Result;
const items5 = [, , , ];
({ bubble: arr6[0], statusBubble: arr6[1] } = tmp3);
items5[2] = obj;
let statusBubbleLeftAligned = !tmp18;
if (!tmp18) {
statusBubbleLeftAligned = tmp3.statusBubbleLeftAligned;
}
function handlePressAddOrEditStatus() {
trackUserProfileAction({ action: "PRESS_EDIT_CUSTOM_STATUS" });
let obj = closure_1_1(textVariant[20]);
obj.hideActionSheet();
obj = { analyticsLocations: null, prompt: null };
const items = [closure_1_1(textVariant[22]).USER_PROFILE_CUSTOM_STATUS_BUBBLE];
obj[0] = items;
obj[1] = closure_1;
const result = callback(textVariant[21]).openEditCustomStatusModal(obj);
}
const obj5 = { style: items5, ref, children: null };
items5[3] = statusBubbleLeftAligned;
const items6 = [callback(StatusBubbleConnector, { style: tmp3.largeCircle, backgroundColor: token, borderColor: token1 }), ];
if (tmp22) {
let stringResult = placeholderText;
if (!tmp19) {
const intl3 = tmp4(tmp5[23]).intl;
stringResult = intl3.string(tmp4(tmp5[23]).t.Vq4UmS);
}
const obj7 = { accessibilityRole: "button", accessibilityLabel: null, accessibilityHint: null, onPress: null, hitSlop: null, children: null };
const intl4 = tmp4(tmp5[23]).intl;
obj7[1] = intl4.string(tmp4(tmp5[23]).t["zrpF/b"]);
let formatToPlainStringResult;
if (tmp19) {
const intl5 = tmp4(tmp5[23]).intl;
const obj8 = { prompt: null };
obj8[0] = placeholderText;
formatToPlainStringResult = intl5.formatToPlainString(tmp4(tmp5[23]).t.ioWOMP, obj8);
}
obj7[2] = formatToPlainStringResult;
obj7[3] = handlePressAddOrEditStatus;
obj7[4] = obj;
let str7 = "text-md/medium";
if (tmp19) {
str7 = "text-md/normal";
}
const obj9 = { variant: null, color: "control-secondary-text-default", lineClamp: null, style: null, children: null };
obj9[0] = str7;
let _Math = Math;
obj9[2] = Math.ceil(2 * previewEmoji.getFontScale());
const obj10 = { paddingVertical: null };
obj10[0] = scaledTextLineHeight / 10;
if (!tmp19) {
const merged = Object.assign(tmp19);
obj9[3] = obj10;
const obj11 = { color: null, size: "xs", style: null };
obj11[0] = tmp7(tmp5[8]).colors.CONTROL_SECONDARY_TEXT_DEFAULT;
let tmp44;
if (tmp4Result3.isAndroid()) {
const obj12 = { marginBottom: null };
obj12[0] = 0.1 * -scaledTextLineHeight;
tmp44 = obj12;
}
const obj13 = { children: null };
obj11[2] = tmp44;
obj13[0] = tmp31(tmp4(tmp5[25]).CirclePlusIcon, obj11);
const items7 = [tmp31(tmp29, obj13), , ];
const obj14 = { style: null };
obj14[0] = tmp3.addStatusIconSpacer;
items7[1] = tmp31(tmp29, obj14);
items7[2] = stringResult;
obj9[4] = items7;
obj7[5] = tmp28(tmp4(tmp5[14]).Text, obj9);
tmp31Result = tmp31(tmp4(tmp5[24]).PressableOpacity, obj7);
tmp4Result3 = tmp4(tmp5[13]);
} else {
if (tmp4Result4.isAndroid()) {
const obj15 = { fontFamily: null };
obj15[0] = str4.PRIMARY_NORMAL_ITALIC;
let obj16 = obj15;
} else {
obj16 = { fontStyle: "italic" };
}
tmp4Result4 = tmp4(tmp5[13]);
}
} else {
function renderStatusContent() {
if (callback2) {
let obj = { text: null, isPlaceholderText: null, emoji: null, textVariant: null, lineClamp: null, lineHeight: null };
obj[0] = str4;
obj[1] = closure_7;
obj[2] = previewEmoji;
obj[3] = textVariant;
let rounded;
if (!closure_0) {
const _Math = Math;
rounded = Math.ceil(2 * previewEmoji.getFontScale());
}
obj[4] = rounded;
obj[5] = scaledTextLineHeight;
let tmp7Result = callback2(closure_1_17, obj);
const tmp7 = callback2;
const tmp8 = closure_1_17;
} else if (closure_6) {
obj = { emoji: null, size: null };
obj[0] = previewEmoji;
obj[1] = emojiOnlyEmojiSize;
tmp7Result = callback2(closure_1_19, obj);
}
return tmp7Result;
}
if (tmp) {
const obj17 = { accessibilityRole: "button", accessibilityLabel: null, accessibilityValue: null, onPress: null, hitSlop: null, children: null };
const intl2 = tmp4(tmp5[23]).intl;
obj17[1] = intl2.string(tmp4(tmp5[23]).t.QdHxos);
obj17[2] = obj1;
obj17[3] = handlePressAddOrEditStatus;
obj17[4] = obj;
obj17[5] = renderStatusContent();
tmp31Result = tmp31(tmp4(tmp5[24]).PressableOpacity, obj17);
} else {
if (null != onPressTruncatedStatus) {
if (tmp23[0]) {
if (!tmp19) {
const intl = tmp4(tmp5[23]).intl;
let str6;
if (previewEmoji != null) {
str6 = previewEmoji.name;
}
if (str6 == null) {
str6 = "";
}
const obj18 = { emoji: null, status: null };
obj18[0] = str6;
if (str4 == null) {
str4 = "";
}
const obj19 = { accessibilityRole: "button", accessibilityLabel: null, onPress: null, hitSlop: null, children: null };
obj18[1] = str4;
obj19[1] = intl.formatToPlainString(tmp4(tmp5[23]).t.UpF5Qa, obj18);
obj19[2] = onPressTruncatedStatus;
obj19[3] = obj;
obj19[4] = renderStatusContent();
tmp31Result = tmp31(tmp4(tmp5[24]).PressableOpacity, obj19);
}
}
}
tmp31Result = renderStatusContent();
}
}
items6[1] = tmp31Result;
obj5[2] = items6;
items3[2] = closure_10(closure_6, obj5);
obj2[1] = items3;
return closure_10(closure_6, obj2);
});
let result = require("set").fileFinishedImporting("modules/user_profile/native/UserProfileCustomStatusBubble.tsx");
export default forwardRefResult;