This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,574 @@
// 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;
@@ -0,0 +1,20 @@
// Metro module 15914 (f15915).
const r9 = {
IN_APP: "IN_APP",
IN_PANEL: "IN_PANEL"
};
export { r9 as VoicePanelPIPModes };
export const PIP_OFFSET_BOTTOM = 44;
export const PIPReferenceDimensions = {
width: 200,
height: 200
};
export const SquarePIPReferenceDimensions = {
width: 120,
height: 120
};
export const SquareActivityPIPReferenceDimensions = {
width: 96,
height: 96
};
export const DEFAULT_PIP_POSITION_OFFSET = 72;
@@ -0,0 +1,626 @@
// Metro module 15987 (f15988).
import * as Module19 from "react";
import { useContext, useEffect, useMemo, useState, useCallback, useLayoutEffect, useRef } from "react";
import { StyleSheet, PixelRatio } from "react-native";
import EmbeddedActivitiesStore from "../../../activities/EmbeddedActivitiesStore";
import ChannelRTCStore from "../../../calls/ChannelRTCStore";
import ChannelCallLifecycleStore from "../../../video_calls/native/ChannelCallLifecycleStore";
import ApplicationStreamingStore from "../../../../stores/ApplicationStreamingStore";
import AuthenticationStore from "../../../../stores/AuthenticationStore";
import ChannelStore from "../../../../stores/ChannelStore";
import UserStore from "../../../../stores/UserStore";
import { VoicePanelModes } from "../../VoicePanelConstants";
import { VoicePanelPIPModes } from "./VoicePanelPIPConstants";
import { ComponentActions, ApplicationStreamStates } from "../../../../Constants";
import { OrientationLockState, ActivityLayoutMode } from "../../../activities/Constants";
import { ParticipantTypes, isActivityParticipant } from "../../../calls/CallConstants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import VoicePanelStateContext from "../VoicePanelStateContext";
import { useSetHasActiveVideoOutputSink } from "../controller/VoicePanelStreamOutputSinkStack";
import Module10566 from "../../../../_bundle/Module10566";
import { ComponentDispatch } from "../../../../utils/ComponentDispatchUtils";
import { TransitionStates, TransitionGroup } from "../../../../design/components/TransitionGroup/TransitionGroup";
import { usePIPState } from "./VoicePanelPIPStateContext";
import NativeView from "../../../core/native/NativeView";
import { getVoicePanelPIPBorderRadius } from "./VoicePanelPIPUtils";
import { useStateFromStores, useStateFromStoresObject } from "../../../../_bundle/defaultAreStatesEqual";
import { getWindowDimensions } from "../../../screen/useWindowDimensions.native";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import { useAnimatedReaction, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import EmbeddedActivityView from "../../../activities/native/EmbeddedActivityView";
import { useDominantColorFromImage, getCachedSourceFromURI } from "../card/DominantColorUtils";
import { useSurfaceDirectRendererExperiment } from "../../../video_calls/native/SurfaceDirectRendererExperiment";
import { useCanRenderParticipantVideo } from "../../../video_calls/participantHasVideo";
import { Avatar, AvatarSizes, Icon } from "../../../../design/void/native";
import Module8346 from "../../../../_bundle/Module8346";
import { useTargetDimensionsSubscription } from "../card/VoicePanelCardLayoutManager";
import ReanimatedNativeView from "../../../core/native/ReanimatedNativeView";
import { updateVideoSize } from "../../../media/VideoActionCreators";
import ExternalPip_android from "../../../external_pip/ExternalPip.android";
import { StreamEnded } from "../../../../design/components/Illustration/native/redesign/generated/StreamEnded";
import { StreamFailed } from "../../../../design/components/Illustration/native/redesign/generated/StreamFailed";
function $mk98403($env) {
return () => {
const r7 = $env;
let env28198 = {
$parent: $env
};
const handleVideoReady = function handleVideoReady() {
clearTimeout(env28198[0]);
setTimeout($mk117136(env28198.$parent), 17);
};
env28198[1] = handleVideoReady;
const r9 = r7[0];
const r3 = $env.$parent;
const r5 = r3[0];
const r4 = r3[2];
if (r9 === r5(r4[22]).TransitionStates.YEETED) {
env28198[0] = setTimeout($mk112446(r7), 500);
r5(r4[21]).ComponentDispatch.subscribe(r3[16].VOICE_PANEL_PIP_CONTENT_READY, handleVideoReady);
return () => {
const r2 = env28198.$parent.$parent;
(0, r2[0])(r2[2][21]).ComponentDispatch.unsubscribe(r2[16].VOICE_PANEL_PIP_CONTENT_READY, env28198[1]);
clearTimeout(env28198[0]);
};
}
};
}
function $mk112446($env) {
return () => {
const r3 = $env[1];
return r3 == null ? void 0 : r3();
};
}
function $mk117136($env) {
return () => {
const r3 = $env[1];
return r3 == null ? void 0 : r3();
};
}
let markContentReady, InnerStroke, ActivityInVoice, User, AnimatedVideoWrapper, Stream, getFocusedKey, renderFocusedParticipant, areParticipantsEqual, useStyles, c11456_27, c11456_28, c11456_30, c11456_31, c11456_32, c11456_33, c11456_35, EmptyPIP;
let env11456 = {};
const VideoStream = function VideoStream(props) {
const streamOutputSinkStack = useContext(VoicePanelStateContext).streamOutputSinkStack;
const streamId = props.streamId;
const setHasActiveVideoOutputSink = useSetHasActiveVideoOutputSink(streamOutputSinkStack);
useEffect(() => {
if (streamId != null) {
setHasActiveVideoOutputSink(streamId, true);
return () => {
setHasActiveVideoOutputSink(streamId, false);
};
}
}, [setHasActiveVideoOutputSink, streamId]);
return <Module10566 {...props} />;
};
markContentReady = function markContentReady() {
ComponentDispatch.dispatch(ComponentActions.VOICE_PANEL_PIP_CONTENT_READY);
};
InnerStroke = function InnerStroke({ style }) {
const pIPState = usePIPState();
const { width, height } = pIPState;
const styles = useStyles();
let c22686_3 = styles;
return (0, jsx)(NativeView, {
style: useMemo(() => [c22686_3.innerStroke, {
borderRadius: getVoicePanelPIPBorderRadius(width, height) + 1
}, style], [width, height, styles.innerStroke, style])
});
};
ActivityInVoice = function ActivityInVoice(props) {
let state, setState, stateFromStores, stateFromStores2, callback, c22687_9;
let env22688;
const { participantId, transitionState: transitionState2, transitionCleanUp: transitionCleanUp2 } = props;
state = void 0;
setState = void 0;
stateFromStores = void 0;
stateFromStores2 = void 0;
callback = void 0;
c22687_9 = void 0;
const styles = useStyles();
const r22 = env22688 = {
$parent: env11456
};
env22688[0] = transitionState2;
env22688[1] = transitionCleanUp2;
useEffect($mk98403(r22), [transitionState2, transitionCleanUp2]);
const r13 = transitionState2 === TransitionStates.YEETED ? styles.onTop : styles.onBottom;
const context = useContext(VoicePanelStateContext);
const { channelId, layoutManager, windowDimensions } = context;
const stateFromStores3 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId));
[state, setState] = useState(transitionState2 === TransitionStates.MOUNTED);
stateFromStores = useStateFromStores([ChannelRTCStore], () => {
const participant = ChannelRTCStore.getParticipant(channelId, participantId);
return participant != null ? participant.type === ParticipantTypes.ACTIVITY ? participant.applicationId : participantId : participantId;
}, [channelId, participantId]);
stateFromStores2 = useStateFromStores([EmbeddedActivitiesStore], () => EmbeddedActivitiesStore.getPipOrientationLockStateForApp(stateFromStores), [stateFromStores]);
callback = useCallback((a0) => {
L11: {
const r3 = a0.width > a0.height;
if (OrientationLockState.LANDSCAPE === stateFromStores2) {
layoutManager.setTargetDimensions(stateFromStores, 16, 9);
} else if (OrientationLockState.PORTRAIT === stateFromStores2) {
layoutManager.setTargetDimensions(stateFromStores, 9, 16);
} else {
if (OrientationLockState.UNLOCKED !== stateFromStores2 && stateFromStores2 !== null) {
break L11;
}
layoutManager.setTargetDimensions(stateFromStores, r3 ? 16 : 9, r3 ? 9 : 16);
}
}
}, [layoutManager, stateFromStores2, stateFromStores]);
useLayoutEffect(() => {
const windowDimensions2 = getWindowDimensions();
callback({
...windowDimensions2,
landscape: windowDimensions2.width > windowDimensions2.height
});
}, [callback]);
const r76 = () => windowDimensions.get();
r76.__closure = {
windowDimensions
};
r76.__workletHash = 20962628184;
r76.__initData = c11456_27;
const r80 = function(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(callback)(a0);
}
};
r80.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
handleTargetAspectRatioParams: callback
};
r80.__workletHash = 10001753822389;
r80.__initData = c11456_28;
useAnimatedReaction(r76, r80);
let r88 = null;
const r89 = stateFromStores3 != null;
c22687_9 = r89;
useEffect(() => {
if (!state && c22687_9) {
ComponentDispatch.dispatch(ComponentActions.VOICE_PANEL_PIP_CONTENT_READY);
} else if (state) {
let c28199_0 = setTimeout(() => {
setState(false);
ComponentDispatch.dispatch(ComponentActions.VOICE_PANEL_PIP_CONTENT_READY);
}, 500);
return () => {
clearTimeout(c28199_0);
};
}
}, [r89, state]);
if (!state) {
r88 = r89 ? <NativeView style={[styles.activity, r13]}>
<EmbeddedActivityView channel={stateFromStores3} layoutMode={ActivityLayoutMode.PIP} />
<InnerStroke />
</NativeView> : (0, jsx)(User, {
participantId: AuthenticationStore.getId()
});
}
return r88;
};
User = function User(props) {
let props2;
let dominantColorFromImage, setState2, callback2, c22689_10;
let env22690;
const { participantId: participantId2, transitionState: transitionState2, transitionCleanUp: transitionCleanUp2 } = props;
dominantColorFromImage = void 0;
setState2 = void 0;
callback2 = void 0;
c22689_10 = void 0;
const styles = useStyles();
let c22689_1 = styles;
const r32 = env22690 = {
$parent: env11456
};
env22690[0] = transitionState2;
env22690[1] = transitionCleanUp2;
useEffect($mk98403(r32), [transitionState2, transitionCleanUp2]);
const onTop = transitionState2 === TransitionStates.YEETED ? styles.onTop : styles.onBottom;
const context = useContext(VoicePanelStateContext);
const { channelId: channelId2, guildId, focused, mode, layoutManager: layoutManager2 } = context;
const stateFromStores3 = useStateFromStores([ChannelRTCStore], () => {
let r8 = ChannelRTCStore.getParticipant(channelId2, participantId2);
if (r8 == null) {
r8 = void 0;
}
return r8?.type === ParticipantTypes.USER ? r8 : void 0;
});
let r29 = stateFromStores3?.user;
if (r29 == null) {
r29 = UserStore.getCurrentUser();
}
dominantColorFromImage = useDominantColorFromImage(r29 == null ? void 0 : r29.getAvatarURL(guildId, 80, false));
const memo = useMemo(() => [c22689_1.user, onTop, {
backgroundColor: dominantColorFromImage
}], [styles, onTop, dominantColorFromImage]);
let state;
[state, setState2] = useState(false);
const surfaceDirectRendererExperiment = useSurfaceDirectRendererExperiment(stateFromStores3 == null ? void 0 : stateFromStores3.user?.id, {
location: "VoicePanelPIPContent"
});
callback2 = useCallback((a0, a1) => {
const r6 = a0 != null ? ChannelRTCStore.getParticipant(channelId2, a0) : void 0;
setState2(r6 != null && (0, isActivityParticipant)(r6) && a1 === VoicePanelModes.PANEL);
}, [channelId2]);
const r84 = () => focused.get()?.id;
r84.__closure = {
focused
};
r84.__workletHash = 3980010676581;
r84.__initData = c11456_30;
const c = function c(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(callback2)(a0, mode.get());
}
};
c.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
updateIsActivityFocused: callback2,
mode
};
c.__workletHash = 5971237403457;
c.__initData = c11456_31;
useAnimatedReaction(r84, c);
const I = () => mode.get();
I.__closure = {
mode
};
I.__workletHash = 8288240256860;
I.__initData = c11456_32;
const S = function S(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(callback2)(focused.get()?.id, a0);
}
};
S.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
updateIsActivityFocused: callback2,
focused
};
S.__workletHash = 12552370107483;
S.__initData = c11456_33;
useAnimatedReaction(I, S);
const stateFromStoresObject = useStateFromStoresObject([ChannelCallLifecycleStore], () => ({
isReactingToThermalState: ChannelCallLifecycleStore.isReactingToThermalState(),
consumedRequestToRespondToSeriousThermalState: ChannelCallLifecycleStore.consumedRequestToRespondToSeriousThermalState()
}));
const { isReactingToThermalState, consumedRequestToRespondToSeriousThermalState } = stateFromStoresObject;
const callback4 = useCallback(({ nativeEvent }) => {
layoutManager2.setTargetDimensions(participantId2, nativeEvent.width, nativeEvent.height);
}, [layoutManager2, participantId2]);
const r125 = useCanRenderParticipantVideo(stateFromStores3) && !(state && isReactingToThermalState);
c22689_10 = r125;
useEffect(() => {
if (!c22689_10) {
ComponentDispatch.dispatch(ComponentActions.VOICE_PANEL_PIP_CONTENT_READY);
}
}, [r125]);
const r134 = {
style: null,
children: null
};
if (r125) {
r134.style = [styles.blackBackground, styles.user];
r134.children = [<AnimatedVideoWrapper style={onTop} participantId={participantId2}>
<VideoStream useSurfaceDirectRenderer={surfaceDirectRendererExperiment} streamId={stateFromStores3.streamId} style={[styles.video, void 0]} onSize={callback4} onReady={markContentReady} />
</AnimatedVideoWrapper>, <InnerStroke />];
props2 = r134;
} else {
r134.style = memo;
r134.children = [<NativeView style={styles.avatarWrapper}>
{r29 != null ? <Avatar source={getCachedSourceFromURI(r29.getAvatarURL(guildId, 80, false))} size={state ? AvatarSizes.LARGE : AvatarSizes.XLARGE} avatarDecoration={stateFromStores3?.userAvatarDecoration} /> : null}
</NativeView>, <InnerStroke style={styles.userOpacity} />, state ? consumedRequestToRespondToSeriousThermalState ? <NativeView style={styles.thermalAlertIconContainer}>
<Icon style={styles.thermalAlertIcon} source={Module8346} color={styles.thermalAlertIcon.color} />
</NativeView> : null : null];
props2 = r134;
}
return <NativeView {...props2} />;
};
AnimatedVideoWrapper = function AnimatedVideoWrapper({ participantId: participantId4, style: style2, children }) {
const targetDimensionsSubscription = useTargetDimensionsSubscription(participantId4, useContext(VoicePanelStateContext).layoutManager);
const u = function u() {
const r8 = targetDimensionsSubscription.get();
const { width: width3, height: height3 } = r8;
const r0 = height3 < width3;
let width4 = "100%";
let height4 = "auto";
if (r0) {
width4 = "auto";
height4 = "100%";
}
return {
position: "absolute",
aspectRatio: width3 / height3,
width: width4,
height: height4
};
};
u.__closure = {
targetDimensions: targetDimensionsSubscription
};
u.__workletHash = 10377220209728;
u.__initData = c11456_35;
return (0, jsx)(ReanimatedNativeView, {
style: [style2, useAnimatedStyle(u)],
children
});
};
Stream = function Stream(props) {
let streamId2, c22692_5, ref, ref2, callback3, c22692_9;
let env22693;
const { participantId: participantId3, transitionState: transitionState2, transitionCleanUp: transitionCleanUp2 } = props;
streamId2 = void 0;
c22692_5 = void 0;
ref = void 0;
ref2 = void 0;
callback3 = void 0;
c22692_9 = void 0;
const styles = useStyles();
const mode2 = usePIPState().mode;
const r25 = env22693 = {
$parent: env11456
};
env22693[0] = transitionState2;
env22693[1] = transitionCleanUp2;
useEffect($mk98403(r25), [transitionState2, transitionCleanUp2]);
const style2 = transitionState2 === TransitionStates.YEETED ? styles.onTop : styles.onBottom;
const context = useContext(VoicePanelStateContext);
const { channelId: channelId3, layoutManager: layoutManager3 } = context;
const stateFromStoresObject = useStateFromStoresObject([ChannelRTCStore], () => {
const participant = ChannelRTCStore.getParticipant(channelId3, participantId3);
const r0 = participant != null && participant.type === ParticipantTypes.STREAM;
return {
streamId: r0 ? participant.streamId : void 0,
userId: r0 ? participant.user?.id : void 0
};
});
streamId2 = stateFromStoresObject.streamId;
const surfaceDirectRendererExperiment = useSurfaceDirectRendererExperiment(stateFromStoresObject.userId, {
location: "VoicePanelPIPContent.Stream"
});
const stateFromStores3 = useStateFromStores([ApplicationStreamingStore], () => ApplicationStreamingStore.getActiveStreamForStreamKey(participantId3)?.state);
const callback4 = useCallback(({ nativeEvent }) => {
layoutManager3.setTargetDimensions(participantId3, nativeEvent.width, nativeEvent.height);
}, [layoutManager3, participantId3]);
const r19 = PixelRatio.get();
c22692_5 = r19;
ref = useRef(0);
ref2 = useRef(0);
const callback5 = useCallback((a0) => {
if (streamId2 != null) {
const layout = a0.nativeEvent.layout;
const { width: width3, height: height3 } = layout;
if (!(width3 === ref.current && height3 === ref2.current)) {
ref.current = width3;
ref2.current = height3;
if (mode2 === VoicePanelPIPModes.IN_APP) {
updateVideoSize(streamId2, {
width: width3 * c22692_5,
height: height3 * c22692_5
}, 1);
}
}
}
}, [streamId2, r19, mode2]);
callback3 = useCallback((a0) => {
if (!(streamId2 == null || a0 || mode2 !== VoicePanelPIPModes.IN_APP)) {
const current = ref.current;
updateVideoSize(streamId2, {
width: current * c22692_5,
height: ref2.current * c22692_5
}, 1);
}
}, [streamId2, r19, mode2]);
useEffect(() => {
let c28200_0 = ExternalPip_android.addOnPipModeChangedListener(callback3);
return () => {
if (c28200_0 != null) {
c28200_0.remove();
}
};
}, [callback3]);
const r80 = streamId2 != null;
c22692_9 = r80;
useEffect(() => {
if (c22692_9) {
ComponentDispatch.dispatch(ComponentActions.VOICE_PANEL_PIP_CONTENT_READY);
}
}, [r80]);
return stateFromStores3 === ApplicationStreamStates.ENDED ? (0, jsx)(StreamEnded, {
style: styles.streamEmptyImage,
resizeMode: "contain"
}) : stateFromStores3 === ApplicationStreamStates.FAILED ? (0, jsx)(StreamFailed, {
style: styles.streamEmptyImage,
resizeMode: "contain"
}) : r80 ? <AnimatedVideoWrapper style={style2} participantId={participantId3}>
<VideoStream useSurfaceDirectRenderer={surfaceDirectRendererExperiment} streamId={streamId2} style={styles.video} onSize={callback4} onLayout={callback5} />
</AnimatedVideoWrapper> : <User participantId={participantId3} />;
};
getFocusedKey = function getFocusedKey(a0) {
return a0.id;
};
renderFocusedParticipant = function renderFocusedParticipant(a0, a1, a2, a3) {
if (a1.id === "--voice-panel-pip-empty") {
return (0, jsx)(EmptyPIP, {
transitionState: a2,
transitionCleanUp: a3
}, a0);
}
const props = {
participantId: a1.id,
transitionState: a2,
transitionCleanUp: a3
};
const type = a1.type;
if (ParticipantTypes.ACTIVITY === type) {
return <ActivityInVoice key={a0} {...props} />;
}
if (ParticipantTypes.STREAM === type) {
return <Stream key={a0} {...props} />;
}
if (ParticipantTypes.USER !== type) {
ParticipantTypes.HIDDEN_STREAM;
}
return <User key={a0} {...props} />;
};
areParticipantsEqual = function areParticipantsEqual(a0, a1) {
if (a0.length !== a1.length) {
return false;
}
if (a0.length === 0) {
return true;
}
let r14 = 0;
for (const item of a0) {
if (item.id === a1[r14]?.id) {
r14 = r14 + 1;
continue;
}
return false;
}
return true;
};
useStyles = createStyles({
contentWrapper: {
position: "absolute",
width: "100%",
height: "100%",
overflow: "hidden",
alignItems: "center",
justifyContent: "center"
},
userOpacity: {
opacity: 0.1
},
activity: {
position: "absolute",
width: "100%",
height: "100%"
},
user: {
position: "absolute",
width: "100%",
height: "100%",
alignItems: "center",
justifyContent: "center"
},
video: {
position: "absolute",
width: "100%",
height: "100%"
},
avatarWrapper: {
position: "relative",
width: "56%",
height: "56%",
alignItems: "center",
justifyContent: "center"
},
thermalAlertIconContainer: {
width: 22,
height: 22,
backgroundColor: "rgba(78, 80, 88, 0.48)",
borderRadius: Module712.radii.round,
justifyContent: "center",
alignItems: "center",
position: "absolute",
top: 6,
left: 6
},
thermalAlertIcon: {
width: 14,
height: 14,
color: Module712.colors.WHITE
},
onTop: {
zIndex: 1
},
onBottom: {
zIndex: 0
},
streamEmptyImage: {
width: "50%"
},
emptyPip: {
...StyleSheet.absoluteFillObject,
backgroundColor: Module712.colors.BLACK
},
innerStroke: {
position: "absolute",
top: -1,
left: -1,
bottom: -1,
right: -1,
borderWidth: 2,
borderColor: "white",
zIndex: 1,
opacity: 0.3
},
blackBackground: {
backgroundColor: "black"
}
});
c11456_27 = {
code: "function VoicePanelPIPContentTsx1(){const{windowDimensions}=this.__closure;return windowDimensions.get();}"
};
c11456_28 = {
code: "function VoicePanelPIPContentTsx2(windowDimensionsVal,previousWindowDimensionsVal){const{runOnJS,handleTargetAspectRatioParams}=this.__closure;if(windowDimensionsVal!==previousWindowDimensionsVal){runOnJS(handleTargetAspectRatioParams)(windowDimensionsVal);}}"
};
c11456_30 = {
code: "function VoicePanelPIPContentTsx3(){const{focused}=this.__closure;var _focused$get;return(_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id;}"
};
c11456_31 = {
code: "function VoicePanelPIPContentTsx4(focusedParticipantId,previousFocusedParticipantId){const{runOnJS,updateIsActivityFocused,mode}=this.__closure;if(focusedParticipantId!==previousFocusedParticipantId){runOnJS(updateIsActivityFocused)(focusedParticipantId,mode.get());}}"
};
c11456_32 = {
code: "function VoicePanelPIPContentTsx5(){const{mode}=this.__closure;return mode.get();}"
};
c11456_33 = {
code: "function VoicePanelPIPContentTsx6(modeVal,previousModeVal){const{runOnJS,updateIsActivityFocused,focused}=this.__closure;if(modeVal!==previousModeVal){var _focused$get;runOnJS(updateIsActivityFocused)((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id,modeVal);}}"
};
c11456_35 = {
code: "function VoicePanelPIPContentTsx7(){const{targetDimensions}=this.__closure;const{width:targetWidth,height:targetHeight}=targetDimensions.get();let height='100%';let width='100%';if(targetHeight<targetWidth){width='auto';}else{height='auto';}return{position:'absolute',aspectRatio:targetWidth/targetHeight,width:width,height:height};}"
};
EmptyPIP = Module19.memo(function EmptyPIP({ transitionState, transitionCleanUp }) {
const styles = useStyles();
useEffect(() => {
if (transitionState === TransitionStates.YEETED) {
transitionCleanUp();
}
}, [transitionState, transitionCleanUp]);
return (0, jsx)(NativeView, {
style: styles.emptyPip
});
});
const r114 = Module19.memo(function VoicePanelPIPContent() {
const channelId4 = useContext(VoicePanelStateContext).channelId;
const pIPState = usePIPState();
const { id, width: width2, height: height2 } = pIPState;
const styles = useStyles();
let c22695_4 = styles;
const id2 = AuthenticationStore.getId();
const stateFromStores3 = useStateFromStores([ChannelRTCStore], () => {
let id3 = id;
let type = id != null ? ChannelRTCStore.getParticipant(channelId4, id)?.type : ParticipantTypes.USER;
if (type == null) {
type = ParticipantTypes.USER;
}
if (id == null) {
id3 = id2;
}
return [{
id: id3,
type
}];
}, [id, channelId4, id2], areParticipantsEqual);
return <NativeView style={useMemo(() => [[c22695_4.contentWrapper, {
borderRadius: getVoicePanelPIPBorderRadius(width2, height2)
}]], [width2, height2, styles.contentWrapper])} pointerEvents="none">
<TransitionGroup items={stateFromStores3} renderItem={renderFocusedParticipant} getItemKey={getFocusedKey} />
</NativeView>;
});
export default r114;
@@ -0,0 +1,168 @@
// Metro module 15988 (f15989).
import { useRef, useCallback, useMemo } from "react";
import { StyleSheet } from "react-native";
import { PUSH_TO_TALK_PIP_PHYSICS } from "../../VoicePanelConstants";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import NativeView from "../../../core/native/NativeView";
import { Icon } from "../../../../design/void/native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { setPushToTalkState } from "../../../media_engine/MediaEngineActionCreators";
import { usePIPState } from "./VoicePanelPIPStateContext";
import * as _spring from "../../../../design/animation/reanimated/spring/spring";
import * as _VoicePanelPIPUtils from "./VoicePanelPIPUtils";
import { GestureDetector, Gesture } from "../../../../_bundle/Module5273";
import Module15989 from "../../../../_bundle/Module15989";
const AnimatedComponent = ReanimatedRexport.createAnimatedComponent(NativeView);
const AnimatedComponent2 = ReanimatedRexport.createAnimatedComponent(Icon);
const hitSlop = {
top: 6,
bottom: 6,
left: 6,
right: 6
};
const useStyles = createStyles({
iconContainer: {
position: "absolute",
width: 32,
height: 32,
alignItems: "center",
justifyContent: "center",
borderRadius: Module712.radii.round
},
overlay: {
...StyleSheet.absoluteFillObject,
backgroundColor: Module712.colors.BLACK
}
});
const __initData = {
code: "function VoicePanelPIPPushToTalkOverlayTsx1(){const{isPushingToTalk,EXPANDED_ICON_SIZE,BASE_ICON_SIZE,withSpring,PUSH_TO_TALK_PIP_PHYSICS,white}=this.__closure;const padding=isPushingToTalk.get()?8*EXPANDED_ICON_SIZE/BASE_ICON_SIZE+8:8;return{right:withSpring(padding,PUSH_TO_TALK_PIP_PHYSICS),bottom:withSpring(padding,PUSH_TO_TALK_PIP_PHYSICS),transform:[{scale:withSpring(isPushingToTalk.get()?EXPANDED_ICON_SIZE/BASE_ICON_SIZE:1,PUSH_TO_TALK_PIP_PHYSICS)}],backgroundColor:withSpring(isPushingToTalk.get()?white:'rgba(0, 0, 0, 0.54)',PUSH_TO_TALK_PIP_PHYSICS)};}"
};
const __initData2 = {
code: "function VoicePanelPIPPushToTalkOverlayTsx2(){const{withSpring,isPushingToTalk,black,white,PUSH_TO_TALK_PIP_PHYSICS}=this.__closure;return{tintColor:withSpring(isPushingToTalk.get()?black:white,PUSH_TO_TALK_PIP_PHYSICS)};}"
};
const __initData3 = {
code: "function VoicePanelPIPPushToTalkOverlayTsx3(){const{withSpring,isPushingToTalk,PUSH_TO_TALK_PIP_PHYSICS,getVoicePanelPIPBorderRadius,pipState}=this.__closure;return{opacity:withSpring(isPushingToTalk.get()?0.5:0,PUSH_TO_TALK_PIP_PHYSICS),borderRadius:getVoicePanelPIPBorderRadius(pipState.width,pipState.height)};}"
};
const __initData4 = {
code: "function VoicePanelPIPPushToTalkOverlayTsx4(event,success){const{runOnJS,handlePushToTalk}=this.__closure;if(!success){return;}runOnJS(handlePushToTalk)(false);}"
};
const __initData5 = {
code: "function VoicePanelPIPPushToTalkOverlayTsx5(){const{runOnJS,handlePushToTalk}=this.__closure;runOnJS(handlePushToTalk)(false);}"
};
const __initData6 = {
code: "function VoicePanelPIPPushToTalkOverlayTsx6(){const{runOnJS,handlePushToTalk}=this.__closure;runOnJS(handlePushToTalk)(true);}"
};
export default function VoicePanelPIPPushToTalkOverlay() {
let c22696_1, WHITE, BLACK;
const pIPState = usePIPState();
const styles = useStyles();
const sharedValue = useSharedValue(false);
const ref = useRef(false);
let [isPushingToTalk, handlePushToTalk] = [sharedValue, useCallback((a0) => {
if (a0 !== ref.current) {
ref.current = a0;
setPushToTalkState(a0);
sharedValue.set(a0);
}
}, [sharedValue])];
c22696_1 = isPushingToTalk;
WHITE = Module712.unsafe_rawColors.WHITE;
BLACK = Module712.unsafe_rawColors.BLACK;
const r46 = function() {
const r0 = c22696_1.get() ? 20 : 8;
return {
right: _spring.withSpring(r0, PUSH_TO_TALK_PIP_PHYSICS),
bottom: _spring.withSpring(r0, PUSH_TO_TALK_PIP_PHYSICS),
transform: [{
scale: _spring.withSpring(c22696_1.get() ? 1.5 : 1, PUSH_TO_TALK_PIP_PHYSICS)
}],
backgroundColor: _spring.withSpring(c22696_1.get() ? WHITE : "rgba(0, 0, 0, 0.54)", PUSH_TO_TALK_PIP_PHYSICS)
};
};
r46.__closure = {
isPushingToTalk,
EXPANDED_ICON_SIZE: 48,
BASE_ICON_SIZE: 32,
withSpring: _spring.withSpring,
PUSH_TO_TALK_PIP_PHYSICS,
white: WHITE
};
r46.__workletHash = 3936373516983;
r46.__initData = __initData;
const animatedStyle = useAnimatedStyle(r46);
const P = function P() {
return {
tintColor: _spring.withSpring(c22696_1.get() ? BLACK : WHITE, PUSH_TO_TALK_PIP_PHYSICS)
};
};
P.__closure = {
withSpring: _spring.withSpring,
isPushingToTalk,
black: BLACK,
white: WHITE,
PUSH_TO_TALK_PIP_PHYSICS
};
P.__workletHash = 11469896791985;
P.__initData = __initData2;
const animatedStyle2 = useAnimatedStyle(P);
const H = function H() {
return {
opacity: _spring.withSpring(c22696_1.get() ? 0.5 : 0, PUSH_TO_TALK_PIP_PHYSICS),
borderRadius: _VoicePanelPIPUtils.getVoicePanelPIPBorderRadius(pIPState.width, pIPState.height)
};
};
H.__closure = {
withSpring: _spring.withSpring,
isPushingToTalk,
PUSH_TO_TALK_PIP_PHYSICS,
getVoicePanelPIPBorderRadius: _VoicePanelPIPUtils.getVoicePanelPIPBorderRadius,
pipState: pIPState
};
H.__workletHash = 450590017248;
H.__initData = __initData3;
return <>
<AnimatedComponent pointerEvents="none" style={[styles.overlay, useAnimatedStyle(H)]} />
<GestureDetector gesture={useMemo(() => {
const r8 = Gesture.Tap().maxDistance(30);
const r23 = function(a0, a1) {
if (a1) {
_ReanimatedRexport.runOnJS(handlePushToTalk)(false);
}
};
r23.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
handlePushToTalk
};
r23.__workletHash = 13736796804739;
r23.__initData = __initData4;
const r29 = r8.onEnd(r23);
const shouldCancelWhenOutside = Gesture.Pan().maxPointers(1).shouldCancelWhenOutside(false);
const t = function t() {
_ReanimatedRexport.runOnJS(handlePushToTalk)(true);
};
t.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
handlePushToTalk
};
t.__workletHash = 246779667986;
t.__initData = __initData6;
const r46 = shouldCancelWhenOutside.onBegin(t);
const n = function n() {
_ReanimatedRexport.runOnJS(handlePushToTalk)(false);
};
n.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
handlePushToTalk
};
n.__workletHash = 12223608557562;
n.__initData = __initData5;
return Gesture.Exclusive(r29, r46.onFinalize(n));
}, [handlePushToTalk])}>
<AnimatedComponent style={[styles.iconContainer, animatedStyle]} hitSlop={hitSlop}>
<AnimatedComponent2 style={animatedStyle2} size={Icon.Sizes.SMALL_20} source={Module15989} disableColor />
</AnimatedComponent>
</GestureDetector>
</>;
};
@@ -0,0 +1,14 @@
// Metro module 15918 (f15919).
import { createContext, useContext } from "react";
const context = createContext({
id: void 0,
mode: void 0,
width: 0,
height: 0,
containerHeight: 0,
showSecondaryPIP: false
});
export { context as VoicePanelPIPStateContext };
export function usePIPState() {
return useContext(context);
}
@@ -0,0 +1,361 @@
// Metro module 15913 (f15914).
import ChannelRTCStore from "../../../calls/ChannelRTCStore";
import ApplicationStreamingStore from "../../../../stores/ApplicationStreamingStore";
import AuthenticationStore from "../../../../stores/AuthenticationStore";
import { SECONDARY_PIP_TOP_MARGIN, VoicePanelModes } from "../../VoicePanelConstants";
import { PIPReferenceDimensions, SquareActivityPIPReferenceDimensions, SquarePIPReferenceDimensions, VoicePanelPIPModes } from "./VoicePanelPIPConstants";
import { ParticipantTypes } from "../../../calls/CallConstants";
import { MIN_PIP_TOSS_VELOCITY, PIP_WINDOW_OFFSET } from "../../../panels/morphable/native/MorphablePanelConstants";
import { canRenderParticipantVideo } from "../../../video_calls/participantHasVideo";
import { isActivityParticipantCurrentUserCurrentSession } from "../../../activities/isActivityParticipantCurrentUserCurrentSession";
import Module712 from "../../../../_bundle/Module712";
let clamp, getPIPWindowDimensions, pipXYtoAbsoluteXY, xl, lg;
let c11397_14 = new Set();
const clamp2 = function clamp(a0, a1, a2) {
return Math.min(Math.max(a0, a1), a2);
};
clamp2.__closure = {};
clamp2.__workletHash = 10301627783217;
clamp2.__initData = {
code: "function clamp_VoicePanelPIPUtilsTsx1(value,min,max){return Math.min(Math.max(value,min),max);}"
};
clamp = clamp2;
const getPIPWindowDimensions2 = function getPIPWindowDimensions(a0, a1) {
const xOffset = Math.max(a1.left, PIP_WINDOW_OFFSET);
const yOffset = Math.max(a1.top, PIP_WINDOW_OFFSET);
return {
xOffset,
yOffset,
xRange: a0.width - xOffset - Math.max(a1.right, PIP_WINDOW_OFFSET),
yRange: a0.height - yOffset - Math.max(a1.bottom, PIP_WINDOW_OFFSET)
};
};
getPIPWindowDimensions2.__closure = {
PIP_WINDOW_OFFSET
};
getPIPWindowDimensions2.__workletHash = 10369369214675;
getPIPWindowDimensions2.__initData = {
code: "function getPIPWindowDimensions_VoicePanelPIPUtilsTsx2(windowDimensions,safeArea){const{PIP_WINDOW_OFFSET}=this.__closure;const xOffset=Math.max(safeArea.left,PIP_WINDOW_OFFSET);const yOffset=Math.max(safeArea.top,PIP_WINDOW_OFFSET);return{xOffset:xOffset,yOffset:yOffset,xRange:windowDimensions.width-xOffset-Math.max(safeArea.right,PIP_WINDOW_OFFSET),yRange:windowDimensions.height-yOffset-Math.max(safeArea.bottom,PIP_WINDOW_OFFSET)};}"
};
getPIPWindowDimensions = getPIPWindowDimensions2;
const pipXYtoAbsoluteXY2 = function pipXYtoAbsoluteXY({ pipX, pipY, windowDimensions, safeArea }) {
const r17 = Math.max(safeArea.left, PIP_WINDOW_OFFSET);
const r21 = Math.max(safeArea.top, PIP_WINDOW_OFFSET);
return {
x: r17 + pipX * (windowDimensions.width - r17 - Math.max(safeArea.right, PIP_WINDOW_OFFSET)),
y: r21 + pipY * (windowDimensions.height - r21 - Math.max(safeArea.bottom, PIP_WINDOW_OFFSET))
};
};
pipXYtoAbsoluteXY2.__closure = {
getPIPWindowDimensions
};
pipXYtoAbsoluteXY2.__workletHash = 13405407399530;
pipXYtoAbsoluteXY2.__initData = {
code: "function pipXYtoAbsoluteXY_VoicePanelPIPUtilsTsx3({pipX:pipX,pipY:pipY,windowDimensions:windowDimensions,safeArea:safeArea}){const{getPIPWindowDimensions}=this.__closure;const{xOffset:xOffset,yOffset:yOffset,xRange:xRange,yRange:yRange}=getPIPWindowDimensions(windowDimensions,safeArea);return{x:xOffset+pipX*xRange,y:yOffset+pipY*yRange};}"
};
pipXYtoAbsoluteXY = pipXYtoAbsoluteXY2;
export function getClampedPIPPosition({ pipX, pipY, width, height, windowDimensions, safeArea, bottomAvoidanceRegion = 0, topAvoidanceRegion = 0, positionOffset = {
x: 0,
y: 0
} }) {
const pipX2 = pipX !== -1 ? pipX : 1;
const r3 = pipY === -1;
const r26 = pipXYtoAbsoluteXY({
pipX: pipX2,
pipY: r3 ? 0 : pipY,
windowDimensions,
safeArea
});
const { x: r27, y: r28 } = r26;
const r30 = r27 - width / 2;
const r32 = r3 ? r28 + 72 : r28 - height / 2;
const r18 = Math.max(safeArea.left, PIP_WINDOW_OFFSET);
const r42 = Math.max(safeArea.top, PIP_WINDOW_OFFSET);
const r47 = windowDimensions.width - r18 - Math.max(safeArea.right, PIP_WINDOW_OFFSET);
const r54 = windowDimensions.height - r42 - Math.max(safeArea.bottom, PIP_WINDOW_OFFSET);
const r57 = r18 + r47 - width;
const r65 = Math.min(Math.max(r30, r18), r57);
const r66 = r42 + topAvoidanceRegion;
const r69 = r42 + r54 - bottomAvoidanceRegion - height;
return {
x: r65 + positionOffset.x,
y: Math.min(Math.max(r32, r66), r69) + positionOffset.y
};
}
getClampedPIPPosition.__closure = {
pipXYtoAbsoluteXY,
getPIPWindowDimensions,
clamp
};
getClampedPIPPosition.__workletHash = 10462021389431;
getClampedPIPPosition.__initData = {
code: "function getClampedPIPPosition_VoicePanelPIPUtilsTsx4({pipX:pipX,pipY:pipY,width:width,height:height,windowDimensions:windowDimensions,safeArea:safeArea,bottomAvoidanceRegion=0,topAvoidanceRegion=0,positionOffset={x:0,y:0}}){const{pipXYtoAbsoluteXY,getPIPWindowDimensions,clamp}=this.__closure;let{x:x,y:y}=pipXYtoAbsoluteXY({pipX:pipX===-1?1:pipX,pipY:pipY===-1?0:pipY,windowDimensions:windowDimensions,safeArea:safeArea});const halfWidth=width/2;const halfHeight=height/2;x-=halfWidth;if(pipY===-1){y+=72;}else{y-=halfHeight;}const pipRegion=getPIPWindowDimensions(windowDimensions,safeArea);x=clamp(x,pipRegion.xOffset,pipRegion.xOffset+pipRegion.xRange-width);y=clamp(y,pipRegion.yOffset+topAvoidanceRegion,pipRegion.yOffset+pipRegion.yRange-bottomAvoidanceRegion-height);x+=positionOffset.x;y+=positionOffset.y;return{x:x,y:y};}"
};
export function calculatePIPPositionFromVelocity({ velocityX, velocityY, absoluteX, absoluteY, windowDimensions, safeArea }) {
let r64, r65;
L33: {
const r24 = Math.max(safeArea.left, PIP_WINDOW_OFFSET);
const r27 = Math.max(safeArea.top, PIP_WINDOW_OFFSET);
const r32 = windowDimensions.width - r24 - Math.max(safeArea.right, PIP_WINDOW_OFFSET);
const r39 = windowDimensions.height - r27 - Math.max(safeArea.bottom, PIP_WINDOW_OFFSET);
const r40 = absoluteX - r24;
const r41 = absoluteY - r27;
if (Math.max(Math.abs(velocityY), Math.abs(velocityX)) < MIN_PIP_TOSS_VELOCITY) {
const r76 = {
left: Math.min(Math.max(r40, 0), r32),
right: Math.min(Math.max(r32 - r40, 0), r32),
top: Math.min(Math.max(r41, 0), r39),
bottom: Math.min(Math.max(r39 - r41, 0), r39)
};
const r103 = Math;
const r112 = r103.min.apply(r103, [...Object.values(r76)]);
const r115 = r76.left !== r112 ? r76.top !== r112 ? r76.right === r112 ? "right" : "bottom" : "top" : "left";
if (r115 === "left") {
r65 = r41 / r39;
r64 = 0;
} else if (r115 === "right") {
r65 = r41 / r39;
r64 = 1;
} else if (r115 === "top") {
r64 = r40 / r32;
r65 = 0;
} else {
r65 = 0;
r64 = 0;
if (r115 === "bottom") {
r64 = r40 / r32;
r65 = 1;
}
}
} else {
const r52 = velocityY / velocityX;
const r54 = velocityX > 0 ? r32 : 0;
const r57 = r41 + r52 * (r54 - r40);
if (r57 >= 0 && r57 <= r39) {
r64 = r54 / r32;
r65 = r57 / r39;
break L33;
}
const r58 = 1 / r52;
const r60 = velocityY > 0 ? r39 : 0;
r64 = (r40 + r58 * (r60 - r41)) / r32;
r65 = r60 / r39;
}
}
return {
pipX: Math.min(Math.max(r64, 0), 1),
pipY: Math.min(Math.max(r65, 0), 1)
};
}
calculatePIPPositionFromVelocity.__closure = {
getPIPWindowDimensions,
MIN_PIP_TOSS_VELOCITY,
clamp
};
calculatePIPPositionFromVelocity.__workletHash = 14615762848981;
calculatePIPPositionFromVelocity.__initData = {
code: "function calculatePIPPositionFromVelocity_VoicePanelPIPUtilsTsx5({velocityX:velocityX,velocityY:velocityY,absoluteX:absoluteX,absoluteY:absoluteY,windowDimensions:windowDimensions,safeArea:safeArea}){const{getPIPWindowDimensions,MIN_PIP_TOSS_VELOCITY,clamp}=this.__closure;const pipRegion=getPIPWindowDimensions(windowDimensions,safeArea);const{xRange:xRange,yRange:yRange}=pipRegion;const x=absoluteX-pipRegion.xOffset;const y=absoluteY-pipRegion.yOffset;let pipX=0;let pipY=0;if(Math.max(Math.abs(velocityY),Math.abs(velocityX))<MIN_PIP_TOSS_VELOCITY){const closestEdge=function(specs){const minValue=Math.min(...Object.values(specs));if(specs.left===minValue){return'left';}if(specs.top===minValue){return'top';}if(specs.right===minValue){return'right';}return'bottom';}({left:clamp(x,0,xRange),right:clamp(xRange-x,0,xRange),top:clamp(y,0,yRange),bottom:clamp(yRange-y,0,yRange)});switch(closestEdge){case'left':pipX=0;pipY=y/yRange;break;case'right':pipX=1;pipY=y/yRange;break;case'top':pipY=0;pipX=x/xRange;break;case'bottom':pipY=1;pipX=x/xRange;break;}}else{const slope=velocityY/velocityX;let intersectionY=0;let intersectionX=0;intersectionX=velocityX>0?xRange:0;intersectionY=y+slope*(intersectionX-x);if(intersectionY>=0&&intersectionY<=yRange){pipX=intersectionX/xRange;pipY=intersectionY/yRange;}else{intersectionY=velocityY>0?yRange:0;intersectionX=x+1/slope*(intersectionY-y);pipX=intersectionX/xRange;pipY=intersectionY/yRange;}}return{pipX:clamp(pipX,0,1),pipY:clamp(pipY,0,1)};}"
};
xl = Module712.radii.xl;
lg = Module712.radii.lg;
export function getVoicePanelPIPBorderRadius(a0, a1) {
return a0 <= SquareActivityPIPReferenceDimensions.width && a1 <= SquareActivityPIPReferenceDimensions.height ? lg : xl;
}
getVoicePanelPIPBorderRadius.__closure = {
SquareActivityPIPReferenceDimensions,
lg,
xl
};
getVoicePanelPIPBorderRadius.__workletHash = 16698745361037;
getVoicePanelPIPBorderRadius.__initData = {
code: "function getVoicePanelPIPBorderRadius_VoicePanelPIPUtilsTsx6(width,height){const{SquareActivityPIPReferenceDimensions,lg,xl}=this.__closure;if(width<=SquareActivityPIPReferenceDimensions.width&&height<=SquareActivityPIPReferenceDimensions.height){return lg;}return xl;}"
};
export { PIPReferenceDimensions };
export { SquarePIPReferenceDimensions };
export { SquareActivityPIPReferenceDimensions };
export function computePIPSize(a0, a1, a2, a3) {
let height2, width2;
L15: {
const { width, height } = a0;
if (!a1 && width !== height) {
if (width >= height) {
const r20 = a2 ? SquareActivityPIPReferenceDimensions.width : PIPReferenceDimensions.width;
height2 = r20 * Math.max(0.5, a0.height / a0.width);
width2 = r20;
break L15;
}
height2 = a2 ? SquareActivityPIPReferenceDimensions.height : PIPReferenceDimensions.height;
width2 = height2 * Math.max(0.5, a0.width / a0.height);
} else {
const r29 = a2 ? SquareActivityPIPReferenceDimensions : SquarePIPReferenceDimensions;
width2 = r29.width;
height2 = r29.height;
}
}
return {
width: width2,
height: height2,
containerHeight: a3 ? 2 * height2 + SECONDARY_PIP_TOP_MARGIN : height2
};
}
export function computePIPParticipantToShow({ channelId, panelMode, lastParticipantId, speakingUserId, focusedParticipantId, blockList = c11397_14, showSecondaryPIP }) {
let r209;
const id = AuthenticationStore.getId();
const r35 = focusedParticipantId != null ? ChannelRTCStore.getParticipant(channelId, focusedParticipantId) : void 0;
if (panelMode === VoicePanelModes.PANEL && r35 == null) {
return void 0;
}
if (panelMode === VoicePanelModes.PANEL && focusedParticipantId != null && r35?.type === ParticipantTypes.STREAM && r35?.userVideo === true && !blockList.has(r35.user.id)) {
const participant = ChannelRTCStore.getParticipant(channelId, r35.user.id);
if (participant != null && canRenderParticipantVideo(participant)) {
return {
id: participant.id,
type: ParticipantTypes.USER
};
}
}
if (focusedParticipantId != null && r35 != null && !blockList.has(focusedParticipantId)) {
return {
id: focusedParticipantId,
type: r35.type
};
}
if (r35?.type !== ParticipantTypes.ACTIVITY && !showSecondaryPIP) {
for (const item of ChannelRTCStore.getActivityParticipants(channelId)) {
if (!item.participants.some((participant) => isActivityParticipantCurrentUserCurrentSession(participant))) {
continue;
}
if (blockList.has(item.id)) {
continue;
}
return {
id: item.id,
type: item.type
};
}
}
for (const item2 of ChannelRTCStore.getStreamParticipants(channelId)) {
if (blockList.has(item2.id)) {
continue;
}
if (ApplicationStreamingStore.getActiveStreamForUser(item2.user.id, item2.stream.guildId) == null) {
continue;
}
return {
id: item2.id,
type: item2.type
};
}
if (speakingUserId != null && !blockList.has(speakingUserId) && ChannelRTCStore.getParticipant(channelId, speakingUserId) != null) {
return {
id: speakingUserId,
type: ParticipantTypes.USER
};
}
const r131 = lastParticipantId != null ? ChannelRTCStore.getParticipant(channelId, lastParticipantId) : void 0;
if (r131 != null && !blockList.has(r131.id)) {
const type = r131.type;
if (ParticipantTypes.STREAM === type) {
if (ApplicationStreamingStore.getActiveStreamForUser(r131.user.id, r131.stream.guildId) != null && canRenderParticipantVideo(r131)) {
return {
id: r131.id,
type: r131.type
};
}
} else if (ParticipantTypes.ACTIVITY === type) {
if (r131.participants.some((participant) => isActivityParticipantCurrentUserCurrentSession(participant))) {
return {
id: r131.id,
type: r131.type
};
}
} else if (ParticipantTypes.USER === type) {
return {
id: r131.id,
type: r131.type
};
}
}
const participant2 = ChannelRTCStore.getParticipant(channelId, id);
if (!blockList.has(id) && participant2 != null && canRenderParticipantVideo(participant2)) {
return {
id,
type: ParticipantTypes.USER
};
}
for (const item3 of ChannelRTCStore.getVideoParticipants(channelId)) {
if (blockList.has(item3.id)) {
continue;
}
if (!canRenderParticipantVideo(item3)) {
continue;
}
return {
id: item3.id,
type: item3.type
};
}
L78: {
const r208 = blockList.has(id);
r209 = void 0;
if (!r208) {
const r210 = participant2 == null;
r209 = void 0;
if (!r210) {
if (panelMode === VoicePanelModes.PANEL) {
const type2 = r35?.type;
const ACTIVITY = ParticipantTypes.ACTIVITY;
r209 = void 0;
if (type2 !== ACTIVITY) {
break L78;
}
}
r209 = {
id,
type: ParticipantTypes.USER
};
}
}
}
return r209;
}
export function getPIPMode({ channelId, connected, manuallyFocusedId, mode, selfHasVideo }) {
if (connected) {
const r2 = manuallyFocusedId != null ? ChannelRTCStore.getParticipant(channelId, manuallyFocusedId) : void 0;
if (mode === VoicePanelModes.PANEL && r2 != null) {
if (r2.type === ParticipantTypes.ACTIVITY) {
return VoicePanelPIPModes.IN_PANEL;
}
if (r2.type === ParticipantTypes.STREAM && r2.userVideo) {
let r43 = ChannelRTCStore.getParticipant(channelId, r2.user.id);
if (r43 == null) {
r43 = void 0;
}
if (canRenderParticipantVideo(r43)) {
return VoicePanelPIPModes.IN_PANEL;
}
}
if (!selfHasVideo) {
return void 0;
}
if (r2.id !== AuthenticationStore.getId()) {
return VoicePanelPIPModes.IN_PANEL;
}
for (const item of ChannelRTCStore.getVideoParticipants(channelId)) {
if (item.id === AuthenticationStore.getId()) {
continue;
}
if (!canRenderParticipantVideo(item)) {
continue;
}
return VoicePanelPIPModes.IN_PANEL;
}
if (r2.id !== AuthenticationStore.getId()) {
return VoicePanelPIPModes.IN_PANEL;
}
}
return mode === VoicePanelModes.PIP ? VoicePanelPIPModes.IN_APP : void 0;
}
}
export { getPIPWindowDimensions };
export { pipXYtoAbsoluteXY };
@@ -0,0 +1,118 @@
// Metro module 15990 (f15991).
import { useContext, useMemo } from "react";
import EmbeddedActivitiesStore from "../../../activities/EmbeddedActivitiesStore";
import FramesStore from "../../../frames/FramesStore";
import ChannelStore from "../../../../stores/ChannelStore";
import { ActivityLayoutMode } from "../../../activities/Constants";
import { ActivityPanelModes } from "../../../activities/panel/ActivityPanelConstants";
import { FrameLayoutModes } from "../../../frames/FramesConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import VoicePanelStateContext from "../VoicePanelStateContext";
import { usePIPState } from "./VoicePanelPIPStateContext";
import { useStateFromStoresObject, useStateFromStores } from "../../../../_bundle/Module589";
import { getEmbeddedActivityLocationChannelId } from "../../../activities/utils/embeddedActivityLocationUtils";
import roundToNearestPixel from "../utils/roundToNearestPixel";
import isVoiceEmbeddedActivity from "../../../activities/utils/isVoiceEmbeddedActivity";
import { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import getActivityContainerPIPStylesSpec from "../../../activities/panel/native/pip/getActivityContainerPIPStylesSpec";
import NativeView from "../../../core/native/NativeView";
import ReanimatedNativeView from "../../../core/native/ReanimatedNativeView";
import FrameView from "../../../frames/native/FrameView";
import EmbeddedActivityView from "../../../activities/native/EmbeddedActivityView";
const useStyles = createStyles({
activityContainer: {
flex: 1
}
});
const __initData = {
code: "function VoicePanelSecondaryPIPContentTsx1(){const{getActivityContainerPipStylesSpec,pipState,activePipOrientationLockState,windowDimensions}=this.__closure;const{width:width,height:height,shouldVerticallyCenter:shouldVerticallyCenter,shouldHorizontallyCenter:shouldHorizontallyCenter,marginLeft:marginLeft,marginTop:marginTop}=getActivityContainerPipStylesSpec({pipWidth:pipState.width,pipHeight:pipState.height,pipOrientationLockState:activePipOrientationLockState,isLandscape:windowDimensions.get().landscape});return{width:width,height:height,left:shouldHorizontallyCenter?'50%':'0%',top:shouldVerticallyCenter?'50%':'0%',marginLeft:marginLeft,marginTop:marginTop};}"
};
export default function VoicePanelSecondaryPIPContent() {
let connectedEmbeddedActivityChannelId, width, height, framePipOrientationLockState;
const windowDimensions = useContext(VoicePanelStateContext).windowDimensions;
const pIPState = usePIPState();
const styles = useStyles();
const stateFromStoresObject = useStateFromStoresObject([EmbeddedActivitiesStore], () => {
const connectedActivityLocation = EmbeddedActivitiesStore.getConnectedActivityLocation();
const selfEmbeddedActivityForLocation = EmbeddedActivitiesStore.getSelfEmbeddedActivityForLocation(connectedActivityLocation);
const applicationId = selfEmbeddedActivityForLocation?.applicationId;
return {
connectedEmbeddedActivityChannelId: getEmbeddedActivityLocationChannelId(connectedActivityLocation),
connectedEmbeddedActivity: selfEmbeddedActivityForLocation,
pipOrientationLockState: applicationId == null ? void 0 : EmbeddedActivitiesStore.getPipOrientationLockStateForApp(applicationId),
panelMode: EmbeddedActivitiesStore.getActivityPanelMode()
};
});
connectedEmbeddedActivityChannelId = stateFromStoresObject.connectedEmbeddedActivityChannelId;
const connectedEmbeddedActivity = stateFromStoresObject.connectedEmbeddedActivity;
let pipOrientationLockState = stateFromStoresObject.pipOrientationLockState;
const panelMode = stateFromStoresObject.panelMode;
const stateFromStoresObject2 = useStateFromStoresObject([FramesStore], () => {
const connectedFrame = FramesStore.getConnectedFrame();
const applicationId = connectedFrame?.applicationId;
return {
connectedFrame,
framePanelMode: FramesStore.getActivityPanelMode(),
framePipOrientationLockState: applicationId == null ? void 0 : FramesStore.getPipOrientationLockStateForApp(applicationId)
};
});
const { connectedFrame, framePanelMode, framePipOrientationLockState: framePipOrientationLockState2 } = stateFromStoresObject2;
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(connectedEmbeddedActivityChannelId));
width = pIPState.width;
height = pIPState.height;
const memo = useMemo(() => ({
width,
height,
position: "absolute",
left: "50%",
marginLeft: -1 * roundToNearestPixel(width / 2),
top: "50%",
marginTop: -1 * roundToNearestPixel(height / 2)
}), [width, height]);
const r2 = connectedEmbeddedActivity != null && !isVoiceEmbeddedActivity(connectedEmbeddedActivityChannelId) && panelMode === ActivityPanelModes.PIP;
const r3 = connectedFrame != null && framePanelMode === ActivityPanelModes.PIP;
if (r3) {
pipOrientationLockState = framePipOrientationLockState2;
}
framePipOrientationLockState = pipOrientationLockState;
const P = function P() {
const activityContainerPIPStylesSpec = getActivityContainerPIPStylesSpec({
pipWidth: pIPState.width,
pipHeight: pIPState.height,
pipOrientationLockState: framePipOrientationLockState,
isLandscape: windowDimensions.get().landscape
});
const { width: width2, height: height2, shouldVerticallyCenter, shouldHorizontallyCenter } = activityContainerPIPStylesSpec;
let top = "0%";
const left = shouldHorizontallyCenter ? "50%" : "0%";
if (shouldVerticallyCenter) {
top = "50%";
}
return {
width: width2,
height: height2,
left,
top,
marginLeft: activityContainerPIPStylesSpec.marginLeft,
marginTop: activityContainerPIPStylesSpec.marginTop
};
};
P.__closure = {
getActivityContainerPipStylesSpec: getActivityContainerPIPStylesSpec,
pipState: pIPState,
activePipOrientationLockState: framePipOrientationLockState,
windowDimensions
};
P.__workletHash = 12186082276755;
P.__initData = __initData;
const animatedStyle = useAnimatedStyle(P);
return r2 ? <NativeView style={memo} pointerEvents="none">
<ReanimatedNativeView style={[styles.activityContainer, animatedStyle]}>
{r3 ? <FrameView layoutMode={FrameLayoutModes.PIP} /> : <EmbeddedActivityView channel={stateFromStores} layoutMode={ActivityLayoutMode.PIP} />}
</ReanimatedNativeView>
</NativeView> : r3 ? <NativeView style={memo} pointerEvents="none">
<ReanimatedNativeView style={[styles.activityContainer, animatedStyle]}>
{r3 ? <FrameView layoutMode={FrameLayoutModes.PIP} /> : <EmbeddedActivityView channel={stateFromStores} layoutMode={ActivityLayoutMode.PIP} />}
</ReanimatedNativeView>
</NativeView> : null;
};
@@ -0,0 +1,177 @@
// Metro module 15910 (f15911).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { useRef, useState, useInsertionEffect, useLayoutEffect, useEffect } from "react";
import EmbeddedActivitiesStore from "../../../activities/EmbeddedActivitiesStore";
import ChannelRTCStore from "../../../calls/ChannelRTCStore";
import FramesStore from "../../../frames/FramesStore";
import ChannelStore from "../../../../stores/ChannelStore";
import SpeakingStore from "../../../../stores/SpeakingStore";
import { VoicePanelModes } from "../../VoicePanelConstants";
import { ActivityPanelModes } from "../../../activities/panel/ActivityPanelConstants";
import useIsConnectedToVoiceChannel from "../hooks/useIsConnectedToVoiceChannel";
import { useStateFromStores, BatchedStoreListener } from "../../../../_bundle/Module589";
import { getEmbeddedActivityLocationChannelId } from "../../../activities/utils/embeddedActivityLocationUtils";
import { isActivityInTextSupportedForChannel } from "../../../activities/ActivitiesInTextUtils";
import { cheapWorkletShallowEqual } from "../../../reanimated/native/cheapWorkletShallowEqual";
import useSelfHasVideo from "../utils/useSelfHasVideo";
import throttle from "../../../../_bundle/throttle";
import calculatePIPState from "../utils/calculatePIPState";
import { getPIPMode } from "./VoicePanelPIPUtils";
import useExternalPipAspectRatioUpdater_native from "../../../external_pip/useExternalPipAspectRatioUpdater.native";
function $mk117092($env) {
return (a0) => {
const r1 = $env;
let r6 = r1[2].getTargetDimensions(r1[1]);
if (cheapWorkletShallowEqual(a0, r6)) {
r6 = a0;
}
return r6;
};
}
let env11394 = {};
export function useControllerPIPState(a0) {
let channelId, mode, c22597_2;
let env22596 = {
$parent: env11394
};
const channelId2 = a0.channelId;
env22596[0] = channelId2;
const { connected, focusedId } = a0;
env22596[1] = focusedId;
const layoutManager = a0.layoutManager;
env22596[2] = layoutManager;
const mode2 = a0.mode;
env22596[3] = void 0;
env22596[4] = void 0;
env22596[5] = void 0;
env22596[6] = void 0;
env22596[7] = void 0;
const ref2 = useRef({
id: void 0,
mode: void 0,
width: 0,
height: 0,
containerHeight: 0,
showSecondaryPIP: false
});
const r33 = _slicedToArray(useState(void 0), 2);
const r18 = r33[0];
env22596[3] = r18;
env22596[4] = r33[1];
env22596[5] = useRef(r18);
useInsertionEffect(() => {
env22596[5].current = env22596[3];
});
channelId = channelId2;
mode = mode2;
c22597_2 = void 0;
const isConnectedToVoiceChannel = useIsConnectedToVoiceChannel(channelId);
c22597_2 = isConnectedToVoiceChannel;
const stateFromStores = useStateFromStores([EmbeddedActivitiesStore, FramesStore, ChannelStore], () => {
const channel = ChannelStore.getChannel(channelId);
if ((channel == null ? void 0 : channel.isVocal()) && !c22597_2) {
return false;
}
L9: {
const connectedFrame = FramesStore.getConnectedFrame();
const activityPanelMode = FramesStore.getActivityPanelMode();
if (connectedFrame != null && activityPanelMode === ActivityPanelModes.PIP) {
if (mode !== VoicePanelModes.PIP && mode !== VoicePanelModes.PANEL) {
break L9;
}
return true;
}
}
const connectedActivityLocation = EmbeddedActivitiesStore.getConnectedActivityLocation();
if (connectedActivityLocation == null) {
return false;
}
const embeddedActivityLocationChannelId = getEmbeddedActivityLocationChannelId(connectedActivityLocation);
const channel2 = ChannelStore.getChannel(embeddedActivityLocationChannelId);
const activityPanelMode2 = EmbeddedActivitiesStore.getActivityPanelMode();
let r37 = channel2 != null && isActivityInTextSupportedForChannel(channel2) && embeddedActivityLocationChannelId !== channelId;
const r43 = activityPanelMode2 === ActivityPanelModes.PIP && (mode === VoicePanelModes.PIP || embeddedActivityLocationChannelId !== channelId);
if (r37) {
r37 = r43;
}
return r37;
}, [channelId, isConnectedToVoiceChannel, mode]);
const selfHasVideo = useSelfHasVideo(channelId);
const [r57] = useState(() => throttle((a0) => a0(), 1000, {
leading: true
}));
env22596[6] = r57;
useLayoutEffect(() => () => env22596[6].cancel(), [r57]);
const r65 = _slicedToArray(useState(() => env22596[2].getTargetDimensions(env22596[1])), 2);
const participantTargetDimensions = r65[0];
env22596[7] = r65[1];
const r71 = calculatePIPState(channelId, layoutManager, focusedId, r18, {
connected,
mode,
focusedId,
participantTargetDimensions,
selfHasVideo,
showSecondaryPIP: stateFromStores
});
const { participant, dimensions } = r71;
const id = participant?.id;
let r74 = {
...ref2.current,
...dimensions,
id,
showSecondaryPIP: stateFromStores,
mode: getPIPMode({
channelId,
connected,
manuallyFocusedId: focusedId,
mode,
selfHasVideo
})
};
const current = r74;
const ref = ref2;
const r93 = cheapWorkletShallowEqual(current, ref.current);
let c22598_2 = !r93;
useEffect(() => {
if (c22598_2) {
ref.current = current;
}
});
if (r93) {
r74 = ref.current;
}
useEffect(() => {
let c28179_0;
const batchedStoreListener = new BatchedStoreListener([SpeakingStore, ChannelRTCStore], () => {
let c30933_0;
const r8 = (() => {
for (const item of SpeakingStore.getSpeakers()) {
if (ChannelRTCStore.getParticipant(env22596[0], item) == null) {
continue;
}
return item;
}
})();
c30933_0 = r8;
const r6 = env22596[5];
if (r8 !== r6.current && r8 != null) {
if (r6.current == null) {
(0, env22596[4])(r8);
} else {
(0, env22596[6])(() => (0, env22596[4])(c30933_0));
}
}
});
c28179_0 = batchedStoreListener;
batchedStoreListener.attach(`pipstate-change-listeners-${env22596[0]}`);
return () => c28179_0.detach();
}, [channelId, r57]);
useEffect(() => {
(0, env22596[7])($mk117092(env22596));
return env22596[2].subscribeFromItem(function updateParticipantDimensions() {
(0, env22596[7])($mk117092(env22596));
});
}, [focusedId, layoutManager, participantTargetDimensions]);
useExternalPipAspectRatioUpdater_native(channelId, layoutManager, focusedId);
return r74;
}
@@ -0,0 +1,80 @@
// Metro module 15916 (f15917).
import { VoicePanelModes } from "../../VoicePanelConstants";
import { VoicePanelControlsModes } from "../controls/VoicePanelControlsConstants";
import { PIP_WINDOW_OFFSET } from "../../../panels/morphable/native/MorphablePanelConstants";
import { useSharedValue, useAnimatedReaction } from "../../../reanimated/ReanimatedRexport";
import useAnimatedKeyboardHeight from "../../../keyboard/native/useAnimatedKeyboardHeight";
import useScreenNameSharedValue from "../../../panels/morphable/native/useScreenNameSharedValue";
import { useToken } from "../../../../design/tokens/native/useToken";
import Module712 from "../../../../_bundle/Module712";
import * as _cheapWorkletShallowEqual from "../../../reanimated/native/cheapWorkletShallowEqual";
import getPIPBottomOffsetForPIPMode from "../../../panels/morphable/native/getPIPBottomOffsetForPIPMode";
import getAdjustedBottomOffsets from "../../../panels/morphable/native/getAdjustedBottomOffsets";
import calculateVoicePanelHeaderSpecs from "../header/calculateVoicePanelHeaderSpecs";
import updateSharedValueIfChanged_native from "../../../reanimated/utils/updateSharedValueIfChanged.native";
const __initData = {
code: "function usePIPAvoidanceSpecsTsx1(){const{mode,controlsSpecs,keyboardHeight,safeArea,screenName}=this.__closure;return{mode:mode.get(),controlsSpecs:controlsSpecs.get(),keyboardHeight:keyboardHeight.get(),safeArea:safeArea.get(),screenName:screenName.get()};}"
};
const __initData2 = {
code: "function usePIPAvoidanceSpecsTsx2(props,previous){const{cheapWorkletShallowEqual,VoicePanelModes,VoicePanelControlsModes,DEFAULT_CHANNEL_INPUT_HEIGHT,PIP_WINDOW_OFFSET,getPIPBottomOffsetForPIPMode,getAdjustedBottomOffsets,calculateVoicePanelHeaderSpecs,edgeGutter,updateSharedValueIfChanged,pipAvoidanceSpecs}=this.__closure;if(cheapWorkletShallowEqual(props,previous!==null&&previous!==void 0?previous:undefined))return;const{mode:mode,controlsSpecs:controlsSpecs,keyboardHeight:keyboardHeight,safeArea:safeArea,screenName:screenName}=props;const screenBottomOffset=function(){if(mode!==VoicePanelModes.PIP){if(mode===VoicePanelModes.PANEL&&controlsSpecs.mode===VoicePanelControlsModes.DRAWER){return DEFAULT_CHANNEL_INPUT_HEIGHT+PIP_WINDOW_OFFSET;}return 0;}return getPIPBottomOffsetForPIPMode(screenName);}();let{bottomOffset:bottomOffset}=getAdjustedBottomOffsets({screenBottomOffset:screenBottomOffset,safeAreaBottom:safeArea.bottom,keyboardHeight:keyboardHeight});if(keyboardHeight<=0&&mode===VoicePanelModes.PANEL&&controlsSpecs.mode===VoicePanelControlsModes.FLOATING_DEFAULT){bottomOffset+=controlsSpecs.height+PIP_WINDOW_OFFSET;}const{height:headerHeight}=calculateVoicePanelHeaderSpecs(safeArea,edgeGutter);updateSharedValueIfChanged(pipAvoidanceSpecs,{top:mode===VoicePanelModes.PANEL&&controlsSpecs.mode===VoicePanelControlsModes.FLOATING_DEFAULT?headerHeight:0,bottom:bottomOffset});}"
};
export default function usePIPAvoidanceSpecs({ mode, controlsSpecs, safeArea }) {
const sharedValue = useSharedValue({
top: 0,
bottom: 0
});
const animatedKeyboardHeight = useAnimatedKeyboardHeight();
let c22601_4 = animatedKeyboardHeight;
const screenNameSharedValue = useScreenNameSharedValue();
let c22601_5 = screenNameSharedValue;
const token = useToken(Module712.modules.mobile.VOICE_PANEL_GUTTER);
const r35 = () => ({
mode: mode.get(),
controlsSpecs: controlsSpecs.get(),
keyboardHeight: c22601_4.get(),
safeArea: safeArea.get(),
screenName: c22601_5.get()
});
r35.__closure = {
mode,
controlsSpecs,
keyboardHeight: animatedKeyboardHeight,
safeArea,
screenName: screenNameSharedValue
};
r35.__workletHash = 17017598468922;
r35.__initData = __initData;
const u = function u(a0, a1) {
if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(a0, a1 == null ? void 0 : a1)) {
const { mode: mode2, controlsSpecs: controlsSpecs2, keyboardHeight, safeArea: safeArea2, screenName } = a0;
const bottomOffset = getAdjustedBottomOffsets({
screenBottomOffset: mode2 !== VoicePanelModes.PIP ? mode2 === VoicePanelModes.PANEL ? controlsSpecs2.mode === VoicePanelControlsModes.DRAWER ? 60 + PIP_WINDOW_OFFSET : 0 : 0 : getPIPBottomOffsetForPIPMode(screenName),
safeAreaBottom: safeArea2.bottom,
keyboardHeight
}).bottomOffset;
const bottom = keyboardHeight <= 0 && mode2 === VoicePanelModes.PANEL && controlsSpecs2.mode === VoicePanelControlsModes.FLOATING_DEFAULT ? bottomOffset + (controlsSpecs2.height + PIP_WINDOW_OFFSET) : bottomOffset;
const height = calculateVoicePanelHeaderSpecs(safeArea2, token).height;
updateSharedValueIfChanged_native(sharedValue, {
top: mode2 === VoicePanelModes.PANEL ? controlsSpecs2.mode === VoicePanelControlsModes.FLOATING_DEFAULT ? height : 0 : 0,
bottom
});
}
};
u.__closure = {
cheapWorkletShallowEqual: _cheapWorkletShallowEqual.cheapWorkletShallowEqual,
VoicePanelModes,
VoicePanelControlsModes,
DEFAULT_CHANNEL_INPUT_HEIGHT: 60,
PIP_WINDOW_OFFSET,
getPIPBottomOffsetForPIPMode,
getAdjustedBottomOffsets,
calculateVoicePanelHeaderSpecs,
edgeGutter: token,
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
pipAvoidanceSpecs: sharedValue
};
u.__workletHash = 13029906729161;
u.__initData = __initData2;
useAnimatedReaction(r35, u);
return sharedValue;
};