import { NodeIconMap as _ } from "../../model/Brand/LibraryIconMap.es.js";
import { Frontify as u } from "../Frontify.es.js";
const y = ({ node: e, parent: n }) => ({
  icon: _[e.__typename],
  name: e.name,
  id: JSON.stringify({
    id: e.id,
    __typename: e.__typename,
    name: e.name
  }),
  parentId: JSON.stringify({
    id: n.id,
    __typename: n.__typename,
    name: n.name
  }),
  sort: 1,
  value: "value"
}), c = async (e, n, i, o) => {
  if (e.__typename === "SubFolder") {
    const {
      folders: { items: d }
    } = await u.getSubFoldersFromId(e.id, o), r = (t, a) => {
      const m = y({ node: a, parent: e });
      return i != null && i.find((s) => s.id === m.id) ? t : [...t, m];
    };
    n(d.reduce(r, []));
  }
};
export {
  y as createTreeNode,
  c as updateTreeNodes
};
//# sourceMappingURL=Tree.es.js.map
