export function addFileWithDedup(state, fileNode) { const accept = (node) => { if (node.kind === 'file') { const key = `${node.path}\u0000${node.file.size}`; if (state.fileMeta.has(key)) return null; state.fileMeta.set(key, node.id); return node; } node.children = node.children.map(accept).filter(Boolean); return node.children.length ? node : null; }; const accepted = accept(fileNode); if (!accepted || (accepted.kind !== 'file' && !accepted.children.length)) return false; state.nodes.push(accepted); return true; }