@memoarchitect/architect 0.6.4 → 0.6.6

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 (61) hide show
  1. package/README.md +40 -7
  2. package/dist/assets/AiWorkspace-DS79vBOT.js +3 -0
  3. package/dist/assets/AnalysisWorkspace-D_u4shRY.js +39 -0
  4. package/dist/assets/{ComplianceWizard-CVidRUY4.js → ComplianceWizard-k98NZ2ec.js} +1 -1
  5. package/dist/assets/{DSMView-DdcRG9Te.js → DSMView-DGheBwZ0.js} +1 -1
  6. package/dist/assets/{Dashboard-DxOueCqW.js → Dashboard-BRUQvUFK.js} +1 -1
  7. package/dist/assets/{DhfDashboard-CpDAP41S.js → DhfDashboard-B9V_n7kg.js} +1 -1
  8. package/dist/assets/{DhfSettingsPanel-C2vyewXY.js → DhfSettingsPanel-B8aLsWn6.js} +1 -1
  9. package/dist/assets/{DhfWorkbench-BGaEk0Qi.js → DhfWorkbench-TOnZkdUU.js} +3 -3
  10. package/dist/assets/DiagramCanvas-B9d4aLKt.js +1 -0
  11. package/dist/assets/{DiagramEditor-v6VJ5o2f.js → DiagramEditor-CJ7OG2IC.js} +2 -2
  12. package/dist/assets/ElementDetailView-CDcm1rvf.js +2 -0
  13. package/dist/assets/{ImportView-C8lcbof7.js → ImportView-CyMm-tSP.js} +1 -1
  14. package/dist/assets/{LayerGrid-BB30kAyl.js → LayerGrid-DNPZYTsD.js} +1 -1
  15. package/dist/assets/{LayerTable-BN9IZPbM.js → LayerTable-DhOq1DHo.js} +1 -1
  16. package/dist/assets/{MaxGraphCanvas-CfoIuwsi.js → MaxGraphCanvas-DqKU1PTY.js} +6 -6
  17. package/dist/assets/{ModelDiff-D6IR9kzb.js → ModelDiff-BbqIoesG.js} +1 -1
  18. package/dist/assets/OntologyDecompositionDiagram-DkxTe2C_.js +1 -0
  19. package/dist/assets/{OntologyViewer-cI3zi95S.js → OntologyViewer-BIpJC66j.js} +2 -2
  20. package/dist/assets/{ReviewDashboard-BTqze9-C.js → ReviewDashboard-DKoExM8K.js} +1 -1
  21. package/dist/assets/ScenarioEditor-JQ3huCnz.js +3 -0
  22. package/dist/assets/{StatisticsDashboard-BC1JkdTl.js → StatisticsDashboard-B8BduIDz.js} +1 -1
  23. package/dist/assets/{TabularView-Bn_WEMpm.js → TabularView-BXfFSluC.js} +1 -1
  24. package/dist/assets/{TraceabilityMatrix-BEEPlOQq.js → TraceabilityMatrix-CHZHFucA.js} +1 -1
  25. package/dist/assets/{WorkflowWizard-CFx5KVUH.js → WorkflowWizard-7--f9OH2.js} +1 -1
  26. package/dist/assets/index-CVW92JY7.js +3280 -0
  27. package/dist/assets/index-Y1UZTZg-.css +1 -0
  28. package/dist/assets/layout-selection-ClQ295Xc.js +1 -0
  29. package/dist/index.html +2 -2
  30. package/lib/__tests__/feature-grants.test.d.ts +2 -0
  31. package/lib/__tests__/feature-grants.test.d.ts.map +1 -0
  32. package/lib/__tests__/feature-grants.test.js +34 -0
  33. package/lib/__tests__/feature-grants.test.js.map +1 -0
  34. package/lib/bin/memo-architect.js +20 -3
  35. package/lib/bin/memo-architect.js.map +1 -1
  36. package/lib/commands/build.d.ts +3 -0
  37. package/lib/commands/build.d.ts.map +1 -1
  38. package/lib/commands/build.js +3 -0
  39. package/lib/commands/build.js.map +1 -1
  40. package/lib/commands/dev.d.ts +2 -0
  41. package/lib/commands/dev.d.ts.map +1 -1
  42. package/lib/commands/dev.js +5 -0
  43. package/lib/commands/dev.js.map +1 -1
  44. package/lib/commands/example.d.ts +2 -0
  45. package/lib/commands/example.d.ts.map +1 -1
  46. package/lib/commands/example.js +6 -2
  47. package/lib/commands/example.js.map +1 -1
  48. package/lib/feature-grants.d.ts +29 -0
  49. package/lib/feature-grants.d.ts.map +1 -0
  50. package/lib/feature-grants.js +31 -0
  51. package/lib/feature-grants.js.map +1 -0
  52. package/package.json +9 -5
  53. package/dist/assets/ChatPanel-DSjWi7UI.js +0 -3
  54. package/dist/assets/DiagramCanvas-DybZNdxw.js +0 -1
  55. package/dist/assets/ElementDetailView-9EkxZAaF.js +0 -2
  56. package/dist/assets/OntologyDecompositionDiagram-DjhvdWh5.js +0 -1
  57. package/dist/assets/ScenarioEditor-BL835I2V.js +0 -3
  58. package/dist/assets/SysmlGenerator-B_Me_xGE.js +0 -1
  59. package/dist/assets/index-BMgENwvO.js +0 -3280
  60. package/dist/assets/index-XtCtnAfF.css +0 -1
  61. package/dist/assets/layout-selection-ClQts3bC.js +0 -1
package/README.md CHANGED
@@ -9,10 +9,17 @@
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <code>memo-architect 0.6.3</code> &middot; MIT &middot; SysML v2 &middot;
12
+ <code>memo-architect 0.6.5</code> &middot; MIT &middot; SysML v2 &middot;
13
13
  ISO 14971 &middot; IEC 62304 &middot; ISO/IEC/IEEE 42010
14
14
  </p>
15
15
 
16
+ <p align="center">
17
+ <a href="https://memoarchitect.com/memo-architect.html">Product website</a> &middot;
18
+ <a href="https://memoarchitect.com/memo-architect/">Documentation</a> &middot;
19
+ <a href="https://github.com/memoarchitect/memo-architect">GitHub repository</a> &middot;
20
+ <a href="https://www.npmjs.com/package/@memoarchitect/architect">npm package</a>
21
+ </p>
22
+
16
23
  ---
17
24
 
18
25
  > **Status: published preview.** `@memoarchitect/architect` is available on npm.
@@ -22,14 +29,19 @@
22
29
 
23
30
  | Layer | Capability | Repository |
24
31
  |---|---|---|
