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

1268 lines
61 KiB
TypeScript

// Metro module 15919 (f15920).
import * as Module19 from "react";
import { useContext, useMemo, useState, useRef, useCallback, useLayoutEffect, useEffect } from "react";
import { Pressable, StyleSheet, ScrollView } from "react-native";
import ChannelRTCStore from "../../calls/ChannelRTCStore";
import AppFreezeStore from "../../panels/morphable/AppFreezeStore";
import VoicePanelStore from "../VoicePanelStore";
import * as _VoicePanelConstants from "../VoicePanelConstants";
import { BORDER_RADIUS_PHYSICS, DEFAULT_BORDER_RADIUS, DEFAULT_BORDER_RADIUS_PIP, DRAWER_SPRING_PHYSICS_GESTURE_ACTIVE, IS_IOS, LAYOUT_PHYSICS, VOICE_PANEL_CHUNK_DIVISOR, VoicePanelModes } from "../VoicePanelConstants";
import { VoicePanelControlsModes } from "./controls/VoicePanelControlsConstants";
import { isActivityParticipant } from "../../calls/CallConstants";
import { POP_RESISTANCE } from "../../panels/morphable/native/MorphablePanelConstants";
import Logger from "../../debug/Logger";
import * as _spring from "../../../design/animation/reanimated/spring/spring";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import * as _ReanimatedRexport from "../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useDerivedValue, useAnimatedReaction, useAnimatedStyle, useSharedValue, useAnimatedRef, useAnimatedScrollHandler, useAnimatedProps } from "../../reanimated/ReanimatedRexport";
import * as _MetaQuestUtils_android from "../../device/MetaQuestUtils.android";
import VoicePanelStateContext from "./VoicePanelStateContext";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import * as _Module5273 from "../../../_bundle/Module5273";
import { Gesture, GestureDetector } from "../../../_bundle/Module5273";
import * as _cheapWorkletShallowEqual from "../../reanimated/native/cheapWorkletShallowEqual";
import updateSharedValueIfChanged_native from "../../reanimated/utils/updateSharedValueIfChanged.native";
import triggerIOSHaptic from "./utils/triggerIOSHaptic";
import * as _HapticUtils_native from "../../haptics/HapticUtils.native";
import * as _VoicePanelPIPUtils from "./pip/VoicePanelPIPUtils";
import { useToken } from "../../../design/tokens/native/useToken";
import calculateVoicePanelHeaderSpecs from "./header/calculateVoicePanelHeaderSpecs";
import { useGlobalStatusIndicatorState } from "../../connectivity/native/useGlobalStatusIndicatorState";
import { usePIPState } from "./pip/VoicePanelPIPStateContext";
import * as _PanelSizeUtils from "./utils/PanelSizeUtils";
import roundToNearestPixel from "./utils/roundToNearestPixel";
import ExternalPip_android from "../../external_pip/ExternalPip.android";
import { isStable } from "../../../utils/ReleaseChannelUtils.native";
import ReanimatedNativeView from "../../core/native/ReanimatedNativeView";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import { batchUpdates } from "../../../_bundle/Module705";
import useControlsLock from "./controls/useControlsLock";
import { LayerScope } from "../../../design/components/Layers/native/LayerScope.native";
import VoicePanelSystemUIManager from "./VoicePanelSystemUIManager";
import VoicePanelAccessibilityView from "./VoicePanelAccessibilityView";
import closeVoicePanels from "./utils/closeVoicePanels";
import VoicePanelDismissableContent from "./shared/VoicePanelDismissableContent";
import VoicePanelHeader from "./header/VoicePanelHeader";
import VoicePanelCardView from "./card/VoicePanelCardView";
import VoicePanelPreJoinContent from "./prejoin/VoicePanelPreJoinContent";
import VoicePanelPIP from "./pip/VoicePanelPIP";
import VoicePanelControls from "./controls/VoicePanelControls";
let c11402_24, log, layoutTransition, c11402_27, scrollViewLayoutTransition, DRAWER_SIZE_PHYSICS, computeViewableChunksFromScrollPosition, useStyles, AnimatedComponent, isMetaQuest, __initData, __initData2, __initData3, __initData4, __initData5, __initData6, __initData7, __initData8, __initData9, __initData10, __initData11, __initData12, __initData13, __initData14, __initData15, __initData16, __initData17, __initData18, __initData19, __initData20, computeBorderRadii, __initData21, __initData22, __initData23, __initData24, __initData25, __initData26, __initData27, __initData28, __initData29, __initData30, AnimatedWrapper, DrawerShadeOpacityPhysics, __initData31, Component;
const NOOP = function NOOP() {};
log = function log() {
c11402_24.log.apply(c11402_24, [...Array.prototype.slice.call(arguments, 0)]);
};
AnimatedWrapper = function AnimatedWrapper(props) {
let derivedValue, pIPState, animatedStyle, animatedStyle2;
const { wrapperOffset: wrapperOffset3, children } = props;
const wrapperOffset = wrapperOffset3;
derivedValue = void 0;
pIPState = void 0;
animatedStyle = void 0;
animatedStyle2 = void 0;
const height = useGlobalStatusIndicatorState().height;
const styles = useStyles();
const context = useContext(VoicePanelStateContext);
const { wrapperDimensions, connected, controlsSpecs, focused, mode, preJoinContentSize, safeArea, windowDimensions, useReducedMotion } = context;
const r36 = () => controlsSpecs.get().height;
r36.__closure = {
controlsSpecs
};
r36.__workletHash = 6243014585347;
r36.__initData = __initData21;
derivedValue = useDerivedValue(r36);
pIPState = usePIPState();
const r45 = () => ({
modeToSet: mode.get(),
connected: connected.get(),
windowWidth: windowDimensions.get().width,
windowHeight: windowDimensions.get().height,
safeArea: safeArea.get(),
focused: focused.get(),
pipState: pIPState,
controlsHeight: derivedValue.get(),
preJoinContentSize: preJoinContentSize.get(),
globalStatusIndicatorHeight: height
});
r45.__closure = {
mode,
connected,
windowDimensions,
safeArea,
focused,
pipState: pIPState,
controlsHeight: derivedValue,
preJoinContentSize,
globalStatusIndicatorHeight: height
};
r45.__workletHash = 4592460925374;
r45.__initData = __initData22;
const r49 = function(a0, a1) {
const r21 = a1 == null ? void 0 : a1;
L25: {
if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(a0, r21)) {
const { modeToSet, connected: connected3, windowWidth, windowHeight, safeArea: safeArea3, pipState, controlsHeight, preJoinContentSize: preJoinContentSize2, globalStatusIndicatorHeight } = a0;
if (modeToSet === VoicePanelModes.PIP && pipState.id == null) {
break L25;
}
const animated = a1 == null || windowHeight === a1.windowHeight && windowWidth === a1.windowWidth && safeArea3.top === a1.safeArea.top && safeArea3.bottom === a1.safeArea.bottom && safeArea3.left === a1.safeArea.left && safeArea3.right === a1.safeArea.right;
const r46 = wrapperDimensions.get();
r46.drawerX;
r46.drawerY;
const drawerHeight = windowHeight - globalStatusIndicatorHeight;
if (modeToSet === VoicePanelModes.PANEL) {
if (connected3) {
updateSharedValueIfChanged_native(wrapperDimensions, {
drawerWidth: windowWidth,
drawerHeight,
drawerX: 0,
drawerY: 0,
animated,
mode: modeToSet
});
updateSharedValueIfChanged_native(wrapperOffset, {
gestureActive: false
});
} else {
const maxPanelWidth = _PanelSizeUtils.getMaxPanelWidth({
windowWidth,
connected: connected3,
safeAreaLeft: safeArea3.left,
safeAreaRight: safeArea3.right
});
updateSharedValueIfChanged_native(wrapperDimensions, {
drawerWidth: maxPanelWidth,
drawerHeight,
drawerX: _PanelSizeUtils.getPanelX(windowWidth, maxPanelWidth),
drawerY: roundToNearestPixel(Math.max(drawerHeight - preJoinContentSize2 - controlsHeight - safeArea3.bottom, drawerHeight - 0.8 * drawerHeight)),
animated,
mode: modeToSet
});
}
} else if (modeToSet === VoicePanelModes.DISMISSED) {
if (connected3) {
updateSharedValueIfChanged_native(wrapperDimensions, {
mode: modeToSet
});
} else {
updateSharedValueIfChanged_native(wrapperDimensions, {
drawerY: windowDimensions.get().height + 60,
mode: modeToSet
});
}
}
}
}
};
r49.__closure = {
cheapWorkletShallowEqual: _cheapWorkletShallowEqual.cheapWorkletShallowEqual,
VoicePanelModes,
wrapperDimensions,
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
wrapperOffset,
getMaxPanelWidth: _PanelSizeUtils.getMaxPanelWidth,
getPanelX: _PanelSizeUtils.getPanelX,
roundToNearestPixel,
windowDimensions
};
r49.__workletHash = 3683279660781;
r49.__initData = __initData23;
useAnimatedReaction(r45, r49);
const C = function C() {
const r21 = useReducedMotion.get();
const r22 = (r21 ? !r21 : wrapperDimensions.get().animated) || wrapperOffset.get().gestureActive;
let gestureActive = wrapperOffset.get().gestureActive;
const r32 = wrapperDimensions.get();
const { drawerY, drawerX } = r32;
if (gestureActive) {
gestureActive = !connected.get();
}
let r15 = drawerX;
let r10 = drawerY;
if (gestureActive) {
r10 = drawerY + Math.max(wrapperOffset.get().y, 0);
r15 = drawerX + wrapperOffset.get().x;
}
const VoicePanelUITsx29 = function VoicePanelUITsx29(a0) {
if (a0 ? mode.get() !== VoicePanelModes.DISMISSED : a0) {
_ReanimatedRexport.runOnJS(ExternalPip_android.updateSourceTrackingView)();
}
};
VoicePanelUITsx29.__closure = {
mode,
VoicePanelModes,
runOnJS: _ReanimatedRexport.runOnJS,
updateSourceTrackingView: ExternalPip_android.updateSourceTrackingView
};
VoicePanelUITsx29.__workletHash = 10394717541764;
VoicePanelUITsx29.__initData = __initData25;
const r12 = wrapperOffset.get().gestureActive ? DRAWER_SPRING_PHYSICS_GESTURE_ACTIVE : DRAWER_SIZE_PHYSICS;
let r65 = "animate-never";
const transform = [{
translateX: _spring.withSpring(r15, r12, r22 ? "animate-always" : "animate-never", VoicePanelUITsx29)
}, ,];
const r76 = wrapperOffset.get().gestureActive ? DRAWER_SPRING_PHYSICS_GESTURE_ACTIVE : DRAWER_SIZE_PHYSICS;
if (r22) {
r65 = "animate-always";
}
transform[1] = {
translateY: _spring.withSpring(r10, r76, r65, VoicePanelUITsx29)
};
return {
transform
};
};
C.__closure = {
useReducedMotion,
wrapperDimensions,
wrapperOffset,
connected,
mode,
VoicePanelModes,
runOnJS: _ReanimatedRexport.runOnJS,
updateSourceTrackingView: ExternalPip_android.updateSourceTrackingView,
withSpring: _spring.withSpring,
DRAWER_SPRING_PHYSICS_GESTURE_ACTIVE,
DRAWER_SIZE_PHYSICS
};
C.__workletHash = 16361132737159;
C.__initData = __initData24;
animatedStyle = useAnimatedStyle(C);
const M = function M() {
const r8 = mode.get();
const r13 = connected.get();
const r9 = r8 === VoicePanelModes.PIP ? DEFAULT_BORDER_RADIUS_PIP : r13 ? 0 : DEFAULT_BORDER_RADIUS;
return {
width: wrapperDimensions.get().drawerWidth,
height: wrapperDimensions.get().drawerHeight,
borderRadius: _spring.withSpring(r9, BORDER_RADIUS_PHYSICS),
pointerEvents: mode.get() === VoicePanelModes.PANEL ? "auto" : "none",
backgroundColor: connected.get() ? "transparent" : styles.maskDefaultBackground.backgroundColor
};
};
M.__closure = {
computeBorderRadii,
mode,
connected,
wrapperDimensions,
withSpring: _spring.withSpring,
BORDER_RADIUS_PHYSICS,
VoicePanelModes,
styles
};
M.__workletHash = 1768699814221;
M.__initData = __initData26;
animatedStyle2 = useAnimatedStyle(M);
if (!isStable) {
const Y = () => windowDimensions.get();
Y.__closure = {
windowDimensions
};
Y.__workletHash = 14100798624471;
Y.__initData = __initData27;
const k = function k(a0) {
_ReanimatedRexport.runOnJS(log)("Window dimensions changed:", JSON.stringify(a0));
};
k.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
log
};
k.__workletHash = 13929796154212;
k.__initData = __initData28;
useAnimatedReaction(Y, k);
const H = () => wrapperDimensions.get();
H.__closure = {
wrapperDimensions
};
H.__workletHash = 14295147321429;
H.__initData = __initData29;
const T = function T(a0) {
_ReanimatedRexport.runOnJS(log)("Wrapper dimensions changed:", JSON.stringify(a0));
};
T.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
log
};
T.__workletHash = 1850762619613;
T.__initData = __initData30;
useAnimatedReaction(H, T);
}
const memo2 = useMemo(() => ({
wrapperRootStyles: styles.wrapper,
wrapperTransformStyles: animatedStyle,
wrapperSurfaceStyles: animatedStyle2
}), [styles.wrapper, animatedStyle2, animatedStyle]);
return <ReanimatedNativeView style={memo2.wrapperRootStyles} pointerEvents="box-none">
<ReanimatedNativeView style={memo2.wrapperTransformStyles} pointerEvents="box-none">
<ReanimatedNativeView style={memo2.wrapperSurfaceStyles} layout={layoutTransition}>{children}</ReanimatedNativeView>
</ReanimatedNativeView>
</ReanimatedNativeView>;
};
const { DRAWER_SPRING_PHYSICS, MODE_CHANGE_PHYSICS } = _VoicePanelConstants;
c11402_24 = new Logger("VoicePanelUI");
const layoutTransition2 = function layoutTransition(a0) {
return {
animations: {
originX: _spring.withSpring(a0.targetOriginX, LAYOUT_PHYSICS, "animate-always"),
originY: _spring.withSpring(a0.targetOriginY, LAYOUT_PHYSICS, "animate-always"),
width: _spring.withSpring(a0.targetWidth, LAYOUT_PHYSICS, "animate-always"),
height: _spring.withSpring(a0.targetHeight, LAYOUT_PHYSICS, "animate-always")
},
initialValues: {
originX: a0.currentOriginX,
originY: a0.currentOriginY,
width: a0.currentWidth,
height: a0.currentHeight
}
};
};
layoutTransition2.__closure = {
withSpring: _spring.withSpring,
LAYOUT_PHYSICS
};
layoutTransition2.__workletHash = 16454235842679;
layoutTransition2.__initData = {
code: "function layoutTransition_VoicePanelUITsx1(values){const{withSpring,LAYOUT_PHYSICS}=this.__closure;return{animations:{originX:withSpring(values.targetOriginX,LAYOUT_PHYSICS,'animate-always'),originY:withSpring(values.targetOriginY,LAYOUT_PHYSICS,'animate-always'),width:withSpring(values.targetWidth,LAYOUT_PHYSICS,'animate-always'),height:withSpring(values.targetHeight,LAYOUT_PHYSICS,'animate-always')},initialValues:{originX:values.currentOriginX,originY:values.currentOriginY,width:values.currentWidth,height:values.currentHeight}};}"
};
layoutTransition = layoutTransition2;
c11402_27 = {
...LAYOUT_PHYSICS,
damping: 0
};
const scrollViewLayoutTransition2 = function scrollViewLayoutTransition(a0) {
return {
animations: {
originX: _spring.withSpring(a0.targetOriginX, LAYOUT_PHYSICS, "animate-always"),
originY: _spring.withSpring(a0.targetOriginY, LAYOUT_PHYSICS, "animate-always"),
width: _spring.withSpring(a0.targetWidth, c11402_27, "animate-always"),
height: _spring.withSpring(a0.targetHeight, c11402_27, "animate-always")
},
initialValues: {
originX: a0.currentOriginX,
originY: a0.currentOriginY,
width: a0.currentWidth,
height: a0.currentHeight
}
};
};
scrollViewLayoutTransition2.__closure = {
withSpring: _spring.withSpring,
LAYOUT_PHYSICS,
EMBEDDED_ACTIVITY_ORIENTATION_UPDATE_SAFE_LAYOUT_PHYSICS: c11402_27
};
scrollViewLayoutTransition2.__workletHash = 11745134918460;
scrollViewLayoutTransition2.__initData = {
code: "function scrollViewLayoutTransition_VoicePanelUITsx2(values){const{withSpring,LAYOUT_PHYSICS,EMBEDDED_ACTIVITY_ORIENTATION_UPDATE_SAFE_LAYOUT_PHYSICS}=this.__closure;return{animations:{originX:withSpring(values.targetOriginX,LAYOUT_PHYSICS,'animate-always'),originY:withSpring(values.targetOriginY,LAYOUT_PHYSICS,'animate-always'),width:withSpring(values.targetWidth,EMBEDDED_ACTIVITY_ORIENTATION_UPDATE_SAFE_LAYOUT_PHYSICS,'animate-always'),height:withSpring(values.targetHeight,EMBEDDED_ACTIVITY_ORIENTATION_UPDATE_SAFE_LAYOUT_PHYSICS,'animate-always')},initialValues:{originX:values.currentOriginX,originY:values.currentOriginY,width:values.currentWidth,height:values.currentHeight}};}"
};
scrollViewLayoutTransition = scrollViewLayoutTransition2;
DRAWER_SIZE_PHYSICS = {
...DRAWER_SPRING_PHYSICS,
mass: 0.3,
damping: 100,
stiffness: 100
};
const r89 = {
...MODE_CHANGE_PHYSICS,
mass: 2
};
const computeViewableChunksFromScrollPosition2 = function computeViewableChunksFromScrollPosition(a0, a1, a2, r9 = 1) {
const r16 = Math.ceil(a1 / VOICE_PANEL_CHUNK_DIVISOR);
const end = Math.min(Math.max(Math.floor(a0 / r16) - r9, 0) + VOICE_PANEL_CHUNK_DIVISOR + 2 * r9, Math.ceil(a2 / r16));
return {
start: Math.max(end - VOICE_PANEL_CHUNK_DIVISOR - 2 * r9, 0),
end
};
};
computeViewableChunksFromScrollPosition2.__closure = {
VOICE_PANEL_CHUNK_DIVISOR
};
computeViewableChunksFromScrollPosition2.__workletHash = 3008066799757;
computeViewableChunksFromScrollPosition2.__initData = {
code: "function computeViewableChunksFromScrollPosition_VoicePanelUITsx3(scrollPosition,windowHeight,contentHeight,extraChunks=1){const{VOICE_PANEL_CHUNK_DIVISOR}=this.__closure;const chunkSize=Math.ceil(windowHeight/VOICE_PANEL_CHUNK_DIVISOR);let start=Math.max(Math.floor(scrollPosition/chunkSize)-extraChunks,0);const end=Math.min(start+VOICE_PANEL_CHUNK_DIVISOR+extraChunks*2,Math.ceil(contentHeight/chunkSize));start=Math.max(end-VOICE_PANEL_CHUNK_DIVISOR-extraChunks*2,0);return{start:start,end:end};}"
};
computeViewableChunksFromScrollPosition = computeViewableChunksFromScrollPosition2;
useStyles = createStyles({
accessibilityView: {
...StyleSheet.absoluteFillObject,
overflow: "hidden"
},
wrapper: {
...StyleSheet.absoluteFillObject,
alignItems: "flex-start",
zIndex: 1
},
maskDefaultBackground: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER
},
scrollView: {
...StyleSheet.absoluteFillObject,
borderTopLeftRadius: DEFAULT_BORDER_RADIUS,
borderTopRightRadius: DEFAULT_BORDER_RADIUS
},
scrollViewContent: {
flexGrow: 1,
flexShrink: 0
},
shade: {
backgroundColor: Module712.colors.MOBILE_VOICE_PANEL_BACKGROUND,
zIndex: 0
},
shadePressable: {
flexGrow: 1
}
});
AnimatedComponent = ReanimatedRexport.createAnimatedComponent(ScrollView);
isMetaQuest = _MetaQuestUtils_android.isMetaQuest();
__initData = {
code: "function VoicePanelUITsx4(){const{gestureState,connected,mode}=this.__closure;return{gestureActive:gestureState.get().active,connected:connected.get(),mode:mode.get()};}"
};
__initData2 = {
code: "function VoicePanelUITsx5(props,previous){const{cheapWorkletShallowEqual,VoicePanelModes,runOnJS,setPanelFullscreen,setPanelOpen,setPanelPIP}=this.__closure;if(cheapWorkletShallowEqual(props,previous!==null&&previous!==void 0?previous:undefined))return;const{gestureActive:gestureActive,connected:connected,mode:mode}=props;if(!connected||gestureActive||mode!==VoicePanelModes.PANEL){runOnJS(setPanelFullscreen)(false);}else{runOnJS(setPanelFullscreen)(true);}if(mode===VoicePanelModes.PANEL){runOnJS(setPanelOpen)(true);}else{runOnJS(setPanelOpen)(false);}if(mode===VoicePanelModes.PIP){runOnJS(setPanelPIP)(true);}else{runOnJS(setPanelPIP)(false);}}"
};
__initData3 = {
code: "function VoicePanelUITsx6(){const{mode,VoicePanelModes,focused}=this.__closure;var _focused$get;return mode.get()===VoicePanelModes.PANEL?(_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id:undefined;}"
};
__initData4 = {
code: "function VoicePanelUITsx7(manualId,previousManualId){const{runOnJS,handleFocusChange}=this.__closure;if(manualId!==previousManualId){runOnJS(handleFocusChange)(manualId);}}"
};
__initData5 = {
code: "function VoicePanelUITsx8(){const{connected,mode,VoicePanelModes,controlsSpecs,VoicePanelControlsModes,runOnJS,showControls,hideControls}=this.__closure;if(!connected.get())return;if(mode.get()===VoicePanelModes.PIP){}else if(controlsSpecs.get().mode===VoicePanelControlsModes.HIDDEN){runOnJS(showControls)({debounce:true});}else{runOnJS(hideControls)({debounce:true});}}"
};
__initData6 = {
code: "function VoicePanelUITsx9(){const{updateSharedValueIfChanged,gestureState}=this.__closure;updateSharedValueIfChanged(gestureState,{cancel:false,active:false});}"
};
__initData7 = {
code: "function VoicePanelUITsx10(event){const{gestureState,mode,VoicePanelModes,calculatePIPPositionFromVelocity,windowDimensions,safeArea,updateSharedValueIfChanged,wrapperDimensions,wrapperOffset,connected,runOnJS,setMode,lockScrolling,MIN_DISMISS_MOVE_PERCENTAGE,dismissPanel}=this.__closure;if(gestureState.get().cancel)return;const{velocityX:velocityX,velocityY:velocityY,absoluteX:absoluteX,absoluteY:absoluteY}=event;if(mode.get()===VoicePanelModes.PIP){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});}else if(mode.get()===VoicePanelModes.PANEL){if(velocityY>0){if(connected.get()){if(!gestureState.get().requiresPop){runOnJS(setMode)(VoicePanelModes.PIP);updateSharedValueIfChanged(wrapperOffset,{gestureActive:false,x:0,y:0});}else{updateSharedValueIfChanged(wrapperOffset,{gestureActive:false,x:0,y:0});lockScrolling.set(false);}}else{const panelHeight=wrapperDimensions.get().drawerHeight-wrapperDimensions.get().drawerY;const dismissThreshold=panelHeight*MIN_DISMISS_MOVE_PERCENTAGE;if(wrapperOffset.get().y>dismissThreshold){updateSharedValueIfChanged(wrapperOffset,{gestureActive:false});runOnJS(dismissPanel)();return;}else{updateSharedValueIfChanged(wrapperOffset,{gestureActive:false,x:0,y:0});lockScrolling.set(false);}}}else{updateSharedValueIfChanged(wrapperOffset,{gestureActive:false,x:0,y:0});lockScrolling.set(false);}}}"
};
__initData8 = {
code: "function VoicePanelUITsx11(_e){const{lockScrolling,updateSharedValueIfChanged,gestureState,wrapperOffset}=this.__closure;lockScrolling.set(false);updateSharedValueIfChanged(gestureState,{cancel:false,active:false});updateSharedValueIfChanged(wrapperOffset,{gestureActive:false});console.log('onTouchesCancelled');}"
};
__initData9 = {
code: "function VoicePanelUITsx12(event){const{gestureState,mode,VoicePanelModes,connected,lockScrolling,scrollPosition,POP_RESISTANCE,PIP_POP_HEIGHT,runOnJS,triggerHapticFeedback,HapticFeedbackTypes,updateSharedValueIfChanged,wrapperOffset}=this.__closure;if(gestureState.get().cancel)return;if(mode.get()!==VoicePanelModes.PIP){const minYOffset=0;let newYOffset=(gestureState.get().absoluteYStart-event.absoluteY)*-1;if(connected.get()&&!gestureState.get().requiresPop&&newYOffset<=minYOffset){gestureState.set({...gestureState.get(),requiresPop:true});}if(lockScrolling.get()&&newYOffset<minYOffset){lockScrolling.set(false);}else if(!lockScrolling.get()&&scrollPosition.get()<=0){lockScrolling.set(true);}if(gestureState.get().requiresPop){const distance=Math.max(newYOffset,0);const resistance=distance*POP_RESISTANCE;if(distance<=PIP_POP_HEIGHT){newYOffset=distance-resistance;}else{gestureState.set({...gestureState.get(),requiresPop:false});runOnJS(triggerHapticFeedback)(HapticFeedbackTypes.IMPACT_MEDIUM);}}updateSharedValueIfChanged(wrapperOffset,{y:newYOffset,x:0});}else{updateSharedValueIfChanged(wrapperOffset,{x:(gestureState.get().absoluteXStart-event.absoluteX)*-1,y:(gestureState.get().absoluteYStart-event.absoluteY)*-1});}}"
};
__initData10 = {
code: "function VoicePanelUITsx13(event,manager){const{State,gestureState,mode,VoicePanelModes,scrollPosition,isQuest,MIN_GESTURE_MOVE,focused,runOnJS,triggerIOSHaptic,updateSharedValueIfChanged,wrapperOffset,lockScrolling}=this.__closure;if(event.state!==State.BEGAN||gestureState.get().active||gestureState.get().cancel)return;const{absoluteY:absoluteY,absoluteX:absoluteX}=event.changedTouches[0];const yDiff=gestureState.get().absoluteYStart-absoluteY;const xDiff=gestureState.get().absoluteXStart-absoluteX;const absoluteMovement=Math.max(Math.abs(yDiff),Math.abs(xDiff));const isNotPullDownGesture=Math.abs(xDiff)>=Math.abs(yDiff)||yDiff>0;let startGesture=false;if(mode.get()===VoicePanelModes.PANEL){var _focused$get;const scrollPos=Math.floor(scrollPosition.get());if(yDiff<0&&scrollPos<=0){if(isQuest){startGesture=absoluteMovement>MIN_GESTURE_MOVE;}else{startGesture=true;}}else if(((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)!=null&&isNotPullDownGesture){manager.fail();}}else if(mode.get()===VoicePanelModes.PIP&&absoluteMovement>MIN_GESTURE_MOVE){startGesture=true;runOnJS(triggerIOSHaptic)();}if(startGesture){updateSharedValueIfChanged(wrapperOffset,{gestureActive:true});gestureState.set({absoluteXStart:absoluteX,absoluteYStart:absoluteY+scrollPosition.get(),cancel:false,active:true,requiresPop:gestureState.get().requiresPop});lockScrolling.set(true);manager.activate();}else{updateSharedValueIfChanged(gestureState,{absoluteYStart:absoluteY,absoluteXStart:absoluteX});}}"
};
__initData11 = {
code: "function VoicePanelUITsx14(event){const{gestureState,updateSharedValueIfChanged,wrapperOffset,connected,mode,VoicePanelModes}=this.__closure;if(gestureState.get().cancel)return;updateSharedValueIfChanged(wrapperOffset,{x:0,y:0});gestureState.set({absoluteXStart:event.absoluteX,absoluteYStart:event.absoluteY,active:false,cancel:false,requiresPop:connected.get()&&mode.get()===VoicePanelModes.PANEL});}"
};
__initData12 = {
code: "function VoicePanelUITsx15(event,manager){const{IS_IOS,windowDimensions,safeArea,gestureState,isFocusedVideoZoomed,mode,VoicePanelModes,controlsSpecs,VoicePanelControlsModes}=this.__closure;const touch=event.allTouches[0];if(IS_IOS&&touch!=null&&touch.absoluteY>windowDimensions.get().height-safeArea.get().bottom){gestureState.set({...gestureState.get(),cancel:true});manager.activate();return;}if(isFocusedVideoZoomed.get()||mode.get()===VoicePanelModes.PANEL&&controlsSpecs.get().mode===VoicePanelControlsModes.DRAWER){gestureState.set({...gestureState.get(),cancel:true});manager.fail();}}"
};
__initData13 = {
code: "function onBeginDrag_VoicePanelUITsx16(event){const{scrollPosition,dragScrolling}=this.__closure;scrollPosition.set(event.contentOffset.y);dragScrolling.set(true);}"
};
__initData14 = {
code: "function onEndDrag_VoicePanelUITsx17(){const{dragScrolling}=this.__closure;dragScrolling.set(false);}"
};
__initData15 = {
code: "function onMomentumEnd_VoicePanelUITsx18(){const{dragScrolling}=this.__closure;dragScrolling.set(false);}"
};
__initData16 = {
code: "function onScroll_VoicePanelUITsx19(event){const{lockScrolling,isSnappingBack,scrollPosition,scrollTo,scrollerRef,computeViewableChunksFromScrollPosition,windowDimensions,scrollableRegionSize,updateSharedValueIfChanged,viewableChunks}=this.__closure;if(lockScrolling.get()){if(isSnappingBack.get()){return;}if(scrollPosition.get()<0){scrollPosition.set(0);}const targetScrollPosition=scrollPosition.get();if(Math.abs(event.contentOffset.y-targetScrollPosition)<0.1){return;}isSnappingBack.set(true);scrollTo(scrollerRef,0,targetScrollPosition,false);isSnappingBack.set(false);}else{let newViewableChunks;if(scrollPosition.get()!==event.contentOffset.y){newViewableChunks=computeViewableChunksFromScrollPosition(scrollPosition.get(),windowDimensions.get().height,scrollableRegionSize.get());}scrollPosition.set(event.contentOffset.y);newViewableChunks!=null&&updateSharedValueIfChanged(viewableChunks,newViewableChunks);}}"
};
__initData17 = {
code: "function VoicePanelUITsx20(){const{mode}=this.__closure;return mode.get();}"
};
__initData18 = {
code: "function VoicePanelUITsx21(mode,previous){const{VoicePanelModes,lockScrolling}=this.__closure;if(previous==null||mode===previous)return;if(mode===VoicePanelModes.PANEL&&previous===VoicePanelModes.PIP){lockScrolling.set(false);}else if(mode===VoicePanelModes.PIP){lockScrolling.set(true);}}"
};
__initData19 = {
code: "function VoicePanelUITsx22(){const{mode,VoicePanelModes,focused,lockScrolling,calculateVoicePanelHeaderSpecs,safeArea,edgeGutter}=this.__closure;const isPIPMode=mode.get()===VoicePanelModes.PIP;const disableScroll=isPIPMode||focused.get()!=null;return{pointerEvents:isPIPMode?'none':'auto',scrollEnabled:!disableScroll,showsVerticalScrollIndicator:lockScrolling.get()?false:!disableScroll,scrollIndicatorInsets:{top:calculateVoicePanelHeaderSpecs(safeArea.get(),edgeGutter).height-safeArea.get().top,bottom:safeArea.get().bottom}};}"
};
__initData20 = {
code: "function VoicePanelUITsx23(){const{mode,VoicePanelModes,connected,gestureState,wrapperDimensions,wrapperOffset,windowDimensions}=this.__closure;switch(mode.get()){case VoicePanelModes.PIP:case VoicePanelModes.DISMISSED:return 0;default:{if(connected.get()&&gestureState.get().active&&gestureState.get().requiresPop){return 1;}const drawerTop=wrapperDimensions.get().drawerY+(wrapperOffset.get().gestureActive?wrapperOffset.get().y:0);const screenSize=windowDimensions.get().height;const percentage=(screenSize-drawerTop)/screenSize;return Math.min(Math.max(percentage,0),1);}}}"
};
const computeBorderRadii2 = function computeBorderRadii({ mode: mode3, connected: connected3 }) {
return mode3 === VoicePanelModes.PIP ? DEFAULT_BORDER_RADIUS_PIP : connected3 ? 0 : DEFAULT_BORDER_RADIUS;
};
computeBorderRadii2.__closure = {
VoicePanelModes,
DEFAULT_BORDER_RADIUS_PIP,
DEFAULT_BORDER_RADIUS
};
computeBorderRadii2.__workletHash = 4574399878042;
computeBorderRadii2.__initData = {
code: "function computeBorderRadii_VoicePanelUITsx24({mode:mode,connected:connected}){const{VoicePanelModes,DEFAULT_BORDER_RADIUS_PIP,DEFAULT_BORDER_RADIUS}=this.__closure;if(mode===VoicePanelModes.PIP){return DEFAULT_BORDER_RADIUS_PIP;}return!connected?DEFAULT_BORDER_RADIUS:0;}"
};
computeBorderRadii = computeBorderRadii2;
__initData21 = {
code: "function VoicePanelUITsx25(){const{controlsSpecs}=this.__closure;return controlsSpecs.get().height;}"
};
__initData22 = {
code: "function VoicePanelUITsx26(){const{mode,connected,windowDimensions,safeArea,focused,pipState,controlsHeight,preJoinContentSize,globalStatusIndicatorHeight}=this.__closure;return{modeToSet:mode.get(),connected:connected.get(),windowWidth:windowDimensions.get().width,windowHeight:windowDimensions.get().height,safeArea:safeArea.get(),focused:focused.get(),pipState:pipState,controlsHeight:controlsHeight.get(),preJoinContentSize:preJoinContentSize.get(),globalStatusIndicatorHeight:globalStatusIndicatorHeight};}"
};
__initData23 = {
code: "function VoicePanelUITsx27(props,previous){const{cheapWorkletShallowEqual,VoicePanelModes,wrapperDimensions,updateSharedValueIfChanged,wrapperOffset,getMaxPanelWidth,getPanelX,roundToNearestPixel,windowDimensions}=this.__closure;if(cheapWorkletShallowEqual(props,previous!==null&&previous!==void 0?previous:undefined))return;const{modeToSet:modeToSet,connected:connected,windowWidth:windowWidth,windowHeight:windowHeight,safeArea:safeArea,pipState:pipState,controlsHeight:controlsHeight,preJoinContentSize:preJoinContentSize,globalStatusIndicatorHeight:globalStatusIndicatorHeight}=props;if(modeToSet===VoicePanelModes.PIP&&pipState.id==null){return;}const animated=previous!=null?windowHeight===previous.windowHeight&&windowWidth===previous.windowWidth&&safeArea.top===previous.safeArea.top&&safeArea.bottom===previous.safeArea.bottom&&safeArea.left===previous.safeArea.left&&safeArea.right===previous.safeArea.right:true;let{drawerX:drawerX,drawerY:drawerY}=wrapperDimensions.get();const availableHeight=windowHeight-globalStatusIndicatorHeight;if(modeToSet===VoicePanelModes.PANEL){if(connected){drawerX=0;drawerY=0;updateSharedValueIfChanged(wrapperDimensions,{drawerWidth:windowWidth,drawerHeight:availableHeight,drawerX:drawerX,drawerY:drawerY,animated:animated,mode:modeToSet});updateSharedValueIfChanged(wrapperOffset,{gestureActive:false});}else{const drawerWidth=getMaxPanelWidth({windowWidth:windowWidth,connected:connected,safeAreaLeft:safeArea.left,safeAreaRight:safeArea.right});drawerX=getPanelX(windowWidth,drawerWidth);drawerY=roundToNearestPixel(Math.max(availableHeight-preJoinContentSize-controlsHeight-safeArea.bottom,availableHeight-0.8*availableHeight));updateSharedValueIfChanged(wrapperDimensions,{drawerWidth:drawerWidth,drawerHeight:availableHeight,drawerX:drawerX,drawerY:drawerY,animated:animated,mode:modeToSet});}}else if(modeToSet===VoicePanelModes.DISMISSED){if(connected){updateSharedValueIfChanged(wrapperDimensions,{mode:modeToSet});}else{updateSharedValueIfChanged(wrapperDimensions,{drawerY:windowDimensions.get().height+60,mode:modeToSet});}}}"
};
__initData24 = {
code: "function VoicePanelUITsx28(){const{useReducedMotion,wrapperDimensions,wrapperOffset,connected,mode,VoicePanelModes,runOnJS,updateSourceTrackingView,withSpring,DRAWER_SPRING_PHYSICS_GESTURE_ACTIVE,DRAWER_SIZE_PHYSICS}=this.__closure;const animateXY=!useReducedMotion.get()&&wrapperDimensions.get().animated||wrapperOffset.get().gestureActive;let{gestureActive:gestureActive}=wrapperOffset.get();let{drawerY:y,drawerX:x}=wrapperDimensions.get();gestureActive=gestureActive&&!connected.get();if(gestureActive){y+=Math.max(wrapperOffset.get().y,0);x+=wrapperOffset.get().x;}const updateSourceTrackingViewHelper=function(finished){if(finished&&mode.get()!==VoicePanelModes.DISMISSED){runOnJS(updateSourceTrackingView)();}};return{transform:[{translateX:withSpring(x,wrapperOffset.get().gestureActive?DRAWER_SPRING_PHYSICS_GESTURE_ACTIVE:DRAWER_SIZE_PHYSICS,animateXY?'animate-always':'animate-never',updateSourceTrackingViewHelper)},{translateY:withSpring(y,wrapperOffset.get().gestureActive?DRAWER_SPRING_PHYSICS_GESTURE_ACTIVE:DRAWER_SIZE_PHYSICS,animateXY?'animate-always':'animate-never',updateSourceTrackingViewHelper)}]};}"
};
__initData25 = {
code: "function VoicePanelUITsx29(finished){const{mode,VoicePanelModes,runOnJS,updateSourceTrackingView}=this.__closure;if(finished&&mode.get()!==VoicePanelModes.DISMISSED){runOnJS(updateSourceTrackingView)();}}"
};
__initData26 = {
code: "function VoicePanelUITsx30(){const{computeBorderRadii,mode,connected,wrapperDimensions,withSpring,BORDER_RADIUS_PHYSICS,VoicePanelModes,styles}=this.__closure;const borderRadius=computeBorderRadii({mode:mode.get(),connected:connected.get()});return{width:wrapperDimensions.get().drawerWidth,height:wrapperDimensions.get().drawerHeight,borderRadius:withSpring(borderRadius,BORDER_RADIUS_PHYSICS),pointerEvents:mode.get()===VoicePanelModes.PANEL?'auto':'none',backgroundColor:connected.get()?'transparent':styles.maskDefaultBackground.backgroundColor};}"
};
__initData27 = {
code: "function VoicePanelUITsx31(){const{windowDimensions}=this.__closure;return windowDimensions.get();}"
};
__initData28 = {
code: "function VoicePanelUITsx32(value){const{runOnJS,log}=this.__closure;runOnJS(log)('Window dimensions changed:',JSON.stringify(value));}"
};
__initData29 = {
code: "function VoicePanelUITsx33(){const{wrapperDimensions}=this.__closure;return wrapperDimensions.get();}"
};
__initData30 = {
code: "function VoicePanelUITsx34(value){const{runOnJS,log}=this.__closure;runOnJS(log)('Wrapper dimensions changed:',JSON.stringify(value));}"
};
DrawerShadeOpacityPhysics = {
mass: 0.6,
damping: 30,
stiffness: 400,
overshootClamping: true
};
__initData31 = {
code: "function VoicePanelUITsx35(){const{withSpring,opacity,DrawerShadeOpacityPhysics}=this.__closure;return{opacity:withSpring(opacity.get(),DrawerShadeOpacityPhysics),pointerEvents:opacity.get()===0?'none':'auto'};}"
};
Component = Module19.memo(function({ opacity, onPress }) {
const styles2 = useStyles();
const r16 = function() {
return {
opacity: _spring.withSpring(opacity.get(), DrawerShadeOpacityPhysics),
pointerEvents: opacity.get() === 0 ? "none" : "auto"
};
};
r16.__closure = {
withSpring: _spring.withSpring,
opacity,
DrawerShadeOpacityPhysics
};
r16.__workletHash = 3656047169284;
r16.__initData = __initData31;
return <ReanimatedRexport.View style={[StyleSheet.absoluteFill, styles2.shade, useAnimatedStyle(r16)]} importantForAccessibility="no-hide-descendants" accessibilityElementsHidden>
<Pressable style={styles2.shadePressable} onPress={onPress} />
</ReanimatedRexport.View>;
});
const r179 = Module19.memo(function VoicePanelUI() {
let c22605_3;
let scrollPosition, dragScrolling, callback, callback2, callback3, channelId2, connected2, controlsSpecs2, dismissPanel, dismissToPIPGestureRef, focused2, hideControls, isFocusedVideoZoomed, mode2, safeArea2, setMode, showControls, windowDimensions2, wrapperDimensions2, wrapperOffset2, c22606_20, sharedValue, sharedValue2, sharedValue3, sharedValue4, state, setState2, memo, animatedRef, sharedValue5, callback4, token;
const styles2 = useStyles();
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.VOICE_PANEL).analyticsLocations;
const context = useContext(VoicePanelStateContext);
const { scrollPosition: scrollPosition2, dragScrolling: dragScrolling2, channelId, dismissPanel: dismissPanel2 } = context;
const [state2, setState] = useState(false);
const ref = useRef(-1);
const callback7 = useCallback((lockEnabled) => {
clearTimeout(ref.current);
batchUpdates(() => {
if (lockEnabled) {
ref.current = setTimeout(() => {
VoicePanelStore.getState().setChannelPanelFullscreen(channelId, lockEnabled);
AppFreezeStore.getState().requestFreezeLock({
lockEnabled,
key: `voice-panel-freeze-${channelId}`
});
}, 1000);
} else {
VoicePanelStore.getState().setChannelPanelFullscreen(channelId, lockEnabled);
AppFreezeStore.getState().requestFreezeLock({
lockEnabled,
key: `voice-panel-freeze-${channelId}`
});
}
});
}, [channelId]);
useLayoutEffect(() => () => {
clearTimeout(ref.current);
}, []);
const callback6 = useCallback((a0) => {
VoicePanelStore.getState().setChannelPanelOpen(channelId, a0);
}, [channelId]);
const callback5 = useCallback((a0) => {
VoicePanelStore.getState().setChannelPanelPIP(channelId, a0);
}, [channelId]);
scrollPosition = scrollPosition2;
dragScrolling = dragScrolling2;
callback = callback7;
callback2 = callback6;
callback3 = callback5;
channelId2 = void 0;
connected2 = void 0;
controlsSpecs2 = void 0;
dismissPanel = void 0;
dismissToPIPGestureRef = void 0;
focused2 = void 0;
hideControls = void 0;
isFocusedVideoZoomed = void 0;
mode2 = void 0;
safeArea2 = void 0;
setMode = void 0;
showControls = void 0;
windowDimensions2 = void 0;
wrapperDimensions2 = void 0;
wrapperOffset2 = void 0;
c22606_20 = void 0;
sharedValue = void 0;
sharedValue2 = void 0;
sharedValue3 = void 0;
sharedValue4 = void 0;
state = void 0;
setState2 = void 0;
memo = void 0;
animatedRef = void 0;
sharedValue5 = void 0;
callback4 = void 0;
token = void 0;
const context2 = useContext(VoicePanelStateContext);
channelId2 = context2.channelId;
connected2 = context2.connected;
controlsSpecs2 = context2.controlsSpecs;
dismissPanel = context2.dismissPanel;
dismissToPIPGestureRef = context2.dismissToPIPGestureRef;
focused2 = context2.focused;
hideControls = context2.hideControls;
isFocusedVideoZoomed = context2.isFocusedVideoZoomed;
mode2 = context2.mode;
safeArea2 = context2.safeArea;
setMode = context2.setMode;
showControls = context2.showControls;
windowDimensions2 = context2.windowDimensions;
wrapperDimensions2 = context2.wrapperDimensions;
wrapperOffset2 = context2.wrapperOffset;
const safeAreaInsets_native = useSafeAreaInsets_native();
c22606_20 = safeAreaInsets_native;
sharedValue = useSharedValue(0);
sharedValue2 = useSharedValue(false);
sharedValue3 = useSharedValue(false);
sharedValue4 = useSharedValue({
start: 0,
end: VOICE_PANEL_CHUNK_DIVISOR
});
[state, setState2] = useState(true);
memo = useMemo(() => Gesture.Native(), []);
animatedRef = useAnimatedRef();
sharedValue5 = useSharedValue({
absoluteXStart: 0,
absoluteYStart: 0,
cancel: false,
active: false,
requiresPop: false
});
const f = () => ({
gestureActive: sharedValue5.get().active,
connected: connected2.get(),
mode: mode2.get()
});
f.__closure = {
gestureState: sharedValue5,
connected: connected2,
mode: mode2
};
f.__workletHash = 5596084348360;
f.__initData = __initData;
const r121 = function h(a0, a1) {
if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(a0, a1 == null ? void 0 : a1)) {
const { gestureActive, connected: connected3, mode: mode3 } = a0;
if (connected3 && (!gestureActive && mode3 === VoicePanelModes.PANEL)) {
_ReanimatedRexport.runOnJS(callback)(true);
} else {
_ReanimatedRexport.runOnJS(callback)(false);
}
if (mode3 === VoicePanelModes.PANEL) {
_ReanimatedRexport.runOnJS(callback2)(true);
} else {
_ReanimatedRexport.runOnJS(callback2)(false);
}
if (mode3 === VoicePanelModes.PIP) {
_ReanimatedRexport.runOnJS(callback3)(true);
} else {
_ReanimatedRexport.runOnJS(callback3)(false);
}
}
};
r121.__closure = {
cheapWorkletShallowEqual: _cheapWorkletShallowEqual.cheapWorkletShallowEqual,
VoicePanelModes,
runOnJS: _ReanimatedRexport.runOnJS,
setPanelFullscreen: callback,
setPanelOpen: callback2,
setPanelPIP: callback3
};
r121.__workletHash = 10989484188294;
r121.__initData = __initData2;
useAnimatedReaction(f, r121);
callback4 = useCallback((a0) => {
setState2(!(a0 != null && isActivityParticipant(ChannelRTCStore.getParticipant(channelId2, a0))));
}, [channelId2]);
const me = () => mode2.get() === VoicePanelModes.PANEL ? focused2.get()?.id : void 0;
me.__closure = {
mode: mode2,
VoicePanelModes,
focused: focused2
};
me.__workletHash = 6595654888031;
me.__initData = __initData3;
const Pe = function Pe(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(callback4)(a0);
}
};
Pe.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
handleFocusChange: callback4
};
Pe.__workletHash = 15236018210415;
Pe.__initData = __initData4;
useAnimatedReaction(me, Pe);
const memo2 = useMemo(() => {
const r9 = Gesture.Tap();
const r39 = r9.hitSlop({
left: -1 * c22606_20.left,
right: -1 * c22606_20.right
}).enabled(state).maxDistance(30);
const r41 = function h() {
if (connected2.get() && mode2.get() !== VoicePanelModes.PIP) {
if (controlsSpecs2.get().mode === VoicePanelControlsModes.HIDDEN) {
_ReanimatedRexport.runOnJS(showControls)({
debounce: true
});
} else {
_ReanimatedRexport.runOnJS(hideControls)({
debounce: true
});
}
}
};
r41.__closure = {
connected: connected2,
mode: mode2,
VoicePanelModes,
controlsSpecs: controlsSpecs2,
VoicePanelControlsModes,
runOnJS: _ReanimatedRexport.runOnJS,
showControls,
hideControls
};
r41.__workletHash = 15350003421175;
r41.__initData = __initData5;
const r48 = r39.onStart(r41);
const r76 = Gesture.Pan().enabled(state).manualActivation(true).maxPointers(1).hitSlop({
left: -1 * c22606_20.left,
right: -1 * c22606_20.right
}).withRef(dismissToPIPGestureRef).shouldCancelWhenOutside(false).simultaneousWithExternalGesture(memo);
const S = function S(a0, a1) {
const r12 = a0.allTouches[0];
if (IS_IOS && r12 != null && r12.absoluteY > windowDimensions2.get().height - safeArea2.get().bottom) {
sharedValue5.set({
...sharedValue5.get(),
cancel: true
});
a1.activate();
return void 0;
}
if (isFocusedVideoZoomed.get() || mode2.get() === VoicePanelModes.PANEL && controlsSpecs2.get().mode === VoicePanelControlsModes.DRAWER) {
sharedValue5.set({
...sharedValue5.get(),
cancel: true
});
a1.fail();
}
};
S.__closure = {
IS_IOS,
windowDimensions: windowDimensions2,
safeArea: safeArea2,
gestureState: sharedValue5,
isFocusedVideoZoomed,
mode: mode2,
VoicePanelModes,
controlsSpecs: controlsSpecs2,
VoicePanelControlsModes
};
S.__workletHash = 13538548264193;
S.__initData = __initData12;
const r85 = r76.onTouchesDown(S);
const u = function u(a0) {
if (!sharedValue5.get().cancel) {
updateSharedValueIfChanged_native(wrapperOffset2, {
x: 0,
y: 0
});
sharedValue5.set({
absoluteXStart: a0.absoluteX,
absoluteYStart: a0.absoluteY,
active: false,
cancel: false,
requiresPop: connected2.get() && mode2.get() === VoicePanelModes.PANEL
});
}
};
u.__closure = {
gestureState: sharedValue5,
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
wrapperOffset: wrapperOffset2,
connected: connected2,
mode: mode2,
VoicePanelModes
};
u.__workletHash = 11622638269935;
u.__initData = __initData11;
const r95 = r85.onBegin(u);
const c = function c(a0, a1) {
let r3;
if (a0.state === _Module5273.State.BEGAN && !sharedValue5.get().active && !sharedValue5.get().cancel) {
const r32 = a0.changedTouches[0];
const { absoluteY, absoluteX } = r32;
const r15 = sharedValue5.get().absoluteYStart - absoluteY;
const r18 = sharedValue5.get().absoluteXStart - absoluteX;
const r44 = Math.max(Math.abs(r15), Math.abs(r18));
const r2 = Math.abs(r18) >= Math.abs(r15) || r15 > 0;
L21: {
if (mode2.get() === VoicePanelModes.PANEL) {
const r74 = Math.floor(scrollPosition.get());
if (r15 < 0 && r74 <= 0) {
r3 = isMetaQuest ? r44 > 10 : !isMetaQuest;
break L21;
}
const r81 = focused2.get()?.id != null && r2;
r3 = false;
if (r81) {
a1.fail();
r3 = false;
}
} else {
const r1 = mode2.get() === VoicePanelModes.PIP && r44 > 10;
r3 = false;
if (r1) {
_ReanimatedRexport.runOnJS(triggerIOSHaptic)();
r3 = true;
}
}
}
if (r3) {
updateSharedValueIfChanged_native(wrapperOffset2, {
gestureActive: true
});
sharedValue5.set({
absoluteXStart: absoluteX,
absoluteYStart: absoluteY + scrollPosition.get(),
cancel: false,
active: true,
requiresPop: sharedValue5.get().requiresPop
});
sharedValue2.set(true);
a1.activate();
} else {
updateSharedValueIfChanged_native(sharedValue5, {
absoluteYStart: absoluteY,
absoluteXStart: absoluteX
});
}
}
};
c.__closure = {
State: _Module5273.State,
gestureState: sharedValue5,
mode: mode2,
VoicePanelModes,
scrollPosition,
isQuest: isMetaQuest,
MIN_GESTURE_MOVE: 10,
focused: focused2,
runOnJS: _ReanimatedRexport.runOnJS,
triggerIOSHaptic,
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
wrapperOffset: wrapperOffset2,
lockScrolling: sharedValue2
};
c.__workletHash = 262321069191;
c.__initData = __initData10;
const r114 = r95.onTouchesMove(c);
const r116 = function l(a0) {
if (!sharedValue5.get().cancel) {
if (mode2.get() !== VoicePanelModes.PIP) {
const r42 = -1 * (sharedValue5.get().absoluteYStart - a0.absoluteY);
if (connected2.get() && !sharedValue5.get().requiresPop && r42 <= 0) {
sharedValue5.set({
...sharedValue5.get(),
requiresPop: true
});
}
if (sharedValue2.get() && r42 < 0) {
sharedValue2.set(false);
} else {
const r61 = sharedValue2.get();
if (r61 ? !r61 : scrollPosition.get() <= 0) {
sharedValue2.set(true);
}
}
const requiresPop = sharedValue5.get().requiresPop;
let r76 = r42;
if (requiresPop) {
const r81 = Math.max(r42, 0);
if (r81 <= 180) {
r76 = r81 - r81 * POP_RESISTANCE;
} else {
sharedValue5.set({
...sharedValue5.get(),
requiresPop: false
});
_ReanimatedRexport.runOnJS(_HapticUtils_native.triggerHapticFeedback)(_HapticUtils_native.HapticFeedbackTypes.IMPACT_MEDIUM);
r76 = r42;
}
}
updateSharedValueIfChanged_native(wrapperOffset2, {
y: r76,
x: 0
});
} else {
updateSharedValueIfChanged_native(wrapperOffset2, {
x: -1 * (sharedValue5.get().absoluteXStart - a0.absoluteX),
y: -1 * (sharedValue5.get().absoluteYStart - a0.absoluteY)
});
}
}
};
r116.__closure = {
gestureState: sharedValue5,
mode: mode2,
VoicePanelModes,
connected: connected2,
lockScrolling: sharedValue2,
scrollPosition,
POP_RESISTANCE,
PIP_POP_HEIGHT: 180,
runOnJS: _ReanimatedRexport.runOnJS,
triggerHapticFeedback: _HapticUtils_native.triggerHapticFeedback,
HapticFeedbackTypes: _HapticUtils_native.HapticFeedbackTypes,
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
wrapperOffset: wrapperOffset2
};
r116.__workletHash = 2084376677229;
r116.__initData = __initData9;
const r132 = r114.onChange(r116);
const r134 = function() {
sharedValue2.set(false);
updateSharedValueIfChanged_native(sharedValue5, {
cancel: false,
active: false
});
updateSharedValueIfChanged_native(wrapperOffset2, {
gestureActive: false
});
};
r134.__closure = {
lockScrolling: sharedValue2,
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
gestureState: sharedValue5,
wrapperOffset: wrapperOffset2
};
r134.__workletHash = 8529626440714;
r134.__initData = __initData8;
const r140 = r132.onTouchesCancelled(r134);
const n = function n(a0) {
if (!sharedValue5.get().cancel) {
const { velocityX, velocityY, absoluteX, absoluteY } = a0;
if (mode2.get() === VoicePanelModes.PIP) {
const r118 = _VoicePanelPIPUtils.calculatePIPPositionFromVelocity({
velocityX,
velocityY,
absoluteX,
absoluteY,
windowDimensions: windowDimensions2.get(),
safeArea: safeArea2.get()
});
updateSharedValueIfChanged_native(wrapperDimensions2, {
pipX: r118.pipX,
pipY: r118.pipY
});
updateSharedValueIfChanged_native(wrapperOffset2, {
gestureActive: false
});
} else if (mode2.get() === VoicePanelModes.PANEL) {
if (velocityY > 0) {
if (connected2.get()) {
if (sharedValue5.get().requiresPop) {
updateSharedValueIfChanged_native(wrapperOffset2, {
gestureActive: false,
x: 0,
y: 0
});
sharedValue2.set(false);
} else {
_ReanimatedRexport.runOnJS(setMode)(VoicePanelModes.PIP);
updateSharedValueIfChanged_native(wrapperOffset2, {
gestureActive: false,
x: 0,
y: 0
});
}
} else {
const r43 = wrapperDimensions2.get().drawerHeight - wrapperDimensions2.get().drawerY;
if (wrapperOffset2.get().y > 0.2 * r43) {
updateSharedValueIfChanged_native(wrapperOffset2, {
gestureActive: false
});
_ReanimatedRexport.runOnJS(dismissPanel)();
} else {
updateSharedValueIfChanged_native(wrapperOffset2, {
gestureActive: false,
x: 0,
y: 0
});
sharedValue2.set(false);
}
}
} else {
updateSharedValueIfChanged_native(wrapperOffset2, {
gestureActive: false,
x: 0,
y: 0
});
sharedValue2.set(false);
}
}
}
};
n.__closure = {
gestureState: sharedValue5,
mode: mode2,
VoicePanelModes,
calculatePIPPositionFromVelocity: _VoicePanelPIPUtils.calculatePIPPositionFromVelocity,
windowDimensions: windowDimensions2,
safeArea: safeArea2,
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
wrapperDimensions: wrapperDimensions2,
wrapperOffset: wrapperOffset2,
connected: connected2,
runOnJS: _ReanimatedRexport.runOnJS,
setMode,
lockScrolling: sharedValue2,
MIN_DISMISS_MOVE_PERCENTAGE: 0.2,
dismissPanel
};
n.__workletHash = 10532794222556;
n.__initData = __initData7;
const r157 = r140.onEnd(n);
const t = function t() {
updateSharedValueIfChanged_native(sharedValue5, {
cancel: false,
active: false
});
};
t.__closure = {
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
gestureState: sharedValue5
};
t.__workletHash = 141147937726;
t.__initData = __initData6;
return Gesture.Race(r48, r157.onFinalize(t));
}, [safeAreaInsets_native, connected2, controlsSpecs2, dismissPanel, dismissToPIPGestureRef, focused2, state, hideControls, sharedValue5, isFocusedVideoZoomed, sharedValue2, mode2, safeArea2, scrollPosition, memo, setMode, showControls, windowDimensions2, wrapperDimensions2, wrapperOffset2]);
const Ae = function Ae(a0) {
scrollPosition.set(a0.contentOffset.y);
dragScrolling.set(true);
};
Ae.__closure = {
scrollPosition,
dragScrolling
};
Ae.__workletHash = 57033362164;
Ae.__initData = __initData13;
const Ve = function Ve() {
dragScrolling.set(false);
};
Ve.__closure = {
dragScrolling
};
Ve.__workletHash = 14366146937201;
Ve.__initData = __initData14;
const ve = function ve() {
dragScrolling.set(false);
};
ve.__closure = {
dragScrolling
};
ve.__workletHash = 12919609750790;
ve.__initData = __initData15;
const Oe = function Oe(a0) {
if (sharedValue2.get()) {
if (sharedValue3.get()) {
return void 0;
}
if (scrollPosition.get() < 0) {
scrollPosition.set(0);
}
const r84 = scrollPosition.get();
if (Math.abs(a0.contentOffset.y - r84) < 0.1) {
return void 0;
}
sharedValue3.set(true);
_ReanimatedRexport.scrollTo(animatedRef, 0, r84, false);
sharedValue3.set(false);
} else {
const r25 = scrollPosition.get();
const r27 = a0.contentOffset.y;
let r9 = void 0;
if (r25 !== r27) {
const r14 = scrollPosition.get();
const height2 = windowDimensions2.get().height;
const r17 = sharedValue.get();
const r40 = Math.ceil(height2 / VOICE_PANEL_CHUNK_DIVISOR);
const r45 = Math.max(Math.floor(r14 / r40) - 1, 0);
const r46 = Math;
const r48 = r45 + VOICE_PANEL_CHUNK_DIVISOR;
const r50 = 2 * 1;
const end = r46.min(r48 + r50, Math.ceil(r17 / r40));
r9 = {
start: Math.max(end - VOICE_PANEL_CHUNK_DIVISOR - r50, 0),
end
};
}
scrollPosition.set(a0.contentOffset.y);
if (r9 != null) {
updateSharedValueIfChanged_native(sharedValue4, r9);
}
}
};
Oe.__closure = {
lockScrolling: sharedValue2,
isSnappingBack: sharedValue3,
scrollPosition,
scrollTo: _ReanimatedRexport.scrollTo,
scrollerRef: animatedRef,
computeViewableChunksFromScrollPosition,
windowDimensions: windowDimensions2,
scrollableRegionSize: sharedValue,
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
viewableChunks: sharedValue4
};
Oe.__workletHash = 13292683579177;
Oe.__initData = __initData16;
const animatedScrollHandler = useAnimatedScrollHandler({
onBeginDrag: Ae,
onEndDrag: Ve,
onMomentumEnd: ve,
onScroll: Oe
});
const Ee = () => mode2.get();
Ee.__closure = {
mode: mode2
};
Ee.__workletHash = 9335671323831;
Ee.__initData = __initData17;
const De = function De(a0, a1) {
const r7 = a1 != null && a0 !== a1;
L8: {
if (r7) {
if (a0 === VoicePanelModes.PANEL && a1 === VoicePanelModes.PIP) {
sharedValue2.set(false);
break L8;
}
if (a0 === VoicePanelModes.PIP) {
sharedValue2.set(true);
}
}
}
};
De.__closure = {
VoicePanelModes,
lockScrolling: sharedValue2
};
De.__workletHash = 15902278985136;
De.__initData = __initData18;
useAnimatedReaction(Ee, De);
token = useToken(Module712.modules.mobile.VOICE_PANEL_GUTTER);
const Me = function Me() {
const r1 = mode2.get() === VoicePanelModes.PIP;
const r0 = r1 || focused2.get() != null;
const pointerEvents = r1 ? "none" : "auto";
const scrollEnabled = !r0;
const r19 = sharedValue2.get();
return {
pointerEvents,
scrollEnabled,
showsVerticalScrollIndicator: r19 ? !r19 : scrollEnabled,
scrollIndicatorInsets: {
top: calculateVoicePanelHeaderSpecs(safeArea2.get(), token).height - safeArea2.get().top,
bottom: safeArea2.get().bottom
}
};
};
Me.__closure = {
mode: mode2,
VoicePanelModes,
focused: focused2,
lockScrolling: sharedValue2,
calculateVoicePanelHeaderSpecs,
safeArea: safeArea2,
edgeGutter: token
};
Me.__workletHash = 15030832737033;
Me.__initData = __initData19;
const animatedProps = useAnimatedProps(Me);
const callback8 = useCallback((a0, a1) => {
sharedValue.set(a1);
}, [sharedValue]);
const Te = function Te() {
const r7 = mode2.get();
if (VoicePanelModes.PIP !== r7 && VoicePanelModes.DISMISSED !== r7) {
if (connected2.get() && sharedValue5.get().active && sharedValue5.get().requiresPop) {
return 1;
}
const r31 = wrapperDimensions2.get().drawerY + (wrapperOffset2.get().gestureActive ? wrapperOffset2.get().y : 0);
const height2 = windowDimensions2.get().height;
return Math.min(Math.max((height2 - r31) / height2, 0), 1);
}
return 0;
};
Te.__closure = {
mode: mode2,
VoicePanelModes,
connected: connected2,
gestureState: sharedValue5,
wrapperDimensions: wrapperDimensions2,
wrapperOffset: wrapperOffset2,
windowDimensions: windowDimensions2
};
Te.__workletHash = 7328947258749;
Te.__initData = __initData20;
const derivedValue2 = useDerivedValue(Te);
const controlsLock = useControlsLock();
c22605_3 = controlsLock;
useEffect(() => {
c22605_3.lock();
}, [controlsLock]);
useEffect(() => setState(true), []);
return state2 ? <AnalyticsLocationProvider value={analyticsLocations}>
<LayerScope>
<VoicePanelSystemUIManager />
<Component opacity={derivedValue2} onPress={dismissPanel2} />
<VoicePanelAccessibilityView style={styles2.accessibilityView} nativeID={`voice-panel-ui-${channelId}`} accessibilityViewIsModal layout={layoutTransition} onAccessibilityEscape={closeVoicePanels}>
<VoicePanelDismissableContent />
<AnimatedWrapper wrapperOffset={wrapperOffset2}>
<LayerScope zIndex={2}>
<VoicePanelHeader wrapperOffset={wrapperOffset2} gestureState={sharedValue5} layout={layoutTransition} />
</LayerScope>
<GestureDetector gesture={memo2}>
<ReanimatedNativeView style={StyleSheet.absoluteFill} layout={layoutTransition} collapsable={false}>
<GestureDetector gesture={memo}>
<AnimatedComponent layout={scrollViewLayoutTransition} ref={animatedRef} onScroll={animatedScrollHandler} onMomentumScrollEnd={NOOP} animatedProps={animatedProps} style={styles2.scrollView} onContentSizeChange={callback8} contentContainerStyle={styles2.scrollViewContent} scrollEventThrottle={8.333333333333334}>
<VoicePanelCardView viewableChunks={sharedValue4} />
<VoicePanelPreJoinContent />
</AnimatedComponent>
</GestureDetector>
</ReanimatedNativeView>
</GestureDetector>
</AnimatedWrapper>
<VoicePanelPIP />
<VoicePanelControls gestureState={sharedValue5} />
</VoicePanelAccessibilityView>
</LayerScope>
</AnalyticsLocationProvider> : null;
});
export default r179;
export { r89 as REDUCED_MOTION_OPACITY_PHYSICS };