"use client";
//#region packages/@mantine/core/src/components/Tree/merge-async-children/merge-async-children.ts
function mergeAsyncChildren(data, parentValue, children) {
	let changed = false;
	const result = data.map((node) => {
		if (node.value === parentValue) {
			changed = true;
			const merged = {
				...node,
				children
			};
			delete merged.hasChildren;
			return merged;
		}
		if (Array.isArray(node.children)) {
			const updatedChildren = mergeAsyncChildren(node.children, parentValue, children);
			if (updatedChildren !== node.children) {
				changed = true;
				return {
					...node,
					children: updatedChildren
				};
			}
		}
		return node;
	});
	return changed ? result : data;
}
//#endregion
exports.mergeAsyncChildren = mergeAsyncChildren;

//# sourceMappingURL=merge-async-children.cjs.map