/* === process-mining.jsx ============================================= The Process Mining screen — variant discovery map (Docol P2P). Stylistically matches the reference: amber dot nodes, dashed amber edges from a purple cloud start, red circles for end states, time labels on edges, donut showing variant coverage, ranked variants list on the right, and a primary CTA to open the full map. ===================================================================== */ /* ---------- Node + edge definitions for the Docol P2P process ---------- */ /* SVG canvas: 1080 × 540 */ const PM_NODES = [ { id: 'START', x: 540, y: 60, kind: 'start', label: '' }, { id: 'REQ', x: 220, y: 160, kind: 'step', label: 'Criação Requisição de Compra', count: 1283022 }, { id: 'OC', x: 540, y: 160, kind: 'step', label: 'Criação Pedido de Compra', count: 538836 }, { id: 'APRV1', x: 50, y: 260, kind: 'step', label: 'Aprovação Categoria · Comprador', count: 0 }, { id: 'APRV2', x: 130, y: 360, kind: 'step', label: 'Aprovador Diretoria · PO > R$ 250k', count: 201177 }, { id: 'RECEB', x: 540, y: 260, kind: 'step', label: 'Recebimento Concluído · Joinville', count: 538836 }, { id: 'AGUARD', x: 540, y: 360, kind: 'step', label: 'Aguardando Aprovação Fiscal', count: 538836 }, { id: 'DATAD', x: 270, y: 460, kind: 'step', label: 'Data Recebimento Desejada', count: 1283022 }, { id: 'DATAP', x: 510, y: 460, kind: 'step', label: 'Data Recebimento Planejada', count: 1763539 }, { id: 'NF', x: 760, y: 460, kind: 'end', label: 'Registro NF Entrada · Joinville', count: 44823768 }, { id: 'PAY', x: 960, y: 460, kind: 'end', label: 'Registro Pagamento Wieland', count: 45419672 }, { id: 'END', x: 540, y: 530, kind: 'finish', label: '' }, ]; /* Edges — { from, to, label?, dashed?, weight (1..4) } */ const PM_EDGES = [ { from: 'START', to: 'REQ', label: '0,00 Segundos', dashed: true, weight: 3 }, { from: 'START', to: 'OC', label: '0,00 Segundos', dashed: true, weight: 2 }, { from: 'START', to: 'NF', label: '', dashed: true, weight: 4 }, { from: 'START', to: 'PAY', label: '', dashed: true, weight: 4 }, { from: 'REQ', to: 'APRV1', label: '23,98 Horas', dashed: false, weight: 1 }, { from: 'APRV1', to: 'APRV2', label: '', dashed: false, weight: 1 }, { from: 'APRV2', to: 'DATAD', label: '6,78 Dias', dashed: false, weight: 2 }, { from: 'REQ', to: 'DATAD', label: '11,27 Dias', dashed: false, weight: 3 }, { from: 'OC', to: 'RECEB', label: '7,35 Segundos', dashed: false, weight: 2 }, { from: 'RECEB', to: 'AGUARD',label: '13,45 Horas', dashed: false, weight: 2 }, { from: 'AGUARD',to: 'DATAP', label: '', dashed: false, weight: 2 }, { from: 'DATAD', to: 'END', label: '', dashed: true, weight: 2 }, { from: 'DATAP', to: 'END', label: '', dashed: true, weight: 2 }, { from: 'NF', to: 'END', label: '', dashed: true, weight: 3 }, { from: 'PAY', to: 'END', label: '', dashed: true, weight: 3 }, ]; /* Variants list — 29 entries + "Outros" */ const PM_VARIANTS = [ { n: 1, count: 187200, time: '0,00 Segundos' }, { n: 2, count: 142340, time: '0,00 Segundos' }, { n: 3, count: 96450, time: '11,27 Dias' }, { n: 4, count: 82120, time: '13,45 Horas' }, { n: 5, count: 71390, time: '0,00 Segundos' }, { n: 6, count: 58460, time: '7,78 Dias' }, { n: 7, count: 31200, time: '11,70 Horas' }, { n: 8, count: 27800, time: '12,89 Horas' }, { n: 9, count: 24100, time: '2,31 Dias' }, { n: 10, count: 21450, time: '16,42 Horas' }, { n: 11, count: 19200, time: '14,96 Horas' }, { n: 12, count: 17800, time: '18,46 Dias' }, { n: 13, count: 16300, time: '0,00 Segundos' }, { n: 14, count: 14900, time: '0,00 Segundos' }, { n: 15, count: 13500, time: '11,83 Dias' }, { n: 16, count: 12200, time: '2,78 Dias' }, { n: 17, count: 11000, time: '14,73 Horas' }, { n: 18, count: 9800, time: '20,36 Horas' }, { n: 19, count: 8650, time: '3,76 Dias' }, { n: 20, count: 7600, time: '10,33 Dias' }, { n: 21, count: 6700, time: '11,52 Dias' }, { n: 22, count: 5900, time: '36,65 Dias' }, { n: 23, count: 5100, time: '1,29 Dias' }, { n: 24, count: 4400, time: '4,90 Dias' }, { n: 25, count: 3800, time: '92,20 Dias' }, { n: 26, count: 3200, time: '19,24 Dias' }, { n: 27, count: 2700, time: '6,36 Dias' }, { n: 28, count: 2300, time: '6,57 Dias' }, { n: 29, count: 1950, time: '1,01 Dias' }, ]; /* Compute a curved cubic-bezier path between two nodes that bends slightly to avoid straight cross-hatching. */ function bezierPath(a, b, bend = 0.25) { const dx = b.x - a.x; const dy = b.y - a.y; const mx = (a.x + b.x) / 2; const my = (a.y + b.y) / 2; /* Perpendicular offset to create gentle bend */ const len = Math.hypot(dx, dy) || 1; const nx = -dy / len, ny = dx / len; const cx = mx + nx * bend * len; const cy = my + ny * bend * len; return `M ${a.x} ${a.y} Q ${cx} ${cy} ${b.x} ${b.y}`; } /* ---------- The Process Mining screen ---------- */ function PreviewProcessMining({ state, onOpenFullMap }) { const { cosmetic } = state; const empresa = (state.vars?.empresa && String(state.vars.empresa).trim()) || cosmetic.company; const totalCases = 451756; const coveredCases = 387451; const coveragePct = (coveredCases / totalCases) * 100; return (
Descoberta de variantes · processo 1 — Compras ao Pagamento{' '}
da