Files
discord-decomp/sources/components_native/chat/ImageCarousel.tsx
T
2026-07-27 16:20:00 +03:00

398 lines
22 KiB
TypeScript

/* Metro module 11091; source: components_native/chat/ImageCarousel.tsx; dependencies: [31, 27, 4645, 4644, 11092, 33, 4501, 697, 4017, 4504, 1305, 4577, 44, 4650, 566, 11093, 11143, 11158, 8670, 4573, 1244, 9376, 8999, 5278, 8523, 1478, 7879, 11095, 2] */
function _fun84913(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#84913, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:6, offset: 0x01f5c00e, size: 1003 bytes, params: 8, frame: 29
var object2;
const env0_0 = require;
const closure = useTileEntranceAnimatedStyle;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = importAll(31) /* metro dependency 31 */;
const value2 = require(27) /* metro dependency 27 */;
const env0_4 = value2.View;
const StyleSheet = value2.StyleSheet;
const env0_5 = value2.ScrollView;
const env0_6 = (require(4645) /* metro dependency 4645: DraftStore */).DraftType;
const uploadAttachmentStore = importDefault(4644) /* metro dependency 4644: UploadAttachmentStore */;
const imageCarouselConstantsModule = require(11092) /* metro dependency 11092: ImageCarouselConstants */;
const IMAGE_CAROUSEL_EXPERIMENT_TILE_MARGIN = imageCarouselConstantsModule.IMAGE_CAROUSEL_EXPERIMENT_TILE_MARGIN;
const IMAGE_CAROUSEL_TILE_CLOSE_BUTTON_PADDING = imageCarouselConstantsModule.IMAGE_CAROUSEL_TILE_CLOSE_BUTTON_PADDING;
const env0_10 = imageCarouselConstantsModule.IMAGE_CAROUSEL_TILE_HEIGHT;
const value4 = require(33) /* metro dependency 33 */;
const env0_11 = value4.jsx;
const env0_12 = value4.jsxs;
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = createStylesModule.createStyles;
object2 = {};
object2.container = {width: '100%'};
object2.pressableContainer = {marginHorizontal: 4};
const object3 = {'position': 'relative', 'minWidth': 60, 'backgroundColor': null, 'overflow': 'hidden'};
let BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
object3.backgroundColor = BACKGROUND_SURFACE_HIGH;
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.md - 1;
object2.tileContainer = object3;
const object6 = {};
copyDataProperties(object6, StyleSheet.absoluteFillObject, undefined);
object6['flex'] = 1;
object6['flexDirection'] = 'row';
object6['justifyContent'] = 'space-between';
object6['alignItems'] = 'flex-end';
object6['padding'] = 4;
object2.decorationsContainer = object6;
const INTERACTIVE_TEXT_ACTIVE = (importDefault(697) /* metro dependency 697: native */).colors.INTERACTIVE_TEXT_ACTIVE;
object2.highlightedTileContainer = {'borderColor': null, 'borderStyle': 'solid', 'borderWidth': 2,
'borderRadius': 10, borderColor: INTERACTIVE_TEXT_ACTIVE};
object2.closeButton = {'position': 'absolute', 'top': null, 'right': 2,
top: -1 * IMAGE_CAROUSEL_EXPERIMENT_TILE_MARGIN};
object2.scrollview = {paddingTop: IMAGE_CAROUSEL_TILE_CLOSE_BUTTON_PADDING};
let BACKGROUND_SCRIM_LIGHTBOX = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SCRIM_LIGHTBOX;
object2.closeContainer = {'height': 20, 'width': 20, 'borderRadius': 20, 'alignItems': 'center',
'justifyContent': 'center', backgroundColor: BACKGROUND_SCRIM_LIGHTBOX};
const object7 = {};
object7.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
const BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
object7.backgroundColor = BACKGROUND_BASE_LOWER;
const INTERACTIVE_TEXT_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.INTERACTIVE_TEXT_DEFAULT;
object7.tintColor = INTERACTIVE_TEXT_DEFAULT;
object2.closeButtonIcon = object7;
const object8 = {};
let PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
object8.paddingHorizontal = PX_4;
object8.lineHeight = 20;
BACKGROUND_SCRIM_LIGHTBOX = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SCRIM_LIGHTBOX;
object8.backgroundColor = BACKGROUND_SCRIM_LIGHTBOX;
object8.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
object8.textTransform = 'uppercase';
object2.altTagText = object8;
const object9 = {};
BACKGROUND_SCRIM_LIGHTBOX = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SCRIM_LIGHTBOX;
object9.backgroundColor = BACKGROUND_SCRIM_LIGHTBOX;
object9.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
object9.padding = PX_4;
object2.iconContainer = object9;
const object14 = {};
copyDataProperties(object14, StyleSheet.absoluteFillObject, undefined);
object2.spoilerOverlay = object14;
BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
object2.footerRightContainer = {'position': 'absolute', 'bottom': 4, 'right': 4, 'alignItems': 'center',
'justifyContent': 'center', 'alignContent': 'center', 'backgroundColor': null, 'padding': 4, 'borderRadius': 20,
'opacity': 0.85, backgroundColor: BACKGROUND_SURFACE_HIGH};
const env0_13 = Reflect.apply(createStyles, createStylesModule, [object2]);
object2 = {code: "function ImageCarouselTsx1(){const{withTiming,animatedStylePropValue,STANDARD_EASING,withSpring}=this.__closure;return{opacity:withTiming(animatedStylePropValue.get(),{duration:300,easing:STANDARD_EASING},'animate-always'),transform:[{scale:withSpring(animatedStylePropValue.get(),{stiffness:80,damping:6,mass:0.3},'animate-always')}]};}"};
value = value.memo(_fun84928);
(require(2) /* metro dependency 2 */).fileFinishedImporting('components_native/chat/ImageCarousel.tsx');
exports.default = value;
exports.useTileEntranceAnimatedStyle = closure;
}
function useTileEntranceAnimatedStyle(a0) { // fn#84914, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:2146, offset: 0x01f5c3f9, size: 216 bytes, params: 2, frame: 20
var object2;
const value2 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).useSharedValue(0);
env0_3.useEffect(_fun84915, [value2, a0]);
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
const useAnimatedStyle = reanimatedRexportModule.useAnimatedStyle;
const closure = useTileEntranceAnimatedStyleL;
object2 = {};
object2.withTiming = (require(4504) /* metro dependency 4504: timing */).withTiming;
object2.animatedStylePropValue = value2;
const STANDARD_EASING = (require(1305) /* metro dependency 1305: native */).STANDARD_EASING;
object2.STANDARD_EASING = STANDARD_EASING;
object2.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring;
closure.__closure = object2;
closure.__workletHash = 9754366991991;
closure.__initData = env0_14;
return Reflect.apply(useAnimatedStyle, reanimatedRexportModule, [closure]);
}
function Tile({onEdit, onRemove, channelId, highlightThumbnails, upload}) { // fn#84917, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:2701, offset: 0x01f5c579, size: 1259 bytes, params: 2, frame: 40
var object4;
highlightThumbnails = !(highlightThumbnails === undefined) && highlightThumbnails;
const env0_3 = upload;
const styles = useStyles();
const description = upload.description;
const id = upload.id;
const item = upload.item;
const isVideo = upload.isVideo;
const isImage = upload.isImage;
const isThumbnail = upload.isThumbnail;
const defaultImport = importDefault(44) /* metro dependency 44 */;
const platform = item.platform;
const UploadPlatform = (require(4650) /* metro dependency 4650: Upload */).UploadPlatform;
const REACT_NATIVE = UploadPlatform.REACT_NATIVE;
defaultImport(platform === REACT_NATIVE, 'Upload must be a React Native upload item.');
let r15 = highlightThumbnails && isThumbnail === true;
const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([UploadAttachmentStore],
_fun84918);
let binding = env0_3;
let useCallback = binding.useCallback;
const value4 = Reflect.apply(useCallback, binding, [_fun84919, [isVideo, isImage, r15]]);
const value5 = env0_3.useCallback(_fun84920, [onRemove, id]);
const value6 = env0_3.useCallback(_fun84921, [channelId, onRemove, onEdit, upload, id]);
const value7 = env0_3.useCallback(_fun84923, [value5]);
const value8 = useTileEntranceAnimatedStyle(item.id ?? item.uri);
binding = env0_3;
useCallback = binding.useCallback;
let filename = item.filename;
const value9 = Reflect.apply(useCallback, binding, [_fun84924, [value4, value8, description, item.uri, filename,
isImage, isThumbnail, isVideo, value3, styles]]);
object4 = {name: 'remove'};
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
let string = intl.string;
object4.label = Reflect.apply(string, intl, [(require(1244) /* metro dependency 1244: indexNative */).t.kFwAsa]);
const items2 = [object4];
const PressableOpacity = (require(5278) /* metro dependency 5278: Pressables */).PressableOpacity;
let formatToPlainString = intl.formatToPlainString;
const MJHFt9 = (require(1244) /* metro dependency 1244: indexNative */).t.MJHFt9;
filename = item.filename;
const value10 = '';
string = intl.string;
const QtJ1c5 = (require(1244) /* metro dependency 1244: indexNative */).t.QtJ1c5;
r15 = r15 && styles.highlightedTileContainer;
const pressableOpacity = <PressableOpacity accessibilityRole="button" accessibilityLabel={Reflect.apply(formatToPlainString,
intl, [MJHFt9, {name: filename ?? value10}])} accessibilityHint={Reflect.apply(string, intl,
[QtJ1c5])} accessibilityActions={items2} onAccessibilityAction={value7} disabled={!isImage && !isVideo} onPress={value6} style={[styles.pressableContainer,
r15]}>{value9()}</PressableOpacity>;
formatToPlainString = intl.formatToPlainString;
const FxKgb3 = (require(1244) /* metro dependency 1244: indexNative */).t.FxKgb3;
const object2 = {};
object2.name = item.filename ?? value10;
const View2 = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View;
const items4 = [styles.closeContainer, value8];
const Icon = (require(1305) /* metro dependency 1305: native */).Icon;
const object3 = {source: importDefault(8523) /* metro dependency 8523 */};
const Icon2 = (require(1305) /* metro dependency 1305: native */).Icon;
const Sizes = Icon2.Sizes;
const MEDIUM = Sizes.MEDIUM;
object3.size = MEDIUM;
const PRIMARY_500 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.PRIMARY_500;
object3.color = PRIMARY_500;
object3.style = styles.closeButtonIcon;
return (
<View>
{pressableOpacity}
<PressableOpacity
accessibilityRole="button"
accessibilityLabel={Reflect.apply(formatToPlainString, intl, [FxKgb3, object2])}
style={styles.closeButton}
onPress={value5}
hitSlop={{'top': 4, 'bottom': 4, 'left': 4, 'right': 4}}
>
<View2 style={items4}>
<Icon {...object3} />
</View2>
</PressableOpacity>
</View>
);
}
function CustomScrollView(a0) { // fn#84925, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:5336, offset: 0x01f5cf0b, size: 207 bytes, params: 2, frame: 18
const styles = useStyles();
const env0_0 = env0_3.useRef(0);
const env0_1 = env0_3.useRef(0);
return (
<ScrollView
{...a0}
{...{['ref']: env0_3.useRef(null)}}
{...{['onContentSizeChange']: env0_3.useCallback(_fun84926, [])}}
{...{['onScroll']: env0_3.useCallback(_fun84927, [])}}
{...{['scrollEventThrottle']: 16}}
{...{['contentContainerStyle']: styles.scrollview}}
/>
);
}
function _fun84928({attachments, channelId, headerElement, highlightThumbnails}) { // fn#84928, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:5774, offset: 0x01f5d079, size: 428 bytes, params: 2, frame: 25
var r8;
if (highlightThumbnails !== undefined) {
}
let env0_3 = undefined;
var value;
const styles = useStyles();
let r11 = attachments != null && attachments.length > 0;
r11 = !r11 ? headerElement != null : r11;
env0_3 = env0_3.useCallback(_fun84930, [channelId, env0_3.useCallback(function(a0) {
importDefault(dependencyMap[26]).remove(channelId, a0, DraftType.ChannelMessage);
}, [channelId])]);
const items2 = [styles.container];
items2[1] = {height: r11 ? IMAGE_CAROUSEL_TILE_HEIGHT + IMAGE_CAROUSEL_TILE_CLOSE_BUTTON_PADDING : 0,
marginTop: r11 ? -1 * (IMAGE_CAROUSEL_TILE_CLOSE_BUTTON_PADDING - IMAGE_CAROUSEL_EXPERIMENT_TILE_MARGIN) : 0,
marginBottom: r11 ? 2 * IMAGE_CAROUSEL_EXPERIMENT_TILE_MARGIN : 0};
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const string = intl.string;
const RhtzFe = (require(1244) /* metro dependency 1244: indexNative */).t.RhtzFe;
if (attachments != null) {
value = global.Object.values(attachments);
value = value.map(_fun84931);
r8 = value;
} else {
r8 = null;
}
return (
<View style={items2}>
<CustomScrollView
horizontal
keyboardShouldPersistTaps="always"
showsHorizontalScrollIndicator={false}
accessibilityRole="list"
accessibilityLabel={Reflect.apply(string, intl, [RhtzFe])}
>
{headerElement}
{r8}
</CustomScrollView>
</View>
);
}
function useTileEntranceAnimatedStyleL() { // fn#84916, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:2293, owner: useTileEntranceAnimatedStyle.l, offset: 0x01f5c4d1, size: 168 bytes, params: 1, frame: 20
const object2 = {};
let value = environment.__proto__;
value = require(4504) /* metro dependency 4504: timing */;
const withTiming = value.withTiming;
const binding = env0_0;
const value3 = binding.get();
const STANDARD_EASING = (require(1305) /* metro dependency 1305: native */).STANDARD_EASING;
object2.opacity = Reflect.apply(withTiming, value, [value3, {duration: 300, easing: STANDARD_EASING},
'animate-always']);
const object4 = {};
value = require(4577) /* metro dependency 4577: spring */;
object4.scale = value.withSpring(binding.get(), {'stiffness': 80, 'damping': 6, 'mass': 0.3}, 'animate-always');
object2.transform = [object4];
return object2;
}
function _fun84918() { // fn#84918, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:3028, offset: 0x01f5ca64, size: 70 bytes, params: 1, frame: 15
const value = environment.__proto__;
const getUpload = UploadAttachmentStore.getUpload;
const channelIdBinding = channelId;
const idBinding = id;
const ChannelMessage = DraftType.ChannelMessage;
const spoiler = Reflect.apply(getUpload, UploadAttachmentStore, [channelIdBinding, idBinding,
ChannelMessage])?.spoiler;
return spoiler != null && spoiler;
}
function _fun84919() { // fn#84919, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:3140, offset: 0x01f5caaa, size: 65 bytes, params: 1, frame: 5
var r1;
var IMAGE_CAROUSEL_TILE_HEIGHT2;
let value = environment.__proto__;
const r2 = env0_11 ? IMAGE_CAROUSEL_TILE_HEIGHT - 4 : IMAGE_CAROUSEL_TILE_HEIGHT;
const r4 = isVideo || isImage;
value = undefined;
if (r4) {
r1 = value;
IMAGE_CAROUSEL_TILE_HEIGHT2 = IMAGE_CAROUSEL_TILE_HEIGHT;
} else {
r1 = 192;
IMAGE_CAROUSEL_TILE_HEIGHT2 = value;
}
return {width: IMAGE_CAROUSEL_TILE_HEIGHT2, height: r2, maxWidth: r1};
}
function _fun84920() { // fn#84920, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:3264, offset: 0x01f5caeb, size: 35 bytes, params: 1, frame: 12
return onRemove?.(id);
}
function _fun84921() { // fn#84921, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:3313, offset: 0x01f5cb0e, size: 77 bytes, params: 1, frame: 13
var environment;
const value = environment.__proto__;
(importDefault(11093) /* metro dependency 11093: showUploadPreviewActionSheet */)({channelId: channelId,
onRemove: onRemove, onEdit: onEdit_84922, upload: upload});
}
function _fun84923({nativeEvent}) { // fn#84923, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:3426, offset: 0x01f5cb82, size: 40 bytes, params: 2, frame: 9
if (nativeEvent.actionName === 'remove') {
env0_14();
}
}
function _fun84924() { // fn#84924, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:3552, offset: 0x01f5cbaa, size: 865 bytes, params: 1, frame: 33
var r16;
var Text;
var intl;
const value2 = undefined;
const {width, height, maxWidth} = env0_13();
const View2 = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View;
const items2 = [styles.tileContainer];
items2[1] = {width: width, height: height};
items2[2] = env0_15;
const value5 = ((Component) => <Component uri={item.uri} isImage={isImage} isVideo={isVideo} width={width} height={height} maxFileWidth={maxWidth} fileName={item.filename} borderRadius={(importDefault(697) /* metro dependency 697: native */).radii.md} />)(importDefault(11143) /* metro dependency 11143: AttachmentPreview */);
const isThumbnailBinding = isThumbnail;
const value6 = null;
const r5 = isThumbnailBinding ? <View style={styles.footerRightContainer}>{((Icon) => <Icon source={importDefault(11158) /* metro dependency 11158 */} size={(require(1305) /* metro dependency 1305: native */).Icon.Sizes.SMALL_14} />)((require(1305) /* metro dependency 1305: native */).Icon)}</View> : value6;
const items3 = [env0_12 ? ((Component) => <Component style={styles.spoilerOverlay} />)(importDefault(8670) /* metro dependency 8670: VisualEffectViewThemed */) : value6];
if (value6 != description) {
if ((value6 == description ? value2 : description.length) > 0) {
Text = (require(4573) /* metro dependency 4573: Text */).Text;
var textProps = {'variant': 'text-xs/medium', 'color': 'white', 'allowFontScaling': false,
style: styles.altTagText};
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
r16 = <Text {...textProps}>{intl.string((require(1244) /* metro dependency 1244: indexNative */).t.QEW81z)}</Text>;
} else {
r16 = value6;
}
} else {
r16 = value6;
}
const items4 = [r16];
items4[1] = isVideo ? <View style={styles.iconContainer}>{((PlayIcon) => <PlayIcon size="xxs" color="white" />)((require(9376) /* metro dependency 9376: PlayIcon */).PlayIcon)}</View> : value6;
items3[1] = <View>{items4}</View>;
items3[2] = env0_12 ? <View style={styles.iconContainer}>{((EyeIcon) => <EyeIcon size="xxs" color="white" />)((require(8999) /* metro dependency 8999: EyeIcon */).EyeIcon)}</View> : value6;
return (
<View2 style={items2}>
{value5}
{r5}
<View style={styles.decorationsContainer}>
{items3}
</View>
</View2>
);
}
function _fun84926(a0) { // fn#84926, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:5437, offset: 0x01f5cfda, size: 122 bytes, params: 2, frame: 15
let current = env0_0.current;
const current2 = env0_1.current;
const useWindowDimensionsNativeModule = require(1478) /* metro dependency 1478: useWindowDimensionsNative */;
const getWindowDimensions = useWindowDimensionsNativeModule.getWindowDimensions;
if (a0 > current || current2 + Reflect.apply(getWindowDimensions, useWindowDimensionsNativeModule, []).width > a0) {
current = env0_2.current;
if (current != null) {
current.scrollToEnd();
}
}
env0_0.current = a0;
}
function _fun84927({nativeEvent}) { // fn#84927, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:5594, offset: 0x01f5d054, size: 37 bytes, params: 2, frame: 2
env0_1.current = nativeEvent.contentOffset.x;
}
function _fun84930(a0, a1) { // fn#84930, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:5977, offset: 0x01f5d261, size: 106 bytes, params: 3, frame: 18
if (env0_2 != null) {
env0_2(a0);
}
const mediaKeyboardUtilsModule = require(11095) /* metro dependency 11095: MediaKeyboardUtils */;
const addImagesFromPicker = mediaKeyboardUtilsModule.addImagesFromPicker;
const channelIdBinding = channelId;
const UploadOrigin = (require(4650) /* metro dependency 4650: Upload */).UploadOrigin;
const IMAGE_EDITOR = UploadOrigin.IMAGE_EDITOR;
Reflect.apply(addImagesFromPicker, mediaKeyboardUtilsModule, [channelIdBinding, [a1], IMAGE_EDITOR]);
}
function _fun84931(a0) { // fn#84931, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:6410, offset: 0x01f5d2cb, size: 76 bytes, params: 2, frame: 16
return (
<Tile
channelId={channelId}
highlightThumbnails={highlightThumbnails}
onEdit={env0_3}
onRemove={env0_2}
upload={a0}
key={a0.uniqueId}
/>
);
}
function onEdit_84922(a0) { // fn#84922, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11277:3358, offset: 0x01f5cb5b, size: 39 bytes, params: 2, frame: 14
const value = environment.__proto__;
return onEdit?.(id, a0);
}