// Metro module 15878 (f15879). import _slicedToArray from "../../../_bundle/_slicedToArray"; import { useState, useEffect, useCallback, useLayoutEffect, useRef, useMemo, useId } from "react"; import { AppState } from "react-native"; import AccessibilityStore from "../../a11y/AccessibilityStore"; import EmbeddedActivitiesStore from "../../activities/EmbeddedActivitiesStore"; import ChannelRTCStore from "../../calls/ChannelRTCStore"; import AppFreezeStore from "../../panels/morphable/AppFreezeStore"; import SafeAreaDisabledStore from "../../panels/morphable/native/SafeAreaDisabledStore"; import ChannelCallLifecycleStore from "../../video_calls/native/ChannelCallLifecycleStore"; import ChannelStore from "../../../stores/ChannelStore"; import MediaEngineStore from "../../../stores/MediaEngineStore"; import RTCConnectionStore from "../../../stores/RTCConnectionStore"; import VoicePanelStore from "../VoicePanelStore"; import { VoicePanelModes, getAnalyticsNameForVoicePanelMode } from "../VoicePanelConstants"; import { CONTROLS_HEIGHT, CONTROLS_HEIGHT_PTT, CONTROLS_HIDE_TIMEOUT, VoicePanelControlsModes } from "./controls/VoicePanelControlsConstants"; import { AnalyticEvents, ComponentActions, InputModes } from "../../../Constants"; import { OrientationLockState } from "../../activities/Constants"; import { ActivityPanelModes } from "../../activities/panel/ActivityPanelConstants"; import { isActivityParticipant } from "../../calls/CallConstants"; import { MorphablePanelModes } from "../../panels/morphable/native/MorphablePanelConstants"; import useTransitionToConnectedActivityInVoice from "../../activities/utils/useTransitionToConnectedActivityInVoice"; import * as _ReanimatedRexport from "../../reanimated/ReanimatedRexport"; import { useSharedValue, useDerivedValue, useAnimatedReaction, runOnUI } from "../../reanimated/ReanimatedRexport"; import * as _cheapWorkletShallowEqual from "../../reanimated/native/cheapWorkletShallowEqual"; import Durations from "../../../utils/Durations"; import MobileMuteIndicatorExperiment from "../../calls/MobileMuteIndicatorExperiment"; import { useStateFromStores, BatchedStoreListener, useStateFromStoresObject } from "../../../_bundle/Module589"; import ToastActionCreators from "../../toast/native/ToastActionCreators"; import Module10597 from "../../../_bundle/Module10597"; import * as _index_native from "../../../intl/index.native"; import { intl } from "../../../intl/index.native"; import Module15881 from "../../../_bundle/Module15881"; import { trackActivityThermalStateNoticeShown } from "../../activities/trackActivityThermalStateNoticeShown"; import AudioActionCreators from "../../../actions/AudioActionCreators"; import { updateActivityPanelMode, consumeRequestToReactToSeriousThermalState } from "../../activities/EmbeddedActivitiesActionCreators"; import { FLOATING_CTA_HIDE_TIMEOUT } from "./controls/utils/VoicePanelFloatingCTAUtils"; import { getWindowDimensions } from "../../screen/useWindowDimensions.native"; import { getSafeAreaInsets } from "../../safe_area/useSafeAreaInsets.native"; import { getMaxPanelWidth, getPanelX } from "./utils/PanelSizeUtils"; import VoicePanelCardLayoutManager, { useManagerSubscription } from "./card/VoicePanelCardLayoutManager"; import updateSharedValueIfChanged_native from "../../reanimated/utils/updateSharedValueIfChanged.native"; import Module12 from "../../../_bundle/Module12"; import { v4 } from "../../../_bundle/Module514"; import { ComponentDispatch } from "../../../utils/ComponentDispatchUtils"; import { batchUpdates } from "../../../_bundle/Module705"; import subscribeToSafeAreaInsets_native from "../../safe_area/subscribeToSafeAreaInsets.native"; import subscribeToWindowDimensions_native from "../../screen/subscribeToWindowDimensions.native"; import { isStable } from "../../../utils/ReleaseChannelUtils.native"; import AnalyticsUtils from "../../../utils/AnalyticsUtils"; import { unlockOrientation, restoreDefaultOrientation } from "../../device/native/DeviceOrientation"; import { getEmbeddedActivityParticipantId } from "../../calls/ChannelRTCParticipants"; import applyActivityOrientationLock from "../../activities/native/applyActivityOrientationLock"; import * as _TransitionGroup from "../../../design/components/TransitionGroup/TransitionGroup"; import * as _useIsVoicePanelParticipantFocusable from "./utils/useIsVoicePanelParticipantFocusable"; import useIsVoicePanelParticipantFocusable from "./utils/useIsVoicePanelParticipantFocusable"; import ChannelRTCActionCreators from "../../../actions/ChannelRTCActionCreators"; import { collectVoiceAnalyticsMetadata } from "../../app_analytics/AppAnalyticsUtils"; import * as _ChatInputUtils from "../../../utils/native/ChatInputUtils"; import { runAfterInteractions } from "../../../utils/native/RunAfterInteractionsUtils"; import VoicePanelStreamOutputSinkStack from "./controller/VoicePanelStreamOutputSinkStack"; import useVoicePanelParticipants from "./hooks/useVoicePanelParticipants"; import { getEmbeddedActivityLocationChannelId } from "../../activities/utils/embeddedActivityLocationUtils"; import { useControllerPIPState } from "./pip/useControllerPIPState"; import usePIPAvoidanceSpecs from "./pip/usePIPAvoidanceSpecs"; import usePanelOpenState from "./controller/usePanelOpenState"; import useHandleOAuthNavigation from "../../activities/utils/native/useHandleOAuthNavigation"; import SentryUtils_native from "../../../utils/SentryUtils.native"; import * as _VoicePanelPIPStateContext from "./pip/VoicePanelPIPStateContext"; import { VoicePanelPIPStateContext } from "./pip/VoicePanelPIPStateContext"; import VoicePanelStateContext from "./VoicePanelStateContext"; import GuildThemeGuildIdOverrideContext from "../../guild_themes/native/GuildThemeGuildIdOverrideContext"; const __initData = { code: "function VoicePanelControllerTsx1(){const{focused,mode,connected}=this.__closure;var _focused$get;return[(_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id,mode.get(),connected.get()];}" }; const __initData2 = { code: "function VoicePanelControllerTsx2(props,previous){const{cheapWorkletArrayShallowEqual,runOnJS,handleAnimatedReaction}=this.__closure;if(cheapWorkletArrayShallowEqual(props,previous!==null&&previous!==void 0?previous:undefined))return;const[focusedParticipantId,voicePanelMode,connectedValue]=props;runOnJS(handleAnimatedReaction)({focusedParticipantId:focusedParticipantId,voicePanelMode:voicePanelMode,connectedValue:connectedValue});}" }; let c11368_32 = 5 * Durations.Millis.MINUTE; const __initData3 = { code: "function VoicePanelControllerTsx3(){const{focused,pipState}=this.__closure;var _focused$get;return[(_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id,pipState.id];}" }; const __initData4 = { code: "function VoicePanelControllerTsx4(props,previous){const{cheapWorkletArrayShallowEqual,runOnJS,handleStateUpdates}=this.__closure;if(cheapWorkletArrayShallowEqual(props,previous!==null&&previous!==void 0?previous:undefined))return;const[focusedId,pipParticipantId]=props;runOnJS(handleStateUpdates)({focusedId:focusedId,pipParticipantId:pipParticipantId});}" }; const __initData5 = { code: "function VoicePanelControllerTsx5(value){const{isFocusedVideoZoomed}=this.__closure;isFocusedVideoZoomed.set(value);}" }; const __initData6 = { code: "function VoicePanelControllerTsx6(){const{mode,VoicePanelModes,MorphablePanelModes}=this.__closure;switch(mode.get()){case VoicePanelModes.PANEL:{return MorphablePanelModes.PANEL;}case VoicePanelModes.PIP:{return MorphablePanelModes.PIP;}default:{return MorphablePanelModes.UNDEFINED;}}}" }; const __initData7 = { code: "function VoicePanelControllerTsx7(){const{mode}=this.__closure;return mode.get();}" }; const __initData8 = { code: "function VoicePanelControllerTsx8(value){const{VoicePanelModes,runOnJS,_queueHideControls,_clearHideControlsQueue}=this.__closure;if(value===VoicePanelModes.PANEL){runOnJS(_queueHideControls)();}else{runOnJS(_clearHideControlsQueue)();}}" }; const __initData9 = { code: "function VoicePanelControllerTsx9(){const{connected}=this.__closure;return connected.get();}" }; const __initData10 = { code: "function VoicePanelControllerTsx10(connected){const{updateSharedValueIfChanged,controlsSpecs,pushToTalk,CONTROLS_HEIGHT_PTT,CONTROLS_HEIGHT}=this.__closure;updateSharedValueIfChanged(controlsSpecs,{height:pushToTalk&&connected?CONTROLS_HEIGHT_PTT:CONTROLS_HEIGHT,pushToTalk:pushToTalk});}" }; const __initData11 = { code: "function VoicePanelControllerTsx11({windowState:windowState,safeAreaState:safeAreaState,contentState:contentState}){const{isConnected,cheapWorkletShallowEqual,contentDimensions,windowDimensions,safeArea,runOnJS,executeLayoutManagerEffect}=this.__closure;if(isConnected&&!cheapWorkletShallowEqual(contentDimensions.get(),contentState)){contentDimensions.set(contentState);}if(!cheapWorkletShallowEqual(windowDimensions.get(),windowState)){windowDimensions.set(windowState);}if(!cheapWorkletShallowEqual(safeArea.get(),safeAreaState)){safeArea.set(safeAreaState);}runOnJS(executeLayoutManagerEffect)();}" }; const __initData12 = { code: "function VoicePanelControllerTsx12(){const{connected,mode,sharedTransitionState}=this.__closure;return[connected.get(),mode.get(),sharedTransitionState.get()];}" }; const __initData13 = { code: "function VoicePanelControllerTsx13(props,previous){const{cheapWorkletArrayShallowEqual,TransitionStates,VoicePanelModes,runOnJS,setMode}=this.__closure;if(cheapWorkletArrayShallowEqual(props,previous!==null&&previous!==void 0?previous:undefined))return;const[isConnected,currentMode,currentTransitionState]=props;if(currentTransitionState===TransitionStates.YEETED){if(currentMode!==VoicePanelModes.DISMISSED){runOnJS(setMode)(VoicePanelModes.DISMISSED);}}else if(currentMode===VoicePanelModes.DISMISSED){var _previous$;let previousMode=(_previous$=previous===null||previous===void 0?void 0:previous[1])!==null&&_previous$!==void 0?_previous$:VoicePanelModes.PANEL;switch(previousMode){case VoicePanelModes.PANEL:case VoicePanelModes.PIP:if(!isConnected){previousMode=VoicePanelModes.PANEL;}break;default:previousMode=VoicePanelModes.PANEL;}runOnJS(setMode)(previousMode);}else if(!isConnected&&(previous===null||previous===void 0?void 0:previous[0])===true&¤tMode===VoicePanelModes.PIP){runOnJS(setMode)(VoicePanelModes.PANEL);}}" }; const __initData14 = { code: "function VoicePanelControllerTsx14(){const{mode,controlsSpecs}=this.__closure;return[mode.get(),controlsSpecs.get().mode];}" }; const __initData15 = { code: "function VoicePanelControllerTsx15(props,previous){const{cheapWorkletArrayShallowEqual,VoicePanelControlsModes,VoicePanelModes,runOnJS,dismissKeyboard}=this.__closure;if(cheapWorkletArrayShallowEqual(props,previous!==null&&previous!==void 0?previous:undefined))return;const[currentMode,currentControlsMode]=props;if(currentControlsMode!==VoicePanelControlsModes.DRAWER||currentMode!==VoicePanelModes.PANEL||(previous===null||previous===void 0?void 0:previous[0])!==VoicePanelModes.PANEL){runOnJS(dismissKeyboard)();}}" }; export default function VoicePanelController(props) { let state, state2, type, sharedValue, sharedValue2, sharedValue3, sharedValue4, isCall, state3, sharedValue5, sharedValue6, sharedValue7, sharedValue8, sharedValue9, sharedValue10, sharedValue11, callback, sharedValue12, sharedValue13, derivedValue, sharedValue14, callback2, sharedValue15, callback3, callback4, setControlsMode2, state4, setState, callback5, callback6, stateFromStores, pipAvoidanceSpecs, sharedValue16, callback7, ref, ref2; let items, isConnected, state5; let channelId2, items2, stateFromStores2, sharedValue17, windowDimensions, safeAreaInsets, sharedValue18, sharedValue19, state6; const { channelId, guildId, children, transitionState: transitionState3, transitionCleanUp: transitionCleanUp2 } = props; state = void 0; state2 = void 0; type = void 0; sharedValue = void 0; sharedValue2 = void 0; sharedValue3 = void 0; sharedValue4 = void 0; isCall = void 0; state3 = void 0; sharedValue5 = void 0; sharedValue6 = void 0; sharedValue7 = void 0; sharedValue8 = void 0; sharedValue9 = void 0; sharedValue10 = void 0; sharedValue11 = void 0; callback = void 0; sharedValue12 = void 0; sharedValue13 = void 0; derivedValue = void 0; sharedValue14 = void 0; callback2 = void 0; sharedValue15 = void 0; callback3 = void 0; callback4 = void 0; setControlsMode2 = void 0; state4 = void 0; setState = void 0; callback5 = void 0; callback6 = void 0; stateFromStores = void 0; pipAvoidanceSpecs = void 0; sharedValue16 = void 0; callback7 = void 0; ref = void 0; ref2 = void 0; const stateFromStores9 = useStateFromStores([MediaEngineStore], () => MediaEngineStore.getMode() === InputModes.PUSH_TO_TALK); state = _slicedToArray(useState(() => new VoicePanelStreamOutputSinkStack(MediaEngineStore.getMediaEngine())), 1)[0]; useEffect(() => () => state.cleanUp(), [state]); const voicePanelParticipants = useVoicePanelParticipants(channelId, guildId); const { items: items3, isConnected: isConnected8 } = voicePanelParticipants; items = items3; isConnected = isConnected8; state5 = void 0; state5 = _slicedToArray(useState(() => new Set()), 1)[0]; useEffect(() => { if (isConnected) { let c30926_0 = runAfterInteractions(() => { state5.clear(); for (const item of items) { state5.add(item.id); } }, 100); return () => { if (c30926_0 != null) { c30926_0.cancel(); } }; } state5.clear(); }, [isConnected, items, state5]); state2 = state5; channelId2 = channelId; items2 = items; stateFromStores2 = stateFromStores9; sharedValue17 = void 0; windowDimensions = void 0; safeAreaInsets = void 0; sharedValue18 = void 0; sharedValue19 = void 0; state6 = void 0; const channel = ChannelStore.getChannel(channelId); let r32 = channel == null ? void 0 : channel.isDM(); if (r32 == null) { r32 = false; } const type2 = channel?.type; let sharedValue20, isConnected2, sharedValue21, stateFromStores3, sharedValue22, ref3, callback8, callback9, cancelControlsDebounce2, setControlsMode3, ref4; const sharedValue41 = useSharedValue(isConnected); sharedValue17 = useSharedValue(VoicePanelModes.PANEL); windowDimensions = getWindowDimensions(); const sharedValue43 = useSharedValue({ width: windowDimensions.width, height: windowDimensions.height, landscape: windowDimensions.width > windowDimensions.height }); safeAreaInsets = getSafeAreaInsets(); const sharedValue44 = useSharedValue({ ...safeAreaInsets }); const maxPanelWidth = getMaxPanelWidth({ windowWidth: windowDimensions.width, connected: isConnected, safeAreaLeft: safeAreaInsets.left, safeAreaRight: safeAreaInsets.right }); const sharedValue48 = useSharedValue({ drawerHeight: windowDimensions.height, drawerWidth: maxPanelWidth, drawerX: getPanelX(windowDimensions.width, maxPanelWidth), drawerY: windowDimensions.height, pipX: -1, pipY: -1, animated: true, mode: VoicePanelModes.PANEL }); const sharedValue49 = useSharedValue(0); const sharedValue45 = useSharedValue(false); const sharedValue46 = useSharedValue(null); const sharedValue42 = useSharedValue(0); const sharedValue50 = useSharedValue(false); sharedValue18 = useSharedValue(false); const r156 = function h(a0) { sharedValue18.set(a0); }; r156.__closure = { isFocusedVideoZoomed: sharedValue18 }; r156.__workletHash = 13885070318174; r156.__initData = __initData5; const callback15 = useCallback(r156, [sharedValue18]); sharedValue19 = useSharedValue(AccessibilityStore.useReducedMotion); useEffect(() => { const onChange2 = function onChange() { sharedValue19.set(AccessibilityStore.useReducedMotion); }; AccessibilityStore.addReactChangeListener(onChange2); return () => { AccessibilityStore.removeReactChangeListener(onChange2); }; }, [sharedValue19]); const r174 = useSharedValue({ gestureActive: false, x: 0, y: 0 }); const H = function H() { const r2 = sharedValue17.get(); if (VoicePanelModes.PANEL === r2) { return MorphablePanelModes.PANEL; } if (VoicePanelModes.PIP === r2) { return MorphablePanelModes.PIP; } return MorphablePanelModes.UNDEFINED; }; H.__closure = { mode: sharedValue17, VoicePanelModes, MorphablePanelModes }; H.__workletHash = 931249605381; H.__initData = __initData6; const derivedValue2 = useDerivedValue(H); state6 = _slicedToArray(useState(() => { const voicePanelCardLayoutManager = new VoicePanelCardLayoutManager(channelId2); voicePanelCardLayoutManager.updateState(items2, { windowWidth: windowDimensions.width, windowHeight: windowDimensions.height, safeAreaLeft: safeAreaInsets.left, safeAreaRight: safeAreaInsets.right, safeAreaTop: safeAreaInsets.top, safeAreaBottom: safeAreaInsets.bottom, controlBarSize: stateFromStores2 ? CONTROLS_HEIGHT_PTT : CONTROLS_HEIGHT }); return voicePanelCardLayoutManager; }), 1)[0]; useLayoutEffect(() => () => state6.cleanUp(), [state6]); const sharedValue47 = useSharedValue(state6.getContentDimensions()); type = type2; sharedValue = sharedValue41; sharedValue2 = sharedValue47; sharedValue3 = sharedValue45; sharedValue4 = sharedValue46; isCall = r32; state3 = state6; sharedValue5 = sharedValue17; sharedValue6 = sharedValue42; sharedValue7 = sharedValue44; sharedValue8 = sharedValue49; sharedValue9 = sharedValue43; sharedValue10 = sharedValue48; sharedValue11 = sharedValue18; callback = callback15; sharedValue12 = sharedValue19; sharedValue13 = r174; derivedValue = derivedValue2; sharedValue14 = sharedValue50; sharedValue20 = sharedValue17; isConnected2 = isConnected; sharedValue21 = sharedValue; stateFromStores3 = stateFromStores2; sharedValue22 = void 0; ref3 = void 0; callback8 = void 0; callback9 = void 0; cancelControlsDebounce2 = void 0; setControlsMode3 = void 0; ref4 = void 0; const height2 = stateFromStores2 && isConnected ? CONTROLS_HEIGHT_PTT : CONTROLS_HEIGHT; let channelId3, isConnected3, sharedValue23, sharedValue24, transitionState, sharedValue25, setControlsMode4, state7, setState2; let guildId2, channelId4, sharedValue26, stateFromStores4, callback10, ref5, targetDimensions, c22542_7; sharedValue22 = useSharedValue({ mode: VoicePanelControlsModes.FLOATING_DEFAULT, locked: false, height: height2, pushToTalk: stateFromStores2 }); ref3 = useRef(-1); callback8 = useCallback(() => { if (ref3.current !== -1) { clearTimeout(ref3.current); ref3.current = -1; } }, []); callback9 = useCallback(() => { callback8(); if (ref3.current === -1) { ref3.current = setTimeout(() => { callback8(); if (sharedValue20.get() === VoicePanelModes.PANEL && !(sharedValue22.get().mode !== VoicePanelControlsModes.FLOATING_DEFAULT || sharedValue22.get().locked)) { updateSharedValueIfChanged_native(sharedValue22, { mode: VoicePanelControlsModes.HIDDEN }); } }, CONTROLS_HIDE_TIMEOUT); } }, [sharedValue22, callback8, sharedValue17]); const memo = useMemo(() => { let c30928_0 = Module12.debounce(function _setControlsMode(a0, a1) { updateSharedValueIfChanged_native(sharedValue22, { mode: a0, returnMode: a1 }); callback9(); }, 200); return { cancelControlsDebounce: () => c30928_0.cancel(), setControlsMode: ({ mode, debounce = false, returnMode = VoicePanelControlsModes.FLOATING_DEFAULT }) => { if (debounce) { c30928_0(mode, returnMode); } else { c30928_0.cancel(); updateSharedValueIfChanged_native(sharedValue22, { mode, returnMode }); callback9(); } } }; }, [sharedValue22, callback9]); cancelControlsDebounce2 = memo.cancelControlsDebounce; setControlsMode3 = memo.setControlsMode; ref4 = useRef(new Set()); const callback16 = useCallback((a0) => { const r1 = a0 == null ? v4() : a0; let c30929_0 = r1; return { lock: (a0) => { const current = ref4.current; if (!current.has(c30929_0)) { callback8(); ref4.current.add(c30929_0); const r18 = { locked: ref4.current.size > 0 }; if (a0 != null) { r18.mode = a0; } updateSharedValueIfChanged_native(sharedValue22, r18); } }, unlock: (a0) => { const current = ref4.current; if (current.has(c30929_0)) { ref4.current.delete(c30929_0); const r15 = { locked: ref4.current.size > 0 }; if (a0 != null) { r15.mode = a0; } updateSharedValueIfChanged_native(sharedValue22, r15); callback9(); } } }; }, [sharedValue22, callback9, callback8]); const callback17 = useCallback(function(r2 = { debounce: false }) { setControlsMode3({ mode: VoicePanelControlsModes.HIDDEN, debounce: r2.debounce }); }, [setControlsMode3]); const callback18 = useCallback(function(r2 = {}) { let debounce = r2.debounce; if (debounce === void 0) { debounce = false; } let returnMode = sharedValue22.get().returnMode; if (returnMode == null) { returnMode = VoicePanelControlsModes.FLOATING_DEFAULT; } return setControlsMode3({ mode: returnMode, debounce }); }, [setControlsMode3, sharedValue22]); const u = () => sharedValue20.get(); u.__closure = { mode: sharedValue17 }; u.__workletHash = 12140218650562; u.__initData = __initData7; const l = function l(a0) { if (a0 === VoicePanelModes.PANEL) { _ReanimatedRexport.runOnJS(callback9)(); } else { _ReanimatedRexport.runOnJS(callback8)(); } }; l.__closure = { VoicePanelModes, runOnJS: _ReanimatedRexport.runOnJS, _queueHideControls: callback9, _clearHideControlsQueue: callback8 }; l.__workletHash = 7742206515980; l.__initData = __initData8; useAnimatedReaction(u, l); useLayoutEffect(() => { updateSharedValueIfChanged_native(sharedValue22, { height: stateFromStores3 && isConnected2 ? CONTROLS_HEIGHT_PTT : CONTROLS_HEIGHT, pushToTalk: stateFromStores3 }); }, [stateFromStores2, sharedValue22, isConnected]); const r260 = () => sharedValue21.get(); r260.__closure = { connected: sharedValue }; r260.__workletHash = 16653595323628; r260.__initData = __initData9; const r264 = function h(a0) { updateSharedValueIfChanged_native(sharedValue22, { height: stateFromStores3 && a0 ? CONTROLS_HEIGHT_PTT : CONTROLS_HEIGHT, pushToTalk: stateFromStores3 }); }; let controlBarSize = CONTROLS_HEIGHT; r264.__closure = { updateSharedValueIfChanged: updateSharedValueIfChanged_native, controlsSpecs: sharedValue22, pushToTalk: stateFromStores2, CONTROLS_HEIGHT_PTT, CONTROLS_HEIGHT }; r264.__workletHash = 2154816141018; r264.__initData = __initData10; useAnimatedReaction(r260, r264); useLayoutEffect(() => () => { cancelControlsDebounce2(); callback8(); }, [cancelControlsDebounce2, callback8]); useEffect(() => { const closeTiV2 = function closeTiV() { setControlsMode3({ mode: VoicePanelControlsModes.FLOATING_DEFAULT }); }; ComponentDispatch.subscribe(ComponentActions.VOICE_PANEL_TIV_CLOSE, closeTiV2); return () => { ComponentDispatch.unsubscribe(ComponentActions.VOICE_PANEL_TIV_CLOSE, closeTiV2); }; }, [setControlsMode3]); callback2 = callback16; sharedValue15 = sharedValue22; callback3 = callback18; callback4 = callback17; setControlsMode2 = setControlsMode3; channelId3 = channelId; isConnected3 = isConnected; sharedValue23 = sharedValue17; sharedValue24 = sharedValue; transitionState = transitionState3; sharedValue25 = sharedValue22; setControlsMode4 = setControlsMode3; state7 = void 0; setState2 = void 0; [state7, setState2] = useState(VoicePanelModes.PANEL); useLayoutEffect(() => { sharedValue23.set(state7); if (transitionState !== _TransitionGroup.TransitionStates.YEETED) { sharedValue24.set(isConnected3); } }); const callback19 = useCallback(() => { let r0; if (sharedValue25.get().mode === VoicePanelControlsModes.DRAWER) { setControlsMode4({ mode: VoicePanelControlsModes.FLOATING_DEFAULT }); r0 = true; } else if (sharedValue24.get()) { let r1 = sharedValue23.get() === VoicePanelModes.PANEL; if (r1) { setState2(VoicePanelModes.PIP); r1 = true; } r0 = r1; } else { VoicePanelStore.getState().closeChannel(channelId3); r0 = true; } return r0; }, [channelId, sharedValue, sharedValue17, sharedValue22, setControlsMode3]); state4 = state7; setState = setState2; callback5 = callback19; guildId2 = guildId; channelId4 = channelId; sharedValue26 = sharedValue4; stateFromStores4 = void 0; callback10 = void 0; ref5 = void 0; targetDimensions = void 0; c22542_7 = void 0; stateFromStores4 = useStateFromStores([ChannelRTCStore], () => ChannelRTCStore.getSelectedParticipantId(channelId4)); callback10 = useCallback((a0) => { if (a0 == null || _useIsVoicePanelParticipantFocusable.isVoicePanelParticipantFocusable(guildId2, channelId4, a0)) { ChannelRTCActionCreators.selectParticipant(channelId4, a0); } }, [guildId, channelId]); ref5 = useRef(void 0); const getTargetDimensions = state6.getTargetDimensions; const r310 = stateFromStores4 == null ? void 0 : stateFromStores4; let sharedValue27, sharedValue28, sharedValue29, isConnected4, state8, state9, setState3, state10, setState4, managerSubscription, ref6, callback11, id, contentState; let isConnected5, ref7, setState5, setState6; targetDimensions = getTargetDimensions.call(state6, r310); useLayoutEffect(() => { const current2 = stateFromStores4 != null ? { id: stateFromStores4, ...targetDimensions } : null; let r6 = current2; if (r6 == null) { r6 = void 0; } let current = ref5.current; if (current == null) { current = void 0; } if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(r6, current)) { ref5.current = current2; sharedValue26.set(current2); } }, [sharedValue4, stateFromStores4, targetDimensions]); const isVoicePanelParticipantFocusable = useIsVoicePanelParticipantFocusable(guildId, channelId, stateFromStores4); c22542_7 = isVoicePanelParticipantFocusable; useEffect(() => { if (stateFromStores4 != null && !c22542_7) { callback10(null); } }, [stateFromStores4, isVoicePanelParticipantFocusable, callback10]); useEffect(() => () => callback10(null), [callback10]); callback6 = callback10; stateFromStores = useStateFromStores([EmbeddedActivitiesStore], () => { const connectedActivityLocation = EmbeddedActivitiesStore.getConnectedActivityLocation(); const embeddedActivityLocationChannelId = getEmbeddedActivityLocationChannelId(connectedActivityLocation); const activityPanelMode = EmbeddedActivitiesStore.getActivityPanelMode(); return connectedActivityLocation != null && embeddedActivityLocationChannelId !== channelId && activityPanelMode === ActivityPanelModes.PANEL; }); sharedValue27 = sharedValue9; sharedValue28 = sharedValue7; sharedValue29 = sharedValue2; isConnected4 = isConnected; state8 = state6; state9 = void 0; setState3 = void 0; state10 = void 0; setState4 = void 0; managerSubscription = void 0; ref6 = void 0; callback11 = void 0; id = void 0; contentState = void 0; [state9, setState3] = useState(() => { const windowDimensions2 = getWindowDimensions(); const { width: width2, height: height2 } = windowDimensions2; return { width: width2, height: height2, landscape: width2 > height2 }; }); [state10, setState4] = useState(getSafeAreaInsets()); managerSubscription = useManagerSubscription(state6); ref6 = useRef({ timeout: -1, layoutKey: managerSubscription, connected: isConnected, windowState: state9, safeAreaState: state10, contentDimensions: { width: 0, height: 0 } }); isConnected5 = isConnected; ref7 = ref6; setState5 = setState3; setState6 = setState4; useLayoutEffect(() => { if (ref7.current.connected !== isConnected5) { ref7.current.connected = isConnected5; setState5((prevState5) => { let r2 = prevState5; const windowDimensions2 = getWindowDimensions(); const { width: width2, height: height2 } = windowDimensions2; ref7.current.windowState = { width: width2, height: height2, landscape: width2 > height2 }; if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(prevState5, ref7.current.windowState)) { r2 = ref7.current.windowState; } return r2; }); setState6((prevState6) => { let r1 = prevState6; ref7.current.safeAreaState = getSafeAreaInsets(); if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(prevState6, ref7.current.safeAreaState)) { r1 = ref7.current.safeAreaState; } return r1; }); } }, [ref6, isConnected, setState3, setState4]); callback11 = useCallback(() => { clearTimeout(ref6.current.timeout); ref6.current.timeout = setTimeout(() => { clearTimeout(ref6.current.timeout); batchUpdates(() => { setState3((prevState3) => _cheapWorkletShallowEqual.cheapWorkletShallowEqual(ref6.current.windowState, prevState3) ? prevState3 : ref6.current.windowState); setState4((prevState4) => _cheapWorkletShallowEqual.cheapWorkletShallowEqual(ref6.current.safeAreaState, prevState4) ? prevState4 : ref6.current.safeAreaState); }); }, 60); }, []); useLayoutEffect(() => { let c28170_1; let c28170_0 = subscribeToSafeAreaInsets_native(function updateSafeAreas(a0) { if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(ref6.current.safeAreaState, a0)) { ref6.current.safeAreaState = { ...a0 }; callback11(); } }); const safeAreaInsets2 = getSafeAreaInsets(); if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(ref6.current.safeAreaState, safeAreaInsets2)) { ref6.current.safeAreaState = { ...safeAreaInsets2 }; callback11(); } c28170_1 = subscribeToWindowDimensions_native(function updateWindowDimensions(r3 = getWindowDimensions()) { const { width: width2, height: height2 } = r3; const windowState = { width: width2, height: height2, landscape: width2 > height2 }; if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(ref6.current.windowState, windowState)) { ref6.current.windowState = windowState; callback11(); } }); const windowDimensions2 = getWindowDimensions(); const { width: width2, height: height2 } = windowDimensions2; const windowState = { width: width2, height: height2, landscape: width2 > height2 }; if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(ref6.current.windowState, windowState)) { ref6.current.windowState = windowState; callback11(); } return () => { c28170_0(); c28170_1(); }; }, [callback11]); id = useId(); useLayoutEffect(() => { if (isConnected4) { SafeAreaDisabledStore.getState().requestSafeAreaDisableLock({ key: id, lockEnabled: true }); return () => { SafeAreaDisabledStore.getState().requestSafeAreaDisableLock({ key: id, lockEnabled: false }); }; } }, [isConnected, id]); const updateState = state6.updateState; if (stateFromStores2) { controlBarSize = CONTROLS_HEIGHT_PTT; } let sharedValue30, sharedValue31; let channelId5, transitionState2, transitionCleanUp, sharedValue32, sharedValue33, setState7, sharedValue34; contentState = updateState.call(state6, items, { windowWidth: state9.width, windowHeight: state9.height, safeAreaLeft: state10.left, safeAreaRight: state10.right, safeAreaTop: state10.top, safeAreaBottom: state10.bottom, controlBarSize }); useLayoutEffect(() => { const executeLayoutManagerEffect2 = function executeLayoutManagerEffect() { return state8.handleLayoutEffect(); }; ref6.current.layoutKey = managerSubscription; const t = function t({ windowState, safeAreaState, contentState: contentState2 }) { let r2 = isConnected4; if (isConnected4) { r2 = !_cheapWorkletShallowEqual.cheapWorkletShallowEqual(sharedValue29.get(), contentState2); } if (r2) { sharedValue29.set(contentState2); } if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(sharedValue27.get(), windowState)) { sharedValue27.set(windowState); } if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(sharedValue28.get(), safeAreaState)) { sharedValue28.set(safeAreaState); } _ReanimatedRexport.runOnJS(executeLayoutManagerEffect2)(); }; t.__closure = { isConnected: isConnected4, cheapWorkletShallowEqual: _cheapWorkletShallowEqual.cheapWorkletShallowEqual, contentDimensions: sharedValue29, windowDimensions: sharedValue27, safeArea: sharedValue28, runOnJS: _ReanimatedRexport.runOnJS, executeLayoutManagerEffect: executeLayoutManagerEffect2 }; t.__workletHash = 13791383688018; t.__initData = __initData11; runOnUI(t)({ windowState: state9, safeAreaState: state10, contentState }); }, [sharedValue2, contentState, managerSubscription, state6, sharedValue7, state10, sharedValue9, state9, isConnected]); useEffect(() => { let c28172_0, c28172_1, c28172_2, c28172_3; const checkDimensions2 = function checkDimensions() { if (!c28172_3) { const windowDimensions2 = getWindowDimensions(); const { width, height } = windowDimensions2; const r18 = state8.checkDimensionsMismatch(width, height); let c30925_2 = r18; if (r18 != null) { c28172_1 = setTimeout(() => { const windowDimensions2 = getWindowDimensions(); const { width: width2, height: height2 } = windowDimensions2; if (width === width2 && height === height2 && state8.checkDimensionsMismatch(width2, height2) != null) { c28172_3 = true; const VOICE_PANEL_LAYOUT_DESYNC = AnalyticEvents.VOICE_PANEL_LAYOUT_DESYNC; AnalyticsUtils.track(VOICE_PANEL_LAYOUT_DESYNC, { layout_width: c30925_2.staleWidth, layout_height: c30925_2.staleHeight, window_width: width, window_height: height, was_dirty: c30925_2.wasDirty }); c28172_1 = null; } }, 250); } } }; if (isStable) { return void 0; } c28172_0 = setInterval(checkDimensions2, 1000); c28172_1 = null; c28172_2 = AppState.addEventListener("change", (a0) => { if (a0 === "active" && c28172_0 == null) { c28172_0 = setInterval(checkDimensions2, 1000); } else if (a0 !== "active") { clearInterval(c28172_0); clearTimeout(c28172_1); c28172_0 = null; } }); c28172_3 = false; return () => { clearInterval(c28172_0); clearTimeout(c28172_1); c28172_2.remove(); }; }, [state6]); useLayoutEffect(() => () => clearTimeout(ref6.current.timeout), []); useLayoutEffect(() => { if (state4 === VoicePanelModes.PANEL && stateFromStores) { updateActivityPanelMode(ActivityPanelModes.PIP); } }, [state7, stateFromStores]); sharedValue30 = sharedValue17; sharedValue31 = sharedValue22; const c = () => [sharedValue30.get(), sharedValue31.get().mode]; c.__closure = { mode: sharedValue17, controlsSpecs: sharedValue22 }; c.__workletHash = 10791754460802; c.__initData = __initData14; const r406 = function(a0, a1) { if (!_cheapWorkletShallowEqual.cheapWorkletArrayShallowEqual(a0, a1 == null ? void 0 : a1)) { const r16 = _slicedToArray(a0, 2); const r17 = r16[0]; if (!(r16[1] === VoicePanelControlsModes.DRAWER && r17 === VoicePanelModes.PANEL && (a1 == null ? void 0 : a1[0]) === VoicePanelModes.PANEL)) { _ReanimatedRexport.runOnJS(_ChatInputUtils.dismissKeyboard)(); } } }; r406.__closure = { cheapWorkletArrayShallowEqual: _cheapWorkletShallowEqual.cheapWorkletArrayShallowEqual, VoicePanelControlsModes, VoicePanelModes, runOnJS: _ReanimatedRexport.runOnJS, dismissKeyboard: _ChatInputUtils.dismissKeyboard }; r406.__workletHash = 16494740341507; r406.__initData = __initData15; useAnimatedReaction(c, r406); channelId5 = channelId; transitionState2 = transitionState; transitionCleanUp = transitionCleanUp2; sharedValue32 = sharedValue; sharedValue33 = sharedValue17; setState7 = setState2; sharedValue34 = void 0; sharedValue34 = useSharedValue(transitionState); useLayoutEffect(() => { sharedValue34.set(transitionState2); if (transitionState2 === _TransitionGroup.TransitionStates.YEETED) { AppFreezeStore.getState().requestFreezeLock({ lockEnabled: false, key: `voice-panel-freeze-${channelId5}` }); let c30931_0 = setTimeout(transitionCleanUp, 500); return () => clearTimeout(c30931_0); } }, [transitionState, sharedValue34, transitionCleanUp, channelId]); useLayoutEffect(() => () => { AppFreezeStore.getState().requestFreezeLock({ lockEnabled: false, key: `voice-panel-freeze-${channelId5}` }); }, [channelId]); const r436 = () => [sharedValue32.get(), sharedValue33.get(), sharedValue34.get()]; r436.__closure = { connected: sharedValue, mode: sharedValue17, sharedTransitionState: sharedValue34 }; r436.__workletHash = 7656858903152; r436.__initData = __initData12; const r440 = function f(a0, a1) { if (!_cheapWorkletShallowEqual.cheapWorkletArrayShallowEqual(a0, a1 == null ? void 0 : a1)) { const r19 = _slicedToArray(a0, 3); const r20 = r19[0]; const r21 = r19[1]; if (r19[2] === _TransitionGroup.TransitionStates.YEETED) { if (r21 !== VoicePanelModes.DISMISSED) { _ReanimatedRexport.runOnJS(setState7)(VoicePanelModes.DISMISSED); } } else if (r21 === VoicePanelModes.DISMISSED) { let r38 = a1 == null ? void 0 : a1[1]; if (r38 == null) { r38 = VoicePanelModes.PANEL; } const r41 = VoicePanelModes.PANEL !== r38 && VoicePanelModes.PIP !== r38 ? VoicePanelModes.PANEL : r20 ? r38 : VoicePanelModes.PANEL; _ReanimatedRexport.runOnJS(setState7)(r41); } else if (!(r20 || (a1 == null ? void 0 : a1[0]) !== true || r21 !== VoicePanelModes.PIP)) { _ReanimatedRexport.runOnJS(setState7)(VoicePanelModes.PANEL); } } }; r440.__closure = { cheapWorkletArrayShallowEqual: _cheapWorkletShallowEqual.cheapWorkletArrayShallowEqual, TransitionStates: _TransitionGroup.TransitionStates, VoicePanelModes, runOnJS: _ReanimatedRexport.runOnJS, setMode: setState2 }; r440.__workletHash = 5740547237317; r440.__initData = __initData13; useAnimatedReaction(r436, r440); const focusedId = stateFromStores4 == null ? void 0 : stateFromStores4; let channelId7, sharedValue35, controllerPIPState, stateFromStores5, callback12; let channelId8, sharedValue36, sharedValue37, sharedValue38, callback13; let setControlsMode5; let callback14, enableMuteWarning, ref9, stateFromStores6; let isConnected6, state12, stateFromStores7, stateFromStores8, applicationId, activityOrientationLockState, instanceId; let channelId9, isConnected7, state13; let sharedValue39, ref10, sharedValue40; const controllerPIPState2 = useControllerPIPState({ channelId, connected: isConnected, focusedId, layoutManager: state6, mode: state7 }); pipAvoidanceSpecs = usePIPAvoidanceSpecs({ mode: sharedValue17, controlsSpecs: sharedValue22, safeArea: sharedValue7, windowDimensions: sharedValue9 }); const channelId6 = channelId; const state11 = state7; const ref8 = useRef(null); useLayoutEffect(() => { const rTCConnection = RTCConnectionStore.getRTCConnection(); const r9 = rTCConnection != null && RTCConnectionStore.getChannelId() === channelId6; L10: { if (r9) { if (ref8.current !== VoicePanelModes.PIP && state11 === VoicePanelModes.PIP) { rTCConnection.setPipOpen(true); break L10; } if (ref8.current === VoicePanelModes.PIP && state11 !== VoicePanelModes.PIP) { rTCConnection.setPipOpen(false); } } } }, [state7, stateFromStores4, channelId]); useLayoutEffect(() => { ref8.current = state11; }); channelId7 = channelId; sharedValue35 = sharedValue4; controllerPIPState = controllerPIPState2; stateFromStores5 = stateFromStores4; callback12 = void 0; callback12 = useCallback(({ focusedId, pipParticipantId }) => { const shouldReactToSeriousThermalStateWhenActivityFocused = ChannelCallLifecycleStore.shouldReactToSeriousThermalStateWhenActivityFocused(); const r17 = ChannelCallLifecycleStore.consumedRequestToRespondToSeriousThermalState(); const r18 = focusedId != null && isActivityParticipant(ChannelRTCStore.getParticipant(channelId7, focusedId)); const r21 = pipParticipantId != null ? ChannelRTCStore.getParticipant(channelId7, pipParticipantId) : void 0; const r27 = r21?.streamId != null && (r21 == null ? void 0 : r21.voiceState?.selfVideo) === true; if (r18 && shouldReactToSeriousThermalStateWhenActivityFocused && !r17) { const isVideoEnabled = MediaEngineStore.isVideoEnabled(); if (isVideoEnabled || r27) { ToastActionCreators.open({ key: "EMBEDDED_ACTIVITIES_VIDEO_DISABLED_FOR_THERMAL_STATE", icon: Module15881, content: intl.string(_index_native.t.O2IlPT), disableAnimations: true, toastDurationMs: 3000 }); trackActivityThermalStateNoticeShown(); } if (isVideoEnabled) { AudioActionCreators.setVideoEnabled(false); } consumeRequestToReactToSeriousThermalState(); } }, [channelId]); useEffect(() => { let c30932_0; const batchedStoreListener = new BatchedStoreListener([ChannelCallLifecycleStore, ChannelRTCStore], () => { let focusedId = stateFromStores5; if (stateFromStores5 == null) { focusedId = void 0; } callback12({ focusedId, pipParticipantId: controllerPIPState.id }); }); c30932_0 = batchedStoreListener; batchedStoreListener.attach(`thermal-state-reactions-${channelId7}`); return () => c30932_0.detach(); }, [stateFromStores4, controllerPIPState, callback12, channelId]); const r486 = () => [sharedValue35.get()?.id, controllerPIPState.id]; r486.__closure = { focused: sharedValue4, pipState: controllerPIPState }; r486.__workletHash = 94735519164; r486.__initData = __initData3; const r490 = function h(a0, a1) { if (!_cheapWorkletShallowEqual.cheapWorkletArrayShallowEqual(a0, a1 == null ? void 0 : a1)) { const [focusedId, pipParticipantId] = a0; _ReanimatedRexport.runOnJS(callback12)({ focusedId, pipParticipantId }); } }; r490.__closure = { cheapWorkletArrayShallowEqual: _cheapWorkletShallowEqual.cheapWorkletArrayShallowEqual, runOnJS: _ReanimatedRexport.runOnJS, handleStateUpdates: callback12 }; r490.__workletHash = 15246095289306; r490.__initData = __initData4; useAnimatedReaction(r486, r490); channelId8 = channelId; sharedValue36 = sharedValue4; sharedValue37 = sharedValue17; sharedValue38 = sharedValue; callback13 = void 0; callback13 = useCallback((a0) => { const { focusedParticipantId, voicePanelMode } = a0; const r8 = a0.connectedValue && voicePanelMode === VoicePanelModes.PANEL; const r11 = focusedParticipantId != null && isActivityParticipant(ChannelRTCStore.getParticipant(channelId8, focusedParticipantId)) && r8; VoicePanelStore.getState().setIsActivityFocused(r11); }, [channelId]); const r509 = () => [sharedValue36.get()?.id, sharedValue37.get(), sharedValue38.get()]; r509.__closure = { focused: sharedValue4, mode: sharedValue17, connected: sharedValue }; r509.__workletHash = 16641161683997; r509.__initData = __initData; const r513 = function h(a0, a1) { if (!_cheapWorkletShallowEqual.cheapWorkletArrayShallowEqual(a0, a1 == null ? void 0 : a1)) { const [focusedParticipantId, voicePanelMode, connectedValue] = a0; _ReanimatedRexport.runOnJS(callback13)({ focusedParticipantId, voicePanelMode, connectedValue }); } }; r513.__closure = { cheapWorkletArrayShallowEqual: _cheapWorkletShallowEqual.cheapWorkletArrayShallowEqual, runOnJS: _ReanimatedRexport.runOnJS, handleAnimatedReaction: callback13 }; r513.__workletHash = 15290799116693; r513.__initData = __initData2; useAnimatedReaction(r509, r513); setControlsMode5 = setControlsMode3; useTransitionToConnectedActivityInVoice({ onTransition: useCallback(() => { setControlsMode5({ mode: VoicePanelControlsModes.FLOATING_DEFAULT }); }, [setControlsMode3]) }); callback14 = callback3; enableMuteWarning = void 0; ref9 = void 0; stateFromStores6 = void 0; enableMuteWarning = MobileMuteIndicatorExperiment.useConfig({ location: "VoicePanelController" }).enableMuteWarning; ref9 = useRef(0); stateFromStores6 = useStateFromStores([MediaEngineStore], () => MediaEngineStore.getSpeakingWhileMuted()); useEffect(() => { let r2 = stateFromStores6; if (stateFromStores6) { r2 = enableMuteWarning; } if (r2 && !(performance.now() - ref9.current < c11368_32)) { ref9.current = performance.now(); callback14(); ToastActionCreators.open({ key: "SPEAKING_WHILE_MUTED", icon: Module10597, content: intl.string(_index_native.t["29gnR4"]), toastDurationMs: 3000 }); } }, [stateFromStores6, enableMuteWarning, callback3]); usePanelOpenState(channelId, sharedValue17, setState2, sharedValue); useHandleOAuthNavigation(); isConnected6 = isConnected; state12 = state7; stateFromStores7 = stateFromStores4; stateFromStores8 = stateFromStores; applicationId = void 0; activityOrientationLockState = void 0; instanceId = void 0; const stateFromStoresObject = useStateFromStoresObject([EmbeddedActivitiesStore], () => { let activityOrientationLockState2; const currentEmbeddedActivity = EmbeddedActivitiesStore.getCurrentEmbeddedActivity(); const applicationId2 = currentEmbeddedActivity?.applicationId; const compositeInstanceId = currentEmbeddedActivity?.compositeInstanceId; if (applicationId2 != null) { let r13 = EmbeddedActivitiesStore.getOrientationLockStateForApp(applicationId2); if (r13 == null) { r13 = OrientationLockState.UNLOCKED; } activityOrientationLockState2 = r13; } else { activityOrientationLockState2 = OrientationLockState.UNLOCKED; } return { applicationId: applicationId2, instanceId: compositeInstanceId, activityOrientationLockState: activityOrientationLockState2 }; }); applicationId = stateFromStoresObject.applicationId; activityOrientationLockState = stateFromStoresObject.activityOrientationLockState; instanceId = stateFromStoresObject.instanceId; useLayoutEffect(() => { L8: { if (!stateFromStores8) { if (state12 === VoicePanelModes.PANEL && isConnected6) { if (applicationId != null && stateFromStores7 === getEmbeddedActivityParticipantId({ applicationId, instanceId })) { applyActivityOrientationLock(activityOrientationLockState); break L8; } unlockOrientation({ unlockAfterRotatingToPreviousLock: false }); break L8; } restoreDefaultOrientation(); } } }, [applicationId, isConnected, state7, activityOrientationLockState, stateFromStores4, stateFromStores, instanceId]); useLayoutEffect(() => () => restoreDefaultOrientation(), []); channelId9 = channelId; isConnected7 = isConnected; state13 = state7; useEffect(() => { if (state13 !== VoicePanelModes.DISMISSED && isConnected7) { AnalyticsUtils.track(AnalyticEvents.VIDEO_LAYOUT_TOGGLED, { video_layout: getAnalyticsNameForVoicePanelMode(state13), ...collectVoiceAnalyticsMetadata(channelId9) }); } }, [state7, channelId, isConnected]); sharedValue39 = sharedValue17; ref10 = void 0; sharedValue40 = void 0; ref10 = useRef(-1); sharedValue40 = useSharedValue(null); const callback20 = useCallback((a0) => { if (sharedValue39.get() === VoicePanelModes.PANEL) { sharedValue40.set(a0); if (a0 != null) { clearTimeout(ref10.current); ref10.current = setTimeout(() => { sharedValue40.set(null); }, FLOATING_CTA_HIDE_TIMEOUT); } } }, [sharedValue17, sharedValue40]); useLayoutEffect(() => () => clearTimeout(ref10.current), []); sharedValue16 = sharedValue40; callback7 = callback20; ref = useRef(void 0); ref2 = useRef(0); useEffect(() => { ref2.current = 0; }); if (ref2.current != null) { ref2.current = ref2.current + 1; if (ref2.current > 10) { SentryUtils_native.addBreadcrumb({ category: "voice-panel", message: `VoicePanelController is rendering too many times (>${ref2.current})` }); ref2.current = null; } } return ({ channelId, channelType: type, connected: sharedValue, contentDimensions: sharedValue2, controlsSpecs: sharedValue15, dismissPanel: callback5, dismissToPIPGestureRef: ref, dragScrolling: sharedValue3, focused: sharedValue4, generateStateLocker: callback2, guildId, hideControls: callback4, isCall, isFocusedVideoZoomed: sharedValue11, layoutManager: state3, mode: sharedValue5, morphablePanelMode: derivedValue, mountedCards: state2, pipAvoidanceSpecs, preJoinContentSize: sharedValue6, safeArea: sharedValue7, scrollPosition: sharedValue8, setControlsMode: setControlsMode2, setFocused: callback6, setIsFocusedVideoZoomed: callback, setMode: setState, setShowFloatingCTA: callback7, showControls: callback3, showFloatingCTA: sharedValue16, streamOutputSinkStack: state, usePIPState: _VoicePanelPIPStateContext.usePIPState, useReducedMotion: sharedValue12, windowDimensions: sharedValue9, wrapperDimensions: sharedValue10, wrapperOffset: sharedValue13, panelCardStillInPIP: sharedValue14 })), 1)[0]}> {children} ; };