// packages/block-library/src/comment-template/util.js
var convertToTree = (data) => {
  const table = {};
  if (!data) {
    return [];
  }
  data.forEach((item) => {
    table[item.id] = { commentId: item.id, children: [] };
  });
  const tree = [];
  data.forEach((item) => {
    if (item.parent) {
      table[item.parent]?.children.push(table[item.id]);
    } else {
      tree.push(table[item.id]);
    }
  });
  return tree;
};
export {
  convertToTree
};
//# sourceMappingURL=util.js.map
