// Metro module 5378 (f5379).
import { useMemo, memo } from "react";
import { useBottomSheetInternal } from "./Module5250";
import Module1606, { useDerivedValue, useAnimatedStyle } from "./Module1606";
import * as _Module5249 from "./Module5249";
import * as _Module5246 from "./Module5246";
import * as _Module5262 from "./Module5262";
import Module5379 from "./Module5379";
const __initData = {
code: "function pnpm_BottomSheetContentTsx1(){const{animatedContainerHeight,INITIAL_CONTAINER_HEIGHT,animatedKeyboardState,animatedKeyboardHeightInContainer,animatedHandleHeight,animatedSheetHeight,keyboardBehavior,KEYBOARD_BEHAVIOR,KEYBOARD_STATE,isInTemporaryPosition}=this.__closure;if(animatedContainerHeight.get()===INITIAL_CONTAINER_HEIGHT){return 0;}const keyboardState=animatedKeyboardState.get();const keyboardHeightInContainer=animatedKeyboardHeightInContainer.get();const handleHeight=Math.max(0,animatedHandleHeight.get());const containerHeight=animatedContainerHeight.get();let contentHeight=animatedSheetHeight.get()-handleHeight;switch(keyboardBehavior){case KEYBOARD_BEHAVIOR.extend:if(keyboardState===KEYBOARD_STATE.SHOWN){contentHeight=contentHeight-keyboardHeightInContainer;}break;case KEYBOARD_BEHAVIOR.fillParent:if(!isInTemporaryPosition.get()){break;}if(keyboardState===KEYBOARD_STATE.SHOWN){contentHeight=containerHeight-handleHeight-keyboardHeightInContainer;}else{contentHeight=containerHeight-handleHeight;}break;case KEYBOARD_BEHAVIOR.interactive:{if(!isInTemporaryPosition.get()){break;}const contentWithKeyboardHeight=contentHeight+keyboardHeightInContainer;if(keyboardState===KEYBOARD_STATE.SHOWN){if(keyboardHeightInContainer+animatedSheetHeight.get()>containerHeight){contentHeight=containerHeight-keyboardHeightInContainer-handleHeight;}}else if(contentWithKeyboardHeight+handleHeight>containerHeight){contentHeight=containerHeight-handleHeight;}else{contentHeight=contentWithKeyboardHeight;}break;}}return Math.max(contentHeight,0);}"
};
const __initData2 = {
code: "function pnpm_BottomSheetContentTsx2(){const{animatedContainerHeight,INITIAL_CONTAINER_HEIGHT,animatedHighestSnapPoint,animatedPosition,overDragResistanceFactor,animatedKeyboardState,KEYBOARD_STATE,animatedKeyboardHeightInContainer}=this.__closure;const containerHeight=animatedContainerHeight.get();if(containerHeight===INITIAL_CONTAINER_HEIGHT){return 0;}const highestSnapPoint=Math.max(animatedHighestSnapPoint.get(),animatedPosition.get());const overDragSafePaddingBottom=Math.sqrt(highestSnapPoint-containerHeight*-1)*overDragResistanceFactor;let paddingBottom=overDragSafePaddingBottom;if(animatedKeyboardState.get()===KEYBOARD_STATE.SHOWN){paddingBottom=overDragSafePaddingBottom+animatedKeyboardHeightInContainer.get();}return paddingBottom;}"
};
const __initData3 = {
code: "function pnpm_BottomSheetContentTsx3(){const{animatedContainerHeight,INITIAL_CONTAINER_HEIGHT,enableDynamicSizing,animatedContentHeight,detached,animatedPaddingBottom,animate,animationConfigs,overrideReduceMotion,animatedContentHeightMax}=this.__closure;if(animatedContainerHeight.get()===INITIAL_CONTAINER_HEIGHT){return{};}if(enableDynamicSizing&&animatedContentHeight.get()===INITIAL_CONTAINER_HEIGHT){return{};}const paddingBottom=detached?0:animatedPaddingBottom.get();return{paddingBottom:animate({point:paddingBottom,configs:animationConfigs,overrideReduceMotion:overrideReduceMotion}),height:animate({point:animatedContentHeightMax.get()+paddingBottom,configs:animationConfigs,overrideReduceMotion:overrideReduceMotion})};}"
};
const r25 = memo(function BottomSheetContentComponent(props) {
let derivedValue, derivedValue2, animatedStyle;
const { detached, animationConfigs, overrideReduceMotion, keyboardBehavior, accessible, accessibilityLabel, accessibilityHint, accessibilityRole, children } = props;
derivedValue = void 0;
derivedValue2 = void 0;
animatedStyle = void 0;
const bottomSheetInternal = useBottomSheetInternal();
const { enableDynamicSizing, overDragResistanceFactor, enableContentPanningGesture, animatedPosition, animatedHandleHeight, animatedHighestSnapPoint, animatedContainerHeight, animatedContentHeight, animatedSheetHeight, animatedKeyboardState, animatedKeyboardHeightInContainer, isInTemporaryPosition } = bottomSheetInternal;
const N = function N() {
let r44;
if (animatedContainerHeight.get() === _Module5249.INITIAL_CONTAINER_HEIGHT) {
return 0;
}
const r7 = animatedKeyboardState.get();
const r5 = animatedKeyboardHeightInContainer.get();
const r26 = Math.max(0, animatedHandleHeight.get());
const r28 = animatedContainerHeight.get();
const r31 = animatedSheetHeight.get() - r26;
if (_Module5246.KEYBOARD_BEHAVIOR.extend === keyboardBehavior) {
r44 = r7 === _Module5246.KEYBOARD_STATE.SHOWN ? r31 - r5 : r31;
} else if (_Module5246.KEYBOARD_BEHAVIOR.fillParent === keyboardBehavior) {
r44 = isInTemporaryPosition.get() ? r7 === _Module5246.KEYBOARD_STATE.SHOWN ? r28 - r26 - r5 : r28 - r26 : r31;
} else {
const interactive = _Module5246.KEYBOARD_BEHAVIOR.interactive;
r44 = r31;
if (interactive === keyboardBehavior) {
const r47 = isInTemporaryPosition.get();
r44 = r31;
if (r47) {
let r48 = r31 + r5;
if (r7 === _Module5246.KEYBOARD_STATE.SHOWN) {
r44 = r5 + animatedSheetHeight.get() > r28 ? r28 - r5 - r26 : r31;
} else {
if (r48 + r26 > r28) {
r48 = r28 - r26;
}
r44 = r48;
}
}
}
}
return Math.max(r44, 0);
};
N.__closure = {
animatedContainerHeight,
INITIAL_CONTAINER_HEIGHT: _Module5249.INITIAL_CONTAINER_HEIGHT,
animatedKeyboardState,
animatedKeyboardHeightInContainer,
animatedHandleHeight,
animatedSheetHeight,
keyboardBehavior,
KEYBOARD_BEHAVIOR: _Module5246.KEYBOARD_BEHAVIOR,
KEYBOARD_STATE: _Module5246.KEYBOARD_STATE,
isInTemporaryPosition
};
N.__workletHash = 2170474579366;
N.__initData = __initData;
derivedValue = useDerivedValue(N, [animatedContainerHeight, animatedHandleHeight, animatedKeyboardHeightInContainer, animatedKeyboardState, animatedSheetHeight, isInTemporaryPosition, keyboardBehavior]);
const l = function l() {
const r8 = animatedContainerHeight.get();
if (r8 === _Module5249.INITIAL_CONTAINER_HEIGHT) {
return 0;
}
const r28 = Math.sqrt(Math.max(animatedHighestSnapPoint.get(), animatedPosition.get()) - -1 * r8) * overDragResistanceFactor;
return animatedKeyboardState.get() === _Module5246.KEYBOARD_STATE.SHOWN ? r28 + animatedKeyboardHeightInContainer.get() : r28;
};
l.__closure = {
animatedContainerHeight,
INITIAL_CONTAINER_HEIGHT: _Module5249.INITIAL_CONTAINER_HEIGHT,
animatedHighestSnapPoint,
animatedPosition,
overDragResistanceFactor,
animatedKeyboardState,
KEYBOARD_STATE: _Module5246.KEYBOARD_STATE,
animatedKeyboardHeightInContainer
};
l.__workletHash = 3484699588399;
l.__initData = __initData2;
derivedValue2 = useDerivedValue(l, [overDragResistanceFactor, animatedPosition, animatedContainerHeight, animatedHighestSnapPoint, animatedKeyboardState, animatedKeyboardHeightInContainer]);
const S = function S() {
if (animatedContainerHeight.get() === _Module5249.INITIAL_CONTAINER_HEIGHT) {
return {};
}
if (enableDynamicSizing && animatedContentHeight.get() === _Module5249.INITIAL_CONTAINER_HEIGHT) {
return {};
}
const point = detached ? 0 : derivedValue2.get();
return {
paddingBottom: _Module5262.animate({
point,
configs: animationConfigs,
overrideReduceMotion
}),
height: _Module5262.animate({
point: derivedValue.get() + point,
configs: animationConfigs,
overrideReduceMotion
})
};
};
S.__closure = {
animatedContainerHeight,
INITIAL_CONTAINER_HEIGHT: _Module5249.INITIAL_CONTAINER_HEIGHT,
enableDynamicSizing,
animatedContentHeight,
detached,
animatedPaddingBottom: derivedValue2,
animate: _Module5262.animate,
animationConfigs,
overrideReduceMotion,
animatedContentHeightMax: derivedValue
};
S.__workletHash = 8203943631786;
S.__initData = __initData3;
animatedStyle = useAnimatedStyle(S, [overDragResistanceFactor, enableDynamicSizing, detached, animationConfigs, overrideReduceMotion, animatedContentHeight, derivedValue, animatedContainerHeight]);
const memo = useMemo(() => [detached ? {
overflow: "visible"
} : {
overflow: "hidden"
}, animatedStyle], [animatedStyle, detached]);
return enableContentPanningGesture ? {children} : {children};
});
r25.displayName = "BottomSheetContent";
export { r25 as BottomSheetContent };