import * as y from "react";
function M(u, e, f) {
  const t = y.useRef({});
  function a(p) {
    if (!t.current || t.current.data !== u || t.current.childrenColumnName !== e || t.current.getRowKey !== f) {
      let r = function(s) {
        s.forEach((n, i) => {
          const o = f(n, i);
          c.set(o, n), n && typeof n == "object" && e in n && r(n[e] || []);
        });
      };
      const c = /* @__PURE__ */ new Map();
      r(u), t.current = {
        data: u,
        childrenColumnName: e,
        kvMap: c,
        getRowKey: f
      };
    }
    return t.current.kvMap.get(p);
  }
  return [a];
}
export {
  M as default
};
