import { useState, useEffect } from "react";
function useScrollDetection({
  scrollRef,
  contentRef,
  isExpanded,
  codeExpanded,
  children
}) {
  const [needsScroll, setNeedsScroll] = useState(false);
  useEffect(() => {
    const checkScrollNeeded = () => {
      if (scrollRef.current && contentRef.current) {
        const viewport = scrollRef.current;
        const content = contentRef.current;
        const hasScroll = content.scrollHeight > viewport.clientHeight;
        setNeedsScroll(hasScroll);
      }
    };
    const timeoutId = setTimeout(checkScrollNeeded, 100);
    window.addEventListener("resize", checkScrollNeeded);
    const resizeObserver = new ResizeObserver(checkScrollNeeded);
    if (contentRef.current) {
      resizeObserver.observe(contentRef.current);
    }
    return () => {
      clearTimeout(timeoutId);
      window.removeEventListener("resize", checkScrollNeeded);
      resizeObserver.disconnect();
    };
  }, [scrollRef, contentRef, isExpanded, codeExpanded, children]);
  return needsScroll;
}
export {
  useScrollDetection
};
//# sourceMappingURL=use-scroll-detection.js.map
