/* Metro module 6416; source: unknown; dependencies: [31, 6413] */ function _fun50335(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#50335, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6594:6, offset: 0x0121694f, size: 113 bytes, params: 8, frame: 18 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const value = require(31) /* metro dependency 31 */; const env0_2 = value.useCallback; const env0_3 = value.useEffect; const env0_4 = value.useMemo; const env0_5 = value.useRef; exports.useBoundDetection = useBoundDetection; } function useBoundDetection(a0, a1) { // fn#50336, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6594:179, offset: 0x012169c0, size: 408 bytes, params: 3, frame: 23 const env0_0 = a0; const env0_1 = a1; const env0_2 = useRef(false); const env0_3 = useRef(false); const env0_4 = useRef(false); const Date = global.Date; const env0_5 = useRef(Date.now()); const data = a0.props.data; const moduleValue = require(6413) /* metro dependency 6413 */; const useUnmountAwareAnimationFrame = moduleValue.useUnmountAwareAnimationFrame; const requestAnimationFrame = Reflect.apply(useUnmountAwareAnimationFrame, moduleValue, []).requestAnimationFrame; const hasLayout2 = a0.hasLayout(); const value2 = 0; const height = hasLayout2 ? a0.getWindowSize().height : value2; const height2 = a0.hasLayout() ? a0.getChildContainerDimensions().height : value2; const width = a0.hasLayout() ? a0.getWindowSize().width : value2; const width2 = a0.hasLayout() ? a0.getChildContainerDimensions().width : value2; const value3 = useCallback(_fun50337, [a0]); const value4 = useCallback(_fun50338, [requestAnimationFrame, a1, a0]); useMemo(_fun50340, [data]); useEffect(_fun50341, [data, value4, height, width]); useEffect(_fun50342, [height2, width2, a0.firstItemOffset, value4]); return {checkBounds: value3}; } function _fun50337() { // fn#50337, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6594:537, offset: 0x01216b58, size: 468 bytes, params: 1, frame: 25 var r3; var absoluteLastScrollOffset; var childContainerDimensions; var windowSize; var value7; var value8; var value12; var value15; let binding = env0_5; const Date = global.Date; binding.current = Date.now(); const {onEndReached, onStartReached, maintainVisibleContentPosition, horizontal, onEndReachedThreshold, onStartReachedThreshold} = env0_0.props; const value2 = undefined; const r1 = (maintainVisibleContentPosition == null ? value2 : maintainVisibleContentPosition.autoscrollToBottomThreshold) ?? -1; if (onEndReached) { binding = env0_0; if (binding.getIsFirstLayoutComplete()) { binding = env0_0; absoluteLastScrollOffset = binding.getAbsoluteLastScrollOffset(); childContainerDimensions = binding.getChildContainerDimensions(); windowSize = binding.getWindowSize(); value7 = horizontal === true; r3 = value7 ? windowSize.width : windowSize.height; value8 = (value7 ? childContainerDimensions.width : childContainerDimensions.height) + env0_0.firstItemOffset; if (onEndReached) { value12 = global.Math.ceil(absoluteLastScrollOffset + r3) >= value8 - (onEndReachedThreshold ?? 0.5) * r3; if (value12 && !env0_2.current) { env0_2.current = true; onEndReached(); } env0_2.current = value12; } if (onStartReached) { value15 = absoluteLastScrollOffset <= (onStartReachedThreshold ?? 0.2) * r3; if (value15 && !env0_3.current) { env0_3.current = true; onStartReached(); } env0_3.current = value15; } if (!value7) { if (r1 >= 0) { env0_4.current = !!(global.Math.ceil(absoluteLastScrollOffset + r3) >= value8 - r1 * r3); } } } } else if (onStartReached) { binding = env0_0; if (binding.getIsFirstLayoutComplete()) { binding = env0_0; absoluteLastScrollOffset = binding.getAbsoluteLastScrollOffset(); childContainerDimensions = binding.getChildContainerDimensions(); windowSize = binding.getWindowSize(); value7 = horizontal === true; r3 = value7 ? windowSize.width : windowSize.height; value8 = (value7 ? childContainerDimensions.width : childContainerDimensions.height) + env0_0.firstItemOffset; if (onEndReached) { value12 = global.Math.ceil(absoluteLastScrollOffset + r3) >= value8 - (onEndReachedThreshold ?? 0.5) * r3; if (value12 && !env0_2.current) { env0_2.current = true; onEndReached(); } env0_2.current = value12; } if (onStartReached) { value15 = absoluteLastScrollOffset <= (onStartReachedThreshold ?? 0.2) * r3; if (value15 && !env0_3.current) { env0_3.current = true; onStartReached(); } env0_3.current = value15; } if (!value7) { if (r1 >= 0) { env0_4.current = !!(global.Math.ceil(absoluteLastScrollOffset + r3) >= value8 - r1 * r3); } } } } else if (!(r1 < 0)) { binding = env0_0; if (binding.getIsFirstLayoutComplete()) { binding = env0_0; absoluteLastScrollOffset = binding.getAbsoluteLastScrollOffset(); childContainerDimensions = binding.getChildContainerDimensions(); windowSize = binding.getWindowSize(); value7 = horizontal === true; r3 = value7 ? windowSize.width : windowSize.height; value8 = (value7 ? childContainerDimensions.width : childContainerDimensions.height) + env0_0.firstItemOffset; if (onEndReached) { value12 = global.Math.ceil(absoluteLastScrollOffset + r3) >= value8 - (onEndReachedThreshold ?? 0.5) * r3; if (value12 && !env0_2.current) { env0_2.current = true; onEndReached(); } env0_2.current = value12; } if (onStartReached) { value15 = absoluteLastScrollOffset <= (onStartReachedThreshold ?? 0.2) * r3; if (value15 && !env0_3.current) { env0_3.current = true; onStartReached(); } env0_3.current = value15; } if (!value7) { if (r1 >= 0) { env0_4.current = !!(global.Math.ceil(absoluteLastScrollOffset + r3) >= value8 - r1 * r3); } } } } return value2; } function _fun50338() { // fn#50338, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6594:1251, offset: 0x01216d2c, size: 49 bytes, params: 1, frame: 11 if (env0_4.current) { env0_4.current = false; requestAnimationFrame(_fun50339); } } function _fun50342() { // fn#50342, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6594:1549, offset: 0x01216dd1, size: 54 bytes, params: 1, frame: 10 const Date = global.Date; if (Date.now() - env0_5.current >= 100) { env0_7(); } } function _fun50339() { // fn#50339, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6594:1290, offset: 0x01216d5d, size: 82 bytes, params: 1, frame: 14 const maintainVisibleContentPosition = env1_0.props.maintainVisibleContentPosition; const value2 = undefined; const animateAutoScrollToBottom = maintainVisibleContentPosition == null ? value2 : maintainVisibleContentPosition.animateAutoScrollToBottom; const r4 = animateAutoScrollToBottom == null || animateAutoScrollToBottom; const current = require.current; if (current != null) { current.scrollToEnd({animated: r4}); } return value2; }