export function buildWorkflowStatistics( statistics ) { const wrapper = document.createElement( "div" ); wrapper.style.padding = "10px"; const totalNodes = statistics?.total_nodes ?? 0; const totalLinks = statistics?.total_links ?? 0; const workflowDepth = statistics?.workflow_depth ?? 0; const longestPath = statistics?.longest_path ?? 0; const branchCount = statistics?.branch_count ?? 0; const disconnectedGraphs = statistics?.disconnected_graphs ?? 0; const largestCategory = statistics?.largest_category ?? "N/A"; wrapper.innerHTML = `

Workflow Statistics

Total Nodes

${totalNodes}

Total Links

${totalLinks}

Workflow Depth

${workflowDepth}

Longest Path

${longestPath}

Branch Count

${branchCount}

Disconnected Graphs

${disconnectedGraphs}

Largest Category

${largestCategory}

`; const categorySection = document.createElement( "div" ); categorySection.style.background = "#252526"; categorySection.style.border = "1px solid #444"; categorySection.style.borderRadius = "10px"; categorySection.style.padding = "15px"; categorySection.style.marginBottom = "20px"; const categoryTitle = document.createElement( "h3" ); categoryTitle.innerText = "Node Categories"; categorySection.appendChild( categoryTitle ); const categories = statistics?.categories ?? {}; const percentages = statistics?.percentages ?? {}; if ( Object.keys( categories ).length === 0 ) { const empty = document.createElement( "p" ); empty.innerText = "No category data available."; categorySection.appendChild( empty ); } else { Object.entries( categories ).forEach( ( [ category, count ] ) => { const row = document.createElement( "div" ); row.style.marginBottom = "12px"; const percentage = percentages[ category ] ?? 0; row.innerHTML = `
${category} ${count} ( ${percentage}% )
`; categorySection.appendChild( row ); } ); } wrapper.appendChild( categorySection ); const metricsSection = document.createElement( "div" ); metricsSection.style.background = "#252526"; metricsSection.style.border = "1px solid #444"; metricsSection.style.borderRadius = "10px"; metricsSection.style.padding = "15px"; metricsSection.innerHTML = `

Architecture Metrics

`; wrapper.appendChild( metricsSection ); return wrapper; }