import o from "../../../@babel/runtime/helpers/esm/objectSpread2.mjs";
import * as a from "react";
import { convertDataToEntities as f } from "../../../rc-tree/es/utils/treeUtil.mjs";
import { VALUE_SPLIT as E } from "../utils/commonUtil.mjs";
const v = function(r, e) {
  var n = a.useRef({
    options: null,
    info: null
  }), u = a.useCallback(function() {
    return n.current.options !== r && (n.current.options = r, n.current.info = f(r, {
      fieldNames: e,
      initWrapper: function(t) {
        return o(o({}, t), {}, {
          pathKeyEntities: {}
        });
      },
      processEntity: function(t, p) {
        var i = t.nodes.map(function(s) {
          return s[e.value];
        }).join(E);
        p.pathKeyEntities[i] = t, t.key = i;
      }
    })), n.current.info.pathKeyEntities;
  }, [e, r]);
  return u;
};
export {
  v as default
};