25
- | 01–02 | Portable ontology and methodology for any SysML v2 editor | [memo](https://github.com/memoarchitect/memo) |
26
- | 03 | Reusable engine libraries and the `memo` CLI | [memo-tools](https://github.com/memoarchitect/memo-tools) |
27
- | 04 | Complete visual workbench | **memo-architect** (this repository) |
32
+ | 01–02 | Portable ontology and methodology for any SysML v2 editor | [Docs](https://memoarchitect.com/memo/) · [Repository](https://github.com/memoarchitect/memo) |
33
+ | 03 | Reusable engine libraries and the `memo` CLI | [Docs](https://memoarchitect.com/memo-tools/) · [Repository](https://github.com/memoarchitect/memo-tools) |
34
+ | 04 | Complete visual workbench | [Docs](https://memoarchitect.com/memo-architect/) · [Repository](https://github.com/memoarchitect/memo-architect) |
28
35
 
29
- All three products share a `MAJOR.MINOR` compatibility line. Any `0.5.x`
30
- release is intended to work with the other `0.5.x` products; patch versions
36
+ All three products share a `MAJOR.MINOR` compatibility line. Any `0.6.x`
37
+ release is intended to work with the other `0.6.x` products; patch versions
31
38
  may advance independently for fixes and additive changes.
32
39
 
40
+ `VERSION` is the sole release-version source for this repository. Run
41
+ `pnpm version:sync` after changing it; CI rejects unsynchronized generated
42
+ version fields and automatically creates the matching `v<version>` tag when
43
+ the change reaches `main`.
44
+
33
45
  Architect reuses the parser, semantic model, validation, document, and project
34
46
  operations from Memo Tools. The React application provides presentation and user
35
47
  interaction; it does not maintain a second engineering model.
@@ -49,8 +61,26 @@ interaction; it does not maintain a second engineering model.
49
61
  - Review requirements, risk, software, verification, and assurance traceability.
50
62
  - Render BDD, IBD, action-flow, sequence, state, tree, DSM, and tabular views.
51
63
  - Author and export Design History File documents from the versioned model.
64
+ - Open a live JupyterLab workspace with model-independent Syside sample notebooks.
52
65
  - Run the same validation and export operations through the CLI or the workbench.
53
66
 
67
+ ### Jupyter analysis
68
+
69
+ Projects created with `memo init` include seven notebooks under
70
+ `analysis/Samples/`: overview and quality reports, architecture hotspots,
71
+ change-impact exploration, charts, an SVG ownership graph, and an inventory
72
+ table with CSV export. Start JupyterLab from the project and select
73
+ **Analysis → Jupyter Notebooks** in Architect:
74
+
75
+ ```bash
76
+ source analysis/.venv/bin/activate
77
+ cd analysis
78
+ jupyter lab --port 8888
79
+ ```
80
+
81
+ The notebooks use the licensed Syside Python API and automatically locate the
82
+ project's nearest `model/` or `src/` tree.
83
+
54
84
  ## Try it on a bundled example
55
85
 
56
86
  The examples ship inside the ontology package, `@memoarchitect/ontology`, so
@@ -141,7 +171,10 @@ To open a bundled example, see [Try it on a bundled example](#try-it-on-a-bundle
141
171
 
142
172
  ## Documentation
143
173
 
144
- - [Start here](docs/src/index.md)
174
+ - [Published documentation](https://memoarchitect.com/memo-architect/)
175
+ - [Product website](https://memoarchitect.com/memo-architect.html)
176
+ - [Start here in the documentation source](docs/src/index.md)
177
+ - [Feature tour](docs/src/users/features.md)
145
178
  - [Layers and their questions](docs/src/users/layers.md)
146
179
  - [Choosing elements](docs/src/users/elements.md)
147
180
  - [Connecting elements](docs/src/users/relationships.md)
@@ -0,0 +1,3 @@
1
+ import{j as e}from"./reactflow-CsCqNKB-.js";import{u as v,m as M,n as _,o as N,p as G}from"./index-CVW92JY7.js";import{a as l}from"./zustand-CrhqMOHB.js";const U={env:"an environment variable","env-file":"the project .env file","project-settings":"project settings","user-credentials":"your saved credentials",default:"the default"},Y={anthropic:"claude-opus-5",openai:"gpt-4o"};function V({onClose:t}){const i=v(a=>a.llmSettings),f=v(a=>a.registerLlmRequest),[n,p]=l.useState((i==null?void 0:i.provider)??"anthropic"),[x,d]=l.useState((i==null?void 0:i.model)??""),[c,g]=l.useState(""),[m,E]=l.useState(!1),[b,j]=l.useState(null),k=l.useCallback(async()=>{E(!0),j(null);const a=`llmset-${Date.now()}-${Math.random().toString(36).slice(2)}`;try{await new Promise((u,S)=>{f(a,u,S),M(a,{provider:n,model:x.trim()||void 0,...c?{apiKey:c}:{}}),setTimeout(()=>S(new Error("The save timed out.")),2e4)}),g(""),j("Saved.")}catch(u){j((u==null?void 0:u.message)??"The settings could not be saved.")}finally{E(!1)}},[n,x,c,f]),C=l.useCallback(async()=>{E(!0),j(null);const a=`llmclear-${Date.now()}-${Math.random().toString(36).slice(2)}`;try{await new Promise((u,S)=>{f(a,u,S),M(a,{provider:n,apiKey:""}),setTimeout(()=>S(new Error("The request timed out.")),2e4)}),j("Key removed.")}catch(u){j((u==null?void 0:u.message)??"The key could not be removed.")}finally{E(!1)}},[n,f]),w={fontSize:"11px",fontWeight:600,color:"#374151",display:"block",marginBottom:"4px"},s={width:"100%",padding:"6px 10px",border:"1px solid #E5E5E0",borderRadius:"6px",fontSize:"12px",outline:"none",background:"#fff",color:"#1B3A4B",fontFamily:"inherit"};return e.jsxs("div",{style:{padding:"14px 20px",background:"#fff",borderBottom:"1px solid #E5E5E0",display:"flex",flexDirection:"column",gap:"12px",flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[e.jsx("div",{style:{flex:1,fontSize:"12px",fontWeight:700,color:"#1B3A4B"},children:"LLM settings"}),e.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"#9CA3AF",fontSize:"14px",cursor:"pointer"},children:"✕"})]}),e.jsxs("div",{style:{display:"flex",gap:"10px"},children:[e.jsxs("div",{style:{flex:"0 0 130px"},children:[e.jsx("label",{style:w,children:"Provider"}),e.jsxs("select",{value:n,onChange:a=>p(a.target.value),style:{...s,cursor:"pointer"},children:[e.jsx("option",{value:"anthropic",children:"Anthropic"}),e.jsx("option",{value:"openai",children:"OpenAI-compatible"})]})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{style:w,children:"Model"}),e.jsx("input",{value:x,onChange:a=>d(a.target.value),placeholder:Y[n]??"",style:s})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:w,children:"API key"}),i&&!i.keyEditable&&i.configured?e.jsxs("div",{style:{fontSize:"11px",color:"#6B7280",lineHeight:1.6},children:["A key is already supplied by ",U[i.keyOrigin??"default"],", which takes precedence over anything saved here. Remove it there to set a key from this screen."]}):e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"password",value:c,onChange:a=>g(a.target.value),placeholder:i!=null&&i.configured?"Saved — type a new key to replace it":"sk-…",autoComplete:"off",style:s}),e.jsxs("div",{style:{fontSize:"10px",color:"#9CA3AF",marginTop:"4px",lineHeight:1.5},children:["Stored in ",e.jsx("code",{children:"~/.memo/credentials.json"})," with owner-only permissions — outside this project, so it is never committed. You can also set"," ",e.jsx("code",{children:"ANTHROPIC_API_KEY"})," in the environment or a project ",e.jsx("code",{children:".env"}),"."]})]})]}),e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[e.jsx("button",{onClick:k,disabled:m,style:{padding:"6px 14px",borderRadius:"6px",border:"none",background:"#1B3A4B",color:"#fff",fontSize:"11px",fontWeight:600,cursor:m?"default":"pointer",opacity:m?.5:1},children:m?"Saving…":"Save"}),(i==null?void 0:i.configured)&&i.keyEditable&&e.jsx("button",{onClick:C,disabled:m,style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #E5E5E0",background:"transparent",color:"#dc2626",fontSize:"11px",cursor:"pointer"},children:"Remove saved key"}),b&&e.jsx("span",{style:{fontSize:"11px",color:"#6B7280"},children:b})]})]})}const Q=["What hazards have no risk controls?","Show trace from requirements to verification.","Which layers have the most gaps?","How many unmitigated hazards are there?","List all SOUP components."],X=12e4;function J(){const t=v(o=>o.llmAvailable),i=v(o=>o.llmProvider),f=v(o=>o.llmModel),n=v(o=>o.model),p=v(o=>o.registerLlmRequest),[x,d]=l.useState([]),[c,g]=l.useState([]),[m,E]=l.useState(""),[b,j]=l.useState(!1),[k,C]=l.useState(!1),[w,s]=l.useState(!1),[a,u]=l.useState(!1),[S,D]=l.useState(new Set),[T,B]=l.useState(null),L=l.useRef(null),$=l.useRef(null);l.useEffect(()=>{var o;(o=L.current)==null||o.scrollIntoView({behavior:"smooth"})},[x,b]);const R=l.useCallback((o,h)=>new Promise((y,r)=>{p(o,y,r),h(),setTimeout(()=>r(new Error("The request timed out after 2 minutes.")),X)}),[p]),I=l.useCallback(async o=>{if(!o.trim()||b)return;const h=o.trim();E(""),d(r=>[...r,{role:"user",content:h}]),j(!0),B(null);const y=`chat-${Date.now()}-${Math.random().toString(36).slice(2)}`;try{const r=await R(y,()=>_(y,h,c,k));g(r.messages),d(A=>[...A,{role:"assistant",content:r.truncated?`${r.answer}
2
+
3
+ _(Stopped at the tool-call limit for one turn — ask again to continue.)_`:r.answer,changes:r.proposedChanges.length?r.proposedChanges:void 0}]),r.proposedChanges.length&&D(A=>{const F=new Set(A);for(const z of r.proposedChanges)F.add(z.id);return F})}catch(r){d(A=>[...A,{role:"assistant",content:(r==null?void 0:r.message)??"Unknown error",error:!0}])}finally{j(!1)}},[b,c,k,R]),W=o=>{o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),I(m))},P=o=>{D(h=>{const y=new Set(h);return y.has(o)?y.delete(o):y.add(o),y})},q=l.useCallback(async o=>{const h=o.filter(r=>S.has(r.id));if(h.length===0||a)return;u(!0),B(null);const y=`apply-${Date.now()}-${Math.random().toString(36).slice(2)}`;try{const r=await R(y,()=>N(y,h)),A=new Set(r.applied);d(F=>F.map(z=>z.changes?{...z,changes:z.changes.filter(H=>!A.has(H.id))}:z)),B(r.failed.length?`Applied ${r.applied.length}. Failed: ${r.failed.map(F=>F.error).join("; ")}`:`Applied ${r.applied.length} change${r.applied.length===1?"":"s"} to the model source.`)}catch(r){B((r==null?void 0:r.message)??"The changes could not be applied.")}finally{u(!1)}},[S,a,R]),O=o=>{const h=new Set(o.map(y=>y.id));d(y=>y.map(r=>r.changes?{...r,changes:r.changes.filter(A=>!h.has(A.id))}:r))},K=()=>{d([]),g([]),D(new Set),B(null)};return n?e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"#F7F7F5",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"14px 20px 10px",borderBottom:"1px solid #E5E5E0",background:"#fff",flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[e.jsx("span",{style:{fontSize:"16px"},children:"✦"}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:"14px",fontWeight:700,color:"#1B3A4B"},children:"Model Assistant"}),e.jsx("div",{style:{fontSize:"11px",color:t?"#059669":"#dc2626",marginTop:"1px"},children:t?`${i??"LLM"} · ${f??"unknown model"}`:"No API key configured"})]}),e.jsx("button",{onClick:()=>s(o=>!o),title:"LLM settings",style:{background:w?"#F3F4F6":"none",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"4px 8px",fontSize:"12px",color:"#374151",cursor:"pointer"},children:"⚙ Settings"})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"8px",fontSize:"11px",color:"#6B7280",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:k,onChange:o=>C(o.target.checked),style:{cursor:"pointer"}}),"Suggest edits — the assistant may propose model changes for your approval"]})]}),w&&e.jsx(V,{onClose:()=>s(!1)}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px",display:"flex",flexDirection:"column",gap:"12px"},children:[x.length===0&&e.jsxs("div",{style:{paddingTop:"8px"},children:[e.jsx("div",{style:{fontSize:"12px",color:"#9CA3AF",marginBottom:"12px"},children:"Ask about your model in plain English. The assistant can look up any element, follow traceability chains, and read validation gaps."}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:Q.map(o=>e.jsx("button",{onClick:()=>I(o),disabled:!t||b,style:{textAlign:"left",padding:"8px 12px",borderRadius:"8px",background:"#fff",border:"1px solid #E5E5E0",fontSize:"12px",color:"#374151",cursor:"pointer",transition:"border-color 0.1s",opacity:t?1:.5},onMouseEnter:h=>{t&&(h.currentTarget.style.borderColor="#2DD4A8")},onMouseLeave:h=>{h.currentTarget.style.borderColor="#E5E5E0"},children:o},o))})]}),x.map((o,h)=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:o.role==="user"?"row-reverse":"row",gap:"8px",alignItems:"flex-start"},children:[e.jsx("div",{style:{width:"24px",height:"24px",borderRadius:"50%",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:o.role==="user"?"#1B3A4B":"#2DD4A815",fontSize:"10px",fontWeight:700,color:o.role==="user"?"#fff":"#2DD4A8",marginTop:"2px"},children:o.role==="user"?"U":"✦"}),e.jsx("div",{style:{maxWidth:"85%",padding:"10px 12px",borderRadius:"10px",background:o.role==="user"?"#1B3A4B":o.error?"#fef2f2":"#fff",color:o.role==="user"?"#fff":o.error?"#dc2626":"#1B3A4B",fontSize:"13px",lineHeight:"1.6",border:o.role==="assistant"?`1px solid ${o.error?"#fecaca":"#E5E5E0"}`:"none",whiteSpace:"pre-wrap"},children:o.content})]}),o.changes&&o.changes.length>0&&e.jsx(Z,{changes:o.changes,approved:S,onToggle:P,onApply:()=>q(o.changes),onDiscard:()=>O(o.changes),applying:a})]},h)),T&&e.jsx("div",{style:{fontSize:"11px",color:"#374151",background:"#fff",border:"1px solid #E5E5E0",borderRadius:"8px",padding:"8px 12px"},children:T}),b&&e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-start"},children:[e.jsx("div",{style:{width:"24px",height:"24px",borderRadius:"50%",background:"#2DD4A815",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px",color:"#2DD4A8",fontWeight:700},children:"✦"}),e.jsx("div",{style:{padding:"10px 14px",borderRadius:"10px",background:"#fff",border:"1px solid #E5E5E0",display:"flex",gap:"4px",alignItems:"center"},children:e.jsx(oe,{})})]}),e.jsx("div",{ref:L})]}),e.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid #E5E5E0",background:"#fff",flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-end"},children:[e.jsx("textarea",{ref:$,value:m,onChange:o=>E(o.target.value),onKeyDown:W,disabled:!t||b,placeholder:t?"Ask a question… (Enter to send, Shift+Enter for newline)":"Add an API key in Settings to start",rows:2,style:{flex:1,padding:"8px 12px",border:"1px solid #E5E5E0",borderRadius:"8px",fontSize:"13px",resize:"none",fontFamily:"inherit",outline:"none",background:"#F7F7F5",color:"#1B3A4B",lineHeight:"1.5",opacity:t?1:.5},onFocus:o=>{o.target.style.borderColor="#2DD4A8"},onBlur:o=>{o.target.style.borderColor="#E5E5E0"}}),e.jsx("button",{onClick:()=>I(m),disabled:!t||b||!m.trim(),style:{padding:"8px 14px",borderRadius:"8px",border:"none",background:"#1B3A4B",color:"#fff",fontSize:"12px",fontWeight:600,cursor:"pointer",flexShrink:0,opacity:!t||!m.trim()?.4:1,transition:"opacity 0.15s"},children:"Send"})]}),x.length>0&&e.jsx("button",{onClick:K,style:{marginTop:"6px",background:"none",border:"none",color:"#9CA3AF",fontSize:"11px",cursor:"pointer",padding:0},children:"Clear conversation"})]})]}):e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"#9CA3AF"},children:"Waiting for model data…"})}function Z({changes:t,approved:i,onToggle:f,onApply:n,onDiscard:p,applying:x}){const d=t.filter(c=>i.has(c.id)).length;return e.jsxs("div",{style:{marginLeft:"32px",border:"1px solid #FCD34D",borderRadius:"10px",background:"#FFFBEB",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid #FDE68A",fontSize:"11px",fontWeight:700,color:"#92400E"},children:[t.length," proposed change",t.length===1?"":"s"," — nothing is written until you apply"]}),e.jsx("div",{style:{display:"flex",flexDirection:"column"},children:t.map(c=>e.jsxs("label",{style:{display:"flex",gap:"8px",alignItems:"flex-start",padding:"8px 12px",borderBottom:"1px solid #FDE68A",cursor:"pointer",fontSize:"12px"},children:[e.jsx("input",{type:"checkbox",checked:i.has(c.id),onChange:()=>f(c.id),style:{marginTop:"2px",cursor:"pointer"}}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:600,color:"#1B3A4B"},children:ee(c)}),e.jsx("div",{style:{color:"#92400E",marginTop:"2px"},children:c.summary}),e.jsx(te,{change:c})]})]},c.id))}),e.jsxs("div",{style:{padding:"8px 12px",display:"flex",gap:"8px",alignItems:"center"},children:[e.jsx("button",{onClick:n,disabled:d===0||x,style:{padding:"6px 12px",borderRadius:"6px",border:"none",background:"#92400E",color:"#fff",fontSize:"11px",fontWeight:600,cursor:d===0||x?"default":"pointer",opacity:d===0||x?.4:1},children:x?"Applying…":`Apply ${d} selected`}),e.jsx("button",{onClick:p,disabled:x,style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #FDE68A",background:"transparent",color:"#92400E",fontSize:"11px",cursor:"pointer"},children:"Discard all"})]})]})}function ee(t){switch(t.kind){case"create-element":return`Create ${t.elementKind} · ${t.elementId}`;case"update-element":return`Update · ${t.elementId}`;case"create-relationship":return`Relate · ${t.sourceId} → ${t.targetId}`;case"delete-relationship":return`Remove relationship · ${t.relationshipId}`}}function te({change:t}){const i={fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:"11px",color:"#374151",marginTop:"4px"};if(t.kind==="create-element"){const f=Object.entries(t.attributes??{});return e.jsxs("div",{style:i,children:[e.jsxs("div",{children:["name = ",t.name]}),t.layer&&e.jsxs("div",{children:["layer = ",t.layer]}),f.map(([n,p])=>e.jsxs("div",{children:[n," = ",p]},n))]})}if(t.kind==="update-element"){const f=new Set([...Object.keys(t.changes.attributes??{}),...t.changes.name!==void 0?["name"]:[],...t.changes.doc!==void 0?["doc"]:[]]);return e.jsx("div",{style:i,children:[...f].map(n=>{var d,c;const p=n==="name"?t.before.name:n==="doc"?t.before.doc:(d=t.before.attributes)==null?void 0:d[n],x=n==="name"?t.changes.name:n==="doc"?t.changes.doc:(c=t.changes.attributes)==null?void 0:c[n];return e.jsxs("div",{children:[n,": ",e.jsx("span",{style:{color:"#dc2626",textDecoration:"line-through"},children:p||"∅"})," → ",e.jsx("span",{style:{color:"#059669"},children:x})]},n)})})}return t.kind==="create-relationship"?e.jsxs("div",{style:i,children:[t.sourceId," —",t.relationshipType,"→ ",t.targetId]}):e.jsxs("div",{style:i,children:[t.sourceId," —",t.relationshipType,"→ ",t.targetId]})}function oe(){return e.jsxs("span",{style:{display:"inline-flex",gap:"3px",alignItems:"center"},children:[[0,1,2].map(t=>e.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"#9CA3AF",animation:"llm-pulse 1.2s ease-in-out infinite",animationDelay:`${t*.2}s`}},t)),e.jsx("style",{children:"@keyframes llm-pulse{0%,80%,100%{opacity:0.3}40%{opacity:1}}"})]})}const ne=["Add a PressureSensor component with a USB interface and a power port.","Create a hazard: AlarmFailure that causes patient harm in ICU setting.","Define a software item InfusionController with a requirement for dose limit checking.","Add a RiskControlMeasure that mitigates OverInfusion by adding a flow rate sensor."];function re(){const t=v(s=>s.llmAvailable),i=v(s=>s.llmProvider),f=v(s=>s.llmModel),n=v(s=>s.registerLlmRequest),[p,x]=l.useState(""),[d,c]=l.useState(!1),[g,m]=l.useState(null),[E,b]=l.useState(null),[j,k]=l.useState(!1),C=l.useCallback(async s=>{if(!s.trim()||d)return;c(!0),m(null),b(null),k(!1);const a=`gen-${Date.now()}-${Math.random().toString(36).slice(2)}`;try{const u=await new Promise((S,D)=>{n(a,S,D),G(a,s.trim()),setTimeout(()=>D(new Error("Request timed out after 60 seconds.")),6e4)});m(u)}catch(u){b((u==null?void 0:u.message)??"Unknown error")}finally{c(!1)}},[d,n]),w=()=>{g!=null&&g.sysml&&navigator.clipboard.writeText(g.sysml).then(()=>{k(!0),setTimeout(()=>k(!1),2e3)})};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"#F7F7F5",overflow:"hidden"},children:[e.jsx("div",{style:{padding:"14px 20px 10px",borderBottom:"1px solid #E5E5E0",background:"#fff",flexShrink:0},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[e.jsx("span",{style:{fontSize:"16px"},children:"⟨/⟩"}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"14px",fontWeight:700,color:"#1B3A4B"},children:"SysML Generator"}),e.jsx("div",{style:{fontSize:"11px",color:t?"#059669":"#dc2626",marginTop:"1px"},children:t?`${i??"LLM"} · ${f??"unknown model"} · natural language → SysML v2`:"No LLM provider — set ANTHROPIC_API_KEY or OPENAI_API_KEY"})]})]})}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px"},children:[e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsx("label",{style:{fontSize:"12px",fontWeight:600,color:"#374151",display:"block",marginBottom:"6px"},children:"Describe what to generate"}),e.jsx("textarea",{value:p,onChange:s=>x(s.target.value),disabled:!t||d,rows:4,placeholder:"Describe the element(s) to generate in plain English…",style:{width:"100%",padding:"10px 12px",border:"1px solid #E5E5E0",borderRadius:"8px",fontSize:"13px",resize:"vertical",fontFamily:"inherit",outline:"none",background:"#fff",color:"#1B3A4B",lineHeight:"1.5",boxSizing:"border-box",opacity:t?1:.5},onFocus:s=>{s.target.style.borderColor="#2DD4A8"},onBlur:s=>{s.target.style.borderColor="#E5E5E0"},onKeyDown:s=>{s.key==="Enter"&&(s.metaKey||s.ctrlKey)&&(s.preventDefault(),C(p))}}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"8px"},children:[e.jsx("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:"Cmd+Enter to generate"}),e.jsx("button",{onClick:()=>C(p),disabled:!t||d||!p.trim(),style:{padding:"6px 16px",borderRadius:"8px",border:"none",background:"#1B3A4B",color:"#fff",fontSize:"12px",fontWeight:600,cursor:"pointer",opacity:!t||!p.trim()?.4:1},children:d?"Generating…":"Generate SysML"})]})]}),!g&&!d&&e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"8px"},children:"Examples"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"5px"},children:ne.map(s=>e.jsx("button",{onClick:()=>{x(s)},disabled:!t,style:{textAlign:"left",padding:"7px 11px",borderRadius:"6px",background:"#fff",border:"1px solid #E5E5E0",fontSize:"12px",color:"#374151",cursor:"pointer",opacity:t?1:.5},onMouseEnter:a=>{t&&(a.currentTarget.style.borderColor="#2DD4A8")},onMouseLeave:a=>{a.currentTarget.style.borderColor="#E5E5E0"},children:s},s))})]}),d&&e.jsxs("div",{style:{background:"#fff",border:"1px solid #E5E5E0",borderRadius:"10px",padding:"20px",textAlign:"center",color:"#9CA3AF",fontSize:"13px"},children:[e.jsx("div",{style:{marginBottom:"8px",fontSize:"20px"},children:"⟨/⟩"}),"Generating SysML v2…"]}),E&&e.jsxs("div",{style:{background:"#fef2f2",border:"1px solid #fecaca",borderRadius:"8px",padding:"12px",color:"#dc2626",fontSize:"13px"},children:[e.jsx("strong",{children:"Error:"})," ",E]}),g&&!d&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[e.jsxs("div",{style:{background:"#F0FDF9",border:"1px solid #A7F3D0",borderRadius:"8px",padding:"12px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:"#065F46",marginBottom:"4px",textTransform:"uppercase",letterSpacing:"0.06em"},children:"Explanation"}),e.jsx("p",{style:{fontSize:"13px",color:"#1B3A4B",margin:0,lineHeight:"1.6"},children:g.explanation}),g.suggestedFile&&e.jsxs("div",{style:{marginTop:"8px",fontSize:"11px",color:"#6B7280"},children:["Suggested file: ",e.jsx("code",{style:{background:"#D1FAE5",padding:"1px 5px",borderRadius:"3px"},children:g.suggestedFile})]})]}),e.jsxs("div",{style:{background:"#1e293b",borderRadius:"10px",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 14px",borderBottom:"1px solid #334155"},children:[e.jsx("span",{style:{fontSize:"11px",color:"#94a3b8",fontWeight:600},children:"SysML v2"}),e.jsx("button",{onClick:w,style:{padding:"3px 10px",borderRadius:"4px",border:"none",background:j?"#059669":"#334155",color:"#fff",fontSize:"11px",cursor:"pointer",fontWeight:500},children:j?"Copied!":"Copy"})]}),e.jsx("pre",{style:{margin:0,padding:"14px 16px",fontSize:"12px",lineHeight:"1.6",color:"#e2e8f0",overflowX:"auto",fontFamily:"'SF Mono', 'Fira Code', 'Consolas', monospace"},children:e.jsx("code",{children:g.sysml})})]}),e.jsxs("div",{style:{fontSize:"11px",color:"#9CA3AF",padding:"4px 0"},children:["Review the generated SysML before saving. Copy it into your project's ",e.jsx("code",{children:".sysml"})," files. The dev server will pick up the changes automatically."]}),e.jsx("button",{onClick:()=>{m(null),x("")},style:{padding:"6px 14px",borderRadius:"6px",border:"1px solid #E5E5E0",background:"#fff",color:"#374151",fontSize:"12px",cursor:"pointer",alignSelf:"flex-start"},children:"Generate another"})]})]})]})}const se=[{view:"ask",label:"Model Assistant",description:"Ask questions and propose edits"},{view:"sysml-generator",label:"SysML Generator",description:"Natural language → SysML v2"}];function de(){const t=v(n=>n.activeView),i=v(n=>n.setActiveView),f=t.type==="sysml-generator"?"sysml-generator":"ask";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"10px 16px",borderBottom:"1px solid #E5E7EB",background:"#fff",flexShrink:0,flexWrap:"wrap"},children:[e.jsxs("span",{style:{fontSize:"10px",fontWeight:700,color:"#065F46",textTransform:"uppercase",letterSpacing:"0.06em",display:"flex",alignItems:"center",gap:"4px",marginRight:"4px"},children:[e.jsx("span",{children:"✦"})," AI Tools"]}),se.map(n=>{const p=f===n.view;return e.jsx("button",{onClick:()=>i({type:n.view}),title:n.description,"aria-current":p?"page":void 0,style:{padding:"5px 12px",borderRadius:"6px",fontSize:"13px",fontWeight:p?600:400,cursor:"pointer",background:p?"#F0FDF9":"transparent",border:`1px solid ${p?"#A7F3D0":"transparent"}`,color:p?"#065F46":"#6B7280"},children:n.label},n.view)}),e.jsx("span",{style:{flex:1}}),e.jsx("span",{title:"Enabled by --experimental. Generated content is unreviewed and carries no design-control provenance.",style:{fontSize:"10px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:"#92400E",background:"#FEF3C7",border:"1px solid #FDE68A",borderRadius:"4px",padding:"2px 6px"},children:"Experimental"})]}),e.jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden"},children:f==="ask"?e.jsx(J,{}):e.jsx(re,{})})]})}export{de as AiWorkspace};
@@ -0,0 +1,39 @@
1
+ import{j as e}from"./reactflow-CsCqNKB-.js";import{a as s}from"./zustand-CrhqMOHB.js";import{u as B}from"./index-CVW92JY7.js";const I="memo.analysis.notebooks.v1",L="root",k={folders:[{id:L,name:"Notebooks"}],notebooks:[]};function R(){try{const n=localStorage.getItem(I);if(!n)return k;const o=JSON.parse(n);return!Array.isArray(o.folders)||!Array.isArray(o.notebooks)?k:o}catch{return k}}const _=[{template:"part-inventory",title:"Part inventory",description:"List part usages and their owners.",icon:"▦"},{template:"requirements-review",title:"Requirements review",description:"List requirements and their declared text.",icon:"☑"},{template:"ownership-tree",title:"Ownership tree",description:"Print the model hierarchy for review.",icon:"⌘"},{template:"syside-part-api",title:"Syside live model API",description:"Query typed PartUsage elements directly from SysML v2 files.",icon:"⌁"}];function O(n){switch(n){case"part-inventory":return[`# Part inventory from the current MEMO model snapshot
2
+ `,`parts = [element for element in elements if 'part' in (element.get('kind', '') + ' ' + element.get('construct', '')).lower()]
3
+ `,`[(part.get('shortId'), part.get('name'), part.get('kind')) for part in parts[:100]]
4
+ `];case"requirements-review":return[`# Requirements review from the current MEMO model snapshot
5
+ `,`requirements = [element for element in elements if 'requirement' in element.get('kind', '').lower()]
6
+ `,`[(requirement.get('shortId'), requirement.get('name'), requirement.get('documentation', ''))
7
+ `,` for requirement in requirements[:100]]
8
+ `];case"ownership-tree":return[`# Ownership/containment relationships in the current model
9
+ `,`ownership = [relationship for relationship in relationships
10
+ `,` if any(term in relationship.get('type', '').lower() for term in ('contain', 'own', 'compose'))]
11
+ `,`[(relationship.get('sourceId'), relationship.get('targetId'), relationship.get('type'))
12
+ `,` for relationship in ownership[:100]]
13
+ `];case"syside-part-api":return[`# Licensed Syside Automator: query the textual SysML v2 model directly
14
+ `,`from pathlib import Path
15
+ `,`import syside
16
+ `,`
17
+ `,`MODEL_ROOT = Path('../model')
18
+ `,`sysml_paths = [str(path) for path in MODEL_ROOT.rglob('*.sysml')]
19
+ `,`# GPCA currently has semantic diagnostics, so use Syside’s tolerant loader.
20
+ `,`sysml_model, diagnostics = syside.try_load_model(sysml_paths)
21
+ `,`part_usages = list(sysml_model.elements(syside.PartUsage))
22
+ `,`print(f'Loaded {len(sysml_model.user_docs)} documents and {len(part_usages)} PartUsage elements')
23
+ `,`[(part.name, part.owner.name if part.owner else None) for part in part_usages[:100]]
24
+ `];default:return[`# Query the current MEMO model snapshot
25
+ `,`[(element.get('shortId'), element.get('name'), element.get('kind')) for element in elements[:100]]
26
+ `]}}function N(n,o,d){const i=new TextEncoder().encode(JSON.stringify(d));let c="";for(let l=0;l<i.length;l+=32768)c+=String.fromCharCode(...i.subarray(l,l+32768));const m=btoa(c);return{nbformat:4,nbformat_minor:5,metadata:{kernelspec:{display_name:"Python 3",language:"python",name:"python3"},language_info:{name:"python",version:"3.12"}},cells:[{cell_type:"markdown",metadata:{},source:[`# ${n}
27
+ `,`
28
+ `,`This live notebook was generated by MEMO Architect with a snapshot of the currently loaded model. The starter cells require only Python and run without a commercial license.
29
+ `,`
30
+ `,"> For direct textual SysML v2 access, add the optional licensed Syside Automator adapter after configuring `SYSIDE_LICENSE_KEY`.\n"]},{cell_type:"code",execution_count:null,metadata:{},outputs:[],source:[`import base64
31
+ `,`import json
32
+ `,`
33
+ `,`model = json.loads(base64.b64decode('${m}').decode('utf-8'))
34
+ `,`elements = list(model.get('elements', {}).values())
35
+ `,`relationships = list(model.get('relationships', []))
36
+ `,`print(f'Loaded {len(elements)} elements and {len(relationships)} relationships')
37
+ `]},{cell_type:"code",execution_count:null,metadata:{},outputs:[],source:O(o)}]}}function S(n){return`${n.title.replace(/[^a-z0-9_-]+/gi,"-")||"memo-analysis"}.ipynb`}async function C(n,o){const d=S(n),i=N(n.title,n.template??"custom",o);if(!(await fetch(`http://127.0.0.1:8888/api/contents/${encodeURIComponent(d)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"notebook",format:"json",content:i})})).ok)throw new Error("JupyterLab is not available at 127.0.0.1:8888.")}async function M(n){const o=await fetch(`http://127.0.0.1:8888/api/contents/${encodeURIComponent(S(n))}?content=0`);if(o.status===404)return!1;if(!o.ok)throw new Error("JupyterLab is not available at 127.0.0.1:8888.");return!0}function W(){var F;const n=B(t=>t.model),[o,d]=s.useState(R),[i,c]=s.useState(L),[m,l]=s.useState(()=>{var t;return((t=R().notebooks.at(-1))==null?void 0:t.id)??null}),[j,y]=s.useState(null),[w,u]=s.useState(null);s.useEffect(()=>{localStorage.setItem(I,JSON.stringify(o))},[o]);const E=s.useMemo(()=>o.notebooks.filter(t=>t.folderId===i),[o.notebooks,i]),r=o.notebooks.find(t=>t.id===m)??null;s.useEffect(()=>{r&&(u(null),y(null),M(r).then(t=>t?u(r.id):C(r,n).then(()=>u(r.id))).catch(t=>y(t.message)))},[m]);function D(){const t=window.prompt("Folder name");if(!(t!=null&&t.trim()))return;const a={id:`folder-${crypto.randomUUID()}`,name:t.trim()};d(f=>({...f,folders:[...f.folders,a]})),c(a.id)}function g(t="custom",a="Model analysis",f=!0){const x=f?window.prompt("Notebook title",a):a;if(!(x!=null&&x.trim()))return;const v=x.trim(),A=o.notebooks.filter(p=>p.title===v).length,T=A?`${v} ${A+1}`:v,b={id:`notebook-${crypto.randomUUID()}`,title:T,folderId:i,createdAt:Date.now(),template:t};d(p=>({...p,notebooks:[...p.notebooks,b]})),l(b.id),u(null),y(null),C(b,n).then(()=>u(b.id)).catch(p=>y(p.message))}const h={border:"1px solid #BFE6D9",background:"#F2FCF8",color:"#176B55",borderRadius:6,padding:"7px 10px",cursor:"pointer",fontSize:12,fontWeight:600};return e.jsxs("div",{className:"flex flex-1 overflow-hidden",style:{background:"#F7F7F5"},children:[e.jsxs("aside",{style:{width:280,flexShrink:0,borderRight:"1px solid #D9E2E7",background:"#FFF",padding:16,overflow:"auto"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:14},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:700,color:"#173B4E"},children:"Jupyter notebooks"}),e.jsx("div",{style:{fontSize:12,color:"#71889A",marginTop:3},children:"Python analysis workspace"})]}),e.jsx("button",{title:"New folder",onClick:D,style:h,children:"+ Folder"})]}),e.jsx("div",{style:{marginBottom:14},children:o.folders.map(t=>e.jsxs("button",{onClick:()=>c(t.id),style:{display:"block",width:"100%",textAlign:"left",border:"none",borderRadius:6,padding:"8px 10px",cursor:"pointer",background:i===t.id?"#E2F7F0":"transparent",color:"#1B3A4B",fontWeight:i===t.id?700:500},children:["▾  ",t.name]},t.id))}),e.jsx("button",{onClick:()=>g(),style:{...h,width:"100%",marginBottom:12},children:"+ New notebook"}),e.jsxs("div",{style:{borderTop:"1px solid #E3ECEF",margin:"4px 0 10px",paddingTop:12},children:[e.jsx("div",{style:{color:"#71889A",fontSize:10,fontWeight:700,letterSpacing:".07em",textTransform:"uppercase",margin:"0 0 7px 10px"},children:"Starter examples"}),_.map(t=>e.jsxs("button",{onClick:()=>g(t.template,t.title,!1),title:t.description,style:{display:"block",width:"100%",textAlign:"left",border:"none",borderRadius:6,padding:"8px 10px",cursor:"pointer",background:"transparent",color:"#244D63",fontSize:12},children:[e.jsx("span",{style:{color:"#2D8D70",marginRight:7},children:t.icon}),t.title]},t.template))]}),E.map(t=>e.jsxs("button",{onClick:()=>l(t.id),style:{display:"block",width:"100%",textAlign:"left",border:"none",borderRadius:6,padding:"9px 10px",cursor:"pointer",background:m===t.id?"#EEF7FB":"transparent",color:"#244D63",fontSize:13},children:["◫  ",t.title]},t.id)),E.length===0&&e.jsx("div",{style:{color:"#8AA0AE",fontSize:12,lineHeight:1.5,padding:"8px 10px"},children:"No notebooks in this folder yet."})]}),e.jsx("main",{style:{flex:1,minWidth:0,overflow:"auto",padding:"32px clamp(24px, 5vw, 72px)"},children:e.jsxs("div",{style:{maxWidth:960},children:[e.jsxs("div",{style:{display:"flex",alignItems:"start",justifyContent:"space-between",gap:20,marginBottom:26},children:[e.jsxs("div",{children:[e.jsx("div",{style:{color:"#2D8D70",fontSize:12,fontWeight:700,letterSpacing:".08em",textTransform:"uppercase"},children:"Model analysis"}),e.jsx("h1",{style:{color:"#173B4E",fontSize:28,margin:"6px 0 8px"},children:"Analysis"}),e.jsx("p",{style:{color:"#587487",margin:0,lineHeight:1.55,maxWidth:620},children:"Create live Jupyter notebooks that query the currently loaded MEMO model with Python. A licensed Syside adapter can be added for direct textual SysML v2 access."})]}),e.jsx("button",{onClick:()=>g(),style:{...h,whiteSpace:"nowrap"},children:"+ New notebook"})]}),e.jsx("section",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(210px, 1fr))",gap:12,marginBottom:24},children:[["Elements",Object.keys((n==null?void 0:n.elements)??{}).length],["Relationships",((F=n==null?void 0:n.relationships)==null?void 0:F.length)??0],["Kernel","Python 3.12"]].map(([t,a])=>e.jsxs("div",{style:{background:"#FFF",border:"1px solid #D9E6E9",borderRadius:10,padding:"15px 17px"},children:[e.jsx("div",{style:{color:"#7892A1",fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:".06em"},children:t}),e.jsx("div",{style:{color:"#173B4E",fontSize:20,fontWeight:700,marginTop:5},children:a})]},String(t)))}),e.jsxs("section",{style:{marginBottom:24},children:[e.jsx("div",{style:{color:"#587487",fontSize:12,fontWeight:700,textTransform:"uppercase",letterSpacing:".06em",marginBottom:9},children:"Starter notebooks"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(210px, 1fr))",gap:12},children:_.map(t=>e.jsxs("button",{onClick:()=>g(t.template,t.title,!1),style:{textAlign:"left",background:"#FFF",border:"1px solid #D9E6E9",borderRadius:10,padding:16,cursor:"pointer",color:"#173B4E"},children:[e.jsx("div",{style:{fontSize:20,color:"#2D8D70",marginBottom:8},children:t.icon}),e.jsx("div",{style:{fontWeight:700,fontSize:14},children:t.title}),e.jsx("div",{style:{color:"#7892A1",fontSize:12,lineHeight:1.45,marginTop:4},children:t.description})]},t.template))})]}),e.jsx("section",{style:{background:"#FFF",border:"1px solid #D9E6E9",borderRadius:10,padding:20},children:r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16,alignItems:"center"},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{margin:0,color:"#173B4E",fontSize:18},children:r.title}),e.jsx("div",{style:{color:"#7892A1",fontSize:12,marginTop:5},children:w===r.id?"Saved and ready in local JupyterLab":"Preparing live notebook…"})]}),w===r.id?e.jsx("a",{href:`http://127.0.0.1:8888/lab/tree/${encodeURIComponent(S(r))}`,target:"_blank",rel:"noopener noreferrer",style:{...h,textDecoration:"none"},children:"▶ Open live JupyterLab"}):e.jsx("button",{disabled:!0,style:{...h,opacity:.55,cursor:"wait"},children:"Preparing…"})]}),j&&e.jsx("div",{style:{color:"#B45309",fontSize:12,marginTop:10},children:j}),e.jsx("pre",{style:{whiteSpace:"pre-wrap",margin:"18px 0 0",padding:14,borderRadius:7,background:"#102A3A",color:"#BDEFE1",fontSize:12,lineHeight:1.55},children:`elements = list(model.get('elements', {}).values())
38
+ parts = [e for e in elements if 'part' in (e.get('kind', '') + ' ' + e.get('construct', '')).lower()]
39
+ [(p.get('shortId'), p.get('name'), p.get('kind')) for p in parts[:100]]`})]}):e.jsxs("div",{style:{color:"#587487",lineHeight:1.6},children:[e.jsx("strong",{style:{color:"#173B4E"},children:"Start an analysis notebook."}),e.jsx("br",{}),"Choose a starter to create it instantly, then open it in live JupyterLab."]})})]})})]})}export{W as AnalysisWorkspace};
@@ -1 +1 @@
1
- import{j as e}from"./reactflow-CsCqNKB-.js";import{a as g}from"./zustand-CrhqMOHB.js";import{u as j,f as k}from"./index-BMgENwvO.js";const C=[{id:"iso-14971",name:"ISO 14971",description:"Risk Management for Medical Devices",steps:[{id:"hazard-identification",label:"Hazard Identification",description:"Identify hazards and hazardous situations"},{id:"risk-estimation",label:"Risk Estimation",description:"Estimate severity and probability for each hazardous situation"},{id:"control-measures",label:"Risk Controls",description:"Define risk control measures and link to hazards"},{id:"verification",label:"Verification",description:"Verify risk control effectiveness"},{id:"summary",label:"Summary",description:"Review compliance status"}],requiredKinds:["Hazard","HazardousSituation","Harm","RiskControlMeasure"],requiredRelationships:["causes","leadsTo","mitigates"]},{id:"iec-62304",name:"IEC 62304",description:"Software Lifecycle for Medical Devices",steps:[{id:"hazard-identification",label:"Software Items",description:"Identify software items and their safety classification"},{id:"risk-estimation",label:"Architecture",description:"Review software architecture decomposition"},{id:"control-measures",label:"Requirements Tracing",description:"Trace software requirements to system requirements"},{id:"verification",label:"Verification",description:"Verify test coverage for software items"},{id:"summary",label:"Summary",description:"Review compliance status"}],requiredKinds:["SoftwareComponent","SoftwareModule","Requirement","Test"],requiredRelationships:["decomposedBy","traceTo","verify"]}];function w(i){if(!i)return[];const d=Object.values(i.elements),a=[],o=d.filter(n=>n.kind==="Hazard"),l=d.filter(n=>n.kind==="HazardousSituation"),u=d.filter(n=>n.kind==="Harm"),p=d.filter(n=>n.kind==="RiskControlMeasure");a.push({label:"Hazards identified",status:o.length>0?"pass":"fail",detail:`${o.length} hazards found`,elementIds:o.map(n=>n.id)}),a.push({label:"Hazardous situations linked",status:l.length>0?"pass":"warning",detail:`${l.length} hazardous situations`,elementIds:l.map(n=>n.id)}),a.push({label:"Harms documented",status:u.length>0?"pass":"warning",detail:`${u.length} harms identified`,elementIds:u.map(n=>n.id)});const c=new Set(i.relationships.filter(n=>n.type==="mitigates").map(n=>n.targetId)),t=o.filter(n=>!c.has(n.id));a.push({label:"Risk controls applied",status:t.length===0&&o.length>0?"pass":t.length>0?"fail":"warning",detail:t.length>0?`${t.length} hazards without controls`:`${p.length} controls applied`,elementIds:t.map(n=>n.id)});const h=new Set(i.relationships.filter(n=>n.type==="verify").map(n=>n.targetId)),f=p.filter(n=>!h.has(n.id));return a.push({label:"Controls verified",status:f.length===0&&p.length>0?"pass":f.length>0?"warning":"fail",detail:f.length>0?`${f.length} controls not verified`:`All ${p.length} controls verified`,elementIds:f.map(n=>n.id)}),a}function E(i){if(!i)return[];const d=Object.values(i.elements),a=[],o=d.filter(t=>t.kind==="SoftwareComponent"||t.kind==="SoftwareModule"),l=d.filter(t=>t.kind==="Requirement"),u=d.filter(t=>t.kind==="Test");a.push({label:"Software items identified",status:o.length>0?"pass":"fail",detail:`${o.length} software items`,elementIds:o.map(t=>t.id)}),a.push({label:"Software requirements defined",status:l.length>0?"pass":"fail",detail:`${l.length} software requirements`,elementIds:l.map(t=>t.id)});const p=new Set(i.relationships.filter(t=>t.type==="traceTo").map(t=>t.sourceId)),c=l.filter(t=>!p.has(t.id));return a.push({label:"Requirements traced",status:c.length===0&&l.length>0?"pass":c.length>0?"warning":"fail",detail:c.length>0?`${c.length} requirements not traced`:"All requirements traced",elementIds:c.map(t=>t.id)}),a.push({label:"Test coverage",status:u.length>0?"pass":"warning",detail:`${u.length} tests defined`,elementIds:u.map(t=>t.id)}),a}function A(){const i=j(d=>d.availableOntologies);return g.useMemo(()=>{const d=new Map;for(const a of i)for(const o of a.layers)for(const l of o.kinds)l.standard&&d.set(l.standard,(d.get(l.standard)??0)+1);return Array.from(d.entries()).map(([a,o])=>({standard:a,label:a.replace(/_/g," ").replace(/\b\w/g,l=>l.toUpperCase()),kindCount:o})).sort((a,o)=>a.standard.localeCompare(o.standard))},[i])}function z(){const i=j(s=>s.model),d=j(s=>s.selectElement),[a,o]=g.useState(null),[l,u]=g.useState(0),p=A(),c=C.find(s=>s.id===a),t=c==null?void 0:c.steps[l],h=g.useMemo(()=>!a||!i?[]:a==="iso-14971"?w(i):a==="iec-62304"?E(i):[],[a,i]),f=h.filter(s=>s.status==="pass").length,n=h.length,x=n>0?Math.round(f/n*100):0,v={pass:"#2ECC71",warning:"#F39C12",fail:"#E74C3C"},N={pass:"✓",warning:"⚠",fail:"✗"},y=g.useMemo(()=>{if(!i||!t)return[];const s=Object.values(i.elements);switch(t.id){case"hazard-identification":return a==="iso-14971"?s.filter(r=>r.kind==="Hazard"||r.kind==="HazardousSituation"):s.filter(r=>r.kind==="SoftwareComponent"||r.kind==="SoftwareModule");case"risk-estimation":return a==="iso-14971"?s.filter(r=>r.kind==="HazardousSituation"||r.kind==="Harm"):s.filter(r=>r.kind==="SoftwareComponent"||r.kind==="Subsystem"||r.kind==="Component");case"control-measures":return a==="iso-14971"?s.filter(r=>r.kind==="RiskControlMeasure"):s.filter(r=>r.kind==="Requirement"||r.kind==="Requirement");case"verification":return s.filter(r=>r.kind==="Test");default:return[]}},[i,t,a]);return a?e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("div",{className:"w-64 flex flex-col overflow-hidden",style:{background:"#FFFFFF",borderRight:"1px solid #E5E5E0"},children:[e.jsxs("div",{className:"px-4 py-3",style:{background:"linear-gradient(135deg, #1B3A4B, #2D6A7A)"},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{o(null),u(0)},className:"text-xs px-1.5 py-0.5 rounded",style:{color:"rgba(255,255,255,0.6)",background:"rgba(255,255,255,0.1)"},children:"←"}),e.jsx("h2",{className:"text-sm font-bold tracking-wide",style:{color:"#2DD4A8"},children:c.name})]}),e.jsx("p",{className:"text-xs mt-0.5",style:{color:"rgba(255,255,255,0.6)"},children:c.description})]}),e.jsxs("div",{className:"px-4 py-3",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-xs font-medium",style:{color:"#374151"},children:"Compliance"}),e.jsxs("span",{className:"text-xs font-bold",style:{color:x>=80?"#2ECC71":x>=50?"#F39C12":"#E74C3C"},children:[x,"%"]})]}),e.jsx("div",{className:"w-full h-1.5 rounded-full",style:{background:"#F3F4F6"},children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${x}%`,background:x>=80?"#2ECC71":x>=50?"#F39C12":"#E74C3C"}})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto py-1",children:c.steps.map((s,r)=>{const m=l===r,b=r<l;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer mx-1 rounded-lg",style:{background:m?"#2DD4A818":"transparent",fontWeight:m?500:400},onMouseEnter:F=>{m||(F.currentTarget.style.background="#F0F0ED")},onMouseLeave:F=>{m||(F.currentTarget.style.background=m?"#2DD4A818":"transparent")},onClick:()=>u(r),children:[e.jsx("span",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs flex-shrink-0",style:{background:m?"#2DD4A8":b?"#2ECC7130":"#F3F4F6",color:m?"#FFFFFF":b?"#2ECC71":"#9CA3AF"},children:b?"✓":r+1}),e.jsx("span",{className:"text-xs",style:{color:m?"#1B3A4B":"#6B7280"},children:s.label})]},s.id)})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:e.jsx("div",{className:"max-w-3xl",children:t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[e.jsx("h2",{className:"text-lg font-semibold",style:{color:"#374151"},children:t.label}),e.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{background:"#F3F4F6",color:"#9CA3AF"},children:["Step ",l+1," of ",c.steps.length]})]}),e.jsx("p",{className:"text-sm mb-6",style:{color:"#9CA3AF"},children:t.description}),t.id==="summary"?e.jsx("div",{className:"space-y-2",children:h.map((s,r)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg",style:{background:"#FFFFFF",border:`1px solid ${v[s.status]}40`},children:[e.jsx("span",{className:"text-sm font-bold",style:{color:v[s.status]},children:N[s.status]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-xs font-medium",style:{color:"#374151"},children:s.label}),e.jsx("div",{className:"text-xs",style:{color:"#9CA3AF"},children:s.detail})]}),s.elementIds&&s.elementIds.length>0&&s.status!=="pass"&&e.jsx("button",{onClick:()=>d(s.elementIds[0]),className:"text-xs px-2 py-0.5 rounded",style:{background:"#4A90D915",color:"#4A90D9"},children:"View"})]},r))}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#6B7280"},children:["Relevant Elements (",y.length,")"]}),y.length===0&&e.jsx("div",{className:"p-4 rounded-lg text-center text-xs",style:{background:"#FEF2F2",border:"1px solid #FECACA",color:"#E74C3C"},children:"No elements found for this step. Create the required element types in your .sysml files."}),e.jsx("div",{className:"space-y-1",children:y.map(s=>{const r=i.relationships.filter(m=>m.sourceId===s.id||m.targetId===s.id);return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer text-xs",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},onMouseEnter:m=>m.currentTarget.style.background="#F0F0ED",onMouseLeave:m=>m.currentTarget.style.background="#FFFFFF",onClick:()=>d(s.id),children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:k[s.layer]||"#95A5A6"}}),e.jsx("span",{className:"font-medium flex-1 truncate",style:{color:"#374151"},children:s.name}),e.jsx("span",{className:"px-1.5 py-0.5 rounded",style:{background:(k[s.layer]||"#95A5A6")+"18",color:k[s.layer]||"#95A5A6"},children:s.kind}),e.jsxs("span",{style:{color:"#9CA3AF"},children:[r.length," rels"]})]},s.id)})})]})}),e.jsxs("div",{className:"flex items-center gap-2 mt-6 pt-4",style:{borderTop:"1px solid #E5E5E0"},children:[l>0&&e.jsxs("button",{onClick:()=>u(l-1),className:"px-4 py-2 text-xs rounded-lg",style:{background:"#F3F4F6",color:"#6B7280"},children:["←"," Previous"]}),e.jsx("div",{className:"flex-1"}),l<c.steps.length-1&&e.jsxs("button",{onClick:()=>u(l+1),className:"px-4 py-2 text-xs rounded-lg font-medium",style:{background:"#2DD4A8",color:"#FFFFFF"},children:["Next ","→"]})]})]})})})]}):e.jsx("div",{className:"flex-1 overflow-y-auto p-8",style:{background:"#F7F7F5"},children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsx("h2",{className:"text-lg font-semibold mb-1",style:{color:"#374151"},children:"Compliance Wizard"}),e.jsx("p",{className:"text-sm mb-6",style:{color:"#9CA3AF"},children:"Select a standard to walk through compliance requirements step by step."}),e.jsx("div",{className:"space-y-3",children:C.map(s=>e.jsxs("button",{onClick:()=>{o(s.id),u(0)},className:"w-full text-left p-4 rounded-lg transition-colors",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},onMouseEnter:r=>r.currentTarget.style.borderColor="#2DD4A8",onMouseLeave:r=>r.currentTarget.style.borderColor="#E5E5E0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-semibold",style:{color:"#1B3A4B"},children:s.name}),e.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{background:"#F3F4F6",color:"#6B7280"},children:[s.steps.length," steps"]})]}),e.jsx("p",{className:"text-xs mt-1",style:{color:"#6B7280"},children:s.description})]},s.id))}),p.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mt-8 mb-3",style:{color:"#6B7280"},children:"Discovered Standards"}),e.jsx("div",{className:"space-y-2",children:p.map(s=>e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"#7C3AED"}}),e.jsx("span",{className:"text-sm font-medium flex-1",style:{color:"#374151"},children:s.label}),e.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{background:"#F3F4F6",color:"#6B7280"},children:[s.kindCount," ",s.kindCount===1?"kind":"kinds"]})]},s.standard))})]})]})})}export{z as ComplianceWizard};
1
+ import{j as e}from"./reactflow-CsCqNKB-.js";import{a as g}from"./zustand-CrhqMOHB.js";import{u as j,f as k}from"./index-CVW92JY7.js";const C=[{id:"iso-14971",name:"ISO 14971",description:"Risk Management for Medical Devices",steps:[{id:"hazard-identification",label:"Hazard Identification",description:"Identify hazards and hazardous situations"},{id:"risk-estimation",label:"Risk Estimation",description:"Estimate severity and probability for each hazardous situation"},{id:"control-measures",label:"Risk Controls",description:"Define risk control measures and link to hazards"},{id:"verification",label:"Verification",description:"Verify risk control effectiveness"},{id:"summary",label:"Summary",description:"Review compliance status"}],requiredKinds:["Hazard","HazardousSituation","Harm","RiskControlMeasure"],requiredRelationships:["causes","leadsTo","mitigates"]},{id:"iec-62304",name:"IEC 62304",description:"Software Lifecycle for Medical Devices",steps:[{id:"hazard-identification",label:"Software Items",description:"Identify software items and their safety classification"},{id:"risk-estimation",label:"Architecture",description:"Review software architecture decomposition"},{id:"control-measures",label:"Requirements Tracing",description:"Trace software requirements to system requirements"},{id:"verification",label:"Verification",description:"Verify test coverage for software items"},{id:"summary",label:"Summary",description:"Review compliance status"}],requiredKinds:["SoftwareComponent","SoftwareModule","Requirement","Test"],requiredRelationships:["decomposedBy","traceTo","verify"]}];function w(i){if(!i)return[];const d=Object.values(i.elements),a=[],o=d.filter(n=>n.kind==="Hazard"),l=d.filter(n=>n.kind==="HazardousSituation"),u=d.filter(n=>n.kind==="Harm"),p=d.filter(n=>n.kind==="RiskControlMeasure");a.push({label:"Hazards identified",status:o.length>0?"pass":"fail",detail:`${o.length} hazards found`,elementIds:o.map(n=>n.id)}),a.push({label:"Hazardous situations linked",status:l.length>0?"pass":"warning",detail:`${l.length} hazardous situations`,elementIds:l.map(n=>n.id)}),a.push({label:"Harms documented",status:u.length>0?"pass":"warning",detail:`${u.length} harms identified`,elementIds:u.map(n=>n.id)});const c=new Set(i.relationships.filter(n=>n.type==="mitigates").map(n=>n.targetId)),t=o.filter(n=>!c.has(n.id));a.push({label:"Risk controls applied",status:t.length===0&&o.length>0?"pass":t.length>0?"fail":"warning",detail:t.length>0?`${t.length} hazards without controls`:`${p.length} controls applied`,elementIds:t.map(n=>n.id)});const h=new Set(i.relationships.filter(n=>n.type==="verify").map(n=>n.targetId)),f=p.filter(n=>!h.has(n.id));return a.push({label:"Controls verified",status:f.length===0&&p.length>0?"pass":f.length>0?"warning":"fail",detail:f.length>0?`${f.length} controls not verified`:`All ${p.length} controls verified`,elementIds:f.map(n=>n.id)}),a}function E(i){if(!i)return[];const d=Object.values(i.elements),a=[],o=d.filter(t=>t.kind==="SoftwareComponent"||t.kind==="SoftwareModule"),l=d.filter(t=>t.kind==="Requirement"),u=d.filter(t=>t.kind==="Test");a.push({label:"Software items identified",status:o.length>0?"pass":"fail",detail:`${o.length} software items`,elementIds:o.map(t=>t.id)}),a.push({label:"Software requirements defined",status:l.length>0?"pass":"fail",detail:`${l.length} software requirements`,elementIds:l.map(t=>t.id)});const p=new Set(i.relationships.filter(t=>t.type==="traceTo").map(t=>t.sourceId)),c=l.filter(t=>!p.has(t.id));return a.push({label:"Requirements traced",status:c.length===0&&l.length>0?"pass":c.length>0?"warning":"fail",detail:c.length>0?`${c.length} requirements not traced`:"All requirements traced",elementIds:c.map(t=>t.id)}),a.push({label:"Test coverage",status:u.length>0?"pass":"warning",detail:`${u.length} tests defined`,elementIds:u.map(t=>t.id)}),a}function A(){const i=j(d=>d.availableOntologies);return g.useMemo(()=>{const d=new Map;for(const a of i)for(const o of a.layers)for(const l of o.kinds)l.standard&&d.set(l.standard,(d.get(l.standard)??0)+1);return Array.from(d.entries()).map(([a,o])=>({standard:a,label:a.replace(/_/g," ").replace(/\b\w/g,l=>l.toUpperCase()),kindCount:o})).sort((a,o)=>a.standard.localeCompare(o.standard))},[i])}function z(){const i=j(s=>s.model),d=j(s=>s.selectElement),[a,o]=g.useState(null),[l,u]=g.useState(0),p=A(),c=C.find(s=>s.id===a),t=c==null?void 0:c.steps[l],h=g.useMemo(()=>!a||!i?[]:a==="iso-14971"?w(i):a==="iec-62304"?E(i):[],[a,i]),f=h.filter(s=>s.status==="pass").length,n=h.length,x=n>0?Math.round(f/n*100):0,v={pass:"#2ECC71",warning:"#F39C12",fail:"#E74C3C"},N={pass:"✓",warning:"⚠",fail:"✗"},y=g.useMemo(()=>{if(!i||!t)return[];const s=Object.values(i.elements);switch(t.id){case"hazard-identification":return a==="iso-14971"?s.filter(r=>r.kind==="Hazard"||r.kind==="HazardousSituation"):s.filter(r=>r.kind==="SoftwareComponent"||r.kind==="SoftwareModule");case"risk-estimation":return a==="iso-14971"?s.filter(r=>r.kind==="HazardousSituation"||r.kind==="Harm"):s.filter(r=>r.kind==="SoftwareComponent"||r.kind==="Subsystem"||r.kind==="Component");case"control-measures":return a==="iso-14971"?s.filter(r=>r.kind==="RiskControlMeasure"):s.filter(r=>r.kind==="Requirement"||r.kind==="Requirement");case"verification":return s.filter(r=>r.kind==="Test");default:return[]}},[i,t,a]);return a?e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("div",{className:"w-64 flex flex-col overflow-hidden",style:{background:"#FFFFFF",borderRight:"1px solid #E5E5E0"},children:[e.jsxs("div",{className:"px-4 py-3",style:{background:"linear-gradient(135deg, #1B3A4B, #2D6A7A)"},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{o(null),u(0)},className:"text-xs px-1.5 py-0.5 rounded",style:{color:"rgba(255,255,255,0.6)",background:"rgba(255,255,255,0.1)"},children:"←"}),e.jsx("h2",{className:"text-sm font-bold tracking-wide",style:{color:"#2DD4A8"},children:c.name})]}),e.jsx("p",{className:"text-xs mt-0.5",style:{color:"rgba(255,255,255,0.6)"},children:c.description})]}),e.jsxs("div",{className:"px-4 py-3",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-xs font-medium",style:{color:"#374151"},children:"Compliance"}),e.jsxs("span",{className:"text-xs font-bold",style:{color:x>=80?"#2ECC71":x>=50?"#F39C12":"#E74C3C"},children:[x,"%"]})]}),e.jsx("div",{className:"w-full h-1.5 rounded-full",style:{background:"#F3F4F6"},children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${x}%`,background:x>=80?"#2ECC71":x>=50?"#F39C12":"#E74C3C"}})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto py-1",children:c.steps.map((s,r)=>{const m=l===r,b=r<l;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer mx-1 rounded-lg",style:{background:m?"#2DD4A818":"transparent",fontWeight:m?500:400},onMouseEnter:F=>{m||(F.currentTarget.style.background="#F0F0ED")},onMouseLeave:F=>{m||(F.currentTarget.style.background=m?"#2DD4A818":"transparent")},onClick:()=>u(r),children:[e.jsx("span",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs flex-shrink-0",style:{background:m?"#2DD4A8":b?"#2ECC7130":"#F3F4F6",color:m?"#FFFFFF":b?"#2ECC71":"#9CA3AF"},children:b?"✓":r+1}),e.jsx("span",{className:"text-xs",style:{color:m?"#1B3A4B":"#6B7280"},children:s.label})]},s.id)})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:e.jsx("div",{className:"max-w-3xl",children:t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[e.jsx("h2",{className:"text-lg font-semibold",style:{color:"#374151"},children:t.label}),e.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{background:"#F3F4F6",color:"#9CA3AF"},children:["Step ",l+1," of ",c.steps.length]})]}),e.jsx("p",{className:"text-sm mb-6",style:{color:"#9CA3AF"},children:t.description}),t.id==="summary"?e.jsx("div",{className:"space-y-2",children:h.map((s,r)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg",style:{background:"#FFFFFF",border:`1px solid ${v[s.status]}40`},children:[e.jsx("span",{className:"text-sm font-bold",style:{color:v[s.status]},children:N[s.status]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-xs font-medium",style:{color:"#374151"},children:s.label}),e.jsx("div",{className:"text-xs",style:{color:"#9CA3AF"},children:s.detail})]}),s.elementIds&&s.elementIds.length>0&&s.status!=="pass"&&e.jsx("button",{onClick:()=>d(s.elementIds[0]),className:"text-xs px-2 py-0.5 rounded",style:{background:"#4A90D915",color:"#4A90D9"},children:"View"})]},r))}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#6B7280"},children:["Relevant Elements (",y.length,")"]}),y.length===0&&e.jsx("div",{className:"p-4 rounded-lg text-center text-xs",style:{background:"#FEF2F2",border:"1px solid #FECACA",color:"#E74C3C"},children:"No elements found for this step. Create the required element types in your .sysml files."}),e.jsx("div",{className:"space-y-1",children:y.map(s=>{const r=i.relationships.filter(m=>m.sourceId===s.id||m.targetId===s.id);return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer text-xs",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},onMouseEnter:m=>m.currentTarget.style.background="#F0F0ED",onMouseLeave:m=>m.currentTarget.style.background="#FFFFFF",onClick:()=>d(s.id),children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:k[s.layer]||"#95A5A6"}}),e.jsx("span",{className:"font-medium flex-1 truncate",style:{color:"#374151"},children:s.name}),e.jsx("span",{className:"px-1.5 py-0.5 rounded",style:{background:(k[s.layer]||"#95A5A6")+"18",color:k[s.layer]||"#95A5A6"},children:s.kind}),e.jsxs("span",{style:{color:"#9CA3AF"},children:[r.length," rels"]})]},s.id)})})]})}),e.jsxs("div",{className:"flex items-center gap-2 mt-6 pt-4",style:{borderTop:"1px solid #E5E5E0"},children:[l>0&&e.jsxs("button",{onClick:()=>u(l-1),className:"px-4 py-2 text-xs rounded-lg",style:{background:"#F3F4F6",color:"#6B7280"},children:["←"," Previous"]}),e.jsx("div",{className:"flex-1"}),l<c.steps.length-1&&e.jsxs("button",{onClick:()=>u(l+1),className:"px-4 py-2 text-xs rounded-lg font-medium",style:{background:"#2DD4A8",color:"#FFFFFF"},children:["Next ","→"]})]})]})})})]}):e.jsx("div",{className:"flex-1 overflow-y-auto p-8",style:{background:"#F7F7F5"},children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsx("h2",{className:"text-lg font-semibold mb-1",style:{color:"#374151"},children:"Compliance Wizard"}),e.jsx("p",{className:"text-sm mb-6",style:{color:"#9CA3AF"},children:"Select a standard to walk through compliance requirements step by step."}),e.jsx("div",{className:"space-y-3",children:C.map(s=>e.jsxs("button",{onClick:()=>{o(s.id),u(0)},className:"w-full text-left p-4 rounded-lg transition-colors",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},onMouseEnter:r=>r.currentTarget.style.borderColor="#2DD4A8",onMouseLeave:r=>r.currentTarget.style.borderColor="#E5E5E0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-semibold",style:{color:"#1B3A4B"},children:s.name}),e.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{background:"#F3F4F6",color:"#6B7280"},children:[s.steps.length," steps"]})]}),e.jsx("p",{className:"text-xs mt-1",style:{color:"#6B7280"},children:s.description})]},s.id))}),p.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mt-8 mb-3",style:{color:"#6B7280"},children:"Discovered Standards"}),e.jsx("div",{className:"space-y-2",children:p.map(s=>e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"#7C3AED"}}),e.jsx("span",{className:"text-sm font-medium flex-1",style:{color:"#374151"},children:s.label}),e.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{background:"#F3F4F6",color:"#6B7280"},children:[s.kindCount," ",s.kindCount===1?"kind":"kinds"]})]},s.standard))})]})]})})}export{z as ComplianceWizard};
@@ -1 +1 @@
1
- import{j as s}from"./reactflow-CsCqNKB-.js";import{a as b}from"./zustand-CrhqMOHB.js";import{u as C,f as _,R as v}from"./index-BMgENwvO.js";const U=["Function","Function","ActionDefinition","ActionUsage"],H=["flow","decomposedBy","composedOf","allocateTo","succession"];function K(o,c){const m=new Set((c==null?void 0:c.kinds)??U),u=new Set((c==null?void 0:c.relationshipTypes)??H),p=(c==null?void 0:c.cluster)??!0,d=[];for(const e of Object.values(o.elements))m.has(e.kind)&&d.push(e);d.sort((e,h)=>{const g=e.kind.localeCompare(h.kind);return g!==0?g:e.name.localeCompare(h.name)});const a=d.map(e=>e.id),f=new Map;for(let e=0;e<a.length;e++)f.set(a[e],e);const r=a.length,y={};for(const e of d)y[e.id]={name:e.name,kind:e.kind,layer:e.layer,allocatedTo:e.allocatedTo};const l=Array.from({length:r},()=>Array.from({length:r},()=>null));let t=0;for(const e of o.relationships){if(!u.has(e.type))continue;const h=f.get(e.sourceId),g=f.get(e.targetId);if(h===void 0||g===void 0||h===g)continue;let F=l[h][g];F||(F={count:0,types:[],flowItems:[]},l[h][g]=F),F.count++,F.types.includes(e.type)||F.types.push(e.type),e.flowItem&&!F.flowItems.includes(e.flowItem)&&F.flowItems.push(e.flowItem),t++}const i=p?Y(a,l):new Map;return{elementIds:a,elements:y,matrix:l,clusters:i,totalDependencies:t}}function Y(o,c){const m=o.length,u=Array.from({length:m},(l,t)=>t),p=new Array(m).fill(0);function d(l){return u[l]!==l&&(u[l]=d(u[l])),u[l]}function a(l,t){const i=d(l),e=d(t);i!==e&&(p[i]<p[e]?u[i]=e:p[i]>p[e]?u[e]=i:(u[e]=i,p[i]++))}for(let l=0;l<m;l++)for(let t=0;t<m;t++)l!==t&&(c[l][t]||c[t][l])&&a(l,t);const f=new Map;for(let l=0;l<m;l++){const t=d(l);f.has(t)||f.set(t,[]),f.get(t).push(o[l])}const r=new Map;let y=0;for(const l of f.values())r.set(y++,l);return r}function P(o){const c=[],m=new Set;for(const[,a]of o.clusters)for(const f of a)m.has(f)||(c.push(f),m.add(f));for(const a of o.elementIds)m.has(a)||c.push(a);const u=c.length,p=new Map;for(let a=0;a<o.elementIds.length;a++)p.set(o.elementIds[a],a);const d=Array.from({length:u},()=>Array.from({length:u},()=>null));for(let a=0;a<u;a++)for(let f=0;f<u;f++)d[a][f]=o.matrix[p.get(c[a])][p.get(c[f])];return{...o,elementIds:c,matrix:d}}const R=new Set(["Function","Function","UserActivity"]),z=new Set(["System","Subsystem","Component","LogicalComponent","SoftwareComponent","SoftwareModule","Software"]);function V(o){var y,l;const c=[],m=[];for(const t of Object.values(o.elements))R.has(t.kind)&&c.push(t),z.has(t.kind)&&m.push(t);const u=[],p=new Set,d=new Map;for(const t of m)d.set(t.id,[]);for(const t of o.relationships){if(t.type!=="allocateTo")continue;const i=o.elements[t.sourceId],e=o.elements[t.targetId];!i||!e||R.has(i.kind)&&z.has(e.kind)&&(u.push({functionId:i.id,functionName:i.name,targetId:e.id,targetName:e.name}),p.add(i.id),d.has(e.id)||d.set(e.id,[]),d.get(e.id).push(i.id))}for(const t of c)if(t.allocatedTo&&!p.has(t.id)){const i=m.find(e=>e.name===t.allocatedTo||e.id===t.allocatedTo);i&&(u.push({functionId:t.id,functionName:t.name,targetId:i.id,targetName:i.name}),p.add(t.id),d.has(i.id)||d.set(i.id,[]),d.get(i.id).push(t.id))}const a=[];let f=0;for(const t of c)p.has(t.id)||a.push({id:`ci-${f++}`,type:"unallocated-function",severity:"warning",elementId:t.id,elementName:t.name,message:`Function "${t.name}" is not allocated to any component`});for(const t of m){const i=d.get(t.id);(!i||i.length===0)&&a.push({id:`ci-${f++}`,type:"no-functions-allocated",severity:"info",elementId:t.id,elementName:t.name,message:`Component "${t.name}" has no functions allocated to it`})}const r=new Map;for(const t of u)r.set(t.functionId,t.targetId);for(const t of o.relationships){if(t.type!=="flow")continue;const i=r.get(t.sourceId),e=r.get(t.targetId);if(i&&e&&i!==e){const h=o.elements[t.sourceId],g=o.elements[t.targetId];h&&g&&a.push({id:`ci-${f++}`,type:"cross-component-flow",severity:"info",elementId:t.sourceId,elementName:h.name,message:`Flow from "${h.name}" to "${g.name}" crosses component boundary (${(y=o.elements[i])==null?void 0:y.name} → ${(l=o.elements[e])==null?void 0:l.name})`,relatedIds:[t.targetId,i,e]})}}return{allocations:u,componentFunctions:d,issues:a,functions:c,structures:m}}function N(o){for(const c of o.types)if(v[c])return v[c];return"#6B7280"}function Z(o){const c=N(o),m=Math.min(.15+o.count*.15,.6);return`${c}${Math.round(m*255).toString(16).padStart(2,"0")}`}const E=36,D=160;function Q(){const o=C(n=>n.model),c=C(n=>n.selectElement),m=C(n=>n.selectedElementId),u=C(n=>n.setAnalysisIssues),[p,d]=b.useState(!0),[a,f]=b.useState(!1),[r,y]=b.useState(null),[l,t]=b.useState("functional"),i=b.useMemo(()=>{switch(l){case"functional":return["Function","Function"];case"behavior":return["ActionDefinition","ActionUsage"];case"all":return["Function","Function","ActionDefinition","ActionUsage"]}},[l]),e=b.useMemo(()=>{if(!o)return null;const n=K(o,{kinds:i});return p?P(n):n},[o,p,i]),h=b.useMemo(()=>o?V(o):null,[o]);b.useEffect(()=>{if(h)return u(h.issues.map(n=>({id:n.id,source:"DSM",severity:n.severity,elementId:n.elementId,elementName:n.elementName,message:n.message,tag:n.type==="unallocated-function"?"unallocated":n.type==="cross-component-flow"?"cross-boundary":"no functions"}))),()=>u([])},[h,u]);const g=b.useCallback((n,x)=>{y({row:n,col:x})},[]),F=b.useCallback(()=>{y(null)},[]);if(!o||!e)return s.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:"#9CA3AF"},children:s.jsx("p",{children:"No model loaded"})});if(e.elementIds.length===0)return s.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:s.jsxs("div",{className:"text-center",style:{maxWidth:"320px"},children:[s.jsx("div",{style:{fontSize:"40px",marginBottom:"16px",opacity:.4},children:"▤"}),s.jsx("h3",{style:{fontSize:"15px",fontWeight:600,color:"#374151",marginBottom:"8px"},children:"No Functional Elements"}),s.jsx("p",{style:{fontSize:"13px",color:"#9CA3AF",lineHeight:1.6},children:"Add Function or Function elements to your model to see the DSM."})]})});const B=e.elementIds.length,k=new Set;if(p&&e.clusters.size>1){let n=0;for(const[,x]of e.clusters)n+=x.length,n<B&&k.add(n)}const j=r?(()=>{const n=e.matrix[r.row][r.col],x=e.elements[e.elementIds[r.row]],w=e.elements[e.elementIds[r.col]];return{cell:n,rowEl:x,colEl:w}})():null;return s.jsxs("div",{className:"flex-1 flex flex-col",style:{background:"#F7F7F5"},children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-2",style:{borderBottom:"1px solid #E5E5E0",background:"#FFFFFF"},children:[s.jsx("span",{style:{fontSize:"13px",fontWeight:600,color:"#374151"},children:"Design Structure Matrix"}),s.jsxs("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:[B," elements, ",e.totalDependencies," dependencies"]}),s.jsx("div",{className:"flex-1"}),s.jsx("div",{className:"flex rounded overflow-hidden",style:{border:"1px solid #E5E5E0"},children:["functional","behavior","all"].map(n=>s.jsx("button",{onClick:()=>t(n),className:"px-2 py-0.5 text-xs font-medium",style:{background:l===n?"#1B3A4B":"#FFFFFF",color:l===n?"#FFFFFF":"#6B7280"},children:n==="functional"?"Functions":n==="behavior"?"Behavior":"All"},n))}),s.jsxs("label",{className:"flex items-center gap-1.5 text-xs",style:{color:"#6B7280"},children:[s.jsx("input",{type:"checkbox",checked:p,onChange:n=>d(n.target.checked),style:{accentColor:"#2DD4A8"}}),"Cluster"]}),s.jsxs("label",{className:"flex items-center gap-1.5 text-xs",style:{color:"#6B7280"},children:[s.jsx("input",{type:"checkbox",checked:a,onChange:n=>f(n.target.checked),style:{accentColor:"#E67E22"}}),"Allocation"]})]}),s.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[s.jsxs("div",{style:{display:"inline-block",position:"relative"},children:[s.jsx("div",{style:{display:"flex",marginLeft:D,marginBottom:"4px"},children:e.elementIds.map((n,x)=>{const w=e.elements[n],A=(r==null?void 0:r.col)===x;return s.jsx("div",{style:{width:E,height:D-20,position:"relative",borderRight:k.has(x+1)?"2px solid #2DD4A8":void 0},children:s.jsx("div",{style:{position:"absolute",bottom:0,left:E/2,transformOrigin:"bottom left",transform:"rotate(-60deg)",whiteSpace:"nowrap",fontSize:"11px",fontWeight:A?600:400,color:A?"#1a1a1a":"#6B7280",cursor:"pointer"},onClick:()=>c(n),children:w.name})},n)})}),e.elementIds.map((n,x)=>{const w=e.elements[n],A=(r==null?void 0:r.row)===x,M=m===n,L=k.has(x);return s.jsxs("div",{style:{display:"flex",alignItems:"center",borderTop:L?"2px solid #2DD4A8":void 0},children:[s.jsxs("div",{style:{width:D,paddingRight:"8px",fontSize:"11px",fontWeight:A||M?600:400,color:A||M?"#1a1a1a":"#6B7280",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textAlign:"right",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"6px",height:E},onClick:()=>c(n),title:`${w.name} (${w.kind})`,children:[a&&w.allocatedTo&&s.jsx("span",{style:{fontSize:"9px",padding:"1px 4px",borderRadius:"3px",background:"#E67E2220",color:"#E67E22",fontWeight:500},children:w.allocatedTo}),s.jsx("span",{style:{width:"3px",height:"14px",borderRadius:"2px",background:_[w.layer]||"#9CA3AF",flexShrink:0}}),w.name]}),e.elementIds.map(($,I)=>{const S=e.matrix[x][I],T=x===I,W=(r==null?void 0:r.row)===x&&(r==null?void 0:r.col)===I,O=(r==null?void 0:r.row)===x||(r==null?void 0:r.col)===I;return s.jsx("div",{onMouseEnter:()=>g(x,I),onMouseLeave:F,onClick:()=>{S&&c(n)},style:{width:E,height:E,border:"1px solid #E5E5E0",borderRight:k.has(I+1)?"2px solid #2DD4A8":"1px solid #E5E5E0",background:T?"#F3F4F6":S?Z(S):O?"#FAFAFA":"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",cursor:S?"pointer":"default",transition:"background 100ms ease",outline:W&&S?`2px solid ${N(S)}`:void 0,outlineOffset:"-2px"},children:S&&!T&&s.jsx("span",{style:{fontSize:"10px",fontWeight:600,color:N(S)},children:S.count>1?S.count:"●"})},$)})]},n)})]}),(j==null?void 0:j.cell)&&s.jsxs("div",{style:{position:"fixed",bottom:"80px",right:"20px",background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"8px",padding:"12px 16px",boxShadow:"0 4px 16px rgba(0,0,0,0.12)",fontSize:"12px",zIndex:100,maxWidth:"280px"},children:[s.jsx("div",{style:{fontWeight:600,color:"#1a1a1a",marginBottom:"6px"},children:j.rowEl.name}),s.jsxs("div",{style:{color:"#6B7280",marginBottom:"4px"},children:["→"," ",j.colEl.name]}),s.jsx("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap"},children:j.cell.types.map(n=>s.jsx("span",{style:{fontSize:"10px",padding:"2px 6px",borderRadius:"4px",background:(v[n]||"#6B7280")+"20",color:v[n]||"#6B7280",fontWeight:500},children:n},n))}),j.cell.flowItems.length>0&&s.jsxs("div",{style:{marginTop:"4px",color:"#9CA3AF",fontSize:"11px"},children:["Items: ",j.cell.flowItems.join(", ")]})]}),s.jsxs("div",{style:{marginTop:"20px",display:"flex",gap:"16px",flexWrap:"wrap",fontSize:"11px",color:"#6B7280"},children:[["flow","decomposedBy","composedOf","allocateTo","succession"].map(n=>s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[s.jsx("span",{style:{width:"10px",height:"10px",borderRadius:"2px",background:v[n]||"#6B7280"}}),n]},n)),p&&e.clusters.size>1&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[s.jsx("span",{style:{width:"10px",height:"2px",background:"#2DD4A8"}}),"cluster boundary"]})]})]})]})}export{Q as DSMView};
1
+ import{j as s}from"./reactflow-CsCqNKB-.js";import{a as b}from"./zustand-CrhqMOHB.js";import{u as C,f as _,R as v}from"./index-CVW92JY7.js";const U=["Function","Function","ActionDefinition","ActionUsage"],H=["flow","decomposedBy","composedOf","allocateTo","succession"];function K(o,c){const m=new Set((c==null?void 0:c.kinds)??U),u=new Set((c==null?void 0:c.relationshipTypes)??H),p=(c==null?void 0:c.cluster)??!0,d=[];for(const e of Object.values(o.elements))m.has(e.kind)&&d.push(e);d.sort((e,h)=>{const g=e.kind.localeCompare(h.kind);return g!==0?g:e.name.localeCompare(h.name)});const a=d.map(e=>e.id),f=new Map;for(let e=0;e<a.length;e++)f.set(a[e],e);const r=a.length,y={};for(const e of d)y[e.id]={name:e.name,kind:e.kind,layer:e.layer,allocatedTo:e.allocatedTo};const l=Array.from({length:r},()=>Array.from({length:r},()=>null));let t=0;for(const e of o.relationships){if(!u.has(e.type))continue;const h=f.get(e.sourceId),g=f.get(e.targetId);if(h===void 0||g===void 0||h===g)continue;let F=l[h][g];F||(F={count:0,types:[],flowItems:[]},l[h][g]=F),F.count++,F.types.includes(e.type)||F.types.push(e.type),e.flowItem&&!F.flowItems.includes(e.flowItem)&&F.flowItems.push(e.flowItem),t++}const i=p?Y(a,l):new Map;return{elementIds:a,elements:y,matrix:l,clusters:i,totalDependencies:t}}function Y(o,c){const m=o.length,u=Array.from({length:m},(l,t)=>t),p=new Array(m).fill(0);function d(l){return u[l]!==l&&(u[l]=d(u[l])),u[l]}function a(l,t){const i=d(l),e=d(t);i!==e&&(p[i]<p[e]?u[i]=e:p[i]>p[e]?u[e]=i:(u[e]=i,p[i]++))}for(let l=0;l<m;l++)for(let t=0;t<m;t++)l!==t&&(c[l][t]||c[t][l])&&a(l,t);const f=new Map;for(let l=0;l<m;l++){const t=d(l);f.has(t)||f.set(t,[]),f.get(t).push(o[l])}const r=new Map;let y=0;for(const l of f.values())r.set(y++,l);return r}function P(o){const c=[],m=new Set;for(const[,a]of o.clusters)for(const f of a)m.has(f)||(c.push(f),m.add(f));for(const a of o.elementIds)m.has(a)||c.push(a);const u=c.length,p=new Map;for(let a=0;a<o.elementIds.length;a++)p.set(o.elementIds[a],a);const d=Array.from({length:u},()=>Array.from({length:u},()=>null));for(let a=0;a<u;a++)for(let f=0;f<u;f++)d[a][f]=o.matrix[p.get(c[a])][p.get(c[f])];return{...o,elementIds:c,matrix:d}}const R=new Set(["Function","Function","UserActivity"]),z=new Set(["System","Subsystem","Component","LogicalComponent","SoftwareComponent","SoftwareModule","Software"]);function V(o){var y,l;const c=[],m=[];for(const t of Object.values(o.elements))R.has(t.kind)&&c.push(t),z.has(t.kind)&&m.push(t);const u=[],p=new Set,d=new Map;for(const t of m)d.set(t.id,[]);for(const t of o.relationships){if(t.type!=="allocateTo")continue;const i=o.elements[t.sourceId],e=o.elements[t.targetId];!i||!e||R.has(i.kind)&&z.has(e.kind)&&(u.push({functionId:i.id,functionName:i.name,targetId:e.id,targetName:e.name}),p.add(i.id),d.has(e.id)||d.set(e.id,[]),d.get(e.id).push(i.id))}for(const t of c)if(t.allocatedTo&&!p.has(t.id)){const i=m.find(e=>e.name===t.allocatedTo||e.id===t.allocatedTo);i&&(u.push({functionId:t.id,functionName:t.name,targetId:i.id,targetName:i.name}),p.add(t.id),d.has(i.id)||d.set(i.id,[]),d.get(i.id).push(t.id))}const a=[];let f=0;for(const t of c)p.has(t.id)||a.push({id:`ci-${f++}`,type:"unallocated-function",severity:"warning",elementId:t.id,elementName:t.name,message:`Function "${t.name}" is not allocated to any component`});for(const t of m){const i=d.get(t.id);(!i||i.length===0)&&a.push({id:`ci-${f++}`,type:"no-functions-allocated",severity:"info",elementId:t.id,elementName:t.name,message:`Component "${t.name}" has no functions allocated to it`})}const r=new Map;for(const t of u)r.set(t.functionId,t.targetId);for(const t of o.relationships){if(t.type!=="flow")continue;const i=r.get(t.sourceId),e=r.get(t.targetId);if(i&&e&&i!==e){const h=o.elements[t.sourceId],g=o.elements[t.targetId];h&&g&&a.push({id:`ci-${f++}`,type:"cross-component-flow",severity:"info",elementId:t.sourceId,elementName:h.name,message:`Flow from "${h.name}" to "${g.name}" crosses component boundary (${(y=o.elements[i])==null?void 0:y.name} → ${(l=o.elements[e])==null?void 0:l.name})`,relatedIds:[t.targetId,i,e]})}}return{allocations:u,componentFunctions:d,issues:a,functions:c,structures:m}}function N(o){for(const c of o.types)if(v[c])return v[c];return"#6B7280"}function Z(o){const c=N(o),m=Math.min(.15+o.count*.15,.6);return`${c}${Math.round(m*255).toString(16).padStart(2,"0")}`}const E=36,D=160;function Q(){const o=C(n=>n.model),c=C(n=>n.selectElement),m=C(n=>n.selectedElementId),u=C(n=>n.setAnalysisIssues),[p,d]=b.useState(!0),[a,f]=b.useState(!1),[r,y]=b.useState(null),[l,t]=b.useState("functional"),i=b.useMemo(()=>{switch(l){case"functional":return["Function","Function"];case"behavior":return["ActionDefinition","ActionUsage"];case"all":return["Function","Function","ActionDefinition","ActionUsage"]}},[l]),e=b.useMemo(()=>{if(!o)return null;const n=K(o,{kinds:i});return p?P(n):n},[o,p,i]),h=b.useMemo(()=>o?V(o):null,[o]);b.useEffect(()=>{if(h)return u(h.issues.map(n=>({id:n.id,source:"DSM",severity:n.severity,elementId:n.elementId,elementName:n.elementName,message:n.message,tag:n.type==="unallocated-function"?"unallocated":n.type==="cross-component-flow"?"cross-boundary":"no functions"}))),()=>u([])},[h,u]);const g=b.useCallback((n,x)=>{y({row:n,col:x})},[]),F=b.useCallback(()=>{y(null)},[]);if(!o||!e)return s.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:"#9CA3AF"},children:s.jsx("p",{children:"No model loaded"})});if(e.elementIds.length===0)return s.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:s.jsxs("div",{className:"text-center",style:{maxWidth:"320px"},children:[s.jsx("div",{style:{fontSize:"40px",marginBottom:"16px",opacity:.4},children:"▤"}),s.jsx("h3",{style:{fontSize:"15px",fontWeight:600,color:"#374151",marginBottom:"8px"},children:"No Functional Elements"}),s.jsx("p",{style:{fontSize:"13px",color:"#9CA3AF",lineHeight:1.6},children:"Add Function or Function elements to your model to see the DSM."})]})});const B=e.elementIds.length,k=new Set;if(p&&e.clusters.size>1){let n=0;for(const[,x]of e.clusters)n+=x.length,n<B&&k.add(n)}const j=r?(()=>{const n=e.matrix[r.row][r.col],x=e.elements[e.elementIds[r.row]],w=e.elements[e.elementIds[r.col]];return{cell:n,rowEl:x,colEl:w}})():null;return s.jsxs("div",{className:"flex-1 flex flex-col",style:{background:"#F7F7F5"},children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-2",style:{borderBottom:"1px solid #E5E5E0",background:"#FFFFFF"},children:[s.jsx("span",{style:{fontSize:"13px",fontWeight:600,color:"#374151"},children:"Design Structure Matrix"}),s.jsxs("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:[B," elements, ",e.totalDependencies," dependencies"]}),s.jsx("div",{className:"flex-1"}),s.jsx("div",{className:"flex rounded overflow-hidden",style:{border:"1px solid #E5E5E0"},children:["functional","behavior","all"].map(n=>s.jsx("button",{onClick:()=>t(n),className:"px-2 py-0.5 text-xs font-medium",style:{background:l===n?"#1B3A4B":"#FFFFFF",color:l===n?"#FFFFFF":"#6B7280"},children:n==="functional"?"Functions":n==="behavior"?"Behavior":"All"},n))}),s.jsxs("label",{className:"flex items-center gap-1.5 text-xs",style:{color:"#6B7280"},children:[s.jsx("input",{type:"checkbox",checked:p,onChange:n=>d(n.target.checked),style:{accentColor:"#2DD4A8"}}),"Cluster"]}),s.jsxs("label",{className:"flex items-center gap-1.5 text-xs",style:{color:"#6B7280"},children:[s.jsx("input",{type:"checkbox",checked:a,onChange:n=>f(n.target.checked),style:{accentColor:"#E67E22"}}),"Allocation"]})]}),s.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[s.jsxs("div",{style:{display:"inline-block",position:"relative"},children:[s.jsx("div",{style:{display:"flex",marginLeft:D,marginBottom:"4px"},children:e.elementIds.map((n,x)=>{const w=e.elements[n],A=(r==null?void 0:r.col)===x;return s.jsx("div",{style:{width:E,height:D-20,position:"relative",borderRight:k.has(x+1)?"2px solid #2DD4A8":void 0},children:s.jsx("div",{style:{position:"absolute",bottom:0,left:E/2,transformOrigin:"bottom left",transform:"rotate(-60deg)",whiteSpace:"nowrap",fontSize:"11px",fontWeight:A?600:400,color:A?"#1a1a1a":"#6B7280",cursor:"pointer"},onClick:()=>c(n),children:w.name})},n)})}),e.elementIds.map((n,x)=>{const w=e.elements[n],A=(r==null?void 0:r.row)===x,M=m===n,L=k.has(x);return s.jsxs("div",{style:{display:"flex",alignItems:"center",borderTop:L?"2px solid #2DD4A8":void 0},children:[s.jsxs("div",{style:{width:D,paddingRight:"8px",fontSize:"11px",fontWeight:A||M?600:400,color:A||M?"#1a1a1a":"#6B7280",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textAlign:"right",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"6px",height:E},onClick:()=>c(n),title:`${w.name} (${w.kind})`,children:[a&&w.allocatedTo&&s.jsx("span",{style:{fontSize:"9px",padding:"1px 4px",borderRadius:"3px",background:"#E67E2220",color:"#E67E22",fontWeight:500},children:w.allocatedTo}),s.jsx("span",{style:{width:"3px",height:"14px",borderRadius:"2px",background:_[w.layer]||"#9CA3AF",flexShrink:0}}),w.name]}),e.elementIds.map(($,I)=>{const S=e.matrix[x][I],T=x===I,W=(r==null?void 0:r.row)===x&&(r==null?void 0:r.col)===I,O=(r==null?void 0:r.row)===x||(r==null?void 0:r.col)===I;return s.jsx("div",{onMouseEnter:()=>g(x,I),onMouseLeave:F,onClick:()=>{S&&c(n)},style:{width:E,height:E,border:"1px solid #E5E5E0",borderRight:k.has(I+1)?"2px solid #2DD4A8":"1px solid #E5E5E0",background:T?"#F3F4F6":S?Z(S):O?"#FAFAFA":"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",cursor:S?"pointer":"default",transition:"background 100ms ease",outline:W&&S?`2px solid ${N(S)}`:void 0,outlineOffset:"-2px"},children:S&&!T&&s.jsx("span",{style:{fontSize:"10px",fontWeight:600,color:N(S)},children:S.count>1?S.count:"●"})},$)})]},n)})]}),(j==null?void 0:j.cell)&&s.jsxs("div",{style:{position:"fixed",bottom:"80px",right:"20px",background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"8px",padding:"12px 16px",boxShadow:"0 4px 16px rgba(0,0,0,0.12)",fontSize:"12px",zIndex:100,maxWidth:"280px"},children:[s.jsx("div",{style:{fontWeight:600,color:"#1a1a1a",marginBottom:"6px"},children:j.rowEl.name}),s.jsxs("div",{style:{color:"#6B7280",marginBottom:"4px"},children:["→"," ",j.colEl.name]}),s.jsx("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap"},children:j.cell.types.map(n=>s.jsx("span",{style:{fontSize:"10px",padding:"2px 6px",borderRadius:"4px",background:(v[n]||"#6B7280")+"20",color:v[n]||"#6B7280",fontWeight:500},children:n},n))}),j.cell.flowItems.length>0&&s.jsxs("div",{style:{marginTop:"4px",color:"#9CA3AF",fontSize:"11px"},children:["Items: ",j.cell.flowItems.join(", ")]})]}),s.jsxs("div",{style:{marginTop:"20px",display:"flex",gap:"16px",flexWrap:"wrap",fontSize:"11px",color:"#6B7280"},children:[["flow","decomposedBy","composedOf","allocateTo","succession"].map(n=>s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[s.jsx("span",{style:{width:"10px",height:"10px",borderRadius:"2px",background:v[n]||"#6B7280"}}),n]},n)),p&&e.clusters.size>1&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[s.jsx("span",{style:{width:"10px",height:"2px",background:"#2DD4A8"}}),"cluster boundary"]})]})]})]})}export{Q as DSMView};
@@ -1 +1 @@
1
- import{j as e}from"./reactflow-CsCqNKB-.js";import{a as f}from"./zustand-CrhqMOHB.js";import{u as x,f as m}from"./index-BMgENwvO.js";function j(i,d,s){var u,l;const n=Object.values(i.elements),o={},t={};for(const r of n)o[r.layer]=(o[r.layer]||0)+1,t[r.kind.toLowerCase()]=(t[r.kind.toLowerCase()]||0)+1;const a={};for(const r of i.relationships)a[r.type.toLowerCase()]=(a[r.type.toLowerCase()]||0)+1;return{totalElements:n.length,totalRelationships:i.relationships.length,violations:d,completenessPercent:s,riskCount:(o.risk||0)+(o.analysis||0),requirementsCount:o.requirements||0,architectureCount:["logical","physical","functional","logical_structure","software_structure","hardware_structure","functions","interfaces","system","context","operational","behavior"].reduce((r,p)=>r+(o[p]||0),0),verificationCount:(o.verification||0)+(o.assurance||0),hazardCount:t.hazard||0,requirementCount:Object.entries(t).filter(([r])=>r.endsWith("requirement")).reduce((r,[,p])=>r+p,0),riskControlCount:t.riskcontrol||0,systemCount:(t.system||0)+(t.subsystem||0)+(t.softwaresystem||0)+(t.logicalcomponent||0)+(t.hardwareassembly||0)+(t.softwarecomponent||0)+(t.processingnode||0),testCount:(t.verificationcase||0)+(t.validationcase||0)+(t.testartifact||0)+(t.test||0),mitigatesCount:Object.entries(a).filter(([r])=>r.startsWith("mitigat")).reduce((r,[,p])=>r+p,0),verificationLinkCount:Object.entries(a).filter(([r])=>r.startsWith("verif")||r.startsWith("validate")||r==="testedbyusability").reduce((r,[,p])=>r+p,0),diagramCount:((u=i.diagrams)==null?void 0:u.length)??0,projectName:((l=i.metadata)==null?void 0:l.projectName)||i.projectName||i.name||"My Device Project"}}function k(i){return i.totalElements===0?{icon:"🚀",title:"Add your first model elements",description:"Start with intended use, actors, and a system requirement. Or use the Workflow Wizard to guide you step by step.",urgency:"high"}:i.requirementCount===0?{icon:"📋",title:"Define your first requirement",description:"Your model has elements but no system requirements yet. Add a Requirement in the Model Explorer.",urgency:"high"}:i.hazardCount===0?{icon:"⚠️",title:"Add your first hazard",description:`You have ${i.requirementCount} requirement(s) but no hazard analysis yet. ISO 14971 requires hazard identification early.`,urgency:"high"}:i.hazardCount>0&&i.mitigatesCount===0?{icon:"🔗",title:"Connect hazards to risk controls",description:`You have ${i.hazardCount} hazard(s) but no MitigatesHazard relationships. Connect hazards to risk controls to complete the ISO 14971 chain.`,urgency:"high"}:i.systemCount===0?{icon:"🏗️",title:"Define your system architecture",description:"No architecture components found (SoftwareSystem, LogicalComponent, HardwareAssembly, …). Add an architecture layer to ground your requirements and risk analysis.",urgency:"medium"}:i.testCount===0?{icon:"🧪",title:"Add verification tests",description:`${i.requirementCount} requirement(s) have no verification tests yet. Add VerificationCases and link them to requirements with VerifiedBy.`,urgency:"medium"}:i.verificationLinkCount===0&&i.testCount>0?{icon:"↔️",title:"Link tests to requirements",description:"Verification cases exist but no VerifiedBy links found. Open the Traceability Matrix to connect tests to their requirements.",urgency:"medium"}:{icon:"✅",title:"Good coverage so far",description:"Requirements, hazards, and risk controls are in place. Check the GapBar (⌘⇧P) for completeness gaps before your review.",urgency:"low"}}function h({label:i,value:d,color:s,subtitle:n}){return e.jsxs("div",{style:{background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"20px 24px",display:"flex",flexDirection:"column",gap:"4px"},children:[e.jsx("div",{style:{fontSize:"28px",fontWeight:800,color:s,lineHeight:1},children:d}),e.jsx("div",{style:{fontSize:"12px",fontWeight:600,color:"#374151"},children:i}),n&&e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF"},children:n})]})}function y({layer:i,label:d,count:s,color:n,onClick:o}){const t=s>0;return e.jsxs("button",{onClick:o,style:{background:t?`${n}12`:"#F9FAFB",border:`1px solid ${t?n+"30":"#E5E5E0"}`,borderRadius:"12px",padding:"16px",cursor:"pointer",textAlign:"left",transition:"all 0.15s"},onMouseEnter:a=>{a.currentTarget.style.background=t?`${n}20`:"#F3F4F6",a.currentTarget.style.transform="translateY(-1px)",a.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.08)"},onMouseLeave:a=>{a.currentTarget.style.background=t?`${n}12`:"#F9FAFB",a.currentTarget.style.transform="none",a.currentTarget.style.boxShadow="none"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"},children:[e.jsx("span",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:t?n:"#9CA3AF"},children:d}),e.jsxs("span",{style:{fontSize:"10px",fontWeight:600,padding:"2px 8px",borderRadius:"999px",background:t?n+"20":"#F3F4F6",color:t?n:"#9CA3AF"},children:[s," elements"]})]}),e.jsx("div",{style:{width:"100%",height:"4px",background:"#F3F4F6",borderRadius:"2px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"2px",background:t?n:"transparent",width:t?`${Math.min(100,s/10*100)}%`:"0",transition:"width 0.4s ease"}})}),e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"8px"},children:t?"Click to explore →":"Not started"})]})}function g({icon:i,label:d,onClick:s,variant:n="secondary"}){const o=n==="primary";return e.jsxs("button",{onClick:s,style:{display:"flex",alignItems:"center",gap:"8px",padding:"10px 16px",borderRadius:"8px",cursor:"pointer",fontSize:"13px",fontWeight:600,border:"none",background:o?"#1B3A4B":"rgba(255,255,255,0.7)",color:o?"#FFFFFF":"#374151",backdropFilter:"blur(4px)",transition:"all 0.15s"},onMouseEnter:t=>{t.currentTarget.style.background=o?"#244D63":"rgba(255,255,255,0.95)",t.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.1)"},onMouseLeave:t=>{t.currentTarget.style.background=o?"#1B3A4B":"rgba(255,255,255,0.7)",t.currentTarget.style.boxShadow="none"},children:[e.jsx("span",{children:i}),e.jsx("span",{children:d})]})}function S(){var b;const i=x(c=>c.model),d=x(c=>c.validation),s=x(c=>c.completeness),n=x(c=>c.setActiveView),o=x(c=>c.setExplorerTab),t=x(c=>c.toggleGapBar),a=((b=d==null?void 0:d.violations)==null?void 0:b.length)??0,u=f.useMemo(()=>{if(typeof(s==null?void 0:s.overall)=="number")return Math.round(s.overall);if(!(s!=null&&s.layers)||s.layers.length===0)return 0;const c=s.layers.reduce((C,v)=>C+(v.completeness||0),0)/s.layers.length;return Math.round(c)},[s]),l=f.useMemo(()=>i?j(i,a,u):null,[i,a,u]),r=f.useMemo(()=>l?k(l):null,[l]);return!l||!i?e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:e.jsx("div",{style:{fontSize:"13px",color:"#9CA3AF"},children:"Loading dashboard…"})}):e.jsx("div",{style:{flex:1,overflowY:"auto",background:"linear-gradient(135deg, #EEF7F3 0%, #EAF2F8 55%, #F2EEF8 100%)",padding:"32px 40px"},children:e.jsxs("div",{style:{maxWidth:"960px",margin:"0 auto"},children:[e.jsxs("div",{style:{marginBottom:"28px"},children:[e.jsx("h1",{style:{fontSize:"22px",fontWeight:800,color:"#1B3A4B",margin:"0 0 4px 0"},children:l.projectName}),e.jsxs("p",{style:{fontSize:"13px",color:"#4B6E80",margin:0},children:["Model dashboard · ",new Date().toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"12px",marginBottom:"24px"},children:[e.jsx(h,{label:"Elements",value:l.totalElements,color:"#1B3A4B"}),e.jsx(h,{label:"Relationships",value:l.totalRelationships,color:"#4A90D9"}),e.jsx(h,{label:"Completeness",value:`${u}%`,color:u>=70?"#2ECC71":u>=40?"#F39C12":"#E74C3C"}),e.jsx(h,{label:"Violations",value:a,color:a===0?"#2ECC71":"#E74C3C",subtitle:a===0?"All rules passing":"Open the GapBar"})]}),e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx("h2",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"#7A9BAA",margin:"0 0 12px 0"},children:"Layer Coverage"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"12px"},children:[e.jsx(y,{layer:"requirements",label:"Requirements",count:l.requirementsCount,color:m.requirements,onClick:()=>{o("model"),n({type:"welcome"})}}),e.jsx(y,{layer:"risk",label:"Risk",count:l.riskCount,color:m.risk,onClick:()=>{o("model"),n({type:"welcome"})}}),e.jsx(y,{layer:"logical",label:"Architecture",count:l.architectureCount,color:m.logical,onClick:()=>{o("views"),n({type:"welcome"})}}),e.jsx(y,{layer:"verification",label:"Verification",count:l.verificationCount,color:m.verification,onClick:()=>n({type:"traceability"})})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px",marginBottom:"24px"},children:[r&&e.jsxs("div",{style:{background:r.urgency==="high"?"rgba(231,76,60,0.06)":r.urgency==="medium"?"rgba(243,156,18,0.06)":"rgba(46,204,113,0.06)",border:`1px solid ${r.urgency==="high"?"#E74C3C30":r.urgency==="medium"?"#F39C1230":"#2ECC7130"}`,borderRadius:"12px",padding:"20px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"#7A9BAA",marginBottom:"10px"},children:"💡 Suggested Next Step"}),e.jsx("div",{style:{fontSize:"16px",marginBottom:"6px"},children:r.icon}),e.jsx("div",{style:{fontSize:"14px",fontWeight:700,color:"#1B3A4B",marginBottom:"6px"},children:r.title}),e.jsx("div",{style:{fontSize:"12px",color:"#4B6E80",lineHeight:"1.6"},children:r.description}),r.urgency!=="low"&&e.jsx("button",{onClick:()=>n({type:"workflow-wizard"}),style:{marginTop:"14px",padding:"8px 14px",fontSize:"12px",fontWeight:600,background:"#1B3A4B",color:"#FFFFFF",border:"none",borderRadius:"6px",cursor:"pointer"},onMouseEnter:c=>c.currentTarget.style.background="#244D63",onMouseLeave:c=>c.currentTarget.style.background="#1B3A4B",children:"Open Workflow Wizard →"})]}),e.jsxs("div",{style:{background:"rgba(255,255,255,0.6)",border:"1px solid rgba(255,255,255,0.9)",borderRadius:"12px",padding:"20px",backdropFilter:"blur(4px)"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"#7A9BAA",marginBottom:"14px"},children:"Quick Actions"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx(g,{icon:"🗂️",label:"Browse Model",onClick:()=>{o("model")}}),e.jsx(g,{icon:"📊",label:"Open Viewpoints",onClick:()=>o("views")}),e.jsx(g,{icon:"↔️",label:"Traceability Matrix",onClick:()=>n({type:"traceability"})}),e.jsx(g,{icon:"📋",label:"First Review Dashboard",onClick:()=>n({type:"review-dashboard"})}),e.jsx(g,{icon:"✅",label:"Check Completeness",onClick:()=>t()}),e.jsx(g,{icon:"📈",label:"Full Statistics",onClick:()=>n({type:"statistics"})})]})]})]}),l.diagramCount>0&&e.jsx("div",{style:{background:"rgba(255,255,255,0.6)",border:"1px solid rgba(255,255,255,0.9)",borderRadius:"12px",padding:"16px 20px",backdropFilter:"blur(4px)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{style:{fontSize:"13px",fontWeight:600,color:"#374151"},children:[l.diagramCount," model view",l.diagramCount!==1?"s":""," in this project"]}),e.jsx("button",{onClick:()=>o("views"),style:{fontSize:"12px",color:"#4A90D9",background:"none",border:"none",cursor:"pointer",fontWeight:600},children:"Browse viewpoints →"})]})})]})})}export{S as Dashboard};
1
+ import{j as e}from"./reactflow-CsCqNKB-.js";import{a as f}from"./zustand-CrhqMOHB.js";import{u as x,f as m}from"./index-CVW92JY7.js";function j(i,d,s){var u,l;const n=Object.values(i.elements),o={},t={};for(const r of n)o[r.layer]=(o[r.layer]||0)+1,t[r.kind.toLowerCase()]=(t[r.kind.toLowerCase()]||0)+1;const a={};for(const r of i.relationships)a[r.type.toLowerCase()]=(a[r.type.toLowerCase()]||0)+1;return{totalElements:n.length,totalRelationships:i.relationships.length,violations:d,completenessPercent:s,riskCount:(o.risk||0)+(o.analysis||0),requirementsCount:o.requirements||0,architectureCount:["logical","physical","functional","logical_structure","software_structure","hardware_structure","functions","interfaces","system","context","operational","behavior"].reduce((r,p)=>r+(o[p]||0),0),verificationCount:(o.verification||0)+(o.assurance||0),hazardCount:t.hazard||0,requirementCount:Object.entries(t).filter(([r])=>r.endsWith("requirement")).reduce((r,[,p])=>r+p,0),riskControlCount:t.riskcontrol||0,systemCount:(t.system||0)+(t.subsystem||0)+(t.softwaresystem||0)+(t.logicalcomponent||0)+(t.hardwareassembly||0)+(t.softwarecomponent||0)+(t.processingnode||0),testCount:(t.verificationcase||0)+(t.validationcase||0)+(t.testartifact||0)+(t.test||0),mitigatesCount:Object.entries(a).filter(([r])=>r.startsWith("mitigat")).reduce((r,[,p])=>r+p,0),verificationLinkCount:Object.entries(a).filter(([r])=>r.startsWith("verif")||r.startsWith("validate")||r==="testedbyusability").reduce((r,[,p])=>r+p,0),diagramCount:((u=i.diagrams)==null?void 0:u.length)??0,projectName:((l=i.metadata)==null?void 0:l.projectName)||i.projectName||i.name||"My Device Project"}}function k(i){return i.totalElements===0?{icon:"🚀",title:"Add your first model elements",description:"Start with intended use, actors, and a system requirement. Or use the Workflow Wizard to guide you step by step.",urgency:"high"}:i.requirementCount===0?{icon:"📋",title:"Define your first requirement",description:"Your model has elements but no system requirements yet. Add a Requirement in the Model Explorer.",urgency:"high"}:i.hazardCount===0?{icon:"⚠️",title:"Add your first hazard",description:`You have ${i.requirementCount} requirement(s) but no hazard analysis yet. ISO 14971 requires hazard identification early.`,urgency:"high"}:i.hazardCount>0&&i.mitigatesCount===0?{icon:"🔗",title:"Connect hazards to risk controls",description:`You have ${i.hazardCount} hazard(s) but no MitigatesHazard relationships. Connect hazards to risk controls to complete the ISO 14971 chain.`,urgency:"high"}:i.systemCount===0?{icon:"🏗️",title:"Define your system architecture",description:"No architecture components found (SoftwareSystem, LogicalComponent, HardwareAssembly, …). Add an architecture layer to ground your requirements and risk analysis.",urgency:"medium"}:i.testCount===0?{icon:"🧪",title:"Add verification tests",description:`${i.requirementCount} requirement(s) have no verification tests yet. Add VerificationCases and link them to requirements with VerifiedBy.`,urgency:"medium"}:i.verificationLinkCount===0&&i.testCount>0?{icon:"↔️",title:"Link tests to requirements",description:"Verification cases exist but no VerifiedBy links found. Open the Traceability Matrix to connect tests to their requirements.",urgency:"medium"}:{icon:"✅",title:"Good coverage so far",description:"Requirements, hazards, and risk controls are in place. Check the GapBar (⌘⇧P) for completeness gaps before your review.",urgency:"low"}}function h({label:i,value:d,color:s,subtitle:n}){return e.jsxs("div",{style:{background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"20px 24px",display:"flex",flexDirection:"column",gap:"4px"},children:[e.jsx("div",{style:{fontSize:"28px",fontWeight:800,color:s,lineHeight:1},children:d}),e.jsx("div",{style:{fontSize:"12px",fontWeight:600,color:"#374151"},children:i}),n&&e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF"},children:n})]})}function y({layer:i,label:d,count:s,color:n,onClick:o}){const t=s>0;return e.jsxs("button",{onClick:o,style:{background:t?`${n}12`:"#F9FAFB",border:`1px solid ${t?n+"30":"#E5E5E0"}`,borderRadius:"12px",padding:"16px",cursor:"pointer",textAlign:"left",transition:"all 0.15s"},onMouseEnter:a=>{a.currentTarget.style.background=t?`${n}20`:"#F3F4F6",a.currentTarget.style.transform="translateY(-1px)",a.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.08)"},onMouseLeave:a=>{a.currentTarget.style.background=t?`${n}12`:"#F9FAFB",a.currentTarget.style.transform="none",a.currentTarget.style.boxShadow="none"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"},children:[e.jsx("span",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:t?n:"#9CA3AF"},children:d}),e.jsxs("span",{style:{fontSize:"10px",fontWeight:600,padding:"2px 8px",borderRadius:"999px",background:t?n+"20":"#F3F4F6",color:t?n:"#9CA3AF"},children:[s," elements"]})]}),e.jsx("div",{style:{width:"100%",height:"4px",background:"#F3F4F6",borderRadius:"2px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"2px",background:t?n:"transparent",width:t?`${Math.min(100,s/10*100)}%`:"0",transition:"width 0.4s ease"}})}),e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"8px"},children:t?"Click to explore →":"Not started"})]})}function g({icon:i,label:d,onClick:s,variant:n="secondary"}){const o=n==="primary";return e.jsxs("button",{onClick:s,style:{display:"flex",alignItems:"center",gap:"8px",padding:"10px 16px",borderRadius:"8px",cursor:"pointer",fontSize:"13px",fontWeight:600,border:"none",background:o?"#1B3A4B":"rgba(255,255,255,0.7)",color:o?"#FFFFFF":"#374151",backdropFilter:"blur(4px)",transition:"all 0.15s"},onMouseEnter:t=>{t.currentTarget.style.background=o?"#244D63":"rgba(255,255,255,0.95)",t.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.1)"},onMouseLeave:t=>{t.currentTarget.style.background=o?"#1B3A4B":"rgba(255,255,255,0.7)",t.currentTarget.style.boxShadow="none"},children:[e.jsx("span",{children:i}),e.jsx("span",{children:d})]})}function S(){var b;const i=x(c=>c.model),d=x(c=>c.validation),s=x(c=>c.completeness),n=x(c=>c.setActiveView),o=x(c=>c.setExplorerTab),t=x(c=>c.toggleGapBar),a=((b=d==null?void 0:d.violations)==null?void 0:b.length)??0,u=f.useMemo(()=>{if(typeof(s==null?void 0:s.overall)=="number")return Math.round(s.overall);if(!(s!=null&&s.layers)||s.layers.length===0)return 0;const c=s.layers.reduce((C,v)=>C+(v.completeness||0),0)/s.layers.length;return Math.round(c)},[s]),l=f.useMemo(()=>i?j(i,a,u):null,[i,a,u]),r=f.useMemo(()=>l?k(l):null,[l]);return!l||!i?e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:e.jsx("div",{style:{fontSize:"13px",color:"#9CA3AF"},children:"Loading dashboard…"})}):e.jsx("div",{style:{flex:1,overflowY:"auto",background:"linear-gradient(135deg, #EEF7F3 0%, #EAF2F8 55%, #F2EEF8 100%)",padding:"32px 40px"},children:e.jsxs("div",{style:{maxWidth:"960px",margin:"0 auto"},children:[e.jsxs("div",{style:{marginBottom:"28px"},children:[e.jsx("h1",{style:{fontSize:"22px",fontWeight:800,color:"#1B3A4B",margin:"0 0 4px 0"},children:l.projectName}),e.jsxs("p",{style:{fontSize:"13px",color:"#4B6E80",margin:0},children:["Model dashboard · ",new Date().toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"12px",marginBottom:"24px"},children:[e.jsx(h,{label:"Elements",value:l.totalElements,color:"#1B3A4B"}),e.jsx(h,{label:"Relationships",value:l.totalRelationships,color:"#4A90D9"}),e.jsx(h,{label:"Completeness",value:`${u}%`,color:u>=70?"#2ECC71":u>=40?"#F39C12":"#E74C3C"}),e.jsx(h,{label:"Violations",value:a,color:a===0?"#2ECC71":"#E74C3C",subtitle:a===0?"All rules passing":"Open the GapBar"})]}),e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx("h2",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"#7A9BAA",margin:"0 0 12px 0"},children:"Layer Coverage"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"12px"},children:[e.jsx(y,{layer:"requirements",label:"Requirements",count:l.requirementsCount,color:m.requirements,onClick:()=>{o("model"),n({type:"welcome"})}}),e.jsx(y,{layer:"risk",label:"Risk",count:l.riskCount,color:m.risk,onClick:()=>{o("model"),n({type:"welcome"})}}),e.jsx(y,{layer:"logical",label:"Architecture",count:l.architectureCount,color:m.logical,onClick:()=>{o("views"),n({type:"welcome"})}}),e.jsx(y,{layer:"verification",label:"Verification",count:l.verificationCount,color:m.verification,onClick:()=>n({type:"traceability"})})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px",marginBottom:"24px"},children:[r&&e.jsxs("div",{style:{background:r.urgency==="high"?"rgba(231,76,60,0.06)":r.urgency==="medium"?"rgba(243,156,18,0.06)":"rgba(46,204,113,0.06)",border:`1px solid ${r.urgency==="high"?"#E74C3C30":r.urgency==="medium"?"#F39C1230":"#2ECC7130"}`,borderRadius:"12px",padding:"20px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"#7A9BAA",marginBottom:"10px"},children:"💡 Suggested Next Step"}),e.jsx("div",{style:{fontSize:"16px",marginBottom:"6px"},children:r.icon}),e.jsx("div",{style:{fontSize:"14px",fontWeight:700,color:"#1B3A4B",marginBottom:"6px"},children:r.title}),e.jsx("div",{style:{fontSize:"12px",color:"#4B6E80",lineHeight:"1.6"},children:r.description}),r.urgency!=="low"&&e.jsx("button",{onClick:()=>n({type:"workflow-wizard"}),style:{marginTop:"14px",padding:"8px 14px",fontSize:"12px",fontWeight:600,background:"#1B3A4B",color:"#FFFFFF",border:"none",borderRadius:"6px",cursor:"pointer"},onMouseEnter:c=>c.currentTarget.style.background="#244D63",onMouseLeave:c=>c.currentTarget.style.background="#1B3A4B",children:"Open Workflow Wizard →"})]}),e.jsxs("div",{style:{background:"rgba(255,255,255,0.6)",border:"1px solid rgba(255,255,255,0.9)",borderRadius:"12px",padding:"20px",backdropFilter:"blur(4px)"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"#7A9BAA",marginBottom:"14px"},children:"Quick Actions"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx(g,{icon:"🗂️",label:"Browse Model",onClick:()=>{o("model")}}),e.jsx(g,{icon:"📊",label:"Open Viewpoints",onClick:()=>o("views")}),e.jsx(g,{icon:"↔️",label:"Traceability Matrix",onClick:()=>n({type:"traceability"})}),e.jsx(g,{icon:"📋",label:"First Review Dashboard",onClick:()=>n({type:"review-dashboard"})}),e.jsx(g,{icon:"✅",label:"Check Completeness",onClick:()=>t()}),e.jsx(g,{icon:"📈",label:"Full Statistics",onClick:()=>n({type:"statistics"})})]})]})]}),l.diagramCount>0&&e.jsx("div",{style:{background:"rgba(255,255,255,0.6)",border:"1px solid rgba(255,255,255,0.9)",borderRadius:"12px",padding:"16px 20px",backdropFilter:"blur(4px)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{style:{fontSize:"13px",fontWeight:600,color:"#374151"},children:[l.diagramCount," model view",l.diagramCount!==1?"s":""," in this project"]}),e.jsx("button",{onClick:()=>o("views"),style:{fontSize:"12px",color:"#4A90D9",background:"none",border:"none",cursor:"pointer",fontWeight:600},children:"Browse viewpoints →"})]})})]})})}export{S as Dashboard};
@@ -1 +1 @@
1
- import{j as e}from"./reactflow-CsCqNKB-.js";import{a as m}from"./zustand-CrhqMOHB.js";import{u as b}from"./index-BMgENwvO.js";const h=[{id:"rmp",title:"Risk Management Plan",standards:["ISO 14971:2019 §4.4"],layers:["risk"],relevantKinds:["Hazard","HazardousSituation","Harm","RiskControlMeasure","RiskAcceptabilityCriteria"],group:"risk"},{id:"har",title:"Hazard Analysis Report",standards:["ISO 14971:2019 §5","ISO 14971:2019 §6"],layers:["risk"],relevantKinds:["Hazard","HazardousSituation","Harm","RiskControlMeasure"],group:"risk"},{id:"fmea",title:"Failure Mode and Effects Analysis",standards:["IEC 60812:2018"],layers:["risk","functional","physical"],relevantKinds:["Hazard","RiskControlMeasure","Function","Component","Subsystem"],group:"risk"},{id:"rtm",title:"Requirements Traceability Matrix",standards:["IEC 62304:2006 §5.1.1"],layers:["requirements","functional","verification"],relevantKinds:["Requirement","Requirement","DesignInput","DesignOutput","TestCase","VerificationActivity"],group:"design"},{id:"sad",title:"System Architecture Description",standards:["ISO/IEC/IEEE 42010:2022"],layers:["functional","logical","physical","software","interfaces"],relevantKinds:["Function","Component","Subsystem","Interface","Port","SoftwareItem","SOUPComponent"],group:"design"},{id:"sds",title:"Software Design Specification",standards:["IEC 62304:2006 §5.4"],layers:["software"],relevantKinds:["SoftwareItem","SoftwareUnit","SoftwareSystem","SOUPComponent","Interface"],group:"design"},{id:"soup",title:"SOUP List",standards:["IEC 62304:2006 §8.1.2"],layers:["software"],relevantKinds:["SOUPComponent"],group:"design"},{id:"dip",title:"Design Input Plan",standards:["ISO 13485:2016 §7.3.3"],layers:["requirements","business"],relevantKinds:["DesignInput","Requirement","Need","UseCase"],group:"design"},{id:"dop",title:"Design Output Plan",standards:["ISO 13485:2016 §7.3.4"],layers:["functional","physical","software"],relevantKinds:["DesignOutput","Component","SoftwareItem","Function"],group:"design"},{id:"vvp",title:"Verification & Validation Plan",standards:["ISO 13485:2016 §7.3.6"],layers:["verification"],relevantKinds:["TestCase","VerificationActivity","ValidationActivity","TestProtocol"],group:"verification"},{id:"vvr",title:"Verification & Validation Report",standards:["ISO 13485:2016 §7.3.7"],layers:["verification"],relevantKinds:["TestCase","VerificationActivity","ValidationActivity","TestResult"],group:"verification"},{id:"sdp",title:"Software Development Plan",standards:["IEC 62304:2006 §5.1"],layers:["software","verification"],relevantKinds:["SoftwareItem","SoftwareUnit","SoftwareSystem","TestCase"],group:"compliance"},{id:"csr",title:"Clinical Safety Report",standards:["ISO 14971:2019 §10"],layers:["risk","verification"],relevantKinds:["Hazard","RiskControlMeasure","ClinicalEvidence","ValidationActivity"],group:"compliance"},{id:"uer",title:"Usability Engineering Report",standards:["IEC 62366-1:2015"],layers:["ui","requirements"],relevantKinds:["UseCase","UserActivity","UserInterface","UsabilityRequirement"],group:"compliance"},{id:"cybersecurity",title:"Cybersecurity Documentation",standards:["IEC 81001-5-1:2021"],layers:["software","interfaces"],relevantKinds:["ThreatModel","SecurityControl","Interface","SOUPComponent"],group:"compliance"},{id:"labeling",title:"Labeling Specification",standards:["21 CFR 801"],layers:["requirements","ui"],relevantKinds:["LabelingRequirement","Requirement"],group:"compliance"},{id:"dhf-index",title:"Design History File Index",standards:["ISO 13485:2016 §4.2.4"],layers:[],relevantKinds:[],group:"all"},{id:"change-log",title:"Design Change Log",standards:["ISO 13485:2016 §7.3.9"],layers:[],relevantKinds:[],group:"all"}],j={risk:"Risk Management",design:"Design & Architecture",verification:"Verification & Validation",compliance:"Compliance & Standards",all:"General"},v={risk:"#E74C3C",design:"#4A90D9",verification:"#2ECC71",compliance:"#8E44AD",all:"#6B7280"};function B(n,i,o){const l=Object.values(i.elements).filter(s=>n.relevantKinds.includes(s.kind)),c=((o==null?void 0:o.violations)||[]).filter(s=>n.relevantKinds.includes(s.elementKind)||n.layers.includes(s.layer)),a=c.filter(s=>s.severity==="error").length;return{elementCount:l.length,gapCount:a,status:l.length===0?"empty":a===0?"complete":"partial",violations:c}}function z(){const n=b(t=>t.model),i=b(t=>t.validation),o=b(t=>t.completeness),[l,c]=m.useState(null),[a,s]=m.useState(null),r=m.useMemo(()=>{if(!n)return new Map;const t=new Map;for(const d of h)t.set(d.id,B(d,n,i));return t},[n,i]),x=m.useMemo(()=>a?h.filter(t=>t.group===a||t.group==="all"):h,[a]),g=m.useMemo(()=>{const t=new Map;for(const d of x){const p=d.group;t.has(p)||t.set(p,[]),t.get(p).push(d)}return t},[x]),f=m.useMemo(()=>{let t=0,d=0,p=0;for(const y of r.values())y.status==="complete"?t++:y.status==="partial"?d++:p++;return{complete:t,partial:d,empty:p,total:h.length}},[r]);if(!n)return e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"#9CA3AF"},children:"Waiting for model data..."});const C=l?h.find(t=>t.id===l):null,A=l?r.get(l):null;return e.jsxs("div",{style:{height:"100%",overflow:"auto",background:"#F7F7F5",padding:"24px"},children:[e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx("h2",{style:{fontSize:"20px",fontWeight:700,color:"#1B3A4B",margin:0},children:"Documents"}),e.jsxs("p",{style:{color:"#6B7280",fontSize:"13px",marginTop:"4px"},children:["Design history file · ",f.total," documents | ",f.complete," complete | ",f.partial," partial | ",f.empty," empty",o&&` | Overall completeness: ${o.overall}%`]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"12px",marginBottom:"24px"},children:[e.jsx(u,{label:"Complete",value:f.complete,color:"#059669"}),e.jsx(u,{label:"Partial",value:f.partial,color:"#d97706"}),e.jsx(u,{label:"Empty",value:f.empty,color:"#dc2626"}),e.jsx(u,{label:"Completeness",value:`${(o==null?void 0:o.overall)||0}%`,color:"#2563eb"})]}),e.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"20px",flexWrap:"wrap"},children:[e.jsx(S,{label:"All",active:!a,onClick:()=>s(null)}),Object.entries(j).filter(([t])=>t!=="all").map(([t,d])=>e.jsx(S,{label:d,active:a===t,onClick:()=>s(a===t?null:t),color:v[t]},t))]}),l?e.jsx(w,{doc:C,status:A,model:n,validation:i,onBack:()=>c(null)}):Array.from(g.entries()).map(([t,d])=>e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsxs("h3",{style:{fontSize:"14px",fontWeight:600,color:v[t]||"#374151",marginBottom:"12px",display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:v[t]||"#6B7280",display:"inline-block"}}),j[t]||t]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"12px"},children:d.map(p=>{const y=r.get(p.id);return e.jsx(k,{doc:p,status:y,onClick:()=>c(p.id)},p.id)})})]},t))]})}function u({label:n,value:i,color:o}){return e.jsxs("div",{style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"14px 16px",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"24px",fontWeight:700,color:o},children:i}),e.jsx("div",{style:{fontSize:"11px",color:"#6B7280",marginTop:"2px"},children:n})]})}function S({label:n,active:i,onClick:o,color:l}){return e.jsx("button",{onClick:o,style:{padding:"4px 12px",borderRadius:"16px",fontSize:"12px",fontWeight:500,border:`1px solid ${i?l||"#2DD4A8":"#e5e7eb"}`,background:i?(l||"#2DD4A8")+"15":"#fff",color:i?l||"#1B3A4B":"#6B7280",cursor:"pointer"},children:n})}function k({doc:n,status:i,onClick:o}){const l=i.status==="complete"?"#059669":i.status==="partial"?"#d97706":"#dc2626",c=i.status==="complete"?"#ecfdf5":i.status==="partial"?"#fffbeb":"#fef2f2",a=i.status==="complete"?"Complete":i.status==="partial"?"Partial":"Empty";return e.jsxs("div",{onClick:o,style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s"},onMouseEnter:s=>{s.currentTarget.style.borderColor="#2DD4A8",s.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.06)"},onMouseLeave:s=>{s.currentTarget.style.borderColor="#e5e7eb",s.currentTarget.style.boxShadow="none"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"8px"},children:[e.jsx("span",{style:{fontSize:"11px",fontWeight:600,color:"#6B7280",fontFamily:"monospace"},children:n.id.toUpperCase()}),e.jsx("span",{style:{fontSize:"10px",fontWeight:600,padding:"2px 6px",borderRadius:"4px",background:c,color:l},children:a})]}),e.jsx("div",{style:{fontSize:"14px",fontWeight:600,color:"#1B3A4B",marginBottom:"6px"},children:n.title}),e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginBottom:"8px"},children:n.standards[0]}),e.jsxs("div",{style:{display:"flex",gap:"16px",fontSize:"12px",color:"#6B7280"},children:[e.jsxs("span",{children:[i.elementCount," elements"]}),i.gapCount>0&&e.jsxs("span",{style:{color:"#dc2626"},children:[i.gapCount," gaps"]})]})]})}function w({doc:n,status:i,model:o,validation:l,onBack:c}){const a=Object.values(o.elements).filter(r=>n.relevantKinds.includes(r.kind)),s=new Map;for(const r of a)s.has(r.kind)||s.set(r.kind,[]),s.get(r.kind).push(r);return e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"20px"},children:[e.jsx("button",{onClick:c,style:{background:"none",border:"none",color:"#2563eb",cursor:"pointer",fontSize:"13px",padding:0,marginBottom:"8px"},children:"← Back to dashboard"}),e.jsx("h3",{style:{fontSize:"18px",fontWeight:700,color:"#1B3A4B",margin:0},children:n.title}),e.jsxs("p",{style:{color:"#6B7280",fontSize:"12px",marginTop:"4px"},children:[n.id.toUpperCase()," | ",n.standards.join(", ")]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(120px, 1fr))",gap:"12px",marginBottom:"20px"},children:[e.jsx(u,{label:"Elements",value:i.elementCount,color:"#2563eb"}),e.jsx(u,{label:"Gaps",value:i.gapCount,color:i.gapCount>0?"#dc2626":"#059669"}),e.jsx(u,{label:"Status",value:i.status,color:i.status==="complete"?"#059669":i.status==="partial"?"#d97706":"#dc2626"})]}),Array.from(s.entries()).sort().map(([r,x])=>e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsxs("h4",{style:{fontSize:"13px",fontWeight:600,color:"#374151",marginBottom:"8px"},children:[r," (",x.length,")"]}),e.jsxs("div",{style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:"6px",overflow:"hidden"},children:[e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"#f3f4f6"},children:[e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600,color:"#374151"},children:"Name"}),e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600,color:"#374151"},children:"Layer"}),e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600,color:"#374151"},children:"Description"})]})}),e.jsx("tbody",{children:x.slice(0,50).map(g=>e.jsxs("tr",{style:{borderTop:"1px solid #e5e7eb"},children:[e.jsx("td",{style:{padding:"6px 10px",color:"#2563eb",fontWeight:500},children:g.name}),e.jsx("td",{style:{padding:"6px 10px",color:"#6B7280"},children:g.layer}),e.jsx("td",{style:{padding:"6px 10px",color:"#6B7280",maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.doc||"—"})]},g.id))})]}),x.length>50&&e.jsxs("div",{style:{padding:"8px 10px",fontSize:"11px",color:"#9CA3AF",background:"#f9fafb"},children:["...and ",x.length-50," more"]})]})]},r)),i.violations.length>0&&e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsxs("h4",{style:{fontSize:"13px",fontWeight:600,color:"#dc2626",marginBottom:"8px"},children:["Validation Issues (",i.violations.length,")"]}),e.jsx("div",{style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:"6px",overflow:"hidden"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"#f3f4f6"},children:[e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600},children:"Severity"}),e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600},children:"Rule"}),e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600},children:"Element"}),e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600},children:"Description"})]})}),e.jsx("tbody",{children:i.violations.slice(0,50).map((r,x)=>e.jsxs("tr",{style:{borderTop:"1px solid #e5e7eb"},children:[e.jsx("td",{style:{padding:"6px 10px"},children:e.jsx("span",{style:{fontSize:"10px",fontWeight:600,padding:"1px 6px",borderRadius:"3px",background:r.severity==="error"?"#fef2f2":"#fffbeb",color:r.severity==="error"?"#dc2626":"#d97706"},children:r.severity})}),e.jsx("td",{style:{padding:"6px 10px",color:"#6B7280",fontFamily:"monospace",fontSize:"11px"},children:r.ruleId}),e.jsx("td",{style:{padding:"6px 10px",color:"#2563eb"},children:r.elementName}),e.jsx("td",{style:{padding:"6px 10px",color:"#6B7280"},children:r.description})]},x))})]})})]}),a.length===0&&e.jsxs("div",{style:{padding:"40px",textAlign:"center",color:"#9CA3AF",background:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px"},children:[e.jsx("p",{style:{fontSize:"14px",marginBottom:"4px"},children:"No model elements found for this document type."}),e.jsxs("p",{style:{fontSize:"12px"},children:["Add elements of kinds: ",n.relevantKinds.join(", ")]})]})]})}export{z as DhfDashboard};
1
+ import{j as e}from"./reactflow-CsCqNKB-.js";import{a as m}from"./zustand-CrhqMOHB.js";import{u as b}from"./index-CVW92JY7.js";const h=[{id:"rmp",title:"Risk Management Plan",standards:["ISO 14971:2019 §4.4"],layers:["risk"],relevantKinds:["Hazard","HazardousSituation","Harm","RiskControlMeasure","RiskAcceptabilityCriteria"],group:"risk"},{id:"har",title:"Hazard Analysis Report",standards:["ISO 14971:2019 §5","ISO 14971:2019 §6"],layers:["risk"],relevantKinds:["Hazard","HazardousSituation","Harm","RiskControlMeasure"],group:"risk"},{id:"fmea",title:"Failure Mode and Effects Analysis",standards:["IEC 60812:2018"],layers:["risk","functional","physical"],relevantKinds:["Hazard","RiskControlMeasure","Function","Component","Subsystem"],group:"risk"},{id:"rtm",title:"Requirements Traceability Matrix",standards:["IEC 62304:2006 §5.1.1"],layers:["requirements","functional","verification"],relevantKinds:["Requirement","Requirement","DesignInput","DesignOutput","TestCase","VerificationActivity"],group:"design"},{id:"sad",title:"System Architecture Description",standards:["ISO/IEC/IEEE 42010:2022"],layers:["functional","logical","physical","software","interfaces"],relevantKinds:["Function","Component","Subsystem","Interface","Port","SoftwareItem","SOUPComponent"],group:"design"},{id:"sds",title:"Software Design Specification",standards:["IEC 62304:2006 §5.4"],layers:["software"],relevantKinds:["SoftwareItem","SoftwareUnit","SoftwareSystem","SOUPComponent","Interface"],group:"design"},{id:"soup",title:"SOUP List",standards:["IEC 62304:2006 §8.1.2"],layers:["software"],relevantKinds:["SOUPComponent"],group:"design"},{id:"dip",title:"Design Input Plan",standards:["ISO 13485:2016 §7.3.3"],layers:["requirements","business"],relevantKinds:["DesignInput","Requirement","Need","UseCase"],group:"design"},{id:"dop",title:"Design Output Plan",standards:["ISO 13485:2016 §7.3.4"],layers:["functional","physical","software"],relevantKinds:["DesignOutput","Component","SoftwareItem","Function"],group:"design"},{id:"vvp",title:"Verification & Validation Plan",standards:["ISO 13485:2016 §7.3.6"],layers:["verification"],relevantKinds:["TestCase","VerificationActivity","ValidationActivity","TestProtocol"],group:"verification"},{id:"vvr",title:"Verification & Validation Report",standards:["ISO 13485:2016 §7.3.7"],layers:["verification"],relevantKinds:["TestCase","VerificationActivity","ValidationActivity","TestResult"],group:"verification"},{id:"sdp",title:"Software Development Plan",standards:["IEC 62304:2006 §5.1"],layers:["software","verification"],relevantKinds:["SoftwareItem","SoftwareUnit","SoftwareSystem","TestCase"],group:"compliance"},{id:"csr",title:"Clinical Safety Report",standards:["ISO 14971:2019 §10"],layers:["risk","verification"],relevantKinds:["Hazard","RiskControlMeasure","ClinicalEvidence","ValidationActivity"],group:"compliance"},{id:"uer",title:"Usability Engineering Report",standards:["IEC 62366-1:2015"],layers:["ui","requirements"],relevantKinds:["UseCase","UserActivity","UserInterface","UsabilityRequirement"],group:"compliance"},{id:"cybersecurity",title:"Cybersecurity Documentation",standards:["IEC 81001-5-1:2021"],layers:["software","interfaces"],relevantKinds:["ThreatModel","SecurityControl","Interface","SOUPComponent"],group:"compliance"},{id:"labeling",title:"Labeling Specification",standards:["21 CFR 801"],layers:["requirements","ui"],relevantKinds:["LabelingRequirement","Requirement"],group:"compliance"},{id:"dhf-index",title:"Design History File Index",standards:["ISO 13485:2016 §4.2.4"],layers:[],relevantKinds:[],group:"all"},{id:"change-log",title:"Design Change Log",standards:["ISO 13485:2016 §7.3.9"],layers:[],relevantKinds:[],group:"all"}],j={risk:"Risk Management",design:"Design & Architecture",verification:"Verification & Validation",compliance:"Compliance & Standards",all:"General"},v={risk:"#E74C3C",design:"#4A90D9",verification:"#2ECC71",compliance:"#8E44AD",all:"#6B7280"};function B(n,i,o){const l=Object.values(i.elements).filter(s=>n.relevantKinds.includes(s.kind)),c=((o==null?void 0:o.violations)||[]).filter(s=>n.relevantKinds.includes(s.elementKind)||n.layers.includes(s.layer)),a=c.filter(s=>s.severity==="error").length;return{elementCount:l.length,gapCount:a,status:l.length===0?"empty":a===0?"complete":"partial",violations:c}}function z(){const n=b(t=>t.model),i=b(t=>t.validation),o=b(t=>t.completeness),[l,c]=m.useState(null),[a,s]=m.useState(null),r=m.useMemo(()=>{if(!n)return new Map;const t=new Map;for(const d of h)t.set(d.id,B(d,n,i));return t},[n,i]),x=m.useMemo(()=>a?h.filter(t=>t.group===a||t.group==="all"):h,[a]),g=m.useMemo(()=>{const t=new Map;for(const d of x){const p=d.group;t.has(p)||t.set(p,[]),t.get(p).push(d)}return t},[x]),f=m.useMemo(()=>{let t=0,d=0,p=0;for(const y of r.values())y.status==="complete"?t++:y.status==="partial"?d++:p++;return{complete:t,partial:d,empty:p,total:h.length}},[r]);if(!n)return e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"#9CA3AF"},children:"Waiting for model data..."});const C=l?h.find(t=>t.id===l):null,A=l?r.get(l):null;return e.jsxs("div",{style:{height:"100%",overflow:"auto",background:"#F7F7F5",padding:"24px"},children:[e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx("h2",{style:{fontSize:"20px",fontWeight:700,color:"#1B3A4B",margin:0},children:"Documents"}),e.jsxs("p",{style:{color:"#6B7280",fontSize:"13px",marginTop:"4px"},children:["Design history file · ",f.total," documents | ",f.complete," complete | ",f.partial," partial | ",f.empty," empty",o&&` | Overall completeness: ${o.overall}%`]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"12px",marginBottom:"24px"},children:[e.jsx(u,{label:"Complete",value:f.complete,color:"#059669"}),e.jsx(u,{label:"Partial",value:f.partial,color:"#d97706"}),e.jsx(u,{label:"Empty",value:f.empty,color:"#dc2626"}),e.jsx(u,{label:"Completeness",value:`${(o==null?void 0:o.overall)||0}%`,color:"#2563eb"})]}),e.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"20px",flexWrap:"wrap"},children:[e.jsx(S,{label:"All",active:!a,onClick:()=>s(null)}),Object.entries(j).filter(([t])=>t!=="all").map(([t,d])=>e.jsx(S,{label:d,active:a===t,onClick:()=>s(a===t?null:t),color:v[t]},t))]}),l?e.jsx(w,{doc:C,status:A,model:n,validation:i,onBack:()=>c(null)}):Array.from(g.entries()).map(([t,d])=>e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsxs("h3",{style:{fontSize:"14px",fontWeight:600,color:v[t]||"#374151",marginBottom:"12px",display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:v[t]||"#6B7280",display:"inline-block"}}),j[t]||t]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"12px"},children:d.map(p=>{const y=r.get(p.id);return e.jsx(k,{doc:p,status:y,onClick:()=>c(p.id)},p.id)})})]},t))]})}function u({label:n,value:i,color:o}){return e.jsxs("div",{style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"14px 16px",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"24px",fontWeight:700,color:o},children:i}),e.jsx("div",{style:{fontSize:"11px",color:"#6B7280",marginTop:"2px"},children:n})]})}function S({label:n,active:i,onClick:o,color:l}){return e.jsx("button",{onClick:o,style:{padding:"4px 12px",borderRadius:"16px",fontSize:"12px",fontWeight:500,border:`1px solid ${i?l||"#2DD4A8":"#e5e7eb"}`,background:i?(l||"#2DD4A8")+"15":"#fff",color:i?l||"#1B3A4B":"#6B7280",cursor:"pointer"},children:n})}function k({doc:n,status:i,onClick:o}){const l=i.status==="complete"?"#059669":i.status==="partial"?"#d97706":"#dc2626",c=i.status==="complete"?"#ecfdf5":i.status==="partial"?"#fffbeb":"#fef2f2",a=i.status==="complete"?"Complete":i.status==="partial"?"Partial":"Empty";return e.jsxs("div",{onClick:o,style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s"},onMouseEnter:s=>{s.currentTarget.style.borderColor="#2DD4A8",s.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.06)"},onMouseLeave:s=>{s.currentTarget.style.borderColor="#e5e7eb",s.currentTarget.style.boxShadow="none"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"8px"},children:[e.jsx("span",{style:{fontSize:"11px",fontWeight:600,color:"#6B7280",fontFamily:"monospace"},children:n.id.toUpperCase()}),e.jsx("span",{style:{fontSize:"10px",fontWeight:600,padding:"2px 6px",borderRadius:"4px",background:c,color:l},children:a})]}),e.jsx("div",{style:{fontSize:"14px",fontWeight:600,color:"#1B3A4B",marginBottom:"6px"},children:n.title}),e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginBottom:"8px"},children:n.standards[0]}),e.jsxs("div",{style:{display:"flex",gap:"16px",fontSize:"12px",color:"#6B7280"},children:[e.jsxs("span",{children:[i.elementCount," elements"]}),i.gapCount>0&&e.jsxs("span",{style:{color:"#dc2626"},children:[i.gapCount," gaps"]})]})]})}function w({doc:n,status:i,model:o,validation:l,onBack:c}){const a=Object.values(o.elements).filter(r=>n.relevantKinds.includes(r.kind)),s=new Map;for(const r of a)s.has(r.kind)||s.set(r.kind,[]),s.get(r.kind).push(r);return e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"20px"},children:[e.jsx("button",{onClick:c,style:{background:"none",border:"none",color:"#2563eb",cursor:"pointer",fontSize:"13px",padding:0,marginBottom:"8px"},children:"← Back to dashboard"}),e.jsx("h3",{style:{fontSize:"18px",fontWeight:700,color:"#1B3A4B",margin:0},children:n.title}),e.jsxs("p",{style:{color:"#6B7280",fontSize:"12px",marginTop:"4px"},children:[n.id.toUpperCase()," | ",n.standards.join(", ")]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(120px, 1fr))",gap:"12px",marginBottom:"20px"},children:[e.jsx(u,{label:"Elements",value:i.elementCount,color:"#2563eb"}),e.jsx(u,{label:"Gaps",value:i.gapCount,color:i.gapCount>0?"#dc2626":"#059669"}),e.jsx(u,{label:"Status",value:i.status,color:i.status==="complete"?"#059669":i.status==="partial"?"#d97706":"#dc2626"})]}),Array.from(s.entries()).sort().map(([r,x])=>e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsxs("h4",{style:{fontSize:"13px",fontWeight:600,color:"#374151",marginBottom:"8px"},children:[r," (",x.length,")"]}),e.jsxs("div",{style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:"6px",overflow:"hidden"},children:[e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"#f3f4f6"},children:[e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600,color:"#374151"},children:"Name"}),e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600,color:"#374151"},children:"Layer"}),e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600,color:"#374151"},children:"Description"})]})}),e.jsx("tbody",{children:x.slice(0,50).map(g=>e.jsxs("tr",{style:{borderTop:"1px solid #e5e7eb"},children:[e.jsx("td",{style:{padding:"6px 10px",color:"#2563eb",fontWeight:500},children:g.name}),e.jsx("td",{style:{padding:"6px 10px",color:"#6B7280"},children:g.layer}),e.jsx("td",{style:{padding:"6px 10px",color:"#6B7280",maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.doc||"—"})]},g.id))})]}),x.length>50&&e.jsxs("div",{style:{padding:"8px 10px",fontSize:"11px",color:"#9CA3AF",background:"#f9fafb"},children:["...and ",x.length-50," more"]})]})]},r)),i.violations.length>0&&e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsxs("h4",{style:{fontSize:"13px",fontWeight:600,color:"#dc2626",marginBottom:"8px"},children:["Validation Issues (",i.violations.length,")"]}),e.jsx("div",{style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:"6px",overflow:"hidden"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"#f3f4f6"},children:[e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600},children:"Severity"}),e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600},children:"Rule"}),e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600},children:"Element"}),e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600},children:"Description"})]})}),e.jsx("tbody",{children:i.violations.slice(0,50).map((r,x)=>e.jsxs("tr",{style:{borderTop:"1px solid #e5e7eb"},children:[e.jsx("td",{style:{padding:"6px 10px"},children:e.jsx("span",{style:{fontSize:"10px",fontWeight:600,padding:"1px 6px",borderRadius:"3px",background:r.severity==="error"?"#fef2f2":"#fffbeb",color:r.severity==="error"?"#dc2626":"#d97706"},children:r.severity})}),e.jsx("td",{style:{padding:"6px 10px",color:"#6B7280",fontFamily:"monospace",fontSize:"11px"},children:r.ruleId}),e.jsx("td",{style:{padding:"6px 10px",color:"#2563eb"},children:r.elementName}),e.jsx("td",{style:{padding:"6px 10px",color:"#6B7280"},children:r.description})]},x))})]})})]}),a.length===0&&e.jsxs("div",{style:{padding:"40px",textAlign:"center",color:"#9CA3AF",background:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px"},children:[e.jsx("p",{style:{fontSize:"14px",marginBottom:"4px"},children:"No model elements found for this document type."}),e.jsxs("p",{style:{fontSize:"12px"},children:["Add elements of kinds: ",n.relevantKinds.join(", ")]})]})]})}export{z as DhfDashboard};
@@ -1 +1 @@
1
- import{j as e}from"./reactflow-CsCqNKB-.js";import{a as d}from"./zustand-CrhqMOHB.js";import{u as p}from"./index-BMgENwvO.js";const y=[{value:"",label:"— Select phase —"},{value:"concept",label:"Concept"},{value:"design",label:"Design & Development"},{value:"verification",label:"Verification & Validation"},{value:"production",label:"Production"}],i={width:"100%",padding:"7px 10px",border:"1px solid #D1D5DB",borderRadius:"6px",fontSize:"13px",color:"#1B3A4B",background:"#fff",boxSizing:"border-box",outline:"none",fontFamily:"inherit"},n={fontSize:"11px",fontWeight:600,color:"#6B7280",textTransform:"uppercase",letterSpacing:"0.04em",display:"block",marginBottom:"4px"},s={fontSize:"12px",fontWeight:700,color:"#1B3A4B",paddingBottom:"6px",borderBottom:"1px solid #E5E7EB",marginBottom:"12px",marginTop:"4px"},j={display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"};function C({onClose:a}){const c=p(o=>o.dhfSettings),x=p(o=>o.updateDhfSettings),[l,g]=d.useState({...c}),[r,h]=d.useState("identity");function t(o,m){g(f=>({...f,[o]:m}))}function u(){x(l),a()}return e.jsx("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.45)"},onClick:o=>{o.target===o.currentTarget&&a()},children:e.jsxs("div",{style:{background:"#fff",borderRadius:"12px",width:"560px",maxHeight:"86vh",display:"flex",flexDirection:"column",boxShadow:"0 24px 60px rgba(0,0,0,0.22)",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px 20px",borderBottom:"1px solid #E5E7EB",flexShrink:0},children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#6B7280",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),e.jsx("span",{style:{fontSize:"15px",fontWeight:700,color:"#1B3A4B",flex:1},children:"DHF Global Settings"}),e.jsx("button",{onClick:a,style:{background:"none",border:"none",cursor:"pointer",color:"#9CA3AF",fontSize:"20px",lineHeight:1,padding:"0 2px"},children:"×"})]}),e.jsx("div",{style:{display:"flex",borderBottom:"1px solid #E5E7EB",flexShrink:0,padding:"0 20px"},children:["identity","branding","layout"].map(o=>e.jsx("button",{onClick:()=>h(o),style:{padding:"10px 14px",border:"none",background:"none",fontSize:"12px",fontWeight:600,cursor:"pointer",color:r===o?"#1B3A4B":"#9CA3AF",borderBottom:`2px solid ${r===o?"#2DD4A8":"transparent"}`,marginBottom:"-1px",textTransform:"capitalize"},children:o==="identity"?"Project":o==="branding"?"Branding":"Layout"},o))}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px"},children:[r==="identity"&&e.jsxs("div",{children:[e.jsx("p",{style:s,children:"Project Identity"}),e.jsxs("p",{style:{fontSize:"12px",color:"#6B7280",marginBottom:"16px",lineHeight:"1.5"},children:["These values resolve ",e.jsx("code",{style:{background:"#F3F4F6",padding:"1px 4px",borderRadius:"3px"},children:"{{project.*}}"})," directives in all templates and the AI drafting context."]}),e.jsxs("div",{style:j,children:[e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Company / Manufacturer"}),e.jsx("input",{style:i,value:l.company,onChange:o=>t("company",o.target.value),placeholder:"Acme Medical Devices Inc."})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Product / Device Name"}),e.jsx("input",{style:i,value:l.product,onChange:o=>t("product",o.target.value),placeholder:"InfuSafe IV Pump"})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Device Type"}),e.jsx("input",{style:i,value:l.deviceType,onChange:o=>t("deviceType",o.target.value),placeholder:"Class II active implantable"})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Document Version"}),e.jsx("input",{style:i,value:l.version,onChange:o=>t("version",o.target.value),placeholder:"1.0.0"})]}),e.jsxs("div",{style:{gridColumn:"1 / -1"},children:[e.jsx("label",{style:n,children:"Development Phase"}),e.jsx("select",{style:i,value:l.phase,onChange:o=>t("phase",o.target.value),children:y.map(o=>e.jsx("option",{value:o.value,children:o.label},o.value))})]}),e.jsxs("div",{style:{gridColumn:"1 / -1"},children:[e.jsx("label",{style:n,children:"Document ID Prefix"}),e.jsx("input",{style:{...i,fontFamily:"monospace"},value:l.documentNumberingPrefix,onChange:o=>t("documentNumberingPrefix",o.target.value),placeholder:"DOC"}),e.jsxs("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:["Used in document IDs, e.g. ",e.jsxs("code",{children:[l.documentNumberingPrefix||"DOC","-RMP-001"]})]})]})]})]}),r==="branding"&&e.jsxs("div",{children:[e.jsx("p",{style:s,children:"Branding"}),e.jsx("p",{style:{fontSize:"12px",color:"#6B7280",marginBottom:"16px",lineHeight:"1.5"},children:"Branding applied to exported HTML and DOCX documents. Per-document overrides can be set in the document's frontmatter."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:[e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Full Logo URL"}),e.jsx("input",{style:i,value:l.logoUrl,onChange:o=>t("logoUrl",o.target.value),placeholder:"https://... or data:image/png;base64,..."}),e.jsx("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:"Shown in document cover pages and report headers."}),l.logoUrl&&e.jsx("img",{src:l.logoUrl,alt:"Logo preview",style:{maxHeight:"48px",maxWidth:"200px",marginTop:"8px",border:"1px solid #E5E7EB",borderRadius:"4px",padding:"4px"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Compact Logo URL"}),e.jsx("input",{style:i,value:l.compactLogoUrl,onChange:o=>t("compactLogoUrl",o.target.value),placeholder:"https://... or data:image/png;base64,..."}),e.jsx("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:"Shown in page headers (small). Falls back to Full Logo if empty."}),l.compactLogoUrl&&e.jsx("img",{src:l.compactLogoUrl,alt:"Compact logo preview",style:{maxHeight:"28px",maxWidth:"120px",marginTop:"8px",border:"1px solid #E5E7EB",borderRadius:"4px",padding:"4px"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Primary Color"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[e.jsx("input",{type:"color",value:l.primaryColor,onChange:o=>t("primaryColor",o.target.value),style:{width:"40px",height:"32px",padding:"2px",border:"1px solid #D1D5DB",borderRadius:"6px",cursor:"pointer"}}),e.jsx("input",{style:{...i,flex:1,fontFamily:"monospace"},value:l.primaryColor,onChange:o=>t("primaryColor",o.target.value),placeholder:"#1B3A4B"})]}),e.jsx("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:"Used for headings, table headers, and badges in exported documents."})]})]})]}),r==="layout"&&e.jsxs("div",{children:[e.jsx("p",{style:s,children:"Document Layout"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[e.jsxs("div",{children:[e.jsxs("label",{style:{...n,display:"flex",alignItems:"center",gap:"8px",textTransform:"none",fontSize:"13px",fontWeight:600,color:"#1B3A4B",marginBottom:0},children:[e.jsx("input",{type:"checkbox",checked:l.compactMode,onChange:o=>t("compactMode",o.target.checked),style:{accentColor:"#2DD4A8"}}),"Compact mode"]}),e.jsx("p",{style:{fontSize:"12px",color:"#6B7280",marginTop:"4px",marginLeft:"20px"},children:"Tighter line spacing and smaller heading sizes. Useful for regulatory submissions."})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Page Header Template"}),e.jsx("input",{style:{...i,fontFamily:"monospace",fontSize:"12px"},value:l.headerTemplate,onChange:o=>t("headerTemplate",o.target.value)}),e.jsxs("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:["Tokens: ",e.jsx("code",{children:"{{id}}"}),", ",e.jsx("code",{children:"{{title}}"}),", ",e.jsx("code",{children:"{{project.product}}"}),", ",e.jsx("code",{children:"{{project.version}}"}),", ",e.jsx("code",{children:"{{date}}"})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Page Footer Template"}),e.jsx("input",{style:{...i,fontFamily:"monospace",fontSize:"12px"},value:l.footerTemplate,onChange:o=>t("footerTemplate",o.target.value)}),e.jsxs("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:["Tokens: same as header, plus ",e.jsx("code",{children:"{{page}}"})," and ",e.jsx("code",{children:"{{pages}}"})]})]})]})]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",padding:"14px 20px",borderTop:"1px solid #E5E7EB",flexShrink:0,background:"#FAFAFA"},children:[e.jsx("button",{onClick:a,style:{padding:"8px 16px",borderRadius:"6px",border:"1px solid #D1D5DB",background:"#fff",fontSize:"13px",cursor:"pointer",color:"#374151"},children:"Cancel"}),e.jsx("button",{onClick:u,style:{padding:"8px 20px",borderRadius:"6px",border:"none",background:"#2DD4A8",fontSize:"13px",fontWeight:600,cursor:"pointer",color:"#065F46"},children:"Save Settings"})]})]})})}export{C as DhfSettingsPanel};
1
+ import{j as e}from"./reactflow-CsCqNKB-.js";import{a as d}from"./zustand-CrhqMOHB.js";import{u as p}from"./index-CVW92JY7.js";const y=[{value:"",label:"— Select phase —"},{value:"concept",label:"Concept"},{value:"design",label:"Design & Development"},{value:"verification",label:"Verification & Validation"},{value:"production",label:"Production"}],i={width:"100%",padding:"7px 10px",border:"1px solid #D1D5DB",borderRadius:"6px",fontSize:"13px",color:"#1B3A4B",background:"#fff",boxSizing:"border-box",outline:"none",fontFamily:"inherit"},n={fontSize:"11px",fontWeight:600,color:"#6B7280",textTransform:"uppercase",letterSpacing:"0.04em",display:"block",marginBottom:"4px"},s={fontSize:"12px",fontWeight:700,color:"#1B3A4B",paddingBottom:"6px",borderBottom:"1px solid #E5E7EB",marginBottom:"12px",marginTop:"4px"},j={display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"};function C({onClose:a}){const c=p(o=>o.dhfSettings),x=p(o=>o.updateDhfSettings),[l,g]=d.useState({...c}),[r,h]=d.useState("identity");function t(o,m){g(f=>({...f,[o]:m}))}function u(){x(l),a()}return e.jsx("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.45)"},onClick:o=>{o.target===o.currentTarget&&a()},children:e.jsxs("div",{style:{background:"#fff",borderRadius:"12px",width:"560px",maxHeight:"86vh",display:"flex",flexDirection:"column",boxShadow:"0 24px 60px rgba(0,0,0,0.22)",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px 20px",borderBottom:"1px solid #E5E7EB",flexShrink:0},children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#6B7280",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),e.jsx("span",{style:{fontSize:"15px",fontWeight:700,color:"#1B3A4B",flex:1},children:"DHF Global Settings"}),e.jsx("button",{onClick:a,style:{background:"none",border:"none",cursor:"pointer",color:"#9CA3AF",fontSize:"20px",lineHeight:1,padding:"0 2px"},children:"×"})]}),e.jsx("div",{style:{display:"flex",borderBottom:"1px solid #E5E7EB",flexShrink:0,padding:"0 20px"},children:["identity","branding","layout"].map(o=>e.jsx("button",{onClick:()=>h(o),style:{padding:"10px 14px",border:"none",background:"none",fontSize:"12px",fontWeight:600,cursor:"pointer",color:r===o?"#1B3A4B":"#9CA3AF",borderBottom:`2px solid ${r===o?"#2DD4A8":"transparent"}`,marginBottom:"-1px",textTransform:"capitalize"},children:o==="identity"?"Project":o==="branding"?"Branding":"Layout"},o))}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px"},children:[r==="identity"&&e.jsxs("div",{children:[e.jsx("p",{style:s,children:"Project Identity"}),e.jsxs("p",{style:{fontSize:"12px",color:"#6B7280",marginBottom:"16px",lineHeight:"1.5"},children:["These values resolve ",e.jsx("code",{style:{background:"#F3F4F6",padding:"1px 4px",borderRadius:"3px"},children:"{{project.*}}"})," directives in all templates and the AI drafting context."]}),e.jsxs("div",{style:j,children:[e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Company / Manufacturer"}),e.jsx("input",{style:i,value:l.company,onChange:o=>t("company",o.target.value),placeholder:"Acme Medical Devices Inc."})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Product / Device Name"}),e.jsx("input",{style:i,value:l.product,onChange:o=>t("product",o.target.value),placeholder:"InfuSafe IV Pump"})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Device Type"}),e.jsx("input",{style:i,value:l.deviceType,onChange:o=>t("deviceType",o.target.value),placeholder:"Class II active implantable"})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Document Version"}),e.jsx("input",{style:i,value:l.version,onChange:o=>t("version",o.target.value),placeholder:"1.0.0"})]}),e.jsxs("div",{style:{gridColumn:"1 / -1"},children:[e.jsx("label",{style:n,children:"Development Phase"}),e.jsx("select",{style:i,value:l.phase,onChange:o=>t("phase",o.target.value),children:y.map(o=>e.jsx("option",{value:o.value,children:o.label},o.value))})]}),e.jsxs("div",{style:{gridColumn:"1 / -1"},children:[e.jsx("label",{style:n,children:"Document ID Prefix"}),e.jsx("input",{style:{...i,fontFamily:"monospace"},value:l.documentNumberingPrefix,onChange:o=>t("documentNumberingPrefix",o.target.value),placeholder:"DOC"}),e.jsxs("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:["Used in document IDs, e.g. ",e.jsxs("code",{children:[l.documentNumberingPrefix||"DOC","-RMP-001"]})]})]})]})]}),r==="branding"&&e.jsxs("div",{children:[e.jsx("p",{style:s,children:"Branding"}),e.jsx("p",{style:{fontSize:"12px",color:"#6B7280",marginBottom:"16px",lineHeight:"1.5"},children:"Branding applied to exported HTML and DOCX documents. Per-document overrides can be set in the document's frontmatter."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:[e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Full Logo URL"}),e.jsx("input",{style:i,value:l.logoUrl,onChange:o=>t("logoUrl",o.target.value),placeholder:"https://... or data:image/png;base64,..."}),e.jsx("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:"Shown in document cover pages and report headers."}),l.logoUrl&&e.jsx("img",{src:l.logoUrl,alt:"Logo preview",style:{maxHeight:"48px",maxWidth:"200px",marginTop:"8px",border:"1px solid #E5E7EB",borderRadius:"4px",padding:"4px"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Compact Logo URL"}),e.jsx("input",{style:i,value:l.compactLogoUrl,onChange:o=>t("compactLogoUrl",o.target.value),placeholder:"https://... or data:image/png;base64,..."}),e.jsx("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:"Shown in page headers (small). Falls back to Full Logo if empty."}),l.compactLogoUrl&&e.jsx("img",{src:l.compactLogoUrl,alt:"Compact logo preview",style:{maxHeight:"28px",maxWidth:"120px",marginTop:"8px",border:"1px solid #E5E7EB",borderRadius:"4px",padding:"4px"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Primary Color"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[e.jsx("input",{type:"color",value:l.primaryColor,onChange:o=>t("primaryColor",o.target.value),style:{width:"40px",height:"32px",padding:"2px",border:"1px solid #D1D5DB",borderRadius:"6px",cursor:"pointer"}}),e.jsx("input",{style:{...i,flex:1,fontFamily:"monospace"},value:l.primaryColor,onChange:o=>t("primaryColor",o.target.value),placeholder:"#1B3A4B"})]}),e.jsx("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:"Used for headings, table headers, and badges in exported documents."})]})]})]}),r==="layout"&&e.jsxs("div",{children:[e.jsx("p",{style:s,children:"Document Layout"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[e.jsxs("div",{children:[e.jsxs("label",{style:{...n,display:"flex",alignItems:"center",gap:"8px",textTransform:"none",fontSize:"13px",fontWeight:600,color:"#1B3A4B",marginBottom:0},children:[e.jsx("input",{type:"checkbox",checked:l.compactMode,onChange:o=>t("compactMode",o.target.checked),style:{accentColor:"#2DD4A8"}}),"Compact mode"]}),e.jsx("p",{style:{fontSize:"12px",color:"#6B7280",marginTop:"4px",marginLeft:"20px"},children:"Tighter line spacing and smaller heading sizes. Useful for regulatory submissions."})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Page Header Template"}),e.jsx("input",{style:{...i,fontFamily:"monospace",fontSize:"12px"},value:l.headerTemplate,onChange:o=>t("headerTemplate",o.target.value)}),e.jsxs("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:["Tokens: ",e.jsx("code",{children:"{{id}}"}),", ",e.jsx("code",{children:"{{title}}"}),", ",e.jsx("code",{children:"{{project.product}}"}),", ",e.jsx("code",{children:"{{project.version}}"}),", ",e.jsx("code",{children:"{{date}}"})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Page Footer Template"}),e.jsx("input",{style:{...i,fontFamily:"monospace",fontSize:"12px"},value:l.footerTemplate,onChange:o=>t("footerTemplate",o.target.value)}),e.jsxs("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:["Tokens: same as header, plus ",e.jsx("code",{children:"{{page}}"})," and ",e.jsx("code",{children:"{{pages}}"})]})]})]})]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",padding:"14px 20px",borderTop:"1px solid #E5E7EB",flexShrink:0,background:"#FAFAFA"},children:[e.jsx("button",{onClick:a,style:{padding:"8px 16px",borderRadius:"6px",border:"1px solid #D1D5DB",background:"#fff",fontSize:"13px",cursor:"pointer",color:"#374151"},children:"Cancel"}),e.jsx("button",{onClick:u,style:{padding:"8px 20px",borderRadius:"6px",border:"none",background:"#2DD4A8",fontSize:"13px",fontWeight:600,cursor:"pointer",color:"#065F46"},children:"Save Settings"})]})]})})}export{C as DhfSettingsPanel};