import { useMemo as a, useCallback as I } from "react";
import p from "../utils/resolveEditableConfig.js";
import S from "../utils/extractCellValue.js";
function k(C) {
  const { cellEdit: o, columns: r, columnId: l, record: t, rowIndex: s, isSelectionColumn: d, isActionColumn: c } = C, e = a(() => r == null ? void 0 : r.find((i) => i.key === l), [r, l]), n = a(() => (e == null ? void 0 : e.dataIndex) ?? l, [e, l]), m = a(() => String((e == null ? void 0 : e.dataIndex) ?? l), [e, l]), u = a(
    () => p({
      cellEdit: o,
      isSelectionColumn: d,
      isActionColumn: c,
      columnDef: e,
      record: t,
      rowIndex: s
    }),
    [o, d, c, e, t, s]
  ), x = a(() => S(t, n), [t, n]), b = a(() => t[n], [t, n]), f = I(
    (i) => o == null ? void 0 : o.onSave(n, t, i, s),
    [o, n, t, s]
  );
  return {
    editableConfig: u,
    isCellEditable: u !== null,
    cellValue: x,
    rawCellValue: b,
    dataIndex: m,
    handleCellSave: f
  };
}
export {
  k as default
};
//# sourceMappingURL=useCellEditable.js.map
