// Metro module 12324 (f12325). import { useMemo } from "react"; import { StyleSheet, View } from "react-native"; import { useEntranceAnimation } from "../useEntranceAnimation"; import { MediaViewerSourcesStore } from "../useMediaViewerSources"; import getMediaViewerStateForScreen from "../getMediaViewerStateForScreen"; import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport"; import { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport"; import REAWorkaroundView from "../../../reanimated/native/REAWorkaroundView"; let c8519_7 = { platformStyles: { position: "absolute", width: "100%", height: "100%" } }; const __initData = { code: "function MediaViewerItemPresenterTsx1(){const{entranceAnimationDriver,interpolate,Extrapolation,startHeight,sourceHeight,startWidth,sourceWidth,startTranslateY,startTranslateX,startScale}=this.__closure;const entranceValue=entranceAnimationDriver.get();function interpolateProxy(from,to){return interpolate(entranceValue,from,to,Extrapolation.CLAMP);}return{height:interpolateProxy([0,1],[startHeight,sourceHeight]),width:interpolateProxy([0,1],[startWidth,sourceWidth]),top:interpolateProxy([0,1],[startTranslateY,0]),left:interpolateProxy([0,1],[startTranslateX,0]),borderRadius:interpolateProxy([0,0.25],[16,0]),transform:[{scale:interpolateProxy([0,1],[startScale,1])}]};}" }; export default function MediaViewerItemPresenter(props) { let startHeight, startScale, startWidth; let width, height, c19798_7, c19798_8, c19798_9, width2, height2; const { source, originLayout, renderMedia, windowWidth, windowHeight, entranceAnimationDriver, index, useItemVisible, panGestureConfig } = props; width = void 0; height = void 0; c19798_7 = void 0; c19798_8 = void 0; c19798_9 = void 0; width2 = void 0; height2 = void 0; const entranceAnimation = useEntranceAnimation(entranceAnimationDriver); const { loads, handleLoad, handleError, handleLoadStart } = entranceAnimation; const field = MediaViewerSourcesStore.useField("spoilerIndexes"); const memo = useMemo(() => field.has(index), [index, field]); const mediaViewerStateForScreen = getMediaViewerStateForScreen(windowWidth, windowHeight, source); width = mediaViewerStateForScreen.width; height = mediaViewerStateForScreen.height; const visible = useItemVisible(index); const r53 = []; if (Array.isArray(source)) { const r6 = loads <= 1; if (r6) { r53.push(renderMedia({ key: `0:${index}:${source[0].uri}`, onLoadStart: handleLoadStart, onLoad: handleLoad, onError: handleError, source: source[0], style: c8519_7.platformStyles, index, hasSpoiler: memo, visible, panGestureConfig })); } if (loads >= 1) { r53.push(renderMedia({ key: `1:${index}:${source[0].uri}`, source: source[1], style: c8519_7.platformStyles, onLoad: handleLoad, onError: handleError, pointerEvents: r6 ? "none" : "auto", fadeDuration: 0, fade: false, index, hasSpoiler: memo, visible, panGestureConfig })); } } else { r53.push(renderMedia({ key: `0:${index}:${source.uri}`, onLoadStart: handleLoadStart, onLoad: handleLoad, onError: handleError, source, style: c8519_7.platformStyles, index, hasSpoiler: memo, visible, panGestureConfig })); } const r93 = width / height; const r96 = originLayout.width / originLayout.height; let startTranslateX = originLayout.x - (width - originLayout.width) / 2 - (windowWidth - width) / 2; c19798_8 = startTranslateX; const r106 = (height - originLayout.height) / 2; const r3 = (windowHeight - height) / 2; let startTranslateY = originLayout.y - r106 - r3; c19798_9 = startTranslateY; width2 = width; height2 = height; if (originLayout.resizeMode === "cover") { const width3 = originLayout.width; width2 = width3; const height3 = originLayout.height; height2 = height3; const r124 = originLayout.x - (windowWidth - width) / 2; c19798_8 = r124; const r4 = originLayout.y - r3; c19798_9 = r4; c19798_7 = 1; startHeight = height3; startWidth = width3; startTranslateY = r4; startTranslateX = r124; startScale = 1; } else { startScale = originLayout.width / width * (r93 > r96 ? r93 : 1); c19798_7 = startScale; startHeight = height; startWidth = width; } const O = function O() { const r10 = entranceAnimationDriver.get(); return { height: _ReanimatedRexport.interpolate(r10, [0, 1], [height2, height], _ReanimatedRexport.Extrapolation.CLAMP), width: _ReanimatedRexport.interpolate(r10, [0, 1], [width2, width], _ReanimatedRexport.Extrapolation.CLAMP), top: _ReanimatedRexport.interpolate(r10, [0, 1], [c19798_9, 0], _ReanimatedRexport.Extrapolation.CLAMP), left: _ReanimatedRexport.interpolate(r10, [0, 1], [c19798_8, 0], _ReanimatedRexport.Extrapolation.CLAMP), borderRadius: _ReanimatedRexport.interpolate(r10, [0, 0.25], [16, 0], _ReanimatedRexport.Extrapolation.CLAMP), transform: [{ scale: _ReanimatedRexport.interpolate(r10, [0, 1], [c19798_7, 1], _ReanimatedRexport.Extrapolation.CLAMP) }] }; }; O.__closure = { entranceAnimationDriver, interpolate: _ReanimatedRexport.interpolate, Extrapolation: _ReanimatedRexport.Extrapolation, startHeight, sourceHeight: height, startWidth, sourceWidth: width, startTranslateY, startTranslateX, startScale }; O.__workletHash = 15052076990644; O.__initData = __initData; const animatedStyle = useAnimatedStyle(O); const memo2 = useMemo(() => StyleSheet.create({ container: { width: windowWidth, height: windowHeight, alignItems: "center", justifyContent: "center" }, child: { width, height }, presenter: { position: "relative", overflow: "hidden", opacity: 1 } }), [windowWidth, windowHeight, width, height]); return {r53} ; };