@memoarchitect/architect 0.4.4 → 0.4.5

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 (32) hide show
  1. package/README.md +17 -6
  2. package/dist/assets/{AskPanel-BpFRMop9.js → AskPanel-D9_AKyYt.js} +1 -1
  3. package/dist/assets/{ComplianceWizard-DCcV-q6X.js → ComplianceWizard-BNvT_ic6.js} +1 -1
  4. package/dist/assets/{DSMView-OMMwi76e.js → DSMView-B4IEz19F.js} +1 -1
  5. package/dist/assets/{Dashboard-Dl5KU656.js → Dashboard-DNRzU1Hk.js} +1 -1
  6. package/dist/assets/{DhfDashboard-agI5JdAZ.js → DhfDashboard-DguH-rDT.js} +1 -1
  7. package/dist/assets/{DhfSettingsPanel-CKvGmNGe.js → DhfSettingsPanel-C89T0dv7.js} +1 -1
  8. package/dist/assets/{DhfWorkbench-BD_buvXh.js → DhfWorkbench-4gHayn-l.js} +3 -3
  9. package/dist/assets/{DiagramCanvas-CUYbaLjV.js → DiagramCanvas-BgfO0AtP.js} +1 -1
  10. package/dist/assets/{DiagramEditor-DZAocSs_.js → DiagramEditor-CEr6iqBf.js} +1 -1
  11. package/dist/assets/{DiagramSurface-BIK9fV8R.js → DiagramSurface-B_lfUNzV.js} +2 -2
  12. package/dist/assets/{ElementDetailView-R_Nob9E0.js → ElementDetailView-AclSjurg.js} +1 -1
  13. package/dist/assets/{ImportView-yxS8JfX4.js → ImportView-t1dIoZF5.js} +1 -1
  14. package/dist/assets/{LayerGrid-DdEtHyAu.js → LayerGrid-fSGvqSEj.js} +1 -1
  15. package/dist/assets/{LayerTable-dOCvwCEb.js → LayerTable-D8QCFY1b.js} +1 -1
  16. package/dist/assets/{MaxGraphCanvas-CDdlW8h_.js → MaxGraphCanvas-DYs6MPuP.js} +1 -1
  17. package/dist/assets/{ModelDiff-BbdzLhXe.js → ModelDiff-CLFqnELG.js} +1 -1
  18. package/dist/assets/{OntologyDecompositionDiagram-BW07CXuV.js → OntologyDecompositionDiagram-cpmTTMRH.js} +1 -1
  19. package/dist/assets/{OntologyViewer-DaRXEQoq.js → OntologyViewer-72jTw72H.js} +2 -2
  20. package/dist/assets/{ReviewDashboard-CipgA5-r.js → ReviewDashboard-BVOe2I5w.js} +1 -1
  21. package/dist/assets/{ScenarioEditor-BfewgrrJ.js → ScenarioEditor-CvOkiRC6.js} +1 -1
  22. package/dist/assets/{StatisticsDashboard-CLww46qL.js → StatisticsDashboard-Dn6lsnKe.js} +1 -1
  23. package/dist/assets/{SysmlGenerator-DnsaN-ey.js → SysmlGenerator-CfBQWovl.js} +1 -1
  24. package/dist/assets/{TabularView-Bp-yKFPV.js → TabularView-B99xy3H3.js} +1 -1
  25. package/dist/assets/{TraceabilityMatrix-B-dn_i5a.js → TraceabilityMatrix-BAJb0X7G.js} +1 -1
  26. package/dist/assets/{WorkflowWizard-C6p5e2IT.js → WorkflowWizard-C38DZKOe.js} +1 -1
  27. package/dist/assets/{index-c27kHB43.js → index-CgRwea72.js} +12 -12
  28. package/dist/assets/{index-BZhRuk7M.css → index-CnFhl4_e.css} +1 -1
  29. package/dist/assets/{layout-selection-DvOsyJH9.js → layout-selection-BQ2WuAEB.js} +1 -1
  30. package/dist/index.html +2 -2
  31. package/lib/bin/memo-architect.js +0 -0
  32. package/package.json +22 -21
