import { useEffect as E, useMemo as T, useCallback as W } from "react";
import j from "../utils/calculateColumnMaxWidth.js";
function B({
  setColumnSizing: h,
  columnResize: d,
  columnAction: r,
  columnSizingState: a,
  columnInitialSize: p,
  allLeafColumns: x,
  rows: M
}) {
  E(() => {
    var b;
    (b = d == null ? void 0 : d.onResize) == null || b.call(d, { ...p, ...a });
  }, [d, a, p]);
  const f = T(
    () => r != null && r.enabled ? j(x, M) : p,
    [x, M, r == null ? void 0 : r.enabled, p]
  ), k = W(() => {
    h({ ...a, ...f });
  }, [h, a, f]), D = W(
    (b) => {
      h({ ...a, [b]: f[b] });
    },
    [h, a, f]
  );
  return {
    // Column width calculations
    columnMaxWidth: f,
    // Resize callbacks
    handleAutoResize: D,
    handleAutoResizeAll: k
  };
}
export {
  B as default
};
//# sourceMappingURL=useDataTableResizing.js.map
