import { useState as c, useRef as _, useEffect as r } from "react";
const A = 7, d = 30, u = 40, L = 45, D = 190, f = (n, E) => {
  const [o, s] = c(!1), [a, l] = c(0), e = _(null);
  return r(() => {
    let t;
    return e.current != null && n && (t = requestAnimationFrame(() => {
      e.current != null && l(
        e.current.scrollHeight + (E && E < A ? d : u)
      );
    })), () => {
      t !== void 0 && cancelAnimationFrame(t);
    };
  }, [n, E]), { isExpanded: o, calculatedHeight: a, contentRef: e, toggleExpanded: () => s((t) => !t) };
};
export {
  D as DEFAULT_EXPANDABLE_CODE_BLOCK_HEIGHT,
  u as EXPANDED_HEIGHT_OFFSET,
  L as SMALL_EXPANDABLE_CODE_BLOCK_HEIGHT,
  A as SMALL_EXPANDABLE_NUMBER_OF_LINES,
  d as SMALL_EXPANDED_HEIGHT_OFFSET,
  f as useExpandable
};
