import { isFunction as l } from "lodash-unified";
import { computed as s } from "vue";
const P = (r) => {
  const d = s(() => {
    const o = r.value;
    if (!o)
      return {};
    const { rowClassName: n, top: t, bottom: e } = o;
    return {
      pinnedTopRowData: t,
      pinnedBottomRowData: e,
      getRowClass({ node: i, data: w, rowIndex: u }) {
        if (!(!i.rowPinned || !n))
          return l(n) ? n(w, u, i.rowPinned) : n;
      }
    };
  });
  return {
    getRowPinnedCellClass: (o) => ((n) => {
      let t;
      const { cellClassName: e } = r.value || {};
      return !n.node.rowPinned || !e ? t = [o(n)] : t = [
        o(n),
        l(e) ? e(
          n.data,
          n.colDef,
          n.node.rowPinned,
          n.rowIndex
        ) : e
      ], t.flat().filter(Boolean);
    }),
    rowPinnedGridConfig: d
  };
};
export {
  P as usePinnedRow
};
