"use client";
//#region packages/@mantine/core/src/components/Tree/filter-tree-data/filter-tree-data.ts
function defaultTreeNodeFilter(query, node) {
	return (typeof node.label === "string" ? node.label : node.value).toLowerCase().includes(query.toLowerCase().trim());
}
function filterTreeData(data, query, filter = defaultTreeNodeFilter) {
	if (!query.trim()) return data;
	const result = [];
	for (const node of data) {
		const nodeMatches = filter(query, node);
		const filteredChildren = Array.isArray(node.children) && node.children.length > 0 ? filterTreeData(node.children, query, filter) : [];
		if (nodeMatches || filteredChildren.length > 0) result.push(filteredChildren.length > 0 ? {
			...node,
			children: filteredChildren
		} : { ...node });
	}
	return result;
}
//#endregion
exports.defaultTreeNodeFilter = defaultTreeNodeFilter;
exports.filterTreeData = filterTreeData;

//# sourceMappingURL=filter-tree-data.cjs.map