@memoarchitect/architect 0.7.2 → 0.8.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/{AiWorkspace-Bu9TlIWg.js → AiWorkspace-Z3BbnmaP.js} +1 -1
  3. package/dist/assets/{AnalysisWorkspace-CodmoI-v.js → AnalysisWorkspace-DjaUOo7U.js} +1 -1
  4. package/dist/assets/{ComplianceWizard-CTihkUi-.js → ComplianceWizard-DKxZ1z25.js} +1 -1
  5. package/dist/assets/DSMView-DJhmrXYm.js +5 -0
  6. package/dist/assets/Dashboard-CYT7KjqU.js +1 -0
  7. package/dist/assets/DhfDashboard-DacdOtkU.js +1 -0
  8. package/dist/assets/DhfWorkbench-CIhopT8J.js +69 -0
  9. package/dist/assets/DiagramCanvas-CLE_nv7Y.js +4 -0
  10. package/dist/assets/{DiagramEditor-UJDHcAUF.js → DiagramEditor-puQuE8gB.js} +2 -2
  11. package/dist/assets/DiagramToolbarControls-XMGLx08e.js +1 -0
  12. package/dist/assets/{ElementDetailView-10U0rr33.js → ElementDetailView-D5XvAL_i.js} +1 -1
  13. package/dist/assets/ExplorerTreeRow-DUmcEsqf.js +3 -0
  14. package/dist/assets/{ImportView-D8svP04Q.js → ImportView-9y1nhQS4.js} +1 -1
  15. package/dist/assets/{LayerGrid-DEe0Ryz-.js → LayerGrid-bhFpOIbe.js} +1 -1
  16. package/dist/assets/{LayerTable-CN_b2rDr.js → LayerTable-RuswZVUI.js} +1 -1
  17. package/dist/assets/{MaxGraphCanvas-bo8oPBct.js → MaxGraphCanvas-D3BXQK2y.js} +1 -1
  18. package/dist/assets/{ModelDiff-xe95oVua.js → ModelDiff-Cl2dhlk3.js} +1 -1
  19. package/dist/assets/{OntologyDecompositionDiagram-BL9R8bdB.js → OntologyDecompositionDiagram-aONGngg4.js} +1 -1
  20. package/dist/assets/{OntologyViewer-CtqNkkCn.js → OntologyViewer-VOrKTRuQ.js} +2 -2
  21. package/dist/assets/{RelationshipOverlay-DL0N8Vmk.js → RelationshipOverlay-B3AN-bM-.js} +1 -1
  22. package/dist/assets/{RelationshipsSection-BoJ0aUXe.js → RelationshipsSection-DggeGBKP.js} +1 -1
  23. package/dist/assets/{ReviewDashboard-DeTge2oC.js → ReviewDashboard--LMXZ3F4.js} +1 -1
  24. package/dist/assets/{ScenarioEditor-FAEYTHgP.js → ScenarioEditor-bB4iBbgO.js} +1 -1
  25. package/dist/assets/{StatisticsDashboard-BAZRqIPN.js → StatisticsDashboard-iXimfU20.js} +1 -1
  26. package/dist/assets/{SysmlCodeEditor-BBfup_Ni.js → SysmlCodeEditor-i0BHj3of.js} +117 -117
  27. package/dist/assets/{TabularView-I4LjHhoH.js → TabularView-DnIfq-TB.js} +1 -1
  28. package/dist/assets/TraceabilityMatrix-eilGn6Sr.js +3 -0
  29. package/dist/assets/UiScreensWorkspace-Cs1ivqzc.js +1 -0
  30. package/dist/assets/{WorkflowWizard-VwpEHt3R.js → WorkflowWizard-C7jI6C59.js} +1 -1
  31. package/dist/assets/index-CG-gfw-s.js +4067 -0
  32. package/dist/assets/index-DXB4CKwW.css +1 -0
  33. package/dist/assets/{index.es-ClbJxlAQ.js → index.es-DABt8CUc.js} +1 -1
  34. package/dist/assets/{jspdf.es.min-DZ68BGxk.js → jspdf.es.min-G-Vwo9yG.js} +3 -3
  35. package/dist/assets/{layout-providers-Dr743WlP.js → layout-providers-BSDYNZu0.js} +1 -1
  36. package/dist/assets/notation-scene-DLZms6VR.js +1 -0
  37. package/dist/assets/{reactflow-s7jmJtXx.js → reactflow-C9OlmOYw.js} +1 -1
  38. package/dist/assets/xlsx-CkFp8p6R.js +105 -0
  39. package/dist/index.html +3 -3
  40. package/dist-standalone/index.html +5504 -0
  41. package/lib/__tests__/standalone-distribution.test.d.ts +2 -0
  42. package/lib/__tests__/standalone-distribution.test.d.ts.map +1 -0
  43. package/lib/__tests__/standalone-distribution.test.js +51 -0
  44. package/lib/__tests__/standalone-distribution.test.js.map +1 -0
  45. package/lib/__tests__/supervised-child-args.test.js +21 -1
  46. package/lib/__tests__/supervised-child-args.test.js.map +1 -1
  47. package/lib/commands/build.d.ts.map +1 -1
  48. package/lib/commands/build.js +15 -18
  49. package/lib/commands/build.js.map +1 -1
  50. package/lib/commands/dev.d.ts +14 -0
  51. package/lib/commands/dev.d.ts.map +1 -1
  52. package/lib/commands/dev.js +40 -1
  53. package/lib/commands/dev.js.map +1 -1
  54. package/lib/feature-grants.d.ts.map +1 -1
  55. package/lib/feature-grants.js +3 -1
  56. package/lib/feature-grants.js.map +1 -1
  57. package/package.json +10 -6
  58. package/dist/assets/DSMView-BiC845df.js +0 -1
  59. package/dist/assets/Dashboard-CgnNLhKq.js +0 -1
  60. package/dist/assets/DhfDashboard-w-dJoJHU.js +0 -1
  61. package/dist/assets/DhfWorkbench-o6B_MT-0.js +0 -69
  62. package/dist/assets/DiagramCanvas-CqGqDbgT.js +0 -3
  63. package/dist/assets/DiagramToolbarControls-B2gZFJlg.js +0 -1
  64. package/dist/assets/ExplorerTreeRow-DqhF_qoO.js +0 -3
  65. package/dist/assets/TraceabilityMatrix-DbrvjqLN.js +0 -3
  66. package/dist/assets/UiScreensWorkspace-DDD_PyJs.js +0 -1
  67. package/dist/assets/editor.worker-DyuDvpVp.js +0 -26
  68. package/dist/assets/element-options-B7AgTB8R.js +0 -3
  69. package/dist/assets/index-BWMNo4wW.css +0 -1
  70. package/dist/assets/index-Bij8Q4Kg.js +0 -45
  71. package/dist/assets/notation-scene-DT8LpWVK.js +0 -1
