/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-e694c50 | Cube Dev Team */
//#region src/utils/tree.ts
function toFlatTree(tree, includingFolders) {
	return tree.reduce((result, node) => {
		if (!node.isLeaf) result = [
			...result,
			...includingFolders ? [node] : [],
			...toFlatTree(node.children || [], includingFolders)
		];
		else result.push(node);
		return result;
	}, []);
}

//#endregion
export { toFlatTree };
//# sourceMappingURL=tree.js.map