import { createVNode } from 'vue';
import TreeNode from './TreeNode.mjs';

const internalProcessProps = (props) => props;
function convertDataToTree(treeData, processor) {
  if (!treeData)
    return [];
  const {
    processProps = internalProcessProps
  } = processor || {};
  const list = Array.isArray(treeData) ? treeData : [treeData];
  return list.map(({
    children,
    ...props
  }) => {
    const childrenNodes = convertDataToTree(children, processor);
    return createVNode(TreeNode, {
      "key": props.key,
      ...processProps(props)
    }, {
      default: () => [childrenNodes]
    });
  });
}

export { convertDataToTree };
//# sourceMappingURL=convertDataToTree.mjs.map