@@ -1 +1 @@
1
- import{j as e}from"./reactflow-s7jmJtXx.js";import{a as j}from"./zustand-CrhqMOHB.js";import{u as g,h as F}from"./index-Bij8Q4Kg.js";function z({model:n}){const i=g(t=>t.setActiveView),s=g(t=>t.setExplorerTab),l=j.useMemo(()=>Object.values(n.elements).filter(t=>["system","subsystem","logicalcomponent","softwarecomponent","physicalcomponent"].includes(t.kind.toLowerCase())).slice(0,8),[n]),a=j.useMemo(()=>{const t={};for(const o of Object.values(n.elements))t[o.layer]=(t[o.layer]||0)+1;return t},[n]),x=Object.entries(a).sort((t,o)=>o[1]-t[1]).slice(0,5),p=Object.keys(n.elements).length;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🏗️",title:"System Architecture",badge:`${p} elements`,onExpand:()=>{s("model")}}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Layer distribution"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:x.map(([t,o])=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:F[t]||"#95A5A6",flexShrink:0}}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",flex:1,textTransform:"capitalize"},children:t}),e.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:"#6B7280"},children:o}),e.jsx("div",{style:{width:"60px",height:"4px",background:"#F3F4F6",borderRadius:"2px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"2px",background:F[t]||"#95A5A6",width:`${Math.round(o/p*100)}%`}})})]},t))})]}),e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Key components"}),l.length>0?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:l.map(t=>e.jsxs("button",{onClick:()=>i({type:"element-detail",elementId:t.id}),style:{textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"3px 0",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",fontFamily:"monospace"},children:t.kind}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",fontWeight:500},children:t.name})]},t.id))}):e.jsx(C,{text:"No System or Subsystem elements yet"})]})]}),n.diagrams&&n.diagrams.length>0&&e.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px",flexWrap:"wrap"},children:[n.diagrams.slice(0,4).map(t=>e.jsxs("button",{onClick:()=>i({type:"diagram",diagramId:t.id}),style:q,onMouseEnter:o=>o.currentTarget.style.background="#E5E5E0",onMouseLeave:o=>o.currentTarget.style.background="#F3F4F6",children:["⊟ ",t.name]},t.id)),n.diagrams.length>4&&e.jsxs("span",{style:{fontSize:"11px",color:"#9CA3AF",alignSelf:"center"},children:["+",n.diagrams.length-4," more"]})]})]})}function R({model:n}){const i=g(t=>t.setActiveView),{reqs:s,withTestLink:l,withArchLink:a}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(d=>["systemrequirement","requirement","userneed"].includes(d.kind.toLowerCase())),f=new Set;for(const d of n.relationships)f.add(d.sourceId),f.add(d.targetId);const u=new Set(["test","verification","validationtest"]),y=new Set(["system","subsystem","logicalcomponent","softwarecomponent"]),c=new Set(t.filter(d=>u.has(d.kind.toLowerCase())).map(d=>d.id)),b=new Set(t.filter(d=>y.has(d.kind.toLowerCase())).map(d=>d.id));let r=0,S=0;for(const d of o){const A=n.relationships.filter(h=>h.sourceId===d.id||h.targetId===d.id).flatMap(h=>[h.sourceId,h.targetId]);A.some(h=>c.has(h))&&r++,A.some(h=>b.has(h))&&S++}return{reqs:o,withTestLink:r,withArchLink:S}},[n]),x=s.length>0?Math.round(l/s.length*100):0,p=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"📋",title:"Requirements",badge:`${s.length} total`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No requirements found. Add Requirement elements to your model."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Verified by tests",percent:x,count:l,total:s.length,color:"#2DD4A8"}),e.jsx(v,{label:"Linked to architecture",percent:p,count:a,total:s.length,color:"#4A90D9"})]})]})}function I({model:n}){const i=g(t=>t.setActiveView),{hazards:s,riskControls:l,mitigatesCount:a,residualRiskCount:x}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(r=>r.kind.toLowerCase()==="hazard"),f=t.filter(r=>r.kind.toLowerCase()==="riskcontrol"),u=n.relationships.filter(r=>r.type.toLowerCase()==="mitigates"),y=u.length,c=new Set(u.map(r=>r.targetId)),b=o.filter(r=>!c.has(r.id)).length;return{hazards:o,riskControls:f,mitigatesCount:y,residualRiskCount:b}},[n]),p=s.length>0?Math.round((s.length-x)/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"⚠️",title:"Risk Chain (ISO 14971)",badge:`${s.length} hazards`,onExpand:()=>i({type:"traceability"}),badgeColor:x>0?"#E74C3C":"#2ECC71"}),s.length===0?e.jsx(C,{text:"No hazards found. Add Hazard elements to start your ISO 14971 risk analysis."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Hazards mitigated",percent:p,count:s.length-x,total:s.length,color:"#2ECC71",warningThreshold:80}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Risk controls",value:l.length}),e.jsx(m,{label:"Mitigates links",value:a}),x>0&&e.jsx(m,{label:"Unmitigated hazards",value:x,alert:!0})]})]})]})}function L({model:n}){const i=g(p=>p.setActiveView),{tests:s,passing:l,withReqLink:a}=j.useMemo(()=>{const p=Object.values(n.elements),t=p.filter(c=>c.kind.toLowerCase()==="test"),o=p.filter(c=>["systemrequirement","requirement"].includes(c.kind.toLowerCase())),f=new Set(o.map(c=>c.id));let u=0;for(const c of t)n.relationships.filter(r=>r.sourceId===c.id||r.targetId===c.id).flatMap(r=>[r.sourceId,r.targetId]).some(r=>f.has(r))&&u++;const y=t.filter(c=>(c.attributes.status||"").toLowerCase()==="pass").length;return{tests:t,passing:y,withReqLink:u}},[n]),x=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🧪",title:"Verification",badge:`${s.length} tests`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No tests found. Add Test elements and link them to requirements."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Tests linked to requirements",percent:x,count:a,total:s.length,color:"#2DD4A8"}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Tests",value:s.length}),l>0&&e.jsx(m,{label:"Passing",value:l}),s.length-l>0&&e.jsx(m,{label:"Unverified",value:s.length-l,alert:s.length-l>0&&l>0})]})]})]})}function k({icon:n,title:i,badge:s,onExpand:l,badgeColor:a}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"16px"},children:n}),e.jsx("span",{style:{fontSize:"14px",fontWeight:700,color:"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600,padding:"2px 8px",borderRadius:"999px",background:a?a+"20":"#F3F4F6",color:a||"#6B7280"},children:s})]}),e.jsx("button",{onClick:l,style:{fontSize:"11px",color:"#4A90D9",background:"none",border:"none",cursor:"pointer",fontWeight:600},children:"Expand →"})]})}function v({label:n,percent:i,count:s,total:l,color:a,warningThreshold:x=100}){const p=i>=x?a:i>=50?"#F39C12":"#E74C3C";return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[e.jsx("span",{style:{fontSize:"12px",color:"#374151"},children:n}),e.jsxs("span",{style:{fontSize:"12px",fontWeight:600,color:i>=80?"#2ECC71":"#374151"},children:[s,"/",l," (",i,"%)"]})]}),e.jsx("div",{style:{height:"6px",background:"#F3F4F6",borderRadius:"3px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"3px",background:p,width:`${i}%`,transition:"width 0.4s ease"}})})]})}function m({label:n,value:i,alert:s}){return e.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"baseline"},children:[e.jsx("span",{style:{fontSize:"16px",fontWeight:700,color:s?"#E74C3C":"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:n})]})}function C({text:n}){return e.jsx("div",{style:{fontSize:"12px",color:"#9CA3AF",fontStyle:"italic",padding:"8px 0"},children:n})}const w={background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"20px"},E={fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:"#9CA3AF",marginBottom:"8px"},q={fontSize:"11px",color:"#374151",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"4px 10px",cursor:"pointer",transition:"background 0.1s",fontWeight:500};function D(){const n=g(s=>s.model),i=g(s=>s.setActiveView);return n?e.jsx("div",{style:{flex:1,overflowY:"auto",background:"#F7F7F5",padding:"28px 40px"},children:e.jsxs("div",{style:{maxWidth:"960px",margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px"},children:[e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:"20px",fontWeight:800,color:"#1B3A4B",margin:"0 0 4px 0"},children:"Design Review Dashboard"}),e.jsx("p",{style:{fontSize:"12px",color:"#6B7280",margin:0},children:"Architecture · Requirements · Risk · Verification — in one view"})]}),e.jsx("button",{onClick:()=>i({type:"dashboard"}),style:{fontSize:"12px",color:"#6B7280",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"6px 12px",cursor:"pointer",fontWeight:500},children:"← Back to Dashboard"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[e.jsx(z,{model:n}),e.jsx(R,{model:n}),e.jsx(I,{model:n}),e.jsx(L,{model:n})]})]})}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:e.jsx("div",{style:{fontSize:"13px",color:"#9CA3AF"},children:"No model data"})})}export{D as ReviewDashboard};
1
+ import{j as e}from"./reactflow-C9OlmOYw.js";import{a as j}from"./zustand-CrhqMOHB.js";import{u as g,h as F}from"./index-CG-gfw-s.js";function z({model:n}){const i=g(t=>t.setActiveView),s=g(t=>t.setExplorerTab),l=j.useMemo(()=>Object.values(n.elements).filter(t=>["system","subsystem","logicalcomponent","softwarecomponent","physicalcomponent"].includes(t.kind.toLowerCase())).slice(0,8),[n]),a=j.useMemo(()=>{const t={};for(const o of Object.values(n.elements))t[o.layer]=(t[o.layer]||0)+1;return t},[n]),x=Object.entries(a).sort((t,o)=>o[1]-t[1]).slice(0,5),p=Object.keys(n.elements).length;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🏗️",title:"System Architecture",badge:`${p} elements`,onExpand:()=>{s("model")}}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Layer distribution"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:x.map(([t,o])=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:F[t]||"#95A5A6",flexShrink:0}}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",flex:1,textTransform:"capitalize"},children:t}),e.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:"#6B7280"},children:o}),e.jsx("div",{style:{width:"60px",height:"4px",background:"#F3F4F6",borderRadius:"2px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"2px",background:F[t]||"#95A5A6",width:`${Math.round(o/p*100)}%`}})})]},t))})]}),e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Key components"}),l.length>0?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:l.map(t=>e.jsxs("button",{onClick:()=>i({type:"element-detail",elementId:t.id}),style:{textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"3px 0",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",fontFamily:"monospace"},children:t.kind}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",fontWeight:500},children:t.name})]},t.id))}):e.jsx(C,{text:"No System or Subsystem elements yet"})]})]}),n.diagrams&&n.diagrams.length>0&&e.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px",flexWrap:"wrap"},children:[n.diagrams.slice(0,4).map(t=>e.jsxs("button",{onClick:()=>i({type:"diagram",diagramId:t.id}),style:q,onMouseEnter:o=>o.currentTarget.style.background="#E5E5E0",onMouseLeave:o=>o.currentTarget.style.background="#F3F4F6",children:["⊟ ",t.name]},t.id)),n.diagrams.length>4&&e.jsxs("span",{style:{fontSize:"11px",color:"#9CA3AF",alignSelf:"center"},children:["+",n.diagrams.length-4," more"]})]})]})}function R({model:n}){const i=g(t=>t.setActiveView),{reqs:s,withTestLink:l,withArchLink:a}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(d=>["systemrequirement","requirement","userneed"].includes(d.kind.toLowerCase())),f=new Set;for(const d of n.relationships)f.add(d.sourceId),f.add(d.targetId);const u=new Set(["test","verification","validationtest"]),y=new Set(["system","subsystem","logicalcomponent","softwarecomponent"]),c=new Set(t.filter(d=>u.has(d.kind.toLowerCase())).map(d=>d.id)),b=new Set(t.filter(d=>y.has(d.kind.toLowerCase())).map(d=>d.id));let r=0,S=0;for(const d of o){const A=n.relationships.filter(h=>h.sourceId===d.id||h.targetId===d.id).flatMap(h=>[h.sourceId,h.targetId]);A.some(h=>c.has(h))&&r++,A.some(h=>b.has(h))&&S++}return{reqs:o,withTestLink:r,withArchLink:S}},[n]),x=s.length>0?Math.round(l/s.length*100):0,p=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"📋",title:"Requirements",badge:`${s.length} total`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No requirements found. Add Requirement elements to your model."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Verified by tests",percent:x,count:l,total:s.length,color:"#2DD4A8"}),e.jsx(v,{label:"Linked to architecture",percent:p,count:a,total:s.length,color:"#4A90D9"})]})]})}function I({model:n}){const i=g(t=>t.setActiveView),{hazards:s,riskControls:l,mitigatesCount:a,residualRiskCount:x}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(r=>r.kind.toLowerCase()==="hazard"),f=t.filter(r=>r.kind.toLowerCase()==="riskcontrol"),u=n.relationships.filter(r=>r.type.toLowerCase()==="mitigates"),y=u.length,c=new Set(u.map(r=>r.targetId)),b=o.filter(r=>!c.has(r.id)).length;return{hazards:o,riskControls:f,mitigatesCount:y,residualRiskCount:b}},[n]),p=s.length>0?Math.round((s.length-x)/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"⚠️",title:"Risk Chain (ISO 14971)",badge:`${s.length} hazards`,onExpand:()=>i({type:"traceability"}),badgeColor:x>0?"#E74C3C":"#2ECC71"}),s.length===0?e.jsx(C,{text:"No hazards found. Add Hazard elements to start your ISO 14971 risk analysis."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Hazards mitigated",percent:p,count:s.length-x,total:s.length,color:"#2ECC71",warningThreshold:80}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Risk controls",value:l.length}),e.jsx(m,{label:"Mitigates links",value:a}),x>0&&e.jsx(m,{label:"Unmitigated hazards",value:x,alert:!0})]})]})]})}function L({model:n}){const i=g(p=>p.setActiveView),{tests:s,passing:l,withReqLink:a}=j.useMemo(()=>{const p=Object.values(n.elements),t=p.filter(c=>c.kind.toLowerCase()==="test"),o=p.filter(c=>["systemrequirement","requirement"].includes(c.kind.toLowerCase())),f=new Set(o.map(c=>c.id));let u=0;for(const c of t)n.relationships.filter(r=>r.sourceId===c.id||r.targetId===c.id).flatMap(r=>[r.sourceId,r.targetId]).some(r=>f.has(r))&&u++;const y=t.filter(c=>(c.attributes.status||"").toLowerCase()==="pass").length;return{tests:t,passing:y,withReqLink:u}},[n]),x=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🧪",title:"Verification",badge:`${s.length} tests`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No tests found. Add Test elements and link them to requirements."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Tests linked to requirements",percent:x,count:a,total:s.length,color:"#2DD4A8"}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Tests",value:s.length}),l>0&&e.jsx(m,{label:"Passing",value:l}),s.length-l>0&&e.jsx(m,{label:"Unverified",value:s.length-l,alert:s.length-l>0&&l>0})]})]})]})}function k({icon:n,title:i,badge:s,onExpand:l,badgeColor:a}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"16px"},children:n}),e.jsx("span",{style:{fontSize:"14px",fontWeight:700,color:"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600,padding:"2px 8px",borderRadius:"999px",background:a?a+"20":"#F3F4F6",color:a||"#6B7280"},children:s})]}),e.jsx("button",{onClick:l,style:{fontSize:"11px",color:"#4A90D9",background:"none",border:"none",cursor:"pointer",fontWeight:600},children:"Expand →"})]})}function v({label:n,percent:i,count:s,total:l,color:a,warningThreshold:x=100}){const p=i>=x?a:i>=50?"#F39C12":"#E74C3C";return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[e.jsx("span",{style:{fontSize:"12px",color:"#374151"},children:n}),e.jsxs("span",{style:{fontSize:"12px",fontWeight:600,color:i>=80?"#2ECC71":"#374151"},children:[s,"/",l," (",i,"%)"]})]}),e.jsx("div",{style:{height:"6px",background:"#F3F4F6",borderRadius:"3px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"3px",background:p,width:`${i}%`,transition:"width 0.4s ease"}})})]})}function m({label:n,value:i,alert:s}){return e.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"baseline"},children:[e.jsx("span",{style:{fontSize:"16px",fontWeight:700,color:s?"#E74C3C":"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:n})]})}function C({text:n}){return e.jsx("div",{style:{fontSize:"12px",color:"#9CA3AF",fontStyle:"italic",padding:"8px 0"},children:n})}const w={background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"20px"},E={fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:"#9CA3AF",marginBottom:"8px"},q={fontSize:"11px",color:"#374151",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"4px 10px",cursor:"pointer",transition:"background 0.1s",fontWeight:500};function D(){const n=g(s=>s.model),i=g(s=>s.setActiveView);return n?e.jsx("div",{style:{flex:1,overflowY:"auto",background:"#F7F7F5",padding:"28px 40px"},children:e.jsxs("div",{style:{maxWidth:"960px",margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px"},children:[e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:"20px",fontWeight:800,color:"#1B3A4B",margin:"0 0 4px 0"},children:"Design Review Dashboard"}),e.jsx("p",{style:{fontSize:"12px",color:"#6B7280",margin:0},children:"Architecture · Requirements · Risk · Verification — in one view"})]}),e.jsx("button",{onClick:()=>i({type:"dashboard"}),style:{fontSize:"12px",color:"#6B7280",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"6px 12px",cursor:"pointer",fontWeight:500},children:"← Back to Dashboard"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[e.jsx(z,{model:n}),e.jsx(R,{model:n}),e.jsx(I,{model:n}),e.jsx(L,{model:n})]})]})}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:e.jsx("div",{style:{fontSize:"13px",color:"#9CA3AF"},children:"No model data"})})}export{D as ReviewDashboard};
@@ -1,3 +1,3 @@
1
- import{j as e}from"./reactflow-s7jmJtXx.js";import{a as x}from"./zustand-CrhqMOHB.js";import{u as A,k as he,m as fe,C as f,F as C,h as E,E as O,n as Z,M as ge,o as ye,D as je}from"./index-Bij8Q4Kg.js";function ke(d){const r=d.diagramType.toLowerCase(),b=["afd","ofd","ffd"].includes(r)?ye(d):r;return je[b]}function ee({expanded:d,color:r=f.muted}){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{transform:d?"rotate(90deg)":void 0,transition:"transform 150ms ease",flexShrink:0},children:e.jsx("path",{d:"M6 4L10 8L6 12",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function te({open:d,color:r}){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[e.jsx("path",{d:"M1.5 3.5h4.8l1.2 1.5H14.5v8H1.5z",fill:r,opacity:"0.15",stroke:r,strokeWidth:"1",strokeLinejoin:"round"}),d&&e.jsx("path",{d:"M1.5 5h13v8H1.5z",fill:r,opacity:"0.08"})]})}function be({color:d}){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[e.jsx("rect",{x:"2",y:"1.5",width:"12",height:"13",rx:"1.5",fill:d,opacity:"0.1",stroke:d,strokeWidth:"1"}),e.jsx("line",{x1:"5",y1:"5.5",x2:"11",y2:"5.5",stroke:d,strokeWidth:"0.8",opacity:"0.5"}),e.jsx("line",{x1:"5",y1:"8",x2:"11",y2:"8",stroke:d,strokeWidth:"0.8",opacity:"0.5"})]})}function se(d){return d?d.split(`
1
+ import{j as e}from"./reactflow-C9OlmOYw.js";import{a as x}from"./zustand-CrhqMOHB.js";import{u as A,k as he,m as fe,C as f,F as C,h as E,E as O,n as Z,M as ge,o as ye,D as je}from"./index-CG-gfw-s.js";function ke(d){const r=d.diagramType.toLowerCase(),b=["afd","ofd","ffd"].includes(r)?ye(d):r;return je[b]}function ee({expanded:d,color:r=f.muted}){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{transform:d?"rotate(90deg)":void 0,transition:"transform 150ms ease",flexShrink:0},children:e.jsx("path",{d:"M6 4L10 8L6 12",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function te({open:d,color:r}){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[e.jsx("path",{d:"M1.5 3.5h4.8l1.2 1.5H14.5v8H1.5z",fill:r,opacity:"0.15",stroke:r,strokeWidth:"1",strokeLinejoin:"round"}),d&&e.jsx("path",{d:"M1.5 5h13v8H1.5z",fill:r,opacity:"0.08"})]})}function be({color:d}){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[e.jsx("rect",{x:"2",y:"1.5",width:"12",height:"13",rx:"1.5",fill:d,opacity:"0.1",stroke:d,strokeWidth:"1"}),e.jsx("line",{x1:"5",y1:"5.5",x2:"11",y2:"5.5",stroke:d,strokeWidth:"0.8",opacity:"0.5"}),e.jsx("line",{x1:"5",y1:"8",x2:"11",y2:"8",stroke:d,strokeWidth:"0.8",opacity:"0.5"})]})}function se(d){return d?d.split(`
2
2
  `).filter(b=>b.trim()).map((b,W)=>{const I=b.match(/^\d+\.\s*(.*)/);return{index:W,text:I?I[1]:b}}):[]}function ve(d){return d.map((r,b)=>`${b+1}. ${r.text}`).join(`
3
3
  `)}function Ce({explorerOnly:d=!1}){const r=A(t=>t.model),b=A(t=>t.createRelationship),W=A(t=>t.inspectElement),I=A(t=>t.setActiveView),G=A(t=>t.setActiveMode),S=A(t=>t.selectedElementId),[D,ne]=x.useState(""),[i,F]=x.useState(null),[L,P]=x.useState(""),[z,_]=x.useState(null),[T,H]=x.useState(""),R=x.useMemo(()=>{if(!r)return[];const t=Object.values(r.elements),n=r.elements,o=(...s)=>{const y=new Set(s.map(j=>j.toLowerCase()));return r.relationships.filter(j=>y.has(j.type.toLowerCase()))},c=(s,y)=>{var j;return typeof s=="string"&&((j=s.split("::").at(-1))==null?void 0:j.trim())===y},h=t.filter(s=>s.kind.endsWith("UseCase")),w=new Set(h.map(s=>s.id)),u=new Map,a=new Set;for(const s of o("Includes")){if(!w.has(s.sourceId)||!w.has(s.targetId))continue;const y=u.get(s.sourceId)??[];y.push(s.targetId),u.set(s.sourceId,y),a.add(s.targetId)}const v=new Map,g=[],m=(s,y)=>{if(!v.has(s)){v.set(s,y),g.push(s);for(const j of u.get(s)??[])m(j,y+1)}};for(const s of h)a.has(s.id)||m(s.id,0);for(const s of h)m(s.id,0);const M=g.map(s=>n[s]).filter(s=>!!s),$=s=>!D||s.name.toLowerCase().includes(D.toLowerCase())||s.kind.toLowerCase().includes(D.toLowerCase());return M.map(s=>{var Q;const y=o("Supports","supportsUseCase").filter(l=>l.targetId===s.id).map(l=>n[l.sourceId]).filter(l=>!!l&&l.kind==="OperationalWorkflow"),j=t.filter(l=>l.kind.endsWith("Scenario")).filter(l=>c(l.attributes.parentUseCase,s.id)||o("Realizes","scenarioRealizesUseCase").some(N=>N.sourceId===l.id&&N.targetId===s.id)),U=j.map(l=>t.find(N=>c(l.attributes.parentWorkflow,N.id))).filter(l=>!!l),pe=[...new Map([...y,...U].map(l=>[l.id,l])).values()],ue=j.map(l=>{const N=(r.diagrams??[]).filter(me=>{var X;return(X=me.scenarioIds)==null?void 0:X.includes(l.id)});return{scenario:l,views:N}}),xe=pe.map(l=>({workflow:l,scenarios:ue.filter(({scenario:N})=>c(N.attributes.parentWorkflow,l.id))}));return{useCase:s,workflows:xe,depth:v.get(s.id)??0,hasChildren:(((Q=u.get(s.id))==null?void 0:Q.length)??0)>0}}).filter(s=>$(s.useCase)||s.workflows.some(({workflow:y,scenarios:j})=>$(y)||j.some(({scenario:U})=>$(U))))},[r,D]),p=S&&r?r.elements[S]:null,K=x.useMemo(()=>he(r,S||""),[r,S]),k=x.useMemo(()=>i||(p?se(p.doc||""):[]),[p,i]),oe=x.useCallback(()=>{p&&F(se(p.doc||""))},[p]),re=x.useCallback(()=>{if(!p||!i)return;const t=ve(i);fe({...p,doc:t}),F(null)},[p,i]),V=x.useCallback(()=>{if(!L.trim())return;const t=[...i||k,{index:k.length,text:L.trim()}];F(t),P("")},[L,i,k]),le=x.useCallback(t=>{const n=(i||k).filter((o,c)=>c!==t);F(n)},[i,k]),Y=x.useCallback((t,n)=>{const o=[...i||k],c=t+n;c<0||c>=o.length||([o[t],o[c]]=[o[c],o[t]],F(o))},[i,k]),ae=x.useCallback((t,n)=>{const o=[...i||k];o[t]={...o[t],text:n},F(o)},[i,k]),ce=x.useMemo(()=>{if(!r||!T)return[];const t=T.toLowerCase();return Object.values(r.elements).filter(n=>n.id!==S&&n.name.toLowerCase().includes(t)).slice(0,10)},[r,T,S]),[q,ie]=x.useState(new Set),J=t=>{ie(n=>{const o=new Set(n);return o.has(t)?o.delete(t):o.add(t),o})},B=t=>{F(null),G("scenario"),W(t),I({type:"element-detail",elementId:t})},de=({workflow:t,scenarios:n})=>{const o=`workflow:${t.id}`,c=q.has(o),h=()=>J(o),w=a=>{G("scenario"),I({type:"diagram",diagramId:a.id})},u=(a,v)=>{const g=S===a.id;return e.jsxs("button",{type:"button",onClick:()=>B(a.id),className:"flex w-full items-center gap-1.5 px-2 py-1 text-left",style:{borderRadius:"4px",margin:"0 4px",marginLeft:`${v+4}px`,width:`calc(100% - ${v+8}px)`,background:g?`${f.accent}18`:"transparent"},onMouseEnter:m=>{g||(m.currentTarget.style.background="#F0F0ED")},onMouseLeave:m=>{m.currentTarget.style.background=g?`${f.accent}18`:"transparent"},children:[e.jsx(be,{color:E[a.layer]||f.muted}),e.jsx(O,{element:a,selected:g})]},a.id)};return e.jsxs("div",{className:"mb-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 cursor-pointer select-none",style:{borderRadius:"4px",margin:"0 4px"},onMouseEnter:a=>a.currentTarget.style.background="#F0F0ED",onMouseLeave:a=>a.currentTarget.style.background="transparent",onClick:()=>B(t.id),children:[e.jsx("button",{type:"button","aria-label":`${c?"Collapse":"Expand"} ${t.name}`,onClick:a=>{a.stopPropagation(),h()},children:e.jsx(ee,{expanded:c,color:f.muted})}),e.jsx(te,{open:c,color:E.operational}),e.jsx(O,{element:t,fontSize:C.explorer.kind,fontWeight:600}),e.jsx(Z,{count:n.length,color:E.operational,title:`${n.length} scenarios`})]}),c&&n.map(({scenario:a,views:v})=>e.jsxs("div",{style:{marginLeft:"16px"},children:[u(a,0),e.jsx("div",{style:{marginLeft:"20px"},children:v.length>0&&e.jsx("div",{className:"pt-1",children:v.map(g=>{const m=ke(g);return e.jsxs("button",{type:"button",onClick:()=>w(g),className:"flex w-full items-center gap-2 px-2 py-1 text-left",style:{borderRadius:"4px",margin:"0 4px",width:"calc(100% - 8px)"},onMouseEnter:M=>M.currentTarget.style.background="#F0F0ED",onMouseLeave:M=>M.currentTarget.style.background="transparent",title:m==null?void 0:m.fullName,children:[m&&e.jsx("span",{className:"px-1.5 py-0.5 rounded font-semibold",style:{background:m.color+"20",color:m.color,fontSize:C.badge},children:m.code}),e.jsxs("span",{className:"flex-1",style:{minWidth:0},children:[e.jsx("span",{className:"truncate block",style:{color:f.primary,fontSize:C.explorer.item},children:g.name}),e.jsx("span",{className:"truncate block font-mono",style:{color:f.faint,fontSize:"9px",marginTop:1},children:g.id})]})]},g.id)})})})]},a.id)),c&&n.length===0&&e.jsx("div",{className:"px-2 py-1",style:{color:f.faint,fontSize:C.explorer.count,marginLeft:"20px"},children:"No scenarios"})]})};return e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[d&&e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:f.surface},children:[e.jsx("div",{className:"px-3 py-2",style:{borderBottom:"1px solid #E5E5E0"},children:e.jsx("input",{type:"text",placeholder:"Search "+R.length+" use cases...",value:D,onChange:t=>ne(t.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none",style:{background:f.surfaceAlt,border:`1px solid ${f.border}`,color:f.primary,fontSize:C.explorer.search}})}),e.jsxs("div",{className:"flex-1 overflow-y-auto py-1",style:{fontSize:C.explorer.item},children:[R.map(({useCase:t,workflows:n,depth:o})=>{const c="use-case:"+t.id,h=q.has(c),w=n.reduce((u,{scenarios:a})=>u+a.length,0);return e.jsxs("div",{className:"mb-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 cursor-pointer select-none",style:{borderRadius:"4px",margin:"0 4px",marginLeft:4+o*16},onMouseEnter:u=>u.currentTarget.style.background="#F0F0ED",onMouseLeave:u=>u.currentTarget.style.background="transparent",onClick:()=>B(t.id),children:[e.jsx("button",{type:"button","aria-label":`${h?"Collapse":"Expand"} ${t.name}`,onClick:u=>{u.stopPropagation(),J(c)},children:e.jsx(ee,{expanded:h,color:E.functional})}),e.jsx(te,{open:h,color:E.functional}),e.jsx(O,{element:t,fontSize:C.explorer.group,fontWeight:600}),e.jsx(Z,{count:w,color:E.functional,title:`${w} scenarios`})]}),h&&e.jsxs("div",{style:{marginLeft:16+o*16},children:[n.map(({workflow:u,scenarios:a})=>e.jsx(de,{workflow:u,scenarios:a},u.id)),n.length===0&&e.jsx("div",{className:"px-2 py-1",style:{color:f.faint,fontSize:C.explorer.kind},children:"No workflows"})]})]},t.id)}),R.length===0&&e.jsx("div",{className:"px-4 py-8 text-center",style:{color:f.faint},children:"No use-case scenario chains found."})]})]}),!d&&e.jsx("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:e.jsxs(e.Fragment,{children:[!p&&e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"#9CA3AF"},children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:2},children:e.jsx(ge,{size:180})}),e.jsx("div",{className:"text-sm",children:"Select a scenario to edit steps and link elements"})]})}),p&&e.jsxs("div",{className:"max-w-2xl",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold",style:{color:"#1a1a1a"},children:p.name}),e.jsx("span",{className:"px-2 py-0.5 text-xs rounded-md font-medium",style:{background:"#E67E2218",color:"#E67E22"},children:p.kind})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"#6B7280"},children:"Steps"}),!i&&e.jsx("button",{onClick:oe,className:"px-2 py-0.5 text-xs rounded",style:{background:"#2DD4A815",color:"#1B3A4B",border:"1px solid #2DD4A840"},children:"Edit"}),i&&e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:re,className:"px-2 py-0.5 text-xs rounded font-medium",style:{background:"#2DD4A8",color:"#FFFFFF"},children:"Save"}),e.jsx("button",{onClick:()=>F(null),className:"px-2 py-0.5 text-xs rounded",style:{background:"#F3F4F6",color:"#6B7280"},children:"Cancel"})]})]}),e.jsx("div",{className:"space-y-1",children:k.map((t,n)=>e.jsxs("div",{className:"flex items-start gap-2 p-2 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("span",{className:"flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-xs font-medium",style:{background:"#2DD4A815",color:"#1B3A4B"},children:n+1}),i?e.jsx("input",{type:"text",value:t.text,onChange:o=>ae(n,o.target.value),className:"flex-1 text-sm px-2 py-1 rounded focus:outline-none",style:{border:"1px solid #E5E5E0",color:"#374151"}}):e.jsx("span",{className:"flex-1 text-sm",style:{color:"#374151"},children:t.text}),i&&e.jsxs("div",{className:"flex gap-0.5",children:[e.jsx("button",{onClick:()=>Y(n,-1),className:"px-1 text-xs",style:{color:"#9CA3AF"},title:"Move up",children:"▲"}),e.jsx("button",{onClick:()=>Y(n,1),className:"px-1 text-xs",style:{color:"#9CA3AF"},title:"Move down",children:"▼"}),e.jsx("button",{onClick:()=>le(n),className:"px-1 text-xs",style:{color:"#E74C3C"},title:"Remove",children:"✕"})]})]},n))}),i&&e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx("input",{type:"text",value:L,onChange:t=>P(t.target.value),onKeyDown:t=>t.key==="Enter"&&V(),placeholder:"Add a step...",className:"flex-1 text-sm px-3 py-2 rounded-lg focus:outline-none",style:{background:"#FFFFFF",border:"1px solid #E5E5E0",color:"#374151"}}),e.jsx("button",{onClick:V,className:"px-3 py-2 text-xs rounded-lg font-medium",style:{background:"#2DD4A815",color:"#1B3A4B",border:"1px solid #2DD4A840"},children:"+ Add"})]}),k.length===0&&!i&&e.jsx("div",{className:"text-xs p-3 rounded-lg",style:{background:"#F3F4F6",color:"#9CA3AF"},children:"No steps defined. Click Edit to add scenario steps."})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"#6B7280"},children:["Linked Elements (",K.length,")"]}),e.jsx("button",{onClick:()=>_(z===null?0:null),className:"px-2 py-0.5 text-xs rounded",style:{background:"#4A90D915",color:"#4A90D9",border:"1px solid #4A90D940"},children:z!==null?"Done":"+ Link"})]}),z!==null&&e.jsxs("div",{className:"mb-2 p-2 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #4A90D940"},children:[e.jsx("input",{type:"text",value:T,onChange:t=>H(t.target.value),placeholder:"Search elements to link...",className:"w-full text-sm px-2 py-1 rounded focus:outline-none mb-1",style:{border:"1px solid #E5E5E0",color:"#374151"}}),ce.map(t=>e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 text-xs rounded cursor-pointer",onMouseEnter:n=>n.currentTarget.style.background="#F0F0ED",onMouseLeave:n=>n.currentTarget.style.background="transparent",onClick:()=>{b({type:"traceTo",sourceId:p.id,targetId:t.id,direction:"outgoing",selectedElementId:p.id}),H(""),_(null)},children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:E[t.layer]||"#95A5A6"}}),e.jsx("span",{style:{color:"#374151"},children:t.name}),e.jsx("span",{style:{color:"#9CA3AF"},children:t.kind})]},t.id))]}),e.jsx("div",{className:"space-y-1",children:K.map(t=>{const n=t.sourceId===p.id?t.targetId:t.sourceId,o=r.elements[n],c=t.sourceId===p.id?"→":"←";return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg cursor-pointer",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},onMouseEnter:h=>h.currentTarget.style.background="#F0F0ED",onMouseLeave:h=>h.currentTarget.style.background="#FFFFFF",onClick:()=>B(n),children:[e.jsx("span",{style:{color:"#9CA3AF"},children:c}),e.jsx("span",{className:"font-medium",style:{color:"#2563EB"},children:t.type}),e.jsx("span",{style:{color:"#374151"},children:(o==null?void 0:o.name)||n}),o&&e.jsx("span",{className:"ml-auto px-1.5 py-0.5 rounded text-xs",style:{background:(E[o.layer]||"#95A5A6")+"18",color:E[o.layer]||"#95A5A6"},children:o.kind})]},t.id)})})]}),e.jsx("div",{className:"text-xs",style:{color:"#D1D5DB"},children:p.file})]})]})})]})}export{Ce as ScenarioEditor};
@@ -1 +1 @@
1
- import{j as e}from"./reactflow-s7jmJtXx.js";import{a as A}from"./zustand-CrhqMOHB.js";import{u as f,L as y,h as u,f as b}from"./index-Bij8Q4Kg.js";function w(a){var F;const c=Object.values(a.elements),n=c.length,t=a.relationships.length,i=((F=a.diagrams)==null?void 0:F.length)??0,d=new Map;for(const s of c){const o=d.get(s.layer)||{count:0,kinds:new Map};o.count++,o.kinds.set(s.kind,(o.kinds.get(s.kind)||0)+1),d.set(s.layer,o)}const m=y.filter(s=>d.has(s)).map(s=>({layer:s,label:b[s]||s,color:u[s]||"#95A5A6",count:d.get(s).count,kinds:d.get(s).kinds}));for(const[s,o]of d)y.includes(s)||m.push({layer:s,label:b[s]||s,color:u[s]||"#95A5A6",count:o.count,kinds:o.kinds});const l=new Map;for(const s of c){const o=l.get(s.kind)||{count:0,layer:s.layer};o.count++,l.set(s.kind,o)}const r=[...l.entries()].map(([s,{count:o,layer:C}])=>({kind:s,count:o,layer:C})).sort((s,o)=>o.count-s.count).slice(0,15),x=new Map;for(const s of a.relationships)x.set(s.type,(x.get(s.type)||0)+1);const j=[...x.entries()].map(([s,o])=>({type:s,count:o})).sort((s,o)=>o.count-s.count),p=new Set;for(const s of a.relationships)p.add(s.sourceId),p.add(s.targetId);const N=c.filter(s=>!p.has(s.id)).length;Math.max(...m.map(s=>s.count),1);const v=m.map(s=>({layer:s.layer,label:s.label,color:s.color,percent:Math.round(s.count/n*100)})),E=n>0?t/n:0,k=n>0?t/n:0;return{totalElements:n,totalRelationships:t,totalDiagrams:i,layers:m,topKinds:r,relTypes:j,avgRelsPerElement:Math.round(k*10)/10,orphanCount:N,coverage:v,density:Math.round(E*100)/100}}function B(){var d,m;const a=f(l=>l.model),c=f(l=>l.validation),n=f(l=>l.completeness),t=A.useMemo(()=>a?w(a):null,[a]);if(!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5",color:"#9CA3AF"},children:e.jsx("div",{className:"text-sm",children:"No model data"})});const i=((d=c==null?void 0:c.violations)==null?void 0:d.length)??0;return e.jsx("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsx("h2",{className:"text-lg font-semibold mb-1",style:{color:"#374151"},children:"Model Statistics"}),e.jsx("p",{className:"text-xs mb-6",style:{color:"#9CA3AF"},children:"Quick health check for your model"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[e.jsx(h,{label:"Elements",value:t.totalElements,color:"#1B3A4B"}),e.jsx(h,{label:"Relationships",value:t.totalRelationships,color:"#4A90D9"}),e.jsx(h,{label:"Diagrams",value:t.totalDiagrams,color:"#7B68EE"}),e.jsx(h,{label:"Violations",value:i,color:i>0?"#E74C3C":"#2ECC71"})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[e.jsx(g,{label:"Rel. Density",value:`${t.avgRelsPerElement}`,unit:"per element",status:t.avgRelsPerElement>=1.5?"good":t.avgRelsPerElement>=.5?"ok":"low"}),e.jsx(g,{label:"Orphans",value:`${t.orphanCount}`,unit:"unlinked",status:t.orphanCount===0?"good":t.orphanCount<=5?"ok":"low"}),e.jsx(g,{label:"Layers Used",value:`${t.layers.length}`,unit:`of ${y.length}`,status:t.layers.length>=6?"good":t.layers.length>=3?"ok":"low"}),e.jsx(g,{label:"Kinds Used",value:`${t.topKinds.length}`,unit:"types",status:t.topKinds.length>=8?"good":t.topKinds.length>=4?"ok":"low"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Elements by Layer"}),e.jsx("div",{className:"space-y-2",children:t.layers.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-20 text-xs truncate",style:{color:"#374151"},children:l.label}),e.jsx("div",{className:"flex-1 h-4 rounded-full overflow-hidden",style:{background:"#F3F4F6"},children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Math.max(l.count/t.totalElements*100,2)}%`,background:l.color,opacity:.8}})}),e.jsx("span",{className:"w-8 text-right text-xs font-medium",style:{color:"#374151"},children:l.count})]},`${l.layer}-${r}`))})]}),e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Layer Coverage"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:y.map(l=>{const r=t.coverage.find(p=>p.layer===l),x=(r==null?void 0:r.percent)??0,j=x>0?Math.max(.15,x/100):.05;return e.jsxs("div",{className:"p-2 rounded-lg text-center",style:{background:`${u[l]||"#95A5A6"}${Math.round(j*255).toString(16).padStart(2,"0")}`,border:`1px solid ${u[l]||"#95A5A6"}30`},children:[e.jsx("div",{className:"text-xs font-medium truncate",style:{color:"#374151"},children:b[l]||l}),e.jsxs("div",{className:"text-lg font-bold",style:{color:u[l]||"#95A5A6"},children:[x,"%"]})]},l)})})]}),e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Top Element Types"}),e.jsx("div",{className:"space-y-1",children:t.topKinds.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:u[l.layer]||"#95A5A6"}}),e.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:l.kind}),e.jsx("span",{className:"font-medium",style:{color:"#6B7280"},children:l.count})]},`${l.kind}-${r}`))})]}),e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Relationship Types"}),e.jsxs("div",{className:"space-y-1",children:[t.relTypes.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"#4A90D9"}}),e.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:l.type}),e.jsx("span",{className:"font-medium",style:{color:"#6B7280"},children:l.count})]},`${l.type}-${r}`)),t.relTypes.length===0&&e.jsx("div",{className:"text-xs",style:{color:"#9CA3AF"},children:"No relationships"})]})]})]}),n&&e.jsxs("div",{className:"mt-4 p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Completeness by Layer"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:(m=n.layers)==null?void 0:m.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:u[l.layer]||"#95A5A6"}}),e.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:l.layer}),e.jsxs("span",{className:"font-medium",style:{color:l.completeness>=80?"#2ECC71":l.completeness>=50?"#F39C12":"#E74C3C"},children:[Math.round(l.completeness),"%"]})]},`${l.layer}-${r}`))})]})]})})}function h({label:a,value:c,color:n}){return e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("div",{className:"text-2xl font-bold",style:{color:n},children:c.toLocaleString()}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:a})]})}function g({label:a,value:c,unit:n,status:t}){const i=t==="good"?"#2ECC71":t==="ok"?"#F39C12":"#E74C3C";return e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:`1px solid ${i}30`},children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-lg font-bold",style:{color:i},children:c}),e.jsx("span",{className:"text-xs",style:{color:"#9CA3AF"},children:n})]}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:"#6B7280"},children:a})]})}export{B as StatisticsDashboard};
1
+ import{j as e}from"./reactflow-C9OlmOYw.js";import{a as A}from"./zustand-CrhqMOHB.js";import{u as f,L as y,h as u,f as b}from"./index-CG-gfw-s.js";function w(a){var F;const c=Object.values(a.elements),n=c.length,t=a.relationships.length,i=((F=a.diagrams)==null?void 0:F.length)??0,d=new Map;for(const s of c){const o=d.get(s.layer)||{count:0,kinds:new Map};o.count++,o.kinds.set(s.kind,(o.kinds.get(s.kind)||0)+1),d.set(s.layer,o)}const m=y.filter(s=>d.has(s)).map(s=>({layer:s,label:b[s]||s,color:u[s]||"#95A5A6",count:d.get(s).count,kinds:d.get(s).kinds}));for(const[s,o]of d)y.includes(s)||m.push({layer:s,label:b[s]||s,color:u[s]||"#95A5A6",count:o.count,kinds:o.kinds});const l=new Map;for(const s of c){const o=l.get(s.kind)||{count:0,layer:s.layer};o.count++,l.set(s.kind,o)}const r=[...l.entries()].map(([s,{count:o,layer:C}])=>({kind:s,count:o,layer:C})).sort((s,o)=>o.count-s.count).slice(0,15),x=new Map;for(const s of a.relationships)x.set(s.type,(x.get(s.type)||0)+1);const j=[...x.entries()].map(([s,o])=>({type:s,count:o})).sort((s,o)=>o.count-s.count),p=new Set;for(const s of a.relationships)p.add(s.sourceId),p.add(s.targetId);const N=c.filter(s=>!p.has(s.id)).length;Math.max(...m.map(s=>s.count),1);const v=m.map(s=>({layer:s.layer,label:s.label,color:s.color,percent:Math.round(s.count/n*100)})),E=n>0?t/n:0,k=n>0?t/n:0;return{totalElements:n,totalRelationships:t,totalDiagrams:i,layers:m,topKinds:r,relTypes:j,avgRelsPerElement:Math.round(k*10)/10,orphanCount:N,coverage:v,density:Math.round(E*100)/100}}function B(){var d,m;const a=f(l=>l.model),c=f(l=>l.validation),n=f(l=>l.completeness),t=A.useMemo(()=>a?w(a):null,[a]);if(!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5",color:"#9CA3AF"},children:e.jsx("div",{className:"text-sm",children:"No model data"})});const i=((d=c==null?void 0:c.violations)==null?void 0:d.length)??0;return e.jsx("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsx("h2",{className:"text-lg font-semibold mb-1",style:{color:"#374151"},children:"Model Statistics"}),e.jsx("p",{className:"text-xs mb-6",style:{color:"#9CA3AF"},children:"Quick health check for your model"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[e.jsx(h,{label:"Elements",value:t.totalElements,color:"#1B3A4B"}),e.jsx(h,{label:"Relationships",value:t.totalRelationships,color:"#4A90D9"}),e.jsx(h,{label:"Diagrams",value:t.totalDiagrams,color:"#7B68EE"}),e.jsx(h,{label:"Violations",value:i,color:i>0?"#E74C3C":"#2ECC71"})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[e.jsx(g,{label:"Rel. Density",value:`${t.avgRelsPerElement}`,unit:"per element",status:t.avgRelsPerElement>=1.5?"good":t.avgRelsPerElement>=.5?"ok":"low"}),e.jsx(g,{label:"Orphans",value:`${t.orphanCount}`,unit:"unlinked",status:t.orphanCount===0?"good":t.orphanCount<=5?"ok":"low"}),e.jsx(g,{label:"Layers Used",value:`${t.layers.length}`,unit:`of ${y.length}`,status:t.layers.length>=6?"good":t.layers.length>=3?"ok":"low"}),e.jsx(g,{label:"Kinds Used",value:`${t.topKinds.length}`,unit:"types",status:t.topKinds.length>=8?"good":t.topKinds.length>=4?"ok":"low"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Elements by Layer"}),e.jsx("div",{className:"space-y-2",children:t.layers.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-20 text-xs truncate",style:{color:"#374151"},children:l.label}),e.jsx("div",{className:"flex-1 h-4 rounded-full overflow-hidden",style:{background:"#F3F4F6"},children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Math.max(l.count/t.totalElements*100,2)}%`,background:l.color,opacity:.8}})}),e.jsx("span",{className:"w-8 text-right text-xs font-medium",style:{color:"#374151"},children:l.count})]},`${l.layer}-${r}`))})]}),e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Layer Coverage"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:y.map(l=>{const r=t.coverage.find(p=>p.layer===l),x=(r==null?void 0:r.percent)??0,j=x>0?Math.max(.15,x/100):.05;return e.jsxs("div",{className:"p-2 rounded-lg text-center",style:{background:`${u[l]||"#95A5A6"}${Math.round(j*255).toString(16).padStart(2,"0")}`,border:`1px solid ${u[l]||"#95A5A6"}30`},children:[e.jsx("div",{className:"text-xs font-medium truncate",style:{color:"#374151"},children:b[l]||l}),e.jsxs("div",{className:"text-lg font-bold",style:{color:u[l]||"#95A5A6"},children:[x,"%"]})]},l)})})]}),e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Top Element Types"}),e.jsx("div",{className:"space-y-1",children:t.topKinds.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:u[l.layer]||"#95A5A6"}}),e.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:l.kind}),e.jsx("span",{className:"font-medium",style:{color:"#6B7280"},children:l.count})]},`${l.kind}-${r}`))})]}),e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Relationship Types"}),e.jsxs("div",{className:"space-y-1",children:[t.relTypes.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"#4A90D9"}}),e.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:l.type}),e.jsx("span",{className:"font-medium",style:{color:"#6B7280"},children:l.count})]},`${l.type}-${r}`)),t.relTypes.length===0&&e.jsx("div",{className:"text-xs",style:{color:"#9CA3AF"},children:"No relationships"})]})]})]}),n&&e.jsxs("div",{className:"mt-4 p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Completeness by Layer"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:(m=n.layers)==null?void 0:m.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:u[l.layer]||"#95A5A6"}}),e.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:l.layer}),e.jsxs("span",{className:"font-medium",style:{color:l.completeness>=80?"#2ECC71":l.completeness>=50?"#F39C12":"#E74C3C"},children:[Math.round(l.completeness),"%"]})]},`${l.layer}-${r}`))})]})]})})}function h({label:a,value:c,color:n}){return e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("div",{className:"text-2xl font-bold",style:{color:n},children:c.toLocaleString()}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:a})]})}function g({label:a,value:c,unit:n,status:t}){const i=t==="good"?"#2ECC71":t==="ok"?"#F39C12":"#E74C3C";return e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:`1px solid ${i}30`},children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-lg font-bold",style:{color:i},children:c}),e.jsx("span",{className:"text-xs",style:{color:"#9CA3AF"},children:n})]}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:"#6B7280"},children:a})]})}export{B as StatisticsDashboard};