import { isString as s } from "lodash-unified";
import u from "../../ap-form/utils/set.mjs";
import { getFieldProps as c } from "../../ap-table/utils.mjs";
function i(n, t, r) {
  if (r)
    return s(r) ? n[r] : r(n, t);
}
function d(n, t) {
  const r = {};
  return n.forEach((e, o) => {
    const f = i(e, o, t);
    r[f] = e;
  }), r;
}
function g(n, t, r) {
  return n.map((e, o) => {
    const f = i(e, o, t);
    return r[f] ?? e;
  });
}
function h(n) {
  let t = {};
  function r(e) {
    for (const o of e)
      if (o.children?.length)
        r(o.children);
      else {
        const f = c(o.fieldProps, {});
        f?.transform && (t = u(
          t,
          [o.dataIndex].flat(1),
          f.transform,
          !0
        ));
      }
  }
  return r(n), t;
}
export {
  d as arrayToObject,
  h as getColumnTransformOptions,
  i as getRowKey,
  g as updateArrItem
};
