@memoarchitect/architect 0.6.5 → 0.7.2
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.
- package/README.md +45 -4
- package/dist/assets/AiWorkspace-Bu9TlIWg.js +7 -0
- package/dist/assets/AnalysisWorkspace-CodmoI-v.js +39 -0
- package/dist/assets/{ComplianceWizard-DWolzleI.js → ComplianceWizard-CTihkUi-.js} +1 -1
- package/dist/assets/DSMView-BiC845df.js +1 -0
- package/dist/assets/Dashboard-CgnNLhKq.js +1 -0
- package/dist/assets/{DhfDashboard-D9JxRAbD.js → DhfDashboard-w-dJoJHU.js} +1 -1
- package/dist/assets/{DhfWorkbench-BQv2WQ9o.js → DhfWorkbench-o6B_MT-0.js} +15 -15
- package/dist/assets/DiagramCanvas-CqGqDbgT.js +3 -0
- package/dist/assets/DiagramEditor-UJDHcAUF.js +4 -0
- package/dist/assets/DiagramToolbarControls-B2gZFJlg.js +1 -0
- package/dist/assets/ElementDetailView-10U0rr33.js +2 -0
- package/dist/assets/ExplorerTreeRow-DqhF_qoO.js +3 -0
- package/dist/assets/{ImportView-33dFwj6A.js → ImportView-D8svP04Q.js} +1 -1
- package/dist/assets/{LayerGrid-B3MBWswK.js → LayerGrid-DEe0Ryz-.js} +1 -1
- package/dist/assets/{LayerTable-DyIzIt5M.js → LayerTable-CN_b2rDr.js} +2 -2
- package/dist/assets/{MaxGraphCanvas-BS5wYazZ.js → MaxGraphCanvas-bo8oPBct.js} +6 -6
- package/dist/assets/{ModelDiff-BoFREnpg.js → ModelDiff-xe95oVua.js} +1 -1
- package/dist/assets/{OntologyDecompositionDiagram-IG1gj1c3.js → OntologyDecompositionDiagram-BL9R8bdB.js} +1 -1
- package/dist/assets/{OntologyViewer-CQTEg-GI.js → OntologyViewer-CtqNkkCn.js} +2 -2
- package/dist/assets/{RelationshipOverlay-B9bqt4zl.js → RelationshipOverlay-DL0N8Vmk.js} +1 -1
- package/dist/assets/{RelationshipsSection-DttMvF2i.js → RelationshipsSection-BoJ0aUXe.js} +1 -1
- package/dist/assets/{ReviewDashboard-BJ_smBGS.js → ReviewDashboard-DeTge2oC.js} +1 -1
- package/dist/assets/ScenarioEditor-FAEYTHgP.js +3 -0
- package/dist/assets/{StatisticsDashboard-CBYJGUPH.js → StatisticsDashboard-BAZRqIPN.js} +1 -1
- package/dist/assets/{SysmlCodeEditor-Die2RUsz.js → SysmlCodeEditor-BBfup_Ni.js} +1 -1
- package/dist/assets/TabularView-I4LjHhoH.js +1 -0
- package/dist/assets/TraceabilityMatrix-DbrvjqLN.js +3 -0
- package/dist/assets/UiScreensWorkspace-DDD_PyJs.js +1 -0
- package/dist/assets/{WorkflowWizard-CbkDyd1W.js → WorkflowWizard-VwpEHt3R.js} +1 -1
- package/dist/assets/element-options-B7AgTB8R.js +3 -0
- package/dist/assets/html2canvas.esm-QH1iLAAe.js +22 -0
- package/dist/assets/index-BWMNo4wW.css +1 -0
- package/dist/assets/index-Bij8Q4Kg.js +45 -0
- package/dist/assets/index.es-ClbJxlAQ.js +18 -0
- package/dist/assets/jspdf.es.min-DZ68BGxk.js +170 -0
- package/dist/assets/notation-scene-DT8LpWVK.js +1 -0
- package/dist/assets/purify.es-DP5U8-sc.js +3 -0
- package/dist/assets/{reactflow-CsCqNKB-.js → reactflow-s7jmJtXx.js} +5 -5
- package/dist/index.html +3 -3
- package/lib/__tests__/compiler-bundling.test.d.ts +2 -0
- package/lib/__tests__/compiler-bundling.test.d.ts.map +1 -0
- package/lib/__tests__/compiler-bundling.test.js +32 -0
- package/lib/__tests__/compiler-bundling.test.js.map +1 -0
- package/lib/__tests__/standard-sysml-diagrams-smoke.test.d.ts +2 -0
- package/lib/__tests__/standard-sysml-diagrams-smoke.test.d.ts.map +1 -0
- package/lib/__tests__/standard-sysml-diagrams-smoke.test.js +22 -0
- package/lib/__tests__/standard-sysml-diagrams-smoke.test.js.map +1 -0
- package/lib/__tests__/supervised-child-args.test.d.ts +2 -0
- package/lib/__tests__/supervised-child-args.test.d.ts.map +1 -0
- package/lib/__tests__/supervised-child-args.test.js +35 -0
- package/lib/__tests__/supervised-child-args.test.js.map +1 -0
- package/lib/bin/memo-architect.js +30 -4
- package/lib/bin/memo-architect.js.map +1 -1
- package/lib/commands/dev.d.ts +18 -2
- package/lib/commands/dev.d.ts.map +1 -1
- package/lib/commands/dev.js +56 -8
- package/lib/commands/dev.js.map +1 -1
- package/lib/commands/example.d.ts +1 -0
- package/lib/commands/example.d.ts.map +1 -1
- package/lib/commands/example.js +2 -0
- package/lib/commands/example.js.map +1 -1
- package/lib/feature-grants.d.ts.map +1 -1
- package/lib/feature-grants.js +2 -2
- package/lib/feature-grants.js.map +1 -1
- package/package.json +12 -6
- package/dist/assets/AiWorkspace-DHZ6a9HJ.js +0 -3
- package/dist/assets/DSMView-TdC3EADB.js +0 -1
- package/dist/assets/Dashboard-DBfAOCJv.js +0 -1
- package/dist/assets/DhfSettingsPanel-Firov0IF.js +0 -1
- package/dist/assets/DiagramCanvas-BfwO8YE5.js +0 -1
- package/dist/assets/DiagramEditor-Cp9ORYoN.js +0 -4
- package/dist/assets/ElementDetailView-DOrG8v7V.js +0 -2
- package/dist/assets/ScenarioEditor-D06nbX4h.js +0 -3
- package/dist/assets/TabularView-BLzDtgmK.js +0 -1
- package/dist/assets/TraceabilityMatrix-DbL_FkAC.js +0 -1
- package/dist/assets/index-B8HDzVLs.css +0 -1
- package/dist/assets/index-D0vtjNjX.js +0 -3280
- package/dist/assets/layout-selection-DIQaaOIC.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./reactflow-CsCqNKB-.js";import{a as b}from"./zustand-CrhqMOHB.js";import{u as C,f as _,R as v}from"./index-D0vtjNjX.js";const U=["Function","Function","ActionDefinition","ActionUsage"],H=["flow","decomposedBy","composedOf","allocateTo","succession"];function K(o,c){const m=new Set((c==null?void 0:c.kinds)??U),u=new Set((c==null?void 0:c.relationshipTypes)??H),p=(c==null?void 0:c.cluster)??!0,d=[];for(const e of Object.values(o.elements))m.has(e.kind)&&d.push(e);d.sort((e,h)=>{const g=e.kind.localeCompare(h.kind);return g!==0?g:e.name.localeCompare(h.name)});const a=d.map(e=>e.id),f=new Map;for(let e=0;e<a.length;e++)f.set(a[e],e);const r=a.length,y={};for(const e of d)y[e.id]={name:e.name,kind:e.kind,layer:e.layer,allocatedTo:e.allocatedTo};const l=Array.from({length:r},()=>Array.from({length:r},()=>null));let t=0;for(const e of o.relationships){if(!u.has(e.type))continue;const h=f.get(e.sourceId),g=f.get(e.targetId);if(h===void 0||g===void 0||h===g)continue;let F=l[h][g];F||(F={count:0,types:[],flowItems:[]},l[h][g]=F),F.count++,F.types.includes(e.type)||F.types.push(e.type),e.flowItem&&!F.flowItems.includes(e.flowItem)&&F.flowItems.push(e.flowItem),t++}const i=p?Y(a,l):new Map;return{elementIds:a,elements:y,matrix:l,clusters:i,totalDependencies:t}}function Y(o,c){const m=o.length,u=Array.from({length:m},(l,t)=>t),p=new Array(m).fill(0);function d(l){return u[l]!==l&&(u[l]=d(u[l])),u[l]}function a(l,t){const i=d(l),e=d(t);i!==e&&(p[i]<p[e]?u[i]=e:p[i]>p[e]?u[e]=i:(u[e]=i,p[i]++))}for(let l=0;l<m;l++)for(let t=0;t<m;t++)l!==t&&(c[l][t]||c[t][l])&&a(l,t);const f=new Map;for(let l=0;l<m;l++){const t=d(l);f.has(t)||f.set(t,[]),f.get(t).push(o[l])}const r=new Map;let y=0;for(const l of f.values())r.set(y++,l);return r}function P(o){const c=[],m=new Set;for(const[,a]of o.clusters)for(const f of a)m.has(f)||(c.push(f),m.add(f));for(const a of o.elementIds)m.has(a)||c.push(a);const u=c.length,p=new Map;for(let a=0;a<o.elementIds.length;a++)p.set(o.elementIds[a],a);const d=Array.from({length:u},()=>Array.from({length:u},()=>null));for(let a=0;a<u;a++)for(let f=0;f<u;f++)d[a][f]=o.matrix[p.get(c[a])][p.get(c[f])];return{...o,elementIds:c,matrix:d}}const R=new Set(["Function","Function","UserActivity"]),z=new Set(["System","Subsystem","Component","LogicalComponent","SoftwareComponent","SoftwareModule","Software"]);function V(o){var y,l;const c=[],m=[];for(const t of Object.values(o.elements))R.has(t.kind)&&c.push(t),z.has(t.kind)&&m.push(t);const u=[],p=new Set,d=new Map;for(const t of m)d.set(t.id,[]);for(const t of o.relationships){if(t.type!=="allocateTo")continue;const i=o.elements[t.sourceId],e=o.elements[t.targetId];!i||!e||R.has(i.kind)&&z.has(e.kind)&&(u.push({functionId:i.id,functionName:i.name,targetId:e.id,targetName:e.name}),p.add(i.id),d.has(e.id)||d.set(e.id,[]),d.get(e.id).push(i.id))}for(const t of c)if(t.allocatedTo&&!p.has(t.id)){const i=m.find(e=>e.name===t.allocatedTo||e.id===t.allocatedTo);i&&(u.push({functionId:t.id,functionName:t.name,targetId:i.id,targetName:i.name}),p.add(t.id),d.has(i.id)||d.set(i.id,[]),d.get(i.id).push(t.id))}const a=[];let f=0;for(const t of c)p.has(t.id)||a.push({id:`ci-${f++}`,type:"unallocated-function",severity:"warning",elementId:t.id,elementName:t.name,message:`Function "${t.name}" is not allocated to any component`});for(const t of m){const i=d.get(t.id);(!i||i.length===0)&&a.push({id:`ci-${f++}`,type:"no-functions-allocated",severity:"info",elementId:t.id,elementName:t.name,message:`Component "${t.name}" has no functions allocated to it`})}const r=new Map;for(const t of u)r.set(t.functionId,t.targetId);for(const t of o.relationships){if(t.type!=="flow")continue;const i=r.get(t.sourceId),e=r.get(t.targetId);if(i&&e&&i!==e){const h=o.elements[t.sourceId],g=o.elements[t.targetId];h&&g&&a.push({id:`ci-${f++}`,type:"cross-component-flow",severity:"info",elementId:t.sourceId,elementName:h.name,message:`Flow from "${h.name}" to "${g.name}" crosses component boundary (${(y=o.elements[i])==null?void 0:y.name} → ${(l=o.elements[e])==null?void 0:l.name})`,relatedIds:[t.targetId,i,e]})}}return{allocations:u,componentFunctions:d,issues:a,functions:c,structures:m}}function N(o){for(const c of o.types)if(v[c])return v[c];return"#6B7280"}function Z(o){const c=N(o),m=Math.min(.15+o.count*.15,.6);return`${c}${Math.round(m*255).toString(16).padStart(2,"0")}`}const E=36,D=160;function Q(){const o=C(n=>n.model),c=C(n=>n.selectElement),m=C(n=>n.selectedElementId),u=C(n=>n.setAnalysisIssues),[p,d]=b.useState(!0),[a,f]=b.useState(!1),[r,y]=b.useState(null),[l,t]=b.useState("functional"),i=b.useMemo(()=>{switch(l){case"functional":return["Function","Function"];case"behavior":return["ActionDefinition","ActionUsage"];case"all":return["Function","Function","ActionDefinition","ActionUsage"]}},[l]),e=b.useMemo(()=>{if(!o)return null;const n=K(o,{kinds:i});return p?P(n):n},[o,p,i]),h=b.useMemo(()=>o?V(o):null,[o]);b.useEffect(()=>{if(h)return u(h.issues.map(n=>({id:n.id,source:"DSM",severity:n.severity,elementId:n.elementId,elementName:n.elementName,message:n.message,tag:n.type==="unallocated-function"?"unallocated":n.type==="cross-component-flow"?"cross-boundary":"no functions"}))),()=>u([])},[h,u]);const g=b.useCallback((n,x)=>{y({row:n,col:x})},[]),F=b.useCallback(()=>{y(null)},[]);if(!o||!e)return s.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:"#9CA3AF"},children:s.jsx("p",{children:"No model loaded"})});if(e.elementIds.length===0)return s.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:s.jsxs("div",{className:"text-center",style:{maxWidth:"320px"},children:[s.jsx("div",{style:{fontSize:"40px",marginBottom:"16px",opacity:.4},children:"▤"}),s.jsx("h3",{style:{fontSize:"15px",fontWeight:600,color:"#374151",marginBottom:"8px"},children:"No Functional Elements"}),s.jsx("p",{style:{fontSize:"13px",color:"#9CA3AF",lineHeight:1.6},children:"Add Function or Function elements to your model to see the DSM."})]})});const B=e.elementIds.length,k=new Set;if(p&&e.clusters.size>1){let n=0;for(const[,x]of e.clusters)n+=x.length,n<B&&k.add(n)}const j=r?(()=>{const n=e.matrix[r.row][r.col],x=e.elements[e.elementIds[r.row]],w=e.elements[e.elementIds[r.col]];return{cell:n,rowEl:x,colEl:w}})():null;return s.jsxs("div",{className:"flex-1 flex flex-col",style:{background:"#F7F7F5"},children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-2",style:{borderBottom:"1px solid #E5E5E0",background:"#FFFFFF"},children:[s.jsx("span",{style:{fontSize:"13px",fontWeight:600,color:"#374151"},children:"Design Structure Matrix"}),s.jsxs("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:[B," elements, ",e.totalDependencies," dependencies"]}),s.jsx("div",{className:"flex-1"}),s.jsx("div",{className:"flex rounded overflow-hidden",style:{border:"1px solid #E5E5E0"},children:["functional","behavior","all"].map(n=>s.jsx("button",{onClick:()=>t(n),className:"px-2 py-0.5 text-xs font-medium",style:{background:l===n?"#1B3A4B":"#FFFFFF",color:l===n?"#FFFFFF":"#6B7280"},children:n==="functional"?"Functions":n==="behavior"?"Behavior":"All"},n))}),s.jsxs("label",{className:"flex items-center gap-1.5 text-xs",style:{color:"#6B7280"},children:[s.jsx("input",{type:"checkbox",checked:p,onChange:n=>d(n.target.checked),style:{accentColor:"#2DD4A8"}}),"Cluster"]}),s.jsxs("label",{className:"flex items-center gap-1.5 text-xs",style:{color:"#6B7280"},children:[s.jsx("input",{type:"checkbox",checked:a,onChange:n=>f(n.target.checked),style:{accentColor:"#E67E22"}}),"Allocation"]})]}),s.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[s.jsxs("div",{style:{display:"inline-block",position:"relative"},children:[s.jsx("div",{style:{display:"flex",marginLeft:D,marginBottom:"4px"},children:e.elementIds.map((n,x)=>{const w=e.elements[n],A=(r==null?void 0:r.col)===x;return s.jsx("div",{style:{width:E,height:D-20,position:"relative",borderRight:k.has(x+1)?"2px solid #2DD4A8":void 0},children:s.jsx("div",{style:{position:"absolute",bottom:0,left:E/2,transformOrigin:"bottom left",transform:"rotate(-60deg)",whiteSpace:"nowrap",fontSize:"11px",fontWeight:A?600:400,color:A?"#1a1a1a":"#6B7280",cursor:"pointer"},onClick:()=>c(n),children:w.name})},n)})}),e.elementIds.map((n,x)=>{const w=e.elements[n],A=(r==null?void 0:r.row)===x,M=m===n,L=k.has(x);return s.jsxs("div",{style:{display:"flex",alignItems:"center",borderTop:L?"2px solid #2DD4A8":void 0},children:[s.jsxs("div",{style:{width:D,paddingRight:"8px",fontSize:"11px",fontWeight:A||M?600:400,color:A||M?"#1a1a1a":"#6B7280",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textAlign:"right",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"6px",height:E},onClick:()=>c(n),title:`${w.name} (${w.kind})`,children:[a&&w.allocatedTo&&s.jsx("span",{style:{fontSize:"9px",padding:"1px 4px",borderRadius:"3px",background:"#E67E2220",color:"#E67E22",fontWeight:500},children:w.allocatedTo}),s.jsx("span",{style:{width:"3px",height:"14px",borderRadius:"2px",background:_[w.layer]||"#9CA3AF",flexShrink:0}}),w.name]}),e.elementIds.map(($,I)=>{const S=e.matrix[x][I],T=x===I,W=(r==null?void 0:r.row)===x&&(r==null?void 0:r.col)===I,O=(r==null?void 0:r.row)===x||(r==null?void 0:r.col)===I;return s.jsx("div",{onMouseEnter:()=>g(x,I),onMouseLeave:F,onClick:()=>{S&&c(n)},style:{width:E,height:E,border:"1px solid #E5E5E0",borderRight:k.has(I+1)?"2px solid #2DD4A8":"1px solid #E5E5E0",background:T?"#F3F4F6":S?Z(S):O?"#FAFAFA":"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",cursor:S?"pointer":"default",transition:"background 100ms ease",outline:W&&S?`2px solid ${N(S)}`:void 0,outlineOffset:"-2px"},children:S&&!T&&s.jsx("span",{style:{fontSize:"10px",fontWeight:600,color:N(S)},children:S.count>1?S.count:"●"})},$)})]},n)})]}),(j==null?void 0:j.cell)&&s.jsxs("div",{style:{position:"fixed",bottom:"80px",right:"20px",background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"8px",padding:"12px 16px",boxShadow:"0 4px 16px rgba(0,0,0,0.12)",fontSize:"12px",zIndex:100,maxWidth:"280px"},children:[s.jsx("div",{style:{fontWeight:600,color:"#1a1a1a",marginBottom:"6px"},children:j.rowEl.name}),s.jsxs("div",{style:{color:"#6B7280",marginBottom:"4px"},children:["→"," ",j.colEl.name]}),s.jsx("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap"},children:j.cell.types.map(n=>s.jsx("span",{style:{fontSize:"10px",padding:"2px 6px",borderRadius:"4px",background:(v[n]||"#6B7280")+"20",color:v[n]||"#6B7280",fontWeight:500},children:n},n))}),j.cell.flowItems.length>0&&s.jsxs("div",{style:{marginTop:"4px",color:"#9CA3AF",fontSize:"11px"},children:["Items: ",j.cell.flowItems.join(", ")]})]}),s.jsxs("div",{style:{marginTop:"20px",display:"flex",gap:"16px",flexWrap:"wrap",fontSize:"11px",color:"#6B7280"},children:[["flow","decomposedBy","composedOf","allocateTo","succession"].map(n=>s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[s.jsx("span",{style:{width:"10px",height:"10px",borderRadius:"2px",background:v[n]||"#6B7280"}}),n]},n)),p&&e.clusters.size>1&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[s.jsx("span",{style:{width:"10px",height:"2px",background:"#2DD4A8"}}),"cluster boundary"]})]})]})]})}export{Q as DSMView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./reactflow-CsCqNKB-.js";import{a as f}from"./zustand-CrhqMOHB.js";import{u as x,f as m}from"./index-D0vtjNjX.js";function j(i,d,s){var u,l;const n=Object.values(i.elements),o={},t={};for(const r of n)o[r.layer]=(o[r.layer]||0)+1,t[r.kind.toLowerCase()]=(t[r.kind.toLowerCase()]||0)+1;const a={};for(const r of i.relationships)a[r.type.toLowerCase()]=(a[r.type.toLowerCase()]||0)+1;return{totalElements:n.length,totalRelationships:i.relationships.length,violations:d,completenessPercent:s,riskCount:(o.risk||0)+(o.analysis||0),requirementsCount:o.requirements||0,architectureCount:["logical","physical","functional","logical_structure","software_structure","hardware_structure","functions","interfaces","system","context","operational","behavior"].reduce((r,p)=>r+(o[p]||0),0),verificationCount:(o.verification||0)+(o.assurance||0),hazardCount:t.hazard||0,requirementCount:Object.entries(t).filter(([r])=>r.endsWith("requirement")).reduce((r,[,p])=>r+p,0),riskControlCount:t.riskcontrol||0,systemCount:(t.system||0)+(t.subsystem||0)+(t.softwaresystem||0)+(t.logicalcomponent||0)+(t.hardwareassembly||0)+(t.softwarecomponent||0)+(t.processingnode||0),testCount:(t.verificationcase||0)+(t.validationcase||0)+(t.testartifact||0)+(t.test||0),mitigatesCount:Object.entries(a).filter(([r])=>r.startsWith("mitigat")).reduce((r,[,p])=>r+p,0),verificationLinkCount:Object.entries(a).filter(([r])=>r.startsWith("verif")||r.startsWith("validate")||r==="testedbyusability").reduce((r,[,p])=>r+p,0),diagramCount:((u=i.diagrams)==null?void 0:u.length)??0,projectName:((l=i.metadata)==null?void 0:l.projectName)||i.projectName||i.name||"My Device Project"}}function k(i){return i.totalElements===0?{icon:"🚀",title:"Add your first model elements",description:"Start with intended use, actors, and a system requirement. Or use the Workflow Wizard to guide you step by step.",urgency:"high"}:i.requirementCount===0?{icon:"📋",title:"Define your first requirement",description:"Your model has elements but no system requirements yet. Add a Requirement in the Model Explorer.",urgency:"high"}:i.hazardCount===0?{icon:"⚠️",title:"Add your first hazard",description:`You have ${i.requirementCount} requirement(s) but no hazard analysis yet. ISO 14971 requires hazard identification early.`,urgency:"high"}:i.hazardCount>0&&i.mitigatesCount===0?{icon:"🔗",title:"Connect hazards to risk controls",description:`You have ${i.hazardCount} hazard(s) but no MitigatesHazard relationships. Connect hazards to risk controls to complete the ISO 14971 chain.`,urgency:"high"}:i.systemCount===0?{icon:"🏗️",title:"Define your system architecture",description:"No architecture components found (SoftwareSystem, LogicalComponent, HardwareAssembly, …). Add an architecture layer to ground your requirements and risk analysis.",urgency:"medium"}:i.testCount===0?{icon:"🧪",title:"Add verification tests",description:`${i.requirementCount} requirement(s) have no verification tests yet. Add VerificationCases and link them to requirements with VerifiedBy.`,urgency:"medium"}:i.verificationLinkCount===0&&i.testCount>0?{icon:"↔️",title:"Link tests to requirements",description:"Verification cases exist but no VerifiedBy links found. Open the Traceability Matrix to connect tests to their requirements.",urgency:"medium"}:{icon:"✅",title:"Good coverage so far",description:"Requirements, hazards, and risk controls are in place. Check the GapBar (⌘⇧P) for completeness gaps before your review.",urgency:"low"}}function h({label:i,value:d,color:s,subtitle:n}){return e.jsxs("div",{style:{background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"20px 24px",display:"flex",flexDirection:"column",gap:"4px"},children:[e.jsx("div",{style:{fontSize:"28px",fontWeight:800,color:s,lineHeight:1},children:d}),e.jsx("div",{style:{fontSize:"12px",fontWeight:600,color:"#374151"},children:i}),n&&e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF"},children:n})]})}function y({layer:i,label:d,count:s,color:n,onClick:o}){const t=s>0;return e.jsxs("button",{onClick:o,style:{background:t?`${n}12`:"#F9FAFB",border:`1px solid ${t?n+"30":"#E5E5E0"}`,borderRadius:"12px",padding:"16px",cursor:"pointer",textAlign:"left",transition:"all 0.15s"},onMouseEnter:a=>{a.currentTarget.style.background=t?`${n}20`:"#F3F4F6",a.currentTarget.style.transform="translateY(-1px)",a.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.08)"},onMouseLeave:a=>{a.currentTarget.style.background=t?`${n}12`:"#F9FAFB",a.currentTarget.style.transform="none",a.currentTarget.style.boxShadow="none"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"},children:[e.jsx("span",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:t?n:"#9CA3AF"},children:d}),e.jsxs("span",{style:{fontSize:"10px",fontWeight:600,padding:"2px 8px",borderRadius:"999px",background:t?n+"20":"#F3F4F6",color:t?n:"#9CA3AF"},children:[s," elements"]})]}),e.jsx("div",{style:{width:"100%",height:"4px",background:"#F3F4F6",borderRadius:"2px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"2px",background:t?n:"transparent",width:t?`${Math.min(100,s/10*100)}%`:"0",transition:"width 0.4s ease"}})}),e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"8px"},children:t?"Click to explore →":"Not started"})]})}function g({icon:i,label:d,onClick:s,variant:n="secondary"}){const o=n==="primary";return e.jsxs("button",{onClick:s,style:{display:"flex",alignItems:"center",gap:"8px",padding:"10px 16px",borderRadius:"8px",cursor:"pointer",fontSize:"13px",fontWeight:600,border:"none",background:o?"#1B3A4B":"rgba(255,255,255,0.7)",color:o?"#FFFFFF":"#374151",backdropFilter:"blur(4px)",transition:"all 0.15s"},onMouseEnter:t=>{t.currentTarget.style.background=o?"#244D63":"rgba(255,255,255,0.95)",t.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.1)"},onMouseLeave:t=>{t.currentTarget.style.background=o?"#1B3A4B":"rgba(255,255,255,0.7)",t.currentTarget.style.boxShadow="none"},children:[e.jsx("span",{children:i}),e.jsx("span",{children:d})]})}function S(){var b;const i=x(c=>c.model),d=x(c=>c.validation),s=x(c=>c.completeness),n=x(c=>c.setActiveView),o=x(c=>c.setExplorerTab),t=x(c=>c.toggleGapBar),a=((b=d==null?void 0:d.violations)==null?void 0:b.length)??0,u=f.useMemo(()=>{if(typeof(s==null?void 0:s.overall)=="number")return Math.round(s.overall);if(!(s!=null&&s.layers)||s.layers.length===0)return 0;const c=s.layers.reduce((C,v)=>C+(v.completeness||0),0)/s.layers.length;return Math.round(c)},[s]),l=f.useMemo(()=>i?j(i,a,u):null,[i,a,u]),r=f.useMemo(()=>l?k(l):null,[l]);return!l||!i?e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:e.jsx("div",{style:{fontSize:"13px",color:"#9CA3AF"},children:"Loading dashboard…"})}):e.jsx("div",{style:{flex:1,overflowY:"auto",background:"linear-gradient(135deg, #EEF7F3 0%, #EAF2F8 55%, #F2EEF8 100%)",padding:"32px 40px"},children:e.jsxs("div",{style:{maxWidth:"960px",margin:"0 auto"},children:[e.jsxs("div",{style:{marginBottom:"28px"},children:[e.jsx("h1",{style:{fontSize:"22px",fontWeight:800,color:"#1B3A4B",margin:"0 0 4px 0"},children:l.projectName}),e.jsxs("p",{style:{fontSize:"13px",color:"#4B6E80",margin:0},children:["Model dashboard · ",new Date().toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"12px",marginBottom:"24px"},children:[e.jsx(h,{label:"Elements",value:l.totalElements,color:"#1B3A4B"}),e.jsx(h,{label:"Relationships",value:l.totalRelationships,color:"#4A90D9"}),e.jsx(h,{label:"Completeness",value:`${u}%`,color:u>=70?"#2ECC71":u>=40?"#F39C12":"#E74C3C"}),e.jsx(h,{label:"Violations",value:a,color:a===0?"#2ECC71":"#E74C3C",subtitle:a===0?"All rules passing":"Open the GapBar"})]}),e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx("h2",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"#7A9BAA",margin:"0 0 12px 0"},children:"Layer Coverage"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"12px"},children:[e.jsx(y,{layer:"requirements",label:"Requirements",count:l.requirementsCount,color:m.requirements,onClick:()=>{o("model"),n({type:"welcome"})}}),e.jsx(y,{layer:"risk",label:"Risk",count:l.riskCount,color:m.risk,onClick:()=>{o("model"),n({type:"welcome"})}}),e.jsx(y,{layer:"logical",label:"Architecture",count:l.architectureCount,color:m.logical,onClick:()=>{o("views"),n({type:"welcome"})}}),e.jsx(y,{layer:"verification",label:"Verification",count:l.verificationCount,color:m.verification,onClick:()=>n({type:"traceability"})})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px",marginBottom:"24px"},children:[r&&e.jsxs("div",{style:{background:r.urgency==="high"?"rgba(231,76,60,0.06)":r.urgency==="medium"?"rgba(243,156,18,0.06)":"rgba(46,204,113,0.06)",border:`1px solid ${r.urgency==="high"?"#E74C3C30":r.urgency==="medium"?"#F39C1230":"#2ECC7130"}`,borderRadius:"12px",padding:"20px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"#7A9BAA",marginBottom:"10px"},children:"💡 Suggested Next Step"}),e.jsx("div",{style:{fontSize:"16px",marginBottom:"6px"},children:r.icon}),e.jsx("div",{style:{fontSize:"14px",fontWeight:700,color:"#1B3A4B",marginBottom:"6px"},children:r.title}),e.jsx("div",{style:{fontSize:"12px",color:"#4B6E80",lineHeight:"1.6"},children:r.description}),r.urgency!=="low"&&e.jsx("button",{onClick:()=>n({type:"workflow-wizard"}),style:{marginTop:"14px",padding:"8px 14px",fontSize:"12px",fontWeight:600,background:"#1B3A4B",color:"#FFFFFF",border:"none",borderRadius:"6px",cursor:"pointer"},onMouseEnter:c=>c.currentTarget.style.background="#244D63",onMouseLeave:c=>c.currentTarget.style.background="#1B3A4B",children:"Open Workflow Wizard →"})]}),e.jsxs("div",{style:{background:"rgba(255,255,255,0.6)",border:"1px solid rgba(255,255,255,0.9)",borderRadius:"12px",padding:"20px",backdropFilter:"blur(4px)"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"#7A9BAA",marginBottom:"14px"},children:"Quick Actions"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx(g,{icon:"🗂️",label:"Browse Model",onClick:()=>{o("model")}}),e.jsx(g,{icon:"📊",label:"Open Viewpoints",onClick:()=>o("views")}),e.jsx(g,{icon:"↔️",label:"Traceability Matrix",onClick:()=>n({type:"traceability"})}),e.jsx(g,{icon:"📋",label:"First Review Dashboard",onClick:()=>n({type:"review-dashboard"})}),e.jsx(g,{icon:"✅",label:"Check Completeness",onClick:()=>t()}),e.jsx(g,{icon:"📈",label:"Full Statistics",onClick:()=>n({type:"statistics"})})]})]})]}),l.diagramCount>0&&e.jsx("div",{style:{background:"rgba(255,255,255,0.6)",border:"1px solid rgba(255,255,255,0.9)",borderRadius:"12px",padding:"16px 20px",backdropFilter:"blur(4px)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{style:{fontSize:"13px",fontWeight:600,color:"#374151"},children:[l.diagramCount," model view",l.diagramCount!==1?"s":""," in this project"]}),e.jsx("button",{onClick:()=>o("views"),style:{fontSize:"12px",color:"#4A90D9",background:"none",border:"none",cursor:"pointer",fontWeight:600},children:"Browse viewpoints →"})]})})]})})}export{S as Dashboard};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./reactflow-CsCqNKB-.js";import{a as d}from"./zustand-CrhqMOHB.js";import{u as p}from"./index-D0vtjNjX.js";const y=[{value:"",label:"— Select phase —"},{value:"concept",label:"Concept"},{value:"design",label:"Design & Development"},{value:"verification",label:"Verification & Validation"},{value:"production",label:"Production"}],i={width:"100%",padding:"7px 10px",border:"1px solid #D1D5DB",borderRadius:"6px",fontSize:"13px",color:"#1B3A4B",background:"#fff",boxSizing:"border-box",outline:"none",fontFamily:"inherit"},n={fontSize:"11px",fontWeight:600,color:"#6B7280",textTransform:"uppercase",letterSpacing:"0.04em",display:"block",marginBottom:"4px"},s={fontSize:"12px",fontWeight:700,color:"#1B3A4B",paddingBottom:"6px",borderBottom:"1px solid #E5E7EB",marginBottom:"12px",marginTop:"4px"},j={display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"};function C({onClose:a}){const c=p(o=>o.dhfSettings),x=p(o=>o.updateDhfSettings),[l,g]=d.useState({...c}),[r,h]=d.useState("identity");function t(o,m){g(f=>({...f,[o]:m}))}function u(){x(l),a()}return e.jsx("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.45)"},onClick:o=>{o.target===o.currentTarget&&a()},children:e.jsxs("div",{style:{background:"#fff",borderRadius:"12px",width:"560px",maxHeight:"86vh",display:"flex",flexDirection:"column",boxShadow:"0 24px 60px rgba(0,0,0,0.22)",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px 20px",borderBottom:"1px solid #E5E7EB",flexShrink:0},children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#6B7280",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),e.jsx("span",{style:{fontSize:"15px",fontWeight:700,color:"#1B3A4B",flex:1},children:"DHF Global Settings"}),e.jsx("button",{onClick:a,style:{background:"none",border:"none",cursor:"pointer",color:"#9CA3AF",fontSize:"20px",lineHeight:1,padding:"0 2px"},children:"×"})]}),e.jsx("div",{style:{display:"flex",borderBottom:"1px solid #E5E7EB",flexShrink:0,padding:"0 20px"},children:["identity","branding","layout"].map(o=>e.jsx("button",{onClick:()=>h(o),style:{padding:"10px 14px",border:"none",background:"none",fontSize:"12px",fontWeight:600,cursor:"pointer",color:r===o?"#1B3A4B":"#9CA3AF",borderBottom:`2px solid ${r===o?"#2DD4A8":"transparent"}`,marginBottom:"-1px",textTransform:"capitalize"},children:o==="identity"?"Project":o==="branding"?"Branding":"Layout"},o))}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px"},children:[r==="identity"&&e.jsxs("div",{children:[e.jsx("p",{style:s,children:"Project Identity"}),e.jsxs("p",{style:{fontSize:"12px",color:"#6B7280",marginBottom:"16px",lineHeight:"1.5"},children:["These values resolve ",e.jsx("code",{style:{background:"#F3F4F6",padding:"1px 4px",borderRadius:"3px"},children:"{{project.*}}"})," directives in all templates and the AI drafting context."]}),e.jsxs("div",{style:j,children:[e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Company / Manufacturer"}),e.jsx("input",{style:i,value:l.company,onChange:o=>t("company",o.target.value),placeholder:"Acme Medical Devices Inc."})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Product / Device Name"}),e.jsx("input",{style:i,value:l.product,onChange:o=>t("product",o.target.value),placeholder:"InfuSafe IV Pump"})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Device Type"}),e.jsx("input",{style:i,value:l.deviceType,onChange:o=>t("deviceType",o.target.value),placeholder:"Class II active implantable"})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Document Version"}),e.jsx("input",{style:i,value:l.version,onChange:o=>t("version",o.target.value),placeholder:"1.0.0"})]}),e.jsxs("div",{style:{gridColumn:"1 / -1"},children:[e.jsx("label",{style:n,children:"Development Phase"}),e.jsx("select",{style:i,value:l.phase,onChange:o=>t("phase",o.target.value),children:y.map(o=>e.jsx("option",{value:o.value,children:o.label},o.value))})]}),e.jsxs("div",{style:{gridColumn:"1 / -1"},children:[e.jsx("label",{style:n,children:"Document ID Prefix"}),e.jsx("input",{style:{...i,fontFamily:"monospace"},value:l.documentNumberingPrefix,onChange:o=>t("documentNumberingPrefix",o.target.value),placeholder:"DOC"}),e.jsxs("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:["Used in document IDs, e.g. ",e.jsxs("code",{children:[l.documentNumberingPrefix||"DOC","-RMP-001"]})]})]})]})]}),r==="branding"&&e.jsxs("div",{children:[e.jsx("p",{style:s,children:"Branding"}),e.jsx("p",{style:{fontSize:"12px",color:"#6B7280",marginBottom:"16px",lineHeight:"1.5"},children:"Branding applied to exported HTML and DOCX documents. Per-document overrides can be set in the document's frontmatter."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:[e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Full Logo URL"}),e.jsx("input",{style:i,value:l.logoUrl,onChange:o=>t("logoUrl",o.target.value),placeholder:"https://... or data:image/png;base64,..."}),e.jsx("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:"Shown in document cover pages and report headers."}),l.logoUrl&&e.jsx("img",{src:l.logoUrl,alt:"Logo preview",style:{maxHeight:"48px",maxWidth:"200px",marginTop:"8px",border:"1px solid #E5E7EB",borderRadius:"4px",padding:"4px"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Compact Logo URL"}),e.jsx("input",{style:i,value:l.compactLogoUrl,onChange:o=>t("compactLogoUrl",o.target.value),placeholder:"https://... or data:image/png;base64,..."}),e.jsx("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:"Shown in page headers (small). Falls back to Full Logo if empty."}),l.compactLogoUrl&&e.jsx("img",{src:l.compactLogoUrl,alt:"Compact logo preview",style:{maxHeight:"28px",maxWidth:"120px",marginTop:"8px",border:"1px solid #E5E7EB",borderRadius:"4px",padding:"4px"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Primary Color"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[e.jsx("input",{type:"color",value:l.primaryColor,onChange:o=>t("primaryColor",o.target.value),style:{width:"40px",height:"32px",padding:"2px",border:"1px solid #D1D5DB",borderRadius:"6px",cursor:"pointer"}}),e.jsx("input",{style:{...i,flex:1,fontFamily:"monospace"},value:l.primaryColor,onChange:o=>t("primaryColor",o.target.value),placeholder:"#1B3A4B"})]}),e.jsx("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:"Used for headings, table headers, and badges in exported documents."})]})]})]}),r==="layout"&&e.jsxs("div",{children:[e.jsx("p",{style:s,children:"Document Layout"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[e.jsxs("div",{children:[e.jsxs("label",{style:{...n,display:"flex",alignItems:"center",gap:"8px",textTransform:"none",fontSize:"13px",fontWeight:600,color:"#1B3A4B",marginBottom:0},children:[e.jsx("input",{type:"checkbox",checked:l.compactMode,onChange:o=>t("compactMode",o.target.checked),style:{accentColor:"#2DD4A8"}}),"Compact mode"]}),e.jsx("p",{style:{fontSize:"12px",color:"#6B7280",marginTop:"4px",marginLeft:"20px"},children:"Tighter line spacing and smaller heading sizes. Useful for regulatory submissions."})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Page Header Template"}),e.jsx("input",{style:{...i,fontFamily:"monospace",fontSize:"12px"},value:l.headerTemplate,onChange:o=>t("headerTemplate",o.target.value)}),e.jsxs("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:["Tokens: ",e.jsx("code",{children:"{{id}}"}),", ",e.jsx("code",{children:"{{title}}"}),", ",e.jsx("code",{children:"{{project.product}}"}),", ",e.jsx("code",{children:"{{project.version}}"}),", ",e.jsx("code",{children:"{{date}}"})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Page Footer Template"}),e.jsx("input",{style:{...i,fontFamily:"monospace",fontSize:"12px"},value:l.footerTemplate,onChange:o=>t("footerTemplate",o.target.value)}),e.jsxs("p",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"4px"},children:["Tokens: same as header, plus ",e.jsx("code",{children:"{{page}}"})," and ",e.jsx("code",{children:"{{pages}}"})]})]})]})]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",padding:"14px 20px",borderTop:"1px solid #E5E7EB",flexShrink:0,background:"#FAFAFA"},children:[e.jsx("button",{onClick:a,style:{padding:"8px 16px",borderRadius:"6px",border:"1px solid #D1D5DB",background:"#fff",fontSize:"13px",cursor:"pointer",color:"#374151"},children:"Cancel"}),e.jsx("button",{onClick:u,style:{padding:"8px 20px",borderRadius:"6px",border:"none",background:"#2DD4A8",fontSize:"13px",fontWeight:600,cursor:"pointer",color:"#065F46"},children:"Save Settings"})]})]})})}export{C as DhfSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Es=Object.defineProperty;var Cs=(t,i,n)=>i in t?Es(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n;var Vt=(t,i,n)=>Cs(t,typeof i!="symbol"?i+"":i,n);import{u as En,j as e,H as C,P as j,N as kt,a as oo,B as Cn,E as Jt,R as Is,b as Ds,c as Ns,d as As,e as Rs,i as Ts,C as Bs,f as Ms,g as Ls,M as zs}from"./reactflow-CsCqNKB-.js";import{b as $s,a as d,W as rn}from"./zustand-CrhqMOHB.js";/* empty css */import{F as N,S as ie,w as Ws,u as L,f as In,x as Os,g as Ps,D as an,y as Ve,z as _s,i as ln,A as Hs,R as dn,V as cn,C as pn}from"./index-D0vtjNjX.js";import{c as Ks,a as Vs,b as Ys,d as Us,e as Xs,f as Gs,g as qs,h as Zs,i as Qs,j as Js,k as ei,I as no,l as ti,P as wt,s as oi,u as ni,m as si,G as Yt,n as ii,o as ri,C as eo,p as ai,r as li,q as Ut,v as di,t as un,w as ci,x as pi,y as ui,B as xi,z as hi,R as gi,A as fi}from"./layout-selection-DIQaaOIC.js";import"./layout-providers-Dr743WlP.js";import"./elk-6l8mIQnQ.js";function mi(t,i,n="both",a=10){const r=t.elements[i];if(!r)return{rootId:i,rootName:"(unknown)",rootKind:"",nodes:[],edges:[]};const l=new Map,x=new Map;for(const p of t.relationships)l.has(p.sourceId)||l.set(p.sourceId,[]),l.get(p.sourceId).push(p),x.has(p.targetId)||x.set(p.targetId,[]),x.get(p.targetId).push(p);const m=new Set;m.add(i);const F=[],y=[],I=[[i,0]];for(;I.length>0;){const[p,b]=I.shift();if(b>=a)continue;const v=b+1;if(n==="downstream"||n==="both")for(const f of l.get(p)||[]){const k=f.targetId;if(y.push({fromId:p,toId:k,relType:f.type,relId:f.id}),!m.has(k)){m.add(k);const E=t.elements[k];E&&(F.push({elementId:k,name:E.name,kind:E.kind,layer:E.layer,depth:v,viaRelType:f.type,direction:"downstream"}),I.push([k,v]))}}if(n==="upstream"||n==="both")for(const f of x.get(p)||[]){const k=f.sourceId;if(y.push({fromId:k,toId:p,relType:f.type,relId:f.id}),!m.has(k)){m.add(k);const E=t.elements[k];E&&(F.push({elementId:k,name:E.name,kind:E.kind,layer:E.layer,depth:v,viaRelType:f.type,direction:"upstream"}),I.push([k,v]))}}}return F.sort((p,b)=>p.depth-b.depth||p.name.localeCompare(b.name)),{rootId:i,rootName:r.name,rootKind:r.kind,nodes:F,edges:y}}const Xe=$s(t=>({subject:null,publish:i=>t({subject:i})})),Ue=t=>Xe.getState().publish(t),Dn=t=>{var i,n;return[t.source,t.target,(i=t.data)==null?void 0:i.sourcePortId,(n=t.data)==null?void 0:n.targetPortId].filter(a=>!!a)},yi=(t,i)=>t.edgeId===i.id||Dn(i).some(n=>t.endpointIds.includes(n)),so=()=>Xe(t=>t.subject!==null),bi=t=>Xe(i=>{var n;return((n=i.subject)==null?void 0:n.endpointIds.includes(t))??!1}),Nn=(t,i)=>Xe(n=>{const a=n.subject;return a?a.edgeId===t||i.some(r=>r!==void 0&&a.endpointIds.includes(r)):!1}),Fi=t=>`.react-flow__edge[data-id="${CSS.escape(t)}"]`;function wi(){const t=Xe(a=>a.subject),i=En(a=>t?a.edges.filter(r=>yi(t,r)).map(r=>r.id).join("\0"):"");if(!t)return null;const n=i?i.split("\0").map(Fi).join(","):"";return e.jsxs("style",{children:[".react-flow__edge{opacity:0.22;transition:opacity 120ms ease}",n?`${n}{opacity:1}`:""]})}class ji{constructor(){Vt(this,"providers",[]);Vt(this,"byId",new Map)}register(i,n){const a=this.byId.get(i.descriptor.id);if(a&&a!==i)throw new Error(`Template provider already registered: ${i.descriptor.id}`);if(a)return;this.byId.set(i.descriptor.id,i);const r=n?this.providers.findIndex(l=>l.descriptor.id===n):-1;r>=0?this.providers.splice(r,0,i):this.providers.push(i)}unregister(i){const n=this.byId.get(i);return n?(this.byId.delete(i),this.providers.splice(this.providers.indexOf(n),1),!0):!1}get(i){return this.byId.get(i)}has(i){return this.byId.has(i)}list(){return this.providers.map(i=>i.descriptor)}select(i){const n=this.providers.find(a=>a.matches(i));if(!n)throw new Error("No diagram template matches this view — register a catch-all provider");return n}}const An=new ji,vi=[{descriptor:{id:"memo.template.fbs",name:"Functional Breakdown",label:"FBS",contractVersion:"1",interactive:!0,description:"Functional breakdown structure — functions per realising component."},matches:t=>t.isFBSDiagram,compute:(t,i)=>Ks(t,i.fbs)},{descriptor:{id:"memo.template.decomposition",name:"Decomposition Tree",label:"Decomposition",contractVersion:"1",interactive:!0,description:"Expandable decomposition tree over composition relationships."},matches:t=>t.isDecompDiagram&&t.layoutStyle==="decomposition",compute:(t,i)=>Vs(t,i.decomposition)},{descriptor:{id:"memo.template.containment",name:"Containment Blocks",label:"Containment",contractVersion:"1",interactive:!0,description:"Nested containment blocks over composition relationships."},matches:t=>t.isDecompDiagram,compute:(t,i)=>Ys(t,i.containment)},{descriptor:{id:"memo.template.usecase",name:"Use Case",label:"Use case",contractVersion:"1",interactive:!1,description:"Actors outside a system boundary, use cases inside (KK-7)."},matches:t=>t.diagramType==="ucd",compute:(t,i)=>Us(t,i.useCase)},{descriptor:{id:"memo.template.context",name:"System Context",label:"Context",contractVersion:"1",interactive:!1,description:"Black-box system of interest with external actors and peer systems."},matches:t=>t.diagramType==="context",compute:(t,i)=>Xs(t,i.context.systemName,i.context)},{descriptor:{id:"memo.template.interconnection",name:"Interconnection",label:"Interconnection",contractVersion:"1",interactive:!1,description:"IBD — parts with boundary ports, typed connectors, nested containment (KK-3)."},matches:t=>t.viewKind==="interconnection",compute:(t,i)=>Gs(t,i.interconnection)},{descriptor:{id:"memo.template.actionflow",name:"Action Flow",label:"Action flow",contractVersion:"1",interactive:!1,description:"Actions with parameter ports, item flows, successions, optional swimlanes (KK-4)."},matches:t=>t.viewKind==="actionflow",compute:(t,i)=>qs(t,i.actionflow)},{descriptor:{id:"memo.template.statetransition",name:"State Transition",label:"State transition",contractVersion:"1",interactive:!1,description:"Nested states with routed transition edges and trigger [guard] labels (KK-5)."},matches:t=>t.viewKind==="statetransition",compute:(t,i)=>Zs(t,i.statetransition)},{descriptor:{id:"memo.template.sequence",name:"Sequence",label:"Sequence",contractVersion:"1",interactive:!1,description:"Lifelines with chronological messages (KK-6)."},matches:t=>t.viewKind==="sequence",compute:(t,i)=>Qs(t,i.sequence)},{descriptor:{id:"memo.template.general",name:"General (structured)",label:"General",contractVersion:"1",interactive:!0,description:"General template tree/containment modes (KK-2)."},matches:t=>t.isGeneralTemplate&&t.generalMode!=="graph",compute:(t,i)=>Js(t,i.general)},{descriptor:{id:"memo.template.standard",name:"Standard Graph",label:"Standard",contractVersion:"1",interactive:!0,description:"Relationship graph with optional compartments — the catch-all."},matches:()=>!0,compute:(t,i)=>ei(t,i.standard)}];for(const t of vi)An.register(t);function Ge({color:t="#334155",size:i=38}){const n=Math.round(i*1.42);return e.jsxs("svg",{width:i,height:n,viewBox:"0 0 38 54","aria-hidden":"true",fill:"none",stroke:t,strokeWidth:"2",children:[e.jsx("circle",{cx:"19",cy:"8",r:"6",fill:"#FFFFFF"}),e.jsx("path",{d:"M19 14v18M6 23h26M19 32L8 49M19 32l11 17",strokeLinecap:"round"})]})}const io=t=>t==="Actor"||t==="User";function Si({data:t}){const i=t,{element:n,layerColor:a,isExpanded:r,hasChildren:l,childCount:x,direction:m,onToggleExpand:F,onToggleDirection:y,showDirectionButton:I,depthBgColor:p,isContainer:b}=i,v=m==="vertical"?"V":"H",f=b&&r;return e.jsxs("div",{style:{background:f?p||"#FAFAF9":"#FFFFFF",borderLeft:f?`2px solid ${a}40`:`3px solid ${a}`,borderTop:`1px solid ${f?a+"30":"#E5E5E0"}`,borderRight:`1px solid ${f?a+"30":"#E5E5E0"}`,borderBottom:`1px solid ${f?a+"30":"#E5E5E0"}`,borderRadius:3,padding:f?"0":"8px 12px",minWidth:f?void 0:"200px",boxShadow:"none",width:"100%",height:"100%",boxSizing:"border-box"},children:[e.jsx(C,{type:"target",position:j.Top,id:"top",style:gt}),e.jsx(C,{type:"source",position:j.Bottom,id:"bottom",style:gt}),e.jsx(C,{type:"target",position:j.Left,id:"left",style:gt}),e.jsx(C,{type:"source",position:j.Right,id:"right",style:gt}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",padding:f?"8px 12px":"0"},children:[io(n.kind)&&e.jsx(Ge,{size:24,color:a}),l&&e.jsx("button",{onClick:k=>{k.stopPropagation(),F()},style:{width:"20px",height:"20px",borderRadius:2,border:`1px solid ${a}`,background:r?a+"12":"#FFFFFF",color:a,fontSize:N.md,fontWeight:700,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,padding:0,flexShrink:0,transition:"background 200ms ease, color 200ms ease"},title:r?"Collapse":"Expand",children:r?"−":"+"}),l&&I&&e.jsx("button",{onClick:k=>{k.stopPropagation(),y()},style:{width:"20px",height:"20px",borderRadius:"4px",border:"1.5px solid #10b981",background:"transparent",color:"#10b981",fontSize:"9px",fontWeight:700,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,flexShrink:0,transition:"background 200ms ease"},title:`Direction: ${m}. Click to toggle`,children:v}),e.jsx("span",{style:{fontSize:N.md,fontWeight:600,color:f?a:"#1a1a1a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n.name})]}),!f&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"3px",paddingLeft:l?"26px":"14px"},children:[e.jsx("span",{style:{fontSize:N.badge,color:"#9CA3AF"},children:n.kind}),l&&e.jsxs("span",{style:{fontSize:"9px",color:"#6B7280",background:"#F0F0ED",padding:"1px 5px",borderRadius:2,fontWeight:600},children:[x," parts",r?"":" (collapsed)"]})]})]})}const gt={width:"8px",height:"8px",background:"#2DD4A8",border:"1.5px solid #FFFFFF",opacity:0},ki=d.memo(Si),xn={top:j.Top,bottom:j.Bottom,left:j.Left,right:j.Right},Ei={top:"bottom",bottom:"top",left:"right",right:"left"},Ci="#6B7280",Rn=t=>t?wt[t]:Ci;function Tn(t,i){if(t==="inout")return"⇄";if(!t)return"";const n=t==="in";switch(i){case"left":return n?"→":"←";case"right":return n?"←":"→";case"top":return n?"↓":"↑";default:return n?"↑":"↓"}}const Ii=104,hn=40,gn=t=>({opacity:0,width:t,height:t,top:"50%",left:"50%",transform:"translate(-50%, -50%)",border:"none",background:"transparent",pointerEvents:"none"});function Di({port:t,onMove:i}){const{getZoom:n}=oo(),a=En(p=>p.transform[2]),r=bi(t.id),l=so()&&!r,x=t.size??no,m=x+5,F=Rn(t.direction),y=t.side==="left"||t.side==="right",I={position:"absolute",fontSize:t.nested?"9.5px":"10.5px",fontWeight:r?750:t.nested?600:650,color:r?"#0F172A":t.nested?"#6B7280":"#374151",opacity:l?.45:1,transition:"color 120ms ease, opacity 120ms ease",whiteSpace:"normal",pointerEvents:"none",overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,width:y?Ii:72,background:"rgba(255,255,255,0.94)",padding:"1px 3px",borderRadius:4,lineHeight:1.12,...t.side==="left"?{left:m,bottom:"50%",marginBottom:2}:t.side==="right"?{right:m,bottom:"50%",marginBottom:2,textAlign:"right"}:t.side==="top"?{top:m,left:"50%",transform:"translateX(-50%)"}:{bottom:m,left:"50%",transform:"translateX(-50%)"}};return e.jsxs("div",{className:"nodrag nopan",style:{position:"absolute",left:t.x,top:t.y,width:x,height:x,zIndex:t.nested?11:10},children:[e.jsx("div",{onPointerEnter:()=>Ue({endpointIds:[t.id]}),onPointerLeave:()=>Ue(null),onPointerDown:i?p=>{p.preventDefault(),p.stopPropagation();const b=p.clientY,v=t.y,f=E=>i(v+(E.clientY-b)/n()),k=()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",k)};window.addEventListener("pointermove",f),window.addEventListener("pointerup",k,{once:!0})}:void 0,title:`${t.name}${t.direction?` (${t.direction})`:""}`,style:{position:"absolute",left:"50%",top:"50%",width:hn,height:hn,transform:`translate(-50%, -50%) scale(${1/Math.max(a,.1)})`,cursor:i?"grab":"default",touchAction:"none"}}),e.jsxs("div",{style:{position:"absolute",inset:0,boxSizing:"border-box",background:"#FFFFFF",border:`2px solid ${F}`,borderRadius:5,boxShadow:r?`0 0 0 4px ${F}33, 0 2px 8px rgba(15,23,42,0.24)`:"0 1px 3px rgba(15,23,42,0.18)",opacity:l?.5:1,display:"flex",alignItems:"center",justifyContent:"center",color:F,fontSize:t.nested?"10px":"12px",fontWeight:800,lineHeight:1,pointerEvents:"none",transition:"box-shadow 120ms ease, opacity 120ms ease"},children:[Tn(t.direction,t.side),e.jsx("span",{style:I,children:t.name.replace(/([a-z0-9])([A-Z])/g,"$1$2")}),[{suffix:"",pos:xn[t.side]},{suffix:ti,pos:xn[Ei[t.side]]}].flatMap(p=>[e.jsx(C,{className:"ibd-port-anchor",type:"source",id:`${t.id}${p.suffix}`,position:p.pos,style:gn(x),isConnectable:!1},`s${p.suffix}`),e.jsx(C,{className:"ibd-port-anchor",type:"target",id:`${t.id}${p.suffix}`,position:p.pos,style:gn(x),isConnectable:!1},`t${p.suffix}`)])]})]})}function fn({side:t,direction:i}){const n=Rn(i),a=no;return e.jsx("div",{"aria-label":`implicit ${i} port`,title:`Implicit ${i} port — relationship targets the part directly`,style:{position:"absolute",top:"50%",left:t==="left"?-a/2:void 0,right:t==="right"?-a/2:void 0,transform:"translateY(-50%)",width:a,height:a,boxSizing:"border-box",background:"#FFFFFF",border:`2px solid ${n}`,borderRadius:4,boxShadow:"0 1px 3px rgba(15,23,42,0.18)",display:"flex",alignItems:"center",justifyContent:"center",color:n,fontSize:11,fontWeight:800,lineHeight:1,zIndex:4,pointerEvents:"none"},children:Tn(i,t)})}const ft={width:8,height:8,background:"#2DD4A8",border:"1.5px solid #FFFFFF",opacity:0};function mn({name:t,kind:i,nameColor:n,typeColor:a,frame:r=!1}){return e.jsxs("span",{title:`${t} : ${i}`,style:{display:"flex",flexDirection:r?"row":"column",alignItems:r?"baseline":"flex-start",gap:r?6:1,minWidth:0,overflow:"hidden",flex:1},children:[e.jsx("span",{style:{display:r?"block":"-webkit-box",width:"100%",minWidth:0,fontSize:r?N.md:N.sm,lineHeight:1.2,fontWeight:700,color:n,whiteSpace:r?"nowrap":"normal",overflow:"hidden",textOverflow:"ellipsis",WebkitBoxOrient:"vertical",WebkitLineClamp:r?void 0:2,overflowWrap:"anywhere"},children:t}),e.jsx("span",{style:{display:"block",maxWidth:"100%",fontSize:"9px",lineHeight:1.15,fontWeight:650,letterSpacing:"0.055em",textTransform:"uppercase",color:a,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r?`: ${i}`:`«${i}»`})]})}function yn({label:t,isCollapsed:i,onToggle:n,color:a,onColor:r}){return e.jsx("button",{"aria-label":i?`Expand ${t}`:`Collapse ${t}`,onClick:l=>{l.stopPropagation(),n()},style:{marginLeft:"auto",width:18,height:18,padding:0,borderRadius:3,border:r?"1px solid rgba(255,255,255,0.7)":`1px solid ${a}88`,background:r?"rgba(255,255,255,0.18)":"#FFFFFF",color:r?"#FFFFFF":a,fontSize:13,lineHeight:"15px",cursor:"pointer",fontWeight:700,flexShrink:0},children:i?"+":"−"})}function Ni({id:t,data:i,selected:n,height:a}){const r=i,{label:l,kind:x,color:m,isContainer:F,isFrame:y,ports:I,implicitIn:p,implicitOut:b,onPortMove:v,hasChildren:f,isCollapsed:k,onToggleCollapse:E}=r,[D,O]=d.useState(!1),M=n?ie.selected:y?"none":D?"0 8px 20px rgba(15,23,42,0.12)":F?"0 1px 2px rgba(15,23,42,0.05)":"0 2px 8px rgba(15,23,42,0.08)";return e.jsxs("div",{onMouseEnter:()=>O(!0),onMouseLeave:()=>O(!1),style:{width:"100%",height:"100%",boxSizing:"border-box",background:"#FFFFFF",border:y?"1.5px solid #94A3B8":`1px solid ${D?m+"9A":"#CBD5E1"}`,...y?{}:{borderTop:`3px solid ${m}`},borderRadius:y?10:8,boxShadow:M,transition:"box-shadow 150ms ease, border-color 150ms ease",position:"relative"},children:[!y&&e.jsx(kt,{nodeId:t,isVisible:n,minWidth:180,minHeight:100,color:"#2563EB",lineStyle:{borderWidth:1},handleStyle:{width:10,height:10,borderRadius:2}}),e.jsx(C,{type:"target",position:j.Top,id:"top",style:ft}),e.jsx(C,{type:"source",position:j.Bottom,id:"bottom",style:ft}),e.jsx(C,{type:"target",position:j.Left,id:"left",style:ft}),e.jsx(C,{type:"source",position:j.Right,id:"right",style:ft}),y?e.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,height:38,display:"flex",alignItems:"center",gap:8,padding:"0 10px",background:"#F8FAFC",borderBottom:"1px solid #E2E8F0",borderRadius:"9px 9px 0 0"},children:[e.jsx("span",{style:{padding:"2px 6px",borderRadius:4,background:m,color:"#FFFFFF",fontSize:9,fontWeight:800,letterSpacing:"0.08em"},children:"IBD"}),e.jsx(mn,{name:l,kind:x,nameColor:"#0F172A",typeColor:"#64748B",frame:!0}),f&&E&&e.jsx(yn,{label:l,isCollapsed:k,onToggle:E,color:m})]}):e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,minHeight:58,padding:"7px 10px 6px",background:"#FFFFFF",borderBottom:f?"1px solid #E2E8F0":"none",borderRadius:"7px 7px 0 0",overflow:"hidden"},children:[io(x)&&e.jsx(Ge,{size:24,color:m}),e.jsx(mn,{name:l,kind:x,nameColor:"#0F172A",typeColor:F?m:"#64748B"}),f&&E&&e.jsx(yn,{label:l,isCollapsed:k,onToggle:E,color:m})]}),I.map(A=>e.jsx(Di,{port:A,onMove:v?K=>{const Q=A.size??no,_=(y||F?70:62)-Q/2,z=Math.max(_,(a??_+Q+18)-Q-18);v(A.id,Math.min(Math.max(K,_),z))}:void 0},A.id)),p&&e.jsx(fn,{side:"left",direction:"in"}),b&&e.jsx(fn,{side:"right",direction:"out"})]})}const Ai=d.memo(Ni);function bn(t,i){const n=t.map(r=>({...r}));let a=i;for(;n.length>=2&&a>0;){const r=n[0],l=n[1],x=Math.hypot(l.x-r.x,l.y-r.y);if(x<=a)a-=x,n.shift();else{const m=a/x;n[0]={x:r.x+(l.x-r.x)*m,y:r.y+(l.y-r.y)*m},a=0}}return n}function Ri(t,i){const n=bn(t,i);return bn([...n].reverse(),i).reverse()}const Ti=t=>t.slice(1).reduce((i,n,a)=>i+Math.hypot(n.x-t[a].x,n.y-t[a].y),0);function mt(t,i=7){if(t.length<2)return"";let n=`M ${t[0].x},${t[0].y}`;for(let r=1;r<t.length-1;r++){const l=t[r-1],x=t[r],m=t[r+1],F=Math.hypot(x.x-l.x,x.y-l.y),y=Math.hypot(m.x-x.x,m.y-x.y),I=Math.min(i,F/2,y/2),p=x.x-Math.sign(x.x-l.x)*I,b=x.y-Math.sign(x.y-l.y)*I,v=x.x+Math.sign(m.x-x.x)*I,f=x.y+Math.sign(m.y-x.y)*I;n+=` L ${p},${b} Q ${x.x},${x.y} ${v},${f}`}const a=t[t.length-1];return`${n} L ${a.x},${a.y}`}function Bi(t){let i=0,n=-1;for(let x=1;x<t.length;x++){const m=Math.abs(t[x].x-t[x-1].x)+Math.abs(t[x].y-t[x-1].y);m>n&&(n=m,i=x)}const a=t[i-1],r=t[i],l=Math.abs(r.x-a.x)>=Math.abs(r.y-a.y)?{x:0,y:-14}:{x:14,y:0};return{x:(a.x+r.x)/2+l.x,y:(a.y+r.y)/2+l.y}}function Mi(t){var k,E,D,O,M,A,K,Q,_,z,re;const{getZoom:i}=oo(),n=Nn(t.id,[t.source,t.target,(k=t.data)==null?void 0:k.sourcePortId,(E=t.data)==null?void 0:E.targetPortId]),a=so()&&!n,r=((D=t.data)==null?void 0:D.points)??[];if(r.length<2)return null;const l=String(((O=t.style)==null?void 0:O.stroke)??"#2563EB"),x=Number(((M=t.style)==null?void 0:M.strokeWidth)??2),m=n?{...t.style,strokeWidth:x+1.4}:t.style,F=((A=t.data)==null?void 0:A.labelPoint)??Bi(r),y=Math.min(28/Math.max(i(),.1),Ti(r)*.3),I=Ri(r,y),p=(K=t.data)==null?void 0:K.onRouteChange,b=(Q=t.data)==null?void 0:Q.onSelect,v=!!((_=t.data)!=null&&_.flowAnimation),f=r.length===2?[{index:1,a:r[0],b:r[1],straight:!0}]:r.slice(1).map((w,pe)=>({index:pe+1,a:r[pe],b:w,straight:!1})).filter(w=>w.index>=2&&w.index<=r.length-2);return e.jsxs(e.Fragment,{children:[n&&e.jsx("path",{d:mt(r),fill:"none",stroke:l,strokeOpacity:.22,strokeWidth:x+9,strokeLinecap:"round",pointerEvents:"none"}),e.jsx(Cn,{id:t.id,path:mt(r),style:m,markerEnd:t.markerEnd}),v&&e.jsx("path",{d:mt(r),fill:"none",stroke:String(((z=t.style)==null?void 0:z.stroke)??"#2563EB"),strokeWidth:Math.max(2,Number(((re=t.style)==null?void 0:re.strokeWidth)??2)),className:"memo-ibd-flow"}),I.length>=2&&e.jsx("path",{d:mt(I),fill:"none",stroke:"transparent",strokeWidth:18/Math.max(i(),.1),pointerEvents:"stroke",cursor:"pointer",onClick:w=>b==null?void 0:b(w)}),t.label?e.jsx(Jt,{children:e.jsx("div",{style:{position:"absolute",transform:`translate(-50%, -50%) translate(${F.x}px, ${F.y}px)`,fontSize:N.badge,fontWeight:n?700:600,color:n?"#0F172A":"#475569",background:"rgba(255,255,255,0.96)",border:`1px solid ${n?l:"#E2E8F0"}`,opacity:a?.25:1,padding:"1px 4px",borderRadius:4,pointerEvents:"none"},children:t.label})}):null,t.selected&&p?f.map(w=>{const pe=(w.a.x+w.b.x)/2,ee=(w.a.y+w.b.y)/2;return e.jsx(Jt,{children:e.jsx("div",{className:"nodrag nopan",title:"Drag connector segment",onPointerDown:U=>{U.preventDefault(),U.stopPropagation();const qe=U.clientX,Ze=U.clientY,be=Ee=>{const ne=(Ee.clientX-qe)/i(),ue=(Ee.clientY-Ze)/i();if(w.straight){if(Math.abs(ue)>=Math.abs(ne)){const se=w.a.y+ue;p([w.a,{x:w.a.x,y:se},{x:w.b.x,y:se},w.b])}else{const se=(w.a.x+w.b.x)/2+ne;p([w.a,{x:se,y:w.a.y},{x:se,y:w.b.y},w.b])}return}const G=r.map(se=>({...se}));w.a.y===w.b.y?(G[w.index-1].y=w.a.y+ue,G[w.index].y=w.b.y+ue):(G[w.index-1].x=w.a.x+ne,G[w.index].x=w.b.x+ne),p(G)},ke=()=>{window.removeEventListener("pointermove",be),window.removeEventListener("pointerup",ke)};window.addEventListener("pointermove",be),window.addEventListener("pointerup",ke,{once:!0})},style:{position:"absolute",transform:`translate(-50%, -50%) translate(${pe}px, ${ee}px)`,width:12,height:12,borderRadius:3,background:"#FFFFFF",border:"2px solid #2563EB",boxShadow:"0 1px 4px rgba(15,23,42,0.22)",cursor:w.a.y===w.b.y?"ns-resize":"ew-resize",pointerEvents:"all",touchAction:"none",zIndex:20}})},`route-${w.index}`)}):null]})}const Li=d.memo(Mi);function zi({onDrillIn:t,color:i,label:n}){return e.jsx("button",{onClick:a=>{a.stopPropagation(),t()},onDoubleClick:a=>a.stopPropagation(),className:"nodrag",title:`Open ${n} as its own diagram`,"aria-label":`Drill into ${n}`,style:{width:16,height:16,flexShrink:0,padding:0,display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${i}66`,borderRadius:4,background:"#FFFFFF",color:i,fontSize:10,fontWeight:700,lineHeight:1,cursor:"pointer"},children:"↳"})}function $i({data:t,selected:i}){const n=t,{nodeType:a,label:r,laneColor:l,layerColor:x,inPorts:m,outPorts:F}=n,[y,I]=d.useState(!1);if(a==="start")return e.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:"#374151",border:"2px solid #374151",boxShadow:ie.sm},children:e.jsx(C,{type:"source",position:n.flowDirection==="vertical"?j.Bottom:j.Right,style:{background:"#374151",width:6,height:6}})});if(a==="done")return e.jsxs("div",{style:{width:28,height:28,borderRadius:"50%",background:"#FFFFFF",border:"3px solid #374151",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:ie.sm},children:[e.jsx("div",{style:{width:14,height:14,borderRadius:"50%",background:"#374151"}}),e.jsx(C,{type:"target",position:n.flowDirection==="vertical"?j.Top:j.Left,style:{background:"#374151",width:6,height:6}})]});if(a==="fork"||a==="join"){const f=n.flowDirection==="vertical";return e.jsxs("div",{title:a==="fork"?"Fork — split into concurrent flows":"Join — synchronize concurrent flows",style:{width:"100%",height:"100%",background:"#374151",borderRadius:3,boxShadow:ie.sm},children:[e.jsx(C,{type:"target",position:f?j.Top:j.Left,style:{background:"#374151",width:6,height:6,border:"none"}}),e.jsx(C,{type:"source",position:f?j.Bottom:j.Right,style:{background:"#374151",width:6,height:6,border:"none"}})]})}const p=l||x||"#9CA3AF";if(n.isFrame)return e.jsxs("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",background:`${p}08`,border:`1.5px solid ${p}66`,borderRadius:10,boxShadow:i?"0 0 0 3px #2DD4A8":"none",position:"relative"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 14px 0"},children:[n.onToggleExpand&&e.jsx("button",{"aria-label":`Collapse ${r}`,className:"nodrag",onClick:f=>{f.stopPropagation(),n.onToggleExpand()},onDoubleClick:f=>f.stopPropagation(),style:{width:16,height:16,flexShrink:0,padding:0,display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${p}66`,borderRadius:4,background:"#FFFFFF",color:p,fontSize:11,fontWeight:700,lineHeight:1,cursor:"pointer"},children:"−"}),n.onDrillIn&&e.jsx(zi,{onDrillIn:n.onDrillIn,color:p,label:r}),e.jsx("span",{style:{fontSize:N.md,fontWeight:700,color:p,whiteSpace:"nowrap"},children:r}),n.allocatedTo&&e.jsxs("span",{style:{fontSize:"9px",color:"#9CA3AF",whiteSpace:"nowrap"},children:["→"," ",n.allocatedTo]})]}),e.jsx(C,{type:"target",position:n.flowDirection==="vertical"?j.Top:j.Left,style:{background:p,width:8,height:8,border:"2px solid #FFFFFF"}}),e.jsx(C,{type:"source",position:n.flowDirection==="vertical"?j.Bottom:j.Right,style:{background:p,width:8,height:8,border:"2px solid #FFFFFF"}})]});const b=18,v=Math.max(m.length*b,F.length*b,0);return e.jsxs("div",{onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1),style:{background:"#FFFFFF",border:`1.5px solid ${p}`,borderRadius:3,minWidth:"140px",boxShadow:i?"0 0 0 3px #2DD4A8, 0 4px 12px rgba(45, 212, 168, 0.35)":y?`0 0 0 2px ${p}22`:"none",transition:"box-shadow 150ms ease",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"8px 14px",fontSize:N.md,fontWeight:600,color:"#1a1a1a",background:`${p}0D`,borderBottom:v>0?"1px solid #E5E5E0":"none",textAlign:"center",whiteSpace:"nowrap"},children:[r,n.hasChildren&&n.onDrillIn&&e.jsx("button",{"aria-label":`Drill into ${r}`,title:`Open ${r} as its own diagram`,className:"nodrag",onClick:f=>{f.stopPropagation(),n.onDrillIn()},onDoubleClick:f=>f.stopPropagation(),style:{float:"right",marginLeft:4,width:18,height:18,padding:0,border:`1px solid ${p}`,borderRadius:2,background:"#FFFFFF",color:p,fontSize:11,fontWeight:700,lineHeight:"16px",cursor:"pointer"},children:"↳"}),n.hasChildren&&n.onToggleExpand&&e.jsx("button",{"aria-label":n.isExpanded?`Collapse ${r}`:`Expand ${r}`,onClick:f=>{f.stopPropagation(),n.onToggleExpand()},style:{float:"right",marginLeft:8,width:18,height:18,padding:0,border:`1px solid ${p}`,borderRadius:2,background:"#FFFFFF",color:p,fontSize:13,fontWeight:700,lineHeight:"16px",cursor:"pointer"},children:n.isExpanded?"−":"+"})]}),v>0&&e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0"},children:[e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:m.map(f=>e.jsxs("div",{style:{fontSize:N.badge,color:"#6B7280",paddingLeft:"8px",display:"flex",alignItems:"center",height:`${b}px`,gap:"4px"},children:[e.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"#3498DB",flexShrink:0}}),f]},`in-${f}`))}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px",alignItems:"flex-end"},children:F.map(f=>e.jsxs("div",{style:{fontSize:N.badge,color:"#6B7280",paddingRight:"8px",display:"flex",alignItems:"center",height:`${b}px`,gap:"4px"},children:[f,e.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"#E67E22",flexShrink:0}})]},`out-${f}`))})]}),n.allocatedTo&&e.jsxs("div",{style:{fontSize:"9px",color:"#9CA3AF",textAlign:"center",padding:"2px 6px",borderTop:"1px solid #F3F4F6",background:"#FAFAFA"},children:["→"," ",n.allocatedTo]}),e.jsx(C,{type:"target",position:n.flowDirection==="vertical"?j.Top:j.Left,style:{background:p,width:8,height:8,border:"2px solid #FFFFFF"}}),e.jsx(C,{type:"source",position:n.flowDirection==="vertical"?j.Bottom:j.Right,style:{background:p,width:8,height:8,border:"2px solid #FFFFFF"}})]})}const Wi=d.memo($i);function Oi({data:t,selected:i}){const n=t,a=n.orientation==="column";return e.jsx("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",background:`${n.color}08`,border:i?"3px solid #2DD4A8":`1px solid ${n.color}30`,borderLeft:i?"3px solid #2DD4A8":a?`1px solid ${n.color}30`:`3px solid ${n.color}`,borderTop:i?"3px solid #2DD4A8":a?`3px solid ${n.color}`:`1px solid ${n.color}30`,borderRadius:Ws.md,pointerEvents:"auto",cursor:n.inspectElementId?"pointer":"default",display:"flex"},children:e.jsx("div",{style:{writingMode:a?"horizontal-tb":"vertical-rl",transform:a?void 0:"rotate(180deg)",padding:a?"7px 10px":"10px 6px",fontSize:N.xs,fontWeight:700,color:n.color,letterSpacing:"0.04em",textTransform:"uppercase",alignSelf:a?"flex-start":"center",width:a?"100%":void 0,textAlign:a?"center":void 0,whiteSpace:"nowrap"},children:n.label})})}const Pi=d.memo(Oi);function Fn({onDrillIn:t,color:i,label:n}){return e.jsx("button",{onClick:a=>{a.stopPropagation(),t()},onDoubleClick:a=>a.stopPropagation(),className:"nodrag",title:`Open ${n} as its own diagram`,"aria-label":`Drill into ${n}`,style:{width:16,height:16,flexShrink:0,padding:0,display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${i}66`,borderRadius:4,background:"#FFFFFF",color:i,fontSize:10,fontWeight:700,lineHeight:1,cursor:"pointer"},children:"↳"})}function wn({collapsed:t,onToggle:i,color:n}){return e.jsx("button",{onClick:a=>{a.stopPropagation(),i()},onDoubleClick:a=>a.stopPropagation(),className:"nodrag",title:t?"Show substates":"Hide substates","aria-label":t?"Show substates":"Hide substates",style:{width:16,height:16,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${n}66`,borderRadius:4,background:"#FFFFFF",color:n,fontSize:11,fontWeight:700,lineHeight:1,cursor:"pointer"},children:t?"+":"−"})}const yt={width:8,height:8,border:"none",background:"transparent",opacity:0};function Xt(){return e.jsxs(e.Fragment,{children:[e.jsx(C,{type:"target",position:j.Top,id:"top",style:yt}),e.jsx(C,{type:"source",position:j.Bottom,id:"bottom",style:yt}),e.jsx(C,{type:"target",position:j.Left,id:"left",style:yt}),e.jsx(C,{type:"source",position:j.Right,id:"right",style:yt})]})}function _i({data:t,selected:i}){const n=t,[a,r]=d.useState(!1);if(n.isNote)return e.jsxs("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",background:"#FFFDF5",border:`1px solid ${n.color}66`,borderRadius:4,padding:"6px 10px",boxShadow:ie.sm,display:"flex",flexDirection:"column",justifyContent:"center"},title:n.kind,children:[e.jsx(Xt,{}),e.jsx("span",{style:{fontSize:N.xs,fontWeight:600,color:"#374151",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n.label}),e.jsx("span",{style:{fontSize:"8px",fontWeight:700,color:n.color,textTransform:"uppercase",letterSpacing:"0.05em"},children:n.kind})]});if(n.isContainer)return e.jsxs("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",background:n.isMachine?"transparent":`${n.color}06`,borderTop:n.isMachine?"1.5px dashed #CBD5E1":`1.5px solid ${n.color}55`,borderRight:n.isMachine?"1.5px dashed #CBD5E1":`1.5px solid ${n.color}55`,borderBottom:n.isMachine?"1.5px dashed #CBD5E1":`1.5px solid ${n.color}55`,borderLeft:n.isMachine?"1.5px dashed #CBD5E1":`1.5px solid ${n.color}55`,borderRadius:14,boxShadow:i?ie.selected:"none",position:"relative"},children:[e.jsx(Xt,{}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 14px 0"},children:[n.onToggleCollapse&&!n.isMachine&&e.jsx(wn,{collapsed:!1,onToggle:n.onToggleCollapse,color:n.color}),n.onDrillIn&&!n.isMachine&&e.jsx(Fn,{onDrillIn:n.onDrillIn,color:n.color,label:n.label}),e.jsx("span",{style:{fontSize:N.md,fontWeight:700,color:n.isMachine?"#334155":n.color,whiteSpace:"nowrap"},children:n.label}),e.jsx("span",{style:{fontSize:"8px",fontWeight:700,color:n.isMachine?"#94A3B8":`${n.color}AA`,textTransform:"uppercase",letterSpacing:"0.06em"},children:n.kind})]})]});const l=!!n.hasChildren;return e.jsxs("div",{onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),title:l?`${n.hiddenCount??0} substate${n.hiddenCount===1?"":"s"} hidden — double-click to drill in`:void 0,style:{width:"100%",height:"100%",boxSizing:"border-box",background:"#FFFFFF",borderTop:`3px solid ${n.color}`,borderRight:`1px solid ${a?`${n.color}9A`:"#CBD5E1"}`,borderBottom:`1px solid ${a?`${n.color}9A`:"#CBD5E1"}`,borderLeft:`1px solid ${a?`${n.color}9A`:"#CBD5E1"}`,borderRadius:12,boxShadow:i?ie.selected:a?"0 8px 20px rgba(15,23,42,0.12)":ie.md,transition:"box-shadow 150ms ease, border-color 150ms ease",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,padding:"4px 12px"},children:[e.jsx(Xt,{}),e.jsx("span",{style:{fontSize:N.md,fontWeight:600,color:"#1a1a1a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:n.label}),n.subtitle&&e.jsx("span",{style:{fontSize:"8px",fontWeight:600,color:"#9CA3AF",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:n.subtitle}),l&&e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:5},children:[n.onToggleCollapse&&e.jsx(wn,{collapsed:!0,onToggle:n.onToggleCollapse,color:n.color}),n.onDrillIn&&e.jsx(Fn,{onDrillIn:n.onDrillIn,color:n.color,label:n.label}),e.jsxs("span",{style:{fontSize:"8px",fontWeight:700,color:n.color,letterSpacing:"0.05em"},children:["⊞ ",n.hiddenCount??0]})]})]})}const Hi=d.memo(_i),to="#3498DB";function Ki({data:t}){const i=t;return e.jsxs("div",{style:{width:"100%",height:"100%",position:"relative",pointerEvents:"none"},children:[e.jsx("div",{style:{position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",minWidth:140,maxWidth:"90%",padding:"10px 16px",background:"#FFFFFF",border:`1.5px solid ${to}`,borderRadius:8,boxShadow:ie.md,textAlign:"center",fontSize:N.md,fontWeight:600,color:"#1a1a1a",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i.label}),e.jsx("div",{style:{position:"absolute",top:44,bottom:0,left:"50%",borderLeft:`1.5px dashed ${to}66`}})]})}const Vi=d.memo(Ki);function Yi({data:t}){const i=t;return e.jsx("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",background:"#1B3A4B06",border:"1px solid #1B3A4B22",borderRadius:10,pointerEvents:"none"},children:e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8,padding:"8px 14px"},children:[e.jsx("span",{style:{fontSize:N.sm,fontWeight:700,color:"#1B3A4B"},children:i.label}),i.scenario&&e.jsxs("span",{style:{fontSize:N.xs,color:"#6B7280"},children:["realizes ",i.scenario]})]})})}const Ui=d.memo(Yi),bt={width:6,height:6,border:"none",background:"transparent",opacity:0};function Xi({data:t,selected:i}){const n=t;return e.jsxs("div",{style:{width:14,height:14,borderRadius:"50%",background:"#FFFFFF",border:`3px solid ${to}`,boxShadow:i?ie.selected:ie.sm,position:"relative"},title:n.kind,children:[e.jsx(C,{type:"source",id:"right",position:j.Right,style:bt}),e.jsx(C,{type:"target",id:"right",position:j.Right,style:bt}),e.jsx(C,{type:"source",id:"left",position:j.Left,style:bt}),e.jsx(C,{type:"target",id:"left",position:j.Left,style:bt}),e.jsx("span",{style:{position:"absolute",top:-20,left:"50%",transform:"translateX(-50%)",fontSize:"9px",fontWeight:600,color:"#374151",whiteSpace:"nowrap",background:"#FFFFFFCC",padding:"1px 5px",borderRadius:4},children:n.label})]})}const Gi=d.memo(Xi),vt={opacity:0,width:1,height:1},qi=d.memo(function({data:i}){const n=i;return e.jsxs("div",{style:{width:"100%",height:"100%",display:"grid",placeItems:"center",textAlign:"center",padding:"12px 22px",border:`2px solid ${n.color??"#E67E22"}`,borderRadius:"50%",background:"#FFF9F2",color:"#2D3748",fontSize:13,fontWeight:600,lineHeight:1.25},children:[n.label,e.jsx(C,{type:"target",position:j.Left,style:vt}),e.jsx(C,{type:"source",position:j.Right,style:vt})]})}),Zi=d.memo(function({data:i}){const n=i,a=n.side==="right"?j.Left:j.Right;return e.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#334155",fontSize:12,fontWeight:600,textAlign:"center",gap:3},children:[e.jsx(Ge,{color:n.color??"#334155"}),e.jsx("span",{children:n.label}),e.jsx(C,{type:"source",position:a,style:vt}),e.jsx(C,{type:"target",position:a,style:vt})]})}),Qi=d.memo(function({data:i}){const n=i;return e.jsx("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",border:"1.5px solid #64748B",background:"rgba(255,255,255,0.32)",padding:"10px 14px",color:"#475569",fontSize:12,fontWeight:700},children:n.label})});d.memo(function({data:i}){const n=i;return e.jsx("div",{style:{width:"100%",textAlign:"center",color:"#64748B",fontSize:11,fontWeight:700,letterSpacing:".03em"},children:n.label})});function Ji(t,i=0){if(t.length<2)return"";if(i===0||t.length===2)return`M ${t.map(r=>`${r.x},${r.y}`).join(" L ")}`;let n=`M ${t[0].x},${t[0].y}`;for(let r=1;r<t.length-1;r++){const l=t[r-1],x=t[r],m=t[r+1],F=Math.min(i,Math.abs(x.x-l.x)/2+Math.abs(x.y-l.y)/2),y=Math.min(i,Math.abs(m.x-x.x)/2+Math.abs(m.y-x.y)/2),I={x:x.x+Math.sign(l.x-x.x)*F,y:x.y+Math.sign(l.y-x.y)*F},p={x:x.x+Math.sign(m.x-x.x)*y,y:x.y+Math.sign(m.y-x.y)*y};n+=` L ${I.x},${I.y} Q ${x.x},${x.y} ${p.x},${p.y}`}const a=t[t.length-1];return`${n} L ${a.x},${a.y}`}const er=d.memo(function(i){var b,v,f,k,E;const n=Nn(i.id,[i.source,i.target]),a=so()&&!n,r=((b=i.data)==null?void 0:b.routing)??"rounded",l=Array.isArray((v=i.data)==null?void 0:v.points)?i.data.points:[],x=l.length>=2?l:[{x:i.sourceX,y:i.sourceY},{x:i.targetX,y:i.targetY}],F=r==="straight"?`M ${i.sourceX},${i.sourceY} L ${i.targetX},${i.targetY}`:Ji(x,r==="elbow"?0:r==="rounded"?16:r==="curved"?30:42),y=((f=i.data)==null?void 0:f.labelPoint)??x[Math.floor(x.length/2)]??{x:(i.sourceX+i.targetX)/2,y:(i.sourceY+i.targetY)/2},I=String(((k=i.style)==null?void 0:k.stroke)??"#64748B"),p=Number(((E=i.style)==null?void 0:E.strokeWidth)??1.5);return e.jsxs(e.Fragment,{children:[n&&e.jsx("path",{d:F,fill:"none",stroke:I,strokeOpacity:.22,strokeWidth:p+9,strokeLinecap:"round",pointerEvents:"none"}),e.jsx(Cn,{path:F,style:n?{...i.style,strokeWidth:p+1.4}:i.style}),i.label&&e.jsx(Jt,{children:e.jsx("div",{className:"nodrag nopan",style:{position:"absolute",transform:`translate(-50%, -50%) translate(${y.x}px,${y.y}px)`,background:"#FFFFFF",padding:"2px 5px",borderRadius:3,color:n?"#0F172A":"#334155",fontSize:12,pointerEvents:"all",fontWeight:n?700:void 0,opacity:a?.25:1},children:i.label})})]})}),Ft={opacity:0,width:1,height:1};function Bn(){return e.jsxs(e.Fragment,{children:[e.jsx(C,{type:"target",position:j.Left,style:Ft}),e.jsx(C,{type:"source",position:j.Right,style:Ft}),e.jsx(C,{type:"target",position:j.Top,style:Ft}),e.jsx(C,{type:"source",position:j.Bottom,style:Ft})]})}const tr=d.memo(function({data:i}){const n=i;return e.jsxs("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",display:"grid",placeItems:"center",padding:"14px 18px",textAlign:"center",border:"2px solid #0F766E",borderRadius:8,background:"#F0FDFA",color:"#134E4A",fontSize:15,fontWeight:700,lineHeight:1.25,boxShadow:"0 2px 7px rgba(15, 118, 110, 0.16)"},children:[e.jsxs("span",{children:[e.jsx("small",{style:{display:"block",marginBottom:5,color:"#0F766E",fontSize:10,letterSpacing:".08em"},children:"SYSTEM OF INTEREST"}),n.label]}),e.jsx(Bn,{})]})}),or=d.memo(function({data:i}){const n=i,a=n.category==="environment"?{border:"#7C3AED",fill:"#F5F3FF",text:"#4C1D95",tag:"ENVIRONMENT"}:n.category==="person"?{border:"#2563EB",fill:"#EFF6FF",text:"#1E3A8A",tag:"ACTOR"}:{border:"#64748B",fill:"#F8FAFC",text:"#334155",tag:"EXTERNAL SYSTEM"};return e.jsxs("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:3,padding:"10px 14px",textAlign:"center",border:`1.5px solid ${a.border}`,borderRadius:7,background:a.fill,color:a.text,fontSize:13,fontWeight:650,lineHeight:1.25},children:[n.category==="person"&&e.jsx(Ge,{size:26,color:a.border}),e.jsxs("span",{children:[e.jsx("small",{style:{display:"block",marginBottom:4,color:a.border,fontSize:9,letterSpacing:".07em"},children:a.tag}),n.label]}),e.jsx(Bn,{})]})}),nr=d.memo(function({data:i}){const n=i;return e.jsx("div",{style:{width:"100%",height:"100%",boxSizing:"border-box",border:"2px solid #0F766E",borderRadius:12,background:"rgba(240, 253, 250, 0.34)",padding:"12px 16px",color:"#0F766E",fontSize:12,fontWeight:750,letterSpacing:".04em"},children:n.label})}),sr=d.memo(function({id:i,data:n,selected:a}){var M;const r=n,[l,x]=d.useState(!1),[m,F]=d.useState(""),[y,I]=d.useState(!1),p=d.useRef(null),b=d.useCallback(()=>{F(r.label),x(!0),setTimeout(()=>{var A;(A=p.current)==null||A.select()},10)},[r.label]),v=d.useCallback(()=>{var K;x(!1);const A=m.trim();A&&A!==r.label&&((K=r.onInlineEdit)==null||K.call(r,i,A))},[m,r,i]),f=d.useCallback(A=>{A.key==="Enter"&&(A.preventDefault(),v()),A.key==="Escape"&&x(!1)},[v]),k=d.useCallback(A=>{var K;A.preventDefault(),(K=r.onContextMenu)==null||K.call(r,A,i)},[r,i]),E=r.bgColor??"#FFFFFF",D=r.color,O={background:D,border:"2px solid #FFFFFF",width:10,height:10,opacity:y||a?1:0,transition:"opacity 0.15s"};return e.jsxs("div",{onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1),onContextMenu:k,onDoubleClick:b,style:{minWidth:120,minHeight:40,background:E,borderLeft:`3px solid ${D}`,borderRadius:8,boxShadow:a?`0 0 0 2px ${D}, 0 4px 12px ${D}44`:y?"0 4px 16px rgba(0,0,0,0.14)":"0 1px 4px rgba(0,0,0,0.08)",cursor:l?"text":"grab",position:"relative",transition:"box-shadow 0.15s",opacity:r.isNew?.7:1},children:[a&&e.jsx(kt,{minWidth:80,minHeight:36,maxWidth:600,maxHeight:400,color:D,lineStyle:{borderColor:D},handleStyle:{background:D,border:"2px solid #fff",width:10,height:10,borderRadius:2}}),e.jsxs("div",{style:{padding:"8px 12px",userSelect:"none",display:"flex",gap:8,alignItems:"center"},children:[io(r.kind)&&e.jsx(Ge,{size:26,color:D}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:"9px",fontWeight:700,color:D,textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:2},children:r.kind}),l?e.jsx("input",{ref:p,value:m,onChange:A=>F(A.target.value),onBlur:v,onKeyDown:f,onClick:A=>A.stopPropagation(),autoFocus:!0,style:{fontSize:N.sm,fontWeight:500,color:"#1a1a1a",background:"transparent",border:"none",outline:"none",width:"100%",padding:0}}):e.jsx("div",{style:{fontSize:N.sm,fontWeight:500,color:"#1a1a1a",lineHeight:1.3,wordBreak:"break-word"},children:r.label||r.kind}),r.isNew&&e.jsx("div",{style:{fontSize:"9px",color:"#9CA3AF",marginTop:2},children:"saving…"})]})]}),!!((M=r.compartments)!=null&&M.length)&&e.jsx("div",{style:{borderTop:"1px solid #EDEDEA",padding:"5px 12px 7px",userSelect:"none"},children:r.compartments.map(A=>e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"baseline",fontSize:"10px",lineHeight:"15px",whiteSpace:"nowrap",overflow:"hidden"},children:[e.jsx("span",{style:{color:"#9CA3AF"},children:A.key}),e.jsx("span",{style:{color:"#4B5563",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis"},children:A.value})]},A.key))}),e.jsx(C,{type:"target",position:j.Top,style:{...O,top:-5}}),e.jsx(C,{type:"source",position:j.Bottom,style:{...O,bottom:-5},id:"bottom"}),e.jsx(C,{type:"source",position:j.Right,style:{...O,right:-5},id:"right"}),e.jsx(C,{type:"target",position:j.Left,style:{...O,left:-5}})]})});function Gt({collapsed:t,onToggleCollapse:i,elementIds:n=[]}){const a=L(b=>b.model),r=L(b=>b.selectedElementId),l=L(b=>b.inspectElement),[x,m]=d.useState(""),[F,y]=d.useState(new Set),I=d.useMemo(()=>{var k;if(!a)return[];const b=x.trim().toLowerCase(),v=new Map,f=new Set(n);for(const E of n){const D=(k=a.elements[E])==null?void 0:k.allocatedTo;D&&f.add(D)}for(const E of f){const D=a.elements[E];D&&(b&&!D.name.toLowerCase().includes(b)&&!D.kind.toLowerCase().includes(b)||(v.has(D.kind)||v.set(D.kind,[]),v.get(D.kind).push(D)))}return[...v.entries()].map(([E,D])=>({kind:E,elements:D.sort((O,M)=>O.name.localeCompare(M.name))})).sort((E,D)=>E.kind.localeCompare(D.kind))},[a,n,x]),p=b=>y(v=>{const f=new Set(v);return f.has(b)?f.delete(b):f.add(b),f});return t?e.jsxs("button",{className:"flex flex-col items-center py-2 gap-1 cursor-pointer",style:{width:36,border:0,borderRight:"1px solid #E5E5E0",background:"#FAFAF8",flexShrink:0},onClick:i,title:"Expand diagram elements","aria-label":"Expand diagram elements",children:[e.jsx("span",{style:{color:"#6B7280",fontSize:18},children:"›"}),e.jsx("span",{style:{fontSize:10,color:"#6B7280",writingMode:"vertical-rl"},children:"Diagram Elements"})]}):e.jsxs("div",{className:"flex flex-col overflow-hidden",style:{width:240,borderRight:"1px solid #E5E5E0",background:"#FAFAF8",flexShrink:0},children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:"1px solid #E5E5E0",flexShrink:0},children:[e.jsx("span",{style:{fontSize:N.xs,fontWeight:600,color:"#374151"},children:"Diagram Elements"}),e.jsx("button",{onClick:i,title:"Collapse diagram elements","aria-label":"Collapse diagram elements",style:{background:"none",border:"none",cursor:"pointer",color:"#6B7280",fontSize:18,lineHeight:1},children:"‹"})]}),e.jsx("div",{className:"px-2 pt-2 pb-1",style:{flexShrink:0},children:e.jsx("input",{value:x,onChange:b=>m(b.target.value),placeholder:"Search elements…",className:"w-full px-2 py-1 rounded focus:outline-none",style:{fontSize:N.xs,background:"#F0F0ED",border:"1px solid #E5E5E0",color:"#374151"}})}),e.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[I.map(b=>{var k;const v=F.has(b.kind),f=In[(k=b.elements[0])==null?void 0:k.layer]??"#6B7280";return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>p(b.kind),className:"w-full flex items-center gap-1.5 px-2 py-1",style:{background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[e.jsx("span",{style:{fontSize:10,color:f},children:v?"▶":"▼"}),e.jsx("span",{className:"truncate",style:{fontSize:10,color:f,fontWeight:700},children:b.kind}),e.jsx("span",{style:{fontSize:9,color:"#9CA3AF",marginLeft:"auto"},children:b.elements.length})]}),!v&&b.elements.map(E=>{const D=r===E.id;return e.jsxs("button",{onClick:()=>l(E.id),className:"w-full flex items-center gap-2 px-3 py-1.5 text-left",style:{border:"none",cursor:"pointer",fontSize:N.xs,background:D?"#DDF7EF":"transparent",color:D?"#116149":"#374151",fontWeight:D?600:400},title:`Highlight ${E.name} in diagram`,children:[e.jsx("span",{style:{width:8,height:8,borderRadius:2,background:f,flexShrink:0}}),e.jsx("span",{className:"truncate flex-1",children:E.name})]},E.id)})]},b.kind)}),I.length===0&&e.jsx("div",{className:"p-3 text-center",style:{color:"#9CA3AF",fontSize:N.xs},children:x?"No matching elements":"No elements in this diagram"})]})]})}function J({label:t,icon:i,danger:n,onClick:a}){return e.jsxs("button",{onClick:a,className:"w-full flex items-center gap-2 px-3 py-1.5 text-left",style:{background:"none",border:"none",cursor:"pointer",fontSize:N.xs},onMouseEnter:r=>{r.currentTarget.style.background=n?"#FEF2F2":"#F7F7F5"},onMouseLeave:r=>{r.currentTarget.style.background="none"},children:[i&&e.jsx("span",{style:{fontSize:"12px",width:16,textAlign:"center"},children:i}),e.jsx("span",{style:{color:n?"#DC2626":"#1a1a1a"},children:t})]})}function jt(){return e.jsx("div",{style:{height:1,background:"#E5E5E0",margin:"2px 0"}})}function Mn({x:t,y:i,onClose:n,children:a}){const r=d.useRef(null);d.useEffect(()=>{const F=I=>{r.current&&!r.current.contains(I.target)&&n()},y=I=>{I.key==="Escape"&&n()};return document.addEventListener("mousedown",F),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",F),document.removeEventListener("keydown",y)}},[n]);const l=210,x=Math.min(t,window.innerWidth-l-8),m=Math.min(i,window.innerHeight-200);return e.jsx("div",{ref:r,className:"fixed z-50 rounded-xl overflow-hidden py-1",style:{left:x,top:m,minWidth:l,background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 8px 32px rgba(0,0,0,0.14)"},children:a})}const ir=[{label:"Layer default",value:""},{label:"Mint",value:"#E8F5E9"},{label:"Sky",value:"#E3F2FD"},{label:"Amber",value:"#FFF8E1"},{label:"Rose",value:"#FFF0F0"},{label:"Lavender",value:"#F3E5F5"},{label:"Peach",value:"#FBE9E7"}];function rr({x:t,y:i,nodeId:n,nodeKind:a,onClose:r,onEditName:l,onChangeColor:x,onRemoveFromDiagram:m,onDeleteFromModel:F,onLinkRisk:y,onLinkRequirement:I,onShowProperties:p,onFocusElement:b,onShowInCatalog:v,onShowRelMatrix:f,onOpenSource:k,onViewKindInOntology:E}){const[D,O]=d.useState(!1);return e.jsxs(Mn,{x:t,y:i,onClose:r,children:[e.jsxs("div",{className:"px-3 py-1.5",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:600,color:"#9CA3AF"},children:a}),e.jsx("div",{style:{fontSize:"9px",color:"#D1D5DB",fontFamily:"monospace"},children:n})]}),p&&e.jsx(J,{label:"Show Properties",icon:"ℹ",onClick:()=>{r(),p()}}),v&&e.jsx(J,{label:"Show in Catalog",icon:"☰",onClick:()=>{r(),v()}}),b&&e.jsx(J,{label:"Focus on Element",icon:"◎",onClick:()=>{r(),b()}}),f&&e.jsx(J,{label:"Show Relationship Matrix",icon:"☷",onClick:()=>{r(),f()}}),E&&e.jsx(J,{label:"View Kind in Ontology",icon:"⬡",onClick:()=>{r(),E()}}),k&&e.jsx(J,{label:"Open Source File",icon:"⟨/⟩",onClick:()=>{r(),k()}}),(p||v||b||f||E||k)&&e.jsx(jt,{}),e.jsx(J,{label:"Edit name",icon:"✏️",onClick:()=>{r(),l()}}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-1.5",style:{background:"none",border:"none",cursor:"pointer",fontSize:N.xs},onMouseEnter:M=>{O(!0),M.currentTarget.style.background="#F7F7F5"},onMouseLeave:M=>{M.currentTarget.style.background="none"},children:[e.jsx("span",{style:{fontSize:"12px",width:16,textAlign:"center"},children:"🎨"}),e.jsx("span",{style:{flex:1,textAlign:"left",color:"#1a1a1a"},children:"Change color"}),e.jsx("span",{style:{color:"#9CA3AF",fontSize:"10px"},children:"▶"})]}),D&&e.jsx("div",{className:"absolute left-full top-0 rounded-xl overflow-hidden py-1",style:{background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 4px 16px rgba(0,0,0,0.12)",minWidth:160},onMouseEnter:()=>O(!0),onMouseLeave:()=>O(!1),children:ir.map(M=>e.jsxs("button",{onClick:()=>{r(),x(M.value)},className:"w-full flex items-center gap-2.5 px-3 py-1.5",style:{background:"none",border:"none",cursor:"pointer"},onMouseEnter:A=>{A.currentTarget.style.background="#F7F7F5"},onMouseLeave:A=>{A.currentTarget.style.background="none"},children:[e.jsx("div",{style:{width:14,height:14,borderRadius:3,flexShrink:0,background:M.value||"#E5E5E0",border:"1px solid #D1D5DB"}}),e.jsx("span",{style:{fontSize:N.xs,color:"#374151"},children:M.label})]},M.value))})]}),e.jsx(jt,{}),y&&e.jsx(J,{label:"Link Risk",icon:"⚠️",onClick:()=>{r(),y()}}),I&&e.jsx(J,{label:"Link Requirement",icon:"📋",onClick:()=>{r(),I()}}),(y||I)&&e.jsx(jt,{}),e.jsx(J,{label:"Remove from diagram",icon:"↩️",onClick:()=>{r(),m()}}),e.jsx(J,{label:"Delete from model",icon:"🗑️",danger:!0,onClick:()=>{window.confirm(`Delete ${n} from the model? This cannot be undone.`)&&(r(),F())}})]})}const ar=[{label:"Auto",value:""},{label:"Red",value:"#EF4444"},{label:"Blue",value:"#3B82F6"},{label:"Green",value:"#10B981"},{label:"Orange",value:"#F59E0B"},{label:"Gray",value:"#6B7280"}];function lr({x:t,y:i,edgeId:n,relType:a,onClose:r,onChangeStyle:l,onChangeColor:x,onToggleLabel:m,onDelete:F}){return e.jsxs(Mn,{x:t,y:i,onClose:r,children:[e.jsxs("div",{className:"px-3 py-1.5",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:600,color:"#9CA3AF"},children:a}),e.jsx("div",{style:{fontSize:"9px",color:"#D1D5DB",fontFamily:"monospace"},children:n})]}),e.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2",children:[e.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",minWidth:40},children:"Style"}),["solid","dashed","dotted"].map(y=>e.jsx("button",{onClick:()=>{r(),l(y)},style:{fontSize:"10px",padding:"2px 8px",border:"1px solid #E5E5E0",borderRadius:4,cursor:"pointer",background:"#F7F7F5",color:"#374151"},children:y},y))]}),e.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",minWidth:40,flexShrink:0},children:"Color"}),ar.map(y=>e.jsx("button",{onClick:()=>{r(),x(y.value)},title:y.label,style:{width:16,height:16,borderRadius:"50%",background:y.value||"#E5E5E0",border:"1px solid #D1D5DB",cursor:"pointer"}},y.value))]}),e.jsx(jt,{}),e.jsx(J,{label:"Toggle label",icon:"🏷️",onClick:()=>{r(),m()}}),e.jsx(J,{label:"Delete edge",icon:"🗑️",danger:!0,onClick:()=>{r(),F()}})]})}const dr=d.memo(function({id:i,data:n,selected:a}){const r=n,l=r.color??r.layerColor??"#E67E22",x=80,m=d.useCallback(F=>{var y;F.preventDefault(),(y=r.onContextMenu)==null||y.call(r,F,i)},[r,i]);return e.jsxs("div",{style:{width:x,height:x,position:"relative"},onContextMenu:m,children:[a&&e.jsx(kt,{minWidth:60,minHeight:60}),e.jsx("svg",{width:x,height:x,style:{position:"absolute",top:0,left:0},children:e.jsx("polygon",{points:`${x/2},4 ${x-4},${x/2} ${x/2},${x-4} 4,${x/2}`,fill:r.color?r.color+"44":"#FFF8E1",stroke:l,strokeWidth:a?2.5:1.5})}),e.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px",fontWeight:600,color:"#374151",textAlign:"center",padding:"4px 8px",pointerEvents:"none"},children:r.condition||r.label||"?"}),e.jsx(C,{type:"target",position:j.Top,style:{background:l,border:"2px solid #fff"}}),e.jsx(C,{type:"source",position:j.Right,style:{background:l,border:"2px solid #fff"},id:"right"}),e.jsx(C,{type:"source",position:j.Bottom,style:{background:l,border:"2px solid #fff"},id:"bottom"}),e.jsx(C,{type:"target",position:j.Left,style:{background:l,border:"2px solid #fff"}})]})}),cr=d.memo(function({id:i,data:n,selected:a}){const r=n,l=(r.orientation??"horizontal")==="horizontal",x=l?120:8,m=l?8:60,F=d.useCallback(y=>{var I;y.preventDefault(),(I=r.onContextMenu)==null||I.call(r,y,i)},[r,i]);return e.jsxs("div",{style:{width:x,height:m,background:"#1a1a1a",borderRadius:4,position:"relative"},title:r.nodeType==="join"?"Join (synchronization)":"Fork (parallel)",onContextMenu:F,children:[a&&e.jsx(kt,{minWidth:40,minHeight:6}),l?e.jsxs(e.Fragment,{children:[e.jsx(C,{type:"target",position:j.Left,style:{background:"#2DD4A8",border:"2px solid #fff",left:-1}}),e.jsx(C,{type:"source",position:j.Top,style:{background:"#2DD4A8",border:"2px solid #fff",top:-1},id:"top"}),e.jsx(C,{type:"source",position:j.Bottom,style:{background:"#2DD4A8",border:"2px solid #fff",bottom:-1},id:"bottom"}),e.jsx(C,{type:"source",position:j.Right,style:{background:"#2DD4A8",border:"2px solid #fff",right:-1},id:"right"})]}):e.jsxs(e.Fragment,{children:[e.jsx(C,{type:"target",position:j.Top,style:{background:"#2DD4A8",border:"2px solid #fff",top:-1}}),e.jsx(C,{type:"source",position:j.Left,style:{background:"#2DD4A8",border:"2px solid #fff",left:-1},id:"left"}),e.jsx(C,{type:"source",position:j.Right,style:{background:"#2DD4A8",border:"2px solid #fff",right:-1},id:"right"}),e.jsx(C,{type:"source",position:j.Bottom,style:{background:"#2DD4A8",border:"2px solid #fff",bottom:-1},id:"bottom"})]})]})}),pr=d.memo(function({id:i,data:n}){const a=n,r=a.nodeType==="start",l=32,x=d.useCallback(m=>{var F;m.preventDefault(),(F=a.onContextMenu)==null||F.call(a,m,i)},[a,i]);return e.jsxs("div",{style:{width:l,height:l,position:"relative"},onContextMenu:x,children:[e.jsx("svg",{width:l,height:l,children:r?e.jsx("circle",{cx:l/2,cy:l/2,r:l/2-2,fill:"#1a1a1a"}):e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:l/2,cy:l/2,r:l/2-2,fill:"#1a1a1a"}),e.jsx("circle",{cx:l/2,cy:l/2,r:l/2-6,fill:"#FFFFFF"}),e.jsx("circle",{cx:l/2,cy:l/2,r:l/2-10,fill:"#1a1a1a"})]})}),r?e.jsx(C,{type:"source",position:j.Bottom,style:{background:"#1a1a1a",border:"2px solid #fff"}}):e.jsx(C,{type:"target",position:j.Top,style:{background:"#1a1a1a",border:"2px solid #fff"}})]})}),ur="#ECEBE6",St="#1B3A4B",ro="#5B6470",xr="0 1px 2px rgba(0,0,0,0.16), 0 0 0 0.5px rgba(0,0,0,0.05)",ye=(t,i)=>e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{display:"block"},children:i}),H={arrowRight:({size:t=16})=>ye(t,e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M4 12h14"}),e.jsx("path",{d:"M13 6l6 6-6 6"})]})),arrowDown:({size:t=16})=>ye(t,e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M12 4v14"}),e.jsx("path",{d:"M6 13l6 6 6-6"})]})),lanes:({size:t=16})=>ye(t,e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"3",y:"5",width:"18",height:"3.4",rx:"1.3"}),e.jsx("rect",{x:"3",y:"10.3",width:"18",height:"3.4",rx:"1.3"}),e.jsx("rect",{x:"3",y:"15.6",width:"18",height:"3.4",rx:"1.3"})]})),grid:({size:t=16})=>ye(t,e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2.5"}),e.jsx("path",{d:"M9.2 3.5v17M14.8 3.5v17M3.5 9.2h17M3.5 14.8h17"})]})),expand:({size:t=16})=>ye(t,e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M15 4h5v5"}),e.jsx("path",{d:"M9 20H4v-5"}),e.jsx("path",{d:"M20 4l-7 7"}),e.jsx("path",{d:"M4 20l7-7"})]})),collapse:({size:t=16})=>ye(t,e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M14 10h5"}),e.jsx("path",{d:"M19 10V5"}),e.jsx("path",{d:"M10 14H5"}),e.jsx("path",{d:"M5 14v5"}),e.jsx("path",{d:"M20 4l-6 6"}),e.jsx("path",{d:"M4 20l6-6"})]})),filter:({size:t=16})=>ye(t,e.jsx("path",{d:"M4 5h16l-6.2 7.4V19l-3.6 1.8v-8.4z"})),back:({size:t=16})=>ye(t,e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M11 5l-6 7 6 7"}),e.jsx("path",{d:"M5 12h14"})]}))};function ce(){return e.jsx("span",{"aria-hidden":"true",style:{width:1,height:18,background:"#E2E1DB",margin:"0 3px",borderRadius:1}})}function qt({options:t,value:i,onChange:n}){return e.jsx("div",{role:"tablist",style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,background:ur,borderRadius:9},children:t.map(a=>{const r=a.value===i;return e.jsxs("button",{role:"tab","aria-selected":r,onClick:()=>n(a.value),title:a.title,className:"flex items-center gap-1.5 text-xs font-semibold",style:{padding:a.label?"3px 9px":"4px 7px",borderRadius:7,border:"none",cursor:"pointer",color:r?St:ro,background:r?"#FFFFFF":"transparent",boxShadow:r?xr:"none",transition:"background 140ms ease, color 140ms ease, box-shadow 140ms ease"},children:[a.icon,a.label&&e.jsx("span",{children:a.label})]},a.value)})})}function hr({children:t}){return e.jsx("div",{style:{display:"inline-flex",alignItems:"center",background:"#FFFFFF",border:"1px solid #E2E1DB",borderRadius:9,overflow:"hidden"},children:rn.Children.toArray(t).map((i,n)=>e.jsxs(rn.Fragment,{children:[n>0&&e.jsx("span",{"aria-hidden":"true",style:{width:1,alignSelf:"stretch",background:"#EDECE7"}}),i]},n))})}function oe({icon:t,label:i,onClick:n,active:a=!1,title:r,ariaExpanded:l,ariaLabel:x}){return e.jsxs("button",{onClick:n,title:r,"aria-label":x,"aria-pressed":a,"aria-expanded":l,className:"flex items-center gap-1.5 text-xs font-semibold",style:{padding:i?"5px 9px":"5px 7px",border:"none",cursor:"pointer",color:a?"#FFFFFF":ro,background:a?St:"transparent",transition:"background 140ms ease, color 140ms ease"},children:[t,i&&e.jsx("span",{children:i})]})}function Ye({icon:t,label:i,onClick:n,active:a=!1,title:r,badge:l}){return e.jsxs("button",{onClick:n,title:r,"aria-pressed":a,className:"flex items-center gap-1.5 text-xs font-semibold",style:{padding:l!=null||i!=null?"5px 9px":"5px 7px",borderRadius:9,border:`1px solid ${a?St:"#E2E1DB"}`,cursor:"pointer",color:a?"#FFFFFF":ro,background:a?St:"#FFFFFF",transition:"background 140ms ease, color 140ms ease, border-color 140ms ease"},children:[t,i!=null&&e.jsx("span",{children:i}),l!=null&&e.jsx("span",{style:{fontSize:11,fontWeight:700,lineHeight:1,padding:"2px 5px",borderRadius:6,background:a?"rgba(255,255,255,0.22)":"#F0EFEA",color:a?"#FFFFFF":"#6B7280"},children:l})]})}const jn="memo-layout-progress";if(typeof document<"u"&&!document.getElementById(jn)){const t=document.createElement("style");t.id=jn,t.textContent="@keyframes memo-layout-progress { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }",document.head.appendChild(t)}const gr={background:"#F7F7F5"},fr={padding:.08,maxZoom:2},mr={background:"#FFFFFF"},yr={hideAttribution:!0},br=[20,20],Fr=50,vn=8e3,wr=90;function jr(t,i){return new Promise((n,a)=>{const r=window.setTimeout(()=>a(new Error(`${i} layout exceeded ${vn/1e3}s`)),vn);t.then(l=>{window.clearTimeout(r),n(l)},l=>{window.clearTimeout(r),a(l)})})}function Sn(t,i){const n=new Map(t.map(p=>[p.id,p])),a=new Map,r=p=>{const b=a.get(p);if(b)return b;const v=n.get(p),f=v.parentId?r(v.parentId):{x:0,y:0},k={x:f.x+v.position.x,y:f.y+v.position.y};return a.set(p,k),k},l=p=>{var b,v;return{width:Number(p.width??((b=p.style)==null?void 0:b.width)??0),height:Number(p.height??((v=p.style)==null?void 0:v.height)??0)}},x=i.flatMap(p=>{var D,O,M,A,K,Q;const b=(_,z,re)=>{var w,pe;if(typeof z=="string"){const ee=(((pe=(w=n.get(_))==null?void 0:w.data)==null?void 0:pe.ports)??[]).find(U=>U.id===z);if(ee){const U=ee.size??20;return{x:ee.x+U/2,y:ee.y+U/2}}}return re},v=b(p.source,(D=p.data)==null?void 0:D.sourcePortId,(O=p.data)==null?void 0:O.sourceOffset),f=b(p.target,(M=p.data)==null?void 0:M.targetPortId,(A=p.data)==null?void 0:A.targetOffset);if(!v||!f||!n.has(p.source)||!n.has(p.target))return[];const k=r(p.source),E=r(p.target);return[{id:p.id,source:{x:k.x+v.x,y:k.y+v.y},target:{x:E.x+f.x,y:E.y+f.y},sourceNodeId:p.source,targetNodeId:p.target,sourceSide:(K=p.data)==null?void 0:K.sourceSide,targetSide:(Q=p.data)==null?void 0:Q.targetSide}]});if(x.length===0)return i;const m=t.filter(p=>!p.data.isFrame).map(p=>({id:p.id,...r(p.id),...l(p)})),F=new Map(x.map(p=>[p.id,p])),y=x.filter(p=>{var b,v;return!((v=(b=i.find(f=>f.id===p.id))==null?void 0:b.data)!=null&&v.manualRoute)}),I=fi(y,m);return i.map(p=>{var v;const b=F.get(p.id);if(!b)return p;if((v=p.data)!=null&&v.manualRoute){const f=[...p.data.points??[]];if(f.length>=2)return f[0]=b.source,f[f.length-1]=b.target,{...p,data:{...p.data,points:f}}}return I.has(p.id)?{...p,data:{...p.data,points:I.get(p.id)}}:p})}function vr({x:t,y:i,onConfirm:n,onCancel:a}){const[r,l]=d.useState(""),x=d.useRef(null);d.useEffect(()=>{var y;(y=x.current)==null||y.focus()},[]),d.useEffect(()=>{const y=I=>{const p=document.getElementById("quick-create-popup");p&&!p.contains(I.target)&&a()};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[a]);const m=Math.min(t,window.innerWidth-220),F=Math.min(i,window.innerHeight-80);return e.jsxs("div",{id:"quick-create-popup",className:"fixed z-50 rounded-xl shadow-xl overflow-hidden",style:{left:m,top:F,width:200,background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 8px 32px rgba(0,0,0,0.14)"},children:[e.jsx("div",{className:"px-3 py-2",style:{borderBottom:"1px solid #E5E5E0",fontSize:N.xs,color:"#9CA3AF",fontWeight:600},children:"New Element"}),e.jsxs("div",{className:"px-2 py-2",children:[e.jsx("input",{ref:x,value:r,onChange:y=>l(y.target.value),placeholder:"Element name…",className:"w-full px-2 py-1.5 rounded focus:outline-none",style:{fontSize:N.xs,border:"1px solid #E5E5E0",background:"#F7F7F5",color:"#1a1a1a"},onKeyDown:y=>{y.key==="Enter"&&r.trim()&&(y.preventDefault(),n(r.trim())),y.key==="Escape"&&a()}}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx("button",{onClick:()=>r.trim()&&n(r.trim()),style:{flex:1,fontSize:N.xs,padding:"4px 8px",background:"#2DD4A8",color:"#FFFFFF",border:"none",borderRadius:6,cursor:"pointer",fontWeight:600},children:"Create"}),e.jsx("button",{onClick:a,style:{fontSize:N.xs,padding:"4px 8px",background:"#F7F7F5",color:"#6B7280",border:"1px solid #E5E5E0",borderRadius:6,cursor:"pointer"},children:"Cancel"})]})]})]})}function Zt({color:t,glyph:i}){return e.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:13,height:13,borderRadius:2,background:t+"22",border:`1.5px solid ${t}`,color:t,fontSize:9,fontWeight:800,lineHeight:1},children:i})}function kn(t,i){if(!t||!i)return[];const n=new Map;for(const x of t.relationships)eo.has(x.type)&&!n.has(x.targetId)&&n.set(x.targetId,x.sourceId);const a=[i],r=new Set(a);let l=i;for(;n.has(l);){const x=n.get(l);if(r.has(x))break;a.unshift(x),r.add(x),l=x}return a}function Qt({path:t,nameOf:i,onFocus:n,rootLabel:a}){if(t.length===0)return null;const r=t.length>1?t[t.length-2]:null;return e.jsxs(e.Fragment,{children:[e.jsx(ce,{}),e.jsx(Ye,{icon:e.jsx(H.back,{}),label:"Parent",onClick:()=>n(r),title:r?`Back to ${i(r)}`:a}),e.jsx("button",{onClick:()=>n(null),className:"px-1.5 py-0.5 text-xs font-medium rounded",style:{background:"#F7F7F5",color:"#2563EB",border:"1px solid #E5E5E0"},title:a,children:"⌂ All"}),t.map((l,x)=>{const m=x===t.length-1;return e.jsxs("span",{className:"flex items-center gap-1",style:{color:"#9CA3AF"},children:[e.jsx("span",{children:"›"}),e.jsx("button",{onClick:()=>n(l),disabled:m,className:"text-xs font-medium",style:{color:m?"#1a1a1a":"#2563EB",fontWeight:m?700:500,cursor:m?"default":"pointer"},title:m?void 0:`Focus ${i(l)}`,children:i(l)})]},l)})]})}function Sr(){var Yo,Uo,Xo,Go,qo,Zo,Qo,Jo,en;const t=L(o=>o.model),i=L(o=>o.createRelationship),n=d.useMemo(()=>Os(t),[t]),a=L(o=>o.selectedElementId),r=L(o=>o.selectedViewpointId),l=L(o=>o.selectedDiagramId),x=L(o=>o.hiddenLayers),m=L(o=>o.selectElement),F=L(o=>o.inspectElement),y=L(o=>o.inspectRelationship),I=L(o=>o.setActiveMode),p=L(o=>o.setActiveView),b=L(o=>o.setExplorerTab),v=L(o=>o.availableOntologies),f=L(o=>o.setSelectedOntologyKind),k=L(o=>o.diagramLayouts),E=L(o=>o.setNodeLayout),D=L(o=>o.mergeDiagramLayouts),O=L(o=>o.updateDiagramElementIds),{fitView:M,screenToFlowPosition:A,getViewport:K,setViewport:Q}=oo(),[_,z]=Ds([]),[re,w,pe]=Ns([]),ee=d.useRef([]),U=d.useRef([]),qe=d.useRef(t),Ze=d.useRef(l),be=d.useRef(null),ke=d.useRef(null),Ee=d.useRef(null),ne=d.useRef(0);d.useEffect(()=>{ee.current=_},[_]),d.useEffect(()=>{U.current=re},[re]);const ue=d.useCallback(o=>{ee.current=o,ke.current===null&&(ke.current=requestAnimationFrame(()=>{ke.current=null;const s=ee.current,c=Sn(s,U.current);U.current=c,z(s),w(c)}))},[z,w]),[G,se]=d.useState(!1),[ao,Ce]=d.useState(0),[lo,co]=d.useState(null),[po,Ln]=d.useState(0),[zn,Et]=d.useState(0),[Ne,Ct]=d.useState(!0),[$n,uo]=d.useState(!0),[xo,Wn]=d.useState(!0),[It,On]=d.useState("horizontal"),[Qe,ho]=d.useState("allocation"),[Dt,go]=d.useState("all"),[fo,Pn]=d.useState(!1),[ge,_n]=d.useState(new Set(["control","data","energy","material"])),[te,Ae]=d.useState(null),[fe,Je]=d.useState(null),[q,Re]=d.useState(null),[xe,et]=d.useState(null),[Te,mo]=d.useState(null),[tt,Hn]=d.useState(2),[ot,yo]=d.useState(null),Be=d.useRef([]),Nt=d.useRef([]),bo=d.useCallback(o=>{Be.current.push(o),Be.current.length>Fr&&Be.current.shift(),Nt.current=[]},[]),u=Ps(t,l),Me=u?an[u.diagramType]:null,nt=!!((Yo=u==null?void 0:u.properties)!=null&&Yo.layoutStyle),Fe=((Uo=u==null?void 0:u.properties)==null?void 0:Uo.layoutStyle)==="fbs",we=l?k[l]:void 0,je=oi(we),he=((Xo=we==null?void 0:we.canvas)==null?void 0:Xo.autoLayout)!==!1,me=((Go=we==null?void 0:we.canvas)==null?void 0:Go.flowAnimation)===!0,ae=d.useCallback(()=>{var s;if(!l)return;const o=L.getState().diagramLayouts[l]??{nodes:{},edges:{}};((s=o.canvas)==null?void 0:s.autoLayout)!==!1&&D({[l]:{...o,canvas:{...o.canvas,autoLayout:!1}}})},[l,D]);d.useEffect(()=>{if(!l||he||G||_.length===0||ao===0)return;const o=window.setTimeout(()=>{const s=L.getState().diagramLayouts[l]??{nodes:{},edges:{}},c=K(),h={nodes:Object.fromEntries(_.map(g=>[g.id,{...s.nodes[g.id]??{},x:g.position.x,y:g.position.y,...g.width?{width:g.width}:{},...g.height?{height:g.height}:{},ports:Object.fromEntries((g.data.ports??[]).map(S=>[S.id,{x:S.x,y:S.y,side:S.side}]))}])),edges:Object.fromEntries(re.map(g=>{var S,$,R,W,V,B;return[g.id,{...(()=>{var P;const{points:X,...Y}=((P=s.edges)==null?void 0:P[g.id])??{};return Y})(),...(S=g.data)!=null&&S.manualRoute&&((R=($=g.data)==null?void 0:$.points)!=null&&R.length)?{points:(W=g.data)==null?void 0:W.points,source:g.source,target:g.target,sourcePortId:(V=g.data)==null?void 0:V.sourcePortId,targetPortId:(B=g.data)==null?void 0:B.targetPortId}:{}}]})),canvas:{...s.canvas,zoom:c.zoom,pan:{x:c.x,y:c.y},autoLayout:!1}};D({[l]:h}),Ve(l,h),Ce(0)},350);return()=>window.clearTimeout(o)},[l,he,G,ao,_,re,K,D]);const T=u?u.viewKind??(Me==null?void 0:Me.viewKind)??"general":void 0,ve=T==="interconnection"?.72:.1,Le=T?cn[T]:null,Ie=T==="general"&&!nt&&!Fe,At=(u==null?void 0:u.diagramType)==="ucd",[Se,Fo]=d.useState("graph"),[Rt,wo]=d.useState("all"),[Tt,jo]=d.useState("straight"),[ze,vo]=d.useState(new Set),Kn=d.useMemo(()=>t?ni(t):0,[t]),So=d.useMemo(()=>t?si(t):[],[t]),Bt=(qo=u==null?void 0:u.properties)==null?void 0:qo.modes,Vn=d.useMemo(()=>{if(!Bt)return Yt;const o=new Set(Bt.split(",").map(c=>c.trim())),s=Yt.filter(c=>o.has(c));return s.length?s:Yt},[Bt]),[$e,ko]=d.useState(!0),Eo=d.useMemo(()=>{if(!t||!u)return[];const o=new Set(u.elementIds),s=Object.values(t.elements).filter(c=>o.has(c.id)&&c.allocatedTo).map(c=>c.allocatedTo);return ii(s,t)},[t,u]),Yn=d.useMemo(()=>{if(!t||!u)return"Activity Diagram";const o=_s(u);return an[o].fullName},[t,u]),Un=d.useMemo(()=>{if(!t||!u)return!1;const o=new Set(u.elementIds);return Object.values(t.elements).some(s=>o.has(s.id)&&!!(s.attributes.stage||s.attributes.phase))},[t,u]),st=d.useMemo(()=>{if(!t||!u||T!=="actionflow")return[];const o=(u.elementIds??[]).map(s=>t.elements[s]).filter(s=>!!s&&s.construct==="action");return ri(o,t)},[t,u,T]),[We,Xn]=d.useState("containment"),[Oe,it]=d.useState(new Set),[Co,Pe]=d.useState(new Set),[rt,Mt]=d.useState(null),[_e,Io]=d.useState("all"),[Do,No]=d.useState(!1),[Ao,He]=d.useState(new Set),[De,Lt]=d.useState(null),[zt,Ro]=d.useState("flat"),[To,Ke]=d.useState(new Set),[at,$t]=d.useState(null),[lt,Gn]=d.useState(new Map),le=d.useRef(new Map),qn=d.useMemo(()=>kn(t,rt),[t,rt]),Zn=d.useMemo(()=>kn(t,at),[t,at]),Qn=d.useMemo(()=>{var h;if(!t||!De)return[];const o=[De],s=new Set(o);let c=De;for(;c;){const g=(h=t.elements[c])==null?void 0:h.parentAction;if(!g||s.has(g)||!t.elements[g])break;o.unshift(g),s.add(g),c=g}return o},[t,De]),dt=d.useMemo(()=>{if(!t||T!=="statetransition")return[];const o=new Set;for(const s of t.relationships){if(!eo.has(s.type))continue;const c=t.elements[s.sourceId];!c||!t.elements[s.targetId]||!ai(c)||c.kind.endsWith("Machine")||o.add(c.id)}return[...o]},[t,T]),ct=d.useMemo(()=>t?[...new Set(t.relationships.filter(o=>["composes","composedof","aggregation","decomposedby"].includes(o.type.toLowerCase())).map(o=>o.sourceId))]:[],[t]);d.useEffect(()=>{var s,c;Ce(0),Fo(li(u==null?void 0:u.properties)),wo(Ut(u==null?void 0:u.properties).level??"all"),jo(Ut(u==null?void 0:u.properties).edgeStyle??"straight"),vo(new Set),ko(!0),ho("allocation"),go("all");const o=(c=(s=u==null?void 0:u.properties)==null?void 0:s.styleHint)!=null&&c.startsWith("expanded:")?u.properties.styleHint.slice(9).split(",").map(h=>h.trim()).filter(Boolean):[];it(new Set(o)),Mt(null),Io("all"),No(!1),He(new Set),Lt(null),Ro("flat"),$t(null),le.current.clear()},[l,(Zo=u==null?void 0:u.properties)==null?void 0:Zo.layoutHint,(Qo=u==null?void 0:u.properties)==null?void 0:Qo.styleHint]);const Bo=d.useRef(null);d.useEffect(()=>{if(!t)return;const o=`${l??""}|${T??""}`;if(Bo.current!==o){if(T==="statetransition"){if(dt.length===0)return;Ke(new Set(dt))}else if(T==="interconnection"){if(ct.length===0)return;Pe(new Set(ct))}Bo.current=o}},[t,l,T,dt,ct]);const Jn=d.useMemo(()=>({decompositionNode:ki,interconnectionNode:Ai,actionFlowNode:Wi,actionFlowLane:Pi,stateNode:Hi,seqLifeline:Vi,seqSection:Ui,seqOccurrence:Gi,useCase:qi,useCaseActor:Zi,useCaseBoundary:Qi,contextSystem:tr,contextExternal:or,contextBoundary:nr,diagramNode:sr,decisionNode:dr,forkNode:cr,startEndNode:pr}),[]),es=d.useMemo(()=>({interconnectionEdge:Li,useCaseEdge:er}),[]),ts=d.useCallback(o=>{var s,c;return((s=o.data)==null?void 0:s.color)||((c=o.data)==null?void 0:c.layerColor)||"#ccc"},[]),Z=d.useMemo(()=>{const o=(u==null?void 0:u.viewpointId)==="__model"?null:(u==null?void 0:u.viewpointId)||r,s=o&&(t==null?void 0:t.viewpoints),c=x.size>0,h=u!=null&&u.elementIds?new Set(u.elementIds):void 0;if(!s&&!c&&!h)return;const g=s?t.viewpoints.find(R=>R.id===o):void 0,S=g?new Set(g.visibleKinds):void 0,$=g?new Set(g.visibleLayers):void 0;return R=>x.has(R.layer)?!1:h?h.has(R.id):S&&$?S.has(R.kind)||$.has(R.layer):!0},[r,u,t==null?void 0:t.viewpoints,x]),pt=d.useMemo(()=>{if(!t||!u||u.diagramType!=="bdd")return null;const o=u.relationshipTypes??[];return o.length===0||o.every(c=>eo.has(c.charAt(0).toLowerCase()+c.slice(1)))?di(un(t,Z,u.relationshipTypes)):null},[t,u,Z]),Mo=d.useCallback(()=>{if(t)return Fe?ci(t):Ie?un(t,Z,u==null?void 0:u.relationshipTypes):pi(t)},[t,Fe,Ie,Z,u==null?void 0:u.relationshipTypes]),Wt=d.useCallback(o=>{it(s=>{const c=new Set(s);return c.has(o)?c.delete(o):c.add(o),c})},[]),Lo=d.useCallback(o=>{Pe(s=>{const c=new Set(s);return c.has(o)?c.delete(o):c.add(o),c})},[]),zo=d.useCallback(o=>{He(s=>{const c=new Set(s);return c.has(o)?c.delete(o):c.add(o),c})},[]),ut=d.useCallback(o=>{$t(o),Ke(new Set),F(null)},[F]),xt=d.useCallback(o=>{Lt(o),He(new Set),F(null)},[F]),$o=d.useCallback(o=>{Ke(s=>{const c=new Set(s);return c.has(o)?c.delete(o):c.add(o),c})},[]),Wo=d.useCallback(o=>{le.current.clear(),Gn(s=>{const c=new Map(s),h=c.get(o)||"vertical";return c.set(o,h==="vertical"?"horizontal":"vertical"),c})},[]),Ot=d.useCallback(()=>{const o=Mo();if(!o)return;const s=new Set,c=h=>{s.add(h);for(const g of o.childrenMap.get(h)||[])o.elements.has(g)&&c(g)};for(const h of o.roots)o.elements.has(h)&&c(h);it(s)},[Mo]),Pt=d.useCallback(()=>it(new Set),[]),_t=d.useCallback(()=>{le.current.clear(),Et(o=>o+1)},[]),os=d.useCallback(()=>{if(!l)return;const o=L.getState().diagramLayouts[l]??{},{pan:s,zoom:c,...h}=o.canvas??{},g={nodes:{},edges:{},canvas:{...h,autoLayout:!0}};be.current=null,D({[l]:g}),Ve(l,g),le.current.clear(),Et(S=>S+1),window.setTimeout(()=>M({padding:.08,minZoom:ve,maxZoom:2,duration:300}),250)},[l,D,M,ve]),Oo=d.useCallback(o=>o.map(s=>{if(s.type!=="diagramNode")return s;const c=t==null?void 0:t.elements[s.id];return{...s,data:{...s.data,onContextMenu:(h,g)=>{Re({x:h.clientX,y:h.clientY,nodeId:g,nodeKind:s.data.kind??""})},onInlineEdit:(h,g)=>{if(!c)return;const S={...c,name:g};ln(S)}}}}),[t]),Po=d.useCallback((o,s)=>{const c=o.map(g=>{const S=s.nodes[g.id];return S?{...g,position:{x:S.x,y:S.y},...S.width?{width:S.width}:{},...S.height?{height:S.height}:{},data:{...g.data,bgColor:S.color||void 0,...S.ports?{ports:(g.data.ports??[]).map($=>{var R;return{...$,...((R=S.ports)==null?void 0:R[$.id])??{}}})}:{}}}:g}),h=new Map(c.map(g=>[g.id,g]));return c.map(g=>{if(g.type!=="actionFlowLane")return g;const S=g.data,$=(S.memberIds??[]).map(Y=>h.get(Y)).filter(Boolean);if($.length===0)return g;const R=Math.min(...$.map(Y=>Y.position.x)),W=Math.min(...$.map(Y=>Y.position.y)),V=Math.max(...$.map(Y=>{var P;return Y.position.x+Number(Y.width??((P=Y.style)==null?void 0:P.width)??180)})),B=Math.max(...$.map(Y=>{var P;return Y.position.y+Number(Y.height??((P=Y.style)==null?void 0:P.height)??96)})),X=S.orientation==="column";return{...g,position:{x:X?R-36:R-120,y:X?W-32:W-36},style:{...g.style,width:V-R+(X?72:156),height:B-W+(X?68:72)}}})},[]),_o=d.useCallback((o,s,c)=>{ne.current=Date.now()+250,ae(),Ce(S=>S+1);const h=U.current.map(S=>{var B,X;if(!(((B=S.data)==null?void 0:B.sourcePortId)===s||((X=S.data)==null?void 0:X.targetPortId)===s))return S;const{points:R,manualRoute:W,...V}=S.data??{};return{...S,data:V}});U.current=h;const g=ee.current.map(S=>S.id!==o?S:{...S,data:{...S.data,ports:(S.data.ports??[]).map($=>$.id===s?{...$,y:c}:$)}});ue(g)},[ue,ae]),Ho=d.useCallback((o,s)=>{ne.current=Date.now()+250,ae(),Ce(c=>c+1),w(c=>{const h=c.map(g=>g.id===o?{...g,data:{...g.data,points:s,manualRoute:!0}}:g);return U.current=h,h})},[ae,w]);d.useEffect(()=>{if(!t)return;const o=qe.current!==t&&Ze.current===l;if(be.current=o?K():null,qe.current=t,Ze.current=l,T==="grid"||T==="browser"||T==="geometry")return;let s=!1;const c=({nodes:R,edges:W},V=!0)=>{if(s)return;const B=l?L.getState().diagramLayouts[l]:void 0,X=B&&Object.keys(B.nodes).length>0?Po(R,B):R,Y=W.map(P=>{var tn,on,nn;const de=(tn=B==null?void 0:B.edges)==null?void 0:tn[P.id],ht=!(de!=null&&de.source)||de.source===P.source&&de.target===P.target&&de.sourcePortId===((on=P.data)==null?void 0:on.sourcePortId)&&de.targetPortId===((nn=P.data)==null?void 0:nn.targetPortId)?de==null?void 0:de.points:void 0;return{...P,data:{...P.data,...ht!=null&&ht.length?{points:ht,manualRoute:!0}:{},flowAnimation:me,onRouteChange:Ht=>Ho(P.id,Ht),onSelect:Ht=>{Ht.stopPropagation(),!(Date.now()<ne.current)&&(w(Kt=>Kt.map(sn=>({...sn,selected:sn.id===P.id}))),t.relationships.some(Kt=>Kt.id===P.id)&&y(P.id))}}}});z(V?Oo(X):X),w(Sn(X,Y)),se(!1),Ln(P=>P+1)},h=R=>W=>{s||(console.error(`${R} layout error:`,W),se(!1),co(`${R} layout could not be completed. Try resetting the layout or reducing the visible hierarchy.`))},g=(R,W,V=!0)=>{se(!0),co(null),jr(W,R).then(B=>c(B,V)).catch(h(R))},S=()=>{const R=An.select({viewKind:T,diagramType:u==null?void 0:u.diagramType,isFBSDiagram:Fe,isDecompDiagram:nt,isGeneralTemplate:Ie,generalMode:Se,layoutStyle:We}),W={onToggleExpand:Wt,onToggleDirection:Wo},V={fbs:{expandedNodes:Oe,nodeDirections:lt,callbacks:W,layoutProviderId:je},decomposition:{expandedNodes:Oe,nodeDirections:lt,callbacks:W,positionCache:le.current},containment:{expandedNodes:Oe,callbacks:{onToggleExpand:Wt}},useCase:{viewpointFilter:void 0,systemName:u==null?void 0:u.name,...u?Ut(u.properties):{},level:Rt,edgeStyle:Tt,hiddenActorIds:ze},context:{systemName:u==null?void 0:u.name,viewpointFilter:Z,relationshipTypes:u==null?void 0:u.relationshipTypes},interconnection:{viewpointFilter:Z,relationshipTypes:u==null?void 0:u.relationshipTypes,collapsedNodes:Co,onToggleCollapse:Lo,focusId:rt??void 0,portDisplay:_e,onPortMove:_o,layoutProviderId:je},actionflow:{viewpointFilter:Z,swimlanes:$e,laneGrouping:Qe,displayLevel:Dt,expandedActionIds:Ao,onToggleAction:zo,onDrillInAction:xt,focusActionId:De??void 0,visibleFlowKinds:ge,direction:It,nesting:zt,layoutProviderId:je},statetransition:{viewpointFilter:Z,collapsedStateIds:To,onToggleCollapse:$o,onDrillIn:ut,focusStateId:at??void 0,layoutProviderId:je},sequence:{viewpointFilter:Z},general:{mode:Se,viewpointFilter:Z,expandedNodes:Oe,nodeDirections:lt,callbacks:W,positionCache:le.current,hierarchyRelationshipTypes:u==null?void 0:u.relationshipTypes,layoutProviderId:je},standard:{viewpointFilter:Z,relationshipTypes:u==null?void 0:u.relationshipTypes,compartments:Ie,layoutProviderId:je}},B=R.compute(t,V);B instanceof Promise?g(R.descriptor.label,B,R.descriptor.interactive):c(B,R.descriptor.interactive)},$=window.setTimeout(S,wr);return()=>{s=!0,window.clearTimeout($)}},[t,Z,nt,Fe,We,T,Ie,Se,$e,zn,u==null?void 0:u.relationshipTypes,u==null?void 0:u.diagramType,u==null?void 0:u.name,Rt,Tt,ze,je,Oe,Co,rt,_e,Ao,De,ge,It,Qe,Dt,zt,lt,To,at,$o,ut,xt,Wt,Lo,zo,Wo,l,Po,Oo,_o,Ho,y,K]),d.useEffect(()=>{if(po===0)return;const o=setTimeout(()=>{var h;const s=be.current;if(be.current=null,s){Q(s);return}const c=l?(h=L.getState().diagramLayouts[l])==null?void 0:h.canvas:void 0;(c==null?void 0:c.zoom)!==void 0&&c.pan?Q({x:c.pan.x,y:c.pan.y,zoom:c.zoom},{duration:300}):M({padding:.08,minZoom:ve,maxZoom:2,duration:500})},200);return()=>clearTimeout(o)},[po,l,M,ve,Q]),d.useEffect(()=>{z(o=>o.map(s=>{const c=s.type==="actionFlowLane"?s.data.inspectElementId:void 0,h=!!a&&(s.id===a||c===a);return{...s,selected:h,style:{...s.style,boxShadow:h?"0 0 0 2px #2DD4A8, 0 4px 12px rgba(45, 212, 168, 0.3)":void 0,opacity:a?h?1:.5:1}}}))},[a,z]),d.useEffect(()=>{if(!Te||!t)return;const o=mi(t,Te,"both",tt),s=new Set(o.nodes.map(c=>c.elementId));s.add(Te),z(c=>c.map(h=>({...h,style:{...h.style,opacity:s.has(h.id)?1:.08,pointerEvents:s.has(h.id)?"all":"none"}}))),w(c=>c.map(h=>({...h,style:{...h.style,opacity:s.has(h.source)&&s.has(h.target)?1:.05}})))},[Te,tt,t,z,w]),d.useEffect(()=>{if(!ot)return;const o=setTimeout(()=>yo(null),2500);return()=>clearTimeout(o)},[ot]),d.useEffect(()=>{const o=s=>{const c=s.target;if(!(c.tagName==="INPUT"||c.tagName==="TEXTAREA")){if((s.metaKey||s.ctrlKey)&&s.key==="z"&&!s.shiftKey){s.preventDefault();const h=Be.current.pop();h&&(h.undo(),Nt.current.push(h))}if((s.metaKey||s.ctrlKey)&&(s.key==="Z"||s.key==="z"&&s.shiftKey)){s.preventDefault();const h=Nt.current.pop();h&&(h.do(),Be.current.push(h))}s.key==="g"&&(s.metaKey||s.ctrlKey)&&s.shiftKey&&(s.preventDefault(),uo(h=>!h)),s.key==="0"&&(s.metaKey||s.ctrlKey)&&(s.preventDefault(),M({padding:.08,minZoom:ve,maxZoom:2,duration:400}))}};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[M,ve]);const ns=d.useCallback(o=>{o.preventDefault(),o.dataTransfer.dropEffect="copy"},[]),ss=d.useCallback(o=>{o.preventDefault();const s=o.dataTransfer.getData("application/memo-kind");if(s)try{const c=JSON.parse(s),h=A({x:o.clientX,y:o.clientY});Ae({x:o.clientX,y:o.clientY,flowX:h.x,flowY:h.y,kind:c.kind,layer:c.layer,construct:c.construct})}catch{}},[A]),is=d.useCallback(o=>{const s=A({x:o.clientX,y:o.clientY});Ae({x:o.clientX,y:o.clientY,flowX:s.x,flowY:s.y})},[A]),rs=d.useCallback(o=>{if(!te||!l){Ae(null);return}const s=te.kind??"Part",c=te.layer??"logical",h=te.construct??"part",g=In[c]??"#6B7280",S=`_new_${Date.now()}`,$={id:S,type:"diagramNode",position:{x:te.flowX,y:te.flowY},data:{label:o,kind:s,layer:c,construct:h,color:g,isNew:!0,onContextMenu:(B,X)=>{Re({x:B.clientX,y:B.clientY,nodeId:X,nodeKind:s})},onInlineEdit:(B,X)=>{ln({id:S,name:X,kind:s,construct:h,layer:c})}}};z(B=>[...B,$]),Hs({name:o,kind:s,construct:h,attributes:{_layer:c}});const R=(u==null?void 0:u.elementIds)??[];O(l,[...R,S]);const W=l,V={nodes:{...(k[W]??{}).nodes??{},[S]:{x:te.flowX,y:te.flowY}},edges:(k[W]??{}).edges??{}};D({[W]:V}),Ve(W,V),Ae(null)},[te,l,u,k,D,O,z]),as=d.useCallback(()=>{Re(null),et(null)},[]),ls=d.useCallback((o,s)=>{s!=null&&s.isValid},[]),ds=d.useCallback(o=>{const{source:s,target:c}=o;if(!s||!c)return;const h=t==null?void 0:t.elements[s],g=t==null?void 0:t.elements[c];!h||!g||Je({x:window.innerWidth/2-130,y:window.innerHeight/2-160,sourceElement:h,targetElement:g})},[t]),cs=d.useCallback(async o=>{if(!fe||!l){Je(null);return}const s=fe.sourceElement.id;Je(null);const c=await i({type:o.type,sourceId:o.sourceId,targetId:o.targetId,direction:o.direction,selectedElementId:s,diagramId:l});if(!c.success){console.warn(`[MEMO] Relationship rejected: ${c.error}`);return}const h=dn[o.type]??"#6B7280",g={id:c.relationshipId??`e_${o.sourceId}_${o.targetId}_${o.type}`,source:o.sourceId,target:o.targetId,label:o.type,type:"default",style:{stroke:h,strokeWidth:2},labelStyle:{fontSize:"10px",fill:"#374151"},labelBgStyle:{fill:"#FFFFFF",fillOpacity:.9},labelBgPadding:[4,2],labelBgBorderRadius:4,markerEnd:{type:"arrowclosed",color:h}};w(S=>As(g,S))},[fe,l,w,i]),ps=d.useCallback((o,s)=>{Ee.current={id:s.id,x:s.position.x,y:s.position.y}},[]),us=d.useCallback((o,s)=>{const c=Ee.current;if(Ee.current=null,!((c==null?void 0:c.id)===s.id&&Math.hypot(s.position.x-c.x,s.position.y-c.y)>2)||(ne.current=Date.now()+250,Ce(R=>R+1),!l))return;ae();const{x:g,y:S}=s.position,$=le.current.get(s.id);if(le.current.set(s.id,{x:g,y:S}),E(l,s.id,{x:g,y:S}),$){const R=s.id,W=l;bo({do:()=>E(W,R,{x:g,y:S}),undo:()=>{E(W,R,$),z(V=>V.map(B=>B.id===R?{...B,position:$}:B))}})}},[l,E,bo,z,ae]),xs=d.useCallback(o=>{o.some(s=>s.type==="position"&&s.dragging)&&ae(),o.some(s=>s.type==="dimensions"&&s.resizing)&&(ae(),Ce(s=>s+1)),ue(Rs(o,ee.current))},[ue,ae]),hs=d.useCallback((o,s)=>{},[]),gs=d.useCallback((o,s)=>{o.preventDefault(),et({x:o.clientX,y:o.clientY,edgeId:s.id,relType:String(s.label??"edge")})},[]),fs=d.useCallback((o,s)=>{if(Date.now()<ne.current)return;const c=s.type==="actionFlowLane"?s.data.inspectElementId:void 0;!c&&(s.id.startsWith("__")||s.id.includes("__start")||s.id.includes("__done"))||(F(c??s.id),l&&p({type:"diagram",diagramId:l}))},[F,l,p]),ms=d.useCallback((o,s)=>{var c;if((c=o==null?void 0:o.stopPropagation)==null||c.call(o),T==="actionflow"){if(!Object.values((t==null?void 0:t.elements)??{}).some(g=>g.parentAction===s.id))return;xt(s.id);return}if(T==="statetransition"){const h=s.data;if(!h.hasChildren||h.isMachine){F(s.id);return}ut(s.id);return}if(T==="interconnection"){if(!!!s.data.isContainer){F(s.id);return}Mt(s.id),Pe(new Set),F(null)}},[T,t==null?void 0:t.elements,F,xt,ut]),ys=d.useCallback(()=>{m(null),y(null),Re(null),et(null),z(o=>o.map(s=>({...s,style:{...s.style,opacity:1,boxShadow:void 0}}))),w(o=>o.map(s=>s.selected?{...s,selected:!1}:s))},[m,y,z,w]),bs=d.useCallback((o,s)=>{var c;(c=o==null?void 0:o.stopPropagation)==null||c.call(o),!(Date.now()<ne.current)&&(w(h=>h.map(g=>({...g,selected:g.id===s.id}))),t!=null&&t.relationships.some(h=>h.id===s.id)?y(s.id):t!=null&&t.elements[s.id]&&F(s.id))},[t,F,y,w]),Fs=d.useCallback((o,s)=>{Ue({endpointIds:[s.id]})},[]),ws=d.useCallback((o,s)=>{Ue({edgeId:s.id,endpointIds:Dn(s)})},[]),Ko=d.useCallback(()=>Ue(null),[]),js=d.useCallback((o,s)=>{var c;l&&(E(l,o,{...((c=k[l])==null?void 0:c.nodes[o])??{x:0,y:0},color:s||void 0}),z(h=>h.map(g=>g.id===o?{...g,data:{...g.data,bgColor:s||void 0}}:g)))},[l,k,E,z]),Vo=d.useCallback(o=>{if(!l||!u)return;const s=(u.elementIds??[]).filter(c=>c!==o);O(l,s),z(c=>c.filter(h=>h.id!==o))},[l,u,O,z]),vs=d.useCallback((o,s)=>{const c=s==="dashed"?"6 3":s==="dotted"?"2 3":void 0;w(h=>h.map(g=>g.id===o?{...g,style:{...g.style,strokeDasharray:c}}:g))},[w]),Ss=d.useCallback((o,s)=>{w(c=>c.map(h=>h.id===o?{...h,style:{...h.style,stroke:s||(dn[String(h.label??"")]??"#6B7280")}}:h))},[w]),ks=d.useCallback(o=>{w(s=>s.map(c=>c.id===o?{...c,label:c.label?"":o.split("_")[3]??""}:c))},[w]);if(u&&t&&T==="grid")return e.jsx(ui,{diagram:u,model:t,viewpointFilter:Z});if(u&&t&&T==="browser")return e.jsx(xi,{diagram:u,model:t,viewpointFilter:Z});if(u&&T==="geometry"){const o=cn.geometry;return e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:e.jsxs("div",{className:"text-center",style:{maxWidth:"380px"},children:[e.jsx("span",{className:"inline-block px-2 py-0.5 rounded font-semibold",style:{background:o.color+"20",color:o.color,fontSize:N.badge,marginBottom:"12px"},children:o.label}),e.jsx("h3",{style:{fontSize:N.lg,fontWeight:600,color:"#374151",marginBottom:"8px"},children:u.name}),e.jsx("p",{style:{fontSize:N.md,color:"#9CA3AF",lineHeight:1.6},children:"Geometry View rendering is deferred (ADR-1-19): the ontology carries no spatial data to draw. This view is recognized and validated, but has no renderer yet."})]})})}return!u&&_.length===0&&!G?e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!Ne&&e.jsx(Gt,{collapsed:Ne,onToggleCollapse:()=>Ct(!0)}),Ne&&e.jsx(Gt,{collapsed:!0,onToggleCollapse:()=>Ct(!1)}),e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:e.jsxs("div",{className:"text-center",style:{maxWidth:"320px"},children:[e.jsx("div",{style:{fontSize:"40px",marginBottom:"16px",opacity:.4},children:"📊"}),e.jsx("h3",{style:{fontSize:N.lg,fontWeight:600,color:"#374151",marginBottom:"8px"},children:"Select a Diagram"}),e.jsx("p",{style:{fontSize:N.md,color:"#9CA3AF",lineHeight:1.6},children:"Choose a diagram from the sidebar or drag elements from the palette."})]})})]}):e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx(Gt,{collapsed:Ne,onToggleCollapse:()=>Ct(!Ne),elementIds:u==null?void 0:u.elementIds,eligibleKinds:u!=null&&u.viewpointId&&(t!=null&&t.viewpoints)?new Set(((Jo=t.viewpoints.find(o=>o.id===u.viewpointId))==null?void 0:Jo.visibleKinds)??[]):void 0}),e.jsxs("div",{className:"flex-1 relative",onDragOver:ns,onDrop:ss,onDoubleClick:is,children:[u&&e.jsxs("div",{className:"absolute top-3 left-3 z-10 flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs relative",style:{background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 1px 4px rgba(0,0,0,0.06)"},children:[Le&&e.jsx("span",{className:"px-1.5 py-0.5 rounded font-semibold",style:{background:Le.color+"20",color:Le.color,fontSize:N.badge},title:`${Le.fullName}${Me?` · ${Me.fullName}`:""}`,children:T==="actionflow"?Yn:Le.label}),e.jsx("span",{className:"font-medium",style:{color:"#1a1a1a"},children:u.name}),u.auto&&e.jsx("span",{style:{color:"#9CA3AF",fontSize:"9px"},children:"auto"}),e.jsx(ce,{}),e.jsx(Ye,{icon:e.jsx(H.grid,{}),label:"Grid",active:xo,onClick:()=>{Wn(o=>{const s=!o;return uo(s),s})},title:"Show or hide the canvas grid and snapping (⌘⇧G)"}),Fe&&e.jsxs(e.Fragment,{children:[e.jsx(ce,{}),e.jsx(oe,{icon:e.jsx(H.expand,{}),onClick:Ot,title:"Expand all nodes",ariaLabel:"Expand all"}),e.jsx(oe,{icon:e.jsx(H.collapse,{}),onClick:Pt,title:"Collapse all nodes",ariaLabel:"Collapse all"})]}),T==="actionflow"&&e.jsxs(e.Fragment,{children:[e.jsx(Ye,{icon:e.jsx(H.lanes,{}),active:$e,onClick:()=>ko(o=>!o),title:"Toggle allocation swimlanes"}),$e&&Un&&e.jsx(Ye,{icon:e.jsx(H.lanes,{}),label:"Stage",active:Qe==="stage",onClick:()=>ho(o=>o==="stage"?"allocation":"stage"),title:"Group this flow by its modeled stages"}),$e&&Qe==="allocation"&&Eo.length>0&&e.jsxs("select",{"aria-label":"Display hierarchy level",title:"Display responsibility lanes at a hierarchy level; the SysML allocation is unchanged",value:Dt,onChange:o=>go(o.target.value==="all"?"all":Number(o.target.value)),className:"text-xs font-semibold rounded-lg px-2 py-1",style:{color:"#5B6470",background:"#FFFFFF",border:"1px solid #E2E1DB"},children:[e.jsx("option",{value:"all",children:"All levels"}),Eo.map(o=>e.jsxs("option",{value:o,children:["L",o]},o))]}),e.jsx(ce,{}),e.jsx("span",{style:{color:"#9CA3AF",fontSize:N.xs,fontWeight:600},children:"Steps"}),e.jsx(qt,{value:zt,onChange:Ro,options:[{value:"flat",label:"Inline",title:"Expanded steps join the parent flow in place"},{value:"nested",label:"Nested",title:"Expanded steps are drawn inside their composite action (swimlanes off)"}]}),e.jsx(ce,{}),e.jsx(qt,{value:It,onChange:On,options:[{value:"horizontal",icon:e.jsx(H.arrowRight,{}),title:"Left-to-right flow"},{value:"vertical",icon:e.jsx(H.arrowDown,{}),title:"Top-to-bottom flow"}]}),e.jsx(ce,{}),e.jsxs(hr,{children:[e.jsx(oe,{icon:e.jsx(H.expand,{}),title:"Expand all sub-actions",onClick:()=>He(new Set(Object.values((t==null?void 0:t.elements)??{}).map(o=>o.parentAction).filter(o=>!!o)))}),e.jsx(oe,{icon:e.jsx(H.collapse,{}),title:"Collapse all sub-actions",onClick:()=>He(new Set)})]}),e.jsx(ce,{}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx(Ye,{icon:e.jsx(H.filter,{}),active:fo,badge:`${ge.size}/4`,onClick:()=>Pn(o=>!o),title:"Choose which modeled connection categories are visible"}),fo&&e.jsxs("div",{className:"absolute top-full right-0 mt-2 p-3 rounded-lg",style:{width:264,background:"#FFFFFF",border:"1px solid #D1D5DB",boxShadow:"0 8px 24px rgba(0,0,0,0.14)",zIndex:30},children:[e.jsx("div",{style:{color:"#1F2937",fontWeight:700,fontSize:N.xs},children:"Show connection categories"}),e.jsx("div",{style:{color:"#6B7280",fontSize:N.xs,lineHeight:1.4,marginTop:3,marginBottom:8},children:"Changes this diagram view only; the SysML model is not modified."}),["control","data","energy","material"].map(o=>{const s=ge.has(o),c=o==="control"?"#4B5563":o==="data"?"#3498DB":o==="energy"?"#D97706":"#16A34A";return e.jsxs("button",{role:"switch","aria-checked":s,onClick:()=>_n(h=>{const g=new Set(h);return g.has(o)?g.delete(o):g.add(o),g}),className:"w-full flex items-center justify-between px-1 py-1.5 rounded",style:{color:"#374151",textTransform:"capitalize"},title:`${s?"Hide":"Show"} ${o} connections`,children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{style:{width:9,height:9,borderRadius:"50%",background:c}}),o]}),e.jsx("span",{"aria-hidden":"true",style:{width:32,height:18,borderRadius:9,background:s?"#2563EB":"#D1D5DB",padding:2,transition:"background 160ms ease"},children:e.jsx("span",{style:{display:"block",width:14,height:14,borderRadius:"50%",background:"#FFFFFF",boxShadow:"0 1px 2px rgba(0,0,0,0.22)",transform:s?"translateX(14px)":"translateX(0)",transition:"transform 160ms ease"}})})]},o)})]})]}),e.jsx(Qt,{path:Qn,nameOf:o=>{var s;return((s=t==null?void 0:t.elements[o])==null?void 0:s.name)??o},onFocus:Lt,rootLabel:"Back to the whole action flow"})]}),T==="interconnection"&&e.jsxs(e.Fragment,{children:[e.jsx(ce,{}),e.jsx(oe,{icon:e.jsx(H.expand,{}),onClick:()=>Pe(new Set),title:"Expand all parts",ariaLabel:"Expand all"}),e.jsx(oe,{icon:e.jsx(H.collapse,{}),onClick:()=>Pe(new Set(ct)),title:"Collapse all parts",ariaLabel:"Collapse all"}),e.jsx("span",{style:{color:"#9CA3AF",fontSize:N.xs,fontWeight:600},children:"Ports"}),e.jsx(qt,{value:_e,onChange:Io,options:[{value:"all",label:"Nested",title:"Show ports and their nested ports"},{value:"ports",label:"Top",title:"Show top-level ports only (nested connectors lift to the parent port)"},{value:"none",label:"Off",title:"Hide ports; connectors run part to part"}]}),e.jsx(Qt,{path:qn,nameOf:o=>{var s;return((s=t==null?void 0:t.elements[o])==null?void 0:s.name)??o},onFocus:Mt,rootLabel:"Back to the whole diagram"})]}),T==="statetransition"&&e.jsxs(e.Fragment,{children:[e.jsx(ce,{}),e.jsx(oe,{icon:e.jsx(H.expand,{}),onClick:()=>Ke(new Set),title:"Show all substates",ariaLabel:"Expand all substates"}),e.jsx(oe,{icon:e.jsx(H.collapse,{}),onClick:()=>Ke(new Set(dt)),title:"Fold every composite state",ariaLabel:"Collapse all substates"}),e.jsx(Qt,{path:Zn,nameOf:o=>{var s;return((s=t==null?void 0:t.elements[o])==null?void 0:s.name)??o},onFocus:$t,rootLabel:"Back to the whole machine"})]}),At&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"#E5E5E0"},children:"|"}),e.jsxs("label",{className:"flex items-center gap-1 text-xs font-semibold",style:{color:"#475569"},children:["Level",e.jsxs("select",{"aria-label":"Use case hierarchy level",value:Rt,onChange:o=>wo(o.target.value==="all"?"all":Number(o.target.value)),className:"px-1.5 py-0.5 text-xs font-medium rounded",style:{color:"#374151",background:"#FFFFFF",border:"1px solid #D1D5DB"},children:[e.jsx("option",{value:"all",children:"All levels"}),Array.from({length:Kn+1},(o,s)=>e.jsxs("option",{value:s,children:["L",s]},s))]})]}),e.jsxs("label",{className:"flex items-center gap-1 text-xs font-semibold",style:{color:"#475569"},children:["Routing",e.jsxs("select",{"aria-label":"Use case connector routing",value:Tt,onChange:o=>jo(o.target.value),className:"px-1.5 py-0.5 text-xs font-medium rounded",style:{color:"#374151",background:"#FFFFFF",border:"1px solid #D1D5DB"},children:[e.jsx("option",{value:"straight",children:"Straight"}),e.jsx("option",{value:"elbow",children:"Elbow"}),e.jsx("option",{value:"rounded",children:"Rounded"}),e.jsx("option",{value:"curved",children:"Curved"}),e.jsx("option",{value:"arc",children:"Arc"})]})]}),e.jsx("button",{onClick:os,className:"px-2 py-0.5 text-xs font-semibold rounded",style:{color:"#047857",background:"#ECFDF5",border:"1px solid #A7F3D0"},title:"Reapply the constrained hierarchy layout and obstacle-aware routes",children:"Auto arrange"}),So.length>0&&e.jsxs("details",{className:"relative",children:[e.jsxs("summary",{className:"px-2 py-0.5 text-xs font-semibold rounded cursor-pointer",style:{color:"#374151",background:"#FFFFFF",border:"1px solid #D1D5DB"},children:["Actors",ze.size?`: ${ze.size} hidden`:""]}),e.jsxs("div",{className:"absolute top-7 left-0 z-30 min-w-48 p-2 rounded shadow-lg",style:{background:"#FFFFFF",border:"1px solid #D1D5DB"},children:[e.jsx("div",{className:"mb-1 text-xs",style:{color:"#64748B"},children:"Hide related use cases"}),So.map(o=>e.jsxs("label",{className:"flex items-center gap-2 py-1 text-xs",style:{color:"#374151"},children:[e.jsx("input",{type:"checkbox",checked:ze.has(o.id),onChange:()=>vo(s=>{const c=new Set(s);return c.has(o.id)?c.delete(o.id):c.add(o.id),c})}),o.name]},o.id))]})]})]}),Ie&&!At&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"#E5E5E0"},children:"|"}),e.jsx("div",{className:"flex rounded overflow-hidden",style:{border:"1px solid #E5E5E0"},children:Vn.map(o=>e.jsx("button",{onClick:()=>{Fo(o),le.current.clear()},className:"px-2 py-0.5 text-xs font-medium capitalize",style:{background:Se===o?"#1B3A4B":"#FFFFFF",color:Se===o?"#FFFFFF":"#6B7280"},title:o==="graph"?"Relationship graph with compartments":o==="tree"?"Decomposition tree with expand/collapse":"Nested containment blocks",children:o},o))}),Se!=="graph"&&e.jsxs(e.Fragment,{children:[e.jsx(oe,{icon:e.jsx(H.expand,{}),onClick:Ot,title:"Expand all nodes",ariaLabel:"Expand all"}),e.jsx(oe,{icon:e.jsx(H.collapse,{}),onClick:Pt,title:"Collapse all nodes",ariaLabel:"Collapse all"}),Se==="tree"&&e.jsx("button",{onClick:_t,className:"px-2 py-0.5 text-xs font-medium rounded",style:{background:"#F7F7F5",color:"#374151",border:"1px solid #E5E5E0"},title:"Re-layout the tree from scratch",children:"↻ Reset"})]})]}),nt&&!Fe&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"#E5E5E0"},children:"|"}),e.jsx("div",{className:"flex rounded overflow-hidden",style:{border:"1px solid #E5E5E0"},children:["containment","decomposition"].map(o=>e.jsx("button",{onClick:()=>{Xn(o),le.current.clear()},className:"px-2 py-0.5 text-xs font-medium",style:{background:We===o?"#1B3A4B":"#FFFFFF",color:We===o?"#FFFFFF":"#6B7280"},children:o==="containment"?"Containment":"Decomposition"},o))}),e.jsx(ce,{}),e.jsx(oe,{icon:e.jsx(H.expand,{}),onClick:Ot,title:"Expand all nodes",ariaLabel:"Expand all"}),e.jsx(oe,{icon:e.jsx(H.collapse,{}),onClick:Pt,title:"Collapse all nodes",ariaLabel:"Collapse all"}),We==="decomposition"&&e.jsx("button",{onClick:_t,className:"px-2 py-0.5 text-xs font-medium rounded",style:{background:"#F7F7F5",color:"#374151",border:"1px solid #E5E5E0"},title:"Re-layout the tree from scratch",children:"↻ Reset"})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"#E5E5E0"},children:"|"}),!At&&e.jsxs("button",{"aria-pressed":he,onClick:()=>{if(he)ae();else{const o=L.getState().diagramLayouts[l],s={nodes:{},edges:{},canvas:{...o==null?void 0:o.canvas,autoLayout:!0}};D({[l]:s}),Ve(l,s),Et(c=>c+1)}},className:"px-2 py-0.5 text-xs font-semibold rounded",style:{background:he?"#ECFDF5":"#FFF7ED",color:he?"#047857":"#C2410C",border:`1px solid ${he?"#A7F3D0":"#FED7AA"}`},title:he?"Auto layout is on. Drag any item to switch it off and preserve your changes automatically.":"Auto layout is off. Your changes are saved automatically; click to discard overrides and recalculate.",children:["Auto layout: ",he?"On":"Off"]})]}),l&&T==="interconnection"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"#E5E5E0"},children:"|"}),e.jsxs("button",{"aria-pressed":me,onClick:()=>{const o=L.getState().diagramLayouts[l]??{nodes:{},edges:{}},s={...o,canvas:{...o.canvas,flowAnimation:!me}};D({[l]:s}),Ve(l,s),w(c=>c.map(h=>({...h,data:{...h.data,flowAnimation:!me}})))},className:"px-2 py-0.5 text-xs font-semibold rounded",style:{background:me?"#EFF6FF":"#F8FAFC",color:me?"#1D4ED8":"#64748B",border:`1px solid ${me?"#93C5FD":"#CBD5E1"}`},title:"Toggle animated source-to-target flow on IBD connectors",children:["Flow: ",me?"On":"Off"]}),e.jsx("button",{"aria-pressed":Do,onClick:()=>No(o=>!o),className:"px-2 py-0.5 text-xs font-medium rounded",style:{background:"#F8FAFC",color:"#475569",border:"1px solid #CBD5E1"},title:"Show or hide the IBD notation legend",children:"Legend"})]})]}),Te&&e.jsxs("div",{className:"absolute top-3 right-3 z-10 flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs",style:{background:"#1B3A4B",color:"#FFFFFF",boxShadow:"0 2px 8px rgba(0,0,0,0.18)"},children:[e.jsx("span",{style:{color:"#2DD4A8",fontWeight:700},children:"◎ Focus"}),e.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Depth"}),[1,2,3].map(o=>e.jsx("button",{onClick:()=>Hn(o),style:{width:20,height:20,borderRadius:4,cursor:"pointer",background:tt===o?"#2DD4A8":"rgba(255,255,255,0.15)",color:tt===o?"#1B3A4B":"#FFFFFF",fontWeight:700,fontSize:"11px",border:"none"},children:o},o)),e.jsx("button",{onClick:()=>{mo(null),z(o=>o.map(s=>({...s,style:{...s.style,opacity:1,pointerEvents:"all"}}))),w(o=>o.map(s=>({...s,style:{...s.style,opacity:1}})))},style:{marginLeft:4,padding:"2px 8px",borderRadius:4,cursor:"pointer",background:"rgba(255,255,255,0.15)",color:"#FFFFFF",fontSize:"11px",border:"none"},children:"Exit Focus"})]}),ot&&e.jsxs("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-50 px-4 py-2 rounded-lg text-xs font-mono",style:{background:"#1B3A4B",color:"#2DD4A8",boxShadow:"0 4px 16px rgba(0,0,0,0.2)",whiteSpace:"nowrap"},children:["Copied: ",ot]}),G&&e.jsx("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-10 px-4 py-1.5 rounded-full text-xs font-medium",style:{background:"#FFFFFF",color:"#6B7280",border:"1px solid #E5E5E0",boxShadow:"0 1px 4px rgba(0,0,0,0.06)"},children:"Computing layout…"}),lo&&!G&&e.jsxs("div",{role:"alert",className:"absolute top-3 left-1/2 -translate-x-1/2 z-20 flex items-center gap-3 px-3 py-2",style:{maxWidth:620,background:"#FFFDF7",color:"#5F4300",border:"1px solid #E7C35A",borderRadius:4,boxShadow:"0 2px 8px rgba(31,41,55,0.10)",fontSize:N.xs},children:[e.jsx("span",{children:lo}),e.jsx("button",{onClick:_t,style:{border:"1px solid #B58A12",borderRadius:3,background:"#FFFFFF",color:"#5F4300",padding:"3px 8px",fontWeight:700,whiteSpace:"nowrap"},children:"Retry"})]}),st.length>0&&!G&&e.jsxs("div",{role:"alert",className:"absolute top-16 left-1/2 -translate-x-1/2 z-20 px-3 py-2",style:{maxWidth:720,background:"#FEF2F2",color:"#991B1B",border:"1px solid #FCA5A5",borderRadius:4,boxShadow:"0 2px 8px rgba(31,41,55,0.10)",fontSize:N.xs},children:[e.jsx("span",{style:{fontWeight:700},children:"Diagram error:"})," ",st.length," floating ",st.length===1?"action has":"actions have"," no flow or succession connection:"," ",st.map((o,s)=>e.jsxs("span",{children:[s>0&&", ",e.jsx("button",{onClick:()=>F(o.id),style:{color:"#991B1B",textDecoration:"underline",fontWeight:700},children:o.name})]},o.id))]}),pt&&!G&&e.jsxs("div",{role:"alert",className:"absolute top-16 left-1/2 -translate-x-1/2 z-20 px-3 py-2",style:{maxWidth:720,background:"#FEF2F2",color:"#991B1B",border:"1px solid #FCA5A5",borderRadius:4,boxShadow:"0 2px 8px rgba(31,41,55,0.10)",fontSize:N.xs},children:[e.jsx("span",{style:{fontWeight:700},children:"BDD error:"})," ","expected one connected hierarchy, but found ",pt.rootIds.length," roots",pt.disconnectedIds.length>0&&e.jsxs(e.Fragment,{children:[" and ",pt.disconnectedIds.length," disconnected/floating elements"]}),"."]}),T==="actionflow"&&e.jsxs("div",{"aria-label":"Action flow legend",className:"absolute right-3 bottom-3 z-10 flex items-center gap-4 px-3 py-2",style:{background:"rgba(255,255,255,0.96)",border:"1px solid #D1D5DB",borderRadius:3,color:"#374151",fontSize:N.xs},children:[e.jsx("span",{style:{fontWeight:700},children:"Legend"}),ge.has("control")&&e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{style:{width:24,height:0,borderTop:"2px solid #4B5563"}}),"Control flow"]}),ge.has("data")&&e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{style:{width:24,height:0,borderTop:"2.5px solid #3498DB"}}),"Object flow"]}),ge.has("energy")&&e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{style:{width:24,height:0,borderTop:"2.5px solid #D97706"}}),"Energy flow"]}),ge.has("material")&&e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{style:{width:24,height:0,borderTop:"2.5px solid #16A34A"}}),"Material flow"]})]}),T==="interconnection"&&_.length>0&&Do&&e.jsxs("div",{"aria-label":"Interconnection legend",className:"absolute right-3 bottom-3 z-10 flex flex-col gap-1.5 px-3 py-2",style:{background:"rgba(255,255,255,0.96)",border:"1px solid #D1D5DB",borderRadius:4,color:"#374151",fontSize:N.xs},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{style:{fontWeight:700},children:"Ports"}),_e!=="none"?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Zt,{color:wt.in,glyph:"→"})," in"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Zt,{color:wt.out,glyph:"→"})," out"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Zt,{color:wt.inout,glyph:"⇄"})," inout"]}),_e==="all"&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{style:{width:9,height:9,borderRadius:2,flexShrink:0,background:"#6B728022",border:"1.5px solid #6B7280"}}),"nested"]})]}):e.jsx("span",{style:{color:"#9CA3AF"},children:"hidden"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{style:{fontWeight:700},children:"Flow"}),["data","energy","material"].map(o=>e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{style:{width:20,height:0,borderTop:`2.5px solid ${hi[o]}`}}),o]},o))]})]}),!G&&_.length===0&&u&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",style:{zIndex:1},children:u.auto&&((en=u.elementIds)==null?void 0:en.length)===0?e.jsxs("div",{className:"text-center",style:{maxWidth:420},children:[e.jsx("div",{style:{fontSize:"32px",marginBottom:8},children:"🔍"}),e.jsx("div",{style:{fontSize:N.sm,color:"#374151",fontWeight:600,marginBottom:4},children:"This view selects no elements"}),e.jsx("div",{style:{fontSize:N.xs,color:"#6B7280",lineHeight:1.6},children:"The view is auto-populated from its selectionQuery in the model. Add includeElementKinds / includeLayers to its SysML definition, or link elements to it with IncludedIn relationships."})]}):e.jsxs("div",{className:"text-center",style:{opacity:.4},children:[e.jsx("div",{style:{fontSize:"32px",marginBottom:8},children:"🖱️"}),e.jsx("div",{style:{fontSize:N.sm,color:"#6B7280"},children:"Drag from palette or double-click to create elements"})]})}),G&&e.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",zIndex:20,background:`linear-gradient(90deg, ${pn.accent} 0%, ${pn.accent}80 50%, transparent 100%)`,backgroundSize:"200% 100%",animation:"memo-layout-progress 1.2s linear infinite"}}),e.jsxs(Ts,{nodes:_,edges:re,nodeTypes:Jn,edgeTypes:es,onNodesChange:xs,onEdgesChange:pe,onNodeClick:fs,onNodeDoubleClick:ms,onEdgeClick:bs,onPaneClick:ys,onNodeDragStart:ps,onNodeDragStop:us,onNodeContextMenu:hs,onEdgeContextMenu:gs,onNodeMouseEnter:Fs,onNodeMouseLeave:Ko,onEdgeMouseEnter:ws,onEdgeMouseLeave:Ko,onConnect:ds,onConnectStart:as,onConnectEnd:ls,connectionMode:Bs.Loose,defaultEdgeOptions:{interactionWidth:24},snapToGrid:$n,snapGrid:br,fitView:!0,fitViewOptions:{...fr,minZoom:ve},minZoom:.1,maxZoom:3,zoomOnScroll:!0,panOnScroll:!0,panOnScrollMode:"free",selectionOnDrag:!1,proOptions:yr,style:gr,children:[xo&&e.jsx(Ms,{color:"#C5C7C2",gap:20,size:1.5}),e.jsx(wi,{}),e.jsx(Ls,{}),_.length>20&&e.jsx(zs,{style:mr,nodeColor:ts,maskColor:"rgba(247, 247, 245, 0.7)"})]})]}),te&&e.jsx(vr,{x:te.x,y:te.y,onConfirm:rs,onCancel:()=>Ae(null)}),fe&&e.jsx(gi,{x:fe.x,y:fe.y,sourceElement:fe.sourceElement,targetElement:fe.targetElement,registries:n,onSelect:cs,onCancel:()=>Je(null)}),q&&e.jsx(rr,{x:q.x,y:q.y,nodeId:q.nodeId,nodeKind:q.nodeKind,onClose:()=>Re(null),onEditName:()=>{z(o=>o.map(s=>s.id===q.nodeId?{...s,data:{...s.data,_triggerEdit:!0}}:s))},onChangeColor:o=>js(q.nodeId,o),onRemoveFromDiagram:()=>Vo(q.nodeId),onDeleteFromModel:()=>{Vo(q.nodeId)},onShowProperties:()=>{m(q.nodeId)},onShowInCatalog:()=>{m(q.nodeId),I("catalog")},onFocusElement:()=>{mo(q.nodeId)},onShowRelMatrix:()=>{p({type:"traceability"})},onOpenSource:()=>{const o=t==null?void 0:t.elements[q.nodeId];o!=null&&o.file&&(navigator.clipboard.writeText(o.file).catch(()=>{}),yo(o.file))},onViewKindInOntology:()=>{const o=q.nodeKind;let s=null,c=null;for(const h of v){for(const g of h.layers)if(g.kinds.some(S=>S.name===o)){s=h.name,c=g.id;break}if(s)break}s&&(f(o),b("ontologies"),I("ontology"),p({type:"ontology-detail",packageName:s,layerId:c??void 0}))}}),xe&&e.jsx(lr,{x:xe.x,y:xe.y,edgeId:xe.edgeId,relType:xe.relType,onClose:()=>et(null),onChangeStyle:o=>vs(xe.edgeId,o),onChangeColor:o=>Ss(xe.edgeId,o),onToggleLabel:()=>ks(xe.edgeId),onDelete:()=>w(o=>o.filter(s=>s.id!==xe.edgeId))})]})}function Br(){return e.jsx(Is,{children:e.jsx(Sr,{})})}export{Br as DiagramCanvas};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DiagramCanvas-BfwO8YE5.js","assets/reactflow-CsCqNKB-.js","assets/zustand-CrhqMOHB.js","assets/index-D0vtjNjX.js","assets/index-B8HDzVLs.css","assets/layout-selection-DIQaaOIC.js","assets/layout-providers-Dr743WlP.js","assets/elk-6l8mIQnQ.js","assets/style-BZV40eAE.css","assets/MaxGraphCanvas-BS5wYazZ.js","assets/SysmlCodeEditor-Die2RUsz.js","assets/SysmlCodeEditor-BwKcXIZw.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
var fe=Object.defineProperty;var me=(t,s,i)=>s in t?fe(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i;var B=(t,s,i)=>me(t,typeof s!="symbol"?s+"":s,i);import{_ as P,u as C,g as xe,a as he,l as pe,s as ge,b as ve,c as Se,F as d,C as a,d as ye,L as be,e as Ee,f as Fe}from"./index-D0vtjNjX.js";import{j as e}from"./reactflow-CsCqNKB-.js";import{a as r}from"./zustand-CrhqMOHB.js";const V="memo.renderer.reactflow";class we{constructor(){B(this,"providers",new Map);B(this,"components",new Map)}register(s){const i=this.providers.get(s.descriptor.id);if(i&&i!==s)throw new Error(`Renderer provider already registered: ${s.descriptor.id}`);this.providers.set(s.descriptor.id,s)}unregister(s){return this.components.delete(s),this.providers.delete(s)}get(s){return this.providers.get(s)}has(s){return this.providers.has(s)}list(s=[]){return[...this.providers.values()].map(i=>i.descriptor).filter(i=>s.every(o=>i.capabilities.includes(o))).sort((i,o)=>i.name.localeCompare(o.name))}loadComponent(s){const i=this.providers.get(s)??this.providers.get(V);if(!i)throw new Error(`Renderer provider not found: ${s} (no default registered)`);const o=i.descriptor.id;let n=this.components.get(o);return n||(n=i.loadComponent(),this.components.set(o,n)),n}}const Re={descriptor:{id:"memo.renderer.reactflow",name:"ReactFlow",engine:"ReactFlow (@xyflow/react 12)",version:"12",contractVersion:"1",license:"MIT",description:"Default authoring canvas — React node components, palette, full editing.",capabilities:["interactive-editing","all-view-kinds","manual-layout","undo-redo","minimap","orthogonal-routes"]},loadComponent:()=>P(()=>import("./DiagramCanvas-BfwO8YE5.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(t=>t.DiagramCanvas)},je={descriptor:{id:"memo.renderer.maxgraph",name:"maxGraph",engine:"maxGraph (@maxgraph/core — draw.io rendering engine lineage)",version:"0.x",contractVersion:"1",license:"Apache-2.0",description:"draw.io-style retained-mode canvas — SVG cells, rubberband selection, image export.",capabilities:["all-view-kinds","manual-layout","export-image"]},loadComponent:()=>P(()=>import("./MaxGraphCanvas-BS5wYazZ.js"),__vite__mapDeps([9,1,2,3,4,5,6,7])).then(t=>t.MaxGraphCanvas)},$=new we;$.register(Re);$.register(je);const Ce={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Ae="memo.diagram.renderer.v3",_e="renderer",ke="memo.renderer.",se=new Set;function G(t){const s=t==null?void 0:t.trim();if(s)return s.includes(".")?s:`${ke}${s}`}function De(){if(!(typeof window>"u"))try{return G(new URLSearchParams(window.location.search).get(_e))}catch{return}}function Te(){if(!(typeof window>"u"))try{return G(window.localStorage.getItem(Ae))}catch{return}}function Le(){try{const t=Ce;return G(t==null?void 0:t.VITE_MEMO_DIAGRAM_RENDERER)}catch{return}}function re(){return De()??Te()??Le()??V}function Me(t){return se.add(t),()=>se.delete(t)}function Ne(){return e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5",color:"#9CA3AF",fontSize:13},children:"Loading renderer…"})}function ze(){const t=r.useSyncExternalStore(Me,re,re),s=$.has(t)?t:V,i=r.useMemo(()=>r.lazy(()=>$.loadComponent(s).then(o=>({default:o}))),[s]);return e.jsx("div",{className:"relative flex flex-1 overflow-hidden",children:e.jsx(r.Suspense,{fallback:e.jsx(Ne,{}),children:e.jsx(i,{})})})}const $e=r.lazy(()=>P(()=>import("./SysmlCodeEditor-Die2RUsz.js"),__vite__mapDeps([10,1,2,11])).then(t=>({default:t.SysmlCodeEditor})));function Oe(t,s){const i=(t.elementIds??[]).map(o=>s[o]).filter(Boolean).map(o=>` ${o.construct??"part"} ${o.id} : ${o.kind};`).join(`
|
|
3
|
-
`);return[`package '${t.name}' {`,` // Diagram: ${t.diagramType.toUpperCase()} | Viewpoint: ${t.viewpointId}`,i||" // No elements selected","}"].join(`
|
|
4
|
-
`)}function Ie({diagram:t}){const s=C(c=>c.model),i=C(c=>c.updateDiagramElementIds),[o,n]=r.useState(""),m=r.useMemo(()=>ye(s),[s]),O=r.useCallback(c=>{const x=new Set(t.elementIds??[]);x.has(c)?x.delete(c):x.add(c),i(t.id,[...x])},[t.id,t.elementIds,i]),w=r.useMemo(()=>new Set(t.elementIds??[]),[t.elementIds]),E=be.filter(c=>m.has(c));return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",style:{width:"220px",borderLeft:`1px solid ${a.border}`,background:"#FAFAF8",flexShrink:0},children:[e.jsxs("div",{className:"px-2 py-1.5",style:{borderBottom:`1px solid ${a.border}`},children:[e.jsxs("div",{className:"font-semibold mb-1",style:{color:a.primary,fontSize:d.xs},children:["Elements (",w.size," selected)"]}),e.jsx("input",{value:o,onChange:c=>n(c.target.value),placeholder:"Filter…",className:"w-full px-2 py-1 rounded focus:outline-none",style:{background:"#F0F0ED",border:`1px solid ${a.border}`,color:a.primary,fontSize:d.xs}})]}),e.jsx("div",{className:"flex-1 overflow-y-auto py-1",children:E.map(c=>{const x=(m.get(c)??[]).filter(u=>!o||u.name.toLowerCase().includes(o.toLowerCase())||u.id.toLowerCase().includes(o.toLowerCase()));if(x.length===0)return null;const I=Fe[c]??a.muted;return e.jsxs("div",{children:[e.jsx("div",{className:"px-2 py-1 font-semibold",style:{color:I,fontSize:d.badge},children:Ee[c]??c}),x.map(u=>e.jsxs("label",{className:"flex items-center gap-2 px-3 py-0.5 cursor-pointer",style:{fontSize:d.xs},onMouseEnter:h=>h.currentTarget.style.background="#F0F0ED",onMouseLeave:h=>h.currentTarget.style.background="transparent",children:[e.jsx("input",{type:"checkbox",checked:w.has(u.id),onChange:()=>O(u.id),style:{accentColor:a.accent}}),e.jsx("span",{className:"truncate",style:{color:a.primary},title:u.id,children:u.name||u.id})]},u.id))]},c)})})]})}function ne({tone:t,message:s,actions:i}){const o=t==="conflict";return e.jsxs("div",{role:"alert",className:"flex items-center gap-2 px-3 py-1.5 flex-wrap",style:{background:o?"#FEF2F2":"#FFFBEB",borderBottom:`1px solid ${o?"#FECACA":"#FDE68A"}`,color:o?"#B91C1C":"#92400E",fontSize:d.xs,flexShrink:0},children:[e.jsx("span",{className:"flex-1",style:{minWidth:180},children:s}),i.map(n=>e.jsx("button",{onClick:n.onClick,title:n.hint,style:{fontSize:d.xs,padding:"2px 8px",borderRadius:5,cursor:"pointer",background:"#FFFFFF",border:`1px solid ${o?"#FECACA":"#FDE68A"}`,color:"inherit",fontWeight:600,whiteSpace:"nowrap"},children:n.label},n.label))]})}const Be=4e3;function Pe({at:t}){const[s,i]=r.useState(!1);return r.useEffect(()=>{if(!t)return;i(!0);const o=setTimeout(()=>i(!1),Be);return()=>clearTimeout(o)},[t]),s?e.jsx("span",{title:"A source file this view depends on changed; the view was rebuilt",style:{fontSize:d.badge,padding:"1px 6px",borderRadius:999,background:"#ECFDF5",color:"#047857",border:"1px solid #A7F3D0",whiteSpace:"nowrap"},children:"↻ Refreshed from source"}):null}const Ve=[];function We({diagramId:t}){const s=C(l=>l.model),i=C(l=>l.diagramParseErrors[t]??Ve),o=C(l=>l.lastSourceChange),n=xe(s,t),[m,O]=r.useState("visual"),[w,E]=r.useState(""),[c,x]=r.useState(!1),[I,u]=r.useState(!1),[h,Y]=r.useState(!1),[p,A]=r.useState(!1),[R,y]=r.useState(null),[oe,q]=r.useState(null),[_,j]=r.useState(null),[k,D]=r.useState(null),[ie,le]=r.useState(null),[U,W]=r.useState([]),[T,ae]=r.useState(()=>localStorage.getItem("memo.diagramEditor.autoSave")==="true"),b=r.useRef(),v=r.useRef(""),K=r.useRef(0),L=r.useRef(void 0),M=r.useRef(0),H=r.useRef(!1);r.useEffect(()=>{H.current=p},[p]);const Q=r.useMemo(()=>he(s,t),[s,t]),N=r.useCallback(async()=>{const l=++M.current,g=t;x(!0);try{const S=await pe(g);if(M.current!==l)return!1;const f=S.text??"";return v.current=f,L.current=S.revision,E(f),u(!0),A(!1),y(null),D(null),j(null),!0}catch(S){return M.current===l&&y(S instanceof Error?S.message:String(S)),!1}finally{M.current===l&&x(!1)}},[t]);r.useEffect(()=>{if(clearTimeout(b.current),y(null),q(null),A(!1),j(null),D(null),W([]),L.current=void 0,!(!n||!s)){if(!n.sourceFile||window.__MEMO_DATA__){const l=Oe(n,s.elements);v.current=l,E(l),x(!1),u(!1);return}E(""),v.current="",u(!1),N()}},[t,n==null?void 0:n.sourceFile]),r.useEffect(()=>{if(!o||!(n!=null&&n.sourceFile)||window.__MEMO_DATA__||!ge(o,Q))return;le(o.at);const l=o.files.includes(n.sourceFile);if(l){if(H.current){j({files:o.files.filter(g=>Q.includes(g)),at:o.at,touchesOwnSource:l});return}N()}},[o==null?void 0:o.seq]);const ce=l=>{v.current=l,E(l),A(!0),y(null)},F=r.useCallback(async(l,g)=>{if(!n)return;const S=++K.current;Y(!0),y(null);try{if(n.sourceFile){const f=await ve(t,l,g!=null&&g.force?void 0:L.current);if(f.conflict){D({theirs:f.text??"",revision:f.revision,at:Date.now()}),y(f.error??"The file changed on disk since this edit began.");return}L.current=f.revision,D(null),j(null),W(f.parseErrors??[])}else Se(t,l);v.current===l&&A(!1),q(Date.now())}catch(f){y(f instanceof Error?f.message:String(f))}finally{K.current===S&&Y(!1)}},[n,t]),X=r.useCallback(()=>{clearTimeout(b.current),N()},[N]),de=r.useCallback(()=>{clearTimeout(b.current),F(v.current,{force:!0})},[F]);r.useEffect(()=>(localStorage.setItem("memo.diagramEditor.autoSave",String(T)),clearTimeout(b.current),T&&p&&!c&&!k&&(b.current=setTimeout(()=>void F(v.current),800)),()=>clearTimeout(b.current)),[T,p,c,w,F,k]);const J=r.useCallback(()=>{clearTimeout(b.current),F(v.current)},[F]),ue=r.useMemo(()=>Object.values((s==null?void 0:s.elements)??{}).map(l=>({id:l.id,name:l.name,kind:l.kind})),[s==null?void 0:s.elements]);if(!n)return e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:a.faint,fontSize:d.sm},children:"Diagram not found"});const Z=n.auto,z=!Z||!!n.sourceFile&&I,ee=e.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden",children:[k&&e.jsx(ne,{tone:"conflict",message:`${n.sourceFile} changed on disk while you were editing. Saving now would discard those changes.`,actions:[{label:"Reload from disk",onClick:X,hint:"Discards your unsaved edits"},{label:"Overwrite with mine",onClick:de,hint:"Discards the changes on disk"}]}),!k&&_&&e.jsx(ne,{tone:"notice",message:_.files.length>1?`${_.files.length} source files changed on disk. Your unsaved edits are untouched.`:`${_.files[0]} changed on disk. Your unsaved edits are untouched.`,actions:[{label:"Reload from disk",onClick:X,hint:"Discards your unsaved edits"},{label:"Keep editing",onClick:()=>j(null),hint:"Dismiss until the next change"}]}),e.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"#1E1E1E"},children:e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"h-full flex items-center justify-center",style:{color:"#9CA3AF",fontSize:d.xs},children:"Loading SysML editor…"}),children:e.jsx($e,{value:w,sourceFile:n.sourceFile,readOnly:!z||c,symbols:ue,onChange:ce,onSave:()=>{z&&p&&J()}})})}),U.length>0&&e.jsx("div",{className:"px-3 py-1.5 text-xs",style:{background:"#1C1407",color:"#FCD34D",borderTop:"1px solid #3B2A0A",fontFamily:"monospace"},title:"Saved, but the file does not parse — the model keeps its last good state for this file",children:U.join(" · ")}),i.length>0&&e.jsx("div",{className:"px-3 py-1.5 text-xs",style:{background:"#1C0A0A",color:"#F87171",borderTop:"1px solid #3B0A0A",fontFamily:"monospace"},children:i.join(" · ")}),R&&e.jsx("div",{className:"px-3 py-1.5 text-xs",style:{background:"#1C0A0A",color:"#FCA5A5",borderTop:"1px solid #3B0A0A"},children:R}),!z&&e.jsx("div",{className:"px-3 py-1.5 text-xs",style:{background:"#F9F9F8",color:a.faint,borderTop:`1px solid ${a.border}`},children:n.sourceFile&&window.__MEMO_DATA__?"Static build — run memo-architect dev to edit the SysML source":n.sourceFile?"The SysML source could not be loaded":"Generated model view — no editable SysML source file"})]}),te=e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:e.jsx(ze,{})}),!Z&&e.jsx(Ie,{diagram:n})]});return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5",style:{borderBottom:`1px solid ${a.border}`,background:"#FAFAF8",flexShrink:0},children:[e.jsx("span",{className:"font-semibold truncate flex-1",style:{color:a.primary,fontSize:d.sm},children:n.name}),n.sourceFile&&e.jsx("span",{className:"truncate",title:n.sourceFile,style:{maxWidth:"220px",color:a.faint,fontSize:d.xs},children:n.sourceFile}),(m==="text"||m==="split")&&e.jsx("span",{title:"Local, public Monaco editor with SysML highlighting and model-aware completion",style:{color:"#4B6E80",fontSize:d.badge},children:"Monaco · SysML"}),e.jsx(Pe,{at:ie}),c&&e.jsx("span",{style:{color:a.faint,fontSize:d.xs},children:"Loading source…"}),h&&e.jsx("span",{style:{color:a.faint,fontSize:d.xs},children:"Saving…"}),!h&&R&&e.jsx("span",{title:R,style:{color:"#EF4444",fontSize:d.xs},children:"Save failed"}),!h&&!R&&p&&e.jsx("span",{style:{color:"#B45309",fontSize:d.xs},children:"Unsaved"}),!h&&!p&&oe&&e.jsx("span",{style:{color:"#15803D",fontSize:d.xs},children:"Saved"}),!h&&i.length>0&&e.jsxs("span",{style:{color:"#EF4444",fontSize:d.xs},children:[i.length," error",i.length>1?"s":""]}),z&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"flex items-center gap-1",style:{color:a.secondary,fontSize:d.xs},title:"Save changes 800ms after typing",children:[e.jsx("input",{type:"checkbox",checked:T,onChange:l=>ae(l.target.checked),style:{accentColor:a.accent}}),"Auto-save"]}),e.jsx("button",{onClick:J,disabled:!p||h||c,title:"Save SysML (Ctrl/Cmd+S)",style:{fontSize:d.xs,padding:"3px 10px",borderRadius:"5px",border:`1px solid ${a.border}`,cursor:!p||h||c?"default":"pointer",background:p?a.accent:"#F0F0ED",color:p?"#FFFFFF":a.faint,fontWeight:600},children:"Save"})]}),e.jsx("div",{className:"flex overflow-hidden",style:{border:`1px solid ${a.border}`,borderRadius:"6px"},children:[["visual","⬜ Visual"],["split","⧉ Split"],["text","</> Text"]].map(([l,g])=>e.jsx("button",{onClick:()=>O(l),style:{fontSize:d.xs,padding:"3px 10px",border:"none",cursor:"pointer",background:m===l?a.accent:"transparent",color:m===l?"#FFFFFF":a.secondary,fontWeight:m===l?600:400},children:g},l))})]}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m==="visual"&&te,m==="text"&&ee,m==="split"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{width:"50%",borderRight:`1px solid ${a.border}`,display:"flex",flexDirection:"column",overflow:"hidden"},children:ee}),e.jsx("div",{style:{width:"50%",display:"flex",overflow:"hidden"},children:te})]})]})]})}export{We as DiagramEditor};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./reactflow-CsCqNKB-.js";import{a as b}from"./zustand-CrhqMOHB.js";import{u as m,h as A,C as i,F as r,f as W,E as B,P as j,p as v,q as C,r as M,t as O,v as T}from"./index-D0vtjNjX.js";const a="page",$=new Set(["Scenario","UseCase","UserActivity"]);function D(l){return l?l.split(`
|
|
2
|
-
`).filter(s=>s.trim()).map((s,c)=>{const p=s.match(/^\d+\.\s*(.*)/);return{index:c,text:p?p[1].trim():s.trim()}}):[]}function V({element:l,layerColor:s,onSave:c}){const p=b.useMemo(()=>D(l.doc||""),[l.doc]),[y,u]=b.useState(!1);return y||p.length===0?e.jsxs("div",{children:[e.jsxs("p",{style:{fontSize:r.xs,color:i.faint,marginBottom:6,marginTop:0},children:["One step per line, numbered: ",e.jsx("code",{children:"1. User does something"})]}),e.jsx(v,{value:l.doc||"",onSave:n=>{c(n),u(!1)},density:a,multiline:!0,placeholder:"Click to add scenario steps…"})]}):e.jsxs("div",{style:{position:"relative"},children:[e.jsx("button",{onClick:()=>u(!0),style:{position:"absolute",top:0,right:0,fontSize:r.xs,color:i.muted,padding:"2px 9px",border:`1px solid ${i.border}`,borderRadius:"6px",background:i.surface,cursor:"pointer"},onMouseEnter:n=>{n.currentTarget.style.borderColor=i.accent},onMouseLeave:n=>{n.currentTarget.style.borderColor=i.border},children:"✎ Edit steps"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",paddingTop:4},children:[e.jsx("div",{style:{padding:"6px 20px",borderRadius:"999px",fontSize:r.xs,fontWeight:700,background:s,color:"#fff",letterSpacing:"0.06em",textTransform:"uppercase"},children:"Start"}),p.map((n,o)=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",width:"100%"},children:[e.jsx(k,{color:s}),e.jsxs("div",{style:{width:"100%",maxWidth:"560px",display:"flex",alignItems:"flex-start",gap:"12px",background:i.surface,border:`1px solid ${s}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:s+"18",color:s,fontSize:r.xs,fontWeight:700},children:o+1}),e.jsx("span",{style:{fontSize:r.sm,color:i.primary,lineHeight:1.5,paddingTop:"3px"},children:n.text})]})]},o)),e.jsx(k,{color:s}),e.jsx("div",{style:{padding:"6px 20px",borderRadius:"999px",fontSize:r.xs,fontWeight:700,background:s+"20",color:s,letterSpacing:"0.06em",textTransform:"uppercase",border:`1px solid ${s}40`},children:"End"})]})]})}function k({color:l}){return e.jsx("div",{style:{width:"2px",height:"20px",background:l+"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 ${l}80`}})})}function H(){var F,I,R;const l=m(t=>t.activeView),s=m(t=>t.model),c=m(t=>t.validation),p=m(t=>t.updateElementField),y=m(t=>t.updateElementAttribute),u=m(t=>t.applyEdit),n=l.type==="element-detail"?l.elementId:null,o=n&&s?s.elements[n]:null,S=b.useMemo(()=>{if(!s||!n)return{incoming:[],outgoing:[]};const t=A(s,n);return{incoming:t.filter(d=>d.targetId===n),outgoing:t.filter(d=>d.sourceId===n)}},[s,n]),h=b.useMemo(()=>!c||!n?[]:c.violations.filter(t=>t.elementId===n),[c,n]);if(!o||!n)return e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:i.surfaceAlt},children:e.jsxs("div",{className:"text-center",style:{color:i.faint},children:[e.jsx("div",{style:{fontSize:"32px",marginBottom:"12px",opacity:.5},children:"📄"}),e.jsx("p",{style:{fontSize:r.md},children:"Select an element to view details"})]})});const g=W[o.layer]||i.muted,x=(F=s==null?void 0:s.registries)==null?void 0:F.kinds.find(t=>t.name===o.kind),E=((I=x==null?void 0:x.namespace)==null?void 0:I[1])??((R=x==null?void 0:x.namespace)==null?void 0:R[0]),w=(t,d)=>{p(n,t,d),u(n)},N=(t,d)=>{y(n,t,d),u(n)},f=Object.entries(o.attributes).filter(([t])=>t!=="id"&&t!=="name"),z=$.has(o.kind);return e.jsx("div",{className:"flex-1 overflow-y-auto",style:{background:"#EEF4F7"},children:e.jsxs("div",{style:{maxWidth:"1040px",margin:"0 auto",padding:"20px 28px 48px"},children:[e.jsxs("header",{style:{background:i.surface,border:"1px solid rgba(60,60,67,0.12)",borderLeft:`4px solid ${g}`,borderRadius:"16px",padding:"14px 18px",marginBottom:16,boxShadow:"0 1px 3px rgba(15,23,42,0.05)"},children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",style:{marginBottom:8},children:[e.jsx("span",{className:"px-2 py-0.5 rounded-md font-semibold",style:{background:g+"18",color:g,fontSize:r.xs},children:o.kind}),e.jsx("span",{className:"px-2 py-0.5 rounded-md",style:{background:i.surfaceAlt,color:i.muted,fontSize:r.xs},children:o.layer}),E&&e.jsx("span",{style:{color:i.faint,fontSize:r.xs},children:E.replace(/[_-]/g," ").replace(/\b\w/g,t=>t.toUpperCase())}),o.shortId&&e.jsx("span",{style:{marginLeft:"auto",color:i.faint,fontSize:r.xs,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:o.shortId})]}),e.jsx("h1",{style:{fontSize:"24px",fontWeight:700,color:i.primary,lineHeight:1.2,margin:0},children:o.name}),e.jsx("div",{style:{marginTop:9,paddingTop:8,borderTop:`1px solid ${i.borderLight}`},children:e.jsx(B,{density:a})})]}),h.length>0&&e.jsxs("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid #FEE2E2",background:"#FEF2F2",marginBottom:20},children:[e.jsxs("div",{className:"px-4 py-2 font-semibold",style:{color:"#DC2626",fontSize:r.sm,borderBottom:"1px solid #FEE2E2"},children:[h.length," violation",h.length!==1?"s":""]}),h.map((t,d)=>e.jsxs("div",{className:"px-4 py-2 flex items-center gap-2",style:{fontSize:r.xs},children:[e.jsx("span",{style:{color:"#DC2626"},children:"✖"}),e.jsxs("span",{style:{color:i.faint},children:["[",t.ruleId,"]"]}),e.jsx("span",{style:{color:"#991B1B"},children:t.description})]},d))]}),e.jsx(j,{title:z?"Flow":"Description",density:a,collapsible:!1,children:z?e.jsx(V,{element:o,layerColor:g,onSave:t=>w("doc",t)}):e.jsx(v,{value:o.doc||"",onSave:t=>w("doc",t),density:a,multiline:!0,placeholder:"Click to add a description…"})}),e.jsxs(j,{title:"Attributes",count:f.length,density:a,collapsible:!1,children:[f.length===0&&e.jsx("p",{style:{fontSize:r.sm,color:i.faint,margin:0},children:"This element defines no attributes."}),f.length>0&&e.jsx("div",{style:{borderTop:`1px solid ${i.border}`,maxWidth:900},children:f.map(([t,d])=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(150px, 24%) minmax(0, 1fr)",gap:16,alignItems:"center",padding:"7px 0",borderBottom:`1px solid ${i.borderLight}`},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{color:i.secondary,fontSize:r.sm,fontWeight:600},children:t}),e.jsx("div",{style:{color:i.faint,fontSize:"10px"},children:"Editable"})]}),e.jsx(v,{value:String(d??""),onSave:L=>N(t,L),density:a,placeholder:"Add value…",compact:!0})]},t))})]}),e.jsx(C,{element:o,outgoing:S.outgoing,incoming:S.incoming,density:a}),e.jsx(j,{title:"Source",density:a,collapsible:!1,children:e.jsx("div",{style:{maxWidth:720},children:e.jsx(M,{label:"SysML source file",editability:T("file"),density:a,children:e.jsx(O,{value:o.file??"—",editability:T("file"),density:a,mono:!0})})})})]})})}export{H as ElementDetailView};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./reactflow-CsCqNKB-.js";import{a as p}from"./zustand-CrhqMOHB.js";import{u as E,h as xe,i as fe,f as R}from"./index-D0vtjNjX.js";const he=[{label:"Activity diagram",types:new Set(["act"])},{label:"Operative flow",types:new Set(["afd","ofd"])},{label:"Function flow",types:new Set(["ffd"])},{label:"Sequence diagram",types:new Set(["seq"])}];function ye(r){return he.map(v=>{const m=r.filter(b=>v.types.has(b.diagramType.toLowerCase()));return{label:v.label,items:m}}).filter(v=>v.items.length>0)}function Z(r){return r?r.split(`
|
|
2
|
-
`).filter(m=>m.trim()).map((m,b)=>{const I=m.match(/^\d+\.\s*(.*)/);return{index:b,text:I?I[1]:m}}):[]}function ge(r){return r.map((v,m)=>`${m+1}. ${v.text}`).join(`
|
|
3
|
-
`)}function ke(){const r=E(s=>s.model),v=E(s=>s.createRelationship),m=E(s=>s.inspectElement),b=E(s=>s.selectedElementId),I=E(s=>s.setActiveMode),ee=E(s=>s.setActiveView),[N,se]=p.useState(""),[c,y]=p.useState(null),[B,q]=p.useState(""),[T,K]=p.useState(null),[D,P]=p.useState(""),z=p.useMemo(()=>{if(!r)return[];const s=Object.values(r.elements),n=r.elements,l=(...t)=>{const i=new Set(t.map(u=>u.toLowerCase()));return r.relationships.filter(u=>i.has(u.type.toLowerCase()))},x=(t,i)=>{var u;return typeof t=="string"&&((u=t.split("::").at(-1))==null?void 0:u.trim())===i},j=s.filter(t=>t.kind.endsWith("UseCase")),w=new Set(j.map(t=>t.id)),f=new Map,S=new Set;for(const t of l("Includes")){if(!w.has(t.sourceId)||!w.has(t.targetId))continue;const i=f.get(t.sourceId)??[];i.push(t.targetId),f.set(t.sourceId,i),S.add(t.targetId)}const C=new Map,L=[],A=(t,i)=>{if(!C.has(t)){C.set(t,i),L.push(t);for(const u of f.get(t)??[])A(u,i+1)}};for(const t of j)S.has(t.id)||A(t.id,0);for(const t of j)A(t.id,0);const U=L.map(t=>n[t]).filter(t=>!!t),k=t=>!N||t.name.toLowerCase().includes(N.toLowerCase())||t.kind.toLowerCase().includes(N.toLowerCase());return U.map(t=>{var J;const i=l("Supports","supportsUseCase").filter(a=>a.targetId===t.id).map(a=>n[a.sourceId]).filter(a=>!!a&&a.kind==="OperationalWorkflow"),u=s.filter(a=>a.kind.endsWith("Scenario")).filter(a=>x(a.attributes.parentUseCase,t.id)||l("Realizes","scenarioRealizesUseCase").some(F=>F.sourceId===a.id&&F.targetId===t.id)),W=u.map(a=>s.find(F=>x(a.attributes.parentWorkflow,F.id))).filter(a=>!!a),O=[...new Map([...i,...W].map(a=>[a.id,a])).values()],G=u.map(a=>{const F=l("Composes","scenarioComprisesActivity").filter(o=>o.sourceId===a.id).map(o=>n[o.targetId]).filter(o=>!!o),de=String(a.attributes.activities??"").split(",").map(o=>{var h;return(h=o.split("::").at(-1))==null?void 0:h.trim()}).map(o=>o?n[o]:void 0).filter(o=>!!o),Q=[...new Map([...F,...de].map(o=>[o.id,o])).values()],X=l("Realizes","functionalRealizesOperative").filter(o=>o.targetId===a.id).map(o=>n[o.sourceId]).filter(o=>!!o&&o.layer==="functional"),ue=X.flatMap(o=>l("Realizes","uIRealizesFunctional").filter(h=>h.targetId===o.id).map(h=>n[h.sourceId]).filter(h=>!!h&&h.layer==="usability")),M=new Set([a.id,...Q.map(o=>o.id)]);let _=!0;for(;_;){_=!1;for(const o of s)o.parentAction&&M.has(o.parentAction)&&!M.has(o.id)&&(M.add(o.id),_=!0)}const pe=(r.diagrams??[]).filter(o=>{var h;return((h=o.elementIds)==null?void 0:h.some(me=>M.has(me)))||o.name.toLowerCase().includes(a.name.toLowerCase())});return{scenario:a,activities:Q,functionalScenarios:X,uiScenarios:ue,views:pe}}),V=O.map(a=>({workflow:a,scenarios:G.filter(({scenario:F})=>x(F.attributes.parentWorkflow,a.id))}));return{useCase:t,workflows:V,depth:C.get(t.id)??0,hasChildren:(((J=f.get(t.id))==null?void 0:J.length)??0)>0}}).filter(t=>k(t.useCase)||t.workflows.some(({workflow:i,scenarios:u})=>k(i)||u.some(({scenario:W,activities:O,functionalScenarios:G,uiScenarios:V})=>k(W)||O.some(k)||G.some(k)||V.some(k))))},[r,N]),d=b&&r?r.elements[b]:null,$=p.useMemo(()=>xe(r,b||""),[r,b]),g=p.useMemo(()=>c||(d?Z(d.doc||""):[]),[d,c]),te=p.useCallback(()=>{d&&y(Z(d.doc||""))},[d]),le=p.useCallback(()=>{if(!d||!c)return;const s=ge(c);fe({...d,doc:s}),y(null)},[d,c]),H=p.useCallback(()=>{if(!B.trim())return;const s=[...c||g,{index:g.length,text:B.trim()}];y(s),q("")},[B,c,g]),ne=p.useCallback(s=>{const n=(c||g).filter((l,x)=>x!==s);y(n)},[c,g]),Y=p.useCallback((s,n)=>{const l=[...c||g],x=s+n;x<0||x>=l.length||([l[s],l[x]]=[l[x],l[s]],y(l))},[c,g]),oe=p.useCallback((s,n)=>{const l=[...c||g];l[s]={...l[s],text:n},y(l)},[c,g]),ae=p.useMemo(()=>{if(!r||!D)return[];const s=D.toLowerCase();return Object.values(r.elements).filter(n=>n.id!==b&&n.name.toLowerCase().includes(s)).slice(0,10)},[r,D,b]),[re,ce]=p.useState(new Set),ie=s=>{ce(n=>{const l=new Set(n);return l.has(s)?l.delete(s):l.add(s),l})};return e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("div",{className:"w-72 flex flex-col overflow-hidden",style:{background:"#FFFFFF",borderRight:"1px solid #E5E5E0"},children:[e.jsxs("div",{className:"px-3 py-2",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsx("div",{style:{color:"#1B3A4B",fontSize:"12px",fontWeight:700,marginBottom:7},children:"Use-Case Hierarchy"}),e.jsx("input",{type:"text",placeholder:"Search "+z.length+" use cases...",value:N,onChange:s=>se(s.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"}})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto text-xs py-1",children:[z.map(({useCase:s,workflows:n,depth:l,hasChildren:x})=>{const j="use-case:"+s.id,w=re.has(j);return e.jsxs("div",{className:"mb-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 cursor-pointer",style:{borderRadius:"6px",margin:"0 4px",marginLeft:4+l*14},onMouseEnter:f=>f.currentTarget.style.background="#F0F0ED",onMouseLeave:f=>f.currentTarget.style.background="transparent",onClick:()=>{m(s.id),y(null),ie(j)},children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded flex-shrink-0",style:{backgroundColor:R.functional,borderRadius:"3px"}}),e.jsx("span",{className:"font-medium flex-1",style:{color:"#374151"},children:s.name}),e.jsx("span",{style:{color:"#9CA3AF"},children:x?"Parent use case":"Leaf use case"}),e.jsx("span",{style:{color:"#D1D5DB"},children:w?"▸":"▾"})]}),!w&&e.jsx("div",{className:"ml-5 border-l pl-2",style:{borderColor:"#E5E5E0"},children:n.map(({workflow:f,scenarios:S})=>e.jsxs("div",{className:"mb-1",children:[e.jsx("button",{onClick:()=>{m(f.id),y(null)},className:"block w-full px-2 py-1 text-left truncate rounded",style:{color:"#374151",fontWeight:600},children:f.name}),e.jsxs("div",{className:"ml-3 border-l pl-2",style:{borderColor:"#D8E2E9"},children:[S.map(({scenario:C,activities:L,functionalScenarios:A,uiScenarios:U,views:k})=>e.jsxs("div",{className:"mb-1",children:[e.jsx("button",{onClick:()=>{m(C.id),y(null)},className:"block w-full px-2 py-1 text-left truncate rounded",style:{color:"#1B3A4B",fontWeight:500},children:C.name}),e.jsxs("div",{className:"ml-3 border-l pl-2",style:{borderColor:"#E5E5E0"},children:[[["Activity diagram",L],["Function flow",A],["Interaction sequence",U]].filter(([,t])=>t.length>0).map(([t,i])=>e.jsxs("div",{children:[e.jsx("div",{className:"pt-1",style:{color:"#6B7280",fontSize:"10px"},children:t}),i.map(u=>e.jsx("button",{onClick:()=>{m(u.id),y(null)},className:"block w-full px-1 py-0.5 text-left truncate rounded",style:{color:"#4B5563"},children:u.name},u.id))]},t)),ye(k).map(t=>e.jsxs("div",{children:[e.jsx("div",{className:"pt-1",style:{color:"#6B7280",fontSize:"10px"},children:t.label}),t.items.map(i=>e.jsx("button",{onClick:()=>{I("diagram"),ee({type:"diagram",diagramId:i.id})},className:"block w-full px-1 py-0.5 text-left truncate rounded",style:{color:"#2563EB"},children:i.name},i.id))]},t.label))]})]},C.id)),S.length===0&&e.jsx("div",{className:"px-2 py-1",style:{color:"#9CA3AF",fontSize:"10px"},children:"No scenarios"})]})]},f.id))})]},s.id)}),z.length===0&&e.jsx("div",{className:"px-4 py-8 text-center",style:{color:"#9CA3AF"},children:"No use-case scenario chains found."})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:[!d&&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:"Select a scenario to edit steps and link elements"})]})}),d&&e.jsxs("div",{className:"max-w-2xl",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold",style:{color:"#1a1a1a"},children:d.name}),e.jsx("span",{className:"px-2 py-0.5 text-xs rounded-md font-medium",style:{background:"#E67E2218",color:"#E67E22"},children:d.kind})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"#6B7280"},children:"Steps"}),!c&&e.jsx("button",{onClick:te,className:"px-2 py-0.5 text-xs rounded",style:{background:"#2DD4A815",color:"#1B3A4B",border:"1px solid #2DD4A840"},children:"Edit"}),c&&e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:le,className:"px-2 py-0.5 text-xs rounded font-medium",style:{background:"#2DD4A8",color:"#FFFFFF"},children:"Save"}),e.jsx("button",{onClick:()=>y(null),className:"px-2 py-0.5 text-xs rounded",style:{background:"#F3F4F6",color:"#6B7280"},children:"Cancel"})]})]}),e.jsx("div",{className:"space-y-1",children:g.map((s,n)=>e.jsxs("div",{className:"flex items-start gap-2 p-2 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("span",{className:"flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-xs font-medium",style:{background:"#2DD4A815",color:"#1B3A4B"},children:n+1}),c?e.jsx("input",{type:"text",value:s.text,onChange:l=>oe(n,l.target.value),className:"flex-1 text-sm px-2 py-1 rounded focus:outline-none",style:{border:"1px solid #E5E5E0",color:"#374151"}}):e.jsx("span",{className:"flex-1 text-sm",style:{color:"#374151"},children:s.text}),c&&e.jsxs("div",{className:"flex gap-0.5",children:[e.jsx("button",{onClick:()=>Y(n,-1),className:"px-1 text-xs",style:{color:"#9CA3AF"},title:"Move up",children:"▲"}),e.jsx("button",{onClick:()=>Y(n,1),className:"px-1 text-xs",style:{color:"#9CA3AF"},title:"Move down",children:"▼"}),e.jsx("button",{onClick:()=>ne(n),className:"px-1 text-xs",style:{color:"#E74C3C"},title:"Remove",children:"✕"})]})]},n))}),c&&e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx("input",{type:"text",value:B,onChange:s=>q(s.target.value),onKeyDown:s=>s.key==="Enter"&&H(),placeholder:"Add a step...",className:"flex-1 text-sm px-3 py-2 rounded-lg focus:outline-none",style:{background:"#FFFFFF",border:"1px solid #E5E5E0",color:"#374151"}}),e.jsx("button",{onClick:H,className:"px-3 py-2 text-xs rounded-lg font-medium",style:{background:"#2DD4A815",color:"#1B3A4B",border:"1px solid #2DD4A840"},children:"+ Add"})]}),g.length===0&&!c&&e.jsx("div",{className:"text-xs p-3 rounded-lg",style:{background:"#F3F4F6",color:"#9CA3AF"},children:"No steps defined. Click Edit to add scenario steps."})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"#6B7280"},children:["Linked Elements (",$.length,")"]}),e.jsx("button",{onClick:()=>K(T===null?0:null),className:"px-2 py-0.5 text-xs rounded",style:{background:"#4A90D915",color:"#4A90D9",border:"1px solid #4A90D940"},children:T!==null?"Done":"+ Link"})]}),T!==null&&e.jsxs("div",{className:"mb-2 p-2 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #4A90D940"},children:[e.jsx("input",{type:"text",value:D,onChange:s=>P(s.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"}}),ae.map(s=>e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 text-xs rounded cursor-pointer",onMouseEnter:n=>n.currentTarget.style.background="#F0F0ED",onMouseLeave:n=>n.currentTarget.style.background="transparent",onClick:()=>{v({type:"traceTo",sourceId:d.id,targetId:s.id,direction:"outgoing",selectedElementId:d.id}),P(""),K(null)},children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:R[s.layer]||"#95A5A6"}}),e.jsx("span",{style:{color:"#374151"},children:s.name}),e.jsx("span",{style:{color:"#9CA3AF"},children:s.kind})]},s.id))]}),e.jsx("div",{className:"space-y-1",children:$.map(s=>{const n=s.sourceId===d.id?s.targetId:s.sourceId,l=r.elements[n],x=s.sourceId===d.id?"→":"←";return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg cursor-pointer",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},onMouseEnter:j=>j.currentTarget.style.background="#F0F0ED",onMouseLeave:j=>j.currentTarget.style.background="#FFFFFF",onClick:()=>m(n),children:[e.jsx("span",{style:{color:"#9CA3AF"},children:x}),e.jsx("span",{className:"font-medium",style:{color:"#2563EB"},children:s.type}),e.jsx("span",{style:{color:"#374151"},children:(l==null?void 0:l.name)||n}),l&&e.jsx("span",{className:"ml-auto px-1.5 py-0.5 rounded text-xs",style:{background:(R[l.layer]||"#95A5A6")+"18",color:R[l.layer]||"#95A5A6"},children:l.kind})]},s.id)})})]}),e.jsx("div",{className:"text-xs",style:{color:"#D1D5DB"},children:d.file})]})]})]})}export{ke as ScenarioEditor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./reactflow-CsCqNKB-.js";import{a as u}from"./zustand-CrhqMOHB.js";import{u as w,F as j,e as D,f as T}from"./index-D0vtjNjX.js";function R({element:r}){var f;const i=!!((f=r.doc)!=null&&f.trim()),d=Object.keys(r.attributes).length,S=i&&d>=1,v=i||d>=1,p=S?"#2DD4A8":v?"#F39C12":"#E5E5E0",A=S?"Complete":v?"Partial":"Empty";return t.jsx("span",{className:"inline-block rounded-full flex-shrink-0",style:{width:8,height:8,backgroundColor:p,cursor:"default"},title:A})}function Y({col:r,sortKey:i,sortDir:d}){return r!==i?t.jsx("span",{style:{color:"#D1D5DB",fontSize:"10px",marginLeft:3},children:"⇅"}):t.jsx("span",{style:{color:"#1B3A4B",fontSize:"10px",marginLeft:3},children:d==="asc"?"↑":"↓"})}function P(){const r=w(e=>e.model),i=w(e=>e.activeView),d=w(e=>e.selectedViewpointId),S=w(e=>e.selectElement),v=w(e=>e.selectedElementId),[p,A]=u.useState("name"),[f,C]=u.useState("asc"),[E,B]=u.useState(""),[g,I]=u.useState(""),[b,M]=u.useState(""),h=u.useMemo(()=>{var o,s,n,c,l;if(!r)return[];const e=Object.values(r.elements);if(i.type==="tabular"&&i.diagramId){const a=(o=r.diagrams)==null?void 0:o.find(x=>x.id===i.diagramId);if((s=a==null?void 0:a.elementIds)!=null&&s.length){const x=new Set(a.elementIds);return e.filter(m=>x.has(m.id))}}if(d){const a=(n=r.viewpoints)==null?void 0:n.find(x=>x.id===d);if(a){const x=(c=a.visibleLayers)!=null&&c.length?new Set(a.visibleLayers):null,m=(l=a.visibleKinds)!=null&&l.length?new Set(a.visibleKinds):null;return e.filter(F=>(!x||x.has(F.layer))&&(!m||m.has(F.kind)))}}return e},[r,i,d]),k=u.useMemo(()=>{const e=new Map;for(const s of h)for(const n of Object.keys(s.attributes))e.set(n,(e.get(n)??0)+1);const o=Math.max(1,h.length*.1);return[...e.entries()].filter(([,s])=>s>=o).sort((s,n)=>n[1]-s[1]).slice(0,4).map(([s])=>s)},[h]),O=u.useMemo(()=>[...new Set(h.map(e=>e.layer))].sort(),[h]),V=u.useMemo(()=>[...new Set(h.map(e=>e.kind))].sort(),[h]),N=u.useMemo(()=>{const e=E.toLowerCase();let o=h.filter(s=>!(e&&!s.name.toLowerCase().includes(e)&&!s.kind.toLowerCase().includes(e)||g&&s.layer!==g||b&&s.kind!==b));return o.sort((s,n)=>{let c="",l="";if(p==="name")c=s.name,l=n.name;else if(p==="kind")c=s.kind,l=n.kind;else if(p==="layer")c=s.layer,l=n.layer;else if(p==="status"){const x=m=>{var L;const F=!!((L=m.doc)!=null&&L.trim()),z=Object.keys(m.attributes).length>=1;return F&&z?2:F||z?1:0};c=String(x(s)),l=String(x(n))}else c=s.attributes[p]??"",l=n.attributes[p]??"";const a=c.localeCompare(l,void 0,{numeric:!0});return f==="asc"?a:-a}),o},[h,E,g,b,p,f]);function K(e){p===e?C(o=>o==="asc"?"desc":"asc"):(A(e),C("asc"))}const W=u.useMemo(()=>{var e,o;if(!r)return"";if(i.type==="tabular"&&i.diagramId){const s=(e=r.diagrams)==null?void 0:e.find(n=>n.id===i.diagramId);return s?`Diagram: ${s.name}`:"Diagram"}if(d){const s=(o=r.viewpoints)==null?void 0:o.find(n=>n.id===d);return s?`Viewpoint: ${s.label}`:"Viewpoint"}return"All Elements"},[r,i,d]),y=({col:e,label:o,width:s})=>t.jsxs("th",{onClick:()=>K(e),className:"px-3 py-2 text-left cursor-pointer select-none",style:{fontSize:"11px",fontWeight:600,color:"#374151",background:"#F7F7F5",borderBottom:"1px solid #E5E5E0",whiteSpace:"nowrap",width:s,position:"sticky",top:0,zIndex:1},children:[o,t.jsx(Y,{col:e,sortKey:p,sortDir:f})]});return t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",style:{background:"#FFFFFF"},children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 flex-shrink-0",style:{borderBottom:"1px solid #E5E5E0",background:"#FAFAF8"},children:[t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:"13px",fontWeight:700,color:"#1B3A4B"},children:"Tabular View"}),t.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF"},children:W})]}),t.jsx("div",{className:"flex-1"}),t.jsx("input",{type:"text",placeholder:"Search elements…",value:E,onChange:e=>B(e.target.value),className:"px-3 py-1.5 rounded-lg focus:outline-none",style:{width:220,fontSize:j.xs,color:"#1a1a1a",border:"1px solid #E5E5E0",background:"#FFFFFF"}}),t.jsxs("select",{value:g,onChange:e=>I(e.target.value),className:"px-2 py-1.5 rounded-lg focus:outline-none",style:{fontSize:j.xs,color:"#374151",border:"1px solid #E5E5E0",background:"#FFFFFF",cursor:"pointer"},children:[t.jsx("option",{value:"",children:"All layers"}),O.map(e=>t.jsx("option",{value:e,children:D[e]??e},e))]}),t.jsxs("select",{value:b,onChange:e=>M(e.target.value),className:"px-2 py-1.5 rounded-lg focus:outline-none",style:{fontSize:j.xs,color:"#374151",border:"1px solid #E5E5E0",background:"#FFFFFF",cursor:"pointer"},children:[t.jsx("option",{value:"",children:"All kinds"}),V.map(e=>t.jsx("option",{value:e,children:e},e))]}),t.jsxs("div",{style:{fontSize:"11px",color:"#9CA3AF",whiteSpace:"nowrap"},children:[N.length," / ",h.length," elements"]})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs("table",{className:"w-full border-collapse",style:{tableLayout:"fixed"},children:[t.jsxs("colgroup",{children:[t.jsx("col",{style:{width:28}}),t.jsx("col",{style:{width:"30%"}}),t.jsx("col",{style:{width:"13%"}}),t.jsx("col",{style:{width:"13%"}}),t.jsx("col",{style:{width:40}}),t.jsx("col",{style:{width:"20%"}}),k.map(e=>t.jsx("col",{style:{width:"10%"}},e))]}),t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{style:{background:"#F7F7F5",borderBottom:"1px solid #E5E5E0",position:"sticky",top:0,zIndex:1}}),t.jsx(y,{col:"name",label:"Name"}),t.jsx(y,{col:"kind",label:"Kind"}),t.jsx(y,{col:"layer",label:"Layer"}),t.jsx(y,{col:"status",label:"",width:40}),t.jsx(y,{col:"doc",label:"Description"}),k.map(e=>t.jsx(y,{col:e,label:e},e))]})}),t.jsxs("tbody",{children:[N.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6+k.length,className:"py-16 text-center",style:{fontSize:"13px",color:"#9CA3AF"},children:E||g||b?"No elements match the current filters":"No elements in scope"})}),N.map(e=>{var c;const o=e.id===v,s=T[e.layer]??"#9CA3AF",n=((c=e.doc)==null?void 0:c.trim().slice(0,100))??"";return t.jsxs("tr",{onClick:()=>S(e.id),className:"cursor-pointer",style:{background:o?"#2DD4A812":"transparent",borderBottom:"1px solid #F0F0ED"},onMouseEnter:l=>{o||(l.currentTarget.style.background="#F7F7F5")},onMouseLeave:l=>{o||(l.currentTarget.style.background="transparent")},children:[t.jsx("td",{className:"px-2",children:o&&t.jsx("span",{style:{color:"#2DD4A8",fontSize:"10px"},children:"▶"})}),t.jsxs("td",{className:"px-3 py-2",children:[t.jsx("div",{style:{fontSize:j.xs,fontWeight:500,color:"#1B3A4B",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),e.shortId&&t.jsx("div",{style:{fontSize:"10px",color:"#9CA3AF",fontFamily:"monospace"},children:e.shortId})]}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{style:{fontSize:"10px",fontWeight:600,color:"#374151"},children:e.kind})}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{className:"px-1.5 py-0.5 rounded",style:{fontSize:"10px",fontWeight:600,background:s+"1A",color:s,whiteSpace:"nowrap"},children:D[e.layer]??e.layer})}),t.jsx("td",{className:"px-3 py-2 text-center",children:t.jsx(R,{element:e})}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{style:{fontSize:j.xs,color:"#6B7280",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:n})}),k.map(l=>t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{style:{fontSize:j.xs,color:"#374151",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:e.attributes[l]??""})},l))]},e.id)})]})]})})]})}export{P as TabularView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./reactflow-CsCqNKB-.js";import{a as p}from"./zustand-CrhqMOHB.js";import{u as j,f as w}from"./index-D0vtjNjX.js";const F=[{id:"risk-control",label:"ISO 14971: Risk → Control",description:"Hazards and hazardous situations traced to risk controls",rowKinds:["Hazard","HazardousSituation"],colKinds:["RiskControlMeasure","SafetyGoal"],relationshipTypes:["mitigates","traceTo","causes","leadsTo"]},{id:"req-test",label:"IEC 62304: Requirement → Test",description:"Software requirements traced to verification tests",rowKinds:["Requirement","Requirement","Requirement"],colKinds:["Test"],relationshipTypes:["verify","satisfy","traceTo"]},{id:"req-function",label:"Requirement → Function",description:"Requirements traced to system/component functions",rowKinds:["Requirement","Requirement","Requirement"],colKinds:["Function","Function"],relationshipTypes:["satisfy","traceTo","allocateTo"]},{id:"function-component",label:"Function → Component",description:"Functions allocated to logical/physical components",rowKinds:["Function","Function"],colKinds:["System","Subsystem","Component","LogicalComponent","SoftwareComponent","PhysicalComponent"],relationshipTypes:["allocateTo","traceTo","composedOf"]},{id:"all",label:"All Elements",description:"Full N×N matrix of all elements and relationships",rowKinds:[],colKinds:[],relationshipTypes:[]}];function N({cell:n,onClick:m}){if(!n||n.rels.length===0)return s.jsx("td",{className:"border",style:{borderColor:"#E5E5E0",width:"28px",height:"28px"}});const u=[...new Set(n.rels.map(f=>f.type))],h=n.rels.length>1?"#2DD4A830":"#2DD4A818";return s.jsx("td",{className:"border text-center cursor-pointer",style:{borderColor:"#E5E5E0",background:h,width:"28px",height:"28px"},title:u.join(", "),onClick:m,children:s.jsx("span",{className:"text-xs font-semibold",style:{color:"#1B3A4B",fontSize:"10px"},children:n.rels.length})})}function K(){const n=j(e=>e.model),m=j(e=>e.selectElement),[u,h]=p.useState("risk-control"),[f,g]=p.useState(null),[v,E]=p.useState(null),d=F.find(e=>e.id===u)||F[0],{rows:c,cols:x,matrix:y}=p.useMemo(()=>{if(!n)return{rows:[],cols:[],matrix:new Map};const e=Object.values(n.elements);let i,r;if(d.rowKinds.length===0&&d.colKinds.length===0)i=e,r=e;else{const t=new Set(d.rowKinds),o=new Set(d.colKinds);i=e.filter(l=>t.has(l.kind)),r=e.filter(l=>o.has(l.kind))}i.sort((t,o)=>t.kind.localeCompare(o.kind)||t.name.localeCompare(o.name)),r.sort((t,o)=>t.kind.localeCompare(o.kind)||t.name.localeCompare(o.name));const a=new Map,k=d.relationshipTypes.length>0?new Set(d.relationshipTypes):null,C=new Set(i.map(t=>t.id)),S=new Set(r.map(t=>t.id));for(const t of n.relationships)if(!(k&&!k.has(t.type))){if(C.has(t.sourceId)&&S.has(t.targetId)){const o=`${t.sourceId}:${t.targetId}`,l=a.get(o);l?l.rels.push(t):a.set(o,{rels:[t]})}if(C.has(t.targetId)&&S.has(t.sourceId)){const o=`${t.targetId}:${t.sourceId}`,l=a.get(o);l?l.rels.push(t):a.set(o,{rels:[t]})}}return{rows:i,cols:r,matrix:a}},[n,d]),b=p.useMemo(()=>{const e=new Set;for(const[i]of y){const r=i.split(":")[0];e.add(r)}return e.size},[y]);return n?s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:"#FAFAF8"},children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2",style:{borderBottom:"1px solid #E5E5E0",background:"#FFFFFF"},children:[s.jsx("span",{className:"text-xs font-medium",style:{color:"#6B7280"},children:"Preset:"}),F.map(e=>s.jsx("button",{onClick:()=>h(e.id),className:"px-2 py-1 text-xs rounded-md transition-colors",style:u===e.id?{background:"#2DD4A818",color:"#1B3A4B",fontWeight:600}:{color:"#6B7280"},title:e.description,children:e.label},e.id)),s.jsx("div",{className:"flex-1"}),s.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:[c.length," rows × ",x.length," cols · ",b,"/",c.length," traced (",c.length>0?Math.round(b/c.length*100):0,"%)"]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:c.length===0||x.length===0?s.jsx("div",{className:"flex items-center justify-center h-full text-xs",style:{color:"#9CA3AF"},children:"No elements match the selected preset. Try a different preset or add more model elements."}):s.jsxs("table",{className:"border-collapse text-xs",style:{borderColor:"#E5E5E0"},children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"border px-2 py-1 sticky left-0 z-10",style:{borderColor:"#E5E5E0",background:"#FFFFFF",minWidth:"140px"}}),x.map(e=>(w[e.layer],s.jsx("th",{className:"border px-1 py-1",style:{borderColor:"#E5E5E0",background:v===e.id?"#F0F0ED":"#FFFFFF",writingMode:"vertical-rl",textOrientation:"mixed",maxWidth:"28px",fontSize:"10px",color:"#374151",cursor:"pointer"},onMouseEnter:()=>E(e.id),onMouseLeave:()=>E(null),onClick:()=>m(e.id),title:`${e.name} (${e.kind})`,children:s.jsx("span",{className:"truncate",style:{maxHeight:"100px",display:"block",overflow:"hidden"},children:e.name})},e.id)))]})}),s.jsx("tbody",{children:c.map(e=>{const i=w[e.layer]||"#6B7280";return s.jsxs("tr",{children:[s.jsx("td",{className:"border px-2 py-1 sticky left-0 z-10 cursor-pointer truncate",style:{borderColor:"#E5E5E0",background:f===e.id?"#F0F0ED":"#FFFFFF",maxWidth:"180px",fontSize:"11px",color:"#374151",borderLeft:`3px solid ${i}`},onMouseEnter:()=>g(e.id),onMouseLeave:()=>g(null),onClick:()=>m(e.id),title:`${e.name} (${e.kind})`,children:e.name}),x.map(r=>{const a=y.get(`${e.id}:${r.id}`)||null;return s.jsx(N,{cell:a,onClick:a?()=>m(e.id):void 0},r.id)})]},e.id)})})]})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"#9CA3AF"},children:"No model loaded"})}export{K as TraceabilityMatrix};
|