@@ -1,2 +1,2 @@
1
- import{j as e}from"./reactflow-WKyu73tD.js";import{a as v}from"./zustand-qbFpP9Up.js";import{u as d,e as B,C as t,F as n,d as A,K,S as z}from"./index-c27kHB43.js";const R=new Set(["Scenario","UseCase","UserActivity"]);function W(i){return i?i.split(`
1
+ import{j as e}from"./reactflow-WKyu73tD.js";import{a as v}from"./zustand-qbFpP9Up.js";import{u as d,e as B,C as t,F as n,d as A,K,S as z}from"./index-CgRwea72.js";const R=new Set(["Scenario","UseCase","UserActivity"]);function W(i){return i?i.split(`
2
2
  `).filter(o=>o.trim()).map((o,c)=>{const p=o.match(/^\d+\.\s*(.*)/);return{index:c,text:p?p[1].trim():o.trim()}}):[]}function V({element:i,layerColor:o}){const c=v.useMemo(()=>W(i.doc||""),[i.doc]),[p,u]=v.useState(!1),S=d(r=>r.updateElementField),f=d(r=>r.applyEdit),y=d(r=>r.pendingEdits).get(i.id),l=(y==null?void 0:y.doc)??i.doc??"";if(c.length===0&&!p)return e.jsx("div",{className:"rounded-lg p-4 cursor-pointer text-center",style:{background:o+"08",border:`1px dashed ${o}40`,color:t.faint,fontSize:n.sm},onClick:()=>u(!0),children:"No steps defined. Click to add scenario steps (one per line, numbered)."});if(p){const r=()=>{f(i.id),u(!1)};return e.jsxs("div",{children:[e.jsxs("p",{style:{fontSize:n.xs,color:t.faint,marginBottom:"6px"},children:["Enter numbered steps, one per line: ",e.jsx("code",{children:"1. User does something"})]}),e.jsx("textarea",{value:l,onChange:b=>S(i.id,"doc",b.target.value),className:"w-full rounded-lg p-3 focus:outline-none",style:{border:`1px solid ${t.accent}`,background:t.surface,color:t.primary,fontSize:n.sm,minHeight:"120px",resize:"vertical",fontFamily:"monospace",lineHeight:1.7},autoFocus:!0}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx("button",{onClick:r,className:"px-3 py-1.5 rounded-md font-medium",style:{background:t.accent,color:t.accentDark,fontSize:n.xs},children:"Save"}),e.jsx("button",{onClick:()=>u(!1),className:"px-3 py-1.5 rounded-md",style:{color:t.muted,fontSize:n.xs,border:`1px solid ${t.border}`},children:"Cancel"})]})]})}return e.jsxs("div",{style:{position:"relative"},children:[e.jsx("button",{onClick:()=>u(!0),style:{position:"absolute",top:0,right:0,fontSize:n.xs,color:t.faint,padding:"2px 8px",border:`1px solid ${t.border}`,borderRadius:"6px",background:t.surface,cursor:"pointer"},onMouseEnter:r=>r.currentTarget.style.borderColor=t.accent,onMouseLeave:r=>r.currentTarget.style.borderColor=t.border,children:"Edit steps"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0,paddingTop:"4px"},children:[e.jsx("div",{style:{padding:"6px 20px",borderRadius:"999px",fontSize:n.xs,fontWeight:700,background:o,color:"#fff",letterSpacing:"0.06em",textTransform:"uppercase"},children:"Start"}),c.map((r,b)=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",width:"100%"},children:[e.jsx("div",{style:{width:"2px",height:"20px",background:o+"50",position:"relative"},children:e.jsx("div",{style:{position:"absolute",bottom:-5,left:"50%",transform:"translateX(-50%)",width:0,height:0,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderTop:`6px solid ${o}80`}})}),e.jsxs("div",{style:{width:"100%",maxWidth:"560px",display:"flex",alignItems:"flex-start",gap:"12px",background:t.surface,border:`1px solid ${o}30`,borderRadius:"8px",padding:"10px 14px",boxShadow:"0 1px 3px rgba(0,0,0,0.05)"},children:[e.jsx("span",{style:{flexShrink:0,width:"24px",height:"24px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:o+"18",color:o,fontSize:n.xs,fontWeight:700},children:b+1}),e.jsx("span",{style:{fontSize:n.sm,color:t.primary,lineHeight:1.5,paddingTop:"3px"},children:r.text})]})]},b)),e.jsx("div",{style:{width:"2px",height:"20px",background:o+"50",position:"relative"},children:e.jsx("div",{style:{position:"absolute",bottom:-5,left:"50%",transform:"translateX(-50%)",width:0,height:0,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderTop:`6px solid ${o}80`}})}),e.jsx("div",{style:{padding:"6px 20px",borderRadius:"999px",fontSize:n.xs,fontWeight:700,background:o+"20",color:o,letterSpacing:"0.06em",textTransform:"uppercase",border:`1px solid ${o}40`},children:"End"})]})]})}function X(){const i=d(s=>s.activeView),o=d(s=>s.model),c=d(s=>s.validation),p=d(s=>s.selectElement),u=d(s=>s.updateElementField),S=d(s=>s.updateElementAttribute),f=d(s=>s.cancelEdit),x=d(s=>s.applyEdit),y=d(s=>s.pendingEdits),l=i.type==="element-detail"?i.elementId:null,r=l&&o?o.elements[l]:null,[b,w]=v.useState(!1),[L,k]=v.useState(null),m=v.useMemo(()=>{if(!o||!l)return{incoming:[],outgoing:[]};const s=B(o,l);return{incoming:s.filter(a=>a.targetId===l),outgoing:s.filter(a=>a.sourceId===l)}},[o,l]),E=v.useMemo(()=>!c||!l?[]:c.violations.filter(s=>s.elementId===l),[c,l]);if(!r||!l)return e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:t.surfaceAlt},children:e.jsxs("div",{className:"text-center",style:{color:t.faint},children:[e.jsx("div",{style:{fontSize:"32px",marginBottom:"12px",opacity:.5},children:"📄"}),e.jsx("p",{style:{fontSize:n.md},children:"Select an element to view details"})]})});const C=A[r.layer]||t.muted,h=K[r.kind],j=y.get(l),F=(j==null?void 0:j.doc)??r.doc??"",O=y.has(l),T=()=>{x(l),w(!1),k(null)},D=s=>{if(!o)return s;const a=o.elements[s];return a?a.name:s};return e.jsx("div",{className:"flex-1 overflow-y-auto",style:{background:t.surfaceAlt},children:e.jsxs("div",{style:{maxWidth:"900px",margin:"0 auto",padding:"32px 40px"},children:[e.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"px-2 py-1 rounded font-semibold",style:{background:C+"18",color:C,fontSize:n.sm},children:r.kind}),e.jsx("span",{className:"px-2 py-1 rounded",style:{background:((h==null?void 0:h.color)||t.muted)+"12",color:(h==null?void 0:h.color)||t.muted,fontSize:n.xs},children:r.layer}),h&&e.jsx("span",{style:{color:t.faint,fontSize:n.xs},children:h.label})]}),e.jsx("h1",{style:{fontSize:"24px",fontWeight:700,color:t.primary,lineHeight:1.3},children:r.name}),e.jsx("p",{className:"mt-1",style:{color:t.faint,fontSize:n.xs,fontFamily:"monospace"},children:r.id})]}),O&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>f(l),className:"px-4 py-2 rounded-lg font-medium transition-all",style:{background:t.surface,color:t.muted,fontSize:n.sm,border:`1px solid ${t.border}`},onMouseEnter:s=>s.currentTarget.style.borderColor=t.accent,onMouseLeave:s=>s.currentTarget.style.borderColor=t.border,children:"Cancel"}),e.jsx("button",{onClick:T,className:"px-4 py-2 rounded-lg font-medium transition-all",style:{background:t.accent,color:t.accentDark,fontSize:n.sm,boxShadow:z.sm},onMouseEnter:s=>s.currentTarget.style.boxShadow=z.md,onMouseLeave:s=>s.currentTarget.style.boxShadow=z.sm,children:"Save Changes"})]})]}),E.length>0&&e.jsxs("div",{className:"rounded-lg mb-6 overflow-hidden",style:{border:"1px solid #FEE2E2",background:"#FEF2F2"},children:[e.jsxs("div",{className:"px-4 py-2 font-medium",style:{color:"#DC2626",fontSize:n.sm,borderBottom:"1px solid #FEE2E2"},children:[E.length," violation",E.length!==1?"s":""]}),E.map((s,a)=>e.jsxs("div",{className:"px-4 py-2 flex items-center gap-2",style:{fontSize:n.xs},children:[e.jsx("span",{style:{color:"#DC2626"},children:"✖"}),e.jsxs("span",{style:{color:t.faint},children:["[",s.ruleId,"]"]}),e.jsx("span",{style:{color:"#991B1B"},children:s.description})]},a))]}),R.has(r.kind)&&e.jsx(N,{title:"Flow",children:e.jsx(V,{element:r,layerColor:C})}),!R.has(r.kind)&&e.jsx(N,{title:"Description",children:b?e.jsxs("div",{children:[e.jsx("textarea",{value:F,onChange:s=>u(l,"doc",s.target.value),className:"w-full rounded-lg p-3 focus:outline-none focus:ring-2",style:{border:`1px solid ${t.border}`,background:t.surface,color:t.primary,fontSize:n.md,minHeight:"120px",resize:"vertical",fontFamily:"inherit",lineHeight:1.6,"--tw-ring-color":t.accent},autoFocus:!0}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx("button",{onClick:T,className:"px-3 py-1.5 rounded-md font-medium",style:{background:t.accent,color:t.accentDark,fontSize:n.xs},children:"Save"}),e.jsx("button",{onClick:()=>w(!1),className:"px-3 py-1.5 rounded-md",style:{color:t.muted,fontSize:n.xs,border:`1px solid ${t.border}`},children:"Cancel"})]})]}):e.jsx("div",{className:"rounded-lg p-4 cursor-pointer transition-all",style:{background:t.surface,border:`1px solid ${t.border}`,minHeight:"60px",color:F?t.primary:t.faint,fontSize:n.md,lineHeight:1.6},onClick:()=>w(!0),onMouseEnter:s=>s.currentTarget.style.borderColor=t.accent,onMouseLeave:s=>s.currentTarget.style.borderColor=t.border,title:"Click to edit",children:F||"Click to add a description..."})}),e.jsx(N,{title:"Attributes",children:e.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:`1px solid ${t.border}`,background:t.surface},children:e.jsxs("table",{className:"w-full",style:{fontSize:n.sm},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{borderBottom:`1px solid ${t.border}`,background:t.surfaceAlt},children:[e.jsx("th",{className:"text-left px-4 py-2 font-medium",style:{color:t.secondary,width:"35%"},children:"Key"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium",style:{color:t.secondary},children:"Value"})]})}),e.jsxs("tbody",{children:[Object.entries(r.attributes).length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:2,className:"px-4 py-3 text-center",style:{color:t.faint},children:"No attributes"})}),Object.entries(r.attributes).map(([s,a])=>{var I;const $=((I=j==null?void 0:j.attributes)==null?void 0:I[s])??a,H=L===s;return e.jsxs("tr",{style:{borderBottom:`1px solid ${t.borderLight}`},children:[e.jsx("td",{className:"px-4 py-2",style:{color:t.secondary,fontFamily:"monospace",fontSize:n.xs},children:s}),e.jsx("td",{className:"px-4 py-2",children:H?e.jsx("input",{type:"text",value:$,onChange:g=>S(l,s,g.target.value),onBlur:()=>k(null),onKeyDown:g=>{g.key==="Enter"&&k(null)},className:"w-full px-2 py-1 rounded focus:outline-none",style:{border:`1px solid ${t.accent}`,color:t.primary,fontSize:n.sm},autoFocus:!0}):e.jsx("span",{className:"cursor-pointer block px-2 py-1 rounded",style:{color:t.primary},onClick:()=>k(s),onMouseEnter:g=>g.currentTarget.style.background=t.surfaceAlt,onMouseLeave:g=>g.currentTarget.style.background="transparent",title:"Click to edit",children:$||e.jsx("span",{style:{color:t.faint},children:"—"})})})]},s)})]})]})})}),(m.outgoing.length>0||m.incoming.length>0)&&e.jsxs(N,{title:"Relationships",children:[m.outgoing.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h4",{className:"font-medium mb-2",style:{color:t.secondary,fontSize:n.sm},children:["Outgoing (",m.outgoing.length,")"]}),e.jsx("div",{className:"space-y-1",children:m.outgoing.map((s,a)=>e.jsx(M,{rel:s,direction:"out",resolveName:D,onNavigate:p},a))})]}),m.incoming.length>0&&e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium mb-2",style:{color:t.secondary,fontSize:n.sm},children:["Incoming (",m.incoming.length,")"]}),e.jsx("div",{className:"space-y-1",children:m.incoming.map((s,a)=>e.jsx(M,{rel:s,direction:"in",resolveName:D,onNavigate:p},a))})]})]}),r.file&&e.jsx(N,{title:"Source",children:e.jsx("div",{className:"rounded-lg px-4 py-3",style:{background:t.surface,border:`1px solid ${t.border}`,fontSize:n.xs,fontFamily:"monospace",color:t.secondary},children:r.file})})]})})}function N({title:i,children:o}){return e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"font-semibold mb-3",style:{color:t.primary,fontSize:n.lg,letterSpacing:"-0.01em"},children:i}),o]})}function M({rel:i,direction:o,resolveName:c,onNavigate:p}){const u=o==="out"?i.targetId:i.sourceId,S=c(u),f=A[i.type]||t.accent;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer transition-all",style:{background:t.surface,border:`1px solid ${t.border}`,fontSize:n.sm},onClick:()=>p(u),onMouseEnter:x=>{x.currentTarget.style.borderColor=t.accent,x.currentTarget.style.boxShadow=z.sm},onMouseLeave:x=>{x.currentTarget.style.borderColor=t.border,x.currentTarget.style.boxShadow="none"},children:[e.jsx("span",{style:{color:t.faint,fontSize:n.xs},children:o==="out"?"→":"←"}),e.jsx("span",{className:"px-1.5 py-0.5 rounded font-medium",style:{background:f+"15",color:f,fontSize:n.badge},children:i.type}),e.jsx("span",{className:"flex-1 truncate font-medium",style:{color:t.accentDark},children:S}),e.jsx("span",{style:{color:t.faint,fontSize:n.xs},children:"›"})]})}export{X as ElementDetailView};
@@ -1 +1 @@
1
- import{j as e}from"./reactflow-WKyu73tD.js";import{u as n}from"./index-c27kHB43.js";import"./zustand-qbFpP9Up.js";function p(){const i=n(t=>t.setBulkImportOpen),s=n(t=>t.connected),a=[{icon:"📄",title:"Import Elements from CSV",description:"Import model elements from a CSV or tab-separated file. Supports column mapping, artifact type presets, and batch preview before committing.",action:()=>i(!0),requiresConnection:!0}];return e.jsx("div",{style:{flex:1,overflow:"auto",padding:"40px 48px",background:"linear-gradient(135deg, #F0F4F7 0%, #E8EFF3 100%)",minHeight:0},children:e.jsxs("div",{style:{maxWidth:720,margin:"0 auto"},children:[e.jsx("h1",{style:{fontSize:"22px",fontWeight:700,color:"#1B3A4B",marginBottom:6},children:"Import"}),e.jsx("p",{style:{fontSize:"14px",color:"#6B7280",marginBottom:36},children:"Bring data into your model from external sources."}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:16},children:a.map(t=>{const r=t.requiresConnection&&!s;return e.jsxs("button",{onClick:r?void 0:t.action,disabled:r,style:{display:"flex",alignItems:"flex-start",gap:20,padding:"20px 24px",borderRadius:12,textAlign:"left",background:r?"rgba(255,255,255,0.4)":"rgba(255,255,255,0.75)",border:`1px solid ${r?"rgba(255,255,255,0.6)":"rgba(255,255,255,0.95)"}`,boxShadow:r?"none":"0 2px 8px rgba(0,0,0,0.06)",cursor:r?"not-allowed":"pointer",transition:"all 0.15s",opacity:r?.55:1},onMouseEnter:o=>{r||(o.currentTarget.style.background="rgba(255,255,255,0.95)",o.currentTarget.style.boxShadow="0 4px 16px rgba(0,0,0,0.1)",o.currentTarget.style.transform="translateY(-1px)")},onMouseLeave:o=>{r||(o.currentTarget.style.background="rgba(255,255,255,0.75)",o.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.06)",o.currentTarget.style.transform="none")},children:[e.jsx("div",{style:{fontSize:28,lineHeight:1,flexShrink:0,marginTop:2},children:t.icon}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"15px",fontWeight:600,color:"#1B3A4B",marginBottom:4},children:t.title}),e.jsx("div",{style:{fontSize:"13px",color:"#6B7280",lineHeight:1.55},children:t.description}),r&&e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:8},children:"Connect to the dev server to use this import."})]})]},t.title)})})]})})}export{p as ImportView};
1
+ import{j as e}from"./reactflow-WKyu73tD.js";import{u as n}from"./index-CgRwea72.js";import"./zustand-qbFpP9Up.js";function p(){const i=n(t=>t.setBulkImportOpen),s=n(t=>t.connected),a=[{icon:"📄",title:"Import Elements from CSV",description:"Import model elements from a CSV or tab-separated file. Supports column mapping, artifact type presets, and batch preview before committing.",action:()=>i(!0),requiresConnection:!0}];return e.jsx("div",{style:{flex:1,overflow:"auto",padding:"40px 48px",background:"linear-gradient(135deg, #F0F4F7 0%, #E8EFF3 100%)",minHeight:0},children:e.jsxs("div",{style:{maxWidth:720,margin:"0 auto"},children:[e.jsx("h1",{style:{fontSize:"22px",fontWeight:700,color:"#1B3A4B",marginBottom:6},children:"Import"}),e.jsx("p",{style:{fontSize:"14px",color:"#6B7280",marginBottom:36},children:"Bring data into your model from external sources."}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:16},children:a.map(t=>{const r=t.requiresConnection&&!s;return e.jsxs("button",{onClick:r?void 0:t.action,disabled:r,style:{display:"flex",alignItems:"flex-start",gap:20,padding:"20px 24px",borderRadius:12,textAlign:"left",background:r?"rgba(255,255,255,0.4)":"rgba(255,255,255,0.75)",border:`1px solid ${r?"rgba(255,255,255,0.6)":"rgba(255,255,255,0.95)"}`,boxShadow:r?"none":"0 2px 8px rgba(0,0,0,0.06)",cursor:r?"not-allowed":"pointer",transition:"all 0.15s",opacity:r?.55:1},onMouseEnter:o=>{r||(o.currentTarget.style.background="rgba(255,255,255,0.95)",o.currentTarget.style.boxShadow="0 4px 16px rgba(0,0,0,0.1)",o.currentTarget.style.transform="translateY(-1px)")},onMouseLeave:o=>{r||(o.currentTarget.style.background="rgba(255,255,255,0.75)",o.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.06)",o.currentTarget.style.transform="none")},children:[e.jsx("div",{style:{fontSize:28,lineHeight:1,flexShrink:0,marginTop:2},children:t.icon}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"15px",fontWeight:600,color:"#1B3A4B",marginBottom:4},children:t.title}),e.jsx("div",{style:{fontSize:"13px",color:"#6B7280",lineHeight:1.55},children:t.description}),r&&e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:8},children:"Connect to the dev server to use this import."})]})]},t.title)})})]})})}export{p as ImportView};
@@ -1 +1 @@
1
- import{j as t}from"./reactflow-WKyu73tD.js";import{a as f}from"./zustand-qbFpP9Up.js";import{L as M}from"./index-c27kHB43.js";const $={"purpose-operational":{bg:"#f0f7ff",header:"#cce5ff",text:"#1e40af",border:"#93c5fd"},requirements:{bg:"#f0f6ff",header:"#dae8fc",text:"#1d4ed8",border:"#93c5fd"},architecture:{bg:"#f0faf0",header:"#d5e8d4",text:"#166534",border:"#86efac"},risk:{bg:"#fff5f5",header:"#f8cecc",text:"#991b1b",border:"#fca5a5"},"vv-evidence":{bg:"#faf5ff",header:"#e1d5e7",text:"#6b21a8",border:"#c4b5fd"},"dhf-outputs":{bg:"#fffbeb",header:"#fff2cc",text:"#92400e",border:"#fcd34d"},other:{bg:"#f9fafb",header:"#f3f4f6",text:"#374151",border:"#d1d5db"}},F=[{id:"purpose-operational",label:"Purpose & Operational",abbr:"PUR",layerIds:["purpose","business","operational"]},{id:"requirements",label:"Requirements",abbr:"REQ",layerIds:["requirements"]},{id:"architecture",label:"Architecture",abbr:"ARCH",layerIds:["functional","behavior","logical","physical","software","interfaces","ui"],subGroups:[{label:"Functional",layerIds:["functional","behavior"]},{label:"Logical",layerIds:["logical"]},{label:"Physical",layerIds:["physical"]},{label:"Software",layerIds:["software"]},{label:"Interfaces",layerIds:["interfaces","ui"]}]},{id:"risk",label:"Risk",abbr:"RISK",layerIds:["risk","safety","cybersecurity"]},{id:"vv-evidence",label:"V&V & Evidence",abbr:"V&V",layerIds:["verification","analysis"]},{id:"dhf-outputs",label:"DHF Outputs",abbr:"DHF",layerIds:["design-control","qms","software-lifecycle","operations","clinical","privacy"]}],A=Object.fromEntries(M.map((n,r)=>[n,r]));function O(n){return[...n].sort((r,d)=>(A[r.id]??99)-(A[d.id]??99))}function T(n){return[...n].sort((r,d)=>{const a=r.derivesFrom?1:0,x=d.derivesFrom?1:0;return a!==x?a-x:r.name.localeCompare(d.name)})}function B({kind:n,layerColor:r,domainBg:d,selected:a,onClick:x,onContextMenu:N,isFlashing:p,flashTick:R}){const[b,g]=f.useState(!1),[v,j]=f.useState(!1);f.useEffect(()=>{if(!p)return;j(!0);const w=setTimeout(()=>j(!1),700);return()=>clearTimeout(w)},[p,R]);const m=a?`${r}18`:b?`${r}0C`:"#ffffff",I=a?r:"transparent",k=r;return t.jsxs("button",{"data-kind":n.name,onClick:x,onContextMenu:N,onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),className:"text-left transition-all",style:{width:"130px",minHeight:"55px",background:m,border:`1px solid ${I}`,borderLeft:`3px solid ${k}`,borderRadius:"6px",padding:"6px 8px",cursor:"pointer",transform:v?"scale(1.04)":"scale(1)",boxShadow:v?`0 0 0 2px ${r}, 0 0 12px ${r}60`:a?`0 0 0 1px ${r}40`:b?"0 1px 3px rgba(0,0,0,0.08)":"none",flexShrink:0},children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{style:{fontSize:"9px",fontFamily:"monospace",color:r,opacity:.8,textTransform:"uppercase",letterSpacing:"0.02em",lineHeight:1},children:n.construct.replace("part def","pd").replace("connection def","cd").replace("attribute def","ad")}),n.instanceCount>0&&t.jsx("span",{style:{fontSize:"9px",color:"#6B7280",background:`${r}15`,borderRadius:"8px",padding:"0 4px",lineHeight:"14px"},children:n.instanceCount})]}),t.jsx("div",{style:{fontSize:"11px",fontWeight:n.derivesFrom?400:600,color:a?r:"#1F2937",lineHeight:1.3,wordBreak:"break-word"},children:n.name}),n.derivesFrom&&t.jsxs("div",{style:{fontSize:"9px",color:"#9CA3AF",marginTop:"2px",lineHeight:1},children:["↳ ",n.derivesFrom]})]})}function z({layers:n,selectedKind:r,onKindClick:d,activeLayerId:a,flashKindName:x,flashTick:N}){const p=f.useRef({}),[R,b]=f.useState(null),[g,v]=f.useState(()=>new Set(F.map(e=>e.id).concat(["other"])));if(f.useEffect(()=>{if(!a)return;const e=p.current[a];if(e){e.scrollIntoView({behavior:"smooth",block:"start"}),b(a);const o=setTimeout(()=>b(null),1200);return()=>clearTimeout(o)}},[a]),n.length===0)return t.jsx("div",{className:"flex items-center justify-center py-12",style:{color:"#9CA3AF"},children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-2xl mb-2",children:"⬡"}),t.jsx("div",{className:"text-xs",children:"No layers found in this ontology"})]})});const j=new Set(F.flatMap(e=>e.layerIds)),m=O(n.filter(e=>!j.has(e.id)));function I(e,o){e.preventDefault()}function k(e){v(o=>{const s=new Set(o);return s.has(e)?s.delete(e):s.add(e),s})}const w=(e,o,s)=>T(e).map(l=>t.jsx(B,{kind:l,layerColor:o,domainBg:s,selected:r===l.name,onClick:()=>d(r===l.name?null:l.name),onContextMenu:u=>I(u,l.name),isFlashing:x===l.name,flashTick:N},l.name)),C=(e,o)=>{const s=$[e.id]??$.other,L=o.reduce((i,c)=>i+c.kindCount,0),l=L===0,u=g.has(e.id),E=O(o);return t.jsxs("div",{ref:i=>{p.current[e.id]=i},className:"rounded-xl overflow-hidden transition-all",style:{border:`1px solid ${s.border}`,background:s.bg,outline:R===e.id?`2px solid ${s.border}`:"none",outlineOffset:"2px"},children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 cursor-pointer select-none",style:{background:s.header,borderBottom:u?"none":`1px solid ${s.border}`},onClick:()=>k(e.id),title:u?"Expand":"Collapse",children:[t.jsx("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"none",style:{transition:"transform 150ms ease",transform:u?"rotate(-90deg)":"rotate(0deg)",flexShrink:0},children:t.jsx("path",{d:"M4 6L8 10L12 6",stroke:s.text,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),t.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:s.text,letterSpacing:"0.08em",textTransform:"uppercase",minWidth:"32px",textAlign:"center"},children:e.abbr}),t.jsx("span",{style:{width:"1px",height:"14px",background:`${s.border}`,opacity:.5}}),t.jsx("span",{className:"text-xs font-semibold flex-1",style:{color:s.text},children:e.label}),t.jsx("span",{className:"text-xs",style:{color:s.text,opacity:.7},children:l?"no kinds":`${L} kinds`})]}),!u&&(l?t.jsx("div",{className:"px-4 py-1.5 text-xs italic",style:{color:s.text,opacity:.4},children:"(no elements)"}):t.jsx("div",{className:"p-3 space-y-3",children:e.subGroups?e.subGroups.map(i=>{const c=E.filter(y=>i.layerIds.includes(y.id));if(c.length===0)return null;const h=c.flatMap(y=>y.kinds);if(h.length===0)return null;const S=c[0].color??s.text;return t.jsxs("div",{children:[t.jsxs("div",{className:"text-xs font-medium mb-1.5 flex items-center gap-1.5",style:{color:s.text,opacity:.75},ref:y=>{c.forEach(H=>{p.current[H.id]=y})},children:[t.jsx("span",{className:"inline-block w-2 h-2 rounded-sm flex-shrink-0",style:{background:S}}),i.label]}),t.jsx("div",{className:"flex flex-wrap gap-2",children:w(h,S,s.bg)})]},i.label)}):(()=>{var h;const i=E.flatMap(S=>S.kinds),c=((h=E[0])==null?void 0:h.color)??s.text;return t.jsx("div",{className:"flex flex-wrap gap-2",children:w(i,c,s.bg)})})()}))]},e.id)};return t.jsxs("div",{className:"space-y-3 mb-6",children:[F.map(e=>{const o=n.filter(s=>e.layerIds.includes(s.id));return o.length===0?null:C(e,o)}),m.length>0&&C({id:"other",label:"Other",abbr:"EXT",layerIds:m.map(e=>e.id)},m)]})}export{z as LayerGrid};
1
+ import{j as t}from"./reactflow-WKyu73tD.js";import{a as f}from"./zustand-qbFpP9Up.js";import{L as M}from"./index-CgRwea72.js";const $={"purpose-operational":{bg:"#f0f7ff",header:"#cce5ff",text:"#1e40af",border:"#93c5fd"},requirements:{bg:"#f0f6ff",header:"#dae8fc",text:"#1d4ed8",border:"#93c5fd"},architecture:{bg:"#f0faf0",header:"#d5e8d4",text:"#166534",border:"#86efac"},risk:{bg:"#fff5f5",header:"#f8cecc",text:"#991b1b",border:"#fca5a5"},"vv-evidence":{bg:"#faf5ff",header:"#e1d5e7",text:"#6b21a8",border:"#c4b5fd"},"dhf-outputs":{bg:"#fffbeb",header:"#fff2cc",text:"#92400e",border:"#fcd34d"},other:{bg:"#f9fafb",header:"#f3f4f6",text:"#374151",border:"#d1d5db"}},F=[{id:"purpose-operational",label:"Purpose & Operational",abbr:"PUR",layerIds:["purpose","business","operational"]},{id:"requirements",label:"Requirements",abbr:"REQ",layerIds:["requirements"]},{id:"architecture",label:"Architecture",abbr:"ARCH",layerIds:["functional","behavior","logical","physical","software","interfaces","ui"],subGroups:[{label:"Functional",layerIds:["functional","behavior"]},{label:"Logical",layerIds:["logical"]},{label:"Physical",layerIds:["physical"]},{label:"Software",layerIds:["software"]},{label:"Interfaces",layerIds:["interfaces","ui"]}]},{id:"risk",label:"Risk",abbr:"RISK",layerIds:["risk","safety","cybersecurity"]},{id:"vv-evidence",label:"V&V & Evidence",abbr:"V&V",layerIds:["verification","analysis"]},{id:"dhf-outputs",label:"DHF Outputs",abbr:"DHF",layerIds:["design-control","qms","software-lifecycle","operations","clinical","privacy"]}],A=Object.fromEntries(M.map((n,r)=>[n,r]));function O(n){return[...n].sort((r,d)=>(A[r.id]??99)-(A[d.id]??99))}function T(n){return[...n].sort((r,d)=>{const a=r.derivesFrom?1:0,x=d.derivesFrom?1:0;return a!==x?a-x:r.name.localeCompare(d.name)})}function B({kind:n,layerColor:r,domainBg:d,selected:a,onClick:x,onContextMenu:N,isFlashing:p,flashTick:R}){const[b,g]=f.useState(!1),[v,j]=f.useState(!1);f.useEffect(()=>{if(!p)return;j(!0);const w=setTimeout(()=>j(!1),700);return()=>clearTimeout(w)},[p,R]);const m=a?`${r}18`:b?`${r}0C`:"#ffffff",I=a?r:"transparent",k=r;return t.jsxs("button",{"data-kind":n.name,onClick:x,onContextMenu:N,onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),className:"text-left transition-all",style:{width:"130px",minHeight:"55px",background:m,border:`1px solid ${I}`,borderLeft:`3px solid ${k}`,borderRadius:"6px",padding:"6px 8px",cursor:"pointer",transform:v?"scale(1.04)":"scale(1)",boxShadow:v?`0 0 0 2px ${r}, 0 0 12px ${r}60`:a?`0 0 0 1px ${r}40`:b?"0 1px 3px rgba(0,0,0,0.08)":"none",flexShrink:0},children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{style:{fontSize:"9px",fontFamily:"monospace",color:r,opacity:.8,textTransform:"uppercase",letterSpacing:"0.02em",lineHeight:1},children:n.construct.replace("part def","pd").replace("connection def","cd").replace("attribute def","ad")}),n.instanceCount>0&&t.jsx("span",{style:{fontSize:"9px",color:"#6B7280",background:`${r}15`,borderRadius:"8px",padding:"0 4px",lineHeight:"14px"},children:n.instanceCount})]}),t.jsx("div",{style:{fontSize:"11px",fontWeight:n.derivesFrom?400:600,color:a?r:"#1F2937",lineHeight:1.3,wordBreak:"break-word"},children:n.name}),n.derivesFrom&&t.jsxs("div",{style:{fontSize:"9px",color:"#9CA3AF",marginTop:"2px",lineHeight:1},children:["↳ ",n.derivesFrom]})]})}function z({layers:n,selectedKind:r,onKindClick:d,activeLayerId:a,flashKindName:x,flashTick:N}){const p=f.useRef({}),[R,b]=f.useState(null),[g,v]=f.useState(()=>new Set(F.map(e=>e.id).concat(["other"])));if(f.useEffect(()=>{if(!a)return;const e=p.current[a];if(e){e.scrollIntoView({behavior:"smooth",block:"start"}),b(a);const o=setTimeout(()=>b(null),1200);return()=>clearTimeout(o)}},[a]),n.length===0)return t.jsx("div",{className:"flex items-center justify-center py-12",style:{color:"#9CA3AF"},children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-2xl mb-2",children:"⬡"}),t.jsx("div",{className:"text-xs",children:"No layers found in this ontology"})]})});const j=new Set(F.flatMap(e=>e.layerIds)),m=O(n.filter(e=>!j.has(e.id)));function I(e,o){e.preventDefault()}function k(e){v(o=>{const s=new Set(o);return s.has(e)?s.delete(e):s.add(e),s})}const w=(e,o,s)=>T(e).map(l=>t.jsx(B,{kind:l,layerColor:o,domainBg:s,selected:r===l.name,onClick:()=>d(r===l.name?null:l.name),onContextMenu:u=>I(u,l.name),isFlashing:x===l.name,flashTick:N},l.name)),C=(e,o)=>{const s=$[e.id]??$.other,L=o.reduce((i,c)=>i+c.kindCount,0),l=L===0,u=g.has(e.id),E=O(o);return t.jsxs("div",{ref:i=>{p.current[e.id]=i},className:"rounded-xl overflow-hidden transition-all",style:{border:`1px solid ${s.border}`,background:s.bg,outline:R===e.id?`2px solid ${s.border}`:"none",outlineOffset:"2px"},children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 cursor-pointer select-none",style:{background:s.header,borderBottom:u?"none":`1px solid ${s.border}`},onClick:()=>k(e.id),title:u?"Expand":"Collapse",children:[t.jsx("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"none",style:{transition:"transform 150ms ease",transform:u?"rotate(-90deg)":"rotate(0deg)",flexShrink:0},children:t.jsx("path",{d:"M4 6L8 10L12 6",stroke:s.text,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),t.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:s.text,letterSpacing:"0.08em",textTransform:"uppercase",minWidth:"32px",textAlign:"center"},children:e.abbr}),t.jsx("span",{style:{width:"1px",height:"14px",background:`${s.border}`,opacity:.5}}),t.jsx("span",{className:"text-xs font-semibold flex-1",style:{color:s.text},children:e.label}),t.jsx("span",{className:"text-xs",style:{color:s.text,opacity:.7},children:l?"no kinds":`${L} kinds`})]}),!u&&(l?t.jsx("div",{className:"px-4 py-1.5 text-xs italic",style:{color:s.text,opacity:.4},children:"(no elements)"}):t.jsx("div",{className:"p-3 space-y-3",children:e.subGroups?e.subGroups.map(i=>{const c=E.filter(y=>i.layerIds.includes(y.id));if(c.length===0)return null;const h=c.flatMap(y=>y.kinds);if(h.length===0)return null;const S=c[0].color??s.text;return t.jsxs("div",{children:[t.jsxs("div",{className:"text-xs font-medium mb-1.5 flex items-center gap-1.5",style:{color:s.text,opacity:.75},ref:y=>{c.forEach(H=>{p.current[H.id]=y})},children:[t.jsx("span",{className:"inline-block w-2 h-2 rounded-sm flex-shrink-0",style:{background:S}}),i.label]}),t.jsx("div",{className:"flex flex-wrap gap-2",children:w(h,S,s.bg)})]},i.label)}):(()=>{var h;const i=E.flatMap(S=>S.kinds),c=((h=E[0])==null?void 0:h.color)??s.text;return t.jsx("div",{className:"flex flex-wrap gap-2",children:w(i,c,s.bg)})})()}))]},e.id)};return t.jsxs("div",{className:"space-y-3 mb-6",children:[F.map(e=>{const o=n.filter(s=>e.layerIds.includes(s.id));return o.length===0?null:C(e,o)}),m.length>0&&C({id:"other",label:"Other",abbr:"EXT",layerIds:m.map(e=>e.id)},m)]})}export{z as LayerGrid};
@@ -1,2 +1,2 @@
1
- import{j as t}from"./reactflow-WKyu73tD.js";import{a}from"./zustand-qbFpP9Up.js";import{d as A}from"./index-c27kHB43.js";function q({layers:p,selectedKind:L,onKindClick:S}){const[F,D]=a.useState("name"),[g,j]=a.useState("asc"),[h,M]=a.useState(""),[c,T]=a.useState(!1),[i,v]=a.useState("all"),[d,E]=a.useState("all"),[B,f]=a.useState(!1),[N,b]=a.useState(!1),y=a.useMemo(()=>p.flatMap(e=>e.kinds.map(s=>({...s,layerLabel:e.label,layerColor:A[e.id]??e.color??"#6B7280"}))),[p]),R=a.useMemo(()=>[...new Set(p.map(e=>e.id))],[p]),K=a.useMemo(()=>[...new Set(y.map(e=>e.construct))],[y]),C=a.useMemo(()=>{let e=y;if(h.trim()){const s=h.toLowerCase();e=e.filter(o=>{var l,r;return o.name.toLowerCase().includes(s)||o.label.toLowerCase().includes(s)||o.layer.toLowerCase().includes(s)||(((l=o.description)==null?void 0:l.toLowerCase().includes(s))??!1)||(((r=o.derivesFrom)==null?void 0:r.toLowerCase().includes(s))??!1)})}return i!=="all"&&(e=e.filter(s=>s.layer===i)),d!=="all"&&(e=e.filter(s=>s.construct===d)),e},[y,h,i,d]),x=a.useMemo(()=>[...C].sort((e,s)=>{var l,r;let o=0;switch(F){case"name":o=e.name.localeCompare(s.name);break;case"layer":o=e.layer.localeCompare(s.layer);break;case"construct":o=e.construct.localeCompare(s.construct);break;case"instanceCount":o=e.instanceCount-s.instanceCount;break;case"derivesFrom":o=(e.derivesFrom??"").localeCompare(s.derivesFrom??"");break;case"derivedByCount":o=(((l=e.derivedBy)==null?void 0:l.length)??0)-(((r=s.derivedBy)==null?void 0:r.length)??0);break}return g==="asc"?o:-o}),[C,F,g]),k=a.useMemo(()=>{if(c)return null;const e=new Map;for(const s of x)e.has(s.layer)||e.set(s.layer,[]),e.get(s.layer).push(s);return e},[x,c]);function u(e){F===e?j(s=>s==="asc"?"desc":"asc"):(D(e),j("asc"))}const z=a.useCallback(()=>{const e=[["Name","Layer","Construct","Instances","Derives From","Derived By","Description"]];for(const n of x)e.push([n.name,n.layer,n.construct,String(n.instanceCount),n.derivesFrom??"",(n.derivedBy??[]).join("; "),n.description??""]);const s=e.map(n=>n.map($=>`"${$.replace(/"/g,'""')}"`).join(",")).join(`
1
+ import{j as t}from"./reactflow-WKyu73tD.js";import{a}from"./zustand-qbFpP9Up.js";import{d as A}from"./index-CgRwea72.js";function q({layers:p,selectedKind:L,onKindClick:S}){const[F,D]=a.useState("name"),[g,j]=a.useState("asc"),[h,M]=a.useState(""),[c,T]=a.useState(!1),[i,v]=a.useState("all"),[d,E]=a.useState("all"),[B,f]=a.useState(!1),[N,b]=a.useState(!1),y=a.useMemo(()=>p.flatMap(e=>e.kinds.map(s=>({...s,layerLabel:e.label,layerColor:A[e.id]??e.color??"#6B7280"}))),[p]),R=a.useMemo(()=>[...new Set(p.map(e=>e.id))],[p]),K=a.useMemo(()=>[...new Set(y.map(e=>e.construct))],[y]),C=a.useMemo(()=>{let e=y;if(h.trim()){const s=h.toLowerCase();e=e.filter(o=>{var l,r;return o.name.toLowerCase().includes(s)||o.label.toLowerCase().includes(s)||o.layer.toLowerCase().includes(s)||(((l=o.description)==null?void 0:l.toLowerCase().includes(s))??!1)||(((r=o.derivesFrom)==null?void 0:r.toLowerCase().includes(s))??!1)})}return i!=="all"&&(e=e.filter(s=>s.layer===i)),d!=="all"&&(e=e.filter(s=>s.construct===d)),e},[y,h,i,d]),x=a.useMemo(()=>[...C].sort((e,s)=>{var l,r;let o=0;switch(F){case"name":o=e.name.localeCompare(s.name);break;case"layer":o=e.layer.localeCompare(s.layer);break;case"construct":o=e.construct.localeCompare(s.construct);break;case"instanceCount":o=e.instanceCount-s.instanceCount;break;case"derivesFrom":o=(e.derivesFrom??"").localeCompare(s.derivesFrom??"");break;case"derivedByCount":o=(((l=e.derivedBy)==null?void 0:l.length)??0)-(((r=s.derivedBy)==null?void 0:r.length)??0);break}return g==="asc"?o:-o}),[C,F,g]),k=a.useMemo(()=>{if(c)return null;const e=new Map;for(const s of x)e.has(s.layer)||e.set(s.layer,[]),e.get(s.layer).push(s);return e},[x,c]);function u(e){F===e?j(s=>s==="asc"?"desc":"asc"):(D(e),j("asc"))}const z=a.useCallback(()=>{const e=[["Name","Layer","Construct","Instances","Derives From","Derived By","Description"]];for(const n of x)e.push([n.name,n.layer,n.construct,String(n.instanceCount),n.derivesFrom??"",(n.derivedBy??[]).join("; "),n.description??""]);const s=e.map(n=>n.map($=>`"${$.replace(/"/g,'""')}"`).join(",")).join(`
2
2
  `),o=new Blob([s],{type:"text/csv;charset=utf-8;"}),l=URL.createObjectURL(o),r=document.createElement("a");r.href=l,r.download="ontology-kinds.csv",r.click(),URL.revokeObjectURL(l)},[x]),m=({k:e})=>t.jsx("span",{style:{fontSize:"10px",color:F===e?"#1B3A4B":"#D1D5DB",marginLeft:"3px"},children:F===e?g==="asc"?"▲":"▼":"⇅"}),w=(e,s)=>{var l,r;const o=L===e.name;return t.jsxs("div",{className:"grid items-center cursor-pointer text-xs",style:{gridTemplateColumns:"1.5fr 100px 90px 60px 120px 60px",padding:"7px 16px",background:o?"#EFF6FF":s%2===0?"#FAFAF8":"#FFFFFF",borderLeft:o?`3px solid ${e.layerColor}`:"3px solid transparent",transition:"background 100ms ease"},onClick:()=>S(o?null:e.name),onMouseEnter:n=>{o||(n.currentTarget.style.background="#F0F7FF")},onMouseLeave:n=>{o||(n.currentTarget.style.background=o?"#EFF6FF":s%2===0?"#FAFAF8":"#FFFFFF")},children:[t.jsxs("div",{className:"flex items-center gap-2 truncate",children:[t.jsx("span",{className:"w-2 h-2 rounded flex-shrink-0",style:{backgroundColor:e.layerColor}}),t.jsx("span",{style:{color:"#1a1a1a",fontWeight:o?600:400},children:e.name})]}),t.jsx("span",{className:"capitalize",style:{color:"#6B7280"},children:e.layer}),t.jsx("span",{className:"font-mono",style:{color:"#9CA3AF"},children:e.construct}),t.jsx("span",{className:"text-right",style:{color:e.instanceCount>0?"#1B3A4B":"#D1D5DB"},children:e.instanceCount>0?e.instanceCount:"—"}),t.jsx("span",{className:"truncate",style:{color:e.derivesFrom?"#2563EB":"#D1D5DB"},children:e.derivesFrom??"—"}),t.jsx("span",{className:"text-right",style:{color:(((l=e.derivedBy)==null?void 0:l.length)??0)>0?"#374151":"#D1D5DB"},children:(((r=e.derivedBy)==null?void 0:r.length)??0)>0?e.derivedBy.length:"—"})]},`${e.layer}:${e.name}`)};return t.jsxs("div",{className:"mb-6",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3 flex-wrap",children:[t.jsx("input",{type:"text",placeholder:"Search kinds...",value:h,onChange:e=>M(e.target.value),className:"px-2.5 py-1.5 text-xs rounded-md flex-1 min-w-[140px]",style:{border:"1px solid #E5E7EB",background:"#F9FAFB",color:"#374151",outline:"none",maxWidth:"240px"},onFocus:e=>e.currentTarget.style.borderColor="#2563EB",onBlur:e=>e.currentTarget.style.borderColor="#E5E7EB"}),t.jsxs("div",{className:"relative",children:[t.jsxs("button",{onClick:()=>{f(!B),b(!1)},className:"px-2.5 py-1.5 text-xs rounded-md",style:{border:"1px solid #E5E7EB",background:i!=="all"?"#EFF6FF":"#F9FAFB",color:"#374151"},children:["Layer: ",i==="all"?"All":i]}),B&&t.jsxs("div",{className:"absolute top-full left-0 mt-1 rounded-lg shadow-lg py-1 z-20",style:{background:"#FFFFFF",border:"1px solid #E5E7EB",minWidth:"120px"},children:[t.jsx("button",{className:"block w-full text-left px-3 py-1.5 text-xs hover:bg-gray-50",style:{color:"#374151"},onClick:()=>{v("all"),f(!1)},children:"All"}),R.map(e=>t.jsx("button",{className:"block w-full text-left px-3 py-1.5 text-xs hover:bg-gray-50 capitalize",style:{color:"#374151"},onClick:()=>{v(e),f(!1)},children:e},e))]})]}),t.jsxs("div",{className:"relative",children:[t.jsxs("button",{onClick:()=>{b(!N),f(!1)},className:"px-2.5 py-1.5 text-xs rounded-md",style:{border:"1px solid #E5E7EB",background:d!=="all"?"#EFF6FF":"#F9FAFB",color:"#374151"},children:["Construct: ",d==="all"?"All":d]}),N&&t.jsxs("div",{className:"absolute top-full left-0 mt-1 rounded-lg shadow-lg py-1 z-20",style:{background:"#FFFFFF",border:"1px solid #E5E7EB",minWidth:"140px"},children:[t.jsx("button",{className:"block w-full text-left px-3 py-1.5 text-xs hover:bg-gray-50",style:{color:"#374151"},onClick:()=>{E("all"),b(!1)},children:"All"}),K.map(e=>t.jsx("button",{className:"block w-full text-left px-3 py-1.5 text-xs hover:bg-gray-50 font-mono",style:{color:"#374151"},onClick:()=>{E(e),b(!1)},children:e},e))]})]}),t.jsx("button",{onClick:()=>T(!c),className:"px-2.5 py-1.5 text-xs rounded-md",style:{border:"1px solid #E5E7EB",background:c?"#1B3A4B":"#F9FAFB",color:c?"#2DD4A8":"#374151"},children:c?"Grouped":"Flatten"}),t.jsx("button",{onClick:z,className:"px-2.5 py-1.5 text-xs rounded-md ml-auto",style:{border:"1px solid #E5E7EB",background:"#F9FAFB",color:"#374151"},title:"Export as CSV",children:"Export CSV"}),t.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:[C.length," / ",y.length," kinds"]})]}),t.jsxs("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid #E5E5E0"},children:[t.jsxs("div",{className:"grid text-xs font-medium",style:{gridTemplateColumns:"1.5fr 100px 90px 60px 120px 60px",background:"#F7F7F5",borderBottom:"1px solid #E5E5E0",padding:"8px 16px",color:"#6B7280",position:"sticky",top:0,zIndex:5},children:[t.jsxs("button",{className:"text-left flex items-center",onClick:()=>u("name"),children:["Kind ",t.jsx(m,{k:"name"})]}),t.jsxs("button",{className:"text-left flex items-center",onClick:()=>u("layer"),children:["Layer ",t.jsx(m,{k:"layer"})]}),t.jsxs("button",{className:"text-left flex items-center",onClick:()=>u("construct"),children:["Construct ",t.jsx(m,{k:"construct"})]}),t.jsxs("button",{className:"text-right flex items-center justify-end",onClick:()=>u("instanceCount"),children:["# ",t.jsx(m,{k:"instanceCount"})]}),t.jsxs("button",{className:"text-left flex items-center",onClick:()=>u("derivesFrom"),children:["Derives From ",t.jsx(m,{k:"derivesFrom"})]}),t.jsxs("button",{className:"text-right flex items-center justify-end",onClick:()=>u("derivedByCount"),children:["Subs ",t.jsx(m,{k:"derivedByCount"})]})]}),c?x.map((e,s)=>w(e,s)):k&&[...k.entries()].map(([e,s])=>{const o=p.find(r=>r.id===e),l=A[e]??"#6B7280";return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 text-xs font-semibold",style:{background:`${l}08`,borderTop:"1px solid #E5E5E0",color:l},children:[t.jsx("span",{className:"w-2.5 h-2.5 rounded flex-shrink-0",style:{backgroundColor:l}}),(o==null?void 0:o.label)??e,t.jsxs("span",{className:"font-normal",style:{color:"#9CA3AF"},children:["(",s.length,")"]})]}),s.map((r,n)=>w(r,n))]},e)}),x.length===0&&t.jsx("div",{className:"py-8 text-center text-xs",style:{color:"#9CA3AF"},children:"No kinds match the current filters"})]})]})}export{q as LayerTable};
@@ -1,4 +1,4 @@
1
- import{j as jsxRuntimeExports}from"./reactflow-WKyu73tD.js";import{a as reactExports}from"./zustand-qbFpP9Up.js";import{D as DIAGRAM_TYPE_META,u as useModelStore,g as getDiagram,n as sendDiagramLayoutUpdate,F as FONT}from"./index-c27kHB43.js";import{j as computeFBSLayout,d as buildFunctionalTree,l as computeContainmentLayout,e as buildDecompositionTree,m as computeInterconnectionLayout,n as computeActionFlowViewLayout,o as computeStateTransitionLayout,p as computeSequenceLayout,r as resolveGeneralMode,q as computeGeneralViewLayout,b as buildGeneralViewTree,t as computeLayout,s as selectedLayoutProviderId,c as commonDisplayLevels,g as GridView,B as BrowserView}from"./layout-selection-DvOsyJH9.js";import"./layout-providers-BAUgp0nu.js";import"./elk-B75IRfCd.js";import"web-worker";class ImageBox{constructor(t,e,i){this.src=t,this.width=e,this.height=i}}class EventObject{constructor(t="",...e){if(this.consumed=!1,this.name=t,this.properties={},e[0]&&e[0].constructor===Object)for(const[i,s]of Object.entries(e[0]))this.properties[i]=s;else for(let i=0;i<e.length;i+=2)e[i+1]!==null&&(this.properties[e[i]]=e[i+1])}getName(){return this.name}getProperties(){return this.properties}getProperty(t){return this.properties[t]}isConsumed(){return this.consumed}consume(){this.consumed=!0}}class EventSource{constructor(t=null){this.eventListeners=[],this.eventsEnabled=!0,this.eventSource=null,this.eventSource=t}isEventsEnabled(){return this.eventsEnabled}setEventsEnabled(t){this.eventsEnabled=t}getEventSource(){return this.eventSource}setEventSource(t){this.eventSource=t}addListener(t,e){this.eventListeners.push({name:t,funct:e})}removeListener(t){let e=0;for(;e<this.eventListeners.length;)this.eventListeners[e].funct===t?this.eventListeners.splice(e,1):e+=1}fireEvent(t,e=null){if(this.isEventsEnabled()){t||(t=new EventObject("")),e||(e=this.getEventSource()),e||(e=this);for(const i of this.eventListeners)(i.name===null||i.name===t.getName())&&i.funct.apply(this,[e,t])}}destroy(){this.eventListeners.length=0}}const DEFAULT_HOTSPOT=.3,MIN_HOTSPOT_SIZE=8,MAX_HOTSPOT_SIZE=0,IDENTITY_FIELD_NAME="mxObjectId",NS_SVG="http://www.w3.org/2000/svg",NS_XLINK="http://www.w3.org/1999/xlink",SHADOWCOLOR="gray",SHADOW_OFFSET_X=2,SHADOW_OFFSET_Y=3,SHADOW_OPACITY=1,TOOLTIP_VERTICAL_OFFSET=16,DEFAULT_VALID_COLOR="#00FF00",DEFAULT_INVALID_COLOR="#FF0000",OUTLINE_HIGHLIGHT_COLOR="#00FF00",OUTLINE_HIGHLIGHT_STROKEWIDTH=5,HIGHLIGHT_STROKEWIDTH=3,HIGHLIGHT_SIZE=2,HIGHLIGHT_OPACITY=100,INVALID_CONNECT_TARGET_COLOR="#FF0000",DROP_TARGET_COLOR="#0000FF",VALID_COLOR="#00FF00",INVALID_COLOR="#FF0000",EDGE_SELECTION_COLOR="#00FF00",VERTEX_SELECTION_COLOR="#00FF00",VERTEX_SELECTION_STROKEWIDTH=1,EDGE_SELECTION_STROKEWIDTH=1,VERTEX_SELECTION_DASHED=!0,EDGE_SELECTION_DASHED=!0,GUIDE_COLOR="#FF0000",GUIDE_STROKEWIDTH=1,HANDLE_SIZE=6,LABEL_HANDLE_SIZE=4,HANDLE_FILLCOLOR="#00FF00",HANDLE_STROKECOLOR="black",LABEL_HANDLE_FILLCOLOR="yellow",CONNECT_HANDLE_FILLCOLOR="#0000FF",LOCKED_HANDLE_FILLCOLOR="#FF0000",DEFAULT_FONTFAMILY="Arial,Helvetica,sans-serif",DEFAULT_FONTSIZE=11,DEFAULT_TEXT_DIRECTION="",LINE_HEIGHT=1.2,WORD_WRAP="normal",DEFAULT_FONTSTYLE=0,DEFAULT_STARTSIZE=40,DEFAULT_MARKERSIZE=6,DEFAULT_IMAGESIZE=24,ENTITY_SEGMENT=30,RECTANGLE_ROUNDING_FACTOR=.15,LINE_ARCSIZE=20,ARROW_SPACING=0,ARROW_WIDTH=30,ARROW_SIZE=30,PAGE_FORMAT_A4_PORTRAIT=[0,0,827,1169],NONE="none",FONT_STYLE_MASK={BOLD:1,ITALIC:2,UNDERLINE:4,STRIKETHROUGH:8},DIRECTION_MASK={NONE:0,WEST:1,NORTH:2,SOUTH:4,EAST:8,ALL:15},NODE_TYPE={ELEMENT:1},isWindowObjectAvailable=()=>typeof window<"u",isUserAgentAvailable=()=>!!navigator.userAgent,isUserAgentIncludes=r=>navigator.userAgent.includes(r),isAppVersionAvailable=()=>!!navigator.appVersion,isAppVersionIncludes=r=>navigator.appVersion.includes(r);class Client{}Client.basePath=".";Client.setBasePath=r=>{typeof r<"u"&&r.length>0?(r.substring(r.length-1)==="/"&&(r=r.substring(0,r.length-1)),Client.basePath=r):Client.basePath="."};Client.imageBasePath=".";Client.setImageBasePath=r=>{typeof r<"u"&&r.length>0?(r.substring(r.length-1)==="/"&&(r=r.substring(0,r.length-1)),Client.imageBasePath=r):Client.imageBasePath=`${Client.basePath}/images`};Client.IS_EDGE=isWindowObjectAvailable()&&isUserAgentAvailable()&&!!navigator.userAgent.match(/Edge\//);Client.IS_NS=isWindowObjectAvailable()&&isUserAgentAvailable()&&isUserAgentIncludes("Mozilla/")&&!isUserAgentIncludes("MSIE")&&!isUserAgentIncludes("Edge/");Client.IS_SF=isWindowObjectAvailable()&&/Apple Computer, Inc/.test(navigator.vendor);Client.IS_ANDROID=isWindowObjectAvailable()&&isAppVersionAvailable()&&isAppVersionIncludes("Android");Client.IS_IOS=isWindowObjectAvailable()&&/iP(hone|od|ad)/.test(navigator.platform);Client.IS_GC=isWindowObjectAvailable()&&/Google Inc/.test(navigator.vendor);Client.IS_CHROMEAPP=isWindowObjectAvailable()&&window.chrome!=null&&chrome.app!=null&&chrome.app.runtime!=null;Client.IS_FF=isUserAgentAvailable()&&navigator.userAgent.toLowerCase().includes("firefox");Client.IS_MT=isWindowObjectAvailable()&&isUserAgentAvailable()&&(isUserAgentIncludes("Firefox/")&&!isUserAgentIncludes("Firefox/1.")&&!isUserAgentIncludes("Firefox/2.")||isUserAgentIncludes("Iceweasel/")&&!isUserAgentIncludes("Iceweasel/1.")&&!isUserAgentIncludes("Iceweasel/2.")||isUserAgentIncludes("SeaMonkey/")&&!isUserAgentIncludes("SeaMonkey/1.")||isUserAgentIncludes("Iceape/")&&!isUserAgentIncludes("Iceape/1."));var ft;Client.IS_SVG=isWindowObjectAvailable()&&((ft=navigator.appName)==null?void 0:ft.toUpperCase())!=="MICROSOFT INTERNET EXPLORER";Client.NO_FO=isWindowObjectAvailable()&&(!document.createElementNS||document.createElementNS(NS_SVG,"foreignObject").toString()!=="[object SVGForeignObjectElement]"||isUserAgentIncludes("Opera/"));Client.IS_WIN=isWindowObjectAvailable()&&isAppVersionAvailable()&&isAppVersionIncludes("Win");Client.IS_MAC=isWindowObjectAvailable()&&isAppVersionAvailable()&&isAppVersionIncludes("Mac");Client.IS_CHROMEOS=isWindowObjectAvailable()&&/\bCrOS\b/.test(navigator.appVersion);Client.IS_TOUCH=isWindowObjectAvailable()&&"ontouchstart"in document.documentElement;Client.IS_POINTER=isWindowObjectAvailable()&&!!window.PointerEvent&&isAppVersionAvailable()&&!isAppVersionIncludes("Mac");Client.IS_LOCAL=isWindowObjectAvailable()&&!document.location.href.includes("http://")&&!document.location.href.includes("https://");const getMainEvent=r=>{let t=r;return(t.type==="touchstart"||t.type==="touchmove")&&t.touches&&t.touches[0]?t=t.touches[0]:t.type==="touchend"&&t.changedTouches&&t.changedTouches[0]&&(t=t.changedTouches[0]),t},getClientX=r=>getMainEvent(r).clientX,getClientY=r=>getMainEvent(r).clientY,getSource=r=>r.target,isConsumed=r=>{const t=r;return t.isConsumed!==void 0&&t.isConsumed},isTouchEvent=r=>{const t=r;return t.pointerType?t.pointerType==="touch"||t.pointerType===t.MSPOINTER_TYPE_TOUCH:t.mozInputSource!==void 0?t.mozInputSource===5:t.type.indexOf("touch")===0},isPenEvent=r=>{const t=r;return t.pointerType?t.pointerType=="pen"||t.pointerType===t.MSPOINTER_TYPE_PEN:t.mozInputSource!==void 0?t.mozInputSource===2:t.type.indexOf("pen")===0},isMultiTouchEvent=r=>{const t=r;return t.type&&t.type.indexOf("touch")==0&&t.touches!==void 0&&t.touches.length>1},isMouseEvent=r=>{const t=r;return t.pointerType?t.pointerType=="mouse"||t.pointerType===t.MSPOINTER_TYPE_MOUSE:t.mozInputSource!==void 0?t.mozInputSource===1:t.type.indexOf("mouse")===0},isLeftMouseButton=r=>"buttons"in r&&(r.type==="mousedown"||r.type==="mousemove")?r.buttons===1:r.which!==void 0?r.which===1:r.button===1,isRightMouseButton=r=>r.button===2,isPopupTrigger=r=>isRightMouseButton(r)||Client.IS_MAC&&isControlDown(r)&&!isShiftDown(r)&&!isMetaDown(r)&&!isAltDown(r),isShiftDown=r=>r.shiftKey,isAltDown=r=>r.altKey,isControlDown=r=>r.ctrlKey,isMetaDown=r=>r.metaKey;class NoOpLogger{debug(t){}enter(t){}error(t,...e){}info(t){}leave(t,e){}show(){}trace(t){}warn(t){}}const shallowCopy=(r,t)=>{for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const i=r[e];Array.isArray(i)?t[e]=[...i]:t[e]=i}};class NoOpI18n{isEnabled(){return!1}get(){return null}addResource(){}}const GlobalConfig={i18n:new NoOpI18n,logger:new NoOpLogger},StyleDefaultsConfig={fontFamily:DEFAULT_FONTFAMILY,fontSize:DEFAULT_FONTSIZE,imageSize:DEFAULT_IMAGESIZE,lineArcSize:LINE_ARCSIZE,markerSize:DEFAULT_MARKERSIZE,roundingFactor:RECTANGLE_ROUNDING_FACTOR,shadowColor:SHADOWCOLOR,shadowOffsetX:SHADOW_OFFSET_X,shadowOffsetY:SHADOW_OFFSET_Y,shadowOpacity:SHADOW_OPACITY,startSize:DEFAULT_STARTSIZE},doEval=expression=>eval(expression),isElement=r=>(r==null?void 0:r.nodeType)===NODE_TYPE.ELEMENT,isNullish=r=>r==null,log=()=>GlobalConfig.logger,mixInto=r=>t=>{const e=Reflect.ownKeys(t);try{for(const i of e)Object.defineProperty(r.prototype,i,{value:t[i],writable:!0})}catch(i){log().error("Error while mixing",i)}},matchBinaryMask=(r,t)=>(r&t)===t,blocks=new Set(["BLOCKQUOTE","DIV","H1","H2","H3","H4","H5","H6","OL","P","PRE","TABLE","UL"]),extractTextWithWhitespace=r=>{const t=[];function e(i){if(!(i.length==1&&(i[0].nodeName=="BR"||i[0].innerHTML==`
1
+ import{j as jsxRuntimeExports}from"./reactflow-WKyu73tD.js";import{a as reactExports}from"./zustand-qbFpP9Up.js";import{D as DIAGRAM_TYPE_META,u as useModelStore,g as getDiagram,n as sendDiagramLayoutUpdate,F as FONT}from"./index-CgRwea72.js";import{j as computeFBSLayout,d as buildFunctionalTree,l as computeContainmentLayout,e as buildDecompositionTree,m as computeInterconnectionLayout,n as computeActionFlowViewLayout,o as computeStateTransitionLayout,p as computeSequenceLayout,r as resolveGeneralMode,q as computeGeneralViewLayout,b as buildGeneralViewTree,t as computeLayout,s as selectedLayoutProviderId,c as commonDisplayLevels,g as GridView,B as BrowserView}from"./layout-selection-BQ2WuAEB.js";import"./layout-providers-BAUgp0nu.js";import"./elk-B75IRfCd.js";import"web-worker";class ImageBox{constructor(t,e,i){this.src=t,this.width=e,this.height=i}}class EventObject{constructor(t="",...e){if(this.consumed=!1,this.name=t,this.properties={},e[0]&&e[0].constructor===Object)for(const[i,s]of Object.entries(e[0]))this.properties[i]=s;else for(let i=0;i<e.length;i+=2)e[i+1]!==null&&(this.properties[e[i]]=e[i+1])}getName(){return this.name}getProperties(){return this.properties}getProperty(t){return this.properties[t]}isConsumed(){return this.consumed}consume(){this.consumed=!0}}class EventSource{constructor(t=null){this.eventListeners=[],this.eventsEnabled=!0,this.eventSource=null,this.eventSource=t}isEventsEnabled(){return this.eventsEnabled}setEventsEnabled(t){this.eventsEnabled=t}getEventSource(){return this.eventSource}setEventSource(t){this.eventSource=t}addListener(t,e){this.eventListeners.push({name:t,funct:e})}removeListener(t){let e=0;for(;e<this.eventListeners.length;)this.eventListeners[e].funct===t?this.eventListeners.splice(e,1):e+=1}fireEvent(t,e=null){if(this.isEventsEnabled()){t||(t=new EventObject("")),e||(e=this.getEventSource()),e||(e=this);for(const i of this.eventListeners)(i.name===null||i.name===t.getName())&&i.funct.apply(this,[e,t])}}destroy(){this.eventListeners.length=0}}const DEFAULT_HOTSPOT=.3,MIN_HOTSPOT_SIZE=8,MAX_HOTSPOT_SIZE=0,IDENTITY_FIELD_NAME="mxObjectId",NS_SVG="http://www.w3.org/2000/svg",NS_XLINK="http://www.w3.org/1999/xlink",SHADOWCOLOR="gray",SHADOW_OFFSET_X=2,SHADOW_OFFSET_Y=3,SHADOW_OPACITY=1,TOOLTIP_VERTICAL_OFFSET=16,DEFAULT_VALID_COLOR="#00FF00",DEFAULT_INVALID_COLOR="#FF0000",OUTLINE_HIGHLIGHT_COLOR="#00FF00",OUTLINE_HIGHLIGHT_STROKEWIDTH=5,HIGHLIGHT_STROKEWIDTH=3,HIGHLIGHT_SIZE=2,HIGHLIGHT_OPACITY=100,INVALID_CONNECT_TARGET_COLOR="#FF0000",DROP_TARGET_COLOR="#0000FF",VALID_COLOR="#00FF00",INVALID_COLOR="#FF0000",EDGE_SELECTION_COLOR="#00FF00",VERTEX_SELECTION_COLOR="#00FF00",VERTEX_SELECTION_STROKEWIDTH=1,EDGE_SELECTION_STROKEWIDTH=1,VERTEX_SELECTION_DASHED=!0,EDGE_SELECTION_DASHED=!0,GUIDE_COLOR="#FF0000",GUIDE_STROKEWIDTH=1,HANDLE_SIZE=6,LABEL_HANDLE_SIZE=4,HANDLE_FILLCOLOR="#00FF00",HANDLE_STROKECOLOR="black",LABEL_HANDLE_FILLCOLOR="yellow",CONNECT_HANDLE_FILLCOLOR="#0000FF",LOCKED_HANDLE_FILLCOLOR="#FF0000",DEFAULT_FONTFAMILY="Arial,Helvetica,sans-serif",DEFAULT_FONTSIZE=11,DEFAULT_TEXT_DIRECTION="",LINE_HEIGHT=1.2,WORD_WRAP="normal",DEFAULT_FONTSTYLE=0,DEFAULT_STARTSIZE=40,DEFAULT_MARKERSIZE=6,DEFAULT_IMAGESIZE=24,ENTITY_SEGMENT=30,RECTANGLE_ROUNDING_FACTOR=.15,LINE_ARCSIZE=20,ARROW_SPACING=0,ARROW_WIDTH=30,ARROW_SIZE=30,PAGE_FORMAT_A4_PORTRAIT=[0,0,827,1169],NONE="none",FONT_STYLE_MASK={BOLD:1,ITALIC:2,UNDERLINE:4,STRIKETHROUGH:8},DIRECTION_MASK={NONE:0,WEST:1,NORTH:2,SOUTH:4,EAST:8,ALL:15},NODE_TYPE={ELEMENT:1},isWindowObjectAvailable=()=>typeof window<"u",isUserAgentAvailable=()=>!!navigator.userAgent,isUserAgentIncludes=r=>navigator.userAgent.includes(r),isAppVersionAvailable=()=>!!navigator.appVersion,isAppVersionIncludes=r=>navigator.appVersion.includes(r);class Client{}Client.basePath=".";Client.setBasePath=r=>{typeof r<"u"&&r.length>0?(r.substring(r.length-1)==="/"&&(r=r.substring(0,r.length-1)),Client.basePath=r):Client.basePath="."};Client.imageBasePath=".";Client.setImageBasePath=r=>{typeof r<"u"&&r.length>0?(r.substring(r.length-1)==="/"&&(r=r.substring(0,r.length-1)),Client.imageBasePath=r):Client.imageBasePath=`${Client.basePath}/images`};Client.IS_EDGE=isWindowObjectAvailable()&&isUserAgentAvailable()&&!!navigator.userAgent.match(/Edge\//);Client.IS_NS=isWindowObjectAvailable()&&isUserAgentAvailable()&&isUserAgentIncludes("Mozilla/")&&!isUserAgentIncludes("MSIE")&&!isUserAgentIncludes("Edge/");Client.IS_SF=isWindowObjectAvailable()&&/Apple Computer, Inc/.test(navigator.vendor);Client.IS_ANDROID=isWindowObjectAvailable()&&isAppVersionAvailable()&&isAppVersionIncludes("Android");Client.IS_IOS=isWindowObjectAvailable()&&/iP(hone|od|ad)/.test(navigator.platform);Client.IS_GC=isWindowObjectAvailable()&&/Google Inc/.test(navigator.vendor);Client.IS_CHROMEAPP=isWindowObjectAvailable()&&window.chrome!=null&&chrome.app!=null&&chrome.app.runtime!=null;Client.IS_FF=isUserAgentAvailable()&&navigator.userAgent.toLowerCase().includes("firefox");Client.IS_MT=isWindowObjectAvailable()&&isUserAgentAvailable()&&(isUserAgentIncludes("Firefox/")&&!isUserAgentIncludes("Firefox/1.")&&!isUserAgentIncludes("Firefox/2.")||isUserAgentIncludes("Iceweasel/")&&!isUserAgentIncludes("Iceweasel/1.")&&!isUserAgentIncludes("Iceweasel/2.")||isUserAgentIncludes("SeaMonkey/")&&!isUserAgentIncludes("SeaMonkey/1.")||isUserAgentIncludes("Iceape/")&&!isUserAgentIncludes("Iceape/1."));var ft;Client.IS_SVG=isWindowObjectAvailable()&&((ft=navigator.appName)==null?void 0:ft.toUpperCase())!=="MICROSOFT INTERNET EXPLORER";Client.NO_FO=isWindowObjectAvailable()&&(!document.createElementNS||document.createElementNS(NS_SVG,"foreignObject").toString()!=="[object SVGForeignObjectElement]"||isUserAgentIncludes("Opera/"));Client.IS_WIN=isWindowObjectAvailable()&&isAppVersionAvailable()&&isAppVersionIncludes("Win");Client.IS_MAC=isWindowObjectAvailable()&&isAppVersionAvailable()&&isAppVersionIncludes("Mac");Client.IS_CHROMEOS=isWindowObjectAvailable()&&/\bCrOS\b/.test(navigator.appVersion);Client.IS_TOUCH=isWindowObjectAvailable()&&"ontouchstart"in document.documentElement;Client.IS_POINTER=isWindowObjectAvailable()&&!!window.PointerEvent&&isAppVersionAvailable()&&!isAppVersionIncludes("Mac");Client.IS_LOCAL=isWindowObjectAvailable()&&!document.location.href.includes("http://")&&!document.location.href.includes("https://");const getMainEvent=r=>{let t=r;return(t.type==="touchstart"||t.type==="touchmove")&&t.touches&&t.touches[0]?t=t.touches[0]:t.type==="touchend"&&t.changedTouches&&t.changedTouches[0]&&(t=t.changedTouches[0]),t},getClientX=r=>getMainEvent(r).clientX,getClientY=r=>getMainEvent(r).clientY,getSource=r=>r.target,isConsumed=r=>{const t=r;return t.isConsumed!==void 0&&t.isConsumed},isTouchEvent=r=>{const t=r;return t.pointerType?t.pointerType==="touch"||t.pointerType===t.MSPOINTER_TYPE_TOUCH:t.mozInputSource!==void 0?t.mozInputSource===5:t.type.indexOf("touch")===0},isPenEvent=r=>{const t=r;return t.pointerType?t.pointerType=="pen"||t.pointerType===t.MSPOINTER_TYPE_PEN:t.mozInputSource!==void 0?t.mozInputSource===2:t.type.indexOf("pen")===0},isMultiTouchEvent=r=>{const t=r;return t.type&&t.type.indexOf("touch")==0&&t.touches!==void 0&&t.touches.length>1},isMouseEvent=r=>{const t=r;return t.pointerType?t.pointerType=="mouse"||t.pointerType===t.MSPOINTER_TYPE_MOUSE:t.mozInputSource!==void 0?t.mozInputSource===1:t.type.indexOf("mouse")===0},isLeftMouseButton=r=>"buttons"in r&&(r.type==="mousedown"||r.type==="mousemove")?r.buttons===1:r.which!==void 0?r.which===1:r.button===1,isRightMouseButton=r=>r.button===2,isPopupTrigger=r=>isRightMouseButton(r)||Client.IS_MAC&&isControlDown(r)&&!isShiftDown(r)&&!isMetaDown(r)&&!isAltDown(r),isShiftDown=r=>r.shiftKey,isAltDown=r=>r.altKey,isControlDown=r=>r.ctrlKey,isMetaDown=r=>r.metaKey;class NoOpLogger{debug(t){}enter(t){}error(t,...e){}info(t){}leave(t,e){}show(){}trace(t){}warn(t){}}const shallowCopy=(r,t)=>{for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const i=r[e];Array.isArray(i)?t[e]=[...i]:t[e]=i}};class NoOpI18n{isEnabled(){return!1}get(){return null}addResource(){}}const GlobalConfig={i18n:new NoOpI18n,logger:new NoOpLogger},StyleDefaultsConfig={fontFamily:DEFAULT_FONTFAMILY,fontSize:DEFAULT_FONTSIZE,imageSize:DEFAULT_IMAGESIZE,lineArcSize:LINE_ARCSIZE,markerSize:DEFAULT_MARKERSIZE,roundingFactor:RECTANGLE_ROUNDING_FACTOR,shadowColor:SHADOWCOLOR,shadowOffsetX:SHADOW_OFFSET_X,shadowOffsetY:SHADOW_OFFSET_Y,shadowOpacity:SHADOW_OPACITY,startSize:DEFAULT_STARTSIZE},doEval=expression=>eval(expression),isElement=r=>(r==null?void 0:r.nodeType)===NODE_TYPE.ELEMENT,isNullish=r=>r==null,log=()=>GlobalConfig.logger,mixInto=r=>t=>{const e=Reflect.ownKeys(t);try{for(const i of e)Object.defineProperty(r.prototype,i,{value:t[i],writable:!0})}catch(i){log().error("Error while mixing",i)}},matchBinaryMask=(r,t)=>(r&t)===t,blocks=new Set(["BLOCKQUOTE","DIV","H1","H2","H3","H4","H5","H6","OL","P","PRE","TABLE","UL"]),extractTextWithWhitespace=r=>{const t=[];function e(i){if(!(i.length==1&&(i[0].nodeName=="BR"||i[0].innerHTML==`
2
2
  `)))for(let s=0;s<i.length;s+=1){const n=i[s];n.nodeName=="BR"||n.innerHTML==`
3
3
  `||(i.length==1||s==0)&&n.nodeName=="DIV"&&n.innerHTML.toLowerCase()=="<br>"?t.push(`
4
4
  `):(n.nodeType===3||n.nodeType===4?n.nodeValue&&n.nodeValue.length>0&&t.push(n.nodeValue):n.nodeType!==8&&n.childNodes.length>0&&e(Array.from(n.childNodes)),s<i.length-1&&blocks.has(i[s+1].nodeName)&&t.push(`
@@ -1 +1 @@
1
- import{j as e}from"./reactflow-WKyu73tD.js";import{a as y}from"./zustand-qbFpP9Up.js";import{u as F,d as j}from"./index-c27kHB43.js";function N(l,u){const o=[],i=[],m=[],g=new Set(Object.keys(l.elements)),x=new Set(Object.keys(u.elements));for(const a of x)g.has(a)||o.push(u.elements[a]);for(const a of g)x.has(a)||i.push(l.elements[a]);for(const a of g){if(!x.has(a))continue;const p=l.elements[a],t=u.elements[a],c=[];p.name!==t.name&&c.push(`name: "${p.name}" → "${t.name}"`),p.kind!==t.kind&&c.push(`kind: ${p.kind} → ${t.kind}`),p.layer!==t.layer&&c.push(`layer: ${p.layer} → ${t.layer}`),p.doc!==t.doc&&c.push("doc changed");const s=JSON.stringify(p.attributes),n=JSON.stringify(t.attributes);s!==n&&c.push("attributes changed"),c.length>0&&m.push({element:t,changes:c})}const v=new Set(l.relationships.map(a=>a.id)),h=new Set(u.relationships.map(a=>a.id)),f=u.relationships.filter(a=>!v.has(a.id)),r=l.relationships.filter(a=>!h.has(a.id));return{added:o,removed:i,changed:m,addedRels:f,removedRels:r,summary:{added:o.length,removed:i.length,changed:m.length,addedRels:f.length,removedRels:r.length}}}function A(){const l=F(s=>s.model),u=F(s=>s.selectElement),[o,i]=y.useState(null),[m,g]=y.useState(""),[x,v]=y.useState([]),[h,f]=y.useState(null),[r,a]=y.useState("all"),p=y.useCallback(()=>{if(!l)return;const s=m.trim()||`Snapshot ${x.length+1}`;v(n=>[...n,{name:s,model:JSON.parse(JSON.stringify(l)),timestamp:Date.now()}]),g("")},[l,m,x.length]);y.useEffect(()=>{h!==null&&x[h]&&i(x[h].model)},[h,x]);const t=y.useMemo(()=>!o||!l?null:N(o,l),[o,l]),c=t?t.summary.added+t.summary.removed+t.summary.changed:0;return 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.jsx("h2",{className:"text-sm font-bold tracking-wide",style:{color:"#2DD4A8"},children:"Model Diff"}),e.jsx("p",{className:"text-xs mt-0.5",style:{color:"rgba(255,255,255,0.6)"},children:"Compare model states"})]}),e.jsx("div",{className:"px-3 py-2.5",style:{borderBottom:"1px solid #E5E5E0"},children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("input",{type:"text",value:m,onChange:s=>g(s.target.value),placeholder:"Snapshot name...",className:"flex-1 text-xs px-2 py-1.5 rounded focus:outline-none",style:{background:"#F7F7F5",border:"1px solid #E5E5E0",color:"#1a1a1a"},onKeyDown:s=>s.key==="Enter"&&p()}),e.jsx("button",{onClick:p,className:"px-2 py-1.5 text-xs rounded font-medium",style:{background:"#2DD4A8",color:"#FFFFFF"},children:"Snap"})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto text-xs py-1",children:[x.length===0&&e.jsx("div",{className:"px-4 py-8 text-center",style:{color:"#9CA3AF"},children:"Take a snapshot to create a baseline for comparison."}),x.map((s,n)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer mx-1 rounded-lg",style:{background:h===n?"#2DD4A818":"transparent",fontWeight:h===n?500:400},onMouseEnter:d=>{h!==n&&(d.currentTarget.style.background="#F0F0ED")},onMouseLeave:d=>{h!==n&&(d.currentTarget.style.background=h===n?"#2DD4A818":"transparent")},onClick:()=>f(n),children:[e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"#2DD4A8"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"truncate",style:{color:"#374151"},children:s.name}),e.jsxs("div",{style:{color:"#9CA3AF",fontSize:"10px"},children:[new Date(s.timestamp).toLocaleTimeString()," · ",Object.keys(s.model.elements).length," elements"]})]})]},n))]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:[!t&&e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"#9CA3AF"},children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{style:{fontSize:"32px",marginBottom:"8px",opacity:.5},children:"↔"}),e.jsx("div",{className:"text-sm",children:"Take a snapshot, then make changes to see the diff"}),e.jsx("div",{className:"text-xs mt-2",style:{color:"#D1D5DB"},children:"Snapshots capture the current model state for comparison"})]})}),t&&e.jsxs("div",{className:"max-w-3xl",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("h2",{className:"text-sm font-semibold",style:{color:"#374151"},children:c===0?"No changes":`${c} element changes`}),t.summary.addedRels+t.summary.removedRels>0&&e.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:["+ ",t.summary.addedRels+t.summary.removedRels," relationship changes"]})]}),e.jsx("div",{className:"flex gap-2 mb-4",children:[{key:"all",label:"All",count:c,color:"#6B7280"},{key:"added",label:"Added",count:t.summary.added,color:"#2ECC71"},{key:"removed",label:"Removed",count:t.summary.removed,color:"#E74C3C"},{key:"changed",label:"Changed",count:t.summary.changed,color:"#F39C12"}].map(s=>e.jsxs("button",{onClick:()=>a(s.key),className:"px-2.5 py-1 text-xs rounded-full font-medium",style:{background:r===s.key?s.color+"20":"#F3F4F6",color:r===s.key?s.color:"#9CA3AF",border:`1px solid ${r===s.key?s.color+"40":"#E5E5E0"}`},children:[s.label," (",s.count,")"]},s.key))}),(r==="all"||r==="added")&&t.added.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#2ECC71"},children:["Added (",t.added.length,")"]}),e.jsx("div",{className:"space-y-1",children:t.added.map(s=>e.jsx(b,{element:s,type:"added",onClick:()=>u(s.id)},s.id))})]}),(r==="all"||r==="removed")&&t.removed.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#E74C3C"},children:["Removed (",t.removed.length,")"]}),e.jsx("div",{className:"space-y-1",children:t.removed.map(s=>e.jsx(b,{element:s,type:"removed",onClick:()=>{}},s.id))})]}),(r==="all"||r==="changed")&&t.changed.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#F39C12"},children:["Changed (",t.changed.length,")"]}),e.jsx("div",{className:"space-y-1",children:t.changed.map(({element:s,changes:n})=>e.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg cursor-pointer",style:{background:"#FFFFFF",border:"1px solid #F39C1240"},onMouseEnter:d=>d.currentTarget.style.background="#FDF8F0",onMouseLeave:d=>d.currentTarget.style.background="#FFFFFF",onClick:()=>u(s.id),children:[e.jsx("span",{className:"text-xs mt-0.5",style:{color:"#F39C12"},children:"●"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium truncate",style:{color:"#374151"},children:s.name}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded",style:{background:(j[s.layer]||"#95A5A6")+"18",color:j[s.layer]||"#95A5A6"},children:s.kind})]}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:n.join(", ")})]})]},s.id))})]}),(t.addedRels.length>0||t.removedRels.length>0)&&e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#6B7280"},children:"Relationship Changes"}),e.jsxs("div",{className:"space-y-1",children:[t.addedRels.map(s=>{var n,d;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg",style:{background:"#F0FDF4",border:"1px solid #BBF7D0"},children:[e.jsx("span",{style:{color:"#2ECC71"},children:"+"}),e.jsx("span",{style:{color:"#374151"},children:((n=l==null?void 0:l.elements[s.sourceId])==null?void 0:n.name)||s.sourceId}),e.jsx("span",{style:{color:"#2563EB"},children:s.type}),e.jsx("span",{style:{color:"#374151"},children:((d=l==null?void 0:l.elements[s.targetId])==null?void 0:d.name)||s.targetId})]},s.id)}),t.removedRels.map(s=>{var n,d;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg",style:{background:"#FEF2F2",border:"1px solid #FECACA"},children:[e.jsx("span",{style:{color:"#E74C3C"},children:"-"}),e.jsx("span",{style:{color:"#374151"},children:((n=o==null?void 0:o.elements[s.sourceId])==null?void 0:n.name)||s.sourceId}),e.jsx("span",{style:{color:"#2563EB"},children:s.type}),e.jsx("span",{style:{color:"#374151"},children:((d=o==null?void 0:o.elements[s.targetId])==null?void 0:d.name)||s.targetId})]},s.id)})]})]}),c===0&&t.addedRels.length===0&&t.removedRels.length===0&&e.jsxs("div",{className:"text-center py-8",style:{color:"#9CA3AF"},children:[e.jsx("div",{style:{fontSize:"24px",marginBottom:"8px"},children:"✓"}),e.jsx("div",{className:"text-sm",children:"No differences between snapshot and current model"})]})]})]})]})}function b({element:l,type:u,onClick:o}){const i=u==="added"?{bg:"#F0FDF4",border:"#BBF7D0",dot:"#2ECC71",hoverBg:"#DCFCE7"}:{bg:"#FEF2F2",border:"#FECACA",dot:"#E74C3C",hoverBg:"#FEE2E2"};return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg cursor-pointer text-xs",style:{background:i.bg,border:`1px solid ${i.border}`},onMouseEnter:m=>m.currentTarget.style.background=i.hoverBg,onMouseLeave:m=>m.currentTarget.style.background=i.bg,onClick:o,children:[e.jsx("span",{style:{color:i.dot},children:"●"}),e.jsx("span",{className:"font-medium truncate",style:{color:"#374151"},children:l.name}),e.jsx("span",{className:"ml-auto px-1.5 py-0.5 rounded",style:{background:(j[l.layer]||"#95A5A6")+"18",color:j[l.layer]||"#95A5A6"},children:l.kind})]})}export{A as ModelDiff,N as computeModelDiff};
1
+ import{j as e}from"./reactflow-WKyu73tD.js";import{a as y}from"./zustand-qbFpP9Up.js";import{u as F,d as j}from"./index-CgRwea72.js";function N(l,u){const o=[],i=[],m=[],g=new Set(Object.keys(l.elements)),x=new Set(Object.keys(u.elements));for(const a of x)g.has(a)||o.push(u.elements[a]);for(const a of g)x.has(a)||i.push(l.elements[a]);for(const a of g){if(!x.has(a))continue;const p=l.elements[a],t=u.elements[a],c=[];p.name!==t.name&&c.push(`name: "${p.name}" → "${t.name}"`),p.kind!==t.kind&&c.push(`kind: ${p.kind} → ${t.kind}`),p.layer!==t.layer&&c.push(`layer: ${p.layer} → ${t.layer}`),p.doc!==t.doc&&c.push("doc changed");const s=JSON.stringify(p.attributes),n=JSON.stringify(t.attributes);s!==n&&c.push("attributes changed"),c.length>0&&m.push({element:t,changes:c})}const v=new Set(l.relationships.map(a=>a.id)),h=new Set(u.relationships.map(a=>a.id)),f=u.relationships.filter(a=>!v.has(a.id)),r=l.relationships.filter(a=>!h.has(a.id));return{added:o,removed:i,changed:m,addedRels:f,removedRels:r,summary:{added:o.length,removed:i.length,changed:m.length,addedRels:f.length,removedRels:r.length}}}function A(){const l=F(s=>s.model),u=F(s=>s.selectElement),[o,i]=y.useState(null),[m,g]=y.useState(""),[x,v]=y.useState([]),[h,f]=y.useState(null),[r,a]=y.useState("all"),p=y.useCallback(()=>{if(!l)return;const s=m.trim()||`Snapshot ${x.length+1}`;v(n=>[...n,{name:s,model:JSON.parse(JSON.stringify(l)),timestamp:Date.now()}]),g("")},[l,m,x.length]);y.useEffect(()=>{h!==null&&x[h]&&i(x[h].model)},[h,x]);const t=y.useMemo(()=>!o||!l?null:N(o,l),[o,l]),c=t?t.summary.added+t.summary.removed+t.summary.changed:0;return 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.jsx("h2",{className:"text-sm font-bold tracking-wide",style:{color:"#2DD4A8"},children:"Model Diff"}),e.jsx("p",{className:"text-xs mt-0.5",style:{color:"rgba(255,255,255,0.6)"},children:"Compare model states"})]}),e.jsx("div",{className:"px-3 py-2.5",style:{borderBottom:"1px solid #E5E5E0"},children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("input",{type:"text",value:m,onChange:s=>g(s.target.value),placeholder:"Snapshot name...",className:"flex-1 text-xs px-2 py-1.5 rounded focus:outline-none",style:{background:"#F7F7F5",border:"1px solid #E5E5E0",color:"#1a1a1a"},onKeyDown:s=>s.key==="Enter"&&p()}),e.jsx("button",{onClick:p,className:"px-2 py-1.5 text-xs rounded font-medium",style:{background:"#2DD4A8",color:"#FFFFFF"},children:"Snap"})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto text-xs py-1",children:[x.length===0&&e.jsx("div",{className:"px-4 py-8 text-center",style:{color:"#9CA3AF"},children:"Take a snapshot to create a baseline for comparison."}),x.map((s,n)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer mx-1 rounded-lg",style:{background:h===n?"#2DD4A818":"transparent",fontWeight:h===n?500:400},onMouseEnter:d=>{h!==n&&(d.currentTarget.style.background="#F0F0ED")},onMouseLeave:d=>{h!==n&&(d.currentTarget.style.background=h===n?"#2DD4A818":"transparent")},onClick:()=>f(n),children:[e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"#2DD4A8"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"truncate",style:{color:"#374151"},children:s.name}),e.jsxs("div",{style:{color:"#9CA3AF",fontSize:"10px"},children:[new Date(s.timestamp).toLocaleTimeString()," · ",Object.keys(s.model.elements).length," elements"]})]})]},n))]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:[!t&&e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"#9CA3AF"},children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{style:{fontSize:"32px",marginBottom:"8px",opacity:.5},children:"↔"}),e.jsx("div",{className:"text-sm",children:"Take a snapshot, then make changes to see the diff"}),e.jsx("div",{className:"text-xs mt-2",style:{color:"#D1D5DB"},children:"Snapshots capture the current model state for comparison"})]})}),t&&e.jsxs("div",{className:"max-w-3xl",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("h2",{className:"text-sm font-semibold",style:{color:"#374151"},children:c===0?"No changes":`${c} element changes`}),t.summary.addedRels+t.summary.removedRels>0&&e.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:["+ ",t.summary.addedRels+t.summary.removedRels," relationship changes"]})]}),e.jsx("div",{className:"flex gap-2 mb-4",children:[{key:"all",label:"All",count:c,color:"#6B7280"},{key:"added",label:"Added",count:t.summary.added,color:"#2ECC71"},{key:"removed",label:"Removed",count:t.summary.removed,color:"#E74C3C"},{key:"changed",label:"Changed",count:t.summary.changed,color:"#F39C12"}].map(s=>e.jsxs("button",{onClick:()=>a(s.key),className:"px-2.5 py-1 text-xs rounded-full font-medium",style:{background:r===s.key?s.color+"20":"#F3F4F6",color:r===s.key?s.color:"#9CA3AF",border:`1px solid ${r===s.key?s.color+"40":"#E5E5E0"}`},children:[s.label," (",s.count,")"]},s.key))}),(r==="all"||r==="added")&&t.added.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#2ECC71"},children:["Added (",t.added.length,")"]}),e.jsx("div",{className:"space-y-1",children:t.added.map(s=>e.jsx(b,{element:s,type:"added",onClick:()=>u(s.id)},s.id))})]}),(r==="all"||r==="removed")&&t.removed.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#E74C3C"},children:["Removed (",t.removed.length,")"]}),e.jsx("div",{className:"space-y-1",children:t.removed.map(s=>e.jsx(b,{element:s,type:"removed",onClick:()=>{}},s.id))})]}),(r==="all"||r==="changed")&&t.changed.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#F39C12"},children:["Changed (",t.changed.length,")"]}),e.jsx("div",{className:"space-y-1",children:t.changed.map(({element:s,changes:n})=>e.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg cursor-pointer",style:{background:"#FFFFFF",border:"1px solid #F39C1240"},onMouseEnter:d=>d.currentTarget.style.background="#FDF8F0",onMouseLeave:d=>d.currentTarget.style.background="#FFFFFF",onClick:()=>u(s.id),children:[e.jsx("span",{className:"text-xs mt-0.5",style:{color:"#F39C12"},children:"●"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium truncate",style:{color:"#374151"},children:s.name}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded",style:{background:(j[s.layer]||"#95A5A6")+"18",color:j[s.layer]||"#95A5A6"},children:s.kind})]}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:n.join(", ")})]})]},s.id))})]}),(t.addedRels.length>0||t.removedRels.length>0)&&e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#6B7280"},children:"Relationship Changes"}),e.jsxs("div",{className:"space-y-1",children:[t.addedRels.map(s=>{var n,d;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg",style:{background:"#F0FDF4",border:"1px solid #BBF7D0"},children:[e.jsx("span",{style:{color:"#2ECC71"},children:"+"}),e.jsx("span",{style:{color:"#374151"},children:((n=l==null?void 0:l.elements[s.sourceId])==null?void 0:n.name)||s.sourceId}),e.jsx("span",{style:{color:"#2563EB"},children:s.type}),e.jsx("span",{style:{color:"#374151"},children:((d=l==null?void 0:l.elements[s.targetId])==null?void 0:d.name)||s.targetId})]},s.id)}),t.removedRels.map(s=>{var n,d;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg",style:{background:"#FEF2F2",border:"1px solid #FECACA"},children:[e.jsx("span",{style:{color:"#E74C3C"},children:"-"}),e.jsx("span",{style:{color:"#374151"},children:((n=o==null?void 0:o.elements[s.sourceId])==null?void 0:n.name)||s.sourceId}),e.jsx("span",{style:{color:"#2563EB"},children:s.type}),e.jsx("span",{style:{color:"#374151"},children:((d=o==null?void 0:o.elements[s.targetId])==null?void 0:d.name)||s.targetId})]},s.id)})]})]}),c===0&&t.addedRels.length===0&&t.removedRels.length===0&&e.jsxs("div",{className:"text-center py-8",style:{color:"#9CA3AF"},children:[e.jsx("div",{style:{fontSize:"24px",marginBottom:"8px"},children:"✓"}),e.jsx("div",{className:"text-sm",children:"No differences between snapshot and current model"})]})]})]})]})}function b({element:l,type:u,onClick:o}){const i=u==="added"?{bg:"#F0FDF4",border:"#BBF7D0",dot:"#2ECC71",hoverBg:"#DCFCE7"}:{bg:"#FEF2F2",border:"#FECACA",dot:"#E74C3C",hoverBg:"#FEE2E2"};return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg cursor-pointer text-xs",style:{background:i.bg,border:`1px solid ${i.border}`},onMouseEnter:m=>m.currentTarget.style.background=i.hoverBg,onMouseLeave:m=>m.currentTarget.style.background=i.bg,onClick:o,children:[e.jsx("span",{style:{color:i.dot},children:"●"}),e.jsx("span",{className:"font-medium truncate",style:{color:"#374151"},children:l.name}),e.jsx("span",{className:"ml-auto px-1.5 py-0.5 rounded",style:{background:(j[l.layer]||"#95A5A6")+"18",color:j[l.layer]||"#95A5A6"},children:l.kind})]})}export{A as ModelDiff,N as computeModelDiff};
@@ -1 +1 @@
1
- import{j as e,H as C,P as k,R as D,u as S,i as O,f as R,g as T}from"./reactflow-WKyu73tD.js";import{a as p}from"./zustand-qbFpP9Up.js";/* empty css */import{r as I}from"./layout-providers-BAUgp0nu.js";import{d as L,u as h,t as P,v as M,w as z}from"./index-c27kHB43.js";import"./elk-B75IRfCd.js";import"web-worker";const A={ontology:{bg:"#EFF6FF",fg:"#2563EB",border:"#BFDBFE"},profile:{bg:"#F0FDF4",fg:"#16A34A",border:"#BBF7D0"},extension:{bg:"#FFF7ED",fg:"#EA580C",border:"#FED7AA"}};function H({data:i}){const s=i,l=A[s.type]??A.ontology;return e.jsxs("div",{"data-testid":`ontology-package-node-${s.name}`,onClick:s.onClick,onDoubleClick:s.onDoubleClick,onContextMenu:s.onContextMenu,style:{background:"#FFFFFF",border:s.selected?"2px solid #2563EB":"1px solid #E5E5E0",borderRadius:"12px",padding:"16px",minWidth:"240px",maxWidth:"300px",cursor:"pointer",boxShadow:"0 1px 3px rgba(0,0,0,0.06)",transition:"box-shadow 200ms ease, transform 200ms ease"},children:[e.jsx(C,{type:"target",position:k.Top,id:"top",style:w}),e.jsx(C,{type:"source",position:k.Bottom,id:"bottom",style:w}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"8px"},children:[e.jsx("span",{style:{padding:"1px 8px",fontSize:"10px",borderRadius:"9999px",fontWeight:600,background:l.bg,color:l.fg,border:`1px solid ${l.border}`},children:s.type}),e.jsxs("span",{style:{fontSize:"10px",color:"#9CA3AF"},children:["v",s.version]})]}),e.jsx("div",{style:{fontSize:"13px",fontWeight:600,color:"#1a1a1a",marginBottom:"4px"},children:s.name}),s.description&&e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginBottom:"10px",lineHeight:"1.4"},children:s.description.length>80?s.description.slice(0,80)+"…":s.description}),e.jsx("div",{style:{display:"flex",gap:"2px",marginBottom:"8px",height:"6px",borderRadius:"3px",overflow:"hidden"},children:s.layers.slice(0,12).map(d=>{const n=L[d.id]??d.color??"#6B7280";return e.jsx("div",{style:{flex:Math.max(d.kindCount,1),background:n,borderRadius:"1px"},title:`${d.label}: ${d.kindCount} kinds`},d.id)})}),e.jsxs("div",{style:{display:"flex",gap:"12px",fontSize:"11px",color:"#6B7280"},children:[e.jsxs("span",{children:[e.jsx("strong",{style:{color:"#1B3A4B"},children:s.kindCount})," kinds"]}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:"#1B3A4B"},children:s.layerCount})," layers"]})]})]})}const w={width:"8px",height:"8px",background:"#2563EB",border:"2px solid #FFFFFF",opacity:0},W=p.memo(H);function $({onClose:i}){const s=h(o=>o.availableOntologies),l=h(o=>o.ontologyInstallStatus),d=h(o=>o.setOntologyInstallStatus),[n,c]=p.useState(""),[r,g]=p.useState(null);function t(){n.trim()&&(d({installing:!0}),P(n.trim()),c(""))}function x(o){M(o),g(null)}return e.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-50",style:{background:"rgba(0,0,0,0.4)"},onClick:i,children:e.jsxs("div",{className:"rounded-xl shadow-2xl overflow-hidden",style:{background:"#FFFFFF",width:"520px",maxHeight:"600px",border:"1px solid #E5E5E0"},onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsx("h2",{className:"text-sm font-semibold",style:{color:"#1a1a1a"},children:"Manage Ontology Library"}),e.jsx("button",{onClick:i,className:"text-sm px-2 py-0.5 rounded hover:bg-gray-100",style:{color:"#9CA3AF"},children:"x"})]}),e.jsxs("div",{className:"p-5 space-y-5 overflow-y-auto",style:{maxHeight:"480px"},children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium block mb-1.5",style:{color:"#374151"},children:"Add Ontology"}),e.jsx("p",{className:"text-xs mb-2",style:{color:"#9CA3AF"},children:"Enter a git URL (https://...git), npm package name (@memo/...), or local path."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",placeholder:"https://gitlab.com/org/my-ontology.git",value:n,onChange:o=>c(o.target.value),onKeyDown:o=>o.key==="Enter"&&t(),className:"flex-1 px-3 py-2 text-xs rounded-lg",style:{border:"1px solid #E5E7EB",background:"#F9FAFB",color:"#374151",outline:"none"},onFocus:o=>o.currentTarget.style.borderColor="#2563EB",onBlur:o=>o.currentTarget.style.borderColor="#E5E7EB",disabled:l.installing}),e.jsx("button",{onClick:t,disabled:!n.trim()||l.installing,className:"px-4 py-2 text-xs rounded-lg font-medium",style:{background:l.installing?"#9CA3AF":"#1B3A4B",color:"#FFFFFF",opacity:!n.trim()||l.installing?.5:1,cursor:!n.trim()||l.installing?"not-allowed":"pointer"},children:l.installing?"Installing...":"Install"})]}),l.error&&e.jsx("div",{className:"mt-2 px-3 py-2 rounded-lg text-xs",style:{background:"#FEF2F2",color:"#DC2626",border:"1px solid #FECACA"},children:l.error}),l.lastInstalled&&!l.error&&e.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-xs",style:{background:"#F0FDF4",color:"#16A34A",border:"1px solid #BBF7D0"},children:["Installed ",l.lastInstalled]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-xs font-medium block mb-2",style:{color:"#374151"},children:["Installed Packages (",s.length,")"]}),e.jsxs("div",{className:"space-y-1.5",children:[s.map(o=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{border:"1px solid #E5E5E0",background:"#FAFAF8"},children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium truncate",style:{color:"#1a1a1a"},children:o.name}),e.jsx("span",{className:"px-1.5 py-0.5 text-xs rounded",style:{background:o.type==="ontology"?"#EFF6FF":o.type==="profile"?"#F0FDF4":"#FFF7ED",color:o.type==="ontology"?"#2563EB":o.type==="profile"?"#16A34A":"#EA580C",fontSize:"10px"},children:o.type})]}),e.jsxs("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:["v",o.version," · ",o.kindCount," kinds · ",o.layers.length," layers"]})]}),r===o.name?e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>x(o.name),className:"px-2 py-1 text-xs rounded",style:{background:"#DC2626",color:"#FFFFFF"},children:"Confirm"}),e.jsx("button",{onClick:()=>g(null),className:"px-2 py-1 text-xs rounded",style:{background:"#F3F4F6",color:"#374151"},children:"Cancel"})]}):e.jsx("button",{onClick:()=>g(o.name),className:"text-xs px-2 py-1 rounded hover:bg-red-50",style:{color:"#DC2626",border:"1px solid #FECACA"},children:"Remove"})]},o.name)),s.length===0&&e.jsx("div",{className:"text-center py-6 text-xs",style:{color:"#9CA3AF"},children:"No ontology packages installed"})]})]})]})]})})}const _={ontologyPackage:W},Y=260,V=180;async function K(i){const s=new Map(i.map(t=>[t.name,t])),l={id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":"RIGHT","elk.layered.nodePlacement.strategy":"BRANDES_KOEPF","elk.layered.spacing.nodeNodeBetweenLayers":"100","elk.spacing.nodeNode":"32","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.padding":"[top=24, left=24, bottom=24, right=24]"},children:i.map(t=>({id:t.name,width:Y,height:V})),edges:i.filter(t=>t.extends&&s.has(t.extends)).map((t,x)=>({id:`e-${x}`,sources:[t.extends],targets:[t.name]}))},d=await I(l),n=new Map;for(const t of d.children??[])n.set(t.id,{x:t.x??0,y:t.y??0});const c={ontology:"#3B82F6",profile:"#10B981",extension:"#F59E0B"},r=i.map(t=>({id:t.name,type:"ontologyPackage",position:n.get(t.name)??{x:0,y:0},data:{name:t.name,type:t.type,version:t.version,description:t.description,kindCount:t.kindCount,layerCount:t.layers.length,layers:t.layers.map(x=>({id:x.id,label:x.label,color:x.color,kindCount:x.kindCount})),selected:t.selected,onClick:()=>{}}})),g=[];for(const t of i)if(t.extends&&s.has(t.extends)){const x=c[t.type]??"#94A3B8";g.push({id:`${t.extends}->${t.name}`,source:t.extends,target:t.name,type:"smoothstep",data:{edgeType:"extends"},style:{stroke:x,strokeWidth:2,strokeDasharray:"6 3"},animated:!1,label:"extends",labelStyle:{fontSize:9,fill:x,fontWeight:500},labelBgStyle:{fill:"#F7F7F5",fillOpacity:.9},labelBgPadding:[4,2],markerEnd:{type:"arrowclosed",color:x,width:14,height:14}})}return{nodes:r,edges:g}}function G(i,s){const l=new Map;for(const c of s)c.extends&&(l.has(c.extends)||l.set(c.extends,[]),l.get(c.extends).push(c.name));const d=new Set([i]),n=[i];for(;n.length;){const c=n.shift();for(const r of l.get(c)??[])d.has(r)||(d.add(r),n.push(r))}return d}function U(){const i=h(a=>a.availableOntologies),s=h(a=>a.setActiveView),l=h(a=>a.hiddenEdgeTypes),d=h(a=>a.toggleHiddenEdgeType),[n,c]=p.useState(!1),[r,g]=p.useState({nodes:[],edges:[]}),[t,x]=p.useState(null),{fitView:o}=S();p.useEffect(()=>{let a=!1;return K(i).then(u=>{a||g(u)}).catch(u=>{console.error("[OntologyDiagram] ELK layout failed:",u)}),()=>{a=!0}},[i]);const F=p.useCallback(a=>{s({type:"ontology-detail",packageName:a})},[s]),E=p.useCallback(a=>{const u=G(a,i),m=r.nodes.filter(y=>u.has(y.id));m.length!==0&&o({nodes:m.map(y=>({id:y.id})),duration:400,padding:.2})},[i,r.nodes,o]),v=p.useCallback((a,u)=>{a.preventDefault(),x({x:a.clientX,y:a.clientY,packageName:u})},[]);p.useEffect(()=>{const a=u=>{if(u.key==="Escape"){if(t){x(null);return}o({padding:.1,duration:300})}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t,o]);const{nodes:N,edges:B}=p.useMemo(()=>{const a=r.nodes.map(m=>({...m,data:{...m.data,onClick:()=>E(m.id),onDoubleClick:()=>F(m.id),onContextMenu:y=>v(y,m.id)}})),u=r.edges.filter(m=>{var j;const y=(j=m.data)==null?void 0:j.edgeType;return!y||!l.has(y)});return{nodes:a,edges:u}},[r,E,F,v,l]),f=p.useRef(null);p.useEffect(()=>{if(!t)return;const a=u=>{f.current&&!f.current.contains(u.target)&&x(null)};return window.addEventListener("mousedown",a),()=>window.removeEventListener("mousedown",a)},[t]);const b=l.has("extends");return i.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:e.jsxs("div",{className:"text-center",style:{color:"#9CA3AF"},children:[e.jsx("div",{className:"text-3xl mb-3",children:"◉"}),e.jsx("div",{className:"text-sm font-medium mb-1",style:{color:"#374151"},children:"No ontology packages found"}),e.jsx("div",{className:"text-xs",children:"Start the dev server to load ontology packages"})]})}):e.jsxs("div",{className:"flex-1",style:{background:"#F7F7F5"},children:[e.jsxs("div",{className:"flex items-start justify-between px-6 pt-5 pb-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold",style:{color:"#1a1a1a"},children:"Ontology Library"}),e.jsxs("p",{className:"text-xs mt-1",style:{color:"#9CA3AF"},children:[i.length," package",i.length!==1?"s":""," available. Click to zoom, double-click to open, right-click for source."]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{"data-testid":"toggle-tracing",onClick:()=>d("extends"),title:b?"Show extends tracing edges":"Hide extends tracing edges",className:"px-3 py-1.5 text-xs rounded-lg font-medium",style:b?{background:"#F0F0ED",color:"#6B7280",border:"1px solid #E5E5E0"}:{background:"#1B3A4B",color:"#2DD4A8",border:"1px solid transparent"},children:b?"Show Tracing":"Hide Tracing"}),e.jsx("button",{onClick:()=>c(!0),className:"px-3 py-1.5 text-xs rounded-lg font-medium",style:{background:"#1B3A4B",color:"#2DD4A8"},children:"+ Add Ontology"})]})]}),n&&e.jsx($,{onClose:()=>c(!1)}),e.jsx("div",{style:{flex:1,height:"calc(100% - 72px)"},children:e.jsxs(O,{nodes:N,edges:B,nodeTypes:_,fitView:!0,fitViewOptions:{padding:.1},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnDoubleClick:!1,minZoom:.2,maxZoom:2.5,proOptions:{hideAttribution:!0},children:[e.jsx(R,{color:"#E5E5E0",gap:24,size:1}),e.jsx(T,{showInteractive:!1})]})}),t&&e.jsx(Z,{menuRef:f,state:t,onClose:()=>x(null),packages:i})]})}const Z=({state:i,onClose:s,packages:l,menuRef:d})=>{const n=l.find(r=>r.name===i.packageName);function c(){if(!n)return;const r=n.rootDir?`${n.rootDir}/memo.package.yaml`:"";r?z(r):window.open(`vscode://file/${encodeURIComponent(n.name)}`),s()}return e.jsxs("div",{ref:d,style:{position:"fixed",top:i.y,left:i.x,zIndex:1e3,background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"8px",boxShadow:"0 6px 16px rgba(0,0,0,0.12)",padding:"4px",minWidth:"180px",fontSize:"12px"},children:[e.jsx("div",{style:{padding:"6px 10px",color:"#9CA3AF",fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.4px"},children:i.packageName}),e.jsx("button",{onClick:c,disabled:!(n!=null&&n.rootDir),style:{display:"block",width:"100%",textAlign:"left",padding:"6px 10px",border:"none",background:"transparent",cursor:n!=null&&n.rootDir?"pointer":"not-allowed",color:n!=null&&n.rootDir?"#1a1a1a":"#9CA3AF",borderRadius:"4px"},onMouseEnter:r=>{n!=null&&n.rootDir&&(r.currentTarget.style.background="#F0F0ED")},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Open source"})]})};function ne(){return e.jsx(D,{children:e.jsx(U,{})})}export{ne as OntologyDecompositionDiagram,ne as default};
1
+ import{j as e,H as C,P as k,R as D,u as S,i as O,f as R,g as T}from"./reactflow-WKyu73tD.js";import{a as p}from"./zustand-qbFpP9Up.js";/* empty css */import{r as I}from"./layout-providers-BAUgp0nu.js";import{d as L,u as h,t as P,v as M,w as z}from"./index-CgRwea72.js";import"./elk-B75IRfCd.js";import"web-worker";const A={ontology:{bg:"#EFF6FF",fg:"#2563EB",border:"#BFDBFE"},profile:{bg:"#F0FDF4",fg:"#16A34A",border:"#BBF7D0"},extension:{bg:"#FFF7ED",fg:"#EA580C",border:"#FED7AA"}};function H({data:i}){const s=i,l=A[s.type]??A.ontology;return e.jsxs("div",{"data-testid":`ontology-package-node-${s.name}`,onClick:s.onClick,onDoubleClick:s.onDoubleClick,onContextMenu:s.onContextMenu,style:{background:"#FFFFFF",border:s.selected?"2px solid #2563EB":"1px solid #E5E5E0",borderRadius:"12px",padding:"16px",minWidth:"240px",maxWidth:"300px",cursor:"pointer",boxShadow:"0 1px 3px rgba(0,0,0,0.06)",transition:"box-shadow 200ms ease, transform 200ms ease"},children:[e.jsx(C,{type:"target",position:k.Top,id:"top",style:w}),e.jsx(C,{type:"source",position:k.Bottom,id:"bottom",style:w}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"8px"},children:[e.jsx("span",{style:{padding:"1px 8px",fontSize:"10px",borderRadius:"9999px",fontWeight:600,background:l.bg,color:l.fg,border:`1px solid ${l.border}`},children:s.type}),e.jsxs("span",{style:{fontSize:"10px",color:"#9CA3AF"},children:["v",s.version]})]}),e.jsx("div",{style:{fontSize:"13px",fontWeight:600,color:"#1a1a1a",marginBottom:"4px"},children:s.name}),s.description&&e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginBottom:"10px",lineHeight:"1.4"},children:s.description.length>80?s.description.slice(0,80)+"…":s.description}),e.jsx("div",{style:{display:"flex",gap:"2px",marginBottom:"8px",height:"6px",borderRadius:"3px",overflow:"hidden"},children:s.layers.slice(0,12).map(d=>{const n=L[d.id]??d.color??"#6B7280";return e.jsx("div",{style:{flex:Math.max(d.kindCount,1),background:n,borderRadius:"1px"},title:`${d.label}: ${d.kindCount} kinds`},d.id)})}),e.jsxs("div",{style:{display:"flex",gap:"12px",fontSize:"11px",color:"#6B7280"},children:[e.jsxs("span",{children:[e.jsx("strong",{style:{color:"#1B3A4B"},children:s.kindCount})," kinds"]}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:"#1B3A4B"},children:s.layerCount})," layers"]})]})]})}const w={width:"8px",height:"8px",background:"#2563EB",border:"2px solid #FFFFFF",opacity:0},W=p.memo(H);function $({onClose:i}){const s=h(o=>o.availableOntologies),l=h(o=>o.ontologyInstallStatus),d=h(o=>o.setOntologyInstallStatus),[n,c]=p.useState(""),[r,g]=p.useState(null);function t(){n.trim()&&(d({installing:!0}),P(n.trim()),c(""))}function x(o){M(o),g(null)}return e.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-50",style:{background:"rgba(0,0,0,0.4)"},onClick:i,children:e.jsxs("div",{className:"rounded-xl shadow-2xl overflow-hidden",style:{background:"#FFFFFF",width:"520px",maxHeight:"600px",border:"1px solid #E5E5E0"},onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsx("h2",{className:"text-sm font-semibold",style:{color:"#1a1a1a"},children:"Manage Ontology Library"}),e.jsx("button",{onClick:i,className:"text-sm px-2 py-0.5 rounded hover:bg-gray-100",style:{color:"#9CA3AF"},children:"x"})]}),e.jsxs("div",{className:"p-5 space-y-5 overflow-y-auto",style:{maxHeight:"480px"},children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium block mb-1.5",style:{color:"#374151"},children:"Add Ontology"}),e.jsx("p",{className:"text-xs mb-2",style:{color:"#9CA3AF"},children:"Enter a git URL (https://...git), npm package name (@memo/...), or local path."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",placeholder:"https://gitlab.com/org/my-ontology.git",value:n,onChange:o=>c(o.target.value),onKeyDown:o=>o.key==="Enter"&&t(),className:"flex-1 px-3 py-2 text-xs rounded-lg",style:{border:"1px solid #E5E7EB",background:"#F9FAFB",color:"#374151",outline:"none"},onFocus:o=>o.currentTarget.style.borderColor="#2563EB",onBlur:o=>o.currentTarget.style.borderColor="#E5E7EB",disabled:l.installing}),e.jsx("button",{onClick:t,disabled:!n.trim()||l.installing,className:"px-4 py-2 text-xs rounded-lg font-medium",style:{background:l.installing?"#9CA3AF":"#1B3A4B",color:"#FFFFFF",opacity:!n.trim()||l.installing?.5:1,cursor:!n.trim()||l.installing?"not-allowed":"pointer"},children:l.installing?"Installing...":"Install"})]}),l.error&&e.jsx("div",{className:"mt-2 px-3 py-2 rounded-lg text-xs",style:{background:"#FEF2F2",color:"#DC2626",border:"1px solid #FECACA"},children:l.error}),l.lastInstalled&&!l.error&&e.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-xs",style:{background:"#F0FDF4",color:"#16A34A",border:"1px solid #BBF7D0"},children:["Installed ",l.lastInstalled]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-xs font-medium block mb-2",style:{color:"#374151"},children:["Installed Packages (",s.length,")"]}),e.jsxs("div",{className:"space-y-1.5",children:[s.map(o=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{border:"1px solid #E5E5E0",background:"#FAFAF8"},children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium truncate",style:{color:"#1a1a1a"},children:o.name}),e.jsx("span",{className:"px-1.5 py-0.5 text-xs rounded",style:{background:o.type==="ontology"?"#EFF6FF":o.type==="profile"?"#F0FDF4":"#FFF7ED",color:o.type==="ontology"?"#2563EB":o.type==="profile"?"#16A34A":"#EA580C",fontSize:"10px"},children:o.type})]}),e.jsxs("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:["v",o.version," · ",o.kindCount," kinds · ",o.layers.length," layers"]})]}),r===o.name?e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>x(o.name),className:"px-2 py-1 text-xs rounded",style:{background:"#DC2626",color:"#FFFFFF"},children:"Confirm"}),e.jsx("button",{onClick:()=>g(null),className:"px-2 py-1 text-xs rounded",style:{background:"#F3F4F6",color:"#374151"},children:"Cancel"})]}):e.jsx("button",{onClick:()=>g(o.name),className:"text-xs px-2 py-1 rounded hover:bg-red-50",style:{color:"#DC2626",border:"1px solid #FECACA"},children:"Remove"})]},o.name)),s.length===0&&e.jsx("div",{className:"text-center py-6 text-xs",style:{color:"#9CA3AF"},children:"No ontology packages installed"})]})]})]})]})})}const _={ontologyPackage:W},Y=260,V=180;async function K(i){const s=new Map(i.map(t=>[t.name,t])),l={id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":"RIGHT","elk.layered.nodePlacement.strategy":"BRANDES_KOEPF","elk.layered.spacing.nodeNodeBetweenLayers":"100","elk.spacing.nodeNode":"32","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.padding":"[top=24, left=24, bottom=24, right=24]"},children:i.map(t=>({id:t.name,width:Y,height:V})),edges:i.filter(t=>t.extends&&s.has(t.extends)).map((t,x)=>({id:`e-${x}`,sources:[t.extends],targets:[t.name]}))},d=await I(l),n=new Map;for(const t of d.children??[])n.set(t.id,{x:t.x??0,y:t.y??0});const c={ontology:"#3B82F6",profile:"#10B981",extension:"#F59E0B"},r=i.map(t=>({id:t.name,type:"ontologyPackage",position:n.get(t.name)??{x:0,y:0},data:{name:t.name,type:t.type,version:t.version,description:t.description,kindCount:t.kindCount,layerCount:t.layers.length,layers:t.layers.map(x=>({id:x.id,label:x.label,color:x.color,kindCount:x.kindCount})),selected:t.selected,onClick:()=>{}}})),g=[];for(const t of i)if(t.extends&&s.has(t.extends)){const x=c[t.type]??"#94A3B8";g.push({id:`${t.extends}->${t.name}`,source:t.extends,target:t.name,type:"smoothstep",data:{edgeType:"extends"},style:{stroke:x,strokeWidth:2,strokeDasharray:"6 3"},animated:!1,label:"extends",labelStyle:{fontSize:9,fill:x,fontWeight:500},labelBgStyle:{fill:"#F7F7F5",fillOpacity:.9},labelBgPadding:[4,2],markerEnd:{type:"arrowclosed",color:x,width:14,height:14}})}return{nodes:r,edges:g}}function G(i,s){const l=new Map;for(const c of s)c.extends&&(l.has(c.extends)||l.set(c.extends,[]),l.get(c.extends).push(c.name));const d=new Set([i]),n=[i];for(;n.length;){const c=n.shift();for(const r of l.get(c)??[])d.has(r)||(d.add(r),n.push(r))}return d}function U(){const i=h(a=>a.availableOntologies),s=h(a=>a.setActiveView),l=h(a=>a.hiddenEdgeTypes),d=h(a=>a.toggleHiddenEdgeType),[n,c]=p.useState(!1),[r,g]=p.useState({nodes:[],edges:[]}),[t,x]=p.useState(null),{fitView:o}=S();p.useEffect(()=>{let a=!1;return K(i).then(u=>{a||g(u)}).catch(u=>{console.error("[OntologyDiagram] ELK layout failed:",u)}),()=>{a=!0}},[i]);const F=p.useCallback(a=>{s({type:"ontology-detail",packageName:a})},[s]),E=p.useCallback(a=>{const u=G(a,i),m=r.nodes.filter(y=>u.has(y.id));m.length!==0&&o({nodes:m.map(y=>({id:y.id})),duration:400,padding:.2})},[i,r.nodes,o]),v=p.useCallback((a,u)=>{a.preventDefault(),x({x:a.clientX,y:a.clientY,packageName:u})},[]);p.useEffect(()=>{const a=u=>{if(u.key==="Escape"){if(t){x(null);return}o({padding:.1,duration:300})}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t,o]);const{nodes:N,edges:B}=p.useMemo(()=>{const a=r.nodes.map(m=>({...m,data:{...m.data,onClick:()=>E(m.id),onDoubleClick:()=>F(m.id),onContextMenu:y=>v(y,m.id)}})),u=r.edges.filter(m=>{var j;const y=(j=m.data)==null?void 0:j.edgeType;return!y||!l.has(y)});return{nodes:a,edges:u}},[r,E,F,v,l]),f=p.useRef(null);p.useEffect(()=>{if(!t)return;const a=u=>{f.current&&!f.current.contains(u.target)&&x(null)};return window.addEventListener("mousedown",a),()=>window.removeEventListener("mousedown",a)},[t]);const b=l.has("extends");return i.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:e.jsxs("div",{className:"text-center",style:{color:"#9CA3AF"},children:[e.jsx("div",{className:"text-3xl mb-3",children:"◉"}),e.jsx("div",{className:"text-sm font-medium mb-1",style:{color:"#374151"},children:"No ontology packages found"}),e.jsx("div",{className:"text-xs",children:"Start the dev server to load ontology packages"})]})}):e.jsxs("div",{className:"flex-1",style:{background:"#F7F7F5"},children:[e.jsxs("div",{className:"flex items-start justify-between px-6 pt-5 pb-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold",style:{color:"#1a1a1a"},children:"Ontology Library"}),e.jsxs("p",{className:"text-xs mt-1",style:{color:"#9CA3AF"},children:[i.length," package",i.length!==1?"s":""," available. Click to zoom, double-click to open, right-click for source."]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{"data-testid":"toggle-tracing",onClick:()=>d("extends"),title:b?"Show extends tracing edges":"Hide extends tracing edges",className:"px-3 py-1.5 text-xs rounded-lg font-medium",style:b?{background:"#F0F0ED",color:"#6B7280",border:"1px solid #E5E5E0"}:{background:"#1B3A4B",color:"#2DD4A8",border:"1px solid transparent"},children:b?"Show Tracing":"Hide Tracing"}),e.jsx("button",{onClick:()=>c(!0),className:"px-3 py-1.5 text-xs rounded-lg font-medium",style:{background:"#1B3A4B",color:"#2DD4A8"},children:"+ Add Ontology"})]})]}),n&&e.jsx($,{onClose:()=>c(!1)}),e.jsx("div",{style:{flex:1,height:"calc(100% - 72px)"},children:e.jsxs(O,{nodes:N,edges:B,nodeTypes:_,fitView:!0,fitViewOptions:{padding:.1},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnDoubleClick:!1,minZoom:.2,maxZoom:2.5,proOptions:{hideAttribution:!0},children:[e.jsx(R,{color:"#E5E5E0",gap:24,size:1}),e.jsx(T,{showInteractive:!1})]})}),t&&e.jsx(Z,{menuRef:f,state:t,onClose:()=>x(null),packages:i})]})}const Z=({state:i,onClose:s,packages:l,menuRef:d})=>{const n=l.find(r=>r.name===i.packageName);function c(){if(!n)return;const r=n.rootDir?`${n.rootDir}/memo.package.yaml`:"";r?z(r):window.open(`vscode://file/${encodeURIComponent(n.name)}`),s()}return e.jsxs("div",{ref:d,style:{position:"fixed",top:i.y,left:i.x,zIndex:1e3,background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"8px",boxShadow:"0 6px 16px rgba(0,0,0,0.12)",padding:"4px",minWidth:"180px",fontSize:"12px"},children:[e.jsx("div",{style:{padding:"6px 10px",color:"#9CA3AF",fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.4px"},children:i.packageName}),e.jsx("button",{onClick:c,disabled:!(n!=null&&n.rootDir),style:{display:"block",width:"100%",textAlign:"left",padding:"6px 10px",border:"none",background:"transparent",cursor:n!=null&&n.rootDir?"pointer":"not-allowed",color:n!=null&&n.rootDir?"#1a1a1a":"#9CA3AF",borderRadius:"4px"},onMouseEnter:r=>{n!=null&&n.rootDir&&(r.currentTarget.style.background="#F0F0ED")},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Open source"})]})};function ne(){return e.jsx(D,{children:e.jsx(U,{})})}export{ne as OntologyDecompositionDiagram,ne as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LayerGrid-DdEtHyAu.js","assets/reactflow-WKyu73tD.js","assets/zustand-qbFpP9Up.js","assets/index-c27kHB43.js","assets/index-BZhRuk7M.css","assets/LayerTable-dOCvwCEb.js","assets/RelationshipsSection-D1-tuVYo.js","assets/sysml-edge-styles-ByJeCWqa.js","assets/RelationshipOverlay-BDrBRSPP.js","assets/OntologyDecompositionDiagram-BW07CXuV.js","assets/layout-providers-BAUgp0nu.js","assets/elk-B75IRfCd.js","assets/style-BZV40eAE.css"])))=>i.map(i=>d[i]);
2
- import{d as _,u as y,_ as O,L as X}from"./index-c27kHB43.js";import{j as e}from"./reactflow-WKyu73tD.js";import{a}from"./zustand-qbFpP9Up.js";function G({ontology:s}){const i=s.layers.reduce((r,f)=>r+f.kinds.reduce((d,l)=>d+l.instanceCount,0),0);return e.jsxs("div",{className:"rounded-xl p-5 mb-5",style:{background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 1px 3px rgba(0,0,0,0.04)"},children:[e.jsx("div",{className:"flex items-start justify-between gap-3 mb-3",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs rounded-full font-medium",style:{background:"#EFF6FF",color:"#2563EB",border:"1px solid #BFDBFE"},children:s.type}),s.extends&&e.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:["extends ",s.extends]})]}),e.jsx("h2",{className:"text-base font-semibold truncate",style:{color:"#1a1a1a"},children:s.name}),e.jsxs("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:["v",s.version]})]})}),s.description&&e.jsx("p",{className:"text-sm mb-4",style:{color:"#6B7280",lineHeight:"1.5"},children:s.description}),e.jsxs("div",{className:"flex gap-5 text-xs",style:{color:"#6B7280"},children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:s.kindCount})," ","kinds"]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:s.layers.length})," ","layers"]}),i>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:i})," ","model instances"]})]})]})}function J({kind:s,layers:i,onKindClick:r,onClose:f,allOntologies:d,onNavigate:l}){const o=_[s.layer]??"#6B7280",c=i.flatMap(t=>t.kinds),m=s.derivesFrom?c.find(t=>t.name===s.derivesFrom):null;function p(t){if(i.some(x=>x.kinds.some(h=>h.name===t)))return null;for(const x of d??[])if(x.layers.some(h=>h.kinds.some(N=>N.name===t)))return x.name;return null}function v(t){const x=p(t);x&&l?l(x,t):r(t)}return e.jsxs("div",{className:"flex flex-col border-l overflow-y-auto",style:{width:320,minWidth:320,background:"#FFFFFF",borderColor:"#E5E5E0"},children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",style:{borderColor:"#E5E5E0"},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"w-3 h-3 rounded flex-shrink-0",style:{backgroundColor:o}}),e.jsx("h3",{className:"text-sm font-semibold truncate",style:{color:"#1a1a1a"},children:s.label})]}),e.jsx("button",{onClick:f,className:"text-sm px-1.5 rounded hover:bg-gray-100",style:{color:"#9CA3AF"},children:"✕"})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs rounded font-mono",style:{background:"#F3F4F6",color:"#4B5563",border:"1px solid #E5E7EB"},children:s.construct}),e.jsx("span",{className:"px-2 py-0.5 text-xs rounded font-medium",style:{background:`${o}15`,color:o,border:`1px solid ${o}30`},children:s.layer})]}),s.description&&e.jsx(S,{title:"Description",children:e.jsx("p",{className:"text-xs leading-relaxed",style:{color:"#6B7280"},children:s.description})}),s.derivesFrom&&e.jsx(S,{title:"Derives From",children:e.jsx(I,{name:s.derivesFrom,layer:m==null?void 0:m.layer,crossOntology:p(s.derivesFrom)!==null,onClick:()=>v(s.derivesFrom)})}),s.derivedBy&&s.derivedBy.length>0&&e.jsx(S,{title:`Derived By (${s.derivedBy.length})`,children:e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.derivedBy.map(t=>{const x=c.find(h=>h.name===t);return e.jsx(I,{name:t,layer:x==null?void 0:x.layer,crossOntology:p(t)!==null,onClick:()=>v(t)},t)})})}),s.relationships&&s.relationships.length>0&&e.jsx(S,{title:`Relationships (${s.relationships.length})`,children:e.jsx("div",{className:"space-y-1",children:s.relationships.map((t,x)=>e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",style:{color:"#6B7280"},children:[e.jsx("span",{style:{color:t.direction==="outgoing"?"#10B981":"#8B5CF6"},children:t.direction==="outgoing"?"→":"←"}),e.jsx("span",{className:"font-medium",style:{color:"#374151"},children:t.type}),e.jsx("button",{className:"hover:underline",style:{color:"#2563EB"},onClick:()=>v(t.targetKind),children:t.targetKind})]},x))})}),e.jsxs(S,{title:"Usage",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(V,{label:"Instances",value:s.instanceCount}),e.jsx(V,{label:"Viewpoints",value:s.viewpoints.length})]}),s.viewpoints.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:s.viewpoints.map(t=>e.jsx("span",{className:"px-1.5 py-0.5 text-xs rounded",style:{background:"#F3F4F6",color:"#6B7280"},children:t},t))})]})]})]})}function S({title:s,children:i}){return e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-medium mb-1.5",style:{color:"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.05em"},children:s}),i]})}function I({name:s,layer:i,crossOntology:r,onClick:f}){const d=i?_[i]??"#6B7280":"#6B7280";return e.jsxs("button",{onClick:f,className:"inline-flex items-center gap-1.5 px-2 py-1 text-xs rounded-md hover:bg-gray-50",style:{border:"1px solid #E5E7EB",color:"#374151"},title:r?"Navigate to this kind in another ontology package":void 0,children:[e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:d}}),s.replace(/([A-Z])/g," $1").trim(),r&&e.jsx("span",{style:{color:"#9CA3AF",fontSize:"9px"},children:"↗"})]})}function V({label:s,value:i}){return e.jsxs("div",{className:"rounded-lg p-2",style:{background:"#F9FAFB",border:"1px solid #F3F4F6"},children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:"#1B3A4B"},children:i}),e.jsx("div",{className:"text-xs",style:{color:"#9CA3AF"},children:s})]})}const P={"part def":{label:"Part Definition",shorthand:"pd",description:"Defines a structural classifier (composite part)"},"connection def":{label:"Connection Definition",shorthand:"cd",description:"Defines a connector type between parts"},"attribute def":{label:"Attribute Definition",shorthand:"ad",description:"Defines a typed value property"},"item def":{label:"Item Definition",shorthand:"id",description:"Defines a flow item type"},"action def":{label:"Action Definition",shorthand:"acd",description:"Defines a behavioral action"},"state def":{label:"State Definition",shorthand:"sd",description:"Defines a state machine type"},"requirement def":{label:"Requirement Definition",shorthand:"rd",description:"Defines a requirement type"},"use case def":{label:"Use Case Definition",shorthand:"ucd",description:"Defines a use case type"},"occurrence def":{label:"Occurrence Definition",shorthand:"od",description:"Defines an occurrence (event or snapshot)"},"interface def":{label:"Interface Definition",shorthand:"ifd",description:"Defines a port interface type"},"port def":{label:"Port Definition",shorthand:"ptd",description:"Defines a port type for system interfaces"},"metadata def":{label:"Metadata Definition",shorthand:"md",description:"Defines a metadata annotation type"}},Q={purpose:"#cce5ff",business:"#cce5ff",operational:"#cce5ff",requirements:"#dae8fc",functional:"#d5e8d4",behavior:"#d5e8d4",logical:"#d5e8d4",physical:"#ffe6cc",software:"#d5e8d4",interfaces:"#d5e8d4",ui:"#d5e8d4",risk:"#f8cecc",safety:"#f8cecc",cybersecurity:"#f8cecc",verification:"#e1d5e7",analysis:"#e1d5e7","design-control":"#fff2cc",qms:"#fff2cc","software-lifecycle":"#fff2cc",operations:"#fff2cc",clinical:"#fff2cc",privacy:"#fff2cc"};function ee({layers:s}){const i=[],r=new Map;for(const l of s)for(const o of l.kinds){const c=o.construct||"part def";r.has(c)||r.set(c,[]),r.get(c).push({kindName:o.name,layer:l.id,layerLabel:l.label,layerColor:Q[l.id]??"#f3f4f6",derivesFrom:o.derivesFrom,description:o.description})}const f=Object.keys(P),d=[...r.keys()].sort((l,o)=>{const c=f.indexOf(l),m=f.indexOf(o);return c===-1&&m===-1?l.localeCompare(o):c===-1?1:m===-1?-1:c-m});for(const l of d){const o=r.get(l).sort((m,p)=>m.kindName.localeCompare(p.kindName)),c=P[l];i.push({construct:l,label:(c==null?void 0:c.label)??l,shorthand:(c==null?void 0:c.shorthand)??l,description:(c==null?void 0:c.description)??"",kinds:o})}return i.length===0?e.jsx("div",{className:"py-8 text-center text-sm",style:{color:"#9CA3AF"},children:"No kinds found in the selected viewpoint."}):e.jsxs("div",{style:{fontFamily:"inherit"},children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold mb-1",style:{color:"#1a1a1a"},children:"SysML v2 Construct Mapping"}),e.jsx("p",{className:"text-xs",style:{color:"#9CA3AF"},children:"Each SysML v2 construct keyword and the MEMO kinds that use it. Shorthand codes appear on kind cards throughout the viewer."})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:i.map(l=>e.jsx(se,{group:l},l.construct))})]})}function se({group:s}){return e.jsxs("div",{style:{border:"1px solid #E5E5E0",borderRadius:"10px",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",background:"#F7F7F5",borderBottom:"1px solid #E5E5E0"},children:[e.jsx("code",{style:{fontSize:"11px",fontFamily:"monospace",background:"#1B3A4B",color:"#2DD4A8",padding:"2px 6px",borderRadius:"4px",letterSpacing:"0.02em"},children:s.construct}),e.jsx("span",{className:"text-sm font-semibold",style:{color:"#1a1a1a"},children:s.label}),e.jsx("span",{style:{fontSize:"10px",color:"#6B7280",fontFamily:"monospace",background:"#EBEBEB",padding:"1px 5px",borderRadius:"3px"},children:s.shorthand}),s.description&&e.jsxs("span",{className:"text-xs ml-1",style:{color:"#9CA3AF"},children:["— ",s.description]}),e.jsxs("span",{className:"ml-auto text-xs",style:{color:"#9CA3AF"},children:[s.kinds.length," kind",s.kinds.length!==1?"s":""]})]}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"10px 12px"},children:s.kinds.map(i=>e.jsx(te,{kind:i},i.kindName))})]})}function te({kind:s}){return e.jsxs("div",{title:s.description??s.kindName,style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"3px 8px",background:s.layerColor,borderRadius:"5px",fontSize:"11px",fontWeight:500,color:"#1a1a1a",border:"1px solid rgba(0,0,0,0.06)",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontWeight:600},children:s.kindName}),e.jsx("span",{style:{fontSize:"9px",color:"#6B7280",background:"rgba(255,255,255,0.55)",padding:"1px 4px",borderRadius:"3px"},children:s.layerLabel}),s.derivesFrom&&e.jsxs("span",{style:{fontSize:"9px",color:"#9CA3AF",fontStyle:"italic"},title:`Specializes ${s.derivesFrom}`,children:[":> ",s.derivesFrom]})]})}const ne=a.lazy(()=>O(()=>import("./LayerGrid-DdEtHyAu.js"),__vite__mapDeps([0,1,2,3,4])).then(s=>({default:s.LayerGrid}))),ie=a.lazy(()=>O(()=>import("./LayerTable-dOCvwCEb.js"),__vite__mapDeps([5,1,2,3,4])).then(s=>({default:s.LayerTable}))),K=a.lazy(()=>O(()=>import("./RelationshipsSection-D1-tuVYo.js"),__vite__mapDeps([6,1,2,7])).then(s=>({default:s.RelationshipsSection}))),le=a.lazy(()=>O(()=>import("./RelationshipOverlay-BDrBRSPP.js"),__vite__mapDeps([8,1,2,7])).then(s=>({default:s.RelationshipOverlay}))),L=[{id:"all",label:"All Layers",layerIds:null,description:"All architecture layers in swimlane view"},{id:"software",label:"Software Views",layerIds:["functional","behavior","logical","software","interfaces","ui"],description:"Software architecture: Logical/Service, Runtime, Module/Code, Deployment"},{id:"hardware",label:"Hardware Views",layerIds:["logical","physical","interfaces"],description:"Hardware architecture: Logical, Physical/Embodiment, Compute/Electronics, Cross-domain"},{id:"risk",label:"Risk Chain",layerIds:["requirements","risk","safety","cybersecurity","verification","analysis"],description:"Risk trace chain: Hazard → HazardousSituation → Harm → RiskControl → verification"},{id:"traceability",label:"Traceability",layerIds:["purpose","business","operational","requirements","risk","safety","functional","software","software-lifecycle","verification","analysis"],description:"Full trace: clinical, risk, software, and hardware chains"},{id:"sysml-mapping",label:"SysML Mapping",layerIds:null,type:"sysml-mapping",description:"SysML v2 construct → MEMO kind reference table"}],ae=.3,oe=2.5,R=.15;function re({children:s}){const[i,r]=a.useState(1),[f,d]=a.useState({x:0,y:0}),l=a.useRef(!1),o=a.useRef({x:0,y:0}),c=a.useRef(null),m=u=>Math.max(ae,Math.min(oe,u)),p=a.useCallback(u=>{u.preventDefault();const F=u.deltaY<0?R:-R;r(C=>m(C+F))},[]),v=a.useCallback(u=>{u.target.closest("button, input, a")||(l.current=!0,o.current={x:u.clientX,y:u.clientY},u.currentTarget.setAttribute("data-panning","true"))},[]),t=a.useCallback(u=>{if(!l.current)return;const F=u.clientX-o.current.x,C=u.clientY-o.current.y;o.current={x:u.clientX,y:u.clientY},d(k=>({x:k.x+F,y:k.y+C}))},[]),x=a.useCallback(u=>{l.current=!1,u.currentTarget.removeAttribute("data-panning")},[]),h=a.useCallback(u=>{l.current=!1,u.currentTarget.removeAttribute("data-panning")},[]);function N(){r(1),d({x:0,y:0})}return e.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[e.jsxs("div",{style:{position:"absolute",top:"10px",right:"10px",zIndex:10,display:"flex",gap:"4px",background:"rgba(255,255,255,0.92)",border:"1px solid #E5E5E0",borderRadius:"8px",padding:"4px",boxShadow:"0 2px 8px rgba(0,0,0,0.08)"},children:[e.jsx(T,{title:"Zoom in",onClick:()=>r(u=>m(u+R)),children:"+"}),e.jsxs("span",{style:{fontSize:"10px",color:"#6B7280",lineHeight:"26px",minWidth:"34px",textAlign:"center"},children:[Math.round(i*100),"%"]}),e.jsx(T,{title:"Zoom out",onClick:()=>r(u=>m(u-R)),children:"−"}),e.jsx("div",{style:{width:"1px",background:"#E5E5E0",margin:"2px 0"}}),e.jsx(T,{title:"Fit to view",onClick:N,children:"⊡"})]}),e.jsx("div",{ref:c,onWheel:p,onMouseDown:v,onMouseMove:t,onMouseUp:x,onMouseLeave:h,style:{width:"100%",height:"100%",overflow:"hidden",cursor:l.current?"grabbing":"grab",userSelect:"none"},children:e.jsx("div",{style:{transform:`translate(${f.x}px, ${f.y}px) scale(${i})`,transformOrigin:"0 0",willChange:"transform",padding:"16px"},children:s})})]})}function T({onClick:s,title:i,children:r}){return e.jsx("button",{onClick:s,title:i,style:{width:"26px",height:"26px",border:"none",borderRadius:"5px",background:"transparent",cursor:"pointer",fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1},onMouseEnter:f=>{f.currentTarget.style.background="#F0F0ED"},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:r})}function ce({ontology:s,onBack:i}){const r=y(n=>n.ontologyViewMode),f=y(n=>n.setOntologyViewMode),d=y(n=>n.selectedOntologyKind),l=y(n=>n.setSelectedOntologyKind),o=y(n=>n.showOntologyRelationships),c=y(n=>n.toggleOntologyRelationships),m=y(n=>n.model),p=y(n=>n.activeView),v=y(n=>n.setActiveView),t=y(n=>n.availableOntologies),x=a.useRef(null),[h,N]=a.useState(new Set),[u,F]=a.useState("all"),[C,k]=a.useState(!1),[H,W]=a.useState(null),[Z,Y]=a.useState(0);a.useEffect(()=>{d&&(k(!0),W(d),Y(n=>n+1))},[d]);const g=a.useMemo(()=>({...s,layers:s.layers.map(n=>({...n,kinds:n.kinds.map(b=>{var M;return{...b,instanceCount:m?Object.values(m.elements).filter(A=>A.kind===b.name).length:0,viewpoints:((M=m==null?void 0:m.viewpoints)==null?void 0:M.filter(A=>A.visibleKinds.includes(b.name)).map(A=>A.id))??[]}})}))}),[s,m]),E=L.find(n=>n.id===u)??L[0],j=a.useMemo(()=>{if(!E.layerIds)return g.layers;const n=new Set(E.layerIds);return g.layers.filter(b=>n.has(b.id))},[g.layers,E.layerIds]),w=a.useMemo(()=>{if(!d)return null;for(const n of g.layers){const b=n.kinds.find(M=>M.name===d);if(b)return{kind:b,layerInfo:n}}return null},[d,g]);function q(n,b){l(b),v({type:"ontology-detail",packageName:n})}function U(n){v({type:"ontology-detail",packageName:s.name,layerId:n})}const B={background:"#1B3A4B",color:"#2DD4A8",border:"1px solid transparent"},D={background:"#F0F0ED",color:"#6B7280",border:"1px solid transparent"};return e.jsxs("div",{className:"flex flex-1 overflow-hidden",style:{background:"#F7F7F5"},children:[e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("div",{className:"px-6 pt-5 pb-3",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-3 text-xs flex-wrap",style:{color:"#9CA3AF"},children:[i&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:i,className:"hover:underline",style:{color:"#2563EB"},children:"Ontology Library"}),e.jsx("span",{children:"/"})]}),e.jsx("button",{onClick:()=>l(null),className:"hover:underline",style:{color:w?"#2563EB":"#374151",fontWeight:w?400:500},children:s.name}),w&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"/"}),e.jsx("button",{onClick:()=>U(w.layerInfo.id),className:"hover:underline",style:{color:"#2563EB"},children:w.layerInfo.label}),e.jsx("span",{children:"/"}),e.jsx("span",{style:{color:"#1a1a1a",fontWeight:600},children:d})]})]}),e.jsx(G,{ontology:g}),e.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[e.jsx("span",{className:"text-xs",style:{color:"#9CA3AF"},children:"Layers:"}),e.jsx("button",{onClick:()=>f("visual"),className:"px-2.5 py-1 text-xs rounded-md font-medium",style:r==="visual"?B:D,children:"Visual"}),e.jsx("button",{onClick:()=>f("table"),className:"px-2.5 py-1 text-xs rounded-md font-medium",style:r==="table"?B:D,children:"Table"}),e.jsx("span",{style:{width:"1px",height:"16px",background:"#E5E5E0",margin:"0 4px"}}),e.jsxs("button",{onClick:c,className:"px-2.5 py-1 text-xs rounded-md font-medium",style:o?B:D,children:[o?"Hide":"Show"," Relationships"]})]}),e.jsxs("div",{className:"flex items-center gap-0 mt-3 -mx-6 px-6",style:{borderTop:"1px solid #E5E5E0",paddingTop:"10px"},children:[e.jsx("span",{className:"text-xs mr-2",style:{color:"#9CA3AF",whiteSpace:"nowrap"},children:"View:"}),e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:L.map(n=>{const b=u===n.id;return e.jsx("button",{onClick:()=>F(n.id),title:n.description,className:"px-2.5 py-1 text-xs rounded-md font-medium transition-all",style:b?B:D,children:n.label},n.id)})}),j.length!==g.layers.length&&E.type!=="sysml-mapping"&&e.jsxs("span",{className:"ml-auto text-xs",style:{color:"#9CA3AF",whiteSpace:"nowrap"},children:[j.length," of ",g.layers.length," layers"]})]})]}),E.type==="sysml-mapping"?e.jsx("div",{className:"px-6 py-4",children:e.jsx(ee,{layers:g.layers})}):r==="visual"?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{height:"280px",position:"relative",borderBottom:"1px solid #E5E5E0"},children:e.jsx(re,{children:e.jsxs("div",{ref:x,style:{position:"relative"},children:[e.jsx(a.Suspense,{fallback:e.jsx(z,{layers:j}),children:e.jsx(ne,{layers:j,selectedKind:d,onKindClick:l,activeLayerId:p.layerId??null,flashKindName:H,flashTick:Z})}),o&&e.jsx(a.Suspense,{fallback:null,children:e.jsx(le,{containerRef:x,ontology:{...g,layers:j},activeTypes:h})})]})})}),o&&e.jsx("div",{className:"px-6 py-4",children:e.jsx(a.Suspense,{fallback:null,children:e.jsx(K,{ontology:{...g,layers:j},activeTypes:h,onActiveTypesChange:N})})})]}):e.jsxs("div",{className:"px-6 py-4",children:[e.jsx(a.Suspense,{fallback:e.jsx(z,{layers:j}),children:e.jsx(ie,{layers:j,selectedKind:d,onKindClick:l})}),o&&e.jsx(a.Suspense,{fallback:null,children:e.jsx(K,{ontology:{...g,layers:j},activeTypes:h,onActiveTypesChange:N})})]})]}),C&&w&&e.jsx(J,{kind:w.kind,layers:g.layers,allOntologies:t,onKindClick:l,onNavigate:q,onClose:()=>{l(null),k(!1)}})]})}function z({layers:s}){return e.jsx("div",{className:"grid gap-3 mb-6",style:{gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))"},children:s.map(i=>{const r=_[i.id]??i.color??"#6B7280";return e.jsxs("div",{className:"rounded-xl p-4",style:{background:"#FFFFFF",border:`2px solid ${r}30`},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:r}}),e.jsx("span",{className:"text-sm font-medium",style:{color:"#1a1a1a"},children:i.label})]}),e.jsxs("div",{className:"text-xs",style:{color:"#9CA3AF"},children:[i.kindCount," kinds"]})]},i.id)})})}const de=a.lazy(()=>O(()=>import("./OntologyDecompositionDiagram-BW07CXuV.js"),__vite__mapDeps([9,1,2,10,11,3,4,12]))),$=Object.fromEntries(X.map((s,i)=>[s,i]));function me(){const s=y(p=>p.activeView),i=y(p=>p.availableOntologies),r=y(p=>p.setActiveView),f=y(p=>p.model),d=s.type==="ontology-detail",l=d?s.packageName:null,o=l?i.find(p=>p.name===l):null,c=a.useMemo(()=>{if(o||!d||!f)return null;const p=new Map;for(const t of Object.values(f.elements))p.has(t.layer)||p.set(t.layer,[]),p.get(t.layer).includes(t.kind)||p.get(t.layer).push(t.kind);const v=[...p.entries()].sort(([t],[x])=>($[t]??99)-($[x]??99)).map(([t,x])=>({id:t,label:t.charAt(0).toUpperCase()+t.slice(1),color:"#6B7280",kindCount:x.length,kinds:x.map(h=>({name:h,label:h.replace(/([A-Z])/g," $1").trim(),construct:"part def",layer:t,instanceCount:0,viewpoints:[]}))}));return{name:"@memo/model (inferred)",version:"–",type:"ontology",description:"Ontology inferred from loaded model elements.",layers:v,kindCount:v.reduce((t,x)=>t+x.kindCount,0),relationshipCount:0,relationshipTypes:[],selected:!0}},[o,d,f]),m=o??c;return d&&m?e.jsx(ce,{ontology:m,onBack:()=>r({type:"ontology"})}):e.jsx(a.Suspense,{fallback:e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:e.jsx("span",{className:"text-sm",style:{color:"#9CA3AF"},children:"Loading ontology library..."})}),children:e.jsx(de,{})})}export{me as OntologyViewer,me as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LayerGrid-fSGvqSEj.js","assets/reactflow-WKyu73tD.js","assets/zustand-qbFpP9Up.js","assets/index-CgRwea72.js","assets/index-CnFhl4_e.css","assets/LayerTable-D8QCFY1b.js","assets/RelationshipsSection-D1-tuVYo.js","assets/sysml-edge-styles-ByJeCWqa.js","assets/RelationshipOverlay-BDrBRSPP.js","assets/OntologyDecompositionDiagram-cpmTTMRH.js","assets/layout-providers-BAUgp0nu.js","assets/elk-B75IRfCd.js","assets/style-BZV40eAE.css"])))=>i.map(i=>d[i]);
2
+ import{d as _,u as y,_ as O,L as X}from"./index-CgRwea72.js";import{j as e}from"./reactflow-WKyu73tD.js";import{a}from"./zustand-qbFpP9Up.js";function G({ontology:s}){const i=s.layers.reduce((r,f)=>r+f.kinds.reduce((d,l)=>d+l.instanceCount,0),0);return e.jsxs("div",{className:"rounded-xl p-5 mb-5",style:{background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 1px 3px rgba(0,0,0,0.04)"},children:[e.jsx("div",{className:"flex items-start justify-between gap-3 mb-3",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs rounded-full font-medium",style:{background:"#EFF6FF",color:"#2563EB",border:"1px solid #BFDBFE"},children:s.type}),s.extends&&e.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:["extends ",s.extends]})]}),e.jsx("h2",{className:"text-base font-semibold truncate",style:{color:"#1a1a1a"},children:s.name}),e.jsxs("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:["v",s.version]})]})}),s.description&&e.jsx("p",{className:"text-sm mb-4",style:{color:"#6B7280",lineHeight:"1.5"},children:s.description}),e.jsxs("div",{className:"flex gap-5 text-xs",style:{color:"#6B7280"},children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:s.kindCount})," ","kinds"]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:s.layers.length})," ","layers"]}),i>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:i})," ","model instances"]})]})]})}function J({kind:s,layers:i,onKindClick:r,onClose:f,allOntologies:d,onNavigate:l}){const o=_[s.layer]??"#6B7280",c=i.flatMap(t=>t.kinds),m=s.derivesFrom?c.find(t=>t.name===s.derivesFrom):null;function p(t){if(i.some(x=>x.kinds.some(h=>h.name===t)))return null;for(const x of d??[])if(x.layers.some(h=>h.kinds.some(N=>N.name===t)))return x.name;return null}function v(t){const x=p(t);x&&l?l(x,t):r(t)}return e.jsxs("div",{className:"flex flex-col border-l overflow-y-auto",style:{width:320,minWidth:320,background:"#FFFFFF",borderColor:"#E5E5E0"},children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",style:{borderColor:"#E5E5E0"},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"w-3 h-3 rounded flex-shrink-0",style:{backgroundColor:o}}),e.jsx("h3",{className:"text-sm font-semibold truncate",style:{color:"#1a1a1a"},children:s.label})]}),e.jsx("button",{onClick:f,className:"text-sm px-1.5 rounded hover:bg-gray-100",style:{color:"#9CA3AF"},children:"✕"})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs rounded font-mono",style:{background:"#F3F4F6",color:"#4B5563",border:"1px solid #E5E7EB"},children:s.construct}),e.jsx("span",{className:"px-2 py-0.5 text-xs rounded font-medium",style:{background:`${o}15`,color:o,border:`1px solid ${o}30`},children:s.layer})]}),s.description&&e.jsx(S,{title:"Description",children:e.jsx("p",{className:"text-xs leading-relaxed",style:{color:"#6B7280"},children:s.description})}),s.derivesFrom&&e.jsx(S,{title:"Derives From",children:e.jsx(I,{name:s.derivesFrom,layer:m==null?void 0:m.layer,crossOntology:p(s.derivesFrom)!==null,onClick:()=>v(s.derivesFrom)})}),s.derivedBy&&s.derivedBy.length>0&&e.jsx(S,{title:`Derived By (${s.derivedBy.length})`,children:e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.derivedBy.map(t=>{const x=c.find(h=>h.name===t);return e.jsx(I,{name:t,layer:x==null?void 0:x.layer,crossOntology:p(t)!==null,onClick:()=>v(t)},t)})})}),s.relationships&&s.relationships.length>0&&e.jsx(S,{title:`Relationships (${s.relationships.length})`,children:e.jsx("div",{className:"space-y-1",children:s.relationships.map((t,x)=>e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",style:{color:"#6B7280"},children:[e.jsx("span",{style:{color:t.direction==="outgoing"?"#10B981":"#8B5CF6"},children:t.direction==="outgoing"?"→":"←"}),e.jsx("span",{className:"font-medium",style:{color:"#374151"},children:t.type}),e.jsx("button",{className:"hover:underline",style:{color:"#2563EB"},onClick:()=>v(t.targetKind),children:t.targetKind})]},x))})}),e.jsxs(S,{title:"Usage",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(V,{label:"Instances",value:s.instanceCount}),e.jsx(V,{label:"Viewpoints",value:s.viewpoints.length})]}),s.viewpoints.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:s.viewpoints.map(t=>e.jsx("span",{className:"px-1.5 py-0.5 text-xs rounded",style:{background:"#F3F4F6",color:"#6B7280"},children:t},t))})]})]})]})}function S({title:s,children:i}){return e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-medium mb-1.5",style:{color:"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.05em"},children:s}),i]})}function I({name:s,layer:i,crossOntology:r,onClick:f}){const d=i?_[i]??"#6B7280":"#6B7280";return e.jsxs("button",{onClick:f,className:"inline-flex items-center gap-1.5 px-2 py-1 text-xs rounded-md hover:bg-gray-50",style:{border:"1px solid #E5E7EB",color:"#374151"},title:r?"Navigate to this kind in another ontology package":void 0,children:[e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:d}}),s.replace(/([A-Z])/g," $1").trim(),r&&e.jsx("span",{style:{color:"#9CA3AF",fontSize:"9px"},children:"↗"})]})}function V({label:s,value:i}){return e.jsxs("div",{className:"rounded-lg p-2",style:{background:"#F9FAFB",border:"1px solid #F3F4F6"},children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:"#1B3A4B"},children:i}),e.jsx("div",{className:"text-xs",style:{color:"#9CA3AF"},children:s})]})}const P={"part def":{label:"Part Definition",shorthand:"pd",description:"Defines a structural classifier (composite part)"},"connection def":{label:"Connection Definition",shorthand:"cd",description:"Defines a connector type between parts"},"attribute def":{label:"Attribute Definition",shorthand:"ad",description:"Defines a typed value property"},"item def":{label:"Item Definition",shorthand:"id",description:"Defines a flow item type"},"action def":{label:"Action Definition",shorthand:"acd",description:"Defines a behavioral action"},"state def":{label:"State Definition",shorthand:"sd",description:"Defines a state machine type"},"requirement def":{label:"Requirement Definition",shorthand:"rd",description:"Defines a requirement type"},"use case def":{label:"Use Case Definition",shorthand:"ucd",description:"Defines a use case type"},"occurrence def":{label:"Occurrence Definition",shorthand:"od",description:"Defines an occurrence (event or snapshot)"},"interface def":{label:"Interface Definition",shorthand:"ifd",description:"Defines a port interface type"},"port def":{label:"Port Definition",shorthand:"ptd",description:"Defines a port type for system interfaces"},"metadata def":{label:"Metadata Definition",shorthand:"md",description:"Defines a metadata annotation type"}},Q={purpose:"#cce5ff",business:"#cce5ff",operational:"#cce5ff",requirements:"#dae8fc",functional:"#d5e8d4",behavior:"#d5e8d4",logical:"#d5e8d4",physical:"#ffe6cc",software:"#d5e8d4",interfaces:"#d5e8d4",ui:"#d5e8d4",risk:"#f8cecc",safety:"#f8cecc",cybersecurity:"#f8cecc",verification:"#e1d5e7",analysis:"#e1d5e7","design-control":"#fff2cc",qms:"#fff2cc","software-lifecycle":"#fff2cc",operations:"#fff2cc",clinical:"#fff2cc",privacy:"#fff2cc"};function ee({layers:s}){const i=[],r=new Map;for(const l of s)for(const o of l.kinds){const c=o.construct||"part def";r.has(c)||r.set(c,[]),r.get(c).push({kindName:o.name,layer:l.id,layerLabel:l.label,layerColor:Q[l.id]??"#f3f4f6",derivesFrom:o.derivesFrom,description:o.description})}const f=Object.keys(P),d=[...r.keys()].sort((l,o)=>{const c=f.indexOf(l),m=f.indexOf(o);return c===-1&&m===-1?l.localeCompare(o):c===-1?1:m===-1?-1:c-m});for(const l of d){const o=r.get(l).sort((m,p)=>m.kindName.localeCompare(p.kindName)),c=P[l];i.push({construct:l,label:(c==null?void 0:c.label)??l,shorthand:(c==null?void 0:c.shorthand)??l,description:(c==null?void 0:c.description)??"",kinds:o})}return i.length===0?e.jsx("div",{className:"py-8 text-center text-sm",style:{color:"#9CA3AF"},children:"No kinds found in the selected viewpoint."}):e.jsxs("div",{style:{fontFamily:"inherit"},children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold mb-1",style:{color:"#1a1a1a"},children:"SysML v2 Construct Mapping"}),e.jsx("p",{className:"text-xs",style:{color:"#9CA3AF"},children:"Each SysML v2 construct keyword and the MEMO kinds that use it. Shorthand codes appear on kind cards throughout the viewer."})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:i.map(l=>e.jsx(se,{group:l},l.construct))})]})}function se({group:s}){return e.jsxs("div",{style:{border:"1px solid #E5E5E0",borderRadius:"10px",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",background:"#F7F7F5",borderBottom:"1px solid #E5E5E0"},children:[e.jsx("code",{style:{fontSize:"11px",fontFamily:"monospace",background:"#1B3A4B",color:"#2DD4A8",padding:"2px 6px",borderRadius:"4px",letterSpacing:"0.02em"},children:s.construct}),e.jsx("span",{className:"text-sm font-semibold",style:{color:"#1a1a1a"},children:s.label}),e.jsx("span",{style:{fontSize:"10px",color:"#6B7280",fontFamily:"monospace",background:"#EBEBEB",padding:"1px 5px",borderRadius:"3px"},children:s.shorthand}),s.description&&e.jsxs("span",{className:"text-xs ml-1",style:{color:"#9CA3AF"},children:["— ",s.description]}),e.jsxs("span",{className:"ml-auto text-xs",style:{color:"#9CA3AF"},children:[s.kinds.length," kind",s.kinds.length!==1?"s":""]})]}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"10px 12px"},children:s.kinds.map(i=>e.jsx(te,{kind:i},i.kindName))})]})}function te({kind:s}){return e.jsxs("div",{title:s.description??s.kindName,style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"3px 8px",background:s.layerColor,borderRadius:"5px",fontSize:"11px",fontWeight:500,color:"#1a1a1a",border:"1px solid rgba(0,0,0,0.06)",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontWeight:600},children:s.kindName}),e.jsx("span",{style:{fontSize:"9px",color:"#6B7280",background:"rgba(255,255,255,0.55)",padding:"1px 4px",borderRadius:"3px"},children:s.layerLabel}),s.derivesFrom&&e.jsxs("span",{style:{fontSize:"9px",color:"#9CA3AF",fontStyle:"italic"},title:`Specializes ${s.derivesFrom}`,children:[":> ",s.derivesFrom]})]})}const ne=a.lazy(()=>O(()=>import("./LayerGrid-fSGvqSEj.js"),__vite__mapDeps([0,1,2,3,4])).then(s=>({default:s.LayerGrid}))),ie=a.lazy(()=>O(()=>import("./LayerTable-D8QCFY1b.js"),__vite__mapDeps([5,1,2,3,4])).then(s=>({default:s.LayerTable}))),K=a.lazy(()=>O(()=>import("./RelationshipsSection-D1-tuVYo.js"),__vite__mapDeps([6,1,2,7])).then(s=>({default:s.RelationshipsSection}))),le=a.lazy(()=>O(()=>import("./RelationshipOverlay-BDrBRSPP.js"),__vite__mapDeps([8,1,2,7])).then(s=>({default:s.RelationshipOverlay}))),L=[{id:"all",label:"All Layers",layerIds:null,description:"All architecture layers in swimlane view"},{id:"software",label:"Software Views",layerIds:["functional","behavior","logical","software","interfaces","ui"],description:"Software architecture: Logical/Service, Runtime, Module/Code, Deployment"},{id:"hardware",label:"Hardware Views",layerIds:["logical","physical","interfaces"],description:"Hardware architecture: Logical, Physical/Embodiment, Compute/Electronics, Cross-domain"},{id:"risk",label:"Risk Chain",layerIds:["requirements","risk","safety","cybersecurity","verification","analysis"],description:"Risk trace chain: Hazard → HazardousSituation → Harm → RiskControl → verification"},{id:"traceability",label:"Traceability",layerIds:["purpose","business","operational","requirements","risk","safety","functional","software","software-lifecycle","verification","analysis"],description:"Full trace: clinical, risk, software, and hardware chains"},{id:"sysml-mapping",label:"SysML Mapping",layerIds:null,type:"sysml-mapping",description:"SysML v2 construct → MEMO kind reference table"}],ae=.3,oe=2.5,R=.15;function re({children:s}){const[i,r]=a.useState(1),[f,d]=a.useState({x:0,y:0}),l=a.useRef(!1),o=a.useRef({x:0,y:0}),c=a.useRef(null),m=u=>Math.max(ae,Math.min(oe,u)),p=a.useCallback(u=>{u.preventDefault();const F=u.deltaY<0?R:-R;r(C=>m(C+F))},[]),v=a.useCallback(u=>{u.target.closest("button, input, a")||(l.current=!0,o.current={x:u.clientX,y:u.clientY},u.currentTarget.setAttribute("data-panning","true"))},[]),t=a.useCallback(u=>{if(!l.current)return;const F=u.clientX-o.current.x,C=u.clientY-o.current.y;o.current={x:u.clientX,y:u.clientY},d(k=>({x:k.x+F,y:k.y+C}))},[]),x=a.useCallback(u=>{l.current=!1,u.currentTarget.removeAttribute("data-panning")},[]),h=a.useCallback(u=>{l.current=!1,u.currentTarget.removeAttribute("data-panning")},[]);function N(){r(1),d({x:0,y:0})}return e.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[e.jsxs("div",{style:{position:"absolute",top:"10px",right:"10px",zIndex:10,display:"flex",gap:"4px",background:"rgba(255,255,255,0.92)",border:"1px solid #E5E5E0",borderRadius:"8px",padding:"4px",boxShadow:"0 2px 8px rgba(0,0,0,0.08)"},children:[e.jsx(T,{title:"Zoom in",onClick:()=>r(u=>m(u+R)),children:"+"}),e.jsxs("span",{style:{fontSize:"10px",color:"#6B7280",lineHeight:"26px",minWidth:"34px",textAlign:"center"},children:[Math.round(i*100),"%"]}),e.jsx(T,{title:"Zoom out",onClick:()=>r(u=>m(u-R)),children:"−"}),e.jsx("div",{style:{width:"1px",background:"#E5E5E0",margin:"2px 0"}}),e.jsx(T,{title:"Fit to view",onClick:N,children:"⊡"})]}),e.jsx("div",{ref:c,onWheel:p,onMouseDown:v,onMouseMove:t,onMouseUp:x,onMouseLeave:h,style:{width:"100%",height:"100%",overflow:"hidden",cursor:l.current?"grabbing":"grab",userSelect:"none"},children:e.jsx("div",{style:{transform:`translate(${f.x}px, ${f.y}px) scale(${i})`,transformOrigin:"0 0",willChange:"transform",padding:"16px"},children:s})})]})}function T({onClick:s,title:i,children:r}){return e.jsx("button",{onClick:s,title:i,style:{width:"26px",height:"26px",border:"none",borderRadius:"5px",background:"transparent",cursor:"pointer",fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1},onMouseEnter:f=>{f.currentTarget.style.background="#F0F0ED"},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:r})}function ce({ontology:s,onBack:i}){const r=y(n=>n.ontologyViewMode),f=y(n=>n.setOntologyViewMode),d=y(n=>n.selectedOntologyKind),l=y(n=>n.setSelectedOntologyKind),o=y(n=>n.showOntologyRelationships),c=y(n=>n.toggleOntologyRelationships),m=y(n=>n.model),p=y(n=>n.activeView),v=y(n=>n.setActiveView),t=y(n=>n.availableOntologies),x=a.useRef(null),[h,N]=a.useState(new Set),[u,F]=a.useState("all"),[C,k]=a.useState(!1),[H,W]=a.useState(null),[Z,Y]=a.useState(0);a.useEffect(()=>{d&&(k(!0),W(d),Y(n=>n+1))},[d]);const g=a.useMemo(()=>({...s,layers:s.layers.map(n=>({...n,kinds:n.kinds.map(b=>{var M;return{...b,instanceCount:m?Object.values(m.elements).filter(A=>A.kind===b.name).length:0,viewpoints:((M=m==null?void 0:m.viewpoints)==null?void 0:M.filter(A=>A.visibleKinds.includes(b.name)).map(A=>A.id))??[]}})}))}),[s,m]),E=L.find(n=>n.id===u)??L[0],j=a.useMemo(()=>{if(!E.layerIds)return g.layers;const n=new Set(E.layerIds);return g.layers.filter(b=>n.has(b.id))},[g.layers,E.layerIds]),w=a.useMemo(()=>{if(!d)return null;for(const n of g.layers){const b=n.kinds.find(M=>M.name===d);if(b)return{kind:b,layerInfo:n}}return null},[d,g]);function q(n,b){l(b),v({type:"ontology-detail",packageName:n})}function U(n){v({type:"ontology-detail",packageName:s.name,layerId:n})}const B={background:"#1B3A4B",color:"#2DD4A8",border:"1px solid transparent"},D={background:"#F0F0ED",color:"#6B7280",border:"1px solid transparent"};return e.jsxs("div",{className:"flex flex-1 overflow-hidden",style:{background:"#F7F7F5"},children:[e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("div",{className:"px-6 pt-5 pb-3",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-3 text-xs flex-wrap",style:{color:"#9CA3AF"},children:[i&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:i,className:"hover:underline",style:{color:"#2563EB"},children:"Ontology Library"}),e.jsx("span",{children:"/"})]}),e.jsx("button",{onClick:()=>l(null),className:"hover:underline",style:{color:w?"#2563EB":"#374151",fontWeight:w?400:500},children:s.name}),w&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"/"}),e.jsx("button",{onClick:()=>U(w.layerInfo.id),className:"hover:underline",style:{color:"#2563EB"},children:w.layerInfo.label}),e.jsx("span",{children:"/"}),e.jsx("span",{style:{color:"#1a1a1a",fontWeight:600},children:d})]})]}),e.jsx(G,{ontology:g}),e.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[e.jsx("span",{className:"text-xs",style:{color:"#9CA3AF"},children:"Layers:"}),e.jsx("button",{onClick:()=>f("visual"),className:"px-2.5 py-1 text-xs rounded-md font-medium",style:r==="visual"?B:D,children:"Visual"}),e.jsx("button",{onClick:()=>f("table"),className:"px-2.5 py-1 text-xs rounded-md font-medium",style:r==="table"?B:D,children:"Table"}),e.jsx("span",{style:{width:"1px",height:"16px",background:"#E5E5E0",margin:"0 4px"}}),e.jsxs("button",{onClick:c,className:"px-2.5 py-1 text-xs rounded-md font-medium",style:o?B:D,children:[o?"Hide":"Show"," Relationships"]})]}),e.jsxs("div",{className:"flex items-center gap-0 mt-3 -mx-6 px-6",style:{borderTop:"1px solid #E5E5E0",paddingTop:"10px"},children:[e.jsx("span",{className:"text-xs mr-2",style:{color:"#9CA3AF",whiteSpace:"nowrap"},children:"View:"}),e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:L.map(n=>{const b=u===n.id;return e.jsx("button",{onClick:()=>F(n.id),title:n.description,className:"px-2.5 py-1 text-xs rounded-md font-medium transition-all",style:b?B:D,children:n.label},n.id)})}),j.length!==g.layers.length&&E.type!=="sysml-mapping"&&e.jsxs("span",{className:"ml-auto text-xs",style:{color:"#9CA3AF",whiteSpace:"nowrap"},children:[j.length," of ",g.layers.length," layers"]})]})]}),E.type==="sysml-mapping"?e.jsx("div",{className:"px-6 py-4",children:e.jsx(ee,{layers:g.layers})}):r==="visual"?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{height:"280px",position:"relative",borderBottom:"1px solid #E5E5E0"},children:e.jsx(re,{children:e.jsxs("div",{ref:x,style:{position:"relative"},children:[e.jsx(a.Suspense,{fallback:e.jsx(z,{layers:j}),children:e.jsx(ne,{layers:j,selectedKind:d,onKindClick:l,activeLayerId:p.layerId??null,flashKindName:H,flashTick:Z})}),o&&e.jsx(a.Suspense,{fallback:null,children:e.jsx(le,{containerRef:x,ontology:{...g,layers:j},activeTypes:h})})]})})}),o&&e.jsx("div",{className:"px-6 py-4",children:e.jsx(a.Suspense,{fallback:null,children:e.jsx(K,{ontology:{...g,layers:j},activeTypes:h,onActiveTypesChange:N})})})]}):e.jsxs("div",{className:"px-6 py-4",children:[e.jsx(a.Suspense,{fallback:e.jsx(z,{layers:j}),children:e.jsx(ie,{layers:j,selectedKind:d,onKindClick:l})}),o&&e.jsx(a.Suspense,{fallback:null,children:e.jsx(K,{ontology:{...g,layers:j},activeTypes:h,onActiveTypesChange:N})})]})]}),C&&w&&e.jsx(J,{kind:w.kind,layers:g.layers,allOntologies:t,onKindClick:l,onNavigate:q,onClose:()=>{l(null),k(!1)}})]})}function z({layers:s}){return e.jsx("div",{className:"grid gap-3 mb-6",style:{gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))"},children:s.map(i=>{const r=_[i.id]??i.color??"#6B7280";return e.jsxs("div",{className:"rounded-xl p-4",style:{background:"#FFFFFF",border:`2px solid ${r}30`},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:r}}),e.jsx("span",{className:"text-sm font-medium",style:{color:"#1a1a1a"},children:i.label})]}),e.jsxs("div",{className:"text-xs",style:{color:"#9CA3AF"},children:[i.kindCount," kinds"]})]},i.id)})})}const de=a.lazy(()=>O(()=>import("./OntologyDecompositionDiagram-cpmTTMRH.js"),__vite__mapDeps([9,1,2,10,11,3,4,12]))),$=Object.fromEntries(X.map((s,i)=>[s,i]));function me(){const s=y(p=>p.activeView),i=y(p=>p.availableOntologies),r=y(p=>p.setActiveView),f=y(p=>p.model),d=s.type==="ontology-detail",l=d?s.packageName:null,o=l?i.find(p=>p.name===l):null,c=a.useMemo(()=>{if(o||!d||!f)return null;const p=new Map;for(const t of Object.values(f.elements))p.has(t.layer)||p.set(t.layer,[]),p.get(t.layer).includes(t.kind)||p.get(t.layer).push(t.kind);const v=[...p.entries()].sort(([t],[x])=>($[t]??99)-($[x]??99)).map(([t,x])=>({id:t,label:t.charAt(0).toUpperCase()+t.slice(1),color:"#6B7280",kindCount:x.length,kinds:x.map(h=>({name:h,label:h.replace(/([A-Z])/g," $1").trim(),construct:"part def",layer:t,instanceCount:0,viewpoints:[]}))}));return{name:"@memo/model (inferred)",version:"–",type:"ontology",description:"Ontology inferred from loaded model elements.",layers:v,kindCount:v.reduce((t,x)=>t+x.kindCount,0),relationshipCount:0,relationshipTypes:[],selected:!0}},[o,d,f]),m=o??c;return d&&m?e.jsx(ce,{ontology:m,onBack:()=>r({type:"ontology"})}):e.jsx(a.Suspense,{fallback:e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:e.jsx("span",{className:"text-sm",style:{color:"#9CA3AF"},children:"Loading ontology library..."})}),children:e.jsx(de,{})})}export{me as OntologyViewer,me as default};
@@ -1 +1 @@
1
- import{j as e}from"./reactflow-WKyu73tD.js";import{a as j}from"./zustand-qbFpP9Up.js";import{u as g,d as F}from"./index-c27kHB43.js";function z({model:n}){const i=g(t=>t.setActiveView),s=g(t=>t.setExplorerTab),l=j.useMemo(()=>Object.values(n.elements).filter(t=>["system","subsystem","logicalcomponent","softwarecomponent","physicalcomponent"].includes(t.kind.toLowerCase())).slice(0,8),[n]),a=j.useMemo(()=>{const t={};for(const o of Object.values(n.elements))t[o.layer]=(t[o.layer]||0)+1;return t},[n]),x=Object.entries(a).sort((t,o)=>o[1]-t[1]).slice(0,5),p=Object.keys(n.elements).length;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🏗️",title:"System Architecture",badge:`${p} elements`,onExpand:()=>{s("model")}}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Layer distribution"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:x.map(([t,o])=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:F[t]||"#95A5A6",flexShrink:0}}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",flex:1,textTransform:"capitalize"},children:t}),e.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:"#6B7280"},children:o}),e.jsx("div",{style:{width:"60px",height:"4px",background:"#F3F4F6",borderRadius:"2px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"2px",background:F[t]||"#95A5A6",width:`${Math.round(o/p*100)}%`}})})]},t))})]}),e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Key components"}),l.length>0?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:l.map(t=>e.jsxs("button",{onClick:()=>i({type:"element-detail",elementId:t.id}),style:{textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"3px 0",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",fontFamily:"monospace"},children:t.kind}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",fontWeight:500},children:t.name})]},t.id))}):e.jsx(C,{text:"No System or Subsystem elements yet"})]})]}),n.diagrams&&n.diagrams.length>0&&e.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px",flexWrap:"wrap"},children:[n.diagrams.slice(0,4).map(t=>e.jsxs("button",{onClick:()=>i({type:"diagram",diagramId:t.id}),style:q,onMouseEnter:o=>o.currentTarget.style.background="#E5E5E0",onMouseLeave:o=>o.currentTarget.style.background="#F3F4F6",children:["⊟ ",t.name]},t.id)),n.diagrams.length>4&&e.jsxs("span",{style:{fontSize:"11px",color:"#9CA3AF",alignSelf:"center"},children:["+",n.diagrams.length-4," more"]})]})]})}function R({model:n}){const i=g(t=>t.setActiveView),{reqs:s,withTestLink:l,withArchLink:a}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(d=>["systemrequirement","requirement","userneed"].includes(d.kind.toLowerCase())),f=new Set;for(const d of n.relationships)f.add(d.sourceId),f.add(d.targetId);const u=new Set(["test","verification","validationtest"]),y=new Set(["system","subsystem","logicalcomponent","softwarecomponent"]),c=new Set(t.filter(d=>u.has(d.kind.toLowerCase())).map(d=>d.id)),b=new Set(t.filter(d=>y.has(d.kind.toLowerCase())).map(d=>d.id));let r=0,S=0;for(const d of o){const A=n.relationships.filter(h=>h.sourceId===d.id||h.targetId===d.id).flatMap(h=>[h.sourceId,h.targetId]);A.some(h=>c.has(h))&&r++,A.some(h=>b.has(h))&&S++}return{reqs:o,withTestLink:r,withArchLink:S}},[n]),x=s.length>0?Math.round(l/s.length*100):0,p=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"📋",title:"Requirements",badge:`${s.length} total`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No requirements found. Add Requirement elements to your model."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Verified by tests",percent:x,count:l,total:s.length,color:"#2DD4A8"}),e.jsx(v,{label:"Linked to architecture",percent:p,count:a,total:s.length,color:"#4A90D9"})]})]})}function I({model:n}){const i=g(t=>t.setActiveView),{hazards:s,riskControls:l,mitigatesCount:a,residualRiskCount:x}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(r=>r.kind.toLowerCase()==="hazard"),f=t.filter(r=>r.kind.toLowerCase()==="riskcontrol"),u=n.relationships.filter(r=>r.type.toLowerCase()==="mitigates"),y=u.length,c=new Set(u.map(r=>r.targetId)),b=o.filter(r=>!c.has(r.id)).length;return{hazards:o,riskControls:f,mitigatesCount:y,residualRiskCount:b}},[n]),p=s.length>0?Math.round((s.length-x)/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"⚠️",title:"Risk Chain (ISO 14971)",badge:`${s.length} hazards`,onExpand:()=>i({type:"traceability"}),badgeColor:x>0?"#E74C3C":"#2ECC71"}),s.length===0?e.jsx(C,{text:"No hazards found. Add Hazard elements to start your ISO 14971 risk analysis."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Hazards mitigated",percent:p,count:s.length-x,total:s.length,color:"#2ECC71",warningThreshold:80}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Risk controls",value:l.length}),e.jsx(m,{label:"Mitigates links",value:a}),x>0&&e.jsx(m,{label:"Unmitigated hazards",value:x,alert:!0})]})]})]})}function L({model:n}){const i=g(p=>p.setActiveView),{tests:s,passing:l,withReqLink:a}=j.useMemo(()=>{const p=Object.values(n.elements),t=p.filter(c=>c.kind.toLowerCase()==="test"),o=p.filter(c=>["systemrequirement","requirement"].includes(c.kind.toLowerCase())),f=new Set(o.map(c=>c.id));let u=0;for(const c of t)n.relationships.filter(r=>r.sourceId===c.id||r.targetId===c.id).flatMap(r=>[r.sourceId,r.targetId]).some(r=>f.has(r))&&u++;const y=t.filter(c=>(c.attributes.status||"").toLowerCase()==="pass").length;return{tests:t,passing:y,withReqLink:u}},[n]),x=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🧪",title:"Verification",badge:`${s.length} tests`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No tests found. Add Test elements and link them to requirements."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Tests linked to requirements",percent:x,count:a,total:s.length,color:"#2DD4A8"}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Tests",value:s.length}),l>0&&e.jsx(m,{label:"Passing",value:l}),s.length-l>0&&e.jsx(m,{label:"Unverified",value:s.length-l,alert:s.length-l>0&&l>0})]})]})]})}function k({icon:n,title:i,badge:s,onExpand:l,badgeColor:a}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"16px"},children:n}),e.jsx("span",{style:{fontSize:"14px",fontWeight:700,color:"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600,padding:"2px 8px",borderRadius:"999px",background:a?a+"20":"#F3F4F6",color:a||"#6B7280"},children:s})]}),e.jsx("button",{onClick:l,style:{fontSize:"11px",color:"#4A90D9",background:"none",border:"none",cursor:"pointer",fontWeight:600},children:"Expand →"})]})}function v({label:n,percent:i,count:s,total:l,color:a,warningThreshold:x=100}){const p=i>=x?a:i>=50?"#F39C12":"#E74C3C";return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[e.jsx("span",{style:{fontSize:"12px",color:"#374151"},children:n}),e.jsxs("span",{style:{fontSize:"12px",fontWeight:600,color:i>=80?"#2ECC71":"#374151"},children:[s,"/",l," (",i,"%)"]})]}),e.jsx("div",{style:{height:"6px",background:"#F3F4F6",borderRadius:"3px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"3px",background:p,width:`${i}%`,transition:"width 0.4s ease"}})})]})}function m({label:n,value:i,alert:s}){return e.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"baseline"},children:[e.jsx("span",{style:{fontSize:"16px",fontWeight:700,color:s?"#E74C3C":"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:n})]})}function C({text:n}){return e.jsx("div",{style:{fontSize:"12px",color:"#9CA3AF",fontStyle:"italic",padding:"8px 0"},children:n})}const w={background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"20px"},E={fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:"#9CA3AF",marginBottom:"8px"},q={fontSize:"11px",color:"#374151",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"4px 10px",cursor:"pointer",transition:"background 0.1s",fontWeight:500};function D(){const n=g(s=>s.model),i=g(s=>s.setActiveView);return n?e.jsx("div",{style:{flex:1,overflowY:"auto",background:"#F7F7F5",padding:"28px 40px"},children:e.jsxs("div",{style:{maxWidth:"960px",margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px"},children:[e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:"20px",fontWeight:800,color:"#1B3A4B",margin:"0 0 4px 0"},children:"Design Review Dashboard"}),e.jsx("p",{style:{fontSize:"12px",color:"#6B7280",margin:0},children:"Architecture · Requirements · Risk · Verification — in one view"})]}),e.jsx("button",{onClick:()=>i({type:"dashboard"}),style:{fontSize:"12px",color:"#6B7280",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"6px 12px",cursor:"pointer",fontWeight:500},children:"← Back to Dashboard"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[e.jsx(z,{model:n}),e.jsx(R,{model:n}),e.jsx(I,{model:n}),e.jsx(L,{model:n})]})]})}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:e.jsx("div",{style:{fontSize:"13px",color:"#9CA3AF"},children:"No model data"})})}export{D as ReviewDashboard};
1
+ import{j as e}from"./reactflow-WKyu73tD.js";import{a as j}from"./zustand-qbFpP9Up.js";import{u as g,d as F}from"./index-CgRwea72.js";function z({model:n}){const i=g(t=>t.setActiveView),s=g(t=>t.setExplorerTab),l=j.useMemo(()=>Object.values(n.elements).filter(t=>["system","subsystem","logicalcomponent","softwarecomponent","physicalcomponent"].includes(t.kind.toLowerCase())).slice(0,8),[n]),a=j.useMemo(()=>{const t={};for(const o of Object.values(n.elements))t[o.layer]=(t[o.layer]||0)+1;return t},[n]),x=Object.entries(a).sort((t,o)=>o[1]-t[1]).slice(0,5),p=Object.keys(n.elements).length;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🏗️",title:"System Architecture",badge:`${p} elements`,onExpand:()=>{s("model")}}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Layer distribution"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:x.map(([t,o])=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:F[t]||"#95A5A6",flexShrink:0}}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",flex:1,textTransform:"capitalize"},children:t}),e.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:"#6B7280"},children:o}),e.jsx("div",{style:{width:"60px",height:"4px",background:"#F3F4F6",borderRadius:"2px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"2px",background:F[t]||"#95A5A6",width:`${Math.round(o/p*100)}%`}})})]},t))})]}),e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Key components"}),l.length>0?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:l.map(t=>e.jsxs("button",{onClick:()=>i({type:"element-detail",elementId:t.id}),style:{textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"3px 0",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",fontFamily:"monospace"},children:t.kind}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",fontWeight:500},children:t.name})]},t.id))}):e.jsx(C,{text:"No System or Subsystem elements yet"})]})]}),n.diagrams&&n.diagrams.length>0&&e.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px",flexWrap:"wrap"},children:[n.diagrams.slice(0,4).map(t=>e.jsxs("button",{onClick:()=>i({type:"diagram",diagramId:t.id}),style:q,onMouseEnter:o=>o.currentTarget.style.background="#E5E5E0",onMouseLeave:o=>o.currentTarget.style.background="#F3F4F6",children:["⊟ ",t.name]},t.id)),n.diagrams.length>4&&e.jsxs("span",{style:{fontSize:"11px",color:"#9CA3AF",alignSelf:"center"},children:["+",n.diagrams.length-4," more"]})]})]})}function R({model:n}){const i=g(t=>t.setActiveView),{reqs:s,withTestLink:l,withArchLink:a}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(d=>["systemrequirement","requirement","userneed"].includes(d.kind.toLowerCase())),f=new Set;for(const d of n.relationships)f.add(d.sourceId),f.add(d.targetId);const u=new Set(["test","verification","validationtest"]),y=new Set(["system","subsystem","logicalcomponent","softwarecomponent"]),c=new Set(t.filter(d=>u.has(d.kind.toLowerCase())).map(d=>d.id)),b=new Set(t.filter(d=>y.has(d.kind.toLowerCase())).map(d=>d.id));let r=0,S=0;for(const d of o){const A=n.relationships.filter(h=>h.sourceId===d.id||h.targetId===d.id).flatMap(h=>[h.sourceId,h.targetId]);A.some(h=>c.has(h))&&r++,A.some(h=>b.has(h))&&S++}return{reqs:o,withTestLink:r,withArchLink:S}},[n]),x=s.length>0?Math.round(l/s.length*100):0,p=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"📋",title:"Requirements",badge:`${s.length} total`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No requirements found. Add Requirement elements to your model."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Verified by tests",percent:x,count:l,total:s.length,color:"#2DD4A8"}),e.jsx(v,{label:"Linked to architecture",percent:p,count:a,total:s.length,color:"#4A90D9"})]})]})}function I({model:n}){const i=g(t=>t.setActiveView),{hazards:s,riskControls:l,mitigatesCount:a,residualRiskCount:x}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(r=>r.kind.toLowerCase()==="hazard"),f=t.filter(r=>r.kind.toLowerCase()==="riskcontrol"),u=n.relationships.filter(r=>r.type.toLowerCase()==="mitigates"),y=u.length,c=new Set(u.map(r=>r.targetId)),b=o.filter(r=>!c.has(r.id)).length;return{hazards:o,riskControls:f,mitigatesCount:y,residualRiskCount:b}},[n]),p=s.length>0?Math.round((s.length-x)/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"⚠️",title:"Risk Chain (ISO 14971)",badge:`${s.length} hazards`,onExpand:()=>i({type:"traceability"}),badgeColor:x>0?"#E74C3C":"#2ECC71"}),s.length===0?e.jsx(C,{text:"No hazards found. Add Hazard elements to start your ISO 14971 risk analysis."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Hazards mitigated",percent:p,count:s.length-x,total:s.length,color:"#2ECC71",warningThreshold:80}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Risk controls",value:l.length}),e.jsx(m,{label:"Mitigates links",value:a}),x>0&&e.jsx(m,{label:"Unmitigated hazards",value:x,alert:!0})]})]})]})}function L({model:n}){const i=g(p=>p.setActiveView),{tests:s,passing:l,withReqLink:a}=j.useMemo(()=>{const p=Object.values(n.elements),t=p.filter(c=>c.kind.toLowerCase()==="test"),o=p.filter(c=>["systemrequirement","requirement"].includes(c.kind.toLowerCase())),f=new Set(o.map(c=>c.id));let u=0;for(const c of t)n.relationships.filter(r=>r.sourceId===c.id||r.targetId===c.id).flatMap(r=>[r.sourceId,r.targetId]).some(r=>f.has(r))&&u++;const y=t.filter(c=>(c.attributes.status||"").toLowerCase()==="pass").length;return{tests:t,passing:y,withReqLink:u}},[n]),x=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🧪",title:"Verification",badge:`${s.length} tests`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No tests found. Add Test elements and link them to requirements."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Tests linked to requirements",percent:x,count:a,total:s.length,color:"#2DD4A8"}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Tests",value:s.length}),l>0&&e.jsx(m,{label:"Passing",value:l}),s.length-l>0&&e.jsx(m,{label:"Unverified",value:s.length-l,alert:s.length-l>0&&l>0})]})]})]})}function k({icon:n,title:i,badge:s,onExpand:l,badgeColor:a}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"16px"},children:n}),e.jsx("span",{style:{fontSize:"14px",fontWeight:700,color:"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600,padding:"2px 8px",borderRadius:"999px",background:a?a+"20":"#F3F4F6",color:a||"#6B7280"},children:s})]}),e.jsx("button",{onClick:l,style:{fontSize:"11px",color:"#4A90D9",background:"none",border:"none",cursor:"pointer",fontWeight:600},children:"Expand →"})]})}function v({label:n,percent:i,count:s,total:l,color:a,warningThreshold:x=100}){const p=i>=x?a:i>=50?"#F39C12":"#E74C3C";return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[e.jsx("span",{style:{fontSize:"12px",color:"#374151"},children:n}),e.jsxs("span",{style:{fontSize:"12px",fontWeight:600,color:i>=80?"#2ECC71":"#374151"},children:[s,"/",l," (",i,"%)"]})]}),e.jsx("div",{style:{height:"6px",background:"#F3F4F6",borderRadius:"3px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"3px",background:p,width:`${i}%`,transition:"width 0.4s ease"}})})]})}function m({label:n,value:i,alert:s}){return e.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"baseline"},children:[e.jsx("span",{style:{fontSize:"16px",fontWeight:700,color:s?"#E74C3C":"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:n})]})}function C({text:n}){return e.jsx("div",{style:{fontSize:"12px",color:"#9CA3AF",fontStyle:"italic",padding:"8px 0"},children:n})}const w={background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"20px"},E={fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:"#9CA3AF",marginBottom:"8px"},q={fontSize:"11px",color:"#374151",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"4px 10px",cursor:"pointer",transition:"background 0.1s",fontWeight:500};function D(){const n=g(s=>s.model),i=g(s=>s.setActiveView);return n?e.jsx("div",{style:{flex:1,overflowY:"auto",background:"#F7F7F5",padding:"28px 40px"},children:e.jsxs("div",{style:{maxWidth:"960px",margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px"},children:[e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:"20px",fontWeight:800,color:"#1B3A4B",margin:"0 0 4px 0"},children:"Design Review Dashboard"}),e.jsx("p",{style:{fontSize:"12px",color:"#6B7280",margin:0},children:"Architecture · Requirements · Risk · Verification — in one view"})]}),e.jsx("button",{onClick:()=>i({type:"dashboard"}),style:{fontSize:"12px",color:"#6B7280",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"6px 12px",cursor:"pointer",fontWeight:500},children:"← Back to Dashboard"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[e.jsx(z,{model:n}),e.jsx(R,{model:n}),e.jsx(I,{model:n}),e.jsx(L,{model:n})]})]})}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:e.jsx("div",{style:{fontSize:"13px",color:"#9CA3AF"},children:"No model data"})})}export{D as ReviewDashboard};
@@ -1,3 +1,3 @@
1
- import{j as s}from"./reactflow-WKyu73tD.js";import{a}from"./zustand-qbFpP9Up.js";import{u as j,e as U,f as $,d as F,h as z}from"./index-c27kHB43.js";function w(d){return d?d.split(`
1
+ import{j as s}from"./reactflow-WKyu73tD.js";import{a}from"./zustand-qbFpP9Up.js";import{u as j,e as U,f as $,d as F,h as z}from"./index-CgRwea72.js";function w(d){return d?d.split(`
2
2
  `).filter(o=>o.trim()).map((o,p)=>{const h=o.match(/^\d+\.\s*(.*)/);return{index:p,text:h?h[1]:o}}):[]}function _(d){return d.map((m,o)=>`${o+1}. ${m.text}`).join(`
3
3
  `)}function q(){const d=j(e=>e.model),m=j(e=>e.selectElement),o=j(e=>e.selectedElementId),[p,h]=a.useState(""),[r,u]=a.useState(null),[y,k]=a.useState(""),[b,v]=a.useState(null),[g,N]=a.useState(""),f=a.useMemo(()=>d?Object.values(d.elements).filter(e=>e.kind==="Scenario"||e.kind==="UseCase"||e.kind==="UserActivity"):[],[d]),E=a.useMemo(()=>{if(!p)return f;const e=p.toLowerCase();return f.filter(t=>t.name.toLowerCase().includes(e)||t.kind.toLowerCase().includes(e))},[f,p]),C=a.useMemo(()=>{const e=new Map;for(const t of E)e.has(t.kind)||e.set(t.kind,[]),e.get(t.kind).push(t);return[...e.entries()].sort((t,n)=>t[0].localeCompare(n[0]))},[E]),c=o&&d?d.elements[o]:null,A=a.useMemo(()=>U(d,o||""),[d,o]),i=a.useMemo(()=>r||(c?w(c.doc||""):[]),[c,r]),M=a.useCallback(()=>{c&&u(w(c.doc||""))},[c]),B=a.useCallback(()=>{if(!c||!r)return;const e=_(r);$({...c,doc:e}),u(null)},[c,r]),S=a.useCallback(()=>{if(!y.trim())return;const e=[...r||i,{index:i.length,text:y.trim()}];u(e),k("")},[y,r,i]),L=a.useCallback(e=>{const t=(r||i).filter((n,l)=>l!==e);u(t)},[r,i]),D=a.useCallback((e,t)=>{const n=[...r||i],l=e+t;l<0||l>=n.length||([n[e],n[l]]=[n[l],n[e]],u(n))},[r,i]),T=a.useCallback((e,t)=>{const n=[...r||i];n[e]={...n[e],text:t},u(n)},[r,i]),R=a.useMemo(()=>{if(!d||!g)return[];const e=g.toLowerCase();return Object.values(d.elements).filter(t=>t.id!==o&&t.name.toLowerCase().includes(e)).slice(0,10)},[d,g,o]),[I,O]=a.useState(new Set),G=e=>{O(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsxs("div",{className:"w-72 flex flex-col overflow-hidden",style:{background:"#FFFFFF",borderRight:"1px solid #E5E5E0"},children:[s.jsx("div",{className:"px-3 py-2",style:{borderBottom:"1px solid #E5E5E0"},children:s.jsx("input",{type:"text",placeholder:`Search ${f.length} scenarios...`,value:p,onChange:e=>h(e.target.value),className:"w-full px-3 py-2 text-sm rounded-lg focus:outline-none",style:{background:"#F7F7F5",border:"1px solid #E5E5E0",color:"#1a1a1a"}})}),s.jsxs("div",{className:"flex-1 overflow-y-auto text-xs py-1",children:[C.map(([e,t])=>{const n=I.has(e);return s.jsxs("div",{className:"mb-0.5",children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 cursor-pointer",style:{borderRadius:"6px",margin:"0 4px"},onMouseEnter:l=>l.currentTarget.style.background="#F0F0ED",onMouseLeave:l=>l.currentTarget.style.background="transparent",onClick:()=>G(e),children:[s.jsx("span",{className:"w-2.5 h-2.5 rounded flex-shrink-0",style:{backgroundColor:F.functional,borderRadius:"3px"}}),s.jsx("span",{className:"font-medium flex-1",style:{color:"#374151"},children:e}),s.jsx("span",{style:{color:"#9CA3AF"},children:t.length}),s.jsx("span",{style:{color:"#D1D5DB"},children:n?"▸":"▾"})]}),!n&&t.map(l=>s.jsx("div",{className:"px-3 py-1 ml-6 cursor-pointer flex items-center gap-1.5",style:{borderRadius:"6px",background:o===l.id?"#2DD4A818":"transparent",color:o===l.id?"#1B3A4B":"#374151",fontWeight:o===l.id?500:400},onMouseEnter:x=>{o!==l.id&&(x.currentTarget.style.background="#F0F0ED")},onMouseLeave:x=>{o!==l.id&&(x.currentTarget.style.background="transparent")},onClick:()=>{m(l.id),u(null)},children:s.jsx("span",{className:"truncate",children:l.name})},l.id))]},e)}),C.length===0&&s.jsx("div",{className:"px-4 py-8 text-center",style:{color:"#9CA3AF"},children:"No scenarios found."})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:[!c&&s.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"#9CA3AF"},children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{style:{fontSize:"32px",marginBottom:"8px",opacity:.5},children:"▶"}),s.jsx("div",{className:"text-sm",children:"Select a scenario to edit steps and link elements"})]})}),c&&s.jsxs("div",{className:"max-w-2xl",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx("h2",{className:"text-lg font-semibold",style:{color:"#1a1a1a"},children:c.name}),s.jsx("span",{className:"px-2 py-0.5 text-xs rounded-md font-medium",style:{background:"#E67E2218",color:"#E67E22"},children:c.kind})]}),s.jsxs("div",{className:"mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"#6B7280"},children:"Steps"}),!r&&s.jsx("button",{onClick:M,className:"px-2 py-0.5 text-xs rounded",style:{background:"#2DD4A815",color:"#1B3A4B",border:"1px solid #2DD4A840"},children:"Edit"}),r&&s.jsxs("div",{className:"flex gap-1",children:[s.jsx("button",{onClick:B,className:"px-2 py-0.5 text-xs rounded font-medium",style:{background:"#2DD4A8",color:"#FFFFFF"},children:"Save"}),s.jsx("button",{onClick:()=>u(null),className:"px-2 py-0.5 text-xs rounded",style:{background:"#F3F4F6",color:"#6B7280"},children:"Cancel"})]})]}),s.jsx("div",{className:"space-y-1",children:i.map((e,t)=>s.jsxs("div",{className:"flex items-start gap-2 p-2 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[s.jsx("span",{className:"flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-xs font-medium",style:{background:"#2DD4A815",color:"#1B3A4B"},children:t+1}),r?s.jsx("input",{type:"text",value:e.text,onChange:n=>T(t,n.target.value),className:"flex-1 text-sm px-2 py-1 rounded focus:outline-none",style:{border:"1px solid #E5E5E0",color:"#374151"}}):s.jsx("span",{className:"flex-1 text-sm",style:{color:"#374151"},children:e.text}),r&&s.jsxs("div",{className:"flex gap-0.5",children:[s.jsx("button",{onClick:()=>D(t,-1),className:"px-1 text-xs",style:{color:"#9CA3AF"},title:"Move up",children:"▲"}),s.jsx("button",{onClick:()=>D(t,1),className:"px-1 text-xs",style:{color:"#9CA3AF"},title:"Move down",children:"▼"}),s.jsx("button",{onClick:()=>L(t),className:"px-1 text-xs",style:{color:"#E74C3C"},title:"Remove",children:"✕"})]})]},t))}),r&&s.jsxs("div",{className:"flex gap-2 mt-2",children:[s.jsx("input",{type:"text",value:y,onChange:e=>k(e.target.value),onKeyDown:e=>e.key==="Enter"&&S(),placeholder:"Add a step...",className:"flex-1 text-sm px-3 py-2 rounded-lg focus:outline-none",style:{background:"#FFFFFF",border:"1px solid #E5E5E0",color:"#374151"}}),s.jsx("button",{onClick:S,className:"px-3 py-2 text-xs rounded-lg font-medium",style:{background:"#2DD4A815",color:"#1B3A4B",border:"1px solid #2DD4A840"},children:"+ Add"})]}),i.length===0&&!r&&s.jsx("div",{className:"text-xs p-3 rounded-lg",style:{background:"#F3F4F6",color:"#9CA3AF"},children:"No steps defined. Click Edit to add scenario steps."})]}),s.jsxs("div",{className:"mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"#6B7280"},children:["Linked Elements (",A.length,")"]}),s.jsx("button",{onClick:()=>v(b===null?0:null),className:"px-2 py-0.5 text-xs rounded",style:{background:"#4A90D915",color:"#4A90D9",border:"1px solid #4A90D940"},children:b!==null?"Done":"+ Link"})]}),b!==null&&s.jsxs("div",{className:"mb-2 p-2 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #4A90D940"},children:[s.jsx("input",{type:"text",value:g,onChange:e=>N(e.target.value),placeholder:"Search elements to link...",className:"w-full text-sm px-2 py-1 rounded focus:outline-none mb-1",style:{border:"1px solid #E5E5E0",color:"#374151"}}),R.map(e=>s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 text-xs rounded cursor-pointer",onMouseEnter:t=>t.currentTarget.style.background="#F0F0ED",onMouseLeave:t=>t.currentTarget.style.background="transparent",onClick:()=>{z(c.id,e.id,"traceTo"),N(""),v(null)},children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:F[e.layer]||"#95A5A6"}}),s.jsx("span",{style:{color:"#374151"},children:e.name}),s.jsx("span",{style:{color:"#9CA3AF"},children:e.kind})]},e.id))]}),s.jsx("div",{className:"space-y-1",children:A.map(e=>{const t=e.sourceId===c.id?e.targetId:e.sourceId,n=d.elements[t],l=e.sourceId===c.id?"→":"←";return s.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg cursor-pointer",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},onMouseEnter:x=>x.currentTarget.style.background="#F0F0ED",onMouseLeave:x=>x.currentTarget.style.background="#FFFFFF",onClick:()=>m(t),children:[s.jsx("span",{style:{color:"#9CA3AF"},children:l}),s.jsx("span",{className:"font-medium",style:{color:"#2563EB"},children:e.type}),s.jsx("span",{style:{color:"#374151"},children:(n==null?void 0:n.name)||t}),n&&s.jsx("span",{className:"ml-auto px-1.5 py-0.5 rounded text-xs",style:{background:(F[n.layer]||"#95A5A6")+"18",color:F[n.layer]||"#95A5A6"},children:n.kind})]},e.id)})})]}),s.jsx("div",{className:"text-xs",style:{color:"#D1D5DB"},children:c.file})]})]})]})}export{q as ScenarioEditor};