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

575 lines
25 KiB
TypeScript

// Metro module 15986 (f15987).
import * as Module19 from "react";
import { useContext, useEffect, useMemo, useCallback, useState, useRef } from "react";
import { StyleSheet, Platform } from "react-native";
import EmbeddedActivitiesStore from "../../../activities/EmbeddedActivitiesStore";
import FramesStore from "../../../frames/FramesStore";
import VoicePanelStore from "../../VoicePanelStore";
import { DRAWER_SPRING_PHYSICS, VoicePanelModes, SECONDARY_PIP_TOP_MARGIN } from "../../VoicePanelConstants";
import { VoicePanelControlsModes } from "../controls/VoicePanelControlsConstants";
import { VoicePanelPIPModes } from "./VoicePanelPIPConstants";
import { ActivityPanelModes } from "../../../activities/panel/ActivityPanelConstants";
import * as _spring from "../../../../design/animation/reanimated/spring/spring";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import VoicePanelStateContext from "../VoicePanelStateContext";
import { usePIPState } from "./VoicePanelPIPStateContext";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import { useSharedValue, useAnimatedStyle, useAnimatedReaction } from "../../../reanimated/ReanimatedRexport";
import * as _VoicePanelPIPUtils from "./VoicePanelPIPUtils";
import * as _Module5273 from "../../../../_bundle/Module5273";
import { Gesture, GestureDetector } from "../../../../_bundle/Module5273";
import updateSharedValueIfChanged_native from "../../../reanimated/utils/updateSharedValueIfChanged.native";
import triggerIOSHaptic from "../utils/triggerIOSHaptic";
import ExternalPip_android from "../../../external_pip/ExternalPip.android";
import { useStateFromStoresObject } from "../../../../_bundle/Module589";
import { getEmbeddedActivityLocationChannelId } from "../../../activities/utils/embeddedActivityLocationUtils";
import FramesActionCreators_native from "../../../frames/FramesActionCreators.native";
import { updateActivityPanelMode } from "../../../activities/EmbeddedActivitiesActionCreators";
import useStateFromSharedValue from "../../../reanimated/native/useStateFromSharedValue";
import * as _index_native from "../../../../intl/index.native";
import { intl } from "../../../../intl/index.native";
import ReanimatedNativeView from "../../../core/native/ReanimatedNativeView";
import VoicePanelPIPContent from "./VoicePanelPIPContent";
import VoicePanelPIPPushToTalkOverlay from "./VoicePanelPIPPushToTalkOverlay";
import NativeView from "../../../core/native/NativeView";
import VoicePanelSecondaryPIPContent from "./VoicePanelSecondaryPIPContent";
import * as _TransitionGroup from "../../../../design/components/TransitionGroup/TransitionGroup";
import { TransitionItem } from "../../../../design/components/TransitionGroup/TransitionGroup";
let LAYOUT_PHYSICS, layoutTransition, useStyles, __initData, __initData2, __initData3, __initData4, __initData5, __initData6, __initData7, __initData8, __initData9, __initData10, __initData11, __initData12, __initData13, __initData14, __initData15, Component, renderPIPWrapper;
const VoicePanelPIP = function VoicePanelPIP() {
let stateFromStoresObject;
let callback, currentEmbeddedActivityIsNotInCurrentChannel, hasFrame, callback2;
const styles2 = useStyles();
const context = useContext(VoicePanelStateContext);
const { controlsSpecs: controlsSpecs2, setMode } = context;
const pIPState = usePIPState();
const mode = pIPState.mode;
callback = void 0;
currentEmbeddedActivityIsNotInCurrentChannel = void 0;
hasFrame = void 0;
callback2 = void 0;
const styles = useStyles();
const context2 = useContext(VoicePanelStateContext);
const { controlsSpecs, hideControls, pipAvoidanceSpecs, safeArea, setFocused, setMode: setMode2, showControls, windowDimensions, wrapperDimensions, wrapperOffset, channelId } = context2;
const pIPState2 = usePIPState();
const sharedValue = useSharedValue({
x: 0,
y: 0,
absoluteX: 0,
absoluteY: 0,
active: false,
pressed: false
});
const sharedValue2 = useSharedValue(0);
useEffect(() => {
let c30940_0 = setTimeout(() => {
sharedValue2.set(1);
}, 200);
return () => {
clearTimeout(c30940_0);
};
}, [sharedValue2]);
const U = function U() {
const width = pIPState2.width;
const height = pIPState2.showSecondaryPIP ? pIPState2.containerHeight : pIPState2.height;
const clampedPIPPosition = _VoicePanelPIPUtils.getClampedPIPPosition({
pipX: wrapperDimensions.get().pipX,
pipY: wrapperDimensions.get().pipY,
width,
height,
windowDimensions: windowDimensions.get(),
safeArea: safeArea.get(),
bottomAvoidanceRegion: pipAvoidanceSpecs.get().bottom,
topAvoidanceRegion: pipAvoidanceSpecs.get().top,
positionOffset: sharedValue.get().active ? sharedValue.get() : void 0
});
const { x: r13, y: r41 } = clampedPIPPosition;
return {
width,
height,
opacity: sharedValue2.get(),
transform: [{
translateX: _spring.withSpring(r13, sharedValue.get().active ? DRAWER_SPRING_PHYSICS : LAYOUT_PHYSICS)
}, {
translateY: _spring.withSpring(r41, sharedValue.get().active ? DRAWER_SPRING_PHYSICS : LAYOUT_PHYSICS)
}],
borderRadius: _VoicePanelPIPUtils.getVoicePanelPIPBorderRadius(width, height)
};
};
U.__closure = {
pipState: pIPState2,
getClampedPIPPosition: _VoicePanelPIPUtils.getClampedPIPPosition,
wrapperDimensions,
windowDimensions,
safeArea,
pipAvoidanceSpecs,
initialGestureOffset: sharedValue,
opacity: sharedValue2,
withSpring: _spring.withSpring,
DRAWER_SPRING_PHYSICS,
LAYOUT_PHYSICS,
getVoicePanelPIPBorderRadius: _VoicePanelPIPUtils.getVoicePanelPIPBorderRadius
};
U.__workletHash = 6729444248940;
U.__initData = __initData;
const animatedStyle = useAnimatedStyle(U);
const j = function j() {
const { width, height } = pIPState2;
return {
width,
height,
borderRadius: _VoicePanelPIPUtils.getVoicePanelPIPBorderRadius(width, height)
};
};
j.__closure = {
pipState: pIPState2,
getVoicePanelPIPBorderRadius: _VoicePanelPIPUtils.getVoicePanelPIPBorderRadius
};
j.__workletHash = 1914976453427;
j.__initData = __initData2;
const animatedStyle2 = useAnimatedStyle(j);
const memo = useMemo(() => [styles.pipContentWrapper, {
width: pIPState2.width,
height: pIPState2.height,
borderRadius: _VoicePanelPIPUtils.getVoicePanelPIPBorderRadius(pIPState2.width, pIPState2.height)
}, styles.inAppElevationShadow], [styles, pIPState2.width, pIPState2.height]);
callback = useCallback(() => {
const shouldCancelWhenOutside = Gesture.Pan().enabled(true).manualActivation(true).maxPointers(1).shouldCancelWhenOutside(false);
const c = function c(a0) {
sharedValue.set({
x: 0,
y: 0,
absoluteX: a0.absoluteX,
absoluteY: a0.absoluteY,
active: false,
pressed: true
});
};
c.__closure = {
initialGestureOffset: sharedValue
};
c.__workletHash = 4684366251999;
c.__initData = __initData9;
const r30 = shouldCancelWhenOutside.onBegin(c);
const l = function l() {
updateSharedValueIfChanged_native(sharedValue, {
pressed: false
});
};
l.__closure = {
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
initialGestureOffset: sharedValue
};
l.__workletHash = 17295075038028;
l.__initData = __initData8;
const r37 = r30.onTouchesUp(l);
const u = function u(a0, a1) {
if (a0.state === _Module5273.State.BEGAN && !sharedValue.get().active) {
const r23 = a0.changedTouches[0];
const { absoluteY, absoluteX } = r23;
if (Math.abs(sharedValue.get().absoluteX - absoluteX) > 10 || Math.abs(sharedValue.get().absoluteY - absoluteY) > 10) {
sharedValue.set({
x: 0,
y: 0,
absoluteX,
absoluteY,
pressed: true,
active: true
});
updateSharedValueIfChanged_native(wrapperOffset, {
gestureActive: true,
x: 0,
y: 0
});
a1.activate();
_ReanimatedRexport.runOnJS(triggerIOSHaptic)();
}
}
};
u.__closure = {
State: _Module5273.State,
initialGestureOffset: sharedValue,
MIN_GESTURE_START: 10,
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
wrapperOffset,
runOnJS: _ReanimatedRexport.runOnJS,
triggerIOSHaptic
};
u.__workletHash = 16714994610987;
u.__initData = __initData7;
const r53 = r37.onTouchesMove(u);
const r55 = function({ absoluteX, absoluteY }) {
updateSharedValueIfChanged_native(sharedValue, {
x: absoluteX - sharedValue.get().absoluteX,
y: absoluteY - sharedValue.get().absoluteY
});
};
r55.__closure = {
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
initialGestureOffset: sharedValue
};
r55.__workletHash = 7822444262980;
r55.__initData = __initData6;
const r61 = r53.onChange(r55);
const r63 = function(a0) {
const r20 = _VoicePanelPIPUtils.calculatePIPPositionFromVelocity({
velocityX: a0.velocityX,
velocityY: a0.velocityY,
absoluteX: a0.absoluteX,
absoluteY: a0.absoluteY,
windowDimensions: windowDimensions.get(),
safeArea: safeArea.get()
});
updateSharedValueIfChanged_native(wrapperDimensions, {
pipX: r20.pipX,
pipY: r20.pipY
});
updateSharedValueIfChanged_native(wrapperOffset, {
gestureActive: false
});
updateSharedValueIfChanged_native(sharedValue, {
active: false,
pressed: false
});
_ReanimatedRexport.runOnJS(ExternalPip_android.updateSourceTrackingView)();
};
r63.__closure = {
calculatePIPPositionFromVelocity: _VoicePanelPIPUtils.calculatePIPPositionFromVelocity,
windowDimensions,
safeArea,
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
wrapperDimensions,
wrapperOffset,
initialGestureOffset: sharedValue,
runOnJS: _ReanimatedRexport.runOnJS,
updateSourceTrackingView: ExternalPip_android.updateSourceTrackingView
};
r63.__workletHash = 1502716164658;
r63.__initData = __initData5;
const r81 = r61.onEnd(r63);
const r83 = function n() {
updateSharedValueIfChanged_native(sharedValue, {
active: false,
pressed: false
});
};
r83.__closure = {
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
initialGestureOffset: sharedValue
};
r83.__workletHash = 4606005866023;
r83.__initData = __initData4;
const r89 = r81.onTouchesCancelled(r83);
const r91 = function t() {
updateSharedValueIfChanged_native(sharedValue, {
active: false,
pressed: false
});
};
r91.__closure = {
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
initialGestureOffset: sharedValue
};
r91.__workletHash = 5443656412422;
r91.__initData = __initData3;
return r89.onFinalize(r91);
}, [sharedValue, safeArea, windowDimensions, wrapperDimensions, wrapperOffset]);
const memo2 = useMemo(() => {
const r25 = Gesture.Tap().enabled(mode !== VoicePanelPIPModes.IN_APP).maxDistance(30);
const r27 = function() {
_ReanimatedRexport.runOnJS(setFocused)(null);
};
r27.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setFocused
};
r27.__workletHash = 10703348418884;
r27.__initData = __initData10;
const r35 = r25.onStart(r27).numberOfTaps(2);
const r45 = Gesture.Tap().enabled(true).maxDistance(30);
const r47 = function n() {
if (mode === VoicePanelPIPModes.IN_APP) {
_ReanimatedRexport.runOnJS(setMode2)(VoicePanelModes.PANEL);
} else if (controlsSpecs.get().mode === VoicePanelControlsModes.HIDDEN) {
_ReanimatedRexport.runOnJS(showControls)();
} else {
_ReanimatedRexport.runOnJS(hideControls)();
}
};
r47.__closure = {
pipMode: mode,
VoicePanelPIPModes,
runOnJS: _ReanimatedRexport.runOnJS,
setMode: setMode2,
VoicePanelModes,
controlsSpecs,
VoicePanelControlsModes,
showControls,
hideControls
};
r47.__workletHash = 9532493963151;
r47.__initData = __initData11;
return Gesture.Exclusive(r35, r45.onStart(r47), callback());
}, [controlsSpecs, hideControls, setFocused, showControls, mode, setMode2, callback]);
const stateFromStoresObject2 = useStateFromStoresObject([EmbeddedActivitiesStore, FramesStore], () => ({
currentEmbeddedActivityIsNotInCurrentChannel: getEmbeddedActivityLocationChannelId(EmbeddedActivitiesStore.getCurrentEmbeddedActivity()?.location) !== channelId,
hasFrame: FramesStore.getConnectedFrame() != null
}));
currentEmbeddedActivityIsNotInCurrentChannel = stateFromStoresObject2.currentEmbeddedActivityIsNotInCurrentChannel;
hasFrame = stateFromStoresObject2.hasFrame;
callback2 = useCallback(() => {
if (currentEmbeddedActivityIsNotInCurrentChannel) {
setMode2(VoicePanelModes.PIP);
setFocused(null);
}
if (hasFrame) {
FramesActionCreators_native.updateFramePanelMode(ActivityPanelModes.PANEL);
} else {
updateActivityPanelMode(ActivityPanelModes.PANEL);
}
}, [currentEmbeddedActivityIsNotInCurrentChannel, hasFrame, setMode2, setFocused]);
const memo3 = useMemo(() => {
const r7 = Gesture.Tap().maxDistance(30);
const r19 = function t() {
_ReanimatedRexport.runOnJS(callback2)();
};
r19.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
handleSecondaryPIPTap: callback2
};
r19.__workletHash = 8361527940381;
r19.__initData = __initData12;
return Gesture.Exclusive(r7.onStart(r19), callback());
}, [callback, callback2]);
let pushToTalk = useStateFromSharedValue(controlsSpecs2).pushToTalk;
const [state, setState] = useState(pIPState.mode != null);
useEffect(() => {
if (!(pIPState.mode == null || state)) {
setState(true);
}
}, [pIPState.mode, state]);
let r139 = pIPState.mode != null || state;
stateFromStoresObject = useStateFromStoresObject([FramesStore], () => FramesStore.getConnectedFrame() != null);
const Z = () => ({
borderRadius: _VoicePanelPIPUtils.getVoicePanelPIPBorderRadius(pIPState.width, pIPState.height)
});
Z.__closure = {
getVoicePanelPIPBorderRadius: _VoicePanelPIPUtils.getVoicePanelPIPBorderRadius,
pipState: pIPState
};
Z.__workletHash = 9598016909682;
Z.__initData = __initData13;
const animatedStyle3 = useAnimatedStyle(Z);
const memo4 = useMemo(() => ({
accessible: true,
accessibilityLabel: intl.string(_index_native.t.oN8bqe),
accessibilityRole: "button",
accessibilityActions: [{
name: "activate"
}],
onAccessibilityAction: () => {
setMode(VoicePanelModes.PANEL);
}
}), [setMode]);
const memo5 = useMemo(() => ({
accessible: true,
accessibilityLabel: intl.string(_index_native.t["3ejJer"]),
accessibilityActions: [{
name: "activate"
}],
onAccessibilityAction: () => {
if (stateFromStoresObject) {
FramesActionCreators_native.updateFramePanelMode(ActivityPanelModes.PANEL);
} else {
updateActivityPanelMode(ActivityPanelModes.PANEL);
}
}
}), [stateFromStoresObject]);
const r167 = VoicePanelStore((a0) => a0.isActivityFocused);
if (pushToTalk) {
pushToTalk = pIPState.mode !== VoicePanelPIPModes.IN_PANEL || r167;
}
if (r139) {
r139 = <ReanimatedNativeView style={[styles2.pipContentWrapper, styles2.inAppElevationShadow, animatedStyle2]} pointerEvents="box-none" layout={layoutTransition} {...memo4}>
<GestureDetector gesture={memo2}>
<ReanimatedNativeView style={[styles2.pipMask, animatedStyle3]} layout={layoutTransition}>
<VoicePanelPIPContent />
</ReanimatedNativeView>
</GestureDetector>
{pushToTalk ? <VoicePanelPIPPushToTalkOverlay /> : null}
</ReanimatedNativeView>;
}
return <ReanimatedNativeView pointerEvents="box-none" style={[styles2.multiPIPContainer, animatedStyle]} layout={layoutTransition}>
{r139}
{pIPState.showSecondaryPIP && <NativeView style={memo} {...memo5}>
<ReanimatedNativeView style={[styles2.pipMask, animatedStyle3]}>
<GestureDetector gesture={memo3}>
<NativeView style={StyleSheet.absoluteFill}>
<VoicePanelSecondaryPIPContent />
</NativeView>
</GestureDetector>
</ReanimatedNativeView>
</NativeView>}
</ReanimatedNativeView>;
};
renderPIPWrapper = function renderPIPWrapper(a0, a1, a2, a3) {
return <Component key={a0} pipMode={a1.pipMode} transitionState={a2} transitionCleanUp={a3} />;
};
Platform;
LAYOUT_PHYSICS = {
mass: 0.3,
damping: 80,
stiffness: 150
};
const layoutTransition2 = function layoutTransition(a0) {
return {
animations: {
originX: _spring.withSpring(a0.targetOriginX, LAYOUT_PHYSICS),
originY: _spring.withSpring(a0.targetOriginY, LAYOUT_PHYSICS),
width: _spring.withSpring(a0.targetWidth, LAYOUT_PHYSICS),
height: _spring.withSpring(a0.targetHeight, LAYOUT_PHYSICS)
},
initialValues: {
originX: a0.currentOriginX,
originY: a0.currentOriginY,
width: a0.currentWidth,
height: a0.currentHeight
}
};
};
layoutTransition2.__closure = {
withSpring: _spring.withSpring,
LAYOUT_PHYSICS
};
layoutTransition2.__workletHash = 9346092352642;
layoutTransition2.__initData = {
code: "function layoutTransition_VoicePanelPIPTsx1(values){const{withSpring,LAYOUT_PHYSICS}=this.__closure;return{animations:{originX:withSpring(values.targetOriginX,LAYOUT_PHYSICS),originY:withSpring(values.targetOriginY,LAYOUT_PHYSICS),width:withSpring(values.targetWidth,LAYOUT_PHYSICS),height:withSpring(values.targetHeight,LAYOUT_PHYSICS)},initialValues:{originX:values.currentOriginX,originY:values.currentOriginY,width:values.currentWidth,height:values.currentHeight}};}"
};
layoutTransition = layoutTransition2;
useStyles = createStyles({
pipContentWrapper: {
backgroundColor: "black"
},
inAppElevationShadow: {},
pipMask: {
...StyleSheet.absoluteFillObject,
overflow: "hidden"
},
multiPIPContainer: {
position: "absolute",
zIndex: 10,
flexDirection: "column",
alignItems: "center",
gap: SECONDARY_PIP_TOP_MARGIN
}
});
__initData = {
code: "function VoicePanelPIPTsx2(){const{pipState,getClampedPIPPosition,wrapperDimensions,windowDimensions,safeArea,pipAvoidanceSpecs,initialGestureOffset,opacity,withSpring,DRAWER_SPRING_PHYSICS,LAYOUT_PHYSICS,getVoicePanelPIPBorderRadius}=this.__closure;const width=pipState.width;const height=!pipState.showSecondaryPIP?pipState.height:pipState.containerHeight;const{x:x,y:y}=getClampedPIPPosition({pipX:wrapperDimensions.get().pipX,pipY:wrapperDimensions.get().pipY,width:width,height:height,windowDimensions:windowDimensions.get(),safeArea:safeArea.get(),bottomAvoidanceRegion:pipAvoidanceSpecs.get().bottom,topAvoidanceRegion:pipAvoidanceSpecs.get().top,positionOffset:initialGestureOffset.get().active?initialGestureOffset.get():undefined});return{width:width,height:height,opacity:opacity.get(),transform:[{translateX:withSpring(x,initialGestureOffset.get().active?DRAWER_SPRING_PHYSICS:LAYOUT_PHYSICS)},{translateY:withSpring(y,initialGestureOffset.get().active?DRAWER_SPRING_PHYSICS:LAYOUT_PHYSICS)}],borderRadius:getVoicePanelPIPBorderRadius(width,height)};}"
};
__initData2 = {
code: "function VoicePanelPIPTsx3(){const{pipState,getVoicePanelPIPBorderRadius}=this.__closure;const{width:width,height:height}=pipState;return{width:width,height:height,borderRadius:getVoicePanelPIPBorderRadius(width,height)};}"
};
__initData3 = {
code: "function VoicePanelPIPTsx4(){const{updateSharedValueIfChanged,initialGestureOffset}=this.__closure;updateSharedValueIfChanged(initialGestureOffset,{active:false,pressed:false});}"
};
__initData4 = {
code: "function VoicePanelPIPTsx5(){const{updateSharedValueIfChanged,initialGestureOffset}=this.__closure;updateSharedValueIfChanged(initialGestureOffset,{active:false,pressed:false});}"
};
__initData5 = {
code: "function VoicePanelPIPTsx6({velocityX:velocityX,velocityY:velocityY,absoluteX:absoluteX,absoluteY:absoluteY}){const{calculatePIPPositionFromVelocity,windowDimensions,safeArea,updateSharedValueIfChanged,wrapperDimensions,wrapperOffset,initialGestureOffset,runOnJS,updateSourceTrackingView}=this.__closure;const{pipX:pipX,pipY:pipY}=calculatePIPPositionFromVelocity({velocityX:velocityX,velocityY:velocityY,absoluteX:absoluteX,absoluteY:absoluteY,windowDimensions:windowDimensions.get(),safeArea:safeArea.get()});updateSharedValueIfChanged(wrapperDimensions,{pipX:pipX,pipY:pipY});updateSharedValueIfChanged(wrapperOffset,{gestureActive:false});updateSharedValueIfChanged(initialGestureOffset,{active:false,pressed:false});runOnJS(updateSourceTrackingView)();}"
};
__initData6 = {
code: "function VoicePanelPIPTsx7({absoluteX:absoluteX,absoluteY:absoluteY}){const{updateSharedValueIfChanged,initialGestureOffset}=this.__closure;updateSharedValueIfChanged(initialGestureOffset,{x:absoluteX-initialGestureOffset.get().absoluteX,y:absoluteY-initialGestureOffset.get().absoluteY});}"
};
__initData7 = {
code: "function VoicePanelPIPTsx8(event,manager){const{State,initialGestureOffset,MIN_GESTURE_START,updateSharedValueIfChanged,wrapperOffset,runOnJS,triggerIOSHaptic}=this.__closure;if(event.state!==State.BEGAN||initialGestureOffset.get().active)return;const{absoluteY:absoluteY,absoluteX:absoluteX}=event.changedTouches[0];if(Math.abs(initialGestureOffset.get().absoluteX-absoluteX)>MIN_GESTURE_START||Math.abs(initialGestureOffset.get().absoluteY-absoluteY)>MIN_GESTURE_START){initialGestureOffset.set({x:0,y:0,absoluteX:absoluteX,absoluteY:absoluteY,pressed:true,active:true});updateSharedValueIfChanged(wrapperOffset,{gestureActive:true,x:0,y:0});manager.activate();runOnJS(triggerIOSHaptic)();}}"
};
__initData8 = {
code: "function VoicePanelPIPTsx9(){const{updateSharedValueIfChanged,initialGestureOffset}=this.__closure;updateSharedValueIfChanged(initialGestureOffset,{pressed:false});}"
};
__initData9 = {
code: "function VoicePanelPIPTsx10({absoluteX:absoluteX,absoluteY:absoluteY}){const{initialGestureOffset}=this.__closure;initialGestureOffset.set({x:0,y:0,absoluteX:absoluteX,absoluteY:absoluteY,active:false,pressed:true});}"
};
__initData10 = {
code: "function VoicePanelPIPTsx11(){const{runOnJS,setFocused}=this.__closure;runOnJS(setFocused)(null);}"
};
__initData11 = {
code: "function VoicePanelPIPTsx12(){const{pipMode,VoicePanelPIPModes,runOnJS,setMode,VoicePanelModes,controlsSpecs,VoicePanelControlsModes,showControls,hideControls}=this.__closure;if(pipMode===VoicePanelPIPModes.IN_APP){runOnJS(setMode)(VoicePanelModes.PANEL);}else{if(controlsSpecs.get().mode===VoicePanelControlsModes.HIDDEN){runOnJS(showControls)();}else{runOnJS(hideControls)();}}}"
};
__initData12 = {
code: "function VoicePanelPIPTsx13(){const{runOnJS,handleSecondaryPIPTap}=this.__closure;runOnJS(handleSecondaryPIPTap)();}"
};
__initData13 = {
code: "function VoicePanelPIPTsx14(){const{getVoicePanelPIPBorderRadius,pipState}=this.__closure;return{borderRadius:getVoicePanelPIPBorderRadius(pipState.width,pipState.height)};}"
};
__initData14 = {
code: "function VoicePanelPIPTsx15(){const{transitionState,TransitionStates,panelCardStillInPIP}=this.__closure;return transitionState===TransitionStates.YEETED&&!panelCardStillInPIP.get();}"
};
__initData15 = {
code: "function VoicePanelPIPTsx16(ready,prev){const{runOnJS,fireCleanup}=this.__closure;if(ready&&prev!==ready){runOnJS(fireCleanup)();}}"
};
Component = Module19.memo(function({ pipMode, transitionState, transitionCleanUp }) {
let ref, callback3, panelCardStillInPIP;
ref = void 0;
callback3 = void 0;
panelCardStillInPIP = void 0;
const [state, setState2] = useState(pipMode === VoicePanelPIPModes.IN_PANEL || transitionState === _TransitionGroup.TransitionStates.MOUNTED);
useEffect(() => {
let c28197_0 = setTimeout(() => setState2(true), 400);
return () => {
clearTimeout(c28197_0);
};
}, []);
ref = useRef(null);
callback3 = useCallback(() => {
if (ref.current != null) {
clearTimeout(ref.current);
ref.current = null;
}
transitionCleanUp();
}, [transitionCleanUp]);
useEffect(() => {
if (transitionState === _TransitionGroup.TransitionStates.YEETED) {
ref.current = setTimeout(callback3, 500);
return () => {
if (ref.current != null) {
clearTimeout(ref.current);
ref.current = null;
}
};
}
}, [transitionState, callback3]);
panelCardStillInPIP = useContext(VoicePanelStateContext).panelCardStillInPIP;
const I = () => transitionState === _TransitionGroup.TransitionStates.YEETED && !panelCardStillInPIP.get();
I.__closure = {
transitionState,
TransitionStates: _TransitionGroup.TransitionStates,
panelCardStillInPIP
};
I.__workletHash = 10653972388666;
I.__initData = __initData14;
const f = function f(a0, a1) {
if (a0 ? a1 !== a0 : a0) {
_ReanimatedRexport.runOnJS(callback3)();
}
};
f.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
fireCleanup: callback3
};
f.__workletHash = 1599147342710;
f.__initData = __initData15;
useAnimatedReaction(I, f);
return state ? <VoicePanelPIP /> : null;
});
const r89 = Module19.memo(function VoicePanelPIPWrapper() {
const pIPState3 = usePIPState();
const { mode: mode2, showSecondaryPIP } = pIPState3;
return <TransitionItem item={mode2 == null ? showSecondaryPIP ? {
pipMode: mode2
} : void 0 : {
pipMode: mode2
}} renderItem={renderPIPWrapper} />;
});
export default r89;