/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { useRef, useEffect, useCallback } from 'react';
/**
 * @plan PLAN-20251215-OLDUI-SCROLL.P05
 * @requirement REQ-456.4
 */
export function useBatchedScroll(currentScrollTop) {
    const pendingScrollTopRef = useRef(null);
    const currentScrollTopRef = useRef(currentScrollTop);
    useEffect(() => {
        currentScrollTopRef.current = currentScrollTop;
        pendingScrollTopRef.current = null;
    });
    const getScrollTop = useCallback(() => pendingScrollTopRef.current ?? currentScrollTopRef.current, []);
    const setPendingScrollTop = useCallback((newScrollTop) => {
        pendingScrollTopRef.current = newScrollTop;
    }, []);
    return { getScrollTop, setPendingScrollTop };
}
//# sourceMappingURL=useBatchedScroll.js.map