Files
discord-decomp/modules/voice_panel/native/card/VoicePanelVideoRenderer.tsx
T
2026-11-01 12:12:55 +02:00

1109 lines
49 KiB
TypeScript

// Metro module 15959 (f15960).
import * as Module19 from "react";
import { useContext, useState, useRef, useCallback, useMemo, useEffect } from "react";
import { PixelRatio } from "react-native";
import { MODE_CHANGE_PHYSICS, VoicePanelModes } from "../../VoicePanelConstants";
import { VoicePanelControlsModes } from "../controls/VoicePanelControlsConstants";
import { VoicePanelPIPModes } from "../pip/VoicePanelPIPConstants";
import { SCALE_PHYSICS } from "../../../panels/morphable/native/MorphablePanelConstants";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useSharedValue, useAnimatedReaction, useDerivedValue, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import DCDVideoRenderer from "../../../video_calls/native/components/DCDVideoRenderer";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import VoicePanelStateContext from "../VoicePanelStateContext";
import * as _spring from "../../../../design/animation/reanimated/spring/spring";
import * as _cheapWorkletShallowEqual from "../../../reanimated/native/cheapWorkletShallowEqual";
import * as _HapticUtils_native from "../../../haptics/HapticUtils.native";
import { Gesture, GestureDetector } from "../../../../_bundle/Module5273";
import { useSurfaceDirectRendererExperiment } from "../../../video_calls/native/SurfaceDirectRendererExperiment";
import { usePIPState } from "../pip/VoicePanelPIPStateContext";
import useVideoReadyTimeout from "../../../errors/hooks/useVideoReadyTimeout";
import useVideoSpinnerTimer from "../../../video_calls/useVideoSpinnerTimer";
import { useSetHasActiveVideoOutputSink } from "../controller/VoicePanelStreamOutputSinkStack";
import updateSharedValueIfChanged_native from "../../../reanimated/utils/updateSharedValueIfChanged.native";
import { updateVideoSize } from "../../../media/VideoActionCreators";
import ExternalPip_android from "../../../external_pip/ExternalPip.android";
import { useToken } from "../../../../design/tokens/native/useToken";
import Module712 from "../../../../_bundle/Module712";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import ReanimatedNativeView from "../../../core/native/ReanimatedNativeView";
import MessageLoadingSpinner from "../../../../components_native/common/MessageLoadingSpinner";
let getScaleChangeWithOverscroll, useStyles, __initData, __initData2, __initData3, __initData4, __initData5, __initData6, __initData7, __initData8, __initData9, __initData10, __initData11, __initData12, __initData13, __initData14, __initData15, __initData16, __initData17, __initData18, __initData19, __initData20, __initData21, __initData22, __initData23, __initData24, __initData25, __initData26, __initData27, __initData28, __initData29, __initData30, __initData31, __initData32, __initData33, __initData34, __initData35, shouldMakeActive, __initData36, __initData37, __initData38, __initData39, __initData40, __initData41, __initData42, __initData43, __initData44, __initData45;
const SNAP_EDGE_INNER_THRESHOLD = 25;
const FLING_VELOCITY_SCALING = 0.05;
const PAN_TO_ZOOM_SCALE_FACTOR = 0.0075;
const AnimatedComponent = ReanimatedRexport.createAnimatedComponent(DCDVideoRenderer);
const getScaleChangeWithOverscroll2 = function getScaleChangeWithOverscroll(a0, a1, a2) {
if (a0 >= a2) {
return a1;
}
const r0 = 1 - a0;
return 1 + (a1 - 1) * Math.max(0.1, 1 - r0 * r0 * 5);
};
getScaleChangeWithOverscroll2.__closure = {
MIN_OVERSCROLL: 0.1,
OVERSCOLL_INTENSITY_FACTOR: 5
};
getScaleChangeWithOverscroll2.__workletHash = 8727721301304;
getScaleChangeWithOverscroll2.__initData = {
code: "function getScaleChangeWithOverscroll_VoicePanelVideoRendererTsx1(currentScale,scaleChange,fitScale){const{MIN_OVERSCROLL,OVERSCOLL_INTENSITY_FACTOR}=this.__closure;if(currentScale>=fitScale){return scaleChange;}const underScale=1-currentScale;const factor=Math.max(MIN_OVERSCROLL,1-underScale*underScale*OVERSCOLL_INTENSITY_FACTOR);return 1+(scaleChange-1)*factor;}"
};
getScaleChangeWithOverscroll = getScaleChangeWithOverscroll2;
useStyles = createStyles({
wrapper: {
position: "absolute",
top: 0,
left: 0,
width: "100%",
height: "100%",
alignItems: "center",
justifyContent: "center"
},
animatedWrapperStyles: {
position: "absolute"
},
video: {
width: "100%",
height: "100%"
},
spinner: {
position: "absolute",
top: "50%",
left: "50%",
marginTop: -16,
marginLeft: -16,
height: 32,
width: 32
}
});
__initData = {
code: "function VoicePanelVideoRendererTsx2(){const{containerLayout,videoDimensions}=this.__closure;return Math.max(containerLayout.get().width/videoDimensions.get().width,containerLayout.get().height/videoDimensions.get().height);}"
};
__initData2 = {
code: "function VoicePanelVideoRendererTsx3(){const{containerLayout,videoDimensions}=this.__closure;return Math.min(containerLayout.get().width/videoDimensions.get().width,containerLayout.get().height/videoDimensions.get().height);}"
};
__initData3 = {
code: "function VoicePanelVideoRendererTsx4(){const{translateX,translateY,scale,fitScale,coverScale}=this.__closure;if(translateX.get()!==0||translateY.get()!==0){return false;}if(scale.get()===fitScale.get()||scale.get()===coverScale.get()){return true;}return false;}"
};
__initData4 = {
code: "function VoicePanelVideoRendererTsx5(forcedMode){const{scale,withSpring,fitScale,MODE_CHANGE_PHYSICS,disableAnimations,coverScale,translateX,SCALE_PHYSICS,translateY,currentSizeThreshold}=this.__closure;if(forcedMode==='fit'){scale.set(withSpring(fitScale.get(),MODE_CHANGE_PHYSICS,!disableAnimations.get()?'respect-motion-settings':'animate-never'));}else{scale.set(withSpring(coverScale.get(),MODE_CHANGE_PHYSICS,!disableAnimations.get()?'respect-motion-settings':'animate-never'));}translateX.set(withSpring(0,SCALE_PHYSICS));translateY.set(withSpring(0,SCALE_PHYSICS));currentSizeThreshold.set(forcedMode);}"
};
__initData5 = {
code: "function VoicePanelVideoRendererTsx6(){const{focused,id,videoDimensions,windowDimensions,isCamera,resetToDefaultSize}=this.__closure;var _focused$get;let resizeMode=((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)===id?'fit':'cover';const videoLandscape=videoDimensions.get().width>=videoDimensions.get().height;const parentLandscape=windowDimensions.get().width>=windowDimensions.get().height;const matchingAspect=videoLandscape===parentLandscape;if(isCamera&&resizeMode==='fit'){if(matchingAspect){resizeMode='cover';}}resetToDefaultSize(resizeMode);}"
};
__initData6 = {
code: "function VoicePanelVideoRendererTsx7(){const{containerLayout}=this.__closure;return containerLayout.get();}"
};
__initData7 = {
code: "function VoicePanelVideoRendererTsx8(containerLayout,previous){const{cheapWorkletShallowEqual,focused,id,resetOnLayoutChange}=this.__closure;var _focused$get;if(cheapWorkletShallowEqual(containerLayout,previous!==null&&previous!==void 0?previous:undefined))return;if(((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)!==id)return;if(containerLayout!==previous&&previous!=null){resetOnLayoutChange();}}"
};
__initData8 = {
code: "function VoicePanelVideoRendererTsx9(){const{coverScale,fitScale,MIN_ZOOM_FOR_COVER_SNAP_OFFSET,translateX,scale,translateY,SNAP_CENTER_THRESHOLD,containerLayout,videoDimensions,SNAP_EDGE_OUTER_THRESHOLD,SNAP_EDGE_INNER_THRESHOLD}=this.__closure;if(coverScale.get()<fitScale.get()+MIN_ZOOM_FOR_COVER_SNAP_OFFSET){return false;}const screenTranslateX=translateX.get()*scale.get();const screenTranslateY=translateY.get()*scale.get();if(screenTranslateX<-SNAP_CENTER_THRESHOLD||screenTranslateX>SNAP_CENTER_THRESHOLD||screenTranslateY<-SNAP_CENTER_THRESHOLD||screenTranslateY>SNAP_CENTER_THRESHOLD){return false;}const adjustedScreenTranslateX=screenTranslateX+(containerLayout.get().width-videoDimensions.get().width*scale.get())/2;const adjustedScreenTranslateY=screenTranslateY+(containerLayout.get().height-videoDimensions.get().height*scale.get())/2;const videoWidth=videoDimensions.get().width*scale.get();const videoHeight=videoDimensions.get().height*scale.get();if(videoHeight>=containerLayout.get().height&&adjustedScreenTranslateX>=-SNAP_EDGE_OUTER_THRESHOLD&&adjustedScreenTranslateX<=SNAP_EDGE_INNER_THRESHOLD&&adjustedScreenTranslateX+videoWidth>=containerLayout.get().width-SNAP_EDGE_INNER_THRESHOLD&&adjustedScreenTranslateX+videoWidth<=containerLayout.get().width+SNAP_EDGE_OUTER_THRESHOLD){return true;}if(videoWidth>=containerLayout.get().width&&adjustedScreenTranslateY>=-SNAP_EDGE_OUTER_THRESHOLD&&adjustedScreenTranslateY<=SNAP_EDGE_INNER_THRESHOLD&&adjustedScreenTranslateY+videoHeight>=containerLayout.get().height-SNAP_EDGE_INNER_THRESHOLD&&adjustedScreenTranslateY+videoHeight<=containerLayout.get().height+SNAP_EDGE_OUTER_THRESHOLD){return true;}return false;}"
};
__initData9 = {
code: "function VoicePanelVideoRendererTsx10(){const{numGesturesActive,isInSnap,resetToDefaultSize,scale,fitScale,videoDimensions,containerLayout,translateX,withSpring,SCALE_PHYSICS,translateY}=this.__closure;if(numGesturesActive.get()>0){return;}if(isInSnap.get()){isInSnap.set(false);resetToDefaultSize('cover');return;}if(scale.get()<fitScale.get()){resetToDefaultSize('fit');return;}const maxTranslateY=Math.max(0,(videoDimensions.get().height-containerLayout.get().height/scale.get())/2);const maxTranslateX=Math.max(0,(videoDimensions.get().width-containerLayout.get().width/scale.get())/2);translateX.set(withSpring(Math.min(maxTranslateX,Math.max(-maxTranslateX,translateX.get())),SCALE_PHYSICS));translateY.set(withSpring(Math.min(maxTranslateY,Math.max(-maxTranslateY,translateY.get())),SCALE_PHYSICS));}"
};
__initData10 = {
code: "function VoicePanelVideoRendererTsx11(){const{focused,id,isInDefaultZoom,isInPanToZoom}=this.__closure;var _focused$get;return((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)===id&&(!isInDefaultZoom.get()||isInPanToZoom.get());}"
};
__initData11 = {
code: "function VoicePanelVideoRendererTsx12(isFocusedZoomed,previous){const{setIsFocusedVideoZoomed}=this.__closure;if(isFocusedZoomed===previous){return;}setIsFocusedVideoZoomed(isFocusedZoomed);}"
};
__initData12 = {
code: "function VoicePanelVideoRendererTsx13(){const{focused,id}=this.__closure;var _focused$get;return((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)===id;}"
};
__initData13 = {
code: "function VoicePanelVideoRendererTsx14(isFocused,previous){const{resetOnLayoutChange}=this.__closure;if(isFocused===previous){return;}resetOnLayoutChange();}"
};
__initData14 = {
code: "function VoicePanelVideoRendererTsx15(){const{mode}=this.__closure;return mode.get();}"
};
__initData15 = {
code: "function VoicePanelVideoRendererTsx16(mode,previous){const{resetOnLayoutChange}=this.__closure;if(mode===previous){return;}resetOnLayoutChange();}"
};
__initData16 = {
code: "function VoicePanelVideoRendererTsx17(){const{videoDimensions}=this.__closure;return videoDimensions.get();}"
};
__initData17 = {
code: "function VoicePanelVideoRendererTsx18(layout,previous){const{currentSizeThreshold,resetOnLayoutChange}=this.__closure;if(currentSizeThreshold==null){return;}if(layout.width===(previous===null||previous===void 0?void 0:previous.width)&&layout.height===(previous===null||previous===void 0?void 0:previous.height)){return;}resetOnLayoutChange();}"
};
__initData18 = {
code: "function VoicePanelVideoRendererTsx19(){const{coverScale}=this.__closure;return coverScale.get();}"
};
__initData19 = {
code: "function VoicePanelVideoRendererTsx20(current,previous){const{currentSizeThreshold,resetToDefaultSize}=this.__closure;const _currentSizeThreshold=currentSizeThreshold.get();if(_currentSizeThreshold!=='cover'){return;}if(current===previous){return;}resetToDefaultSize(_currentSizeThreshold);}"
};
__initData20 = {
code: "function VoicePanelVideoRendererTsx21(){const{isInSnap}=this.__closure;return isInSnap.get();}"
};
__initData21 = {
code: "function VoicePanelVideoRendererTsx22(current,previous){const{runOnJS,triggerHapticFeedback,HapticFeedbackTypes}=this.__closure;if(current===previous){return;}if(!current){return;}runOnJS(triggerHapticFeedback)(HapticFeedbackTypes.IMPACT_LIGHT);}"
};
__initData22 = {
code: "function VoicePanelVideoRendererTsx23(){const{isInDefaultZoom,resetOnLayoutChange,focused,id,runOnJS,setFocused}=this.__closure;var _focused$get;if(!isInDefaultZoom.get()){resetOnLayoutChange();return;}if(((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)!==id){runOnJS(setFocused)(id);}else{runOnJS(setFocused)(null);}}"
};
__initData23 = {
code: "function VoicePanelVideoRendererTsx24(e,manager){return manager.fail();}"
};
__initData24 = {
code: "function VoicePanelVideoRendererTsx25(){const{controlsSpecs,VoicePanelControlsModes,runOnJS,showControls,hideControls}=this.__closure;if(controlsSpecs.get().mode===VoicePanelControlsModes.HIDDEN){runOnJS(showControls)({debounce:true});}else{runOnJS(hideControls)({debounce:true});}}"
};
__initData25 = {
code: "function VoicePanelVideoRendererTsx26(e,manager){return manager.fail();}"
};
__initData26 = {
code: "function VoicePanelVideoRendererTsx27(){const{numGesturesActive,handleMovementEnd}=this.__closure;numGesturesActive.set(numGesturesActive.get()-1);handleMovementEnd();}"
};
__initData27 = {
code: "function VoicePanelVideoRendererTsx28(event){const{scale,getScaleChangeWithOverscroll,fitScale,containerLayout,translateX,translateY,isInSnap,isInCoverSnap}=this.__closure;scale.set(scale.get()*getScaleChangeWithOverscroll(scale.get(),event.scaleChange,fitScale.get()));const startingFocalFromCenterX=event.focalX-containerLayout.get().width/2;const startingFocalFromCenterY=event.focalY-containerLayout.get().height/2;const zoomCenteringX=-1*startingFocalFromCenterX*(event.scaleChange-1)/scale.get();const zoomCenteringY=-1*startingFocalFromCenterY*(event.scaleChange-1)/scale.get();translateX.set(translateX.get()+zoomCenteringX);translateY.set(translateY.get()+zoomCenteringY);isInSnap.set(isInCoverSnap());}"
};
__initData28 = {
code: "function VoicePanelVideoRendererTsx29(){const{numGesturesActive,isInPanToZoom,currentSizeThreshold}=this.__closure;numGesturesActive.set(numGesturesActive.get()+1);isInPanToZoom.set(false);currentSizeThreshold.set(null);}"
};
__initData29 = {
code: "function VoicePanelVideoRendererTsx30(event,manager){const{focused,id}=this.__closure;var _focused$get;if(((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)!==id){manager.fail();}}"
};
__initData30 = {
code: "function VoicePanelVideoRendererTsx31(){const{isInPanToZoom}=this.__closure;isInPanToZoom.set(false);}"
};
__initData31 = {
code: "function VoicePanelVideoRendererTsx32(event){const{numGesturesActive,translateX,withSpring,FLING_VELOCITY_SCALING,scale,SCALE_PHYSICS,translateY,handleMovementEnd}=this.__closure;numGesturesActive.set(numGesturesActive.get()-1);translateX.set(withSpring(translateX.get()+event.velocityX*FLING_VELOCITY_SCALING/scale.get(),SCALE_PHYSICS));translateY.set(withSpring(translateY.get()+event.velocityY*FLING_VELOCITY_SCALING/scale.get(),SCALE_PHYSICS));handleMovementEnd();}"
};
__initData32 = {
code: "function VoicePanelVideoRendererTsx33(event){const{isInPanToZoom,PAN_TO_ZOOM_SCALE_FACTOR,scale,getScaleChangeWithOverscroll,fitScale,translateX,translateY,isInSnap,isInCoverSnap}=this.__closure;if(isInPanToZoom.get()){const scaleChange=1+event.changeY*PAN_TO_ZOOM_SCALE_FACTOR;scale.set(scale.get()*getScaleChangeWithOverscroll(scale.get(),scaleChange,fitScale.get()));}else{translateX.set(translateX.get()+event.changeX/scale.get());translateY.set(translateY.get()+event.changeY/scale.get());}isInSnap.set(isInCoverSnap());}"
};
__initData33 = {
code: "function VoicePanelVideoRendererTsx34(){const{isInPanToZoom,runOnJS,hideControls,numGesturesActive,currentSizeThreshold}=this.__closure;if(isInPanToZoom.get()){runOnJS(hideControls)();}numGesturesActive.set(numGesturesActive.get()+1);currentSizeThreshold.set(null);}"
};
__initData34 = {
code: "function VoicePanelVideoRendererTsx35(){const{lastTapTimestamp,PAN_TO_ZOOM_TAP_TIME_MILLIS,isInPanToZoom}=this.__closure;const hasRecentTap=Date.now()-lastTapTimestamp.get()<=PAN_TO_ZOOM_TAP_TIME_MILLIS;isInPanToZoom.set(hasRecentTap);lastTapTimestamp.set(Date.now());}"
};
__initData35 = {
code: "function VoicePanelVideoRendererTsx36(event,manager){const{focused,id}=this.__closure;var _focused$get;if(((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)!==id){manager.fail();return;}}"
};
const shouldMakeActive2 = function shouldMakeActive({ mode: mode3, focusedId, selfId, isScrollVisible: isScrollVisible2 }) {
const PIP = VoicePanelModes.PIP;
return !((isScrollVisible2 ? mode3 === PIP : !isScrollVisible2) || focusedId != null && focusedId !== selfId);
};
shouldMakeActive2.__closure = {
VoicePanelModes
};
shouldMakeActive2.__workletHash = 14556501664557;
shouldMakeActive2.__initData = {
code: "function shouldMakeActive_VoicePanelVideoRendererTsx37({mode:mode,focusedId:focusedId,selfId:selfId,isScrollVisible:isScrollVisible}){const{VoicePanelModes}=this.__closure;const isPIP=mode===VoicePanelModes.PIP;if(!isScrollVisible||isPIP||focusedId!=null&&focusedId!==selfId){return false;}return true;}"
};
shouldMakeActive = shouldMakeActive2;
__initData36 = {
code: "function VoicePanelVideoRendererTsx38(){const{mode,focused,isScrollVisible,streamId}=this.__closure;var _focused$get;return[mode.get(),(_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id,isScrollVisible.get(),streamId];}"
};
__initData37 = {
code: "function VoicePanelVideoRendererTsx39(props,previous){const{cheapWorkletArrayShallowEqual,runOnJS,setHasActiveVideoOutputSink,shouldMakeActive,id}=this.__closure;if(cheapWorkletArrayShallowEqual(props,previous!==null&&previous!==void 0?previous:undefined))return;const[mode,focusedId,isScrollVisible,streamId]=props;if(streamId==null)return;runOnJS(setHasActiveVideoOutputSink)(streamId,shouldMakeActive({mode:mode,focusedId:focusedId,selfId:id,isScrollVisible:isScrollVisible}));}"
};
__initData38 = {
code: "function VoicePanelVideoRendererTsx40(){const{focused,id,windowDimensions,sharedCoords}=this.__closure;var _focused$get;if(((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)===id){return{width:windowDimensions.get().width,height:windowDimensions.get().height};}return{width:sharedCoords.get().width,height:sharedCoords.get().height};}"
};
__initData39 = {
code: "function VoicePanelVideoRendererTsx41(){const{scale,videoDimensions,mode}=this.__closure;return[scale.get(),videoDimensions.get(),mode.get()];}"
};
__initData40 = {
code: "function VoicePanelVideoRendererTsx42(props,previous){const{streamId,cheapWorkletShallowEqual,runOnJS,respondToVideoSizeUpdate}=this.__closure;if(streamId==null)return;if(cheapWorkletShallowEqual(props,previous!==null&&previous!==void 0?previous:undefined))return;runOnJS(respondToVideoSizeUpdate)();}"
};
__initData41 = {
code: "function VoicePanelVideoRendererTsx43(){const{videoDimensions,pipState,VoicePanelPIPModes,scale,disableAnimations,translateX,translateY,mirror}=this.__closure;let{width:width,height:height}=videoDimensions.get();if(pipState.mode===VoicePanelPIPModes.IN_APP){if(width>height){width=width*(pipState.height/height)/scale.get();height=pipState.height/scale.get();}else{height=height*(pipState.width/width)/scale.get();width=pipState.width/scale.get();}}return{width:width,height:height,opacity:disableAnimations.get()?0:1,transform:[{scale:scale.get()},{translateX:translateX.get()},{translateY:translateY.get()},{scaleX:mirror?-1:1}]};}"
};
__initData42 = {
code: "function VoicePanelVideoRendererTsx44(){const{mode,VoicePanelModes,focused,id}=this.__closure;var _focused$get;return{inPip:mode.get()===VoicePanelModes.PIP,isFocused:((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)===id};}"
};
__initData43 = {
code: "function VoicePanelVideoRendererTsx45(curr,prev){const{cheapWorkletShallowEqual,strokeOpacity,withDelay,withTiming}=this.__closure;if(cheapWorkletShallowEqual(curr,prev!==null&&prev!==void 0?prev:undefined))return;if(curr.inPip||curr.isFocused){strokeOpacity.set(0);return;}const shouldDelay=(prev===null||prev===void 0?void 0:prev.isFocused)===true;strokeOpacity.set(shouldDelay?withDelay(300,withTiming(0.3,{duration:0},'animate-never')):0.3);}"
};
__initData44 = {
code: "function VoicePanelVideoRendererTsx46(){const{isInSnap,SNAP_EDGE_INNER_THRESHOLD,borderRadius,strokeOpacity}=this.__closure;if(isInSnap.get()){return{position:'absolute',top:0,left:0,bottom:0,right:0,borderWidth:SNAP_EDGE_INNER_THRESHOLD,overflow:'hidden',borderColor:'white',opacity:0.5};}return{position:'absolute',top:-1,left:-1,bottom:-1,right:-1,borderWidth:2,borderRadius:borderRadius+2,overflow:'hidden',borderColor:'white',opacity:strokeOpacity.get()};}"
};
__initData45 = {
code: "function VoicePanelVideoRendererTsx47(values){const{layout,disableAnimations}=this.__closure;return layout(values,disableAnimations.get());}"
};
const r110 = Module19.memo(function VideoRenderer(props) {
let onReady, setHasActiveVideoOutputSink, sharedValue3, sharedValue4, sharedValue5, sharedValue6, c22654_24, callback, token, sharedValue7;
const { id, streamId, userId, videoSpinnerContext, sharedCoords, isScrollVisible, isCamera, streamKey, mirror = false } = props;
let c22654_5 = mirror;
let focusOnReady = props.focusOnReady;
if (focusOnReady === void 0) {
focusOnReady = false;
}
let c22654_6 = focusOnReady;
let paused = props.paused;
if (paused === void 0) {
paused = false;
}
let id2, isCamera2, focused2, mode2, state, derivedValue, sharedValue8, sharedValue9, setIsFocusedVideoZoomed, windowDimensions2, dismissToPIPGestureRef, setFocused2, hideControls, controlsSpecs, showControls, sharedValue10, sharedValue11, sharedValue12, sharedValue13, sharedValue14, sharedValue15, sharedValue16, sharedValue17, derivedValue2, derivedValue3, derivedValue4, callback2, callback3, callback4, callback5;
const { style, layout } = props;
onReady = void 0;
setHasActiveVideoOutputSink = void 0;
sharedValue3 = void 0;
sharedValue4 = void 0;
sharedValue5 = void 0;
sharedValue6 = void 0;
c22654_24 = void 0;
callback = void 0;
token = void 0;
sharedValue7 = void 0;
const styles = useStyles();
const surfaceDirectRendererExperiment = useSurfaceDirectRendererExperiment(userId, {
location: "VoicePanelVideoRenderer"
});
const context = useContext(VoicePanelStateContext);
const { mode, focused, setFocused, layoutManager, windowDimensions, streamOutputSinkStack } = context;
const sharedValue = useSharedValue(true);
const sharedValue2 = useSharedValue({
...layoutManager.getTargetDimensions(id)
});
const pIPState = usePIPState();
const [loading, setState] = useState(true);
const ref = useRef(() => {
if (c22654_6) {
setFocused(id);
}
});
onReady = useVideoReadyTimeout({
streamId,
userId,
loading,
videoSpinnerContext,
paused,
streamKey
}).onReady;
useVideoSpinnerTimer({
location: "VideoRenderer",
videoSpinnerContext,
userId,
streamId,
loading
});
const callback6 = useCallback(() => {
setState(false);
ref.current();
onReady();
}, [onReady]);
setHasActiveVideoOutputSink = useSetHasActiveVideoOutputSink(streamOutputSinkStack);
const Je = () => [mode.get(), focused.get()?.id, isScrollVisible.get(), streamId];
Je.__closure = {
mode,
focused,
isScrollVisible,
streamId
};
Je.__workletHash = 3558943323767;
Je.__initData = __initData36;
const We = function We(a0, a1) {
if (!_cheapWorkletShallowEqual.cheapWorkletArrayShallowEqual(a0, a1 == null ? void 0 : a1)) {
const [r20, r21, r11, r22] = a0;
if (r22 != null) {
const r27 = _ReanimatedRexport.runOnJS(setHasActiveVideoOutputSink);
const PIP = VoicePanelModes.PIP;
r27(r22, !((r11 ? r20 === PIP : !r11) || r21 != null && r21 !== id));
}
}
};
We.__closure = {
cheapWorkletArrayShallowEqual: _cheapWorkletShallowEqual.cheapWorkletArrayShallowEqual,
runOnJS: _ReanimatedRexport.runOnJS,
setHasActiveVideoOutputSink,
shouldMakeActive,
id
};
We.__workletHash = 12089612803324;
We.__initData = __initData37;
useAnimatedReaction(Je, We);
const callback7 = useCallback(({ nativeEvent }) => {
const { width, height } = nativeEvent;
updateSharedValueIfChanged_native(sharedValue2, {
width,
height
});
layoutManager.setTargetDimensions(id, width, height);
if (sharedValue.get()) {
setTimeout(() => {
sharedValue.set(false);
}, 34);
}
}, [sharedValue2, layoutManager, id, sharedValue]);
const Ue = function Ue() {
return focused.get()?.id === id ? {
width: windowDimensions.get().width,
height: windowDimensions.get().height
} : {
width: sharedCoords.get().width,
height: sharedCoords.get().height
};
};
Ue.__closure = {
focused,
id,
windowDimensions,
sharedCoords
};
Ue.__workletHash = 9631392718391;
Ue.__initData = __initData38;
const derivedValue5 = useDerivedValue(Ue);
id2 = id;
isCamera2 = isCamera;
focused2 = focused;
mode2 = mode;
state = loading;
derivedValue = derivedValue5;
sharedValue8 = sharedValue2;
sharedValue9 = sharedValue;
setIsFocusedVideoZoomed = void 0;
windowDimensions2 = void 0;
dismissToPIPGestureRef = void 0;
setFocused2 = void 0;
hideControls = void 0;
controlsSpecs = void 0;
showControls = void 0;
sharedValue10 = void 0;
sharedValue11 = void 0;
sharedValue12 = void 0;
sharedValue13 = void 0;
sharedValue14 = void 0;
sharedValue15 = void 0;
sharedValue16 = void 0;
sharedValue17 = void 0;
derivedValue2 = void 0;
derivedValue3 = void 0;
derivedValue4 = void 0;
callback2 = void 0;
callback3 = void 0;
callback4 = void 0;
callback5 = void 0;
const context2 = useContext(VoicePanelStateContext);
setIsFocusedVideoZoomed = context2.setIsFocusedVideoZoomed;
windowDimensions2 = context2.windowDimensions;
dismissToPIPGestureRef = context2.dismissToPIPGestureRef;
setFocused2 = context2.setFocused;
hideControls = context2.hideControls;
controlsSpecs = context2.controlsSpecs;
showControls = context2.showControls;
sharedValue10 = useSharedValue(1);
sharedValue11 = useSharedValue(0);
sharedValue12 = useSharedValue(0);
sharedValue13 = useSharedValue(0);
sharedValue14 = useSharedValue(false);
sharedValue15 = useSharedValue(0);
sharedValue16 = useSharedValue(false);
sharedValue17 = useSharedValue(null);
const r173 = function w() {
return Math.max(derivedValue.get().width / sharedValue8.get().width, derivedValue.get().height / sharedValue8.get().height);
};
r173.__closure = {
containerLayout: derivedValue,
videoDimensions: sharedValue2
};
r173.__workletHash = 4177496646282;
r173.__initData = __initData;
derivedValue2 = useDerivedValue(r173);
const r179 = function D() {
return Math.min(derivedValue.get().width / sharedValue8.get().width, derivedValue.get().height / sharedValue8.get().height);
};
r179.__closure = {
containerLayout: derivedValue,
videoDimensions: sharedValue2
};
r179.__workletHash = 5260375952053;
r179.__initData = __initData2;
derivedValue3 = useDerivedValue(r179);
const r187 = function I() {
return sharedValue11.get() === 0 && sharedValue12.get() === 0 && (sharedValue10.get() === derivedValue3.get() || sharedValue10.get() === derivedValue2.get());
};
r187.__closure = {
translateX: sharedValue11,
translateY: sharedValue12,
scale: sharedValue10,
fitScale: derivedValue3,
coverScale: derivedValue2
};
r187.__workletHash = 15099362638406;
r187.__initData = __initData3;
derivedValue4 = useDerivedValue(r187);
const ae = function ae(a0) {
if (a0 === "fit") {
sharedValue10.set(_spring.withSpring(derivedValue3.get(), MODE_CHANGE_PHYSICS, sharedValue9.get() ? "animate-never" : "respect-motion-settings"));
} else {
sharedValue10.set(_spring.withSpring(derivedValue2.get(), MODE_CHANGE_PHYSICS, sharedValue9.get() ? "animate-never" : "respect-motion-settings"));
}
sharedValue11.set(_spring.withSpring(0, SCALE_PHYSICS));
sharedValue12.set(_spring.withSpring(0, SCALE_PHYSICS));
sharedValue17.set(a0);
};
ae.__closure = {
scale: sharedValue10,
withSpring: _spring.withSpring,
fitScale: derivedValue3,
MODE_CHANGE_PHYSICS,
disableAnimations: sharedValue,
coverScale: derivedValue2,
translateX: sharedValue11,
SCALE_PHYSICS,
translateY: sharedValue12,
currentSizeThreshold: sharedValue17
};
ae.__workletHash = 16610861286231;
ae.__initData = __initData4;
callback2 = useCallback(ae, [sharedValue10, sharedValue11, sharedValue12, derivedValue2, sharedValue17, derivedValue3, sharedValue]);
const re = function re() {
let r13 = focused2.get()?.id === id2 ? "fit" : "cover";
const r2 = sharedValue8.get().width >= sharedValue8.get().height;
const r27 = windowDimensions2.get().width >= windowDimensions2.get().height;
let r28 = isCamera2;
if (isCamera2) {
r28 = r13 === "fit";
}
if (r28) {
r28 = r2 === r27;
}
if (r28) {
r13 = "cover";
}
callback2(r13);
};
re.__closure = {
focused,
id,
videoDimensions: sharedValue2,
windowDimensions: windowDimensions2,
isCamera,
resetToDefaultSize: callback2
};
re.__workletHash = 15643035811761;
re.__initData = __initData5;
callback3 = useCallback(re, [focused, id, isCamera, sharedValue2, windowDimensions2, callback2]);
const le = () => derivedValue.get();
le.__closure = {
containerLayout: derivedValue
};
le.__workletHash = 9695573702258;
le.__initData = __initData6;
const ce = function ce(a0, a1) {
if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(a0, a1 == null ? void 0 : a1)) {
if (focused2.get()?.id === id2 && a0 !== a1 && a1 != null) {
callback3();
}
}
};
ce.__closure = {
cheapWorkletShallowEqual: _cheapWorkletShallowEqual.cheapWorkletShallowEqual,
focused,
id,
resetOnLayoutChange: callback3
};
ce.__workletHash = 13816224514199;
ce.__initData = __initData7;
useAnimatedReaction(le, ce);
const Le = function Le() {
if (derivedValue2.get() < derivedValue3.get() + 0.05) {
return false;
}
const r26 = sharedValue11.get() * sharedValue10.get();
const r32 = sharedValue12.get() * sharedValue10.get();
if (!(r26 < -50) && !(r26 > 50) && !(r32 < -50) && !(r32 > 50)) {
const r43 = r26 + (derivedValue.get().width - sharedValue8.get().width * sharedValue10.get()) / 2;
const r55 = r32 + (derivedValue.get().height - sharedValue8.get().height * sharedValue10.get()) / 2;
const r61 = sharedValue8.get().width * sharedValue10.get();
const r67 = sharedValue8.get().height * sharedValue10.get();
return r67 >= derivedValue.get().height && r43 >= -50 && r43 <= SNAP_EDGE_INNER_THRESHOLD && r43 + r61 >= derivedValue.get().width - SNAP_EDGE_INNER_THRESHOLD && r43 + r61 <= derivedValue.get().width + 50 || r61 >= derivedValue.get().width && r55 >= -50 && r55 <= SNAP_EDGE_INNER_THRESHOLD && r55 + r67 >= derivedValue.get().height - SNAP_EDGE_INNER_THRESHOLD && r55 + r67 <= derivedValue.get().height + 50;
}
return false;
};
Le.__closure = {
coverScale: derivedValue2,
fitScale: derivedValue3,
MIN_ZOOM_FOR_COVER_SNAP_OFFSET: 0.05,
translateX: sharedValue11,
scale: sharedValue10,
translateY: sharedValue12,
SNAP_CENTER_THRESHOLD: 50,
containerLayout: derivedValue,
videoDimensions: sharedValue2,
SNAP_EDGE_OUTER_THRESHOLD: 50,
SNAP_EDGE_INNER_THRESHOLD
};
Le.__workletHash = 3902544453390;
Le.__initData = __initData8;
callback4 = useCallback(Le, [derivedValue2, sharedValue10, sharedValue11, sharedValue12, derivedValue, sharedValue2, derivedValue3]);
const ye = function ye() {
if (!(sharedValue13.get() > 0)) {
if (sharedValue14.get()) {
sharedValue14.set(false);
callback2("cover");
return void 0;
}
if (sharedValue10.get() < derivedValue3.get()) {
callback2("fit");
} else {
const r39 = Math.max(0, (sharedValue8.get().height - derivedValue.get().height / sharedValue10.get()) / 2);
const r18 = Math.max(0, (sharedValue8.get().width - derivedValue.get().width / sharedValue10.get()) / 2);
sharedValue11.set(_spring.withSpring(Math.min(r18, Math.max(-r18, sharedValue11.get())), SCALE_PHYSICS));
sharedValue12.set(_spring.withSpring(Math.min(r39, Math.max(-r39, sharedValue12.get())), SCALE_PHYSICS));
}
}
};
ye.__closure = {
numGesturesActive: sharedValue13,
isInSnap: sharedValue14,
resetToDefaultSize: callback2,
scale: sharedValue10,
fitScale: derivedValue3,
videoDimensions: sharedValue2,
containerLayout: derivedValue,
translateX: sharedValue11,
withSpring: _spring.withSpring,
SCALE_PHYSICS,
translateY: sharedValue12
};
ye.__workletHash = 3493652911835;
ye.__initData = __initData9;
callback5 = useCallback(ye, [derivedValue3, sharedValue13, sharedValue14, sharedValue10, sharedValue2, derivedValue, sharedValue11, sharedValue12, callback2]);
const xe = () => {
let r9 = focused2.get()?.id === id2;
if (r9) {
const r11 = derivedValue4.get();
r9 = r11 ? sharedValue16.get() : !r11;
}
return r9;
};
xe.__closure = {
focused,
id,
isInDefaultZoom: derivedValue4,
isInPanToZoom: sharedValue16
};
xe.__workletHash = 5209373786986;
xe.__initData = __initData10;
const ke = function ke(a0, a1) {
if (a0 !== a1) {
setIsFocusedVideoZoomed(a0);
}
};
ke.__closure = {
setIsFocusedVideoZoomed
};
ke.__workletHash = 10707557639101;
ke.__initData = __initData11;
useAnimatedReaction(xe, ke);
const Me = () => focused2.get()?.id === id2;
Me.__closure = {
focused,
id
};
Me.__workletHash = 619124678280;
Me.__initData = __initData12;
const be = function be(a0, a1) {
if (a0 !== a1) {
callback3();
}
};
be.__closure = {
resetOnLayoutChange: callback3
};
be.__workletHash = 8458824233146;
be.__initData = __initData13;
useAnimatedReaction(Me, be);
const Ye = () => mode2.get();
Ye.__closure = {
mode
};
Ye.__workletHash = 7040117988961;
Ye.__initData = __initData14;
const Ne = function Ne(a0, a1) {
if (a0 !== a1) {
callback3();
}
};
Ne.__closure = {
resetOnLayoutChange: callback3
};
Ne.__workletHash = 9279120690968;
Ne.__initData = __initData15;
useAnimatedReaction(Ye, Ne);
const Ge = () => sharedValue8.get();
Ge.__closure = {
videoDimensions: sharedValue2
};
Ge.__workletHash = 8748184223523;
Ge.__initData = __initData16;
const Fe = function Fe(a0, a1) {
if (sharedValue17 != null && !(a0.width === a1?.width && a0.height === a1?.height)) {
callback3();
}
};
Fe.__closure = {
currentSizeThreshold: sharedValue17,
resetOnLayoutChange: callback3
};
Fe.__workletHash = 8464422969486;
Fe.__initData = __initData17;
useAnimatedReaction(Ge, Fe);
const ze = () => derivedValue2.get();
ze.__closure = {
coverScale: derivedValue2
};
ze.__workletHash = 5444376625069;
ze.__initData = __initData18;
const Xe = function Xe(a0, a1) {
const r6 = sharedValue17.get();
if (r6 === "cover" && a0 !== a1) {
callback2(r6);
}
};
Xe.__closure = {
currentSizeThreshold: sharedValue17,
resetToDefaultSize: callback2
};
Xe.__workletHash = 10764193588506;
Xe.__initData = __initData19;
useAnimatedReaction(ze, Xe);
const r301 = () => sharedValue14.get();
r301.__closure = {
isInSnap: sharedValue14
};
r301.__workletHash = 2178206594630;
r301.__initData = __initData20;
const Ze = function Ze(a0, a1) {
if (a0 !== a1 && a0) {
_ReanimatedRexport.runOnJS(_HapticUtils_native.triggerHapticFeedback)(_HapticUtils_native.HapticFeedbackTypes.IMPACT_LIGHT);
}
};
Ze.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
triggerHapticFeedback: _HapticUtils_native.triggerHapticFeedback,
HapticFeedbackTypes: _HapticUtils_native.HapticFeedbackTypes
};
Ze.__workletHash = 11115846398818;
Ze.__initData = __initData21;
useAnimatedReaction(r301, Ze);
const memo = useMemo(() => {
const r11 = Gesture.Tap().numberOfTaps(2);
const O = (a0, a1) => a1.fail();
O.__closure = {};
O.__workletHash = 17368742583362;
O.__initData = __initData23;
const r41 = r11.onTouchesMove(O);
const E = function E() {
if (derivedValue4.get()) {
if (focused2.get()?.id !== id2) {
_ReanimatedRexport.runOnJS(setFocused2)(id2);
} else {
_ReanimatedRexport.runOnJS(setFocused2)(null);
}
} else {
callback3();
}
};
E.__closure = {
isInDefaultZoom: derivedValue4,
resetOnLayoutChange: callback3,
focused: focused2,
id: id2,
runOnJS: _ReanimatedRexport.runOnJS,
setFocused: setFocused2
};
E.__workletHash = 10743965328356;
E.__initData = __initData22;
const r52 = r41.onStart(E);
const r57 = Gesture.Tap();
const C = (a0, a1) => a1.fail();
C.__closure = {};
C.__workletHash = 8766053850176;
C.__initData = __initData25;
const r63 = r57.onTouchesMove(C);
const V = function V() {
if (controlsSpecs.get().mode === VoicePanelControlsModes.HIDDEN) {
_ReanimatedRexport.runOnJS(showControls)({
debounce: true
});
} else {
_ReanimatedRexport.runOnJS(hideControls)({
debounce: true
});
}
};
V.__closure = {
controlsSpecs,
VoicePanelControlsModes,
runOnJS: _ReanimatedRexport.runOnJS,
showControls,
hideControls
};
V.__workletHash = 11260765819879;
V.__initData = __initData24;
const r75 = Gesture.Exclusive(r52, r63.onStart(V));
const r83 = Gesture.Pinch().enabled(!state);
const r85 = function I(a0, a1) {
if (focused2.get()?.id !== id2) {
a1.fail();
}
};
r85.__closure = {
focused: focused2,
id: id2
};
r85.__workletHash = 8765017804058;
r85.__initData = __initData29;
const r89 = r83.onTouchesDown(r85);
const r91 = function D() {
sharedValue13.set(sharedValue13.get() + 1);
sharedValue16.set(false);
sharedValue17.set(null);
};
r91.__closure = {
numGesturesActive: sharedValue13,
isInPanToZoom: sharedValue16,
currentSizeThreshold: sharedValue17
};
r91.__workletHash = 3449238089307;
r91.__initData = __initData28;
const r96 = r89.onStart(r91);
const r98 = function w(a0) {
const r11 = sharedValue10.get();
const r13 = sharedValue10.get();
const scaleChange = a0.scaleChange;
const r21 = derivedValue3.get();
let r23 = scaleChange;
if (!(r13 >= r21)) {
const r2 = 1 - r13;
r23 = 1 + (scaleChange - 1) * Math.max(0.1, 1 - r2 * r2 * 5);
}
sharedValue10.set(r11 * r23);
const r41 = a0.focalX - derivedValue.get().width / 2;
const r47 = a0.focalY - derivedValue.get().height / 2;
const r56 = -1 * r41 * (a0.scaleChange - 1) / sharedValue10.get();
const r63 = -1 * r47 * (a0.scaleChange - 1) / sharedValue10.get();
sharedValue11.set(sharedValue11.get() + r56);
sharedValue12.set(sharedValue12.get() + r63);
sharedValue14.set(callback4());
};
r98.__closure = {
scale: sharedValue10,
getScaleChangeWithOverscroll,
fitScale: derivedValue3,
containerLayout: derivedValue,
translateX: sharedValue11,
translateY: sharedValue12,
isInSnap: sharedValue14,
isInCoverSnap: callback4
};
r98.__workletHash = 2077670235308;
r98.__initData = __initData27;
const r103 = r96.onChange(r98);
const v = function v() {
sharedValue13.set(sharedValue13.get() - 1);
callback5();
};
v.__closure = {
numGesturesActive: sharedValue13,
handleMovementEnd: callback5
};
v.__workletHash = 5853458336611;
v.__initData = __initData26;
const r110 = r103.onEnd(v);
const r124 = Gesture.Pan().enabled(!state).requireExternalGestureToFail(dismissToPIPGestureRef).averageTouches(true);
const f = function f(a0, a1) {
if (focused2.get()?.id !== id2) {
a1.fail();
}
};
f.__closure = {
focused: focused2,
id: id2
};
f.__workletHash = 2184905113389;
f.__initData = __initData35;
const r130 = r124.onTouchesDown(f);
const S = function S() {
sharedValue16.set(Date.now() - sharedValue15.get() <= 250);
sharedValue15.set(Date.now());
};
S.__closure = {
lastTapTimestamp: sharedValue15,
PAN_TO_ZOOM_TAP_TIME_MILLIS: 250,
isInPanToZoom: sharedValue16
};
S.__workletHash = 7713579688732;
S.__initData = __initData34;
const r137 = r130.onBegin(S);
const c = function c() {
if (sharedValue16.get()) {
_ReanimatedRexport.runOnJS(hideControls)();
}
sharedValue13.set(sharedValue13.get() + 1);
sharedValue17.set(null);
};
c.__closure = {
isInPanToZoom: sharedValue16,
runOnJS: _ReanimatedRexport.runOnJS,
hideControls,
numGesturesActive: sharedValue13,
currentSizeThreshold: sharedValue17
};
c.__workletHash = 16349993539830;
c.__initData = __initData33;
const r146 = r137.onStart(c);
const r148 = function(a0) {
if (sharedValue16.get()) {
const r0 = a0.changeY * PAN_TO_ZOOM_SCALE_FACTOR;
const r40 = sharedValue10.get();
const r43 = sharedValue10.get();
const r46 = derivedValue3.get();
const r2 = 1 + r0;
let r48 = r2;
if (!(r43 >= r46)) {
const r1 = 1 - r43;
r48 = 1 + (r2 - 1) * Math.max(0.1, 1 - r1 * r1 * 5);
}
sharedValue10.set(r40 * r48);
} else {
sharedValue11.set(sharedValue11.get() + a0.changeX / sharedValue10.get());
sharedValue12.set(sharedValue12.get() + a0.changeY / sharedValue10.get());
}
sharedValue14.set(callback4());
};
r148.__closure = {
isInPanToZoom: sharedValue16,
PAN_TO_ZOOM_SCALE_FACTOR,
scale: sharedValue10,
getScaleChangeWithOverscroll,
fitScale: derivedValue3,
translateX: sharedValue11,
translateY: sharedValue12,
isInSnap: sharedValue14,
isInCoverSnap: callback4
};
r148.__workletHash = 17282206686388;
r148.__initData = __initData32;
const r153 = r146.onChange(r148);
const r155 = function(a0) {
sharedValue13.set(sharedValue13.get() - 1);
sharedValue11.set(_spring.withSpring(sharedValue11.get() + a0.velocityX * FLING_VELOCITY_SCALING / sharedValue10.get(), SCALE_PHYSICS));
sharedValue12.set(_spring.withSpring(sharedValue12.get() + a0.velocityY * FLING_VELOCITY_SCALING / sharedValue10.get(), SCALE_PHYSICS));
callback5();
};
r155.__closure = {
numGesturesActive: sharedValue13,
translateX: sharedValue11,
withSpring: _spring.withSpring,
FLING_VELOCITY_SCALING,
scale: sharedValue10,
SCALE_PHYSICS,
translateY: sharedValue12,
handleMovementEnd: callback5
};
r155.__workletHash = 10045783163820;
r155.__initData = __initData31;
const r164 = r153.onEnd(r155);
const t = function t() {
sharedValue16.set(false);
};
t.__closure = {
isInPanToZoom: sharedValue16
};
t.__workletHash = 2318423816868;
t.__initData = __initData30;
return Gesture.Simultaneous(r75, r110, r164.onFinalize(t));
}, [state, dismissToPIPGestureRef, focused, id, sharedValue10, sharedValue11, sharedValue12, callback3, sharedValue13, sharedValue17, derivedValue, sharedValue14, callback4, callback5, sharedValue15, sharedValue16, derivedValue4, setFocused2, hideControls, controlsSpecs, showControls, derivedValue3]);
sharedValue3 = sharedValue10;
sharedValue4 = sharedValue11;
sharedValue5 = sharedValue12;
sharedValue6 = sharedValue14;
const r325 = PixelRatio.get();
c22654_24 = r325;
callback = useCallback(() => {
if (!(streamId == null || isCamera || mode.get() !== VoicePanelModes.PANEL)) {
const width = sharedValue2.get().width;
updateVideoSize(streamId, {
width: width * c22654_24,
height: sharedValue2.get().height * c22654_24
}, sharedValue3.get());
}
}, [streamId, isCamera, sharedValue10, sharedValue2, mode, r325]);
const Ke = () => [sharedValue3.get(), sharedValue2.get(), mode.get()];
Ke.__closure = {
scale: sharedValue10,
videoDimensions: sharedValue2,
mode
};
Ke.__workletHash = 16492795532326;
Ke.__initData = __initData39;
const Be = function Be(a0, a1) {
if (streamId != null) {
if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(a0, a1 == null ? void 0 : a1)) {
_ReanimatedRexport.runOnJS(callback)();
}
}
};
Be.__closure = {
streamId,
cheapWorkletShallowEqual: _cheapWorkletShallowEqual.cheapWorkletShallowEqual,
runOnJS: _ReanimatedRexport.runOnJS,
respondToVideoSizeUpdate: callback
};
Be.__workletHash = 5259362546534;
Be.__initData = __initData40;
useAnimatedReaction(Ke, Be);
useEffect(() => {
let c28192_0 = ExternalPip_android.addOnPipModeChangedListener((a0) => {
if (!a0) {
callback();
}
});
return () => {
if (c28192_0 != null) {
c28192_0.remove();
}
};
}, [callback]);
const lt = function lt() {
let r23, r26;
const r13 = sharedValue2.get();
const { width, height } = r13;
const mode3 = pIPState.mode;
const IN_APP = VoicePanelPIPModes.IN_APP;
let height2 = height;
let width2 = width;
if (mode3 === IN_APP) {
if (width > height) {
r26 = width * (pIPState.height / height) / sharedValue3.get();
r23 = pIPState.height / sharedValue3.get();
} else {
r23 = height * (pIPState.width / width) / sharedValue3.get();
r26 = pIPState.width / sharedValue3.get();
}
height2 = r23;
width2 = r26;
}
const r39 = sharedValue.get();
let scaleX = 1;
const opacity = r39 ? 0 : 1;
const transform = [{
scale: sharedValue3.get()
}, {
translateX: sharedValue4.get()
}, {
translateY: sharedValue5.get()
}, ,];
if (c22654_5) {
scaleX = -1;
}
transform[3] = {
scaleX
};
return {
width: width2,
height: height2,
opacity,
transform
};
};
lt.__closure = {
videoDimensions: sharedValue2,
pipState: pIPState,
VoicePanelPIPModes,
scale: sharedValue10,
disableAnimations: sharedValue,
translateX: sharedValue11,
translateY: sharedValue12,
mirror
};
lt.__workletHash = 4149619035590;
lt.__initData = __initData41;
const animatedStyle = useAnimatedStyle(lt);
token = useToken(Module712.modules.mobile.VOICE_TILE_BORDER_RADIUS);
sharedValue7 = useSharedValue(mode.get() !== VoicePanelModes.PIP ? focused.get()?.id !== id ? 0.3 : 0 : 0);
const ut = () => ({
inPip: mode.get() === VoicePanelModes.PIP,
isFocused: focused.get()?.id === id
});
ut.__closure = {
mode,
VoicePanelModes,
focused,
id
};
ut.__workletHash = 16147365192890;
ut.__initData = __initData42;
const dt = function dt(a0, a1) {
const r14 = a1 == null ? void 0 : a1;
L11: {
if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(a0, r14)) {
if (!a0.inPip && !a0.isFocused) {
sharedValue7.set(a1?.isFocused === true ? _ReanimatedRexport.withDelay(300, _timing.withTiming(0.3, {
duration: 0
}, "animate-never")) : 0.3);
break L11;
}
sharedValue7.set(0);
}
}
};
dt.__closure = {
cheapWorkletShallowEqual: _cheapWorkletShallowEqual.cheapWorkletShallowEqual,
strokeOpacity: sharedValue7,
withDelay: _ReanimatedRexport.withDelay,
withTiming: _timing.withTiming
};
dt.__workletHash = 5119744299592;
dt.__initData = __initData43;
useAnimatedReaction(ut, dt);
const St = function St() {
return sharedValue6.get() ? {
position: "absolute",
top: 0,
left: 0,
bottom: 0,
right: 0,
borderWidth: SNAP_EDGE_INNER_THRESHOLD,
overflow: "hidden",
borderColor: "white",
opacity: 0.5
} : {
position: "absolute",
top: -1,
left: -1,
bottom: -1,
right: -1,
borderWidth: 2,
borderRadius: token + 2,
overflow: "hidden",
borderColor: "white",
opacity: sharedValue7.get()
};
};
St.__closure = {
isInSnap: sharedValue14,
SNAP_EDGE_INNER_THRESHOLD,
borderRadius: token,
strokeOpacity: sharedValue7
};
St.__workletHash = 5172898891721;
St.__initData = __initData44;
const animatedStyle2 = useAnimatedStyle(St);
const ft = function ft(a0) {
return layout(a0, sharedValue.get());
};
ft.__closure = {
layout,
disableAnimations: sharedValue
};
ft.__workletHash = 12145775353383;
ft.__initData = __initData45;
const callback8 = useCallback(ft, [layout, sharedValue]);
return <GestureDetector gesture={memo}>
<ReanimatedNativeView style={[styles.wrapper, style]} layout={callback8}>
<ReanimatedNativeView style={[styles.animatedWrapperStyles, animatedStyle]} layout={callback8}>
<AnimatedComponent useSurfaceDirectRenderer={surfaceDirectRendererExperiment} streamId={streamId} onReady={callback6} onSize={callback7} style={styles.video} layout={callback8} />
</ReanimatedNativeView>
{state ? <MessageLoadingSpinner animate style={styles.spinner} /> : <ReanimatedNativeView style={animatedStyle2} layout={callback8} pointerEvents="none" />}
</ReanimatedNativeView>
</GestureDetector>;
});
export default r110;