'use strict';

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

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

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.js.map
