'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var treeUtil = require('../../../vc-tree/src/utils/treeUtil.cjs');
var commonUtil = require('../utils/commonUtil.cjs');

var useEntities = (options, fieldNames) => {
  const entities = vue.computed(() => {
    return treeUtil.convertDataToEntities(options.value, {
      fieldNames: fieldNames.value,
      initWrapper: (wrapper) => ({
        ...wrapper,
        pathKeyEntities: {}
      }),
      processEntity: (entity, wrapper) => {
        const pathKey = entity.nodes.map((node) => node[fieldNames.value.value]).join(commonUtil.VALUE_SPLIT);
        wrapper.pathKeyEntities[pathKey] = entity;
        entity.key = pathKey;
      }
    }).pathKeyEntities;
  });
  return entities;
};

exports.default = useEntities;
//# sourceMappingURL=useEntities.cjs.map